summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/score603e/startup
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-03 20:36:21 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-03 20:36:21 +0000
commit40e7ae22964b5e89a5294acfb95e3f7aae470c1d (patch)
tree1a1cf03679407f7c2c5a1a0c2c15e1be7e85f748 /c/src/lib/libbsp/powerpc/score603e/startup
parent2008-09-03 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-40e7ae22964b5e89a5294acfb95e3f7aae470c1d.tar.bz2
2008-09-03 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, README, configure.ac, console/85c30.c, console/console.c, console/consolebsp.h, include/bsp.h, include/gen2.h, irq/FPGA.c, irq/irq.c, irq/irq.h, irq/irq_init.c, start/start.S, startup/bspstart.c, startup/genpvec.c, startup/linkcmds, timer/timer.c, tod/tod.c: Initiate update and testing. Runs hello but does not run ticker yet.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/score603e/startup')
-rw-r--r--c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c140
-rw-r--r--c/src/lib/libbsp/powerpc/score603e/startup/genpvec.c4
-rw-r--r--c/src/lib/libbsp/powerpc/score603e/startup/linkcmds1
3 files changed, 140 insertions, 5 deletions
diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c b/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
index 3e4428955c..8bd9539669 100644
--- a/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
@@ -21,6 +21,13 @@
#include <rtems/libio.h>
#include <rtems/libcsupport.h>
#include <rtems/bspIo.h>
+#include <libcpu/cpuIdent.h>
+#define DEBUG 1
+
+/*
+ * Where the heap starts; is used by bsp_pretasking_hook;
+ */
+unsigned int BSP_heap_start;
/*
* PCI Bus Frequency
@@ -38,6 +45,14 @@ unsigned int BSP_processor_frequency; /* XXX - Set this based upon the Score boa
unsigned int BSP_time_base_divisor = 1000; /* XXX - Just a guess */
/*
+ * system init stack
+ */
+#define INIT_STACK_SIZE 0x1000
+
+extern unsigned long __rtems_end[];
+
+
+/*
* Driver configuration parameters
*/
uint32_t bsp_clicks_per_usec;
@@ -75,6 +90,9 @@ void bsp_pretasking_hook(void)
uint32_t heap_start;
uint32_t heap_size;
+ #if DEBUG
+ printk("bsp_pretasking_hook: Set Heap\n");
+ #endif
heap_start = (uint32_t) &end;
if (heap_start & (CPU_ALIGNMENT-1))
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
@@ -82,7 +100,13 @@ void bsp_pretasking_hook(void)
heap_size = Configuration.work_space_start - (void *)&end;
heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
+ #if DEBUG
+ printk("bsp_pretasking_hook: bsp_libc_init\n");
+ #endif
bsp_libc_init((void *) heap_start, heap_size, 0);
+ #if DEBUG
+ printk("bsp_pretasking_hook: End of routine\n");
+ #endif
}
/*PAGE
@@ -97,31 +121,52 @@ void initialize_PMC();
void bsp_predriver_hook(void)
{
+ #if DEBUG
+ printk("bsp_predriver_hook: init_RTC\n");
+ #endif
init_RTC();
-/* XXX - What Does this now ????
init_PCI();
initialize_universe();
-*/
+ #if DEBUG
+ printk("bsp_predriver_hook: initialize_PCI_bridge\n");
+ #endif
initialize_PCI_bridge ();
#if (HAS_PMC_PSC8)
+ #if DEBUG
+ printk("bsp_predriver_hook: initialize_PMC\n");
+ #endif
initialize_PMC();
#endif
+#if 0
/*
* Initialize Bsp General purpose vector table.
*/
+ #if DEBUG
+ printk("bsp_predriver_hook: initialize_external_exception_vector\n");
+ #endif
initialize_external_exception_vector();
+#endif
#if (0)
/*
* XXX - Modify this to write a 48000000 (loop to self) command
* to each interrupt location. This is better for debug.
*/
+ #if DEBUG
+ printk("bsp_predriver_hook: bsp_spurious_initialize\n");
+ #endif
bsp_spurious_initialize();
#endif
+ ShowBATS();
+
+ #if DEBUG
+ printk("bsp_predriver_hook: End of routine\n");
+ #endif
+
}
/*PAGE
@@ -162,16 +207,27 @@ void initialize_PMC() {
/*
* Clear status, enable SERR and memory space only.
*/
+ #if DEBUG
+ printk("initialize_PMC: set Device Address 0x4 \n");
+ ShowBATS();
+ #endif
PMC_addr = BSP_PCI_DEVICE_ADDRESS( 0x4 );
*PMC_addr = 0x020080cc;
/*
* set PMC base address.
*/
+ #if DEBUG
+ printk("initialize_PMC: set Device Address 0x14 \n");
+ ShowBATS();
+ #endif
PMC_addr = BSP_PCI_DEVICE_ADDRESS( 0x14 );
*PMC_addr = (BSP_PCI_REGISTER_BASE >> 24) & 0x3f;
- PMC_addr = (volatile uint32_t*)
+ #if DEBUG
+ printk("initialize_PMC: set PMC Serial Address 0x100000\n");
+ #endif
+ PMC_addr = (volatile uint32_t*)
BSP_PMC_SERIAL_ADDRESS( 0x100000 );
data = *PMC_addr;
*PMC_addr = data & 0xfc;
@@ -191,9 +247,20 @@ void bsp_postdriver_hook(void)
extern void Init_EE_mask_init(void);
extern void open_dev_console(void);
+ #if DEBUG
+ printk("bsp_postdriver_hook: open_dev_console\n");
+ #endif
open_dev_console();
+ ShowBATS();
+ #if DEBUG
+ printk("bsp_postdriver_hook: Init_EE_mask_init\n");
+ #endif
Init_EE_mask_init();
+ ShowBATS();
+ #if DEBUG
+ printk("bsp_postdriver_hook: Finished procedure\n");
+ #endif
}
void bsp_set_trap_vectors( void );
@@ -209,13 +276,21 @@ void bsp_start( void )
{
unsigned char *work_space_start;
unsigned int msr_value = 0x0000;
+ uint32_t intrStackStart;
+ uint32_t intrStackSize;
volatile uint32_t *ptr;
-
+ ppc_cpu_id_t myCpu;
+ ppc_cpu_revision_t myCpuRevision;
+
rtems_bsp_delay( 1000 );
/*
* Zero out lots of memory
*/
+ #if DEBUG
+ printk("bsp_start: Zero out lots of memory\n");
+ ShowBATS();
+ #endif
memset(
&end,
@@ -227,9 +302,38 @@ void bsp_start( void )
BSP_bus_frequency = 66000000;
/*
+ * Get CPU identification dynamically. Note that the get_ppc_cpu_type()
+ * function store the result in global variables so that it can be used
+ * later...
+ */
+ myCpu = get_ppc_cpu_type();
+ myCpuRevision = get_ppc_cpu_revision();
+
+ /*
+ * Initialize the interrupt related settings.
+ */
+ intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE;
+ intrStackSize = rtems_configuration_get_interrupt_stack_size();
+ BSP_heap_start = intrStackStart + intrStackSize;
+
+ /*
+ * Initialize default raw exception handlers.
+ */
+printk("ppc_exc_initialize\n");
+ ppc_exc_initialize(
+ PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
+ intrStackStart,
+ intrStackSize
+ );
+
+ /*
* There are multiple ROM monitors available for this board.
*/
#if (SCORE603E_USE_SDS)
+ #if DEBUG
+ printk("bsp_start: USE SDS\n");
+ #endif
+
/*
* Write instruction for Unconditional Branch to ROM vector.
@@ -251,14 +355,23 @@ void bsp_start( void )
msr_value = 0x2030;
#elif (SCORE603E_USE_OPEN_FIRMWARE)
+ #if DEBUG
+ printk("bsp_start: USE OPEN FIRMWARE\n");
+ #endif
msr_value = 0x2030;
#elif (SCORE603E_USE_NONE)
+ #if DEBUG
+ printk("bsp_start: USE NONE\n");
+ #endif
msr_value = 0x2030;
_CPU_MSR_SET( msr_value );
bsp_set_trap_vectors();
#elif (SCORE603E_USE_DINK)
+ #if DEBUG
+ printk("bsp_start: USE DINK\n");
+ #endif
msr_value = 0x2030;
_CPU_MSR_SET( msr_value );
@@ -270,6 +383,9 @@ void bsp_start( void )
*ptr = 0x4c000064;
#else
+ #if DEBUG
+ printk("bsp_start: ERROR unknow ROM Monitor\n");
+ #endif
#error "SCORE603E BSPSTART.C -- what ROM monitor are you using"
#endif
@@ -281,6 +397,9 @@ void bsp_start( void )
* not malloc'ed. It is just "pulled from the air".
*/
+ #if DEBUG
+ printk("bsp_start: Calculate Wrokspace\n");
+ #endif
work_space_start =
(unsigned char *)&RAM_END - rtems_configuration_get_work_space_size();
@@ -294,10 +413,23 @@ void bsp_start( void )
/*
* initialize the device driver parameters
*/
+ #if DEBUG
+ printk("bsp_start: set clicks poer usec\n");
+ #endif
bsp_clicks_per_usec = 66 / 4; /* XXX get from linkcmds */
#if ( PPC_USE_DATA_CACHE )
+ #if DEBUG
+ printk("bsp_start: cache_enable\n");
+ #endif
instruction_cache_enable ();
data_cache_enable ();
+ #if DEBUG
+ printk("bsp_start: END PPC_USE_DATA_CACHE\n");
+ #endif
#endif
+ #if DEBUG
+ printk("bsp_start: end BSPSTART\n");
+ ShowBATS();
+ #endif
}
diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/genpvec.c b/c/src/lib/libbsp/powerpc/score603e/startup/genpvec.c
index 571f61663c..1b182f2204 100644
--- a/c/src/lib/libbsp/powerpc/score603e/startup/genpvec.c
+++ b/c/src/lib/libbsp/powerpc/score603e/startup/genpvec.c
@@ -52,6 +52,7 @@ typedef struct
/* XXX */
void init_irq_data_register(void);
+#if 0
void initialize_external_exception_vector (void)
{
int i;
@@ -76,6 +77,7 @@ void initialize_external_exception_vector (void)
status = rtems_interrupt_catch( external_exception_ISR,
PPC_IRQ_EXTERNAL, (rtems_isr_entry *) &previous_isr );
}
+#endif
void Init_EE_mask_init() {
;
@@ -164,7 +166,7 @@ rtems_isr external_exception_ISR (
node = (EE_ISR_Type *)(ISR_Array[ index ].first);
if ( rtems_chain_is_tail( &ISR_Array[ index ], (void *)node ) ) {
- printk"ERROR:: check %d interrupt %02d has no isr\n", check_irq, index);
+ printk ("ERROR:: check %d interrupt %02d has no isr\n", check_irq, index);
value = get_irq_mask();
printk(" Mask = %02x\n", value);
}
diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds b/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds
index 6d5549bb45..37f247c4aa 100644
--- a/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds
+++ b/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds
@@ -193,6 +193,7 @@ SECTIONS
. = ALIGN(8) + 0x8000;
PROVIDE (__stack = .);
_end = . ;
+ __rtems_end = . ;
PROVIDE (end = .);
} >RAM