aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2003-12-18 03:51:21 +0000
committerBill Paul <wpaul@FreeBSD.org>2003-12-18 03:51:21 +0000
commita22ec80eced588e8f57c74312fe233a5e703d21c (patch)
tree5ee952471a833e8a8748d227d48d1f385c5adb16 /sys/dev
parent1e4925e8d398c943cac862ec5c1d0b000c161567 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/if_ndis/if_ndis.c33
-rw-r--r--sys/dev/if_ndis/if_ndisvar.h3
2 files changed, 33 insertions, 3 deletions
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index b6beb3d2b272..5e1f9b9e835c 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -85,7 +85,7 @@ static struct ndis_type ndis_devs[] = {
#ifdef NDIS_DEV_TABLE
NDIS_DEV_TABLE
#endif
- { 0, 0, NULL }
+ { 0, 0, 0, NULL }
};
#define __stdcall __attribute__((__stdcall__))
@@ -178,7 +178,9 @@ ndis_probe(dev)
while(t->ndis_name != NULL) {
if ((pci_get_vendor(dev) == t->ndis_vid) &&
- (pci_get_device(dev) == t->ndis_did)) {
+ (pci_get_device(dev) == t->ndis_did) &&
+ (pci_read_config(dev, PCIR_SUBVEND_0, 4) ==
+ t->ndis_subsys)) {
device_set_desc(dev, t->ndis_name);
return(0);
}
@@ -201,6 +203,9 @@ ndis_attach(dev)
struct ifnet *ifp;
int unit, error = 0, rid, len;
void *img;
+ struct ndis_type *t;
+ int devidx = 0, defidx = 0;
+
sc = device_get_softc(dev);
unit = device_get_unit(dev);
@@ -297,6 +302,30 @@ ndis_attach(dev)
sc->ndis_regvals = ndis_regvals;
sc->ndis_iftype = PCIBus;
+ /* Figure out exactly which device we matched. */
+
+ t = ndis_devs;
+
+ while(t->ndis_name != NULL) {
+ if ((pci_get_vendor(dev) == t->ndis_vid) &&
+ (pci_get_device(dev) == t->ndis_did)) {
+ if (t->ndis_subsys == 0)
+ defidx = devidx;
+ else {
+ if (t->ndis_subsys ==
+ pci_read_config(dev, PCIR_SUBVEND_0, 4))
+ break;
+ }
+ }
+ t++;
+ devidx++;
+ }
+
+ if (ndis_devs[devidx].ndis_name == NULL)
+ sc->ndis_devidx = defidx;
+ else
+ sc->ndis_devidx = devidx;
+
sysctl_ctx_init(&sc->ndis_ctx);
/* Create sysctl registry nodes */
diff --git a/sys/dev/if_ndis/if_ndisvar.h b/sys/dev/if_ndis/if_ndisvar.h
index bc3b90244915..5b9c768218f5 100644
--- a/sys/dev/if_ndis/if_ndisvar.h
+++ b/sys/dev/if_ndis/if_ndisvar.h
@@ -47,6 +47,7 @@ struct ndis_chain {
struct ndis_type {
uint16_t ndis_vid;
uint16_t ndis_did;
+ uint32_t ndis_subsys;
char *ndis_name;
};
@@ -103,6 +104,7 @@ struct ndis_softc {
struct sysctl_ctx_list ndis_ctx;
struct sysctl_oid *ndis_tree;
+ int ndis_devidx;
interface_type ndis_iftype;
bus_dma_tag_t ndis_parent_tag;
@@ -112,7 +114,6 @@ struct ndis_softc {
bus_dmamap_t *ndis_mmaps;
bus_dmamap_t *ndis_tmaps;
int ndis_mmapcnt;
-
};
#define NDIS_LOCK(_sc) mtx_lock(&(_sc)->ndis_mtx)