From df49c60c9671e4a28e636964d744c1f59fb6cb68 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 12 Jun 2000 15:00:15 +0000 Subject: Merged from 4.5.0-beta3a --- c/src/lib/libbsp/m68k/gen68360/Makefile.am | 11 +- c/src/lib/libbsp/m68k/gen68360/clock/Makefile.am | 4 +- c/src/lib/libbsp/m68k/gen68360/console/Makefile.am | 4 +- .../gen68360/console/consolereserveresources.c | 10 +- c/src/lib/libbsp/m68k/gen68360/include/Makefile.am | 4 +- c/src/lib/libbsp/m68k/gen68360/include/bsp.h | 9 + c/src/lib/libbsp/m68k/gen68360/network/Makefile.am | 6 +- c/src/lib/libbsp/m68k/gen68360/network/network.c | 185 ++++++++++++++------- c/src/lib/libbsp/m68k/gen68360/start/Makefile.am | 4 +- c/src/lib/libbsp/m68k/gen68360/start/start.S | 2 +- c/src/lib/libbsp/m68k/gen68360/startup/Makefile.am | 5 +- c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c | 17 +- c/src/lib/libbsp/m68k/gen68360/startup/init68360.c | 13 +- c/src/lib/libbsp/m68k/gen68360/startup/linkcmds | 2 + .../libbsp/m68k/gen68360/startup/linkcmds.bootp | 2 + .../lib/libbsp/m68k/gen68360/startup/linkcmds.prom | 2 + c/src/lib/libbsp/m68k/gen68360/timer/Makefile.am | 4 +- c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile.am | 7 +- 18 files changed, 181 insertions(+), 110 deletions(-) (limited to 'c/src/lib/libbsp/m68k/gen68360') diff --git a/c/src/lib/libbsp/m68k/gen68360/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/Makefile.am index b3f8cceb8a..465ec8cdd4 100644 --- a/c/src/lib/libbsp/m68k/gen68360/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal @@ -8,12 +8,7 @@ ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal # wrapup is the one that actually builds and installs the library # from the individual .rel files built in other directories -if HAS_NETWORKING -NETWORKING_DRIVER = network -endif - -SUBDIRS = . include start startup clock console timer $(NETWORKING_DRIVER) \ - wrapup +SUBDIRS = . include start startup clock console timer network wrapup include $(top_srcdir)/../../bsp.am diff --git a/c/src/lib/libbsp/m68k/gen68360/clock/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/clock/Makefile.am index 0b1ebe8a61..3e08045c00 100644 --- a/c/src/lib/libbsp/m68k/gen68360/clock/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/clock/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/lib/libbsp/m68k/gen68360/console/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/console/Makefile.am index 5b70bbba23..f4a5b22b6e 100644 --- a/c/src/lib/libbsp/m68k/gen68360/console/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/console/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/lib/libbsp/m68k/gen68360/console/consolereserveresources.c b/c/src/lib/libbsp/m68k/gen68360/console/consolereserveresources.c index bd9fbcde6b..37ef74bc27 100644 --- a/c/src/lib/libbsp/m68k/gen68360/console/consolereserveresources.c +++ b/c/src/lib/libbsp/m68k/gen68360/console/consolereserveresources.c @@ -27,12 +27,4 @@ #include #include "m68360.h" -/* - * Reserve resources consumed by this driver - */ -void console_reserve_resources( - rtems_configuration_table *configuration -) -{ - rtems_termios_reserve_resources (configuration, 1); -} +int _console_reserve_resources_removed; diff --git a/c/src/lib/libbsp/m68k/gen68360/include/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/include/Makefile.am index 091727637a..2b8181354c 100644 --- a/c/src/lib/libbsp/m68k/gen68360/include/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/include/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/lib/libbsp/m68k/gen68360/include/bsp.h b/c/src/lib/libbsp/m68k/gen68360/include/bsp.h index e54ed3ffff..01a44c9202 100644 --- a/c/src/lib/libbsp/m68k/gen68360/include/bsp.h +++ b/c/src/lib/libbsp/m68k/gen68360/include/bsp.h @@ -35,6 +35,15 @@ extern "C" { #include #include +/* + * confdefs.h overrides for this BSP: + * - termios serial ports (defaults to 1) + * - Interrupt stack space is not minimum if defined. + */ + +/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */ +#define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024) + /* * Network driver configuration */ diff --git a/c/src/lib/libbsp/m68k/gen68360/network/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/network/Makefile.am index f5371f1f95..b7b337a83e 100644 --- a/c/src/lib/libbsp/m68k/gen68360/network/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/network/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -8,7 +8,7 @@ PGM = $(ARCH)/network.rel C_FILES = network.c C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) - + OBJS = $(C_O_FILES) include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg diff --git a/c/src/lib/libbsp/m68k/gen68360/network/network.c b/c/src/lib/libbsp/m68k/gen68360/network/network.c index 7dc4f4a73f..8364dbbf07 100644 --- a/c/src/lib/libbsp/m68k/gen68360/network/network.c +++ b/c/src/lib/libbsp/m68k/gen68360/network/network.c @@ -99,6 +99,9 @@ struct scc_softc { unsigned long txUnderrun; unsigned long txLostCarrier; unsigned long txRawWait; + unsigned long txCoalesced; + unsigned long txCoalesceFailed; + unsigned long txRetry; }; static struct scc_softc scc_softc[NSCCDRIVER]; @@ -344,81 +347,78 @@ m360Enet_retire_tx_bd (struct scc_softc *sc) int i; int nRetired; struct mbuf *m, *n; + int retries = 0; + int saveStatus = 0; i = sc->txBdTail; nRetired = 0; while ((sc->txBdActiveCount != 0) && (((status = (sc->txBdBase + i)->status) & M360_BD_READY) == 0)) { /* - * See if anything went wrong + * Check for errors which stop the transmitter. */ - if (status & (M360_BD_DEFER | - M360_BD_HEARTBEAT | - M360_BD_LATE_COLLISION | + if (status & (M360_BD_LATE_COLLISION | M360_BD_RETRY_LIMIT | - M360_BD_UNDERRUN | - M360_BD_CARRIER_LOST)) { + M360_BD_UNDERRUN)) { + int j; + + if (status & M360_BD_LATE_COLLISION) + sc->txLateCollision++; + if (status & M360_BD_RETRY_LIMIT) + sc->txRetryLimit++; + if (status & M360_BD_UNDERRUN) + sc->txUnderrun++; + /* - * Check for errors which stop the transmitter. + * Reenable buffer descriptors */ - if (status & (M360_BD_LATE_COLLISION | - M360_BD_RETRY_LIMIT | - M360_BD_UNDERRUN)) { - int j; - - if (status & M360_BD_LATE_COLLISION) - scc_softc[0].txLateCollision++; - if (status & M360_BD_RETRY_LIMIT) - scc_softc[0].txRetryLimit++; - if (status & M360_BD_UNDERRUN) - scc_softc[0].txUnderrun++; - - /* - * Reenable buffer descriptors - */ - j = sc->txBdTail; - for (;;) { - status = (sc->txBdBase + j)->status; - if (status & M360_BD_READY) - break; - (sc->txBdBase + j)->status = M360_BD_READY | - (status & (M360_BD_PAD | - M360_BD_WRAP | - M360_BD_INTERRUPT | - M360_BD_LAST | - M360_BD_TX_CRC)); - if (status & M360_BD_LAST) - break; - if (++j == sc->txBdCount) - j = 0; - } + j = sc->txBdTail; + for (;;) { + status = (sc->txBdBase + j)->status; + if (status & M360_BD_READY) + break; + (sc->txBdBase + j)->status = M360_BD_READY | + (status & (M360_BD_PAD | + M360_BD_WRAP | + M360_BD_INTERRUPT | + M360_BD_LAST | + M360_BD_TX_CRC)); + if (status & M360_BD_LAST) + break; + if (++j == sc->txBdCount) + j = 0; + } - /* - * Move transmitter back to the first - * buffer descriptor in the frame. - */ - m360.scc1p._tbptr = m360.scc1p.tbase + - sc->txBdTail * sizeof (m360BufferDescriptor_t); + /* + * Move transmitter back to the first + * buffer descriptor in the frame. + */ + m360.scc1p._tbptr = m360.scc1p.tbase + + sc->txBdTail * sizeof (m360BufferDescriptor_t); - /* - * Restart the transmitter - */ - M360ExecuteRISC (M360_CR_OP_RESTART_TX | M360_CR_CHAN_SCC1); - continue; - } - if (status & M360_BD_DEFER) - scc_softc[0].txDeferred++; - if (status & M360_BD_HEARTBEAT) - scc_softc[0].txHeartbeat++; - if (status & M360_BD_CARRIER_LOST) - scc_softc[0].txLostCarrier++; + /* + * Restart the transmitter + */ + M360ExecuteRISC (M360_CR_OP_RESTART_TX | M360_CR_CHAN_SCC1); + continue; } + saveStatus |= status; + retries += (status >> 2) & 0xF; nRetired++; if (status & M360_BD_LAST) { /* * A full frame has been transmitted. * Free all the associated buffer descriptors. */ + if (saveStatus & M360_BD_DEFER) + sc->txDeferred++; + if (saveStatus & M360_BD_HEARTBEAT) + sc->txHeartbeat++; + if (saveStatus & M360_BD_CARRIER_LOST) + sc->txLostCarrier++; + saveStatus = 0; + sc->txRetry += retries; + retries = 0; sc->txBdActiveCount -= nRetired; while (nRetired) { nRetired--; @@ -600,6 +600,74 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) nAdded = 0; txBd = firstTxBd = sc->txBdBase + sc->txBdHead; while (m) { + /* + * There are more mbufs in the packet than there + * are transmit buffer descriptors. + * Coalesce into a single buffer. + */ + if (nAdded == sc->txBdCount) { + struct mbuf *nm; + int j; + char *dest; + + /* + * Get the pointer to the first mbuf of the packet + */ + if (sc->txBdTail != sc->txBdHead) + rtems_panic ("sendpacket coalesce"); + m = sc->txMbuf[sc->txBdTail]; + + /* + * Rescind the buffer descriptor READY bits + */ + for (j = 0 ; j < sc->txBdCount ; j++) + (sc->txBdBase + j)->status = 0; + + /* + * Allocate an mbuf cluster + * Toss the packet if allocation fails + */ + MGETHDR (nm, M_DONTWAIT, MT_DATA); + if (nm == NULL) { + sc->txCoalesceFailed++; + m_freem (m); + return; + } + MCLGET (nm, M_DONTWAIT); + if (nm->m_ext.ext_buf == NULL) { + sc->txCoalesceFailed++; + m_freem (m); + m_free (nm); + return; + } + nm->m_pkthdr = m->m_pkthdr; + nm->m_len = nm->m_pkthdr.len; + + /* + * Copy data from packet chain to mbuf cluster + */ + sc->txCoalesced++; + dest = nm->m_ext.ext_buf; + while (m) { + struct mbuf *n; + + if (m->m_len) { + memcpy (dest, mtod(m, caddr_t), m->m_len); + dest += m->m_len; + } + MFREE (m, n); + m = n; + } + + /* + * Redo the send with the new mbuf cluster + */ + m = nm; + nAdded = 0; + status = 0; + continue; + } + /* * Wait for buffer descriptor to become available. */ @@ -815,7 +883,10 @@ scc_stats (struct scc_softc *sc) printf ("Retransmit Limit:%-8lu", sc->txRetryLimit); printf (" Late Collision:%-8lu\n", sc->txLateCollision); printf (" Underrun:%-8lu", sc->txUnderrun); - printf (" Raw output wait:%-8lu\n", sc->txRawWait); + printf (" Raw output wait:%-8lu", sc->txRawWait); + printf (" Coalesced:%-8lu\n", sc->txCoalesced); + printf (" Coalesce failed:%-8lu", sc->txCoalesceFailed); + printf (" Retries:%-8lu\n", sc->txRetry); } /* diff --git a/c/src/lib/libbsp/m68k/gen68360/start/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/start/Makefile.am index 824d7a22c5..e5a9f26a27 100644 --- a/c/src/lib/libbsp/m68k/gen68360/start/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/start/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/lib/libbsp/m68k/gen68360/start/start.S b/c/src/lib/libbsp/m68k/gen68360/start/start.S index c5f76ec803..50522e35e3 100644 --- a/c/src/lib/libbsp/m68k/gen68360/start/start.S +++ b/c/src/lib/libbsp/m68k/gen68360/start/start.S @@ -392,7 +392,7 @@ ZEROLOOPTEST: cmpl a1,a0 | Done? bcs.s ZEROLOOP | No, skip - movel 4(a7),_RamSize | Set RAM size + movel 4(a7),_M68k_Ramsize | Set RAM size movel #_stack_init,a7 | set master stack pointer pea env | envp diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.am index c10a8eb294..a62478be87 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -22,6 +22,7 @@ include $(top_srcdir)/../../../../../../automake/lib.am # (OPTIONAL) Add local stuff here using += # +# USE_INIT_FINI tells main.c what C++ help we need. AM_CPPFLAGS += -DUSE_INIT_FINI $(PGM): $(OBJS) diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c index 9279cf6cd1..e129f2279e 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c @@ -28,8 +28,6 @@ extern rtems_configuration_table Configuration; rtems_configuration_table BSP_Configuration; -unsigned long _RamSize; - rtems_cpu_table Cpu_table; char *rtems_progname; @@ -51,6 +49,13 @@ void bsp_pretasking_hook(void); /* m68k version */ void bsp_start( void ) { extern void *_WorkspaceBase; + + /* + * _M68k_Ramsize is the amount of RAM on this board and + * is set by many m68k BSPs at this point. With this + * BSP, it is dynamically set in start.S. + */ + /* * Allocate the memory for the RTEMS Work Space. This can come from @@ -68,12 +73,6 @@ void bsp_start( void ) BSP_Configuration.work_space_start = (void *)&_WorkspaceBase; - /* - * Account for the console's resources - */ - - console_reserve_resources( &BSP_Configuration ); - /* * initialize the CPU table for this BSP */ @@ -81,5 +80,5 @@ void bsp_start( void ) Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ Cpu_table.postdriver_hook = bsp_postdriver_hook; Cpu_table.do_zero_of_workspace = TRUE; - Cpu_table.interrupt_stack_size = 4096; + Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY; } diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c b/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c index 8a68524766..522a8fdd5d 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c +++ b/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c @@ -347,6 +347,7 @@ void _Init68360 (void) * But uses SRAM instead of DRAM * * CS0* - 512kx8 flash memory * * CS1* - 512kx32 static RAM * + * CS2* - 512kx32 static RAM * *************************************************** */ @@ -418,12 +419,16 @@ void _Init68360 (void) /* * Step 12: Set up main memory * 512Kx32 SRAM on CS1* + * 512Kx32 SRAM on CS2* * 0 wait states */ - ramSize = 1 * 1024 * 1024; + ramSize = 4 * 1024 * 1024; m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V; m360.memc[1].or = M360_MEMC_OR_WAITS(0) | M360_MEMC_OR_2MB | M360_MEMC_OR_32BIT; + m360.memc[2].br = ((unsigned long)&_RamBase + 0x200000) | M360_MEMC_BR_V; + m360.memc[2].or = M360_MEMC_OR_WAITS(0) | M360_MEMC_OR_2MB | + M360_MEMC_OR_32BIT; /* * Step 13: Copy the exception vector table to system RAM */ @@ -463,12 +468,6 @@ void _Init68360 (void) * SIM60 interrupt sources higher priority than CPM */ m360.mcr = 0x4C7F; - * No show cycles - * User/supervisor access - * Bus clear interrupt service level 7 - * SIM60 interrupt sources higher priority than CPM - */ - m360.mcr = 0x4C7F; #else /* diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds index 39f4c8dbd3..fcc3b0b694 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds @@ -15,6 +15,8 @@ * Declare some sizes. * A heap size of 0 means `use all available memory for the heap'. */ +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0; +_RamSize = DEFINED(_RamSize) ? _RamSize : 64M; _HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x0; _StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp index 74e339717b..455d5710da 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp +++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp @@ -19,6 +19,8 @@ * Declare some sizes. * A heap size of 0 means `use all available memory for the heap'. */ +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0; +_RamSize = DEFINED(_RamSize) ? _RamSize : 64M; _HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x0; _StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom index 39ab48d096..dae2d98f47 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom +++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom @@ -19,6 +19,8 @@ * Declare some sizes. * A heap size of 0 means `use all available memory for the heap'. */ +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0; +_RamSize = DEFINED(_RamSize) ? _RamSize : 64M; _HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x0; _StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; diff --git a/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.am index 7f16dcc233..5c2b8edf56 100644 --- a/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/timer/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 diff --git a/c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile.am b/c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile.am index e439ed658c..b1637c8e91 100644 --- a/c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile.am +++ b/c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile.am @@ -1,6 +1,6 @@ -## +## ## $Id$ -## +## AUTOMAKE_OPTIONS = foreign 1.4 @@ -13,8 +13,7 @@ BSP_PIECES = startup clock console timer $(NETWORKING_DRIVER) # bummer; have to use $foreach since % pattern subst rules only replace 1x OBJS = $(foreach piece, $(BSP_PIECES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \ - $(wildcard \ - ../../../../libcpu/$(RTEMS_CPU)/$(RTEMS_CPU_MODEL)/fpsp/$(ARCH)/fpsp.rel) + $(wildcard ../../../../libcpu/$(RTEMS_CPU)/$(RTEMS_CPU_MODEL)/fpsp/$(ARCH)/fpsp.rel) LIB = $(ARCH)/libbsp.a include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg -- cgit v1.2.3