msrtool: Very small fixes I made after sending out the rc1 tarball.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3767 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Peter Stuge 2008-11-22 18:29:44 +00:00
parent dad1e3091f
commit cc9db9dfa0
1 changed files with 7 additions and 8 deletions

View File

@ -25,7 +25,7 @@
static void print_bitdef(FILE *f, const struct msrbits *mb, const char *tail) { static void print_bitdef(FILE *f, const struct msrbits *mb, const char *tail) {
uint8_t endbit; uint8_t endbit;
if (!reserved && !strcmp(mb->name, "RSVD")) if (!reserved && 0 == strcmp(mb->name, "RSVD"))
return; return;
if (1 == mb->size) if (1 == mb->size)
fprintf(f, "# %5d", mb->start); fprintf(f, "# %5d", mb->start);
@ -33,7 +33,7 @@ static void print_bitdef(FILE *f, const struct msrbits *mb, const char *tail) {
endbit = mb->start - mb->size + 1; endbit = mb->start - mb->size + 1;
fprintf(f, "# %*d:%d", endbit < 10 ? 3 : 2, mb->start, endbit); fprintf(f, "# %*d:%d", endbit < 10 ? 3 : 2, mb->start, endbit);
} }
if (!strcmp(mb->name, "RSVD")) if (0 == strcmp(mb->name, "RSVD"))
fprintf(f, " [%s]", mb->desc); fprintf(f, " [%s]", mb->desc);
else else
fprintf(f, " %s %s", mb->name, mb->desc); fprintf(f, " %s %s", mb->name, mb->desc);
@ -55,7 +55,6 @@ static void print_bitval(FILE *f, const struct msrbits *mb, const struct msr val
fprintf(f, "%d", (tmp.hi || tmp.lo) ? 1 : 0); fprintf(f, "%d", (tmp.hi || tmp.lo) ? 1 : 0);
mask = msr_shr(mask, 1); mask = msr_shr(mask, 1);
} }
/* TODO */
break; break;
case PRESENT_DEC: case PRESENT_DEC:
fprintf(f, "%d", val.lo); fprintf(f, "%d", val.lo);
@ -141,7 +140,7 @@ const struct msrdef *findmsrdef(const uint32_t addr) {
void dumpmsrdefs(const struct targetdef *t) { void dumpmsrdefs(const struct targetdef *t) {
const struct msrdef *m; const struct msrdef *m;
const struct msrbits *mb; const struct msrbits *mb;
if (!t) if (NULL == t)
return; return;
printf("# %s MSRs:\n", t->name); printf("# %s MSRs:\n", t->name);
for (m = t->msrs; !MSR_ISEOT(*m); m++) { for (m = t->msrs; !MSR_ISEOT(*m); m++) {
@ -158,7 +157,7 @@ int dumpmsrdefsvals(FILE *f, const struct targetdef *t, const uint8_t cpu) {
struct msr val = MSR1(0); struct msr val = MSR1(0);
const struct msrdef *m; const struct msrdef *m;
const struct msrbits *mb; const struct msrbits *mb;
if (!t) if (NULL == t)
return 1; return 1;
fprintf(f, "# %s MSRs:\n", t->name); fprintf(f, "# %s MSRs:\n", t->name);
for (m = t->msrs; !MSR_ISEOT(*m); m++) { for (m = t->msrs; !MSR_ISEOT(*m); m++) {
@ -225,10 +224,10 @@ void decodemsr(const uint8_t cpu, const uint32_t addr, const struct msr val) {
const struct msrdef *m = findmsrdef(addr); const struct msrdef *m = findmsrdef(addr);
const struct msrbits *mb; const struct msrbits *mb;
if (m) if (NULL != m)
printf("# %s ", m->symbol); printf("# %s ", m->symbol);
printf("0x%08x = 0x%08x%08x\n", addr, val.hi, val.lo); printf("0x%08x = 0x%08x%08x\n", addr, val.hi, val.lo);
if (!m) { if (NULL == m) {
fprintf(stderr, "Sorry - no definition exists for this MSR! Please add it and send a signed-off\n"); fprintf(stderr, "Sorry - no definition exists for this MSR! Please add it and send a signed-off\n");
fprintf(stderr, "patch to coreboot@coreboot.org. Thanks for your help!\n"); fprintf(stderr, "patch to coreboot@coreboot.org. Thanks for your help!\n");
return; return;
@ -266,7 +265,7 @@ uint8_t diff_msr(FILE *f, const uint32_t addr, const struct msr a, const struct
if (a.hi == b.hi && a.lo == b.lo) if (a.hi == b.hi && a.lo == b.lo)
return 0; return 0;
if (!m) { if (NULL == m) {
fprintf(stderr, "MSR 0x%08x has no definition! Please add it and send a Signed-off-by patch\n", addr); fprintf(stderr, "MSR 0x%08x has no definition! Please add it and send a Signed-off-by patch\n", addr);
fprintf(stderr, "to coreboot@coreboot.org. Thank you for your help!\n"); fprintf(stderr, "to coreboot@coreboot.org. Thank you for your help!\n");
return 1; return 1;