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

Function main

util/msrtool/msrtool.c:254–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254int main(int argc, char *argv[]) {
255 char c;
256 int ret = 1;
257 const struct sysdef *s;
258 const struct targetdef *t;
259 uint8_t tn, listmsrs = 0, listknown = 0, input = 0;
260 uint32_t addr = 0;
261 const char *streamfn = NULL, *difffn = NULL;
262 struct msr msrval = MSR2(-1, -1);
263 while ((c = getopt(argc, argv, "hqvrklc:m:t:a:i:s:d:")) != -1)
264 switch (c) {
265 case 'h':
266 syntax(argv);
267 return 0;
268 case 'q':
269 quiet = 1;
270 break;
271 case 'v':
272 ++verbose;
273 break;
274 case 'r':
275 reserved = 1;
276 break;
277 case 'k':
278 listknown = 1;
279 break;
280 case 'l':
281 listmsrs = 1;
282 break;
283 case 'c':
284 cpu = atoi(optarg);
285 break;
286 case 'm':
287 for (s = allsystems; !SYSTEM_ISEOT(*s); s++)
288 if (!strcmp(s->name, optarg)) {
289 sys = s;
290 break;
291 }
292 break;
293 case 't':
294 for (t = alltargets; !TARGET_ISEOT(*t); t++)
295 if (!strcmp(t->name, optarg)) {
296 add_target(t);
297 break;
298 }
299 break;
300 case 'i':
301 input = 1;
302 addr = msraddrbyname(optarg);
303 optarg = strchr(optarg, '=');
304 if (NULL == optarg) {
305 fprintf(stderr, "missing value in -i argument!\n");
306 break;
307 }
308 if (!str2msr(++optarg, &msrval, NULL))
309 fprintf(stderr, "invalid value in -i argument!\n");
310 break;
311 case 's':

Callers

nothing calls this directly

Calls 15

getoptFunction · 0.85
syntaxFunction · 0.85
add_targetFunction · 0.85
msraddrbynameFunction · 0.85
fprintfFunction · 0.85
str2msrFunction · 0.85
pci_allocFunction · 0.85
printfFunction · 0.85
dumpmsrdefsFunction · 0.85
decodemsrFunction · 0.85
do_streamFunction · 0.85
do_diffFunction · 0.85

Tested by

no test coverage detected