MCPcopy Create free account
hub / github.com/coreboot/coreboot / main

Function main

util/cbmem/cbmem.c:1080–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078}
1079
1080int main(int argc, char** argv)
1081{
1082 int print_defaults = 1;
1083 int print_console = 0;
1084 int print_coverage = 0;
1085 int print_list = 0;
1086 int print_hexdump = 0;
1087 int print_rawdump = 0;
1088 int print_tcpa_log = 0;
1089 enum timestamps_print_type timestamp_type = TIMESTAMPS_PRINT_NONE;
1090 enum console_print_type console_type = CONSOLE_PRINT_FULL;
1091 unsigned int rawdump_id = 0;
1092 int max_loglevel = BIOS_NEVER;
1093 int print_unknown_logs = 1;
1094 uint32_t timestamp_id = 0;
1095 enum cbmem_drv_backend_type backend_type = CBMEM_DRV_BACKEND_ANY;
1096
1097 int opt, option_index = 0;
1098 static struct option long_options[] = {
1099 {"console", 0, 0, 'c'},
1100 {"backend", required_argument, 0, 'b'},
1101 {"oneboot", 0, 0, '1'},
1102 {"2ndtolast", 0, 0, '2'},
1103 {"loglevel", required_argument, 0, 'B'},
1104 {"coverage", 0, 0, 'C'},
1105 {"list", 0, 0, 'l'},
1106 {"tcpa-log", 0, 0, 'L'},
1107 {"timestamps", 0, 0, 't'},
1108 {"parseable-timestamps", 0, 0, 'T'},
1109 {"stacked-timestamps", 0, 0, 'S'},
1110 {"add-timestamp", required_argument, 0, 'a'},
1111 {"hexdump", 0, 0, 'x'},
1112 {"rawdump", required_argument, 0, 'r'},
1113 {"verbose", 0, 0, 'V'},
1114 {"version", 0, 0, 'v'},
1115 {"help", 0, 0, 'h'},
1116 {0, 0, 0, 0}
1117 };
1118 while ((opt = getopt_long(argc, argv, "cb:12B:CltTSa:LxVvh?r:",
1119 long_options, &option_index)) != EOF) {
1120 switch (opt) {
1121 case 'c':
1122 print_console = 1;
1123 print_defaults = 0;
1124 break;
1125 case 'b':
1126 if (!strcasecmp(optarg, "devmem"))
1127 backend_type = CBMEM_DRV_BACKEND_DEVMEM;
1128 else if (!strcasecmp(optarg, "sysfs"))
1129 backend_type = CBMEM_DRV_BACKEND_SYSFS;
1130 else if (!strcasecmp(optarg, "any"))
1131 backend_type = CBMEM_DRV_BACKEND_ANY;
1132 else
1133 die("Unrecognized backend type: '%s'\n", optarg);
1134 break;
1135
1136 case '1':
1137 print_console = 1;

Callers

nothing calls this directly

Calls 15

getopt_longFunction · 0.85
strcasecmpFunction · 0.85
parse_loglevelFunction · 0.85
exitFunction · 0.85
fprintfFunction · 0.85
cbmem_drv_initFunction · 0.85
dump_consoleFunction · 0.85
dump_coverageFunction · 0.85
dump_cbmem_tocFunction · 0.85
dump_cbmem_hexFunction · 0.85
dump_cbmem_rawFunction · 0.85

Tested by

no test coverage detected