From 1402d56abf125a8317ce8a6659f6ba2e5bde5eb1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 21 May 2004 15:18:14 +0000 Subject: 2004-05-21 Till Strauman * PR/625/networking * libchip/network/dec21140.c, ... : Prevent name clashes by making 'ld_le32()' etc. static inlines. Let dec21140 attach routine return an error rather than panic if no chip is detected (thus allowing for probing). * libchip/network/elnk.c: Let elnk bail out if autoneg never completes instead of looping forever. Avoid divide by zero (crashed my PC). * libchip/network/if_fxp.c: Enable more fxp chip variants but warn that they are UNTESTED. --- c/src/ChangeLog | 12 +++++++++ c/src/libchip/network/dec21140.c | 9 ++++--- c/src/libchip/network/elnk.c | 11 ++++---- c/src/libchip/network/if_fxp.c | 55 ++++++++++++++++++++-------------------- 4 files changed, 51 insertions(+), 36 deletions(-) (limited to 'c/src') diff --git a/c/src/ChangeLog b/c/src/ChangeLog index 0ee6ce6111..ecbd7f86d6 100644 --- a/c/src/ChangeLog +++ b/c/src/ChangeLog @@ -1,3 +1,15 @@ +2004-05-21 Till Strauman + + * PR/625/networking + * libchip/network/dec21140.c, ... : Prevent name clashes by making + 'ld_le32()' etc. static inlines. Let dec21140 attach routine return + an error rather than panic if no chip is detected (thus allowing + for probing). + * libchip/network/elnk.c: Let elnk bail out if autoneg never completes + instead of looping forever. Avoid divide by zero (crashed my PC). + * libchip/network/if_fxp.c: Enable more fxp chip variants but warn that + they are UNTESTED. + 2004-05-10 Ralf Corsepius * aclocal/check-cxx.m4: Remove CPLUS_LD_LIBS. diff --git a/c/src/libchip/network/dec21140.c b/c/src/libchip/network/dec21140.c index 11b53ca40d..561b36dbe6 100644 --- a/c/src/libchip/network/dec21140.c +++ b/c/src/libchip/network/dec21140.c @@ -244,12 +244,12 @@ extern void Wait_X_ms( unsigned int timeToWait ); #define rtems_bsp_delay_in_bus_cycles(cycle) Wait_X_ms( cycle/100 ) #define CPU_CACHE_ALIGNMENT_FOR_BUFFER PG_SIZE -inline void st_le32(volatile uint32_t *addr, uint32_t value) +static inline void st_le32(volatile uint32_t *addr, uint32_t value) { *(addr)=value ; } -inline uint32_t ld_le32(volatile uint32_t *addr) +static inline uint32_t ld_le32(volatile uint32_t *addr) { return(*addr); } @@ -1062,7 +1062,10 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if ( diag == PCIB_ERR_SUCCESS) printk( "DEC/Intel 21143 PCI network card found\n" ); else - rtems_panic("DEC PCI network card not found !!\n"); + { + printk("No DEC/Intel 21140/3 PCI network card found !!\n"); + return 0; + } } #endif #if defined(__PPC__) diff --git a/c/src/libchip/network/elnk.c b/c/src/libchip/network/elnk.c index dcbd63a1b7..970f98a9c1 100644 --- a/c/src/libchip/network/elnk.c +++ b/c/src/libchip/network/elnk.c @@ -205,12 +205,12 @@ extern void Wait_X_ms( unsigned int timeToWait ); #define rtems_bsp_delay_in_bus_cycles(cycle) Wait_X_ms( cycle/100 ) #define CPU_CACHE_ALIGNMENT_FOR_BUFFER PG_SIZE -inline void st_le32(volatile uint32_t *addr, uint32_t value) +static inline void st_le32(volatile uint32_t *addr, uint32_t value) { *(addr)=value ; } -inline uint32_t ld_le32(volatile uint32_t *addr) +static inline uint32_t ld_le32(volatile uint32_t *addr) { return(*addr); } @@ -2670,7 +2670,8 @@ 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 ); + for (i=0; ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 && i < 20; i++) + DELAY(10000); } @@ -2998,7 +2999,7 @@ elnk_stats (struct elnk_softc *sc) printf(" interrupts:%-9d txcmp_ints:%-5d avg_chain_len:%-4d\n", sc->xl_stats.device_interrupts, sc->xl_stats.txcomplete_ints, - (totalLengths / numLengths) ); + numLengths ? (totalLengths / numLengths) : -1 ); } printf(" carrier_lost:%-5d sqe_errs:%-5d\n", @@ -3121,8 +3122,6 @@ struct el_boards int pbus,pdev,pfun, vid, did, tindex; }; - - /* * Attach an ELNK driver to the system */ diff --git a/c/src/libchip/network/if_fxp.c b/c/src/libchip/network/if_fxp.c index 0de7c2a508..45e7cd0f98 100644 --- a/c/src/libchip/network/if_fxp.c +++ b/c/src/libchip/network/if_fxp.c @@ -182,8 +182,11 @@ static u_char fxp_cb_config_template[] = { struct fxp_ident { u_int16_t devid; char *name; + int warn; }; +#define UNTESTED 1 + /* * Claim various Intel PCI device identifiers for this driver. The * sub-vendor and sub-device field are extensively used to identify @@ -191,28 +194,19 @@ struct fxp_ident { * them. */ static struct fxp_ident fxp_ident_table[] = { -#ifdef NOTUSED - /* currently untested */ - { 0x1229, "Intel Pro 10/100B/100+ Ethernet" }, - { 0x2449, "Intel Pro/100 Ethernet" }, -#endif - { 0x1209, "Intel Embedded 10/100 Ethernet" }, -#ifdef NOTUSED - /* currently untested */ - { 0x1029, "Intel Pro/100 Ethernet" }, -#endif - { 0x1030, "Intel Pro/100 Ethernet" }, -#ifdef NOTUSED - /* currently untested */ - { 0x1031, "Intel Pro/100 Ethernet" }, - { 0x1032, "Intel Pro/100 Ethernet" }, - { 0x1033, "Intel Pro/100 Ethernet" }, - { 0x1034, "Intel Pro/100 Ethernet" }, - { 0x1035, "Intel Pro/100 Ethernet" }, - { 0x1036, "Intel Pro/100 Ethernet" }, - { 0x1037, "Intel Pro/100 Ethernet" }, - { 0x1038, "Intel Pro/100 Ethernet" }, -#endif + { 0x1229, "Intel Pro 10/100B/100+ Ethernet", UNTESTED }, + { 0x2449, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1209, "Intel Embedded 10/100 Ethernet", 0 }, + { 0x1029, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1030, "Intel Pro/100 Ethernet", 0 }, + { 0x1031, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1032, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1033, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1034, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1035, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1036, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1037, "Intel Pro/100 Ethernet", UNTESTED }, + { 0x1038, "Intel Pro/100 Ethernet", UNTESTED }, { 0, NULL }, }; @@ -467,14 +461,21 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) for (j=0; fxp_ident_table[j].devid; j++ ) { i = pcib_find_by_devid( 0x8086, - fxp_ident_table[j].devid, - unitNumber-1, - &(sc->pci_signature)); + fxp_ident_table[j].devid, + unitNumber-1, + &(sc->pci_signature)); DBGLVL_PRINTK(2,"fxp_attach: find_devid returned %d " "and pci signature 0x%x\n", i,sc->pci_signature); - if (PCIB_ERR_SUCCESS == i) - break; + if (PCIB_ERR_SUCCESS == i) { + if ( UNTESTED == fxp_ident_table[j].warn ) { + device_printf(dev +"WARNING: this chip version has NOT been reported to work under RTEMS yet.\n"); + device_printf(dev, +" If it works OK, report it as tested in 'c/src/libchip/network/if_fxp.c'\n"); + } + break; + } } } -- cgit v1.2.3