Deleted Added
full compact
if_tl.c (213894) if_tl.c (214264)
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.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

--- 17 unchanged lines hidden (view full) ---

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
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.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

--- 17 unchanged lines hidden (view full) ---

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
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/dev/tl/if_tl.c 213894 2010-10-15 15:00:30Z marius $");
34__FBSDID("$FreeBSD: head/sys/dev/tl/if_tl.c 214264 2010-10-24 12:51:02Z marius $");
35
36/*
37 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
38 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
39 * the National Semiconductor DP83840A physical interface and the
40 * Microchip Technology 24Cxx series serial EEPROM.
41 *
42 * Written using the following four documents:

--- 1056 unchanged lines hidden (view full) ---

1099
1100 return(ENXIO);
1101}
1102
1103static int
1104tl_attach(dev)
1105 device_t dev;
1106{
35
36/*
37 * Texas Instruments ThunderLAN driver for FreeBSD 2.2.6 and 3.x.
38 * Supports many Compaq PCI NICs based on the ThunderLAN ethernet controller,
39 * the National Semiconductor DP83840A physical interface and the
40 * Microchip Technology 24Cxx series serial EEPROM.
41 *
42 * Written using the following four documents:

--- 1056 unchanged lines hidden (view full) ---

1099
1100 return(ENXIO);
1101}
1102
1103static int
1104tl_attach(dev)
1105 device_t dev;
1106{
1107 int i;
1108 u_int16_t did, vid;
1109 struct tl_type *t;
1110 struct ifnet *ifp;
1111 struct tl_softc *sc;
1107 u_int16_t did, vid;
1108 struct tl_type *t;
1109 struct ifnet *ifp;
1110 struct tl_softc *sc;
1112 int unit, error = 0, rid;
1111 int error, flags, i, rid, unit;
1113 u_char eaddr[6];
1114
1115 vid = pci_get_vendor(dev);
1116 did = pci_get_device(dev);
1117 sc = device_get_softc(dev);
1118 sc->tl_dev = dev;
1119 unit = device_get_unit(dev);
1120

--- 81 unchanged lines hidden (view full) ---

1202 if (sc->tl_ldata == NULL) {
1203 device_printf(dev, "no memory for list buffers!\n");
1204 error = ENXIO;
1205 goto fail;
1206 }
1207
1208 bzero(sc->tl_ldata, sizeof(struct tl_list_data));
1209
1112 u_char eaddr[6];
1113
1114 vid = pci_get_vendor(dev);
1115 did = pci_get_device(dev);
1116 sc = device_get_softc(dev);
1117 sc->tl_dev = dev;
1118 unit = device_get_unit(dev);
1119

--- 81 unchanged lines hidden (view full) ---

1201 if (sc->tl_ldata == NULL) {
1202 device_printf(dev, "no memory for list buffers!\n");
1203 error = ENXIO;
1204 goto fail;
1205 }
1206
1207 bzero(sc->tl_ldata, sizeof(struct tl_list_data));
1208
1210 sc->tl_dinfo = t;
1211 if (t->tl_vid == COMPAQ_VENDORID || t->tl_vid == TI_VENDORID)
1209 if (vid == COMPAQ_VENDORID || vid == TI_VENDORID)
1212 sc->tl_eeaddr = TL_EEPROM_EADDR;
1210 sc->tl_eeaddr = TL_EEPROM_EADDR;
1213 if (t->tl_vid == OLICOM_VENDORID)
1211 if (vid == OLICOM_VENDORID)
1214 sc->tl_eeaddr = TL_EEPROM_EADDR_OC;
1215
1216 /* Reset the adapter. */
1217 tl_softreset(sc, 1);
1218 tl_hardreset(dev);
1219 tl_softreset(sc, 1);
1220
1221 /*

--- 14 unchanged lines hidden (view full) ---

1236 * Second, they store the address in three 16-bit words in
1237 * network byte order, as opposed to storing it sequentially
1238 * like all the other ThunderLAN cards. In order to get
1239 * the station address in a form that matches what the Olicom
1240 * diagnostic utility specifies, we have to byte-swap each
1241 * word. To make things even more confusing, neither 00:00:28
1242 * nor 00:00:24 appear in the IEEE OUI database.
1243 */
1212 sc->tl_eeaddr = TL_EEPROM_EADDR_OC;
1213
1214 /* Reset the adapter. */
1215 tl_softreset(sc, 1);
1216 tl_hardreset(dev);
1217 tl_softreset(sc, 1);
1218
1219 /*

--- 14 unchanged lines hidden (view full) ---

1234 * Second, they store the address in three 16-bit words in
1235 * network byte order, as opposed to storing it sequentially
1236 * like all the other ThunderLAN cards. In order to get
1237 * the station address in a form that matches what the Olicom
1238 * diagnostic utility specifies, we have to byte-swap each
1239 * word. To make things even more confusing, neither 00:00:28
1240 * nor 00:00:24 appear in the IEEE OUI database.
1241 */
1244 if (sc->tl_dinfo->tl_vid == OLICOM_VENDORID) {
1242 if (vid == OLICOM_VENDORID) {
1245 for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
1246 u_int16_t *p;
1247 p = (u_int16_t *)&eaddr[i];
1248 *p = ntohs(*p);
1249 }
1250 }
1251
1252 ifp = sc->tl_ifp = if_alloc(IFT_ETHER);

