iPXE
Data Structures | Functions | Variables
fdt_cmd.c File Reference

Flattened Device Tree commands. More...

#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <usr/imgmgmt.h>
#include <usr/fdtmgmt.h>

Go to the source code of this file.

Data Structures

struct  fdt_options
 "fdt" options More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int fdt_exec (int argc, char **argv)
 The "fdt" command. More...
 
 COMMAND (fdt, fdt_exec)
 Flattened Device Tree commands. More...
 

Variables

static struct option_descriptor fdt_opts []
 "fdt" option list More...
 
static struct command_descriptor fdt_cmd
 "fdt" command descriptor More...
 

Detailed Description

Flattened Device Tree commands.

Definition in file fdt_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ fdt_exec()

static int fdt_exec ( int  argc,
char **  argv 
)
static

The "fdt" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 61 of file fdt_cmd.c.

61  {
62  struct fdt_options opts;
63  struct image *image = NULL;
64  char *name_uri;
65  int rc;
66 
67  /* Parse options */
68  if ( ( rc = parse_options ( argc, argv, &fdt_cmd, &opts ) ) != 0 )
69  goto err_parse;
70 
71  /* Parse name/URI string */
72  name_uri = argv[optind];
73 
74  /* Acquire image, if applicable */
75  if ( name_uri && ( ( rc = imgacquire ( name_uri, opts.timeout,
76  &image ) ) != 0 ) ) {
77  goto err_image;
78  }
79 
80  /* (Un)register as FDT */
81  if ( ( rc = imgfdt ( image ) ) != 0 )
82  goto err_fdt;
83 
84  err_fdt:
85  err_image:
86  err_parse:
87  return rc;
88 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int optind
Current option index.
Definition: getopt.c:51
int imgfdt(struct image *image)
Apply flattened device tree image.
Definition: fdtmgmt.c:41
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition: parseopt.c:484
An executable image.
Definition: image.h:23
"fdt" options
Definition: fdt_cmd.c:39
static struct command_descriptor fdt_cmd
"fdt" command descriptor
Definition: fdt_cmd.c:51
static union @447 opts
"cert<xxx>" option list
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
int imgacquire(const char *name_uri, unsigned long timeout, struct image **image)
Acquire an image.
Definition: imgmgmt.c:142

References fdt_cmd, imgacquire(), imgfdt(), NULL, optind, opts, parse_options(), and rc.

◆ COMMAND()

COMMAND ( fdt  ,
fdt_exec   
)

Flattened Device Tree commands.

Variable Documentation

◆ fdt_opts

struct option_descriptor fdt_opts[]
static
Initial value:
= {
OPTION_DESC ( "timeout", 't', required_argument,
}
int parse_timeout(char *text, unsigned long *value)
Parse timeout value (in ms)
Definition: parseopt.c:114
"fdt" options
Definition: fdt_cmd.c:39
#define OPTION_DESC(_longopt, _shortopt, _has_arg, _struct, _field, _parse)
Construct option descriptor.
Definition: parseopt.h:67
Option requires an argument.
Definition: getopt.h:18
void timeout(int)

"fdt" option list

Definition at line 45 of file fdt_cmd.c.

◆ fdt_cmd

struct command_descriptor fdt_cmd
static
Initial value:
=
COMMAND_DESC ( struct fdt_options, fdt_opts, 0, 1, "[<uri>]" )
static struct option_descriptor fdt_opts[]
"fdt" option list
Definition: fdt_cmd.c:45
"fdt" options
Definition: fdt_cmd.c:39
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition: parseopt.h:108

"fdt" command descriptor

Definition at line 51 of file fdt_cmd.c.

Referenced by fdt_exec().