From 7344fba988145038deadd47b158d5e842d8df466 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 10 Aug 1998 21:45:01 +0000 Subject: Can now reply to multiple successive pings successfully without being in promiscuous mode. It still dies somewhere between 16 and 20 pings. --- c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c | 41 ++++++++++++--------------- c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h | 10 +++---- 2 files changed, 22 insertions(+), 29 deletions(-) (limited to 'c/src/lib/libbsp') diff --git a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c b/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c index 9553f7f9a9..f72952be44 100644 --- a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c +++ b/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c @@ -1132,9 +1132,9 @@ SONIC_STATIC void sonic_initialize_hardware( */ if (broadcastFlag) - sonic_write_register( rp, SONIC_REG_RCR, RCR_BRD | RDA_STATUS_PRO ); + sonic_write_register( rp, SONIC_REG_RCR, RCR_BRD ); else - sonic_write_register( rp, SONIC_REG_RCR, 0 | RDA_STATUS_PRO); + sonic_write_register( rp, SONIC_REG_RCR, 0 ); /* * Set up Resource Area pointers @@ -1176,32 +1176,27 @@ SONIC_STATIC void sonic_initialize_hardware( sonic_write_register( rp, SONIC_REG_CR, 0 ); /* - * Set up the SONIC CAM with our hardware address. - * Use the Receive Resource Area to hold the CAM Descriptor Area. + * Set up the SONIC CAM with our hardware address. */ + hwaddr = dp->iface->hwaddr; cdp = dp->cdp; - for (i=0 ; i<16 ; i++ ) { - /* - * cap0, cap1, and cap2 are zeroed by sonic_allocate. - */ - cdp->desc[i].cep = i; - } - #if (SONIC_DEBUG & SONIC_DEBUG_CAM) printf( "hwaddr: %2x:%2x:%2x:%2x:%2x:%2x\n", hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5] ); #endif - cdp->desc[0].cep = 0; /* Fill first entry in CAM */ - cdp->desc[0].cap2 = hwaddr[0] << 8 | hwaddr[1]; - cdp->desc[0].cap1 = hwaddr[2] << 8 | hwaddr[3]; - cdp->desc[0].cap0 = hwaddr[4] << 8 | hwaddr[5]; - cdp->ce = 0x0001; /* Enable first entry in CAM */ - sonic_write_register( rp, SONIC_REG_CDC, 16 ); /* 16 entries in CDA */ + cdp->cep = 0; /* Fill first and only entry in CAM */ + cdp->cap0 = hwaddr[1] << 8 | hwaddr[0]; + cdp->cap1 = hwaddr[3] << 8 | hwaddr[2]; + cdp->cap2 = hwaddr[5] << 8 | hwaddr[4]; + cdp->ce = 0x0001; /* Enable first entry in CAM */ + + sonic_write_register( rp, SONIC_REG_CDC, 1 ); /* 1 entry in CDA */ sonic_write_register( rp, SONIC_REG_CDP, LSW(cdp) ); - sonic_write_register( rp, SONIC_REG_CR, CR_LCAM ); /* Load the CAM */ + sonic_write_register( rp, SONIC_REG_CR, CR_LCAM ); /* Load the CAM */ + while (sonic_read_register( rp, SONIC_REG_CR ) & CR_LCAM) continue; @@ -1216,7 +1211,7 @@ SONIC_STATIC void sonic_initialize_hardware( printf ("Loaded Ethernet address into SONIC CAM.\n" " Wrote %04x%04x%04x - %#x\n" " Read %04x%04x%04x - %#x\n", - cdp->desc[0].cap2, cdp->desc[0].cap1, cdp->desc[0].cap0, cdp->ce, + cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, sonic_read_register( rp, SONIC_REG_CAP2 ), sonic_read_register( rp, SONIC_REG_CAP1 ), sonic_read_register( rp, SONIC_REG_CAP0 ), @@ -1224,14 +1219,14 @@ SONIC_STATIC void sonic_initialize_hardware( #endif sonic_write_register( rp, SONIC_REG_CEP, 0 ); /* Select first entry in CAM */ - if ((sonic_read_register( rp, SONIC_REG_CAP2 ) != cdp->desc[0].cap2) - || (sonic_read_register( rp, SONIC_REG_CAP1 ) != cdp->desc[0].cap1) - || (sonic_read_register( rp, SONIC_REG_CAP0 ) != cdp->desc[0].cap0) + if ((sonic_read_register( rp, SONIC_REG_CAP2 ) != cdp->cap2) + || (sonic_read_register( rp, SONIC_REG_CAP1 ) != cdp->cap1) + || (sonic_read_register( rp, SONIC_REG_CAP0 ) != cdp->cap0) || (sonic_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", - cdp->desc[0].cap2, cdp->desc[0].cap1, cdp->desc[0].cap0, cdp->ce, + cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, sonic_read_register( rp, SONIC_REG_CAP2 ), sonic_read_register( rp, SONIC_REG_CAP1 ), sonic_read_register( rp, SONIC_REG_CAP0 ), diff --git a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h b/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h index 0a66f34a0e..c57885a577 100644 --- a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h +++ b/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h @@ -333,12 +333,10 @@ typedef struct ReceiveDescriptor ReceiveDescriptor_t; typedef volatile ReceiveDescriptor_t *ReceiveDescriptorPointer_t; typedef struct { - struct { - rtems_unsigned32 cep; /* CAM Entry Pointer */ - rtems_unsigned32 cap0; /* CAM Address Port 0 xx-xx-xx-xx-YY-YY */ - rtems_unsigned32 cap1; /* CAM Address Port 1 xx-xx-YY-YY-xxxx */ - rtems_unsigned32 cap2; /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */ - } desc[16]; + rtems_unsigned32 cep; /* CAM Entry Pointer */ + rtems_unsigned32 cap0; /* CAM Address Port 0 xx-xx-xx-xx-YY-YY */ + rtems_unsigned32 cap1; /* CAM Address Port 1 xx-xx-YY-YY-xxxx */ + rtems_unsigned32 cap2; /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */ rtems_unsigned32 ce; } CamDescriptor_t; -- cgit v1.2.3