Re: Linksys EG1032 rev. 3 patch

From: Fredrik Lindberg <fli+freebsd-current_at_shapeshifter.se>
Date: Wed, 05 Oct 2005 14:22:46 +0200
M. Warner Losh wrote:
> In message: <43424F75.3000409_at_shapeshifter.se>
>             Fredrik Lindberg <fli_at_shapeshifter.se> writes:
> : M. Warner Losh wrote:
> : > In message: <4341A55B.1070209_at_shapeshifter.se>
> : >             Fredrik Lindberg <fli+freebsd-current_at_shapeshifter.se> writes:
> : > : Filtering on subvendor/subdevice might be better, I didn't even think
> : > : of that and revision filtering seemed to be quite popular among
> : > : exsisting drivers.
> : > 
> : > Yes.  Many chip vendors bump the revision field 'often'.  Just how
> : > often varies from chip maker to chip maker.  Some do only when they
> : > have a new version of the chip that needs special work arounds (or
> : > that no longer needs them :-).  Others do change it for each change to
> : > the silicon.  Most are somewhere inbetween.
> : > 
> : > : The subdevice id for a rev.3 card seems to be 0x0024 (subvendor 0x1737).
> : > : I don't own a rev. 2 card but google says that the rev.2 card has
> : > : subdevice id 0x0015 (subvendor 0x1737).
> : > 
> : > That might be sufficient...
> : > 
> : 
> : Ok, how should this be implemented then? Just a specific check in each
> : drivers probe methods or by adding some svid/sdid fields to
> : struct rl_type and similar structs.
> : I would go for the latter, but that might be overkill.
> 
> I'd code it as a special case in re and sk driver's probe routine for
> the moment.  If more of these cards surface, then doing something more
> general might be a good idea.
> 
> Warner

Ok, here is something that probes for subdevice. Somebody with a
rev. 2 card needs to test this and confirm that sk(4)
still attaches successfully to those cards.

	Fredrik

Index: dev/re/if_re.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/re/if_re.c,v
retrieving revision 1.57
diff -u -r1.57 if_re.c
--- dev/re/if_re.c	5 Oct 2005 10:09:15 -0000	1.57
+++ dev/re/if_re.c	5 Oct 2005 12:21:32 -0000
_at__at_ -177,6 +177,8 _at__at_
 		"RealTek 8110S Single-chip Gigabit Ethernet" },
 	{ COREGA_VENDORID, COREGA_DEVICEID_CGLAPCIGT, RL_HWREV_8169S,
 		"Corega CG-LAPCIGT (RTL8169S) Gigabit Ethernet" },
+	{ LINKSYS_VENDORID, LINKSYS_DEVICEID_EG1032, RL_HWREV_8169S,
+		"Linksys EG1032 (RTL8169S) Gigabit Ethernet" },
 	{ 0, 0, 0, NULL }
 };
 
_at__at_ -826,6 +828,17 _at__at_
 	while (t->rl_name != NULL) {
 		if ((pci_get_vendor(dev) == t->rl_vid) &&
 		    (pci_get_device(dev) == t->rl_did)) {
+			/*
+			 * Only attach to rev. 3 of the Linksys EG1032 adapter.
+			 * Rev. 2 i supported by sk(4).
+			 */
+			if ((t->rl_vid == LINKSYS_VENDORID) &&
+				(t->rl_did == LINKSYS_DEVICEID_EG1032) &&
+				(pci_get_subdevice(dev) !=
+				LINKSYS_SUBDEVICE_EG1032_REV3)) {
+				t++;
+				continue;
+			}
 
 			/*
 			 * Temporarily map the I/O space
Index: pci/if_rlreg.h
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_rlreg.h,v
retrieving revision 1.53
diff -u -r1.53 if_rlreg.h
--- pci/if_rlreg.h	29 Sep 2005 16:52:19 -0000	1.53
+++ pci/if_rlreg.h	5 Oct 2005 12:21:32 -0000
_at__at_ -825,6 +825,21 _at__at_
 #define COREGA_DEVICEID_CGLAPCIGT		0xc107
 
 /*
+ * Linksys vendor ID
+ */
+#define LINKSYS_VENDORID			0x1737
+
+/*
+ * Linksys EG1032 device ID
+ */
+#define LINKSYS_DEVICEID_EG1032			0x1032
+
+/*
+ * Linksys EG1032 rev 3 sub-device ID
+ */
+#define LINKSYS_SUBDEVICE_EG1032_REV3	0x0024
+
+/*
  * Peppercon vendor ID
  */
 #define PEPPERCON_VENDORID			0x1743
Index: pci/if_sk.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_sk.c,v
retrieving revision 1.110
diff -u -r1.110 if_sk.c
--- pci/if_sk.c	16 Sep 2005 11:11:51 -0000	1.110
+++ pci/if_sk.c	5 Oct 2005 12:21:33 -0000
_at__at_ -1312,6 +1312,17 _at__at_
 	while(t->sk_name != NULL) {
 		if ((pci_get_vendor(dev) == t->sk_vid) &&
 		    (pci_get_device(dev) == t->sk_did)) {
+			/*
+			 * Only attach to rev. 2 of the Linksys EG1032 adapter.
+			 * Rev. 3 is supported by re(4).
+			 */
+			if ((t->sk_vid == VENDORID_LINKSYS) &&
+				(t->sk_did == DEVICEID_LINKSYS_EG1032) &&
+				(pci_get_subdevice(dev) !=
+				 SUBDEVICEID_LINKSYS_EG1032_REV2)) {
+				t++;
+				continue;
+			}
 			device_set_desc(dev, t->sk_name);
 			return (BUS_PROBE_DEFAULT);
 		}
Index: pci/if_skreg.h
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_skreg.h,v
retrieving revision 1.29
diff -u -r1.29 if_skreg.h
--- pci/if_skreg.h	10 Jun 2005 16:49:23 -0000	1.29
+++ pci/if_skreg.h	5 Oct 2005 12:21:33 -0000
_at__at_ -104,6 +104,11 _at__at_
 #define DEVICEID_LINKSYS_EG1032	0x1032
 
 /*
+ * Linksys gigabit ethernet rev 2 sub-device ID
+ */
+#define SUBDEVICEID_LINKSYS_EG1032_REV2	0x0015
+
+/*
  * D-Link PCI vendor ID
  */
 #define	VENDORID_DLINK		0x1186
Received on Wed Oct 05 2005 - 10:22:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:44 UTC