if_ti.c (207571) | if_ti.c (219547) |
---|---|
1/*- 2 * Copyright (c) 1997, 1998, 1999 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 --- 63 unchanged lines hidden (view full) --- 72 * - Raymond Lee of Netgear, for providing a pair of Netgear 73 * GA620 Tigon 2 boards for testing 74 * - Ulf Zimmermann, for bringing the GA260 to my attention and 75 * convincing me to write this driver. 76 * - Andrew Gallatin for providing FreeBSD/Alpha support. 77 */ 78 79#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997, 1998, 1999 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 --- 63 unchanged lines hidden (view full) --- 72 * - Raymond Lee of Netgear, for providing a pair of Netgear 73 * GA620 Tigon 2 boards for testing 74 * - Ulf Zimmermann, for bringing the GA260 to my attention and 75 * convincing me to write this driver. 76 * - Andrew Gallatin for providing FreeBSD/Alpha support. 77 */ 78 79#include <sys/cdefs.h> |
80__FBSDID("$FreeBSD: head/sys/dev/ti/if_ti.c 207571 2010-05-03 15:51:59Z alc $"); | 80__FBSDID("$FreeBSD: head/sys/dev/ti/if_ti.c 219547 2011-03-11 22:32:17Z marius $"); |
81 82#include "opt_ti.h" 83 84#include <sys/param.h> 85#include <sys/systm.h> 86#include <sys/sockio.h> 87#include <sys/mbuf.h> 88#include <sys/malloc.h> --- 51 unchanged lines hidden (view full) --- 140 TI_SWAP_NTOH 141} ti_swap_type; 142 143 144/* 145 * Various supported device vendors/types and their names. 146 */ 147 | 81 82#include "opt_ti.h" 83 84#include <sys/param.h> 85#include <sys/systm.h> 86#include <sys/sockio.h> 87#include <sys/mbuf.h> 88#include <sys/malloc.h> --- 51 unchanged lines hidden (view full) --- 140 TI_SWAP_NTOH 141} ti_swap_type; 142 143 144/* 145 * Various supported device vendors/types and their names. 146 */ 147 |
148static struct ti_type ti_devs[] = { | 148static const struct ti_type const ti_devs[] = { |
149 { ALT_VENDORID, ALT_DEVICEID_ACENIC, 150 "Alteon AceNIC 1000baseSX Gigabit Ethernet" }, 151 { ALT_VENDORID, ALT_DEVICEID_ACENIC_COPPER, 152 "Alteon AceNIC 1000baseT Gigabit Ethernet" }, 153 { TC_VENDORID, TC_DEVICEID_3C985, 154 "3Com 3c985-SX Gigabit Ethernet" }, 155 { NG_VENDORID, NG_DEVICEID_GA620, 156 "Netgear GA620 1000baseSX Gigabit Ethernet" }, --- 956 unchanged lines hidden (view full) --- 1113 NULL, NULL, /* lockfunc, lockarg */ 1114 &sc->ti_jumbo_dmat) != 0) { 1115 device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); 1116 return (ENOBUFS); 1117 } 1118 1119 if (bus_dmamem_alloc(sc->ti_jumbo_dmat, 1120 (void**)&sc->ti_cdata.ti_jumbo_buf, | 149 { ALT_VENDORID, ALT_DEVICEID_ACENIC, 150 "Alteon AceNIC 1000baseSX Gigabit Ethernet" }, 151 { ALT_VENDORID, ALT_DEVICEID_ACENIC_COPPER, 152 "Alteon AceNIC 1000baseT Gigabit Ethernet" }, 153 { TC_VENDORID, TC_DEVICEID_3C985, 154 "3Com 3c985-SX Gigabit Ethernet" }, 155 { NG_VENDORID, NG_DEVICEID_GA620, 156 "Netgear GA620 1000baseSX Gigabit Ethernet" }, --- 956 unchanged lines hidden (view full) --- 1113 NULL, NULL, /* lockfunc, lockarg */ 1114 &sc->ti_jumbo_dmat) != 0) { 1115 device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); 1116 return (ENOBUFS); 1117 } 1118 1119 if (bus_dmamem_alloc(sc->ti_jumbo_dmat, 1120 (void**)&sc->ti_cdata.ti_jumbo_buf, |
1121 BUS_DMA_NOWAIT, &sc->ti_jumbo_dmamap) != 0) { | 1121 BUS_DMA_NOWAIT | BUS_DMA_COHERENT, 1122 &sc->ti_jumbo_dmamap) != 0) { |
1122 device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); 1123 return (ENOBUFS); 1124 } 1125 1126 SLIST_INIT(&sc->ti_jfree_listhead); 1127 SLIST_INIT(&sc->ti_jinuse_listhead); 1128 1129 /* --- 1117 unchanged lines hidden (view full) --- 2247/* 2248 * Probe for a Tigon chip. Check the PCI vendor and device IDs 2249 * against our list and return its name if we find a match. 2250 */ 2251static int 2252ti_probe(dev) 2253 device_t dev; 2254{ | 1123 device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); 1124 return (ENOBUFS); 1125 } 1126 1127 SLIST_INIT(&sc->ti_jfree_listhead); 1128 SLIST_INIT(&sc->ti_jinuse_listhead); 1129 1130 /* --- 1117 unchanged lines hidden (view full) --- 2248/* 2249 * Probe for a Tigon chip. Check the PCI vendor and device IDs 2250 * against our list and return its name if we find a match. 2251 */ 2252static int 2253ti_probe(dev) 2254 device_t dev; 2255{ |
2255 struct ti_type *t; | 2256 const struct ti_type *t; |
2256 2257 t = ti_devs; 2258 2259 while (t->ti_name != NULL) { 2260 if ((pci_get_vendor(dev) == t->ti_vid) && 2261 (pci_get_device(dev) == t->ti_did)) { 2262 device_set_desc(dev, t->ti_name); 2263 return (BUS_PROBE_DEFAULT); --- 120 unchanged lines hidden (view full) --- 2384 NULL, NULL, /* lockfunc, lockarg */ 2385 &sc->ti_rdata_dmat) != 0) { 2386 device_printf(dev, "Failed to allocate rdata dmat\n"); 2387 error = ENOMEM; 2388 goto fail; 2389 } 2390 2391 if (bus_dmamem_alloc(sc->ti_rdata_dmat, (void**)&sc->ti_rdata, | 2257 2258 t = ti_devs; 2259 2260 while (t->ti_name != NULL) { 2261 if ((pci_get_vendor(dev) == t->ti_vid) && 2262 (pci_get_device(dev) == t->ti_did)) { 2263 device_set_desc(dev, t->ti_name); 2264 return (BUS_PROBE_DEFAULT); --- 120 unchanged lines hidden (view full) --- 2385 NULL, NULL, /* lockfunc, lockarg */ 2386 &sc->ti_rdata_dmat) != 0) { 2387 device_printf(dev, "Failed to allocate rdata dmat\n"); 2388 error = ENOMEM; 2389 goto fail; 2390 } 2391 2392 if (bus_dmamem_alloc(sc->ti_rdata_dmat, (void**)&sc->ti_rdata, |
2392 BUS_DMA_NOWAIT, &sc->ti_rdata_dmamap) != 0) { | 2393 BUS_DMA_NOWAIT | BUS_DMA_COHERENT, 2394 &sc->ti_rdata_dmamap) != 0) { |
2393 device_printf(dev, "Failed to allocate rdata memory\n"); 2394 error = ENOMEM; 2395 goto fail; 2396 } 2397 2398 if (bus_dmamap_load(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, 2399 sc->ti_rdata, sizeof(struct ti_ring_data), 2400 ti_rdata_cb, sc, BUS_DMA_NOWAIT) != 0) { --- 81 unchanged lines hidden (view full) --- 2482 /* Set up ifnet structure */ 2483 ifp->if_softc = sc; 2484 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 2485 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 2486 ifp->if_ioctl = ti_ioctl; 2487 ifp->if_start = ti_start; 2488 ifp->if_init = ti_init; 2489 ifp->if_baudrate = 1000000000; | 2395 device_printf(dev, "Failed to allocate rdata memory\n"); 2396 error = ENOMEM; 2397 goto fail; 2398 } 2399 2400 if (bus_dmamap_load(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, 2401 sc->ti_rdata, sizeof(struct ti_ring_data), 2402 ti_rdata_cb, sc, BUS_DMA_NOWAIT) != 0) { --- 81 unchanged lines hidden (view full) --- 2484 /* Set up ifnet structure */ 2485 ifp->if_softc = sc; 2486 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 2487 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 2488 ifp->if_ioctl = ti_ioctl; 2489 ifp->if_start = ti_start; 2490 ifp->if_init = ti_init; 2491 ifp->if_baudrate = 1000000000; |
2490 ifp->if_mtu = ETHERMTU; | |
2491 ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; 2492 2493 /* Set up ifmedia support. */ 2494 if (sc->ti_copper) { 2495 /* 2496 * Copper cards allow manual 10/100 mode selection, 2497 * but not manual 1000baseTX mode selection. Why? 2498 * Becuase currently there's no way to specify the --- 1381 unchanged lines hidden --- | 2492 ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; 2493 2494 /* Set up ifmedia support. */ 2495 if (sc->ti_copper) { 2496 /* 2497 * Copper cards allow manual 10/100 mode selection, 2498 * but not manual 1000baseTX mode selection. Why? 2499 * Becuase currently there's no way to specify the --- 1381 unchanged lines hidden --- |