summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2009-09-30 15:28:43 +0000
committerThierry Vignaud <tv@mandriva.org>2009-09-30 15:28:43 +0000
commitbffbc31041d40fad268821f038a387a3eebd7022 (patch)
treebfd7e17a8f93fa58eeadd5ddea54326baaf9a611
parentb9ea6c995aec55772860a4fed36ebce33b607548 (diff)
downloadldetect-bffbc31041d40fad268821f038a387a3eebd7022.tar
ldetect-bffbc31041d40fad268821f038a387a3eebd7022.tar.gz
ldetect-bffbc31041d40fad268821f038a387a3eebd7022.tar.bz2
ldetect-bffbc31041d40fad268821f038a387a3eebd7022.tar.xz
ldetect-bffbc31041d40fad268821f038a387a3eebd7022.zip
(pci_probe) reuse more stuff from libpci in order to retrieve PCI sub
ids, class and revision
-rw-r--r--pci.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/pci.c b/pci.c
index 4fe4f1d..bd95345 100644
--- a/pci.c
+++ b/pci.c
@@ -29,7 +29,6 @@ static void __attribute__((noreturn)) error_and_die(char *msg, ...)
extern struct pciusb_entries pci_probe(void) {
u8 buf[BUF_SIZE];
- unsigned short *bufi = (unsigned short *) &buf;
struct pciusb_entries r;
static struct pci_access *pacc;
@@ -76,17 +75,17 @@ extern struct pciusb_entries pci_probe(void) {
e->pci_function = dev->func;
e->class_id = dev->device_class;
- /* we divide by 2 because we address the array as a word array since we read a word */
- e->subvendor = bufi[PCI_SUBSYSTEM_VENDOR_ID/2]; // == (u16)!(buf[PCI_SUBSYSTEM_VENDOR_ID] | (buf[PCI_SUBSYSTEM_VENDOR_ID+1] << 8))
- e->subdevice = bufi[PCI_SUBSYSTEM_ID/2];
- e->pci_revision = buf[PCI_CLASS_REVISION];
+ e->subvendor = pci_read_word(dev, PCI_SUBSYSTEM_VENDOR_ID);
+ e->subdevice = pci_read_word(dev, PCI_SUBSYSTEM_ID);
+
+ e->pci_revision = pci_read_byte(dev, PCI_REVISION_ID);
if ((e->subvendor == 0 && e->subdevice == 0) ||
(e->subvendor == e->vendor && e->subdevice == e->device)) {
e->subvendor = 0xffff;
e->subdevice = 0xffff;
}
- class_prog = buf[PCI_CLASS_PROG];
+ class_prog = pci_read_byte(dev, PCI_CLASS_PROG);
if (e->vendor == 0x10ec && e->device == 0x8139) {
if (e->pci_revision < 0x20)