summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortijl <tijl@FreeBSD.org>2010-12-19 11:14:34 +0000
committertijl <tijl@FreeBSD.org>2010-12-19 11:14:34 +0000
commit9a41478439793acf8c1998e7f249f0e9afc545c7 (patch)
treea683fbeb3b12c59f317f685d84704c30a161fb2d
parentfb1c27a83b3ccf75e8eae46e07b288ca5cc1d680 (diff)
downloadFreeBSD-src-9a41478439793acf8c1998e7f249f0e9afc545c7.zip
FreeBSD-src-9a41478439793acf8c1998e7f249f0e9afc545c7.tar.gz
Fix a bug introduced in r216518. The ndis_subsys field holds the PCI
subdevice ID in addition to the subvendor ID. Reported by: Paul B Mahol 'onemda gmail com' Approved by: kib (mentor)
-rw-r--r--sys/dev/if_ndis/if_ndis_pci.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/if_ndis/if_ndis_pci.c b/sys/dev/if_ndis/if_ndis_pci.c
index ff93df3..2b9ad1e 100644
--- a/sys/dev/if_ndis/if_ndis_pci.c
+++ b/sys/dev/if_ndis/if_ndis_pci.c
@@ -110,14 +110,20 @@ ndis_devcompare(bustype, t, dev)
struct ndis_pci_type *t;
device_t dev;
{
+ uint16_t vid, did;
+ uint32_t subsys;
+
if (bustype != PCIBus)
return(FALSE);
+ vid = pci_get_vendor(dev);
+ did = pci_get_device(dev);
+ subsys = pci_get_subdevice(dev);
+ subsys = (subsys << 16) | pci_get_subvendor(dev);
+
while(t->ndis_name != NULL) {
- if ((pci_get_vendor(dev) == t->ndis_vid) &&
- (pci_get_device(dev) == t->ndis_did) &&
- (pci_get_subvendor(dev) == t->ndis_subsys ||
- t->ndis_subsys == 0)) {
+ if ((t->ndis_vid == vid) && (t->ndis_did == did) &&
+ (t->ndis_subsys == subsys || t->ndis_subsys == 0)) {
device_set_desc(dev, t->ndis_name);
return(TRUE);
}
@@ -169,6 +175,8 @@ ndis_attach_pci(dev)
struct resource_list *rl;
struct resource_list_entry *rle;
struct drvdb_ent *db;
+ uint16_t vid, did;
+ uint32_t subsys;
sc = device_get_softc(dev);
unit = device_get_unit(dev);
@@ -300,14 +308,18 @@ ndis_attach_pci(dev)
/* Figure out exactly which device we matched. */
+ vid = pci_get_vendor(dev);
+ did = pci_get_device(dev);
+ subsys = pci_get_subdevice(dev);
+ subsys = (subsys << 16) | pci_get_subvendor(dev);
+
t = db->windrv_devlist;
while(t->ndis_name != NULL) {
- if ((pci_get_vendor(dev) == t->ndis_vid) &&
- (pci_get_device(dev) == t->ndis_did)) {
+ if (t->ndis_vid == vid && t->ndis_did == did) {
if (t->ndis_subsys == 0)
defidx = devidx;
- else if (pci_get_subvendor(dev) == t->ndis_subsys)
+ else if (t->ndis_subsys == subsys)
break;
}
t++;
OpenPOWER on IntegriCloud