summaryrefslogtreecommitdiff
path: root/util/msrtool/sys.c
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2008-11-25 02:03:16 +0000
committerPeter Stuge <peter@stuge.se>2008-11-25 02:03:16 +0000
commit0924dee124acfd1f8ae96685720c7a4af068e843 (patch)
tree00321ecd5b104f533af8b1d170c79761b6f7cdf3 /util/msrtool/sys.c
parentef8ea01c8c6638e4cf3a9ed32857e14c3f6e7cbc (diff)
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
Diffstat (limited to 'util/msrtool/sys.c')
-rw-r--r--util/msrtool/sys.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/util/msrtool/sys.c b/util/msrtool/sys.c
index 95539c8677..cc2cc4e7c0 100644
--- a/util/msrtool/sys.c
+++ b/util/msrtool/sys.c
@@ -17,6 +17,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <pci/pci.h>
+
#include "msrtool.h"
static struct cpuid_t id;
@@ -40,3 +42,18 @@ struct cpuid_t *cpuid(void) {
}
return &id;
}
+
+struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device) {
+ struct pci_dev *temp;
+ struct pci_filter filter;
+
+ pci_filter_init(NULL, &filter);
+ filter.vendor = vendor;
+ filter.device = device;
+
+ for (temp = pacc->devices; temp; temp = temp->next)
+ if (pci_filter_match(&filter, temp))
+ return temp;
+
+ return NULL;
+}