Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2001 17:58:35 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Nick Sayer <nsayer@FreeBSD.ORG>
Cc:        freebsd-mobile@FreeBSD.ORG
Subject:   Re: Netgear MA301 and other PIX based PrismII PCI adapters
Message-ID:  <20010822175835.A19864@Odin.AC.HMC.Edu>
In-Reply-To: <200108230037.f7N0b6k15312@morpheus.kfu.com>; from nsayer@FreeBSD.ORG on Wed, Aug 22, 2001 at 05:37:01PM -0700
References:  <2672.216.101.175.66.998515230.squirrel@medusa.kfu.com> <200108230037.f7N0b6k15312@morpheus.kfu.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Wed, Aug 22, 2001 at 05:37:01PM -0700, Nick Sayer wrote:
> So it would appear that PrismII vendors all tend to do the same thing, but 
> with different vendor/device ID numbers. This means that if_wi should really 
> have some sort of list of them that is easily extendable. I will see what I 
> can do and contact the wi maintainer, if there is one.

How's the following look?  It models the code in an.  Of course the real
solution is that someone needs to figure out loadable PCI ids so you
don't need kernel recompile to add two numbers and a string to a list.

-- Brooks

Index: if_wi.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/wi/if_wi.c,v
retrieving revision 1.54
diff -u -r1.54 if_wi.c
--- if_wi.c	26 May 2001 09:27:06 -0000	1.54
+++ if_wi.c	23 Aug 2001 00:55:01 -0000
@@ -119,6 +119,29 @@
 static u_int8_t	wi_mcast_addr[6] = { 0x01, 0x60, 0x1D, 0x00, 0x01, 0x00 };
 #endif
 
+struct wi_type {
+	u_int16_t		wi_vid;
+	u_int16_t		wi_did;
+	char			*wi_name;
+	int			wi_prism2;
+};
+
+static struct wi_type wi_devs[] = {
+	{
+		WI_PCI_VENDOR_EUMITCOM,
+		WI_PCI_DEVICE_PRISM2STA,
+		"PRISM2STA PCI WaveLAN/IEEE 802.11",
+		1
+	},
+	{
+		WI_PCI_VENDOR_NETGEAR,
+		WI_PCI_DEVICE_MA301,
+		"Netgear MA401 PCI 802.11 Wireless Adaptor",
+		1
+	},
+	{ 0, 0, NULL, 0 }
+};
+
 static void wi_intr		__P((void *));
 static void wi_reset		__P((struct wi_softc *));
 static int wi_ioctl		__P((struct ifnet *, u_long, caddr_t));
@@ -257,14 +280,19 @@
 	device_t	dev;
 {
 	struct wi_softc		*sc;
+	struct wi_type		*t;
 
+	t = wi_devs;
 	sc = device_get_softc(dev);
-	if ((pci_get_vendor(dev) == WI_PCI_VENDOR_EUMITCOM) &&
-		(pci_get_device(dev) == WI_PCI_DEVICE_PRISM2STA)) {
-			sc->wi_prism2 = 1;
-			device_set_desc(dev,
-			    "PRISM2STA PCI WaveLAN/IEEE 802.11");
+
+	while(t->wi_name != NULL) {
+		if (pci_get_vendor(dev) == t->wi_vid &&
+		    pci_get_device(dev) == t->wi_did) {
+			sc->wi_prism2 = t->wi_prism2;
+			device_set_desc(dev, t->wi_name);
 			return (0);
+		}
+		t++;
 	}
 	return(ENXIO);
 }
Index: if_wireg.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/wi/if_wireg.h,v
retrieving revision 1.14
diff -u -r1.14 if_wireg.h
--- if_wireg.h	17 May 2001 22:20:54 -0000	1.14
+++ if_wireg.h	23 Aug 2001 00:55:54 -0000
@@ -150,7 +150,9 @@
 #define WI_PCI_IORES	0x1C
 
 #define WI_PCI_VENDOR_EUMITCOM		0x1638
+#define WI_PCI_VENDOR_NETGEAR		0x1385
 #define WI_PCI_DEVICE_PRISM2STA		0x1100
+#define WI_PCI_DEVICE_MA301		0x4100
 #define WI_HFA384X_SWSUPPORT0_OFF	0x28
 #define WI_PRISM2STA_MAGIC		0x4A2D
 

-- 
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7hFU6XY6L6fI4GtQRAnPHAJ9mGhW200H454fJr2DvvWGpMIlPWgCeLCDQ
9QiyKAiIz5C8nuU2slr4EHs=
=qaQc
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010822175835.A19864>