diff options
Diffstat (limited to 'c/src')
-rw-r--r-- | c/src/lib/libbsp/sparc/ChangeLog | 14 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/bspstart.c | 118 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/start.S | 5 |
3 files changed, 59 insertions, 78 deletions
diff --git a/c/src/lib/libbsp/sparc/ChangeLog b/c/src/lib/libbsp/sparc/ChangeLog index 1a635acaf2..73b3e40285 100644 --- a/c/src/lib/libbsp/sparc/ChangeLog +++ b/c/src/lib/libbsp/sparc/ChangeLog @@ -1,3 +1,17 @@ +2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> + + * shared/bspstart.c, shared/start.S: Add capability for bootcard.c BSP + Initialization Framework to ask the BSP where it has memory for the + RTEMS Workspace and C Program Heap. These collectively are referred + to as work area. If the BSP supports this, then it does not have to + include code to split the available memory between the two areas. + This reduces the amount of code in the BSP specific bspstart.c file. + Additionally, the shared framework can initialize the C Library, call + rtems_debug_enable(), and dirty the work area memory. Until most/all + BSPs support this new capability, if the BSP supports this, it should + call RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION from its configure.ac. + When the transition is complete, this autoconf macro can be removed. + 2008-05-12 Joel Sherrill <joel.sherrill@OARcorp.com> * shared/bspstart.c: Refactored and renamed initialization routines to diff --git a/c/src/lib/libbsp/sparc/shared/bspstart.c b/c/src/lib/libbsp/sparc/shared/bspstart.c index e463763b49..4cb625b7c7 100644 --- a/c/src/lib/libbsp/sparc/shared/bspstart.c +++ b/c/src/lib/libbsp/sparc/shared/bspstart.c @@ -1,10 +1,8 @@ /* - * This set of routines starts the application. It includes application, - * board, and monitor specific initialization and configuration. - * The generic CPU dependent initialization has been performed - * before any of these are invoked. + * This set of routines are the BSP specific initialization + * support routines. * - * COPYRIGHT (c) 1989-2006. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -21,9 +19,6 @@ * $Id$ */ -/* must be identical to STACK_SIZE in start.S */ -#define STACK_SIZE 16 * 1024 - #include <string.h> #include <bsp.h> @@ -32,93 +27,68 @@ #include <rtems/bspIo.h> /* - * Tells us where to put the workspace in case remote debugger is present. - */ - -extern uint32_t rdb_start; - -#ifdef LEON2 -/* - * Tells us if data cache snooping is available - */ - -int CPU_SPARC_HAS_SNOOPING; -#endif - -/* - * Use the shared implementations of the following routines + * LEON2 Cache Snooping Support */ - -void bsp_libc_init( void *, uint32_t, int ); -extern void bsp_spurious_initialize(); - #ifdef LEON2 -/* - * set_snooping - * - * Read the data cache configuration register to determine if - * bus snooping is available. This is needed for some drivers so - * that they can select the most efficient copy routines. - * - */ - -static inline int set_snooping(void) -{ - unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */ - return ((tmp>>23) & 1); /* Data cache snooping enabled */ -} + /* + * Tells us if data cache snooping is available + */ + int CPU_SPARC_HAS_SNOOPING; + + /* + * set_snooping + * + * Read the data cache configuration register to determine if + * bus snooping is available. This is needed for some drivers so + * that they can select the most efficient copy routines. + */ + static inline int set_snooping(void) + { + unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */ + return ((tmp>>23) & 1); /* Data cache snooping enabled */ + } #endif /* - * bsp_pretasking_hook - * * BSP pretasking hook. Called just before drivers are initialized. * Used to setup libc and install any BSP extensions. */ - void bsp_pretasking_hook(void) { - extern int end; - uint32_t heap_start; - uint32_t heap_size; - - heap_start = (uint32_t) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - heap_size = Configuration.work_space_start - (void *)&end - STACK_SIZE; - heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ - - bsp_libc_init((void *) heap_start, heap_size, 0); - -#ifdef RTEMS_DEBUG - rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); -#endif + extern void bsp_spurious_initialize(); bsp_spurious_initialize(); } /* + * This method returns the base address and size of the area which + * is to be allocated between the RTEMS Workspace and the C Program + * Heap. + */ +void bsp_get_workarea( + void **workarea_base, + size_t *workarea_size, + size_t *requested_heap_size +) +{ + /* Tells us where to put the workspace in case remote debugger is present. */ + extern uint32_t rdb_start; + /* must be identical to STACK_SIZE in start.S */ + #define STACK_SIZE (16 * 1024) + + *workarea_base = &end; + *workarea_size = (void *)rdb_start - (void *)&end - STACK_SIZE; + *requested_heap_size = 0; +} + +/* * bsp_start * * This routine does the bulk of the system initialization. */ - void bsp_start( void ) { - unsigned char *work_space_start; - - work_space_start = - (unsigned char *)rdb_start - rtems_configuration_get_work_space_size(); - - if ( work_space_start <= (unsigned char *)&end ) { - printk( "bspstart: Not enough RAM!!!\n" ); - BSP_fatal_return(); - } - - Configuration.work_space_start = work_space_start; - #ifdef LEON2 - CPU_SPARC_HAS_SNOOPING = set_snooping(); + CPU_SPARC_HAS_SNOOPING = set_snooping(); #endif } diff --git a/c/src/lib/libbsp/sparc/shared/start.S b/c/src/lib/libbsp/sparc/shared/start.S index 4e43281e54..24cbf93483 100644 --- a/c/src/lib/libbsp/sparc/shared/start.S +++ b/c/src/lib/libbsp/sparc/shared/start.S @@ -223,11 +223,8 @@ SYM(hard_reset): set (SYM(rdb_start)), %g6 ! End of work-space area st %sp, [%g6] - set (SYM(Configuration)), %l1 - ld [%l1+4], %l3 ! work_space_size - sub %sp, %l3, %sp ! set %sp to area below work_space + sub %g6, 4, %sp ! stack starts at end of RAM - 4 andn %sp, 0x0f, %sp ! align stack on 16-byte boundary - mov %sp, %fp ! Set frame pointer nop |