diff options
Diffstat (limited to '')
-rw-r--r-- | c/src/libchip/network/if_dc.c | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/c/src/libchip/network/if_dc.c b/c/src/libchip/network/if_dc.c index 80f7c4924c..bdd1d8874f 100644 --- a/c/src/libchip/network/if_dc.c +++ b/c/src/libchip/network/if_dc.c @@ -2,10 +2,10 @@ * * Ported from FreeBSD --> RTEMS, december 03. * Daron Chabot <daron@nucleus.usask.ca> - * -- only tested with i386 bsp. + * -- only tested with i386 bsp. * -- supports *one* card (until the PCI & IRQ APIs get sorted out ;-)) * - * + * * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. * @@ -112,7 +112,7 @@ #define DRIVER_SUPPORTED #warning The if_dc driver is untested on the PPC platform !!! #endif - + #if defined(DRIVER_SUPPORTED) /* this covers the file "globally"... */ #include <bsp.h> @@ -135,7 +135,7 @@ #include <sys/malloc.h> #include <sys/systm.h> #include <bsp.h> - + /* moved to cpukit/include/rtems in CVS current ! */ /*#include "if_media.h" */ /*#include "pci.h" */ @@ -151,10 +151,10 @@ #if defined(__i386__) #define vtophys(p) (u_int32_t)(p) -#else +#else #define vtophys(p) vtophys(p) #endif - + /* #include <net/if_arp.h> #include <net/if_vlan_var.h> @@ -179,17 +179,17 @@ #include <pci/pcivar.h> #endif -/* NOTE: use mem space mapping (for now ...) +/* NOTE: use mem space mapping (for now ...) #define DC_USEIOSPACE */ - + #ifdef __alpha__ #define SRM_MEDIA #endif #include <bsp/irq.h> - + #include "if_dcreg.h" @@ -205,15 +205,15 @@ static struct dc_softc dc_softc_devs[NDRIVER]; #include "miibus_if.h" - + #ifndef lint static const char rcsid[] = "$FreeBSD: src/sys/pci/if_dc.c,v 1.9.2.41 2003/03/05 18:42:33 njl Exp $"; #endif #endif - - + + /* * Various supported device vendors/types and their names. * NOTE: @@ -417,8 +417,8 @@ DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, 0, 0); /* XXX Fixme: rtems_bsp_delay( ) for the pc386 BSP (at least) * needs work... see pc386/include/bsp.h. - * I have "a" solution, utilizing the 2nd i8254 timer, - * if anyone is interested (first timer is used for clock_tick ISR)... + * I have "a" solution, utilizing the 2nd i8254 timer, + * if anyone is interested (first timer is used for clock_tick ISR)... */ #ifdef __i386__ extern void Wait_X_ms( unsigned int ); @@ -754,7 +754,7 @@ static void dc_mii_send(sc, bits, cnt) static int dc_mii_readreg(sc, frame) struct dc_softc *sc; struct dc_mii_frame *frame; - + { int i, ack, s; @@ -766,7 +766,7 @@ static int dc_mii_readreg(sc, frame) frame->mii_opcode = DC_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + /* * Sync the PHYs. */ @@ -824,7 +824,7 @@ fail: static int dc_mii_writereg(sc, frame) struct dc_softc *sc; struct dc_mii_frame *frame; - + { int s; @@ -838,7 +838,7 @@ static int dc_mii_writereg(sc, frame) /* * Sync the PHYs. - */ + */ dc_mii_sync(sc); dc_mii_send(sc, frame->mii_stdelim, 2); @@ -1227,7 +1227,7 @@ void dc_setfilt_21143(sc) sp[h >> 4] |= 1 << (h & 0xF); } #endif - + if (ifp->if_flags & IFF_BROADCAST) { h = dc_crc_le(sc, (caddr_t)ðerbroadcastaddr); sp[h >> 4] |= 1 << (h & 0xF); @@ -1332,7 +1332,7 @@ void dc_setfilt_asix(sc) CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR0); ac_enaddr = (u_int32_t *)&sc->arpcom.ac_enaddr[0]; CSR_WRITE_4(sc, DC_AX_FILTDATA, *ac_enaddr); - + CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_PAR1); ac_enaddr = (u_int32_t *)&sc->arpcom.ac_enaddr[4]; @@ -1546,7 +1546,7 @@ static void dc_setcfg(sc, media) DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_PORTSEL); } } -#endif +#endif if ((media & IFM_GMASK) == IFM_FDX) { DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_FULLDUPLEX); @@ -1615,7 +1615,7 @@ struct dc_type *dc_devtype( int unitnum ) uint32_t rev; int rc; - + t = dc_devs; while(t->dc_name != NULL) { @@ -1627,7 +1627,7 @@ struct dc_type *dc_devtype( int unitnum ) pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ DC_PCI_CFRV, &rev); rev &= 0xFF; - + if (t->dc_did == DC_DEVICEID_98713 && rev >= DC_REVISION_98713A) t++; @@ -1901,7 +1901,7 @@ decISON(const rtems_irq_connect_data* irq) { return (BSP_irq_enabled_at_i8259s(irq->name)); } - + /* * Attach the interface. Allocate softc structures, do ifmedia @@ -1910,12 +1910,12 @@ decISON(const rtems_irq_connect_data* irq) int rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) { - int rc; + int rc; u_char eaddr[ETHER_ADDR_LEN]; - + char *unitName; int unitNumber; - + uint32_t command; struct dc_softc *sc; struct ifnet *ifp; @@ -1923,7 +1923,7 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) uint32_t revision; int error = 0, mac_offset; uint32_t value; - + /* * Get the instance number for the board we're going to configure * from the user. @@ -1947,11 +1947,11 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) return (0); } memset(sc, 0, sizeof(struct dc_softc)); - + /*unit = device_get_unit(dev);*/ sc->dc_unit = unitNumber; sc->dc_name = unitName; - + /* * Handle power management nonsense. * @@ -1965,7 +1965,7 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) } t = sc->dc_info; - + /* * Map control/status registers. */ @@ -2014,20 +2014,20 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ DC_PCI_CFBMA, &value); sc->membase = value; - + /* Allocate interrupt */ memset(&sc->irqInfo, 0, sizeof(rtems_irq_connect_data)); /*pcib_conf_read32(sig, DC_PCI_CFIT, &value); */ pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ DC_PCI_CFIT, &value); - + sc->irqInfo.name = value & 0xFF; sc->irqInfo.hdl = (rtems_irq_hdl)dc_intr; sc->irqInfo.handle = (void *)sc; /* new parameter */ sc->irqInfo.on = nop; sc->irqInfo.off = nop; sc->irqInfo.isOn = decISON; - + #ifdef BSP_SHARED_HANDLER_SUPPORT rc = BSP_install_rtems_shared_irq_handler( &sc->irqInfo ); #else @@ -2036,8 +2036,8 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) if(!rc) { rtems_panic("Can't install dec2114x irq handler.\n"); } - - + + #if 0 rid = 0; sc->dc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, @@ -2061,7 +2061,7 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) } #endif - + /* Need this info to decide on a chip type. sc->dc_info = dc_devtype(dev); */ @@ -2203,8 +2203,8 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) pci_write_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ DC_PCI_CFDD, command); } - - + + /* * Try to learn something about the supported media. * We know that ASIX and ADMtek and Davicom devices @@ -2268,7 +2268,7 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) sc->dc_ldata = malloc(sizeof(struct dc_list_data), M_DEVBUF, M_NOWAIT); - + if (sc->dc_ldata == NULL) { printk("dc%d: no memory for list buffers!\n", sc->dc_unit); if (sc->dc_pnic_rx_buf != NULL) @@ -2283,7 +2283,7 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) } bzero(sc->dc_ldata, sizeof(struct dc_list_data)); - + ifp = &sc->arpcom.ac_if; ifp->if_softc = sc; ifp->if_unit = unitNumber; /*sc->dc_unit;*/ @@ -2347,7 +2347,7 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) goto fail; } #endif - + /* * Call MI attach routine. */ @@ -2382,16 +2382,16 @@ rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) command = pci_read_config(dev, DC_PCI_CFDD, 4); command &= ~(DC_CFDD_SNOOZE_MODE|DC_CFDD_SLEEP_MODE); switch ((command >> 8) & 0xff) { - case 3: + case 3: sc->dc_srm_media = IFM_10_T; break; - case 4: + case 4: sc->dc_srm_media = IFM_10_T | IFM_FDX; break; - case 5: + case 5: sc->dc_srm_media = IFM_100_TX; break; - case 6: + case 6: sc->dc_srm_media = IFM_100_TX | IFM_FDX; break; } @@ -2663,7 +2663,7 @@ static void dc_pnic_rx_bug_war(sc, idx) * frame reception. */ dc_newbuf(sc, i, m); - bcopy(ptr, mtod(m, char *), total_len); + bcopy(ptr, mtod(m, char *), total_len); cur_rx->dc_status = rxstat | DC_RXSTAT_FIRSTFRAG; return; @@ -2759,7 +2759,7 @@ static void dc_rxeof(sc) * comes up in the ring. However, don't report long * frames as errors since they could be vlans */ - if ((rxstat & DC_RXSTAT_RXERR)){ + if ((rxstat & DC_RXSTAT_RXERR)){ if (!(rxstat & DC_RXSTAT_GIANT) || (rxstat & (DC_RXSTAT_CRCERR | DC_RXSTAT_DRIBBLE | DC_RXSTAT_MIIERE | DC_RXSTAT_COLLSEEN | @@ -2778,7 +2778,7 @@ static void dc_rxeof(sc) } } - /* No errors; receive the packet. */ + /* No errors; receive the packet. */ total_len -= ETHER_CRC_LEN; #ifdef __i386__ @@ -3168,10 +3168,10 @@ dc_daemon(void * arg) RTEMS_WAIT | RTEMS_EVENT_ANY, \ RTEMS_NO_TIMEOUT, &events); - - + + ifp = &sc->arpcom.ac_if; - + while((status = CSR_READ_4(sc, DC_ISR)) & DC_INTRS) { CSR_WRITE_4(sc, DC_ISR, status); @@ -3434,10 +3434,10 @@ static void dc_init(xsc) break; case 16: DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_16LONG); - break; + break; case 8: DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_8LONG); - break; + break; case 0: default: DC_SETBIT(sc, DC_BUSCTL, DC_CACHEALIGN_NONE); @@ -3523,7 +3523,7 @@ static void dc_init(xsc) */ if (sc->dc_flags & DC_TULIP_LEDS) { CSR_WRITE_4(sc, DC_WATCHDOG, - DC_WDOG_CTLWREN|DC_WDOG_LINK|DC_WDOG_ACTIVITY); + DC_WDOG_CTLWREN|DC_WDOG_LINK|DC_WDOG_ACTIVITY); CSR_WRITE_4(sc, DC_WATCHDOG, 0); } @@ -3563,7 +3563,7 @@ static void dc_init(xsc) struct ifreq ifr; ifr.ifr_media = sc->dc_srm_media; - ifmedia_ioctl(ifp, &ifr, &mii->mii_media, SIOCSIFMEDIA); + ifmedia_ioctl(ifp, &ifr, &mii->mii_media, SIOCSIFMEDIA); sc->dc_srm_media = 0; } #endif |