From a3d3d9aeda34fd9c4535b6d59cf90f42528d273a Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Tue, 20 Apr 2004 10:43:39 +0000 Subject: Remove stray white spaces. --- c/src/libchip/network/cs8900.c | 2 +- c/src/libchip/network/cs8900.h | 48 +++++----- c/src/libchip/network/dec21140.c | 106 ++++++++++----------- c/src/libchip/network/elnk.c | 196 +++++++++++++++++++------------------- c/src/libchip/network/i82586.c | 106 ++++++++++----------- c/src/libchip/network/i82586reg.h | 2 +- c/src/libchip/network/i82586var.h | 8 +- c/src/libchip/network/if_fxp.c | 38 ++++---- c/src/libchip/network/if_fxpreg.h | 6 +- c/src/libchip/network/if_fxpvar.h | 12 +-- c/src/libchip/network/mii.h | 2 +- c/src/libchip/network/open_eth.c | 4 +- c/src/libchip/network/open_eth.h | 26 ++--- c/src/libchip/network/sonic.c | 50 +++++----- c/src/libchip/network/sonic.h | 6 +- 15 files changed, 306 insertions(+), 306 deletions(-) (limited to 'c/src/libchip/network') diff --git a/c/src/libchip/network/cs8900.c b/c/src/libchip/network/cs8900.c index 3dbce70a8e..bf580c93fe 100644 --- a/c/src/libchip/network/cs8900.c +++ b/c/src/libchip/network/cs8900.c @@ -23,7 +23,7 @@ CS8900 RTEMS driver. See the header file for details. - + */ #include diff --git a/c/src/libchip/network/cs8900.h b/c/src/libchip/network/cs8900.h index 036b6d6ced..67b37c7b48 100644 --- a/c/src/libchip/network/cs8900.h +++ b/c/src/libchip/network/cs8900.h @@ -2,10 +2,10 @@ ------------------------------------------------------------------------ cs8900.h,v 1.3 2002/09/07 23:09:47 joel Exp ------------------------------------------------------------------------ - + Copyright Cybertec Pty Ltd, 2000 All rights reserved Cybertec Pty Ltd, 2000 - + Port to the DIMM PC copyright (c) 2004 Angelo Fraietta This project has been assisted by the Commonwealth Government through the Australia Council, its arts funding and advisory body. @@ -16,7 +16,7 @@ The license and distribution terms for this file may be found in the file LICENSE in this distribution or at http://www.OARcorp.com/rtems/license.html. - + ------------------------------------------------------------------------ CS8900 RTEMS driver. @@ -27,7 +27,7 @@ completely different bus, byte order and interrupt structures. An example BSP backend is provided in the pci386 BSP. - + The BSP provides the following functions: cs8900_io_set_reg @@ -70,7 +70,7 @@ attached to the networking stack. It also creates a 'struct rtems_bsdnet_ifconfig' which is used to attach the interface to the networking stack. The following code declares the BSD config: - + static cs8900_device cs8900; static struct rtems_bsdnet_ifconfig cs8900_ifconfig = @@ -113,9 +113,9 @@ #define ETHERNET_IRQ_LEVEL 0 cs8900_device *cs = &cs8900; - + memset (cs, 0, sizeof (cs8900_device)); - + cs->dev = 0; cs->io_base = ETHERNET_IO_BASE; cs->mem_base = ETHERNET_MEM_BASE; @@ -123,11 +123,11 @@ cs->rx_queue_size = 30; cs8900_ifconfig.drv_ctrl = &cs8900; - + printf ("CS8900 initialisation\n"); - + rtems_bsdnet_attach (&cs8900_ifconfig); - + flags = IFF_UP; if (rtems_bsdnet_ifconfig (cs8900_ifconfig.name, SIOCSIFFLAGS, @@ -422,7 +422,7 @@ #define CS8900_SELF_STATUS_3_3_V (1 << 6) #define CS8900_SELF_STATUS_INITD (1 << 7) #define CS8900_SELF_STATUS_SIBUST (1 << 8) -#define CS8900_SELF_STATUS_EEPROM_PRESENT (1 << 9) +#define CS8900_SELF_STATUS_EEPROM_PRESENT (1 << 9) #define CS8900_SELF_STATUS_EEPROM_OK (1 << 10) #define CS8900_SELF_STATUS_EL_PRESENT (1 << 11) #define CS8900_SELF_STATUS_EE_SIZE (1 << 12) @@ -453,7 +453,7 @@ #define CS8900_TRACE_SIZE (400) /* - * The default receive queue size. If the BSP sets this field to + * The default receive queue size. If the BSP sets this field to * 0 this default is used. */ #define CS8900_RX_QUEUE_SIZE (30) @@ -489,12 +489,12 @@ typedef struct unsigned long tx_underrun_errors; unsigned long tx_dropped; unsigned long tx_resends; - + /* interrupt watch dog */ unsigned long int_swint_req; unsigned long int_swint_res; unsigned long int_lockup; - + unsigned long interrupts; } eth_statistics; @@ -538,7 +538,7 @@ typedef struct unsigned char mac_address[6]; /* - * The bsdnet information structure. + * The bsdnet information structure. */ struct arpcom arpcom; @@ -549,29 +549,29 @@ typedef struct int accept_bcast; int tx_active; - + rtems_id rx_task; rtems_id tx_task; - /* + /* * The queues. FIXME : these should be changed to be mbuf lists. */ struct mbuf *rx_ready_head; struct mbuf *rx_ready_tail; int rx_ready_len; - + struct mbuf *rx_loaded_head; struct mbuf *rx_loaded_tail; int rx_loaded_len; /* - * Number of mbufs queued for the interrupt handler to + * Number of mbufs queued for the interrupt handler to * loop reading. */ int rx_queue_size; - + #if CS8900_TRACE unsigned short trace_key[CS8900_TRACE_SIZE]; unsigned long trace_var[CS8900_TRACE_SIZE]; @@ -580,11 +580,11 @@ typedef struct #endif /** - * Standard(!) ethernet statistics + * Standard(!) ethernet statistics */ eth_statistics eth_stats; - + } cs8900_device; /* @@ -611,7 +611,7 @@ int cs8900_link_active (cs8900_device *cs); int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config, int attaching); - + /** * The BSP specific interrupt wrapper calls this function when a device * interrupt occurs. @@ -700,7 +700,7 @@ unsigned short cs8900_io_get_reg (cs8900_device *cs, unsigned short reg); * @param data The data to be written to the register. */ -void cs8900_mem_set_reg (cs8900_device *cs, +void cs8900_mem_set_reg (cs8900_device *cs, unsigned long reg, unsigned short data); /** diff --git a/c/src/libchip/network/dec21140.c b/c/src/libchip/network/dec21140.c index 9184b6648b..b7099cb3b7 100644 --- a/c/src/libchip/network/dec21140.c +++ b/c/src/libchip/network/dec21140.c @@ -82,7 +82,7 @@ #include #include #include - + #if defined(__i386__) #include #endif @@ -94,7 +94,7 @@ #undef malloc #endif #ifdef free -#undef free +#undef free #endif #define DEC_DEBUG @@ -158,12 +158,12 @@ #define CSR0_MODE 0x0020e002 /* 01b08000 */ #endif #define ROM_ADDRESS 0x00004800 -#define CSR6_INIT 0x022cc000 /* 022c0000 020c0000 */ -#define CSR6_TX 0x00002000 -#define CSR6_TXRX 0x00002002 +#define CSR6_INIT 0x022cc000 /* 022c0000 020c0000 */ +#define CSR6_TX 0x00002000 +#define CSR6_TXRX 0x00002002 #define IT_SETUP 0x000100c0 /* 000100e0 */ -#define CLEAR_IT 0xFFFFFFFF -#define NO_IT 0x00000000 +#define CLEAR_IT 0xFFFFFFFF +#define NO_IT 0x00000000 @@ -172,7 +172,7 @@ struct MD { /* used by hardware */ volatile uint32_t status; volatile uint32_t counts; - volatile uint32_t buf1, buf2; + volatile uint32_t buf1, buf2; /* used by software */ volatile struct mbuf *m; volatile struct MD *next; @@ -222,13 +222,13 @@ struct MD { ** events so only requesting units are serviced. */ -static rtems_event_set unit_signals[NDECDRIVER]= { RTEMS_EVENT_1, +static rtems_event_set unit_signals[NDECDRIVER]= { RTEMS_EVENT_1, RTEMS_EVENT_2, - RTEMS_EVENT_3, + RTEMS_EVENT_3, RTEMS_EVENT_4, - RTEMS_EVENT_5, + RTEMS_EVENT_5, RTEMS_EVENT_6, - RTEMS_EVENT_7, + RTEMS_EVENT_7, RTEMS_EVENT_8 }; @@ -279,7 +279,7 @@ struct dec21140_softc { volatile struct MD *nextRxMD; volatile unsigned char *bufferBase; int acceptBroadcast; - + volatile struct MD *TxMD; volatile struct MD *SentTxMD; int PendingTxCount; @@ -300,7 +300,7 @@ struct dec21140_softc { unsigned long rxBadCRC; unsigned long rxOverrun; unsigned long rxCollision; - + unsigned long txInterrupts; unsigned long txDeferred; unsigned long txHeartbeat; @@ -353,10 +353,10 @@ static int eeget16(volatile unsigned int *ioaddr, int location) int i; unsigned short retval = 0; int read_cmd = location | EE_READ_CMD; - + st_le32(ioaddr, EE_ENB & ~EE_CS); st_le32(ioaddr, EE_ENB); - + /* Shift the read command bits out. */ for (i = 10; i >= 0; i--) { short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; @@ -368,7 +368,7 @@ static int eeget16(volatile unsigned int *ioaddr, int location) rtems_bsp_delay_in_bus_cycles(200); } st_le32(ioaddr, EE_ENB); - + for (i = 16; i > 0; i--) { st_le32(ioaddr, EE_ENB | EE_SHIFT_CLK); rtems_bsp_delay_in_bus_cycles(200); @@ -481,7 +481,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) { int i,st; volatile unsigned int *tbase; - volatile unsigned char *cp, *setup_frm, *eaddrs; + volatile unsigned char *cp, *setup_frm, *eaddrs; volatile unsigned char *buffer; volatile struct MD *rmd; @@ -503,16 +503,16 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) * WARNING : First write in CSR6 * Then Reset the chip ( 1 in CSR0) */ - st_le32( (tbase+memCSR6), CSR6_INIT); - st_le32( (tbase+memCSR0), RESET_CHIP); + st_le32( (tbase+memCSR6), CSR6_INIT); + st_le32( (tbase+memCSR0), RESET_CHIP); rtems_bsp_delay_in_bus_cycles(200); - st_le32( (tbase+memCSR7), NO_IT); + st_le32( (tbase+memCSR7), NO_IT); /* * Init CSR0 */ - st_le32( (tbase+memCSR0), CSR0_MODE); + st_le32( (tbase+memCSR0), CSR0_MODE); /* * Init RX ring @@ -523,7 +523,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) sc->bufferBase = cp; cp += (CPU_CACHE_ALIGNMENT_FOR_BUFFER - (int)cp) & (CPU_CACHE_ALIGNMENT_FOR_BUFFER - 1); #if defined(__i386__) -#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA +#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA if (_CPU_is_paging_enabled()) _CPU_change_memory_mapping_attribute (NULL, cp, @@ -542,7 +542,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) for (i=0 ; inumRxbuffers; i++) { struct mbuf *m; - + /* allocate an mbuf for each receive descriptor */ MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); @@ -550,7 +550,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) rmd->m = m; rmd->buf2 = phys_to_bus(rmd+1); - rmd->buf1 = phys_to_bus(mtod(m, void *)); + rmd->buf1 = phys_to_bus(mtod(m, void *)); rmd->status = 0x80000000; rmd->counts = 0xfdc00000 | (RBUF_SIZE); rmd->next = rmd+1; @@ -576,7 +576,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) (rmd+i)->status = 0x0; (rmd+i)->next = rmd+i+1; (rmd+i)->m = 0; - } + } /* * mark last TX buffer. @@ -614,7 +614,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) st_le32( (tbase+memCSR1), 1); while (rmd->status != 0x7fffffff); - rmd->counts = 0x01000000; + rmd->counts = 0x01000000; sc->TxMD = rmd+1; @@ -680,7 +680,7 @@ dec21140_rxDaemon (void *arg) while((rmd->status & 0x80000000) == 0) { /* printk("unit %i rx\n", ifp->if_unit ); */ - + /* pass on the packet in the mbuf */ len = (rmd->status >> 16) & 0x7ff; m = (struct mbuf *)(rmd->m); @@ -698,7 +698,7 @@ dec21140_rxDaemon (void *arg) /* mark the descriptor as ready to receive */ rmd->status = 0x80000000; - + rmd=rmd->next; } @@ -729,7 +729,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) tbase = dp->base; /* * Waiting for Transmitter ready - */ + */ tmd = dp->TxMD; n = m; @@ -741,7 +741,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) len = 0; temp = (volatile unsigned char *)(bus_to_phys(tmd->buf1)); - + for (;;) { len += m->m_len; @@ -752,7 +752,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) } if (len < ET_MINLEN) len = ET_MINLEN; - tmd->counts = 0xe1000000 | (len & 0x7ff); + tmd->counts = 0xe1000000 | (len & 0x7ff); tmd->status = 0x80000000; st_le32( (tbase+memCSR1), 0x1); @@ -778,13 +778,13 @@ dec21140_txDaemon (void *arg) int i; rtems_event_set events; - for (;;) + for (;;) { /* * Wait for packets bound for any of the dec units */ rtems_bsdnet_event_receive( RTEMS_ALL_EVENTS, - RTEMS_EVENT_ANY | RTEMS_WAIT, + RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); for(i=0; i< NDECDRIVER; i++ ) @@ -799,7 +799,7 @@ dec21140_txDaemon (void *arg) /* * Send packets till queue is empty */ - for(;;) + for(;;) { IF_DEQUEUE(&ifp->if_snd, m); if( !m ) break; @@ -853,7 +853,7 @@ dec21140_init (void *arg) */ tbase = sc->base; st_le32( (tbase+memCSR5), IT_SETUP); - st_le32( (tbase+memCSR7), IT_SETUP); + st_le32( (tbase+memCSR7), IT_SETUP); st_le32( (unsigned int*)(tbase+memCSR6), CSR6_INIT | CSR6_TXRX); /* @@ -957,7 +957,7 @@ dec21140_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: dec21140_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -1044,7 +1044,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if (pcib_init() == PCIB_ERR_NOTPRESENT) rtems_panic("PCI BIOS not found !!"); - + /* * Try to find the network card on the PCI bus. Probe for a DEC 21140 * card first. If not found probe the bus for a DEC/Intel 21143 card. @@ -1063,7 +1063,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) else rtems_panic("DEC PCI network card not found !!\n"); } -#endif +#endif #if defined(__PPC__) /* * Find the board @@ -1074,7 +1074,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if( BSP_pciFindDevice( PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21143, unitNumber-1, &pbus, &pdev, &pfun) != -1 ) { - printk("dec21143 : found device '%s', PPC support has not been tested. Using it anyway.\n", + printk("dec21143 : found device '%s', PPC support has not been tested. Using it anyway.\n", config->name ); pci_write_config_dword(pbus, @@ -1092,9 +1092,9 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) } #ifdef DEC_DEBUG - else + else { - printk("dec21140 : found device '%s', bus 0x%02x, dev 0x%02x, func 0x%02x\n", + printk("dec21140 : found device '%s', bus 0x%02x, dev 0x%02x, func 0x%02x\n", config->name, pbus, pdev, pfun); } #endif @@ -1112,7 +1112,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc = &dec21140_softc[unitNumber - 1]; ifp = &sc->arpcom.ac_if; - if (ifp->if_softc != NULL) + if (ifp->if_softc != NULL) { printk("dec2114x : unit %i already in use.\n", unitNumber ); return 0; @@ -1125,7 +1125,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc->ioevent = unit_signals[unitNumber-1]; /* - ** Save the buffer counts + ** Save the buffer counts */ sc->numRxbuffers = (config->rbuf_count) ? config->rbuf_count : NRXBUFS; sc->numTxbuffers = (config->xbuf_count) ? config->xbuf_count : NTXBUFS; @@ -1142,7 +1142,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) pcib_conf_read32(signature, 16, &value); sc->port = value & ~IO_MASK; - + pcib_conf_read32(signature, 20, &value); if (_CPU_is_paging_enabled()) _CPU_map_phys_address((void **) &(sc->base), @@ -1151,7 +1151,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) PTE_CACHE_DISABLE | PTE_WRITABLE); else sc->base = (unsigned int *)(value & ~MEM_MASK); - + pcib_conf_read8(signature, 60, &interrupt); cvalue = interrupt; #endif @@ -1163,14 +1163,14 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) &lvalue); sc->port = lvalue & (unsigned int)(~IO_MASK); - + (void)pci_read_config_dword(pbus, pdev, pfun, PCI_BASE_ADDRESS_1, &lvalue); - tmp = (unsigned int)(lvalue & (unsigned int)(~MEM_MASK)) + tmp = (unsigned int)(lvalue & (unsigned int)(~MEM_MASK)) + (unsigned int)PCI_MEM_BASE; sc->base = (unsigned int *)(tmp); @@ -1191,8 +1191,8 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) pci_write_config_word(pbus, pdev, pfun, PCI_COMMAND, (uint16_t) ( PCI_COMMAND_MEMORY | - PCI_COMMAND_MASTER | - PCI_COMMAND_INVALIDATE | + PCI_COMMAND_MASTER | + PCI_COMMAND_INVALIDATE | PCI_COMMAND_WAIT | PCI_COMMAND_FAST_BACK ) ); #endif @@ -1230,7 +1230,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) for (i=0 ; i<(ETHER_ADDR_LEN/2); i++){ sc->arpcom.ac_enaddr[2*i] = rombuf.c[20+2*i+1]; sc->arpcom.ac_enaddr[2*i+1] = rombuf.c[20+2*i]; - } + } #endif #if defined(__PPC__) memcpy (sc->arpcom.ac_enaddr, rombuf.c+20, ETHER_ADDR_LEN); @@ -1276,11 +1276,11 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) /* * Start driver tasks if this is the first dec unit initialized */ - if (txDaemonTid == 0) + if (txDaemonTid == 0) { rxDaemonTid = rtems_bsdnet_newproc( "DCrx", 4096, dec21140_rxDaemon, NULL); - + txDaemonTid = rtems_bsdnet_newproc( "DCtx", 4096, dec21140_txDaemon, NULL); #ifdef DEC_DEBUG diff --git a/c/src/libchip/network/elnk.c b/c/src/libchip/network/elnk.c index 2f6bc18d0a..8ec84daed0 100644 --- a/c/src/libchip/network/elnk.c +++ b/c/src/libchip/network/elnk.c @@ -127,7 +127,7 @@ #undef malloc #endif #ifdef free -#undef free +#undef free #endif #define ELNK_DEBUG @@ -181,13 +181,13 @@ ** events so only requesting units are serviced. */ -static rtems_event_set unit_signals[NUM_UNITS]= { RTEMS_EVENT_1, +static rtems_event_set unit_signals[NUM_UNITS]= { RTEMS_EVENT_1, RTEMS_EVENT_2, - RTEMS_EVENT_3, + RTEMS_EVENT_3, RTEMS_EVENT_4, - RTEMS_EVENT_5, + RTEMS_EVENT_5, RTEMS_EVENT_6, - RTEMS_EVENT_7, + RTEMS_EVENT_7, RTEMS_EVENT_8 }; @@ -757,7 +757,7 @@ struct xl_mii_frame { -struct xl_stats +struct xl_stats { /* accumulated stats */ u_int16_t xl_carrier_lost; @@ -797,7 +797,7 @@ struct xl_stats -struct xl_type +struct xl_type { u_int16_t xl_vid; u_int16_t xl_did; @@ -876,7 +876,7 @@ static struct xl_type xl_devs[] = { /* rx message descriptor entry, ensure the struct is aligned to 8 bytes */ -struct RXMD +struct RXMD { /* used by hardware */ volatile uint32_t next; @@ -894,7 +894,7 @@ struct RXMD #define NUM_FRAGS 6 -/* +/* * tx message descriptor entry, ensure the struct is aligned to 8 bytes */ @@ -904,7 +904,7 @@ struct tfrag volatile uint32_t length; } __attribute__ ((packed)); -struct TXMD +struct TXMD { /* used by hardware */ volatile uint32_t next; @@ -926,7 +926,7 @@ struct TXMD /* * Per-device data */ -struct elnk_softc +struct elnk_softc { struct arpcom arpcom; @@ -1043,7 +1043,7 @@ xl_wait(sc) { register int i; - for(i = 0; i < XL_TIMEOUT; i++) + for(i = 0; i < XL_TIMEOUT; i++) { if (!(CSR_READ_2(sc, XL_STATUS) & XL_STAT_CMDBUSY)) break; @@ -1130,7 +1130,7 @@ static int xl_mii_readreg(sc, frame) struct elnk_softc *sc; struct xl_mii_frame *frame; - + { int i, ack; @@ -1141,7 +1141,7 @@ xl_mii_readreg(sc, frame) frame->mii_opcode = XL_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + /* * Select register window 4. */ @@ -1214,7 +1214,7 @@ static int xl_mii_writereg(sc, frame) struct elnk_softc *sc; struct xl_mii_frame *frame; - + { /* * Set up frame for TX. @@ -1223,7 +1223,7 @@ xl_mii_writereg(sc, frame) frame->mii_stdelim = XL_MII_STARTDELIM; frame->mii_opcode = XL_MII_WRITEOP; frame->mii_turnaround = XL_MII_TURNAROUND; - + /* * Select the window 4. */ @@ -1371,7 +1371,7 @@ xl_read_eeprom(sc, dest, off, cnt, swap) for (i = 0; i < cnt; i++) { if (sc->xl_flags & XL_FLAG_8BITROM) - CSR_WRITE_2(sc, XL_W0_EE_CMD, + CSR_WRITE_2(sc, XL_W0_EE_CMD, XL_EE_8BIT_READ | EEPROM_8BIT_OFFSET(off + i)); else CSR_WRITE_2(sc, XL_W0_EE_CMD, @@ -1384,7 +1384,7 @@ xl_read_eeprom(sc, dest, off, cnt, swap) if (swap) *ptr = ntohs(word); else - *ptr = word; + *ptr = word; } return(err ? 1 : 0); @@ -1403,12 +1403,12 @@ xl_stats_update(timerid,xsc) u_int32_t t1; sc->xl_stats.intstatus = CSR_READ_2(sc, XL_STATUS); - + sc->xl_stats.miianr = xl_miibus_readreg(sc, 0x18, MII_ANAR ); sc->xl_stats.miipar = xl_miibus_readreg(sc, 0x18, MII_ANLPAR ); sc->xl_stats.miistatus = xl_miibus_readreg(sc, 0x18, MII_BMSR ); sc->xl_stats.miicmd = xl_miibus_readreg(sc, 0x18, MII_BMCR ); - + XL_SEL_WIN(1); sc->xl_stats.rxstatus = CSR_READ_2(sc, XL_W1_RX_STATUS ); sc->xl_stats.txstatus = CSR_READ_1(sc, XL_W1_TX_STATUS ); @@ -1418,7 +1418,7 @@ xl_stats_update(timerid,xsc) sc->xl_stats.internalconfig = CSR_READ_4(sc, XL_W3_INTERNAL_CFG); sc->xl_stats.mac_control = CSR_READ_2(sc, XL_W3_MAC_CTRL); sc->xl_stats.txfree = CSR_READ_2(sc, XL_W3_FREE_TX ); - + /* Read all the stats registers. */ XL_SEL_WIN(6); @@ -1486,7 +1486,7 @@ xl_reset(sc) register int i; XL_SEL_WIN(0); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET | + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET | ((sc->xl_flags & XL_FLAG_WEIRDRESET) ? XL_RESETOPT_DISADVFD:0)); @@ -1512,12 +1512,12 @@ xl_reset(sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET); xl_wait(sc); - if (sc->xl_flags & XL_FLAG_INVERT_LED_PWR || - sc->xl_flags & XL_FLAG_INVERT_MII_PWR) + if (sc->xl_flags & XL_FLAG_INVERT_LED_PWR || + sc->xl_flags & XL_FLAG_INVERT_MII_PWR) { XL_SEL_WIN(2); CSR_WRITE_2(sc, XL_W2_RESET_OPTIONS, CSR_READ_2(sc, - XL_W2_RESET_OPTIONS) + XL_W2_RESET_OPTIONS) | ((sc->xl_flags & XL_FLAG_INVERT_LED_PWR)?XL_RESETOPT_INVERT_LED:0) | ((sc->xl_flags & XL_FLAG_INVERT_MII_PWR)?XL_RESETOPT_INVERT_MII:0) ); @@ -1896,7 +1896,7 @@ static int elnkIsOn(const rtems_irq_connect_data* irq) -static void +static void elnk_start_txchain( struct elnk_softc *sc, struct TXMD *chainhead ) { xl_wait(sc); @@ -1935,7 +1935,7 @@ elnk_interrupt_handler ( struct elnk_softc *sc ) printk("etherlink : unit elnk%d intstatus %04x\n", sc->xl_unit, status ); #endif - if (status & XL_STAT_UP_COMPLETE) + if (status & XL_STAT_UP_COMPLETE) { #if 0 printk("etherlink : unit elnk%d rx\n", sc->xl_unit ); @@ -1990,7 +1990,7 @@ elnk_interrupt_handler ( struct elnk_softc *sc ) */ if( (int)sc->last_txchain_head->chainptr == -1 ) { - /* + /* ** single packet was sent so no indirection to the last ** entry in the chain. since chainptr is != 0, then ** another chain is ready starting from the packet AFTER @@ -2032,18 +2032,18 @@ elnk_interrupt_handler ( struct elnk_softc *sc ) } - if (status & XL_STAT_ADFAIL) + if (status & XL_STAT_ADFAIL) { printk("etherlink : unit elnk%d Catastrophic bus failure\n", sc->xl_unit ); } - if (status & XL_STAT_STATSOFLOW) + if (status & XL_STAT_STATSOFLOW) { sc->xl_stats_no_timeout = 1; xl_stats_update(sc->stat_timer_id,sc); sc->xl_stats_no_timeout = 0; } } - + #if 0 { @@ -2102,13 +2102,13 @@ elnk_initialize_hardware (struct elnk_softc *sc) /* * Init RX ring */ - cp = (unsigned char *)malloc( (ringsize = ((rxsize = (sc->numRxbuffers * sizeof(struct RXMD))) + + cp = (unsigned char *)malloc( (ringsize = ((rxsize = (sc->numRxbuffers * sizeof(struct RXMD))) + (txsize = (sc->numTxbuffers * sizeof(struct TXMD)))) ) + + CPU_CACHE_ALIGNMENT_FOR_BUFFER); sc->bufferBase = cp; cp += (CPU_CACHE_ALIGNMENT_FOR_BUFFER - (int)cp) & (CPU_CACHE_ALIGNMENT_FOR_BUFFER - 1); #if defined(__i386__) -#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA +#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA if (_CPU_is_paging_enabled()) _CPU_change_memory_mapping_attribute (NULL, cp, ringsize, PTE_CACHE_DISABLE | PTE_WRITABLE); @@ -2124,7 +2124,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) { struct mbuf *m; struct RXMD *nxtmd; - /* + /* * The rx ring is easy as its just an array of RXMD structs. New * mbuf entries are allocated from the stack whenever the rx * daemon forwards an incoming packet into it. Here, we @@ -2136,7 +2136,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) { rtems_panic ("etherlink : unit elnk%d rx ring entry %d not aligned to 8 bytes\n", sc->xl_unit, i ); } - + /* allocate an mbuf for each receive descriptor */ MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); @@ -2161,7 +2161,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) { struct TXMD *thismd, *nxtmd; - /* + /* * The tx ring is more complex. Each MD has an array of fragment * descriptors that are loaded from each packet as they arrive * from the stack. Each packet gets one ring entry, this allows @@ -2217,7 +2217,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) sc->arpcom.ac_enaddr[0], sc->arpcom.ac_enaddr[1], sc->arpcom.ac_enaddr[2], sc->arpcom.ac_enaddr[3], sc->arpcom.ac_enaddr[4], sc->arpcom.ac_enaddr[5], - sc->xl_unit, + sc->xl_unit, (unsigned)sc->ioaddr, sc->irqInfo.name ); #endif @@ -2291,13 +2291,13 @@ elnk_rxDaemon (void *arg) */ while( (rxstat = ld_le32(&rmd->status)) ) { - if (rxstat & XL_RXSTAT_UP_ERROR) + if (rxstat & XL_RXSTAT_UP_ERROR) { printk("unit %i up error\n", sc->xl_unit ); ifp->if_ierrors++; } - if( (rxstat & XL_RXSTAT_UP_CMPLT) ) + if( (rxstat & XL_RXSTAT_UP_CMPLT) ) { #if 0 @@ -2337,7 +2337,7 @@ elnk_rxDaemon (void *arg) } /* clear descriptor status */ rmd->status = 0; - + rmd = rmd->next_md; } @@ -2377,13 +2377,13 @@ elnk_txDaemon (void *arg) int chainCount,i; rtems_event_set events; - for (;;) + for (;;) { /* * Wait for any unit's signal to wake us up */ rtems_bsdnet_event_receive( RTEMS_ALL_EVENTS, - RTEMS_EVENT_ANY | RTEMS_WAIT, + RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); for(i=0; i< NUM_UNITS; i++ ) @@ -2401,10 +2401,10 @@ elnk_txDaemon (void *arg) chainCount = 0; firstmd = NULL; - + lastmd = sc->last_tx_md; - for(;;) + for(;;) { /* ** Check the chain recovery queue whenever the tx @@ -2462,7 +2462,7 @@ elnk_txDaemon (void *arg) break; } - + IF_DEQUEUE(&ifp->if_snd, m); if( !m ) break; @@ -2482,7 +2482,7 @@ elnk_txDaemon (void *arg) if( m ) { printk("etherlink : unit elnk%d tx fragments exhausted, truncating packet!\n", sc->xl_unit); - st_le32( &nextmd->txfrags[NUM_FRAGS-1].length, XL_LAST_FRAG | + st_le32( &nextmd->txfrags[NUM_FRAGS-1].length, XL_LAST_FRAG | ld_le32( &nextmd->txfrags[NUM_FRAGS-1].length) ); } } @@ -2493,7 +2493,7 @@ elnk_txDaemon (void *arg) int i; printk("unit %d queued pkt (%08x) ", sc->xl_unit, (uint32_t)pkt ); for(delim="", i=0; i < sizeof(struct ether_header); i++, delim=":") - printk("%s%02x", delim, (char) pkt[i] ); + printk("%s%02x", delim, (char) pkt[i] ); printk("\n"); } #endif @@ -2504,7 +2504,7 @@ elnk_txDaemon (void *arg) st_le32( &nextmd->status, 0); if( !firstmd ) - { + { /* keep track of the first packet we add to the chain */ firstmd = nextmd; @@ -2540,21 +2540,21 @@ elnk_txDaemon (void *arg) /* save the last descriptor we set up in the chain */ sc->last_tx_md = lastmd; - /* + /* * We've added one or more packets to a chain, flag * the last packet so we get an dnComplete interrupt * when the card finishes accepting the chain */ st_le32( &lastmd->status, XL_TXSTAT_DL_INTR ); - /* + /* * point the chain head's chainptr to the tail so we * can jump to the next chain to send inside the isr. * If we're only sending one packet, then don't bother * with the link, as the chainptr value will either be * 0 if theres no next chain or -1 if there is. */ - if( chainCount > 1 ) + if( chainCount > 1 ) { firstmd->chainptr = lastmd; @@ -2562,7 +2562,7 @@ elnk_txDaemon (void *arg) if( ++sc->chlenIndex == NUM_CHAIN_LENGTHS ) sc->chlenIndex = 0; } - /* + /* ** clear the last packet's chainptr flag. If another ** chain is added later but before this chain is ** finished being sent, this flag on this packet will @@ -2571,19 +2571,19 @@ elnk_txDaemon (void *arg) lastmd->chainptr = NULL; #if 0 - printk("unit %d queued %d pkts, lastpkt status %08X\n", - sc->xl_unit, - chainCount, + printk("unit %d queued %d pkts, lastpkt status %08X\n", + sc->xl_unit, + chainCount, (uint32_t)ld_le32( &lastmd->status) ); #endif - if( sc->tx_idle == 0 && CSR_READ_4(sc, XL_DOWNLIST_PTR) == 0 ) + if( sc->tx_idle == 0 && CSR_READ_4(sc, XL_DOWNLIST_PTR) == 0 ) { printk("etherlink : unit elnk%d tx forced!\n", sc->xl_unit); sc->tx_idle = -1; } - /* + /* ** start sending this chain of packets if tx isn't ** busy, else the dnComplete interrupt will see there ** is another chain waiting and begin it immediately. @@ -2660,7 +2660,7 @@ elnk_init (void *arg) uint32_t cr,sr; xl_miibus_writereg(sc, 0x18, MII_BMCR, BMCR_RESET ); - + while( (cr = xl_miibus_readreg(sc, 0x18, MII_BMCR )) & BMCR_RESET ) { DELAY(100000); @@ -2669,7 +2669,7 @@ elnk_init (void *arg) xl_miibus_writereg(sc, 0x18, MII_ANAR, ANAR_10 | ANAR_TX | ANAR_10_FD | ANAR_TX_FD ); /* ANAR_T4 */ xl_miibus_writereg(sc, 0x18, MII_BMCR, BMCR_STARTNEG | BMCR_AUTOEN ); - while( ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 ); + while( ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 ); } @@ -2689,7 +2689,7 @@ elnk_init (void *arg) /* Init our MAC address */ XL_SEL_WIN(2); - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) { CSR_WRITE_1(sc, XL_W2_STATION_ADDR_LO + i, sc->arpcom.ac_enaddr[i]); } @@ -2852,7 +2852,7 @@ elnk_init (void *arg) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_COAX_STOP); /* increase packet size to allow reception of 802.1q or ISL packets */ - if (sc->xl_type == XL_TYPE_905B) + if (sc->xl_type == XL_TYPE_905B) CSR_WRITE_2(sc, XL_W3_MAXPKTSIZE, XL_PACKET_SIZE); /* Clear out the stats counters. */ @@ -2960,13 +2960,13 @@ elnk_stop (struct elnk_softc *sc) static void elnk_stats (struct elnk_softc *sc) { - printf(" MII PHY data { anr:%04x lpar:%04x stat:%04x ctl:%04x }\n", - sc->xl_stats.miianr, - sc->xl_stats.miipar, + printf(" MII PHY data { anr:%04x lpar:%04x stat:%04x ctl:%04x }\n", + sc->xl_stats.miianr, + sc->xl_stats.miipar, sc->xl_stats.miistatus, sc->xl_stats.miicmd); - printf(" internalcfg:%08x macctl:%04x dmactl:%08x\n", + printf(" internalcfg:%08x macctl:%04x dmactl:%08x\n", sc->xl_stats.internalconfig, sc->xl_stats.mac_control, sc->xl_stats.dmactl); @@ -3000,27 +3000,27 @@ elnk_stats (struct elnk_softc *sc) (totalLengths / numLengths) ); } - printf(" carrier_lost:%-5d sqe_errs:%-5d\n", - sc->xl_stats.xl_carrier_lost, + printf(" carrier_lost:%-5d sqe_errs:%-5d\n", + sc->xl_stats.xl_carrier_lost, sc->xl_stats.xl_sqe_errs); - printf(" tx_multi_collision:%-5d tx_single_collision:%-5d\n", - sc->xl_stats.xl_tx_multi_collision, + printf(" tx_multi_collision:%-5d tx_single_collision:%-5d\n", + sc->xl_stats.xl_tx_multi_collision, sc->xl_stats.xl_tx_single_collision); - printf(" tx_late_collision:%-5d rx_overrun:%-5d\n", - sc->xl_stats.xl_tx_late_collision, + printf(" tx_late_collision:%-5d rx_overrun:%-5d\n", + sc->xl_stats.xl_tx_late_collision, sc->xl_stats.xl_rx_overrun); - printf(" tx_deferred:%-5d badssd:%-5d\n", - sc->xl_stats.xl_tx_deferred, + printf(" tx_deferred:%-5d badssd:%-5d\n", + sc->xl_stats.xl_tx_deferred, sc->xl_stats.xl_badssd); - printf(" rx_frames_ok:%-9d tx_frames_ok:%-9d\n", + printf(" rx_frames_ok:%-9d tx_frames_ok:%-9d\n", sc->xl_stats.xl_rx_frames_ok, sc->xl_stats.xl_tx_frames_ok); - printf(" rx_bytes_ok:%-9d tx_bytes_ok:%-9d\n", + printf(" rx_bytes_ok:%-9d tx_bytes_ok:%-9d\n", sc->xl_stats.xl_rx_bytes_ok, sc->xl_stats.xl_tx_bytes_ok ); } @@ -3069,7 +3069,7 @@ elnk_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: elnk_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -3095,12 +3095,12 @@ static int iftap(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m ) char *delim, *pkt; printk("unit %i, src ", ifp->if_unit ); - for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") + for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") printk("%s%02x", delim, (char) eh->ether_shost[i] ); printk(" dest "); - for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") + for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") printk("%s%02x", delim, (char) eh->ether_dhost[i] ); printk(" pkt "); @@ -3108,7 +3108,7 @@ static int iftap(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m ) for(delim="", i=0; i < sizeof(struct ether_header); i++, delim=":") printk("%s%02x", delim, (char) pkt[i] ); - printk("\n"); + printk("\n"); return 0; } #endif @@ -3179,9 +3179,9 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) */ for( i=0; !done && xl_devs[i].xl_vid; i++) { - for(unum= 1; !done && BSP_pciFindDevice( xl_devs[i].xl_vid, xl_devs[i].xl_did, unum-1, - &sysboards[numFound].pbus, - &sysboards[numFound].pdev, + for(unum= 1; !done && BSP_pciFindDevice( xl_devs[i].xl_vid, xl_devs[i].xl_did, unum-1, + &sysboards[numFound].pbus, + &sysboards[numFound].pdev, &sysboards[numFound].pfun)==0; unum++) { if( numFound == NUM_UNITS ) @@ -3254,7 +3254,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc = &elnk_softc[unitNumber - 1]; ifp = &sc->arpcom.ac_if; - if (ifp->if_softc != NULL) + if (ifp->if_softc != NULL) { printk("etherlink : unit %i already in use.\n", unitNumber ); return 0; @@ -3287,9 +3287,9 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) #ifdef ELNK_DEBUG - printk("etherlink : device '%s', name 'elnk%d', pci %02x:%02x.%02x, %d rx/%d tx buffers\n", - xl_devs[sc->xl_type].xl_name, sc->xl_unit, - pbus, pdev, pfun, + printk("etherlink : device '%s', name 'elnk%d', pci %02x:%02x.%02x, %d rx/%d tx buffers\n", + xl_devs[sc->xl_type].xl_name, sc->xl_unit, + pbus, pdev, pfun, sc->numRxbuffers, sc->numTxbuffers); #endif @@ -3329,9 +3329,9 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) */ pci_write_config_word(pbus, pdev, pfun, PCI_COMMAND, - (uint16_t)( PCI_COMMAND_IO | - PCI_COMMAND_MASTER | - PCI_COMMAND_INVALIDATE | + (uint16_t)( PCI_COMMAND_IO | + PCI_COMMAND_MASTER | + PCI_COMMAND_INVALIDATE | PCI_COMMAND_WAIT ) ); /* * Get the device's base address @@ -3348,7 +3348,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) pci_read_config_byte(pbus, pdev, pfun, PCI_INTERRUPT_LINE, &cvalue); -#endif +#endif memset(&sc->irqInfo,0,sizeof(rtems_irq_connect_data)); sc->irqInfo.name = cvalue; @@ -3373,7 +3373,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) #if defined(__PPC__) pci_read_config_byte(pbus,pdev,pfun, PCI_LATENCY_TIMER, &pci_latency); #endif - if (pci_latency < new_latency) + if (pci_latency < new_latency) { printk("etherlink : unit elnk%d Overriding PCI latency, timer (CFLT) setting of %d, new value is %d.\n", sc->xl_unit, pci_latency, new_latency ); #if defined(__i386__) @@ -3429,8 +3429,8 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if (sc->deviceID == TC_DEVICEID_TORNADO_10_100BT_920B) sc->xl_flags |= XL_FLAG_PHYOK; - - if (config->hardware_address) + + if (config->hardware_address) { memcpy(sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); } @@ -3441,7 +3441,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) printk("etherlink : unit elnk%d Failed to read station address\n", sc->xl_unit ); return 0; } - memcpy((char *)&sc->arpcom.ac_enaddr, eaddr, ETHER_ADDR_LEN); + memcpy((char *)&sc->arpcom.ac_enaddr, eaddr, ETHER_ADDR_LEN); } /* @@ -3500,7 +3500,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) printk("etherlink : unit elnk%d available media : %s\n", sc->xl_unit, &msg[1]); } - + XL_SEL_WIN(7); } @@ -3538,7 +3538,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) /* * Start driver tasks if this is the first unit initialized */ - if (txDaemonTid == 0) + if (txDaemonTid == 0) { if( rtems_message_queue_create( rtems_build_name('X','L','c','r'), sc->numTxbuffers+1, @@ -3548,11 +3548,11 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) { rtems_panic( "etherlink : Unable to create TX buffer recovery queue\n" ); } - + rxDaemonTid = rtems_bsdnet_newproc( "XLrx", 4096, elnk_rxDaemon, NULL); - + txDaemonTid = rtems_bsdnet_newproc( "XLtx", 4096, elnk_txDaemon, NULL); #ifdef ELNK_DEBUG diff --git a/c/src/libchip/network/i82586.c b/c/src/libchip/network/i82586.c index 788641d027..2afd015d8b 100644 --- a/c/src/libchip/network/i82586.c +++ b/c/src/libchip/network/i82586.c @@ -237,12 +237,12 @@ char *bitmask_snprintf(unsigned long value, const char *format, char *buf, int b { char *b = buf; int bit = 31; - + while (bit-- > *format) value <<= 1; format++; - + while (*format) { if (value & 0x80000000) @@ -252,13 +252,13 @@ char *bitmask_snprintf(unsigned long value, const char *format, char *buf, int b *b++ = '0'; *b++ = ','; - + while (bit-- > *format) value <<= 1; - + format++; } - + *b = '\0'; return buf; } @@ -268,7 +268,7 @@ char *ether_sprintf(unsigned char *addr) static char buf[32]; char *b = buf; int i; - + for (i = 0; i < ETHER_ADDR_LEN; i++) { sprintf(b, "%02x:", *addr++); @@ -309,17 +309,17 @@ i82586_attach(struct rtems_bsdnet_ifconfig *config, int attaching) char *name; int unit; int mtu; - + /* * Parse driver name */ - + if ((unit = rtems_bsdnet_parse_driver_name (config, &name)) < 0) return 0; - - sc = config->drv_ctrl; + + sc = config->drv_ctrl; ifp = &sc->arpcom.ac_if; - + #if I82586_DEBUG sc->sc_debug = 0; //IED_TINT | IED_XMIT; #endif @@ -331,18 +331,18 @@ i82586_attach(struct rtems_bsdnet_ifconfig *config, int attaching) printf ("Driver `%s' already in use.\n", config->name); return 0; } - + /* * Process options */ - + memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); - + if (config->mtu) mtu = config->mtu; else mtu = ETHERMTU; - + ifp->if_softc = sc; ifp->if_unit = unit; ifp->if_name = name; @@ -514,7 +514,7 @@ iexmit(struct ie_softc *sc) #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_EMIT, cur); #endif - + #if I82586_DEBUG if (sc->sc_debug & IED_XMIT) printf("%s: xmit buffer %d\n", sc->arpcom.ac_if.if_name, cur); @@ -611,7 +611,7 @@ i82586_cmd_wait(struct ie_softc *sc) off = IE_SCB_STATUS(sc->scb); printf("i82586_cmd_wait: timo(%ssync): scb status: 0x%x, cmd: 0x%x\n", - sc->async_cmd_inprogress?"a":"", + sc->async_cmd_inprogress?"a":"", sc->ie_bus_read16(sc, off), cmd); return (1); /* Timeout */ @@ -726,7 +726,7 @@ i82586_intr(rtems_vector_number vec, void *arg) static unsigned long icnt = 0; I82586_TRACE(sc, I82586_INTS_REQ, icnt++); #endif - + /* * Implementation dependent interrupt handling. It must at least * disabled interrupts from the i82586. It is hoped this can @@ -756,7 +756,7 @@ i82586_intr_task(void *arg) u_int status; int off; int reset; - + /* * Not sure this is a good idea but as a out path exists and * roads lead to it, it seems ok. @@ -775,14 +775,14 @@ i82586_intr_task(void *arg) #endif reset = 0; - + while ((status & IE_ST_WHENCE) != 0) { #if I82586_DEBUG if (sc->sc_debug) printf ("%s: -------\n%s: scbstatus=0x%x\n", sc->arpcom.ac_if.if_name, sc->arpcom.ac_if.if_name, status); #endif - + #if 1 /* Ack interrupts FIRST in case we receive more during the ISR. */ ie_ack(sc, status & IE_ST_WHENCE); @@ -816,7 +816,7 @@ i82586_intr_task(void *arg) /* * Interrupt ACK was posted asynchronously; wait for * completion here before reading SCB status again. - * + * * If ACK fails, try to reset the chip, in hopes that * it helps. */ @@ -825,14 +825,14 @@ i82586_intr_task(void *arg) break; } #endif - + IE_BUS_BARRIER(sc, off, 2, BUS_SPACE_BARRIER_READ); status = sc->ie_bus_read16(sc, off); #if I82586_DEBUG I82586_TRACE(sc, I82586_INTS_LOOPS, status); #endif } - + if (reset) { #if I82586_DEBUG printf("%s: intr reset; status=0x%x\n", sc->arpcom.ac_if.if_name, status); @@ -840,11 +840,11 @@ i82586_intr_task(void *arg) i82586_cmd_wait(sc); i82586_reset(sc, 1); } - + #if I82586_DEBUG I82586_TRACE(sc, I82586_INTS_OUT, status); #endif - + if (sc->intrhook) (sc->intrhook)(sc, INTR_EXIT); } @@ -861,7 +861,7 @@ i82586_rint(struct ie_softc *sc, int scbstatus) #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_INT, scbstatus); - + if (sc->sc_debug & IED_RINT) printf("%s: rint: status 0x%x\n", sc->arpcom.ac_if.if_name, scbstatus); @@ -904,7 +904,7 @@ i82586_rint(struct ie_softc *sc, int scbstatus) */ i82586_rx_errors(sc, i, status); drop = 1; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_DROP, status); #endif @@ -1294,7 +1294,7 @@ ie_readframe(struct ie_softc *sc, int num) /* frame number to read */ */ ether_input (&sc->arpcom.ac_if, eh, m); sc->arpcom.ac_if.if_ipackets++; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_OK, sc->arpcom.ac_if.if_ipackets); #endif @@ -1309,14 +1309,14 @@ void i82586_start(struct ifnet *ifp) { struct ie_softc *sc = ifp->if_softc; - + if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) return; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_REQ, sc->xmit_busy); #endif - + rtems_event_send (sc->tx_task, i82586_TX_EVENT); } @@ -1330,10 +1330,10 @@ i82586_tx_task(void *arg) rtems_bsdnet_event_receive (i82586_TX_EVENT, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &events); - + #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_EVT, sc->xmit_busy); - + if (sc->sc_debug) printf ("%s: =======\n", sc->arpcom.ac_if.if_name); #endif @@ -1350,11 +1350,11 @@ i82586_start_tx(struct ie_softc *sc) int buffer, head, xbase; u_short len; int s; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_START_TX, sc->xmit_busy); #endif - + if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) { #if I82586_DEBUG @@ -1362,7 +1362,7 @@ i82586_start_tx(struct ie_softc *sc) #endif return; } - + for (;;) { if (sc->xmit_busy == NTXBUF) { ifp->if_flags |= IFF_OACTIVE; @@ -1421,14 +1421,14 @@ i82586_start_tx(struct ie_softc *sc) #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_START, sc->xmit_busy); #endif - + s = splnet(); /* Start the first packet transmitting. */ if (sc->xmit_busy == 0) iexmit(sc); sc->xmit_busy++; - + splx(s); } } @@ -1770,7 +1770,7 @@ ie_ia_setup(struct ie_softc *sc, int cmdbuf) (sc->memcopyout)(sc, sc->arpcom.ac_enaddr, IE_CMD_IAS_EADDR(cmdbuf), ETHER_ADDR_LEN); - + cmdresult = i82586_start_cmd(sc, IE_CUC_START, cmdbuf, IE_STAT_COMPL, 0); status = sc->ie_bus_read16(sc, IE_CMD_COMMON_STATUS(cmdbuf)); if (cmdresult != 0) { @@ -1852,13 +1852,13 @@ i82586_init(void *arg) sc->trace_flow_wrap = 0; #endif sc->trace_flow_in = 0; - + cmd = sc->buf_area; - + #if I82586_DEBUG printf ("%s: sc_debug at 0x%08x\n", sc->arpcom.ac_if.if_name, (unsigned int) &sc->sc_debug); #endif - + /* * Send the configure command first. */ @@ -1923,7 +1923,7 @@ i82586_start_transceiver(struct ie_softc *sc) #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_START, 0); #endif - + /* * Start RU at current position in frame & RBD lists. */ @@ -2075,7 +2075,7 @@ void i82586_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ie_softc *sc = ifp->if_softc; - + if (sc->sc_mediastatus) (*sc->sc_mediastatus)(sc, ifmr); } @@ -2104,13 +2104,13 @@ print_softie(struct ie_softc *sc) "TX_ACTIVE", "TRACE_CNT" }; - + int i; - + printf("i82586 %s:\n", sc->arpcom.ac_if.if_name); printf(" iobase=%p\n", sc->sc_iobase); - + printf(" scp=0x%08x\t\tiscp=0x%08x\t\tscb=0x%08x\n", sc->scp, sc->iscp, sc->scb); printf(" buf_area=0x%08x\tbuf_area_sz=0x%08x\n", @@ -2139,7 +2139,7 @@ print_softie(struct ie_softc *sc) int in; int lfdone = 0; char *tabs; - + if (!sc->trace_flow_wrap) { cnt = sc->trace_flow_in; in = 0; @@ -2152,7 +2152,7 @@ print_softie(struct ie_softc *sc) sc->trace_flow_in = sc->trace_flow_wrap = 0; cnt /= 2; - + for (i = 0; i < cnt; i++) { if (!lfdone) { switch (sc->trace_flow[in]) { @@ -2168,7 +2168,7 @@ print_softie(struct ie_softc *sc) tabs = "\t\t"; else tabs = "\t"; - + printf(" %d\t%s%s0x%08x (%d)\n", i, trace_labels[sc->trace_flow[in]], tabs, sc->trace_flow[in + 1], sc->trace_flow[in + 1]); @@ -2179,9 +2179,9 @@ print_softie(struct ie_softc *sc) lfdone = 1; printf("\n"); } - + in += 2; - + if (in >= I82586_TRACE_FLOW) in = 0; } diff --git a/c/src/libchip/network/i82586reg.h b/c/src/libchip/network/i82586reg.h index bd5024563c..6ee381b091 100644 --- a/c/src/libchip/network/i82586reg.h +++ b/c/src/libchip/network/i82586reg.h @@ -260,7 +260,7 @@ struct __ie_recv_buf_desc { * All commands share this in common. *- struct __ie_cmd_common { - u_int16_t ie_cmd_status; // status of this command + u_int16_t ie_cmd_status; // status of this command u_int16_t ie_cmd_cmd; // command word u_int16_t ie_cmd_link; // link to next command }; diff --git a/c/src/libchip/network/i82586var.h b/c/src/libchip/network/i82586var.h index f250fe03d0..c9421a6732 100644 --- a/c/src/libchip/network/i82586var.h +++ b/c/src/libchip/network/i82586var.h @@ -199,7 +199,7 @@ struct ie_softc { struct arpcom arpcom; /* - * For RTEMS we run the tx and rx handlers under a task due to the + * For RTEMS we run the tx and rx handlers under a task due to the * network semaphore stuff. */ @@ -225,7 +225,7 @@ struct ie_softc { u_int16_t value); void (*ie_bus_write24) (struct ie_softc *, int offset, int addr); - void (*ie_bus_barrier) (struct ie_softc *, int offset, + void (*ie_bus_barrier) (struct ie_softc *, int offset, int length, int flags); /* Media management */ @@ -296,9 +296,9 @@ do { rtems_interrupt_level level; rtems_interrupt_disable (level); \ int sc_debug; unsigned int trace_flow[I82586_TRACE_FLOW * 2]; - unsigned int trace_flow_wrap; + unsigned int trace_flow_wrap; #endif - unsigned int trace_flow_in; + unsigned int trace_flow_in; }; /* Exported functions */ diff --git a/c/src/libchip/network/if_fxp.c b/c/src/libchip/network/if_fxp.c index c72e90c7d7..0de7c2a508 100644 --- a/c/src/libchip/network/if_fxp.c +++ b/c/src/libchip/network/if_fxp.c @@ -427,7 +427,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) */ if ((unitNumber = rtems_bsdnet_parse_driver_name (config, &unitName)) < 0) return 0; - + /* * Is driver free? */ @@ -448,7 +448,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) callout_handle_init(&sc->stat_ch); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE); #endif - s = splimp(); + s = splimp(); /* * init PCI Bios interface... @@ -459,10 +459,10 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) device_printf(dev, "could not initialize pci bios interface\n"); return 0; } - + /* * find device on pci bus - */ + */ { int j; for (j=0; fxp_ident_table[j].devid; j++ ) { @@ -475,7 +475,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) i,sc->pci_signature); if (PCIB_ERR_SUCCESS == i) break; - } + } } /* @@ -485,7 +485,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) device_printf(dev, "could not find 82559ER device\n"); return 0; } - + /* * Enable bus mastering. Enable memory space too, in case @@ -572,7 +572,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) sc->pci_regs_are_io = TRUE; pcib_conf_read32(sc->pci_signature, PCI_BASE_ADDRESS_1, - &val32); + &val32); sc->pci_regs_base = val32 & PCI_BASE_ADDRESS_IO_MASK; } else { @@ -599,7 +599,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) sc->irqInfo.hdl = (rtems_irq_hdl)fxp_intr; sc->irqInfo.on = nopOn; sc->irqInfo.off = nopOn; - sc->irqInfo.isOn = fxpIsOn; + sc->irqInfo.isOn = fxpIsOn; s = BSP_install_rtems_irq_handler (&sc->irqInfo); if (!s) rtems_panic ("Can't attach fxp interrupt handler for irq %d\n", @@ -616,7 +616,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) DBGLVL_PRINTK(3,"fxp_attach: sc->cbl_base = 0x%x\n",sc->cbl_base); if (sc->cbl_base == NULL) goto failmem; - else + else memset(sc->cbl_base, 0, sizeof(struct fxp_cb_tx) * FXP_NTXCB); sc->fxp_stats = malloc(sizeof(struct fxp_stats), M_DEVBUF, @@ -669,7 +669,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) * * Systems based on the ICH2/ICH2-M chip from Intel have a defect * where the chip can cause a PCI protocol violation if it receives - * a CU_RESUME command when it is entering the IDLE state. The + * a CU_RESUME command when it is entering the IDLE state. The * workaround is to disable Dynamic Standby Mode, so the chip never * deasserts CLKRUN#, and always remains in an active state. * @@ -706,7 +706,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) "EEPROM checksum @ 0x%x: 0x%x -> 0x%x\n", i, data, cksum); /* - * We need to do a full PCI reset here. A software + * We need to do a full PCI reset here. A software * reset to the port doesn't cut it, but let's try * anyway. */ @@ -951,7 +951,7 @@ fxp_stats(struct fxp_softc *sc) printf (" Input errors:%-8lu\n", ifp->if_ierrors); } -static void +static void fxp_eeprom_shiftin(struct fxp_softc *sc, int data, int length) { u_int16_t reg; @@ -1236,7 +1236,7 @@ tbdinit: ifp->if_timer = 5; } txp->tx_threshold = tx_threshold; - + /* * Advance the end of list forward. */ @@ -1290,7 +1290,7 @@ tbdinit: static rtems_isr fxp_intr(rtems_vector_number v) { /* - * FIXME: currently only works with one interface... + * FIXME: currently only works with one interface... */ struct fxp_softc *sc = &(fxp_softc[0]); @@ -1333,11 +1333,11 @@ static void fxp_daemon(void *xsc) #ifdef NOTUSED /* * It should not be possible to have all bits set; the - * FXP_SCB_INTR_SWI bit always returns 0 on a read. If + * FXP_SCB_INTR_SWI bit always returns 0 on a read. If * all bits are set, this may indicate that the card has * been physically ejected, so ignore it. - */ - if (statack == 0xff) + */ + if (statack == 0xff) return; #endif @@ -1516,7 +1516,7 @@ fxp_tick(void *xsc) * with external storage to be released in a timely manner rather * than being defered for a potentially long time. This limits * the delay to a maximum of one second. - */ + */ for (txp = sc->cbl_first; sc->tx_queued && (txp->cb_status & FXP_CB_STATUS_C) != 0; txp = txp->next) { @@ -1579,7 +1579,7 @@ fxp_tick(void *xsc) } else if (sc->stat_ch == fxp_timeout_stop_rq) { sc->stat_ch = fxp_timeout_stopped; - } + } } /* diff --git a/c/src/libchip/network/if_fxpreg.h b/c/src/libchip/network/if_fxpreg.h index 28bf3b98ea..9bf4e59ff5 100644 --- a/c/src/libchip/network/if_fxpreg.h +++ b/c/src/libchip/network/if_fxpreg.h @@ -226,7 +226,7 @@ struct fxp_cb_mcs { * chosen to make the total struct size an even power of two. It's * critical that no TxCB be split across a page boundry since * no attempt is made to allocate physically contiguous memory. - * + * */ #ifdef __alpha__ /* XXX - should be conditional on pointer size */ #define FXP_NTXSEG 28 @@ -251,7 +251,7 @@ struct fxp_cb_tx { /* * The following structure isn't actually part of the TxCB, * unless the extended TxCB feature is being used. In this - * case, the first two elements of the structure below are + * case, the first two elements of the structure below are * fetched along with the TxCB. */ volatile struct fxp_tbd tbd[FXP_NTXSEG]; @@ -331,7 +331,7 @@ struct fxp_stats { }; #define FXP_STATS_DUMP_COMPLETE 0xa005 #define FXP_STATS_DR_COMPLETE 0xa007 - + /* * Serial EEPROM control register bits */ diff --git a/c/src/libchip/network/if_fxpvar.h b/c/src/libchip/network/if_fxpvar.h index 710d3ffaf2..1c61dda945 100644 --- a/c/src/libchip/network/if_fxpvar.h +++ b/c/src/libchip/network/if_fxpvar.h @@ -1,13 +1,13 @@ -/* +/* * Copyright (c) 1995, David Greenman * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions - * are met: + * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following - * disclaimer. + * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -119,7 +119,7 @@ struct fxp_softc { struct fxp_cb_tx *cbl_last; /* last active TxCB in list */ struct fxp_stats *fxp_stats; /* Pointer to interface stats */ int rx_idle_secs; /* # of seconds RX has been idle */ - enum {fxp_timeout_stopped,fxp_timeout_running,fxp_timeout_stop_rq} + enum {fxp_timeout_stopped,fxp_timeout_running,fxp_timeout_stop_rq} stat_ch; /* status of status updater */ struct fxp_cb_tx *cbl_base; /* base of TxCB list */ struct fxp_cb_mcs *mcsp; /* Pointer to mcast setup descriptor */ @@ -194,7 +194,7 @@ struct fxp_softc { *((u_int32_t*)((u_int8_t*)((sc)->pci_regs_base)+(reg))) = val; \ }while (0) -#endif +#endif #define sc_if arpcom.ac_if diff --git a/c/src/libchip/network/mii.h b/c/src/libchip/network/mii.h index dca3ff4ed5..14e45b0462 100644 --- a/c/src/libchip/network/mii.h +++ b/c/src/libchip/network/mii.h @@ -1,5 +1,5 @@ /* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ - + /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * diff --git a/c/src/libchip/network/open_eth.c b/c/src/libchip/network/open_eth.c index 4ba88f85c2..fdbbf78ae3 100644 --- a/c/src/libchip/network/open_eth.c +++ b/c/src/libchip/network/open_eth.c @@ -240,13 +240,13 @@ open_eth_initialize_hardware (struct open_eth_softc *sc) #ifdef OETH_RATE_10MHZ mii_cr = 0; #endif - write_mii(0, mii_cr | 0x8000); + write_mii(0, mii_cr | 0x8000); while (read_mii(0) & 0x8000) {} write_mii(20, 0x1422); #ifdef OETH_RATE_10MHZ mii_cr = 0; #endif - write_mii(0, mii_cr); + write_mii(0, mii_cr); printf("open_eth: driver attached, PHY config : 0x%04x\n", read_mii(0)); #ifdef OPEN_ETH_DEBUG diff --git a/c/src/libchip/network/open_eth.h b/c/src/libchip/network/open_eth.h index 88627d178d..88d05255d8 100644 --- a/c/src/libchip/network/open_eth.h +++ b/c/src/libchip/network/open_eth.h @@ -52,14 +52,14 @@ typedef struct _oeth_regs { #define OETH_TOTAL_BD 128 #define OETH_MAXBUF_LEN 0x610 - -/* Tx BD */ + +/* Tx BD */ #define OETH_TX_BD_READY 0x8000 /* Tx BD Ready */ #define OETH_TX_BD_IRQ 0x4000 /* Tx BD IRQ Enable */ #define OETH_TX_BD_WRAP 0x2000 /* Tx BD Wrap (last BD) */ #define OETH_TX_BD_PAD 0x1000 /* Tx BD Pad Enable */ #define OETH_TX_BD_CRC 0x0800 /* Tx BD CRC Enable */ - + #define OETH_TX_BD_UNDERRUN 0x0100 /* Tx BD Underrun Status */ #define OETH_TX_BD_RETRY 0x00F0 /* Tx BD Retry Status */ #define OETH_TX_BD_RETLIM 0x0008 /* Tx BD Retransmission Limit Status */ @@ -72,12 +72,12 @@ typedef struct _oeth_regs { OETH_TX_BD_LATECOL | \ OETH_TX_BD_DEFER | \ OETH_TX_BD_CARRIER) - -/* Rx BD */ + +/* Rx BD */ #define OETH_RX_BD_EMPTY 0x8000 /* Rx BD Empty */ #define OETH_RX_BD_IRQ 0x4000 /* Rx BD IRQ Enable */ #define OETH_RX_BD_WRAP 0x2000 /* Rx BD Wrap (last BD) */ - + #define OETH_RX_BD_MISS 0x0080 /* Rx BD Miss Status */ #define OETH_RX_BD_OVERRUN 0x0040 /* Rx BD Overrun Status */ #define OETH_RX_BD_INVSIMB 0x0020 /* Rx BD Invalid Symbol Status */ @@ -113,7 +113,7 @@ typedef struct _oeth_regs { #define OETH_MODER_HUGEN 0x00004000 /* Huge Enable */ #define OETH_MODER_PAD 0x00008000 /* Pad Enable */ #define OETH_MODER_RECSMALL 0x00010000 /* Receive Small */ - + /* Interrupt Source Register */ #define OETH_INT_TXB 0x00000001 /* Transmit Buffer IRQ */ #define OETH_INT_TXE 0x00000002 /* Transmit Error IRQ */ @@ -131,26 +131,26 @@ typedef struct _oeth_regs { #define OETH_INT_MASK_BUSY 0x00000010 /* Busy IRQ Mask */ #define OETH_INT_MASK_TXC 0x00000020 /* Transmit Control Frame IRQ Mask */ #define OETH_INT_MASK_RXC 0x00000040 /* Received Control Frame IRQ Mask */ - + /* Control Module Mode Register */ #define OETH_CTRLMODER_PASSALL 0x00000001 /* Pass Control Frames */ #define OETH_CTRLMODER_RXFLOW 0x00000002 /* Receive Control Flow Enable */ #define OETH_CTRLMODER_TXFLOW 0x00000004 /* Transmit Control Flow Enable */ - -/* MII Mode Register */ + +/* MII Mode Register */ #define OETH_MIIMODER_CLKDIV 0x000000FF /* Clock Divider */ #define OETH_MIIMODER_NOPRE 0x00000100 /* No Preamble */ #define OETH_MIIMODER_RST 0x00000200 /* MIIM Reset */ - + /* MII Command Register */ #define OETH_MIICOMMAND_SCANSTAT 0x00000001 /* Scan Status */ #define OETH_MIICOMMAND_RSTAT 0x00000002 /* Read Status */ #define OETH_MIICOMMAND_WCTRLDATA 0x00000004 /* Write Control Data */ - + /* MII Address Register */ #define OETH_MIIADDRESS_FIAD 0x0000001F /* PHY Address */ #define OETH_MIIADDRESS_RGAD 0x00001F00 /* RGAD Address */ - + /* MII Status Register */ #define OETH_MIISTATUS_LINKFAIL 0x00000001 /* Link Fail */ #define OETH_MIISTATUS_BUSY 0x00000002 /* MII Busy */ diff --git a/c/src/libchip/network/sonic.c b/c/src/libchip/network/sonic.c index a70782be2b..644653ebab 100644 --- a/c/src/libchip/network/sonic.c +++ b/c/src/libchip/network/sonic.c @@ -27,9 +27,9 @@ * which had a 100 Mhz PPC603e. * * This driver also works with DP83934CVUL-20/25 MHz, tested on - * Tharsys ERC32 VME board. + * Tharsys ERC32 VME board. * - * Rehaul to fix lost interrupts and buffers, and to use to use + * Rehaul to fix lost interrupts and buffers, and to use to use * interrupt-free transmission by Jiri, 22/03/1999. */ @@ -55,7 +55,7 @@ #include /* - * XXX fix this + * XXX fix this */ void *set_vector(void *, uint32_t, uint32_t); @@ -68,7 +68,7 @@ void *set_vector(void *, uint32_t, uint32_t); * Use the top line if you want more symbols. */ -#define SONIC_STATIC +#define SONIC_STATIC /* #define SONIC_STATIC static */ /* @@ -79,7 +79,7 @@ void *set_vector(void *, uint32_t, uint32_t); #endif /* - * + * * As suggested by National Application Note 746, make the * receive resource area bigger than the receive descriptor area. * @@ -138,11 +138,11 @@ struct sonic_softc { void *sonic; /* - * Register access routines + * Register access routines */ sonic_write_register_t write_register; sonic_read_register_t read_register; - + /* * Interrupt vector */ @@ -480,7 +480,7 @@ SONIC_STATIC void sonic_retire_tda (struct sonic_softc *sc) #if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) /* - * If there is an error that was not a collision, + * If there is an error that was not a collision, * then someone may want to see it. */ @@ -588,13 +588,13 @@ SONIC_STATIC void sonic_sendpacket (struct ifnet *ifp, struct mbuf *m) */ while (sc->tdaHead->next->status != 0) { - + /* * Free up transmit descriptors */ sonic_retire_tda (sc); - if (sc->tdaHead->next->status == 0) + if (sc->tdaHead->next->status == 0) break; #if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) @@ -893,12 +893,12 @@ SONIC_STATIC void sonic_rda_wait( * Routine to align the received packet so that the ip header * is on a 32-bit boundary. Necessary for cpu's that do not * allow unaligned loads and stores and when the 32-bit DMA - * mode is used. - * - * Transfers are done on word basis to avoid possibly slow byte + * mode is used. + * + * Transfers are done on word basis to avoid possibly slow byte * and half-word writes. */ - + void ipalign(struct mbuf *m) { unsigned int *first, *last, data; @@ -979,7 +979,7 @@ SONIC_STATIC void sonic_rxDaemon (void *arg) sonic_print_rx_descriptor( rdp ); if ((LSW(rdp->mbufp->m_data) != rdp->pkt_lsw) || (MSW(rdp->mbufp->m_data) != rdp->pkt_msw)) - printf ("SONIC RDA/RRA %p, %08x\n",rdp->mbufp->m_data,(rdp->pkt_msw << 16) | + printf ("SONIC RDA/RRA %p, %08x\n",rdp->mbufp->m_data,(rdp->pkt_msw << 16) | (rdp->pkt_lsw & 0x0ffff)); #endif rdp->byte_count &= 0x0ffff; /* ERC32 pollutes msb of byte_count */ @@ -989,7 +989,7 @@ SONIC_STATIC void sonic_rxDaemon (void *arg) sizeof(struct ether_header); eh = mtod (m, struct ether_header *); m->m_data += sizeof(struct ether_header); - + #ifdef CPU_U32_FIX ipalign(m); /* Align packet on 32-bit boundary */ #endif @@ -1122,7 +1122,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) if ( (*sc->read_register)( rp, SONIC_REG_SR ) <= SONIC_REVISION_B ) { rtems_fatal_error_occurred( 0x0BADF00D ); /* don't eat this part :) */ } - + /* * Set up circular linked list in Transmit Descriptor Area. * Use the PINT bit in the transmit configuration field to @@ -1138,11 +1138,11 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) tdp = sc->tdaTail; for (i = 0 ; i < sc->tdaCount ; i++) { /* - * Start off with the table of outstanding mbuf's + * Start off with the table of outstanding mbuf's */ /* - * status, pkt_config, pkt_size, and all fragment fields + * status, pkt_config, pkt_size, and all fragment fields * are set to zero by sonic_allocate. */ @@ -1176,7 +1176,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) */ sc->rda = sonic_allocate( - (sc->rdaCount * sizeof(ReceiveDescriptor_t)) + + (sc->rdaCount * sizeof(ReceiveDescriptor_t)) + sizeof(CamDescriptor_t) ); sc->cdp = (CamDescriptorPointer_t) ((unsigned char *)sc->rda + (sc->rdaCount * sizeof(ReceiveDescriptor_t))); @@ -1204,7 +1204,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) ordp->next = sc->rda; ordp->link = LSW(sc->rda) | RDA_LINK_EOL; sc->rdp_last = ordp; - + /* * Allocate the receive resource area. * In accordance with National Application Note 746, make the @@ -1232,7 +1232,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) * so we can find the mbuf when the SONIC returns the buffer * to the driver. */ - + MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); m->m_pkthdr.rcvif = &sc->arpcom.ac_if; @@ -1374,7 +1374,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) (*sc->write_register)( rp, SONIC_REG_CEP, 0 ); /* Select first entry in CAM */ printf ("Loaded Ethernet address into SONIC CAM.\n" " Wrote %04x%04x%04x - %#x\n" - " Read %04x%04x%04x - %#x\n", + " Read %04x%04x%04x - %#x\n", cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, (*sc->read_register)( rp, SONIC_REG_CAP2 ), (*sc->read_register)( rp, SONIC_REG_CAP1 ), @@ -1388,7 +1388,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) || ((*sc->read_register)( rp, SONIC_REG_CE ) != cdp->ce)) { printf ("Failed to load Ethernet address into SONIC CAM.\n" " Wrote %04x%04x%04x - %#x\n" - " Read %04x%04x%04x - %#x\n", + " Read %04x%04x%04x - %#x\n", cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, (*sc->read_register)( rp, SONIC_REG_CAP2 ), (*sc->read_register)( rp, SONIC_REG_CAP1 ), @@ -1511,7 +1511,7 @@ sonic_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: sonic_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ diff --git a/c/src/libchip/network/sonic.h b/c/src/libchip/network/sonic.h index b4a28ea6d4..6a4b98f22c 100644 --- a/c/src/libchip/network/sonic.h +++ b/c/src/libchip/network/sonic.h @@ -323,7 +323,7 @@ struct TransmitDescriptor { uint32_t link_pad; /* - * Extra RTEMS stuff + * Extra RTEMS stuff */ struct TransmitDescriptor *next; /* Circularly-linked list */ struct mbuf *mbufp; /* First mbuf in packet */ @@ -400,7 +400,7 @@ struct ReceiveDescriptor { uint32_t in_use; /* - * Extra RTEMS stuff + * Extra RTEMS stuff */ volatile struct ReceiveDescriptor *next; /* Circularly-linked list */ struct mbuf *mbufp; /* First mbuf in packet */ @@ -443,7 +443,7 @@ typedef volatile CamDescriptor_t *CamDescriptorPointer_t; #define RDA_IN_USE 0x0000 /* SONIC has finished with the packet */ /* and the driver can process it */ #define RDA_FREE 0xFFFF /* SONIC can use it */ - + /* * Attach routine */ -- cgit v1.2.3