summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Herrmann <andreas.herrmann3@amd.com>2011-05-31 09:04:52 +0200
committerDave Jones <davej@redhat.com>2011-05-31 03:09:32 -0400
commit3ae5b48b30e7d6c1be98fa3b7b3788d90341b5d6 (patch)
tree4f2b04609b0d719a1179d79d6346572725638eae
parent02193406f44bd2737a372b5ed0ec63e4e8bc547e (diff)
lsmsr: Add support to show MSRs for which no description is provided
Of course no verbose information but only the plain value of the register (if it's a valid MSR address) can be provided. Example: # lsmsr -r 0xdeadbeef -l warning: unknown MSR deadbeef unknown: 0xdeadbeef; (at your own risk) # lsmsr -r 0xdeadbeef warning: unknown MSR deadbeef could not read MSR 0xdeadbeef ((null)): Input/output error unknown = 0x0000000000000000 Artificial example (forcing use of family 0xf register description and showing PstateControl MSR on a family 0x10 CPU): # ./lsmsr -r 0xc0010062 -f 0xf warning: unknown MSR c0010062 unknown = 0x0000000000000003 Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
-rw-r--r--lsmsr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lsmsr.c b/lsmsr.c
index 1a00bc2..c03950e 100644
--- a/lsmsr.c
+++ b/lsmsr.c
@@ -308,6 +308,8 @@ static int set_msr_table(void)
return 0;
}
+struct reg_spec unknown_msr = {0, "unknown", "(at your own risk)", NULL, NULL};
+
#define OPT_MAX 32
int main(int argc, char *argv[])
{
@@ -400,8 +402,10 @@ int main(int argc, char *argv[])
reg = get_reg_spec(g.reg, g.msr_table);
if (!reg) {
fflush(stdout);
- fprintf(stderr, "error: unknown MSR %x\n", g.reg);
- goto out;
+ fprintf(stderr, "warning: unknown MSR %x\n", g.reg);
+ g.verbosity = 0;
+ unknown_msr.address = g.reg;
+ reg = &unknown_msr;
}
if (_show_msr(reg))
goto out;