if_dc.c (67668) | if_dc.c (67771) |
---|---|
1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/sys/dev/dc/if_dc.c 67668 2000-10-27 00:15:04Z wpaul $ | 32 * $FreeBSD: head/sys/dev/dc/if_dc.c 67771 2000-10-28 09:00:20Z wpaul $ |
33 */ 34 35/* 36 * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143 37 * series chips and several workalikes including the following: 38 * 39 * Macronix 98713/98715/98725/98727/98732 PMAC (www.macronix.com) 40 * Macronix/Lite-On 82c115 PNIC II (www.macronix.com) 41 * Lite-On 82c168/82c169 PNIC (www.litecom.com) 42 * ASIX Electronics AX88140A (www.asix.com.tw) 43 * ASIX Electronics AX88141 (www.asix.com.tw) 44 * ADMtek AL981 (www.admtek.com.tw) 45 * ADMtek AN985 (www.admtek.com.tw) 46 * Davicom DM9100, DM9102, DM9102A (www.davicom8.com) 47 * Accton EN1217 (www.accton.com) 48 * Xircom X3201 (www.xircom.com) | 33 */ 34 35/* 36 * DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143 37 * series chips and several workalikes including the following: 38 * 39 * Macronix 98713/98715/98725/98727/98732 PMAC (www.macronix.com) 40 * Macronix/Lite-On 82c115 PNIC II (www.macronix.com) 41 * Lite-On 82c168/82c169 PNIC (www.litecom.com) 42 * ASIX Electronics AX88140A (www.asix.com.tw) 43 * ASIX Electronics AX88141 (www.asix.com.tw) 44 * ADMtek AL981 (www.admtek.com.tw) 45 * ADMtek AN985 (www.admtek.com.tw) 46 * Davicom DM9100, DM9102, DM9102A (www.davicom8.com) 47 * Accton EN1217 (www.accton.com) 48 * Xircom X3201 (www.xircom.com) |
49 * Abocom FE2500 |
|
49 * 50 * Datasheets for the 21143 are available at developer.intel.com. 51 * Datasheets for the clone parts can be found at their respective sites. 52 * (Except for the PNIC; see www.freebsd.org/~wpaul/PNIC/pnic.ps.gz.) 53 * The PNIC II is essentially a Macronix 98715A chip; the only difference 54 * worth noting is that its multicast hash table is only 128 bits wide 55 * instead of 512. 56 * --- 70 unchanged lines hidden (view full) --- 127 128MODULE_DEPEND(dc, miibus, 1, 1, 1); 129 130/* "controller miibus0" required. See GENERIC if you get errors here. */ 131#include "miibus_if.h" 132 133#ifndef lint 134static const char rcsid[] = | 50 * 51 * Datasheets for the 21143 are available at developer.intel.com. 52 * Datasheets for the clone parts can be found at their respective sites. 53 * (Except for the PNIC; see www.freebsd.org/~wpaul/PNIC/pnic.ps.gz.) 54 * The PNIC II is essentially a Macronix 98715A chip; the only difference 55 * worth noting is that its multicast hash table is only 128 bits wide 56 * instead of 512. 57 * --- 70 unchanged lines hidden (view full) --- 128 129MODULE_DEPEND(dc, miibus, 1, 1, 1); 130 131/* "controller miibus0" required. See GENERIC if you get errors here. */ 132#include "miibus_if.h" 133 134#ifndef lint 135static const char rcsid[] = |
135 "$FreeBSD: head/sys/dev/dc/if_dc.c 67668 2000-10-27 00:15:04Z wpaul $"; | 136 "$FreeBSD: head/sys/dev/dc/if_dc.c 67771 2000-10-28 09:00:20Z wpaul $"; |
136#endif 137 138/* 139 * Various supported device vendors/types and their names. 140 */ 141static struct dc_type dc_devs[] = { 142 { DC_VENDORID_DEC, DC_DEVICEID_21143, 143 "Intel 21143 10/100BaseTX" }, --- 32 unchanged lines hidden (view full) --- 176 { DC_VENDORID_LO, DC_DEVICEID_82C168, 177 "82c168 PNIC 10/100BaseTX" }, 178 { DC_VENDORID_LO, DC_DEVICEID_82C168, 179 "82c169 PNIC 10/100BaseTX" }, 180 { DC_VENDORID_ACCTON, DC_DEVICEID_EN1217, 181 "Accton EN1217 10/100BaseTX" }, 182 { DC_VENDORID_XIRCOM, DC_DEVICEID_X3201, 183 "Xircom X3201 10/100BaseTX" }, | 137#endif 138 139/* 140 * Various supported device vendors/types and their names. 141 */ 142static struct dc_type dc_devs[] = { 143 { DC_VENDORID_DEC, DC_DEVICEID_21143, 144 "Intel 21143 10/100BaseTX" }, --- 32 unchanged lines hidden (view full) --- 177 { DC_VENDORID_LO, DC_DEVICEID_82C168, 178 "82c168 PNIC 10/100BaseTX" }, 179 { DC_VENDORID_LO, DC_DEVICEID_82C168, 180 "82c169 PNIC 10/100BaseTX" }, 181 { DC_VENDORID_ACCTON, DC_DEVICEID_EN1217, 182 "Accton EN1217 10/100BaseTX" }, 183 { DC_VENDORID_XIRCOM, DC_DEVICEID_X3201, 184 "Xircom X3201 10/100BaseTX" }, |
185 { DC_VENDORID_ABOCOM, DC_DEVICEID_FE2500, 186 "Abocom FE2500 10/100BaseTX" }, |
|
184 { 0, 0, NULL } 185}; 186 187static int dc_probe __P((device_t)); 188static int dc_attach __P((device_t)); 189static int dc_detach __P((device_t)); 190static void dc_acpi __P((device_t)); 191static struct dc_type *dc_devtype __P((device_t)); --- 1041 unchanged lines hidden (view full) --- 1233 DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); 1234 else 1235 DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); 1236 1237 for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; 1238 ifma = ifma->ifma_link.le_next) { 1239 if (ifma->ifma_addr->sa_family != AF_LINK) 1240 continue; | 187 { 0, 0, NULL } 188}; 189 190static int dc_probe __P((device_t)); 191static int dc_attach __P((device_t)); 192static int dc_detach __P((device_t)); 193static void dc_acpi __P((device_t)); 194static struct dc_type *dc_devtype __P((device_t)); --- 1041 unchanged lines hidden (view full) --- 1236 DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); 1237 else 1238 DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); 1239 1240 for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; 1241 ifma = ifma->ifma_link.le_next) { 1242 if (ifma->ifma_addr->sa_family != AF_LINK) 1243 continue; |
1241 h = dc_crc_le(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); | 1244 h = dc_crc_le(sc, 1245 LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); |
1242 sp[h >> 4] |= 1 << (h & 0xF); 1243 } 1244 1245 if (ifp->if_flags & IFF_BROADCAST) { 1246 h = dc_crc_le(sc, (caddr_t)ðerbroadcastaddr); 1247 sp[h >> 4] |= 1 << (h & 0xF); 1248 } 1249 --- 196 unchanged lines hidden (view full) --- 1446 DC_SETBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); 1447 1448 for (i = 0; i < DC_TIMEOUT; i++) { 1449 DELAY(10); 1450 if (!(CSR_READ_4(sc, DC_BUSCTL) & DC_BUSCTL_RESET)) 1451 break; 1452 } 1453 | 1246 sp[h >> 4] |= 1 << (h & 0xF); 1247 } 1248 1249 if (ifp->if_flags & IFF_BROADCAST) { 1250 h = dc_crc_le(sc, (caddr_t)ðerbroadcastaddr); 1251 sp[h >> 4] |= 1 << (h & 0xF); 1252 } 1253 --- 196 unchanged lines hidden (view full) --- 1450 DC_SETBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); 1451 1452 for (i = 0; i < DC_TIMEOUT; i++) { 1453 DELAY(10); 1454 if (!(CSR_READ_4(sc, DC_BUSCTL) & DC_BUSCTL_RESET)) 1455 break; 1456 } 1457 |
1454 if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { | 1458 if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || 1459 DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { |
1455 DELAY(10000); 1456 DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); 1457 i = 0; 1458 } 1459 1460 if (i == DC_TIMEOUT) 1461 printf("dc%d: reset never completed!\n", sc->dc_unit); 1462 --- 381 unchanged lines hidden (view full) --- 1844 break; 1845 case DC_DEVICEID_AL981: 1846 sc->dc_type = DC_TYPE_AL981; 1847 sc->dc_flags |= DC_TX_USE_TX_INTR; 1848 sc->dc_flags |= DC_TX_ADMTEK_WAR; 1849 sc->dc_pmode = DC_PMODE_MII; 1850 break; 1851 case DC_DEVICEID_AN985: | 1460 DELAY(10000); 1461 DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); 1462 i = 0; 1463 } 1464 1465 if (i == DC_TIMEOUT) 1466 printf("dc%d: reset never completed!\n", sc->dc_unit); 1467 --- 381 unchanged lines hidden (view full) --- 1849 break; 1850 case DC_DEVICEID_AL981: 1851 sc->dc_type = DC_TYPE_AL981; 1852 sc->dc_flags |= DC_TX_USE_TX_INTR; 1853 sc->dc_flags |= DC_TX_ADMTEK_WAR; 1854 sc->dc_pmode = DC_PMODE_MII; 1855 break; 1856 case DC_DEVICEID_AN985: |
1857 case DE_DEVICEID_FE2500: |
|
1852 sc->dc_type = DC_TYPE_AN985; 1853 sc->dc_flags |= DC_TX_USE_TX_INTR; 1854 sc->dc_flags |= DC_TX_ADMTEK_WAR; 1855 sc->dc_pmode = DC_PMODE_MII; 1856 break; 1857 case DC_DEVICEID_98713: 1858 case DC_DEVICEID_98713_CP: 1859 if (revision < DC_REVISION_98713A) { --- 1493 unchanged lines hidden --- | 1858 sc->dc_type = DC_TYPE_AN985; 1859 sc->dc_flags |= DC_TX_USE_TX_INTR; 1860 sc->dc_flags |= DC_TX_ADMTEK_WAR; 1861 sc->dc_pmode = DC_PMODE_MII; 1862 break; 1863 case DC_DEVICEID_98713: 1864 case DC_DEVICEID_98713_CP: 1865 if (revision < DC_REVISION_98713A) { --- 1493 unchanged lines hidden --- |