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

Function decodemsr

util/msrtool/msrutils.c:266–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void decodemsr(const uint8_t cpu, const uint32_t addr, const struct msr val) {
267 struct msr bitval, mask;
268 const struct msrdef *m = findmsrdef(addr);
269 const struct msrbits *mb;
270
271 if (NULL != m)
272 printf("# %s ", m->symbol);
273 printf("0x%08x = 0x%08x%08x\n", addr, val.hi, val.lo);
274 if (NULL == m) {
275 fprintf(stderr, "Sorry - no definition exists for this MSR! Please add it and send a signed-off\n");
276 fprintf(stderr, "patch to coreboot@coreboot.org. Thanks for your help!\n");
277 return;
278 }
279
280 for (mb = m->bits; mb->size; mb++) {
281 if (!reserved && 0 == strcmp(mb->name, "RSVD"))
282 continue;
283 print_bitdef(stdout, mb, " = ");
284 mask.hi = mask.lo = 0xffffffff;
285 mask = msr_shr(mask, 64 - mb->size);
286 bitval = msr_shr(val, mb->start - mb->size + 1);
287 msr_and(&bitval, mask);
288 print_bitval(stdout, mb, bitval);
289 }
290}
291
292/**
293 * Compare two MSR values and print any differences with field definitions and

Callers 1

mainFunction · 0.85

Calls 8

findmsrdefFunction · 0.85
printfFunction · 0.85
fprintfFunction · 0.85
print_bitdefFunction · 0.85
msr_shrFunction · 0.85
msr_andFunction · 0.85
print_bitvalFunction · 0.85
strcmpFunction · 0.50

Tested by

no test coverage detected