xref: /aosp_15_r20/external/coreboot/util/nvramtool/cli/opts.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef OPTS_H
4 #define OPTS_H
5 
6 #include "common.h"
7 
8 typedef enum { NVRAMTOOL_OP_SHOW_VERSION = 0,
9 	NVRAMTOOL_OP_SHOW_USAGE,
10 	NVRAMTOOL_OP_LBTABLE_SHOW_INFO,
11 	NVRAMTOOL_OP_LBTABLE_DUMP,
12 	NVRAMTOOL_OP_SHOW_PARAM_VALUES,
13 	NVRAMTOOL_OP_CMOS_SHOW_ONE_PARAM,
14 	NVRAMTOOL_OP_CMOS_SHOW_ALL_PARAMS,
15 	NVRAMTOOL_OP_CMOS_SET_ONE_PARAM,
16 	NVRAMTOOL_OP_CMOS_SET_PARAMS_STDIN,
17 	NVRAMTOOL_OP_CMOS_SET_PARAMS_FILE,
18 	NVRAMTOOL_OP_CMOS_CHECKSUM,
19 	NVRAMTOOL_OP_SHOW_LAYOUT,
20 	NVRAMTOOL_OP_WRITE_CMOS_DUMP,
21 	NVRAMTOOL_OP_READ_CMOS_DUMP,
22 	NVRAMTOOL_OP_SHOW_CMOS_HEX_DUMP,
23 	NVRAMTOOL_OP_SHOW_CMOS_DUMPFILE,
24 	NVRAMTOOL_OP_WRITE_BINARY_FILE,
25 	NVRAMTOOL_OP_WRITE_HEADER_FILE
26 } nvramtool_op_t;
27 
28 typedef struct {
29 	nvramtool_op_t op;
30 	char *param;
31 } nvramtool_op_info_t;
32 
33 typedef enum { NVRAMTOOL_MOD_SHOW_VALUE_ONLY = 0,
34 	NVRAMTOOL_MOD_USE_CMOS_LAYOUT_FILE,
35 	NVRAMTOOL_MOD_USE_CBFS_FILE,
36 	NVRAMTOOL_MOD_USE_CMOS_FILE,
37 	NVRAMTOOL_MOD_USE_CMOS_OPT_TABLE,
38 	NVRAMTOOL_NUM_OP_MODIFIERS	/* must always be last */
39 } nvramtool_op_modifier_t;
40 
41 typedef struct {
42 	int found;
43 	int found_seq;
44 	char *param;
45 } nvramtool_op_modifier_info_t;
46 
47 extern nvramtool_op_info_t nvramtool_op;
48 
49 extern nvramtool_op_modifier_info_t nvramtool_op_modifiers[];
50 
51 void parse_nvramtool_args(int argc, char *argv[]);
52 
53 #endif				/* OPTS_H */
54