msrtool: Use libpci to let system and target probes find PCI devices.

And some more notes in TODO.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3770 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Peter Stuge
2008-11-25 02:03:16 +00:00
parent ef8ea01c8c
commit 0924dee124
5 changed files with 53 additions and 1 deletions

View File

@ -25,6 +25,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <pci/pci.h>
#include "msrtool.h"
@ -36,6 +37,8 @@ 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 },
@ -296,6 +299,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);