diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-03-18 16:36:50 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-03-18 16:36:50 +0000 |
commit | 1105818d147f07b340617a27865d96bbe273fb8d (patch) | |
tree | 22a68e9e2c7c11247d15aa7b34634dd56550eea0 /c/src/lib | |
parent | Patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff) | |
download | rtems-1105818d147f07b340617a27865d96bbe273fb8d.tar.bz2 |
Patch from Ian Lance Taylor <ian@airs.com>:
Erik Ivanenko pointed out a problem in the ne2000.c driver I
submitted: it did not work correctly with bootp. Here is a patch,
based on a patch he sent me.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c b/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c index 7684995309..deffbf960a 100644 --- a/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c +++ b/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c @@ -365,7 +365,6 @@ static void ne_init_hardware (struct ne_softc *sc) { unsigned int port = sc->port; - unsigned char prom[16]; int i; rtems_irq_connect_data irq; @@ -387,15 +386,6 @@ ne_init_hardware (struct ne_softc *sc) outport_byte (port + PSTART, NE_FIRST_RX_PAGE); outport_byte (port + BNRY, NE_STOP_PAGE - 1); - /* Read the PROM to get the Ethernet hardware address. FIXME: We - should let config->hardware_address from rtems_ne_driver_attach - override this. */ - - ne_read_data (sc, 0, sizeof prom, prom); - - for (i = 0; i < ETHER_ADDR_LEN; ++i) - sc->arpcom.ac_enaddr[i] = prom[i * 2]; - /* Set the Ethernet hardware address. */ outport_byte (port + CMDR, MSK_PG1 | MSK_RD2); @@ -909,12 +899,6 @@ rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config) /* Handle the options passed in by the caller. */ - if (config->hardware_address != NULL) - memcpy (sc->arpcom.ac_enaddr, config->hardware_address, - ETHER_ADDR_LEN); - else - memset (sc->arpcom.ac_enaddr, 0, ETHER_ADDR_LEN); - if (config->mtu != 0) mtu = config->mtu; else @@ -936,6 +920,33 @@ rtems_ne_driver_attach (struct rtems_bsdnet_ifconfig *config) sc->accept_broadcasts = ! config->ignore_broadcast; + if (config->hardware_address != NULL) + memcpy (sc->arpcom.ac_enaddr, config->hardware_address, + ETHER_ADDR_LEN); + else + { + unsigned char prom[16]; + int ia; + + /* Read the PROM to get the Ethernet hardware address. */ + + outport_byte (sc->port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP); + outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); + outport_byte (sc->port + RBCR0, 0); + outport_byte (sc->port + RBCR1, 0); + outport_byte (sc->port + RCR, MSK_MON); + outport_byte (sc->port + TCR, MSK_LOOP); + outport_byte (sc->port + IMR, 0); + outport_byte (sc->port + ISR, 0xff); + + ne_read_data (sc, 0, sizeof prom, prom); + + outport_byte (sc->port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP); + + for (ia = 0; ia < ETHER_ADDR_LEN; ++ia) + sc->arpcom.ac_enaddr[ia] = prom[ia * 2]; + } + /* Set up the network interface. */ ifp->if_softc = sc; |