diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-14 23:07:47 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-14 23:07:47 +0000 |
commit | 3ddb428321e09f109916dba380b5a0fbcf7186e0 (patch) | |
tree | efbac461ef038ade292364a89aedaa36e2506bc9 /c/src/lib | |
parent | 2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-3ddb428321e09f109916dba380b5a0fbcf7186e0.tar.bz2 |
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, console/rsPMCQ1.h, include/bsp.h,
startup/bspstart.c: Create bsp_get_work_area() into its own file and
use BSP Framework to perform more initialization.
* startup/bspgetworkarea.c: New file.
Diffstat (limited to 'c/src/lib')
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/ChangeLog | 7 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/Makefile.am | 3 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/configure.ac | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/include/bsp.h | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/startup/bspgetworkarea.c | 44 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c | 81 |
7 files changed, 68 insertions, 75 deletions
diff --git a/c/src/lib/libbsp/powerpc/ep1a/ChangeLog b/c/src/lib/libbsp/powerpc/ep1a/ChangeLog index 64128bfa99..b23fb37882 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/ChangeLog +++ b/c/src/lib/libbsp/powerpc/ep1a/ChangeLog @@ -1,3 +1,10 @@ +2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com> + + * Makefile.am, configure.ac, console/rsPMCQ1.h, include/bsp.h, + startup/bspstart.c: Create bsp_get_work_area() into its own file and + use BSP Framework to perform more initialization. + * startup/bspgetworkarea.c: New file. + 2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com> * startup/bspstart.c: Review of all bsp_cleanup() implementations. In diff --git a/c/src/lib/libbsp/powerpc/ep1a/Makefile.am b/c/src/lib/libbsp/powerpc/ep1a/Makefile.am index 4bc2e600cf..28f2060899 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/Makefile.am +++ b/c/src/lib/libbsp/powerpc/ep1a/Makefile.am @@ -25,7 +25,8 @@ dist_project_lib_DATA += startup/linkcmds startup_SOURCES = startup/bspstart.c ../../shared/bootcard.c \ ../../shared/bsppost.c ../../shared/bsppredriverhook.c \ - ../../shared/bsplibc.c ../../powerpc/shared/startup/sbrk.c \ + startup/bspgetworkarea.c ../../shared/bsplibc.c \ + ../../powerpc/shared/startup/sbrk.c \ ../../shared/bspclean.c ../../shared/gnatinstallhandler.c \ ../../powerpc/shared/startup/pgtbl_setup.c \ ../../powerpc/shared/startup/pgtbl_activate.c \ diff --git a/c/src/lib/libbsp/powerpc/ep1a/configure.ac b/c/src/lib/libbsp/powerpc/ep1a/configure.ac index 3bed523245..493a3c4eca 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/configure.ac +++ b/c/src/lib/libbsp/powerpc/ep1a/configure.ac @@ -36,6 +36,8 @@ RTEMS_BSPOPTS_HELP([CONSOLE_USE_INTERRUPTS], RTEMS_CHECK_NETWORKING AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") +RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION + # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile]) diff --git a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h index c6ba7d05bb..bc78217103 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h +++ b/c/src/lib/libbsp/powerpc/ep1a/console/rsPMCQ1.h @@ -149,7 +149,7 @@ extern unsigned int rsPMCQ1QuiccIntConnect( FUNCION_PTR routine, int arg ); -unsigned int rsPMCQ1Init(); +unsigned int rsPMCQ1Init(void); unsigned int rsPMCQ1MaIntConnect ( unsigned long busNo, /* Pci Bus number of PMCQ1 */ unsigned long slotNo, /* Pci Slot number of PMCQ1 */ diff --git a/c/src/lib/libbsp/powerpc/ep1a/include/bsp.h b/c/src/lib/libbsp/powerpc/ep1a/include/bsp.h index c73243d2ba..6f24bac137 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/ep1a/include/bsp.h @@ -202,6 +202,10 @@ void BSP_FLASH_set_page( uint8_t page ); #define BSP_FLASH_DISABLE_WRITES(_area) BSP_FLASH_Disable_writes( _area ) #define BSP_FLASH_SET_PAGE(_page) BSP_FLASH_set_page( _page ) +/* + * system init stack + */ +#define BSP_INIT_STACK_SIZE 0x1000 /* clear hostbridge errors * diff --git a/c/src/lib/libbsp/powerpc/ep1a/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/ep1a/startup/bspgetworkarea.c new file mode 100644 index 0000000000..a30866ebf3 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/ep1a/startup/bspgetworkarea.c @@ -0,0 +1,44 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include <bsp.h> +#include <bsp/bootcard.h> +#include <stdint.h> + +extern void *RAM_END; +extern void *__rtems_end; +extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*); + +unsigned int BSP_mem_size = (unsigned int)&RAM_END; + +/* + * 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_work_area( + void **work_area_start, + size_t *work_area_size, + void **heap_start, + size_t *heap_size +) +{ + uintptr_t size; + uintptr_t reserve; + + reserve = (uintptr_t)BSP_INIT_STACK_SIZE; + reserve += rtems_configuration_get_interrupt_stack_size(); + size = (uintptr_t)&RAM_END - (uintptr_t)&__rtems_end + reserve; + + *work_area_start = (void *)(&__rtems_end + reserve); + *work_area_size = size; + _bsp_sbrk_init( *work_area_start, work_area_size ); + *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; + *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; +} + diff --git a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c index 2a7c5ffa94..d31b7ece1e 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/ep1a/startup/bspstart.c @@ -19,7 +19,6 @@ #include <string.h> #include <rtems/libio.h> -#include <rtems/libcsupport.h> #include <bsp/consoleIo.h> #include <libcpu/spr.h> #include <bsp/residual.h> @@ -84,15 +83,6 @@ printk("0x%x ==> %d\n", offset, data ); uint32_t VME_Slot1 = FALSE; /* - * Total memory. - * Note: RAM_END is defined in linkcmds. We want to verify that the application - * is only using 10M of memory, and we do this by only accounting for this - * much memory. - */ -extern int RAM_END; -unsigned int BSP_mem_size = (unsigned int)&RAM_END; - -/* * PCI Bus Frequency */ unsigned int BSP_bus_frequency; @@ -107,11 +97,6 @@ unsigned int BSP_processor_frequency; */ unsigned int BSP_time_base_divisor = 1000; /* XXX - Just a guess */ -/* - * system init stack - */ -#define INIT_STACK_SIZE 0x1000 - void BSP_panic(char *s) { printk("%s PANIC %s\n",_RTEMS_version, s); @@ -164,48 +149,12 @@ void BSP_FLASH_set_page( } /* - * Use the shared implementations of the following routines - */ - -void bsp_libc_init( void *, uint32_t, int ); - -/* - * Function: bsp_pretasking_hook - * Created: 95/03/10 - * - * Description: - * BSP pretasking hook. Called just before drivers are initialized. - * Used to setup libc and install any BSP extensions. - * - * NOTES: - * Must not use libc (to do io) from here, since drivers are - * not yet initialized. + * bsp_pretasking_hook * + * BSP pretasking hook. Called just before drivers are initialized. */ - void bsp_pretasking_hook(void) { - uint32_t heap_start; - uint32_t heap_size; - uint32_t heap_sbrk_spared; - - extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*); - - heap_start = ((uint32_t) __rtems_end) + - INIT_STACK_SIZE + rtems_configuration_get_interrupt_stack_size(); - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - heap_size = (BSP_mem_size - heap_start) - rtems_configuration_get_work_space_size(); - - heap_sbrk_spared=_bsp_sbrk_init(heap_start, &heap_size); - -#ifdef SHOW_MORE_INIT_SETTINGS - printk(" HEAP start %x size %x (%x bytes spared for sbrk)\n", - heap_start, heap_size, heap_sbrk_spared); -#endif - - bsp_libc_init((void *) 0, heap_size, heap_sbrk_spared); rsPMCQ1Init(); } @@ -329,14 +278,14 @@ void bsp_start( void ) unsigned char *stack; uint32_t intrStackStart; uint32_t intrStackSize; - unsigned char *work_space_start; ppc_cpu_id_t myCpu; ppc_cpu_revision_t myCpuRevision; Triv121PgTbl pt=0; /* R = e; */ /* - * Get CPU identification dynamically. Note that the get_ppc_cpu_type() function - * store the result in global variables so that it can be used latter... + * Get CPU identification dynamically. Note that the get_ppc_cpu_type() + * function store the result in global variables so that it can be used + * latter... */ BSP_Increment_Light(); myCpu = get_ppc_cpu_type(); @@ -367,7 +316,8 @@ ShowBATS(); * so there is no need to set it in r1 again... It is just for info * so that It can be printed without accessing R1. */ - stack = ((unsigned char*) __rtems_end) + INIT_STACK_SIZE - PPC_MINIMUM_STACK_FRAME_SIZE; + stack = ((unsigned char*) __rtems_end) + BSP_INIT_STACK_SIZE + - PPC_MINIMUM_STACK_FRAME_SIZE; /* tag the bottom (T. Straumann 6/36/2001 <strauman@slac.stanford.edu>) */ *((uint32_t *)stack) = 0; @@ -375,7 +325,7 @@ ShowBATS(); /* * Initialize the interrupt related settings. */ - intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE; + intrStackStart = (uint32_t) __rtems_end + BSP_INIT_STACK_SIZE; intrStackSize = rtems_configuration_get_interrupt_stack_size(); /* @@ -418,21 +368,6 @@ ShowBATS(); __asm__ __volatile ("sc"); #endif -#ifdef SHOW_MORE_INIT_SETTINGS - printk("rtems_configuration_get_work_space_size() = %x\n", - rtems_configuration_get_work_space_size()); -#endif - work_space_start = - (unsigned char *)BSP_mem_size - rtems_configuration_get_work_space_size(); - - if ( work_space_start <= ((unsigned char *)__rtems_end) + - INIT_STACK_SIZE + rtems_configuration_get_interrupt_stack_size()) { - printk( "bspstart: Not enough RAM!!!\n" ); - bsp_cleanup(); - } - - Configuration.work_space_start = work_space_start; - /* * Initalize RTEMS IRQ system */ |