if_ti.c (227091) | if_ti.c (227092) |
---|---|
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 227091 2011-11-04 20:25:30Z yongari $"); | 80__FBSDID("$FreeBSD: head/sys/dev/ti/if_ti.c 227092 2011-11-04 20:43:37Z yongari $"); |
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> --- 830 unchanged lines hidden (view full) --- 919 if (sc->ti_rdata->ti_event_ring == NULL) 920 return; 921 922 while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { 923 e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; 924 switch (TI_EVENT_EVENT(e)) { 925 case TI_EV_LINKSTAT_CHANGED: 926 sc->ti_linkstat = TI_EVENT_CODE(e); | 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> --- 830 unchanged lines hidden (view full) --- 919 if (sc->ti_rdata->ti_event_ring == NULL) 920 return; 921 922 while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { 923 e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; 924 switch (TI_EVENT_EVENT(e)) { 925 case TI_EV_LINKSTAT_CHANGED: 926 sc->ti_linkstat = TI_EVENT_CODE(e); |
927 if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) 928 device_printf(sc->ti_dev, "10/100 link up\n"); 929 else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) 930 device_printf(sc->ti_dev, "gigabit link up\n"); 931 else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) 932 device_printf(sc->ti_dev, "link down\n"); | 927 if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) { 928 if_link_state_change(sc->ti_ifp, LINK_STATE_UP); 929 sc->ti_ifp->if_baudrate = IF_Mbps(100); 930 if (bootverbose) 931 device_printf(sc->ti_dev, 932 "10/100 link up\n"); 933 } else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) { 934 if_link_state_change(sc->ti_ifp, LINK_STATE_UP); 935 sc->ti_ifp->if_baudrate = IF_Gbps(1UL); 936 if (bootverbose) 937 device_printf(sc->ti_dev, 938 "gigabit link up\n"); 939 } else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { 940 if_link_state_change(sc->ti_ifp, 941 LINK_STATE_DOWN); 942 sc->ti_ifp->if_baudrate = 0; 943 if (bootverbose) 944 device_printf(sc->ti_dev, 945 "link down\n"); 946 } |
933 break; 934 case TI_EV_ERROR: 935 if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) 936 device_printf(sc->ti_dev, "invalid command\n"); 937 else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_UNIMP_CMD) 938 device_printf(sc->ti_dev, "unknown command\n"); 939 else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_BADCFG) 940 device_printf(sc->ti_dev, "bad config data\n"); --- 1471 unchanged lines hidden (view full) --- 2412 2413 /* Set up ifnet structure */ 2414 ifp->if_softc = sc; 2415 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 2416 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 2417 ifp->if_ioctl = ti_ioctl; 2418 ifp->if_start = ti_start; 2419 ifp->if_init = ti_init; | 947 break; 948 case TI_EV_ERROR: 949 if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) 950 device_printf(sc->ti_dev, "invalid command\n"); 951 else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_UNIMP_CMD) 952 device_printf(sc->ti_dev, "unknown command\n"); 953 else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_BADCFG) 954 device_printf(sc->ti_dev, "bad config data\n"); --- 1471 unchanged lines hidden (view full) --- 2426 2427 /* Set up ifnet structure */ 2428 ifp->if_softc = sc; 2429 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 2430 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 2431 ifp->if_ioctl = ti_ioctl; 2432 ifp->if_start = ti_start; 2433 ifp->if_init = ti_init; |
2420 ifp->if_baudrate = 1000000000; | 2434 ifp->if_baudrate = IF_Gbps(1UL); |
2421 ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; 2422 2423 /* Set up ifmedia support. */ 2424 if (sc->ti_copper) { 2425 /* 2426 * Copper cards allow manual 10/100 mode selection, 2427 * but not manual 1000baseTX mode selection. Why? 2428 * Becuase currently there's no way to specify the --- 30 unchanged lines hidden (view full) --- 2459 0600, "ti%d", sc->ti_unit); 2460 sc->dev->si_drv1 = sc; 2461 2462 /* 2463 * Call MI attach routine. 2464 */ 2465 ether_ifattach(ifp, eaddr); 2466 | 2435 ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; 2436 2437 /* Set up ifmedia support. */ 2438 if (sc->ti_copper) { 2439 /* 2440 * Copper cards allow manual 10/100 mode selection, 2441 * but not manual 1000baseTX mode selection. Why? 2442 * Becuase currently there's no way to specify the --- 30 unchanged lines hidden (view full) --- 2473 0600, "ti%d", sc->ti_unit); 2474 sc->dev->si_drv1 = sc; 2475 2476 /* 2477 * Call MI attach routine. 2478 */ 2479 ether_ifattach(ifp, eaddr); 2480 |
2481 /* Driver supports link state tracking. */ 2482 ifp->if_capabilities |= IFCAP_LINKSTATE; 2483 ifp->if_capenable |= IFCAP_LINKSTATE; 2484 |
|
2467 /* Hook interrupt last to avoid having to lock softc */ 2468 error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE, 2469 NULL, ti_intr, sc, &sc->ti_intrhand); 2470 2471 if (error) { 2472 device_printf(dev, "couldn't set up irq\n"); 2473 goto fail; 2474 } --- 1317 unchanged lines hidden --- | 2485 /* Hook interrupt last to avoid having to lock softc */ 2486 error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE, 2487 NULL, ti_intr, sc, &sc->ti_intrhand); 2488 2489 if (error) { 2490 device_printf(dev, "couldn't set up irq\n"); 2491 goto fail; 2492 } --- 1317 unchanged lines hidden --- |