X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=util%2Fmsrtool%2Fmsrtool.c;h=2bb8ded8ba51fa7bea946ab4e68d6800fbdcf742;hb=9f26b8f7108f96dba4872fd344d7f102a19734d3;hp=6f0b3a01095959739a37208fb4cc0f88efb3eb99;hpb=dad1e3091f2d9a3fc03b9ca83c2990e23b4ea32c;p=coreboot.git diff --git a/util/msrtool/msrtool.c b/util/msrtool/msrtool.c index 6f0b3a010..2bb8ded8b 100644 --- a/util/msrtool/msrtool.c +++ b/util/msrtool/msrtool.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "msrtool.h" @@ -36,9 +37,12 @@ const struct targetdef **targets = NULL; const struct sysdef *sys = NULL; uint8_t reserved = 0, verbose = 0, quiet = 0; +struct pci_access *pacc = NULL; + static struct targetdef alltargets[] = { { "geodelx", "AMD Geode(tm) LX", geodelx_probe, geodelx_msrs }, { "cs5536", "AMD Geode(tm) CS5536", cs5536_probe, cs5536_msrs }, + { "K8", "AMD K8 Family", k8_probe, k8_msrs }, { TARGET_EOT } }; @@ -275,7 +279,7 @@ int main(int argc, char *argv[]) { break; case 'i': input = 1; - addr = strtoul(optarg, NULL, 16); + addr = msraddrbyname(optarg); optarg = strchr(optarg, '='); if (NULL == optarg) { fprintf(stderr, "missing value in -i argument!\n"); @@ -296,6 +300,14 @@ int main(int argc, char *argv[]) { printf_quiet("msrtool %s\n", VERSION); + pacc = pci_alloc(); + if (NULL == pacc) { + fprintf(stderr, "Could not initialize PCI library! pci_alloc() failed.\n"); + return 1; + } + pci_init(pacc); + pci_scan_bus(pacc); + if (!sys && !input && !listknown) for (sys = allsystems; !SYSTEM_ISEOT(*sys); sys++) { printf_verbose("Probing for system %s: %s\n", sys->name, sys->prettyname); @@ -338,6 +350,7 @@ int main(int argc, char *argv[]) { if (sys && !sys->name) { fprintf(stderr, "Unable to detect the current operating system!\n"); + fprintf(stderr, "On Linux, please do 'modprobe msr' and retry.\n"); fprintf(stderr, "Please send a report or patch to coreboot@coreboot.org. Thanks for your help!\n"); fprintf(stderr, "\n"); } @@ -387,7 +400,7 @@ int main(int argc, char *argv[]) { } for (; optind < argc; optind++) { - addr = strtoul(argv[optind], NULL, 16); + addr = msraddrbyname(argv[optind]); if (!sys->rdmsr(cpu, addr, &msrval)) break; decodemsr(cpu, addr, msrval);