From 38b81b5d29824997271dbd54a4954c08ce75e279 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 13 Dec 1999 16:25:03 +0000 Subject: Patch from Emmanuel Raguet to correct some problems in the dec21140 driver. Comments follow: I have tried to use bootp with the dec21140 driver and I had problems. I have found them - Ethernet address must be known in Attach step (read from the board) - Endian problem for Ethernet address storage. Now it is solved and I can use bootp to obtain the network configuration of the target. --- c/src/libchip/network/dec21140.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'c/src/libchip') diff --git a/c/src/libchip/network/dec21140.c b/c/src/libchip/network/dec21140.c index cf8bd72936..93b8ff52d6 100644 --- a/c/src/libchip/network/dec21140.c +++ b/c/src/libchip/network/dec21140.c @@ -364,13 +364,6 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) */ st_le32( (tbase+memCSR0), CSR0_MODE); - /* csr12_val = ld_le32( (tbase+memCSR8) );*/ - - for (i=0; i<32; i++){ - rombuf.s[i] = eeget16(tbase+memCSR9, i); - } - memcpy (sc->arpcom.ac_enaddr, rombuf.c+20, ETHER_ADDR_LEN); - #ifdef DEC_DEBUG printk("DC21140 %x:%x:%x:%x:%x:%x IRQ %d IO %x M %x .........\n", sc->arpcom.ac_enaddr[0], sc->arpcom.ac_enaddr[1], @@ -493,7 +486,6 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) st_le32( (tbase+memCSR5), IT_SETUP); st_le32( (tbase+memCSR7), IT_SETUP); st_le32( (unsigned int*)(tbase+memCSR6), CSR6_INIT | CSR6_TXRX); - } static void @@ -886,8 +878,23 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config) ETHER_ADDR_LEN); } else { - memset (sc->arpcom.ac_enaddr, 0x08,ETHER_ADDR_LEN); + union {char c[64]; unsigned short s[32];} rombuf; + int i; + + for (i=0; i<32; i++){ + rombuf.s[i] = eeget16(sc->base+memCSR9, i); + } +#if defined(__i386) + 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); +#endif } + if (config->mtu) mtu = config->mtu; else -- cgit v1.2.3