Re: Linksys EG1032 rev. 3 patch

From: Fredrik Lindberg <fli+freebsd-current_at_shapeshifter.se>
Date: Sun, 02 Oct 2005 23:51:26 +0200
Matthew N. Dodd wrote:
> On Sun, 2 Oct 2005, Scott Long wrote:
> 
>> Sounds like the if_sk driver needs to be made more intelligent so that 
>> it doesn't try to claim this card, yes?
> 
> 
> I found the attached patch in my local tree.
> 
> Curious to know if it works as I don't have the hardware.
> 
> 
I couldn't get a clean compile with this for some reason, maybe
my buildspace were polluted.
I've attached a similar patch that works for me with my
Linksys EG1032 rev 3 card, rev 2 cards needs testing because I
don't own any of those.

	Fredrik



Index: sys/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
--- sys/pci/if_sk.c	16 Sep 2005 11:11:51 -0000	1.110
+++ sys/pci/if_sk.c	2 Oct 2005 21:32:03 -0000
_at__at_ -143,39 +143,46 _at__at_
 	{
 		VENDORID_SK,
 		DEVICEID_SK_V1,
+		-1,
 		"SysKonnect Gigabit Ethernet (V1.0)"
 	},
 	{
 		VENDORID_SK,
 		DEVICEID_SK_V2,
+		-1,
 		"SysKonnect Gigabit Ethernet (V2.0)"
 	},
 	{
 		VENDORID_MARVELL,
 		DEVICEID_SK_V2,
+		-1,
 		"Marvell Gigabit Ethernet"
 	},
 	{
 		VENDORID_MARVELL,
 		DEVICEID_BELKIN_5005,
+		-1,
 		"Belkin F5D5005 Gigabit Ethernet"
 	},
 	{
 		VENDORID_3COM,
 		DEVICEID_3COM_3C940,
+		-1,
 		"3Com 3C940 Gigabit Ethernet"
 	},
 	{
 		VENDORID_LINKSYS,
 		DEVICEID_LINKSYS_EG1032,
-		"Linksys EG1032 Gigabit Ethernet"
+		0x12,
+		"Linksys EG1032 Gigabit Ethernet Rev. 2"
 	},
 	{
 		VENDORID_DLINK,
 		DEVICEID_DLINK_DGE530T,
+		-1,
 		"D-Link DGE-530T Gigabit Ethernet"
 	},
-	{ 0, 0, NULL }
+	{ 0, 0, 0, NULL }
 };
 
 static int skc_probe(device_t);
