summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k
diff options
context:
space:
mode:
authorEric Norum <WENorum@lbl.gov>2005-02-01 15:12:55 +0000
committerEric Norum <WENorum@lbl.gov>2005-02-01 15:12:55 +0000
commit7c7184a49f274498c62440f593b1802f1e8f60f9 (patch)
tree84155fdc759e2a7ebae51ebffff89111b8b5aa3f /c/src/lib/libbsp/m68k
parent2005-02-01 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-7c7184a49f274498c62440f593b1802f1e8f60f9.tar.bz2
Place FEC buffer descriptors in static RAM. No more cache concerns.
Diffstat (limited to 'c/src/lib/libbsp/m68k')
-rw-r--r--c/src/lib/libbsp/m68k/uC5282/ChangeLog5
-rw-r--r--c/src/lib/libbsp/m68k/uC5282/network/network.c34
-rw-r--r--c/src/lib/libbsp/m68k/uC5282/start/start.S14
3 files changed, 23 insertions, 30 deletions
diff --git a/c/src/lib/libbsp/m68k/uC5282/ChangeLog b/c/src/lib/libbsp/m68k/uC5282/ChangeLog
index dd4f772b18..2ff8a3e56b 100644
--- a/c/src/lib/libbsp/m68k/uC5282/ChangeLog
+++ b/c/src/lib/libbsp/m68k/uC5282/ChangeLog
@@ -1,3 +1,8 @@
+2005-02-01 Eric Norum <norume@aps.anl.gov>
+
+ * start/start.S, network/network.c: Place FEC buffer descriptors in SRAM.
+ No longer need to worry about buffer descriptor caching.
+
2005-01-31 Eric Norum <norume@aps.anl.gov>
* network/network.c, startup/bspstart.c: Processor doesn't snoop FEC DMA
diff --git a/c/src/lib/libbsp/m68k/uC5282/network/network.c b/c/src/lib/libbsp/m68k/uC5282/network/network.c
index 737670b798..e25f08ca53 100644
--- a/c/src/lib/libbsp/m68k/uC5282/network/network.c
+++ b/c/src/lib/libbsp/m68k/uC5282/network/network.c
@@ -123,19 +123,19 @@ mcf5282_fec_tx_interrupt_handler( rtems_vector_number v )
}
/*
- * Allocate buffer descriptors
+ * Allocate buffer descriptors from (non-cached) on-chip static RAM
* Ensure 128-bit (16-byte) alignment
*/
static mcf5282BufferDescriptor_t *
mcf5282_bd_allocate(unsigned int count)
{
- mcf5282BufferDescriptor_t *p;
+ extern char __SRAMBASE[];
+ static mcf5282BufferDescriptor_t *bdp = (mcf5282BufferDescriptor_t *)__SRAMBASE;
+ mcf5282BufferDescriptor_t *p = bdp;
- p = malloc((count * sizeof(mcf5282BufferDescriptor_t)) + 15, 0, M_NOWAIT);
- if (!p)
- rtems_panic("FEC BD");
- if ((int)p & 0xF)
- p = (mcf5282BufferDescriptor_t *)((char *)p + (16 - ((int)p & 0xF)));
+ bdp += count;
+ if ((int)bdp & 0xF)
+ bdp = (mcf5282BufferDescriptor_t *)((char *)bdp + (16 - ((int)bdp & 0xF)));
return p;
}
@@ -302,15 +302,9 @@ static void
fec_retire_tx_bd(volatile struct mcf5282_enet_struct *sc )
{
struct mbuf *m, *n;
- volatile mcf5282BufferDescriptor_t *txBd;
- for (;;) {
- if (sc->txBdActiveCount == 0)
- return;
- txBd = sc->txBdBase + sc->txBdTail;
- rtems_cache_invalidate_multiple_data_lines(txBd, sizeof *txBd);
- if ((txBd->status & MCF5282_FEC_TxBD_R) != 0)
- return;
+ while ((sc->txBdActiveCount != 0)
+ && ((sc->txBdBase[sc->txBdTail].status & MCF5282_FEC_TxBD_R) == 0)) {
m = sc->txMbuf[sc->txBdTail];
MFREE(m, n);
if (++sc->txBdTail == sc->txBdCount)
@@ -359,9 +353,7 @@ fec_rxDaemon (void *arg)
/*
* Wait for packet if there's not one ready
*/
- rtems_cache_invalidate_multiple_data_lines(rxBd, sizeof *rxBd);
if ((status = rxBd->status) & MCF5282_FEC_RxBD_E) {
-int chkCount=0 ;
/*
* Clear old events.
*/
@@ -373,14 +365,10 @@ int chkCount=0 ;
* This catches the case when a packet arrives between the
* `if' above, and the clearing of the RXF bit in the EIR.
*/
- for (;;) {
+ while ((status = rxBd->status) & MCF5282_FEC_RxBD_E) {
rtems_event_set events;
int level;
- rtems_cache_invalidate_multiple_data_lines(rxBd, sizeof *rxBd);
- if (((status = rxBd->status) & MCF5282_FEC_RxBD_E) == 0)
- break;
-
rtems_interrupt_disable(level);
MCF5282_FEC_EIMR |= MCF5282_FEC_EIMR_RXF;
rtems_interrupt_enable(level);
@@ -403,7 +391,7 @@ int chkCount=0 ;
int len = rxBd->length - sizeof(rtems_unsigned32);;
/*
- * Invalidate the cache and push the packet up
+ * Invalidate the cache and push the packet up.
* The cache is so small that it's more efficient to just
* invalidate the whole thing unless the packet is very small.
*/
diff --git a/c/src/lib/libbsp/m68k/uC5282/start/start.S b/c/src/lib/libbsp/m68k/uC5282/start/start.S
index 1adb1fb5eb..bd2b57a582 100644
--- a/c/src/lib/libbsp/m68k/uC5282/start/start.S
+++ b/c/src/lib/libbsp/m68k/uC5282/start/start.S
@@ -313,19 +313,19 @@ SYM(_spuriousInterrupt):
.align 4
PUBLIC (start)
SYM(start):
- move.w #0x2700,sr | Disable interrupts
-
- move.l #__SRAMBASE+1,d0 | Enable the MCF5282 internal SRAM
- movec d0,%rambar | ...so we have a stack
- move.l #__SRAMBASE+SRAM_SIZE-4,sp | Overwrite the fake stack pointer
+ move.w #0x2700,sr | Disable interrupts
/*
* If we're being started by the debugger, and the debugger has
* moved the IPSBAR, we're doomed........
*/
- move.l #__IPSBAR+1,d0 | Enable the MCF5282 internal peripherals
+ move.l #__IPSBAR+1,d0 | Enable the MCF5282 internal peripherals
move.l d0,DEFAULT_IPSBAR
-
+ move.l #__SRAMBASE+0x201,d0 | Enable the MCF5282 internal SRAM
+ movec d0,%rambar | CPU-space copy of RAMBAR
+ move.l d0,DEFAULT_IPSBAR+8 | Memory-space copy of RAMBAR
+ move.l #__SRAMBASE+SRAM_SIZE-4,sp | Overwrite the fake stack pointer
+
/*
* Copy the vector table to address 0 (VBR must be 0 mod 2^20)
* Leave the dBUG vectors (0-63) alone