--- 21 unchanged lines hidden (view full) ---

1274
1275 /*
1276 * Do MII setup. If no PHYs are found, then this is a
1277 * bitrate ThunderLAN chip that only supports 10baseT
1278 * and AUI/BNC.
1279 * XXX mii_attach() can fail for reason different than
1280 * no PHYs found!
1281 */
1243 for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
1244 u_int16_t *p;
1245 p = (u_int16_t *)&eaddr[i];
1246 *p = ntohs(*p);
1247 }
1248 }
1249
1250 ifp = sc->tl_ifp = if_alloc(IFT_ETHER);

--- 21 unchanged lines hidden (view full) ---

1272
1273 /*
1274 * Do MII setup. If no PHYs are found, then this is a
1275 * bitrate ThunderLAN chip that only supports 10baseT
1276 * and AUI/BNC.
1277 * XXX mii_attach() can fail for reason different than
1278 * no PHYs found!
1279 */
1280 flags = 0;
1281 if (vid == COMPAQ_VENDORID) {
1282 if (did == COMPAQ_DEVICEID_NETEL_10_100_PROLIANT ||
1283 did == COMPAQ_DEVICEID_NETFLEX_3P_INTEGRATED ||
1284 did == COMPAQ_DEVICEID_NETFLEX_3P_BNC ||
1285 did == COMPAQ_DEVICEID_NETEL_10_T2_UTP_COAX)
1286 flags |= MIIF_MACPRIV0;
1287 if (did == COMPAQ_DEVICEID_NETEL_10 ||
1288 did == COMPAQ_DEVICEID_NETEL_10_100_DUAL ||
1289 did == COMPAQ_DEVICEID_NETFLEX_3P ||
1290 did == COMPAQ_DEVICEID_NETEL_10_100_EMBEDDED)
1291 flags |= MIIF_MACPRIV1;
1292 } else if (vid == OLICOM_VENDORID && did == OLICOM_DEVICEID_OC2183)
1293 flags |= MIIF_MACPRIV0 | MIIF_MACPRIV1;
1282 if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd,
1283 tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) {
1284 struct ifmedia *ifm;
1285 sc->tl_bitrate = 1;
1286 ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts);
1287 ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
1288 ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
1289 ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);

--- 1074 unchanged lines hidden ---
1294 if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd,
1295 tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) {
1296 struct ifmedia *ifm;
1297 sc->tl_bitrate = 1;
1298 ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts);
1299 ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T, 0, NULL);
1300 ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
1301 ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);

--- 1074 unchanged lines hidden ---