_at__at_ -1311,7 +1318,8 _at__at_
 
 	while(t->sk_name != NULL) {
 		if ((pci_get_vendor(dev) == t->sk_vid) &&
-		    (pci_get_device(dev) == t->sk_did)) {
+		(pci_get_device(dev) == t->sk_did) &&
+		(pci_get_revid(dev) == t->sk_rev || t->sk_rev == -1)) {
 			device_set_desc(dev, t->sk_name);
 			return (BUS_PROBE_DEFAULT);
 		}
Index: sys/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
--- sys/pci/if_skreg.h	10 Jun 2005 16:49:23 -0000	1.29
+++ sys/pci/if_skreg.h	2 Oct 2005 21:32:05 -0000
_at__at_ -1300,6 +1300,7 _at__at_
 struct sk_type {
 	u_int16_t		sk_vid;
 	u_int16_t		sk_did;
+	int16_t			sk_rev;
 	char			*sk_name;
 };
 
Index: sys/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
--- sys/pci/if_rlreg.h	29 Sep 2005 16:52:19 -0000	1.53
+++ sys/pci/if_rlreg.h	2 Oct 2005 21:32:05 -0000
_at__at_ -457,6 +457,7 _at__at_
 struct rl_type {
 	uint16_t		rl_vid;
 	uint16_t		rl_did;
+	int16_t			rl_rev;
 	int			rl_basetype;
 	char			*rl_name;
 };
_at__at_ -823,6 +824,16 _at__at_
  * Corega CG-LAPCIGT device ID
  */
 #define COREGA_DEVICEID_CGLAPCIGT		0xc107
+
+/*
+ * Linksys vendor ID
+ */
+#define LINKSYS_VENDORID			0x1737
+
+/*
+ * Linksys EG1032 device ID
+ */
+#define LINKSYS_DEVICEID_EG1032			0x1032
 
 /*
  * Peppercon vendor ID
Index: sys/pci/if_rl.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_rl.c,v
retrieving revision 1.158
diff -u -r1.158 if_rl.c
--- sys/pci/if_rl.c	1 Oct 2005 18:56:19 -0000	1.158
+++ sys/pci/if_rl.c	2 Oct 2005 21:32:06 -0000
_at__at_ -136,41 +136,41 _at__at_
  * Various supported device vendors/types and their names.
  */
 static struct rl_type rl_devs[] = {
-	{ RT_VENDORID, RT_DEVICEID_8129, RL_8129,
+	{ RT_VENDORID, RT_DEVICEID_8129, -1, RL_8129,
 		"RealTek 8129 10/100BaseTX" },
-	{ RT_VENDORID, RT_DEVICEID_8139, RL_8139,
+	{ RT_VENDORID, RT_DEVICEID_8139, -1, RL_8139,
 		"RealTek 8139 10/100BaseTX" },
-	{ RT_VENDORID, RT_DEVICEID_8138, RL_8139,
+	{ RT_VENDORID, RT_DEVICEID_8138, -1, RL_8139,
 		"RealTek 8139 10/100BaseTX CardBus" },
-	{ RT_VENDORID, RT_DEVICEID_8100, RL_8139,
+	{ RT_VENDORID, RT_DEVICEID_8100, -1, RL_8139,
 		"RealTek 8100 10/100BaseTX" },
-	{ ACCTON_VENDORID, ACCTON_DEVICEID_5030, RL_8139,
+	{ ACCTON_VENDORID, ACCTON_DEVICEID_5030, -1, RL_8139,
 		"Accton MPX 5030/5038 10/100BaseTX" },
-	{ DELTA_VENDORID, DELTA_DEVICEID_8139, RL_8139,
+	{ DELTA_VENDORID, DELTA_DEVICEID_8139, -1, RL_8139,
 		"Delta Electronics 8139 10/100BaseTX" },
-	{ ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, RL_8139,
+	{ ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, -1, RL_8139,
 		"Addtron Technolgy 8139 10/100BaseTX" },
-	{ DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, RL_8139,
+	{ DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, -1, RL_8139,
 		"D-Link DFE-530TX+ 10/100BaseTX" },
-	{ DLINK_VENDORID, DLINK_DEVICEID_690TXD, RL_8139,
+	{ DLINK_VENDORID, DLINK_DEVICEID_690TXD, -1, RL_8139,
 		"D-Link DFE-690TXD 10/100BaseTX" },
-	{ NORTEL_VENDORID, ACCTON_DEVICEID_5030, RL_8139,
+	{ NORTEL_VENDORID, ACCTON_DEVICEID_5030, -1, RL_8139,
 		"Nortel Networks 10/100BaseTX" },
-	{ COREGA_VENDORID, COREGA_DEVICEID_FETHERCBTXD, RL_8139,
+	{ COREGA_VENDORID, COREGA_DEVICEID_FETHERCBTXD, -1, RL_8139,
 		"Corega FEther CB-TXD" },
-	{ COREGA_VENDORID, COREGA_DEVICEID_FETHERIICBTXD, RL_8139,
+	{ COREGA_VENDORID, COREGA_DEVICEID_FETHERIICBTXD, -1, RL_8139,
 		"Corega FEtherII CB-TXD" },
-	{ PEPPERCON_VENDORID, PEPPERCON_DEVICEID_ROLF, RL_8139,
+	{ PEPPERCON_VENDORID, PEPPERCON_DEVICEID_ROLF, -1, RL_8139,
 		"Peppercon AG ROL-F" },
-	{ PLANEX_VENDORID, PLANEX_DEVICEID_FNW3800TX, RL_8139,
+	{ PLANEX_VENDORID, PLANEX_DEVICEID_FNW3800TX, -1, RL_8139,
 		"Planex FNW-3800-TX" },
-	{ CP_VENDORID, RT_DEVICEID_8139, RL_8139,
+	{ CP_VENDORID, RT_DEVICEID_8139, -1, RL_8139,
 		"Compaq HNE-300" },
-	{ LEVEL1_VENDORID, LEVEL1_DEVICEID_FPC0106TX, RL_8139,
+	{ LEVEL1_VENDORID, LEVEL1_DEVICEID_FPC0106TX, -1, RL_8139,
 		"LevelOne FPC-0106TX" },
-	{ EDIMAX_VENDORID, EDIMAX_DEVICEID_EP4103DL, RL_8139,
+	{ EDIMAX_VENDORID, EDIMAX_DEVICEID_EP4103DL, -1, RL_8139,
 		"Edimax EP-4103DL CardBus" },
-	{ 0, 0, 0, NULL }
+	{ 0, 0, 0, 0, NULL }
 };
 
 static int rl_attach(device_t);
_at__at_ -733,7 +733,8 _at__at_
 
 	while (t->rl_name != NULL) {
 		if ((pci_get_vendor(dev) == t->rl_vid) &&
-		    (pci_get_device(dev) == t->rl_did)) {
+		    (pci_get_device(dev) == t->rl_did) &&
+			(pci_get_devid(dev) == t->rl_rev || t->rl_rev == -1)) {
 			/*
 			 * Temporarily map the I/O space
 			 * so we can read the chip ID register.
Index: sys/dev/re/if_re.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/re/if_re.c,v
retrieving revision 1.56
diff -u -r1.56 if_re.c
--- sys/dev/re/if_re.c	1 Oct 2005 18:56:17 -0000	1.56
+++ sys/dev/re/if_re.c	2 Oct 2005 21:32:07 -0000
_at__at_ -159,21 +159,23 _at__at_
  * Various supported device vendors/types and their names.
  */
 static struct rl_type re_devs[] = {
-	{ DLINK_VENDORID, DLINK_DEVICEID_528T, RL_HWREV_8169S,
+	{ DLINK_VENDORID, DLINK_DEVICEID_528T, -1, RL_HWREV_8169S,
 		"D-Link DGE-528(T) Gigabit Ethernet Adapter" },
-	{ RT_VENDORID, RT_DEVICEID_8139, RL_HWREV_8139CPLUS,
+	{ RT_VENDORID, RT_DEVICEID_8139, -1, RL_HWREV_8139CPLUS,
 		"RealTek 8139C+ 10/100BaseTX" },
-	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169,
+	{ RT_VENDORID, RT_DEVICEID_8169, -1, RL_HWREV_8169,
 		"RealTek 8169 Gigabit Ethernet" },
-	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169S,
+	{ RT_VENDORID, RT_DEVICEID_8169, -1, RL_HWREV_8169S,
 		"RealTek 8169S Single-chip Gigabit Ethernet" },
-	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169SB,
+	{ RT_VENDORID, RT_DEVICEID_8169, -1, RL_HWREV_8169SB,
 		"RealTek 8169SB Single-chip Gigabit Ethernet" },
-	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8110S,
+	{ RT_VENDORID, RT_DEVICEID_8169, -1, RL_HWREV_8110S,
 		"RealTek 8110S Single-chip Gigabit Ethernet" },
-	{ COREGA_VENDORID, COREGA_DEVICEID_CGLAPCIGT, RL_HWREV_8169S,
+	{ COREGA_VENDORID, COREGA_DEVICEID_CGLAPCIGT, -1, RL_HWREV_8169S,
 		"Corega CG-LAPCIGT (RTL8169S) Gigabit Ethernet" },
-	{ 0, 0, 0, NULL }
+	{ LINKSYS_VENDORID, LINKSYS_DEVICEID_EG1032, 0x10, RL_HWREV_8169S,
+		"Linksys EG1032 (RTL8169S) Gigabit Ethernet Rev. 3" },
+	{ 0, 0, 0, 0, NULL }
 };
 
 static struct rl_hwrev re_hwrevs[] = {
_at__at_ -821,7 +823,8 _at__at_
 
 	while (t->rl_name != NULL) {
 		if ((pci_get_vendor(dev) == t->rl_vid) &&
-		    (pci_get_device(dev) == t->rl_did)) {
+		    (pci_get_device(dev) == t->rl_did) &&
+		    (pci_get_revid(dev) == t->rl_rev || t->rl_rev == -1)) {
 
 			/*
 			 * Temporarily map the I/O space
Index: share/man/man4/sk.4
===================================================================
RCS file: /home/ncvs/src/share/man/man4/sk.4,v
retrieving revision 1.28
diff -u -r1.28 sk.4
--- share/man/man4/sk.4	21 Jul 2005 05:02:38 -0000	1.28
+++ share/man/man4/sk.4	2 Oct 2005 21:32:07 -0000
_at__at_ -175,7 +175,7 _at__at_
 .It
 D-Link DGE-530T single port, 1000baseT adapter
 .It
-Linksys EG1032 single port, 1000baseT adapter
+Linksys EG1032 single port Rev. 2, 1000baseT adapter
 .It
 SK-9521 SK-NET GE-T single port, 1000baseT adapter
 .It
Index: share/man/man4/re.4
===================================================================
RCS file: /home/ncvs/src/share/man/man4/re.4,v
retrieving revision 1.15
diff -u -r1.15 re.4
--- share/man/man4/re.4	5 Aug 2005 13:21:11 -0000	1.15
+++ share/man/man4/re.4	2 Oct 2005 21:32:08 -0000
_at__at_ -165,6 +165,8 _at__at_
 PLANEX COMMUNICATIONS Inc.\& GN-1200TC (8169S)
 .It
 Xterasys XN-152 10/100/1000 NIC (8169)
+.It
+Linksys EG1032 Gigabit Ethernet Rev. 3 (8169S)
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
Received on Sun Oct 02 2005 - 19:51:31 UTC

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