Subject: linksys eg1032 rev 3, patches
To: None <tech-net@netbsd.org>
From: Jeff Rizzo <riz@tastylime.net>
List: tech-net
Date: 11/22/2005 21:16:41
--98e8jtXdkpgskNou
Content-Type: multipart/mixed; boundary="HcAYCG3uE/tztfnV"
Content-Disposition: inline
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Can someone look over these patches to if_sk.c and if_re_pci.c ? Rev 3
of the Linksys EG1032 gigE board needs re(4) rather than sk(4), and with
these patches, are matched correctly. (taken mostly from OpenBSD)
I'm not sure if it would be preferable to do the subsystem id matching
which is necessary in a less one-off way - it seems like it would be more
"right", but at the moment, no other devices need it.
Thanks,
+j
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=eg1032
Content-Transfer-Encoding: quoted-printable
Index: if_re_pci.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/dev/pci/if_re_pci.c,v
retrieving revision 1.10
diff -u -r1.10 if_re_pci.c
--- if_re_pci.c 15 Jun 2005 11:27:39 -0000 1.10
+++ if_re_pci.c 23 Nov 2005 05:11:06 -0000
@@ -114,6 +114,8 @@
"D-Link DGE-528T Gigabit Ethernet" },
{ PCI_VENDOR_USR2, PCI_PRODUCT_USR2_USR997902, RTK_HWREV_8169S,
"US Robotics (3Com) USR997902 Gigabit Ethernet" },
+ { PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_EG1032, RTK_HWREV_8169S,
+ "Linksys EG1032 rev. 3 Gigabit Ethernet" },
{ 0, 0, 0, NULL }
};
=20
@@ -134,6 +136,8 @@
{ 0, 0, NULL }
};
=20
+#define RE_LINKSYS_EG1032_SUBID 0x00241737
+
CFATTACH_DECL(re_pci, sizeof(struct re_pci_softc), re_pci_probe, re_pci_at=
tach,
NULL, NULL);
=20
@@ -150,6 +154,15 @@
bus_space_handle_t rtk_bhandle;
bus_size_t bsize;
u_int32_t hwrev;
+ pcireg_t subid;
+
+ subid =3D pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+
+ /* special-case Linksys EG1032, since rev 2 uses sk(4) */
+ if (PCI_VENDOR(pa->pa_id) =3D=3D PCI_VENDOR_LINKSYS &&
+ PCI_PRODUCT(pa->pa_id) =3D=3D PCI_PRODUCT_LINKSYS_EG1032 &&
+ subid =3D=3D RE_LINKSYS_EG1032_SUBID)
+ return 1;
=20
t =3D re_devs;
=20
Index: if_sk.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/dev/pci/if_sk.c,v
retrieving revision 1.17
diff -u -r1.17 if_sk.c
--- if_sk.c 19 Nov 2005 21:45:50 -0000 1.17
+++ if_sk.c 23 Nov 2005 05:11:07 -0000
@@ -250,7 +250,6 @@
} sk_products[] =3D {
{ PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C940, },
{ PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_DGE530T, },
- { PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_EG1032, },
{ PCI_VENDOR_LINKSYS, PCI_PRODUCT_LINKSYS_EG1064, },
{ PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SKNET_GE, },
{ PCI_VENDOR_SCHNEIDERKOCH, PCI_PRODUCT_SCHNEIDERKOCH_SK9821v2, },
@@ -259,6 +258,8 @@
{ 0, 0, }
};
=20
+#define SK_LINKSYS_EG1032_SUBID 0x00151737
+
static inline u_int32_t
sk_win_read_4(struct sk_softc *sc, u_int32_t reg)
{
@@ -974,6 +975,14 @@
{
struct pci_attach_args *pa =3D (struct pci_attach_args *)aux;
const struct sk_product *psk;
+ pcireg_t subid;
+
+ subid =3D pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+
+ if (PCI_VENDOR(pa->pa_id) =3D=3D PCI_VENDOR_LINKSYS &&
+ PCI_PRODUCT(pa->pa_id) =3D=3D PCI_PRODUCT_LINKSYS_EG1032 &&
+ subid =3D=3D SK_LINKSYS_EG1032_SUBID)
+ return(1);
=20
if ((psk =3D sk_lookup(pa))) {
return(1);
--HcAYCG3uE/tztfnV--
--98e8jtXdkpgskNou
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (NetBSD)
iQCVAwUBQ4P7ObOuUtxCgar5AQKYOwP/V9j0ZS77LBkvxtjc8jNiVMx/UmqodW/v
2ubjOkk/1eIUR8ylyKy084hTOS9ZDJOIfVGiuclaxyIym8Pzz3llsjGh/ryHlbSs
4a6snXz8EUUi5EEp4u5vHx0HXH64yhB9hlvFDhuERCgMelPNNJXnYfKCL7kC+mPK
D5jkqYkfBns=
=cb+2
-----END PGP SIGNATURE-----
--98e8jtXdkpgskNou--