diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | libldetect.h | 1 | ||||
-rw-r--r-- | pci.c | 12 | ||||
-rw-r--r-- | pciusb.c | 1 |
4 files changed, 14 insertions, 1 deletions
@@ -1,4 +1,5 @@ - do not display random revisions for USB devices +- retrieve PCI capabilities in order to better identify PCI Express devices Version 0.9.1 - 28 September 2009, Thierry Vignaud diff --git a/libldetect.h b/libldetect.h index e3b9b6a..36526de 100644 --- a/libldetect.h +++ b/libldetect.h @@ -20,6 +20,7 @@ struct pciusb_entry { unsigned short pci_revision:8; /* pci revision 8 bits wide */ unsigned short usb_port; /* pci function id 3 bits wide */ + unsigned short is_pciexpress:1; /* is it PCI express */ char *module; char *text; @@ -9,6 +9,7 @@ #include <fcntl.h> #include <unistd.h> #include <dirent.h> +#include <pci/header.h> #include "common.h" #define CONFIG_SPACE_ZIZE 64 @@ -34,6 +35,7 @@ extern struct pciusb_entries pci_probe(void) { static struct pci_access *pacc; struct pci_dev *dev; char classbuf[128], vendorbuf[128], devbuf[128]; + struct pci_cap *cap; pacc = pci_alloc(); @@ -56,7 +58,7 @@ extern struct pciusb_entries pci_probe(void) { memset(buf, 0, BUF_SIZE); // make sure not to retrieve values from previous devices pci_setup_cache(dev, (u8*)buf, CONFIG_SPACE_ZIZE); pci_read_block(dev, 0, buf, CONFIG_SPACE_ZIZE); - pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_CLASS); + pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_CLASS | PCI_FILL_CAPS | PCI_FILL_EXT_CAPS); pciusb_initialize(e); @@ -87,6 +89,14 @@ extern struct pciusb_entries pci_probe(void) { } class_prog = pci_read_byte(dev, PCI_CLASS_PROG); + for (cap = dev->first_cap; cap; cap = cap->next) { + switch (cap->id) { + case PCI_CAP_ID_EXP: + e->is_pciexpress = 1; + break; + } + } + if (e->vendor == 0x10ec && e->device == 0x8139) { if (e->pci_revision < 0x20) e->module = strdup("8139too"); @@ -178,6 +178,7 @@ extern void pciusb_initialize(struct pciusb_entry *e) { e->text = NULL; e->class = NULL; e->already_found = 0; + e->is_pciexpress = 0; } extern void pciusb_free(struct pciusb_entries *entries) { |