Finally! I think this is bug free, but please have a look. :)
syntax: ./msrtool [-hvqrkl] [-c cpu] [-m system] [-t target ...] [-i addr=hi[:]lo] | [-s file] | [-d [:]file] | addr... -h show this help text -v be verbose -q be quiet (overrides -v) -r include [Reserved] values -k list all known systems and targets -l list MSRs and bit fields for current target(s) (-kl for ALL targets!) -c access MSRs on the specified CPU, default=0 -m force a system, e.g: -m linux -t force a target, can be used multiple times, e.g: -t geodelx -t cs5536 -i immediate mode decode hex addr=hi:lo for the target without reading hw value e.g: -i 4c00000f=f2f100ff56960004 -s stream mode read one MSR address per line and append current hw value to the line use the filename - for stdin/stdout using -l -s ignores input and will output all MSRs with values -d diff mode read one address and value per line and compare with current hw value, printing differences to stdout. use the filename - to read from stdin use :file or :- to reverse diff, normally hw values are considered new addr.. direct mode, read and decode values for the given MSR address(es)
All functionality is implemented, but the only supported system at the moment is Linux using /dev/cpu/*/msr, and the only target with a MSR definition is geodelx, where only MSR 4c00000f has been defined.
Please play around with it and if you think it looks good let's commit it and start adding more MSR definitions (and systems).
-s and -d are meant to compare setup between different firmware runs.
Boot firmwre one and run msrtool -ls filename, boot firmware two and run msrtool -d filename. The output looks like this: (fake example)
# ./msrtool -dfilename msrtool exported Detected system linux: Linux with /dev/cpu/*/msr Forced target geodelx: AMD Geode(tm) LX
# GLCP_DELAY_CONTROLS -0x4c00000f 0x0000000000000000 +0x4c00000f 0x000000000000000a # 15:14 D_VIPCLK Input delay for VIPCLK -0 +2 # 13 H_SDCLK Half SDCLK hold select (for cmd addr) -0: Full SDCLK setup +1: Half SDCLK setup for MA and BA # 4:0 DLL_OVS/RSDA DLL Override Setting or Read Strobe Delay Adjust -0 +10
If I get an ack I'll use something like this as commit message:
msrtool: Release Candidate 1
msrtool can decode MSRs and print the value of every field in human readable form. It can also be used to save a set of MSRs to a file, and at a later time compare the saved values with current values in hardware.
Signed-off-by: Peter Stuge peter@stuge.se