2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>

* bsp_specs, clock/clock.c, include/bsp.h, irq/irq.c,
	startup/bspclean.c, startup/bspstart.c: Eliminate copies of the
	Configuration Table. Use the RTEMS provided accessor macros to obtain
	configuration fields.
This commit is contained in:
Joel Sherrill
2007-12-11 15:46:33 +00:00
parent 7f6bb8cdb1
commit 5023c87431
7 changed files with 83 additions and 40 deletions

View File

@@ -1,3 +1,10 @@
2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* bsp_specs, clock/clock.c, include/bsp.h, irq/irq.c,
startup/bspclean.c, startup/bspstart.c: Eliminate copies of the
Configuration Table. Use the RTEMS provided accessor macros to obtain
configuration fields.
2007-12-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/mpc5200.h: Expand tabs.

View File

@@ -3,12 +3,12 @@
%rename link old_link
*startfile:
%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s crtbegin.o%s \
%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: ecrti%O%s rtems_crti%O%s \
%{!qrtems_debug: start.o%s} \
%{qrtems_debug: start_g.o%s}}}
*endfile:
%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s ecrtn.o%s}
%{!qrtems: %(old_endfile)} %{qrtems: ecrtn.o%s}
*link:
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -u __vectors -N -u start -e start}

View File

@@ -130,7 +130,7 @@ void mpc5200_gpt_clock_isr(rtems_irq_hdl_param handle)
status = gpt->status;
if (ClockInitialized && (status & GPT_STATUS_TEXP)) {
gpt->status |= GPT_STATUS_TEXP;
gpt->status |= GPT_STATUS_RESET;
Clock_last_TBR = PPC_Get_timebase_register();
Clock_driver_ticks++;
@@ -328,7 +328,7 @@ int BSP_connect_clock_handler (uint32_t gpt_no)
status = gpt->status; \
\
if (ClockInitialized && (status & GPT_STATUS_TEXP)) { \
gpt->status |= GPT_STATUS_TEXP; \
gpt->status |= GPT_STATUS_RESET; \
Clock_last_TBR = PPC_Get_timebase_register(); \
} \
} while(0)

View File

@@ -151,7 +151,6 @@ extern int rtems_mpc5200_fec_driver_attach_detach (struct rtems_bsdnet_ifconfig
/* miscellaneous stuff assumed to exist */
extern rtems_configuration_table BSP_Configuration;
/*
* We need to decide how much memory will be non-cacheable. This
* will mainly be memory that will be used in DMA (network and serial

View File

@@ -631,6 +631,50 @@ int BSP_rtems_irq_mngt_get(rtems_irq_global_settings** config)
return 0;
}
#include <stdio.h>
uint64_t BSP_Starting_TBR;
uint64_t BSP_Total_in_ISR;
uint32_t BSP_ISR_Count;
uint32_t BSP_Worst_ISR;
#define BSP_COUNTED_IRQ 16
uint32_t BSP_ISR_Count_Per[BSP_COUNTED_IRQ + 1];
void BSP_initialize_IRQ_Timing(void)
{
int i;
BSP_Starting_TBR = PPC_Get_timebase_register();
BSP_Total_in_ISR = 0;
BSP_ISR_Count = 0;
BSP_Worst_ISR = 0;
for ( i=0 ; i<BSP_COUNTED_IRQ ; i++ )
BSP_ISR_Count_Per[i] = 0;
}
static const char * u64tostring(
char *buffer,
uint64_t v
)
{
sprintf( buffer, "%lld %lld usecs", v, (v / 33) );
return buffer;
}
void BSP_report_IRQ_Timing(void)
{
uint64_t now;
char buffer[96];
int i;
now = PPC_Get_timebase_register();
printk( "Started at: %s\n", u64tostring(buffer, BSP_Starting_TBR) );
printk( "Current : %s\n", u64tostring(buffer, now) );
printk( "System up : %s\n", u64tostring(buffer, now - BSP_Starting_TBR) );
printk( "ISRs : %d\n", BSP_ISR_Count );
printk( "ISRs ran : %s\n", u64tostring(buffer, BSP_Total_in_ISR) );
printk( "Worst ISR : %s\n", u64tostring(buffer, BSP_Worst_ISR) );
for ( i=0 ; i<BSP_COUNTED_IRQ ; i++ )
printk( "IRQ %d: %d\n", i, BSP_ISR_Count_Per[i] );
printk( "Ticks : %d\n", Clock_driver_ticks );
}
/*
* High level IRQ handler called from shared_raw_irq_code_entry
@@ -642,6 +686,14 @@ int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
register unsigned int new_msr;
register unsigned int pmce;
register unsigned int crit_pri_main_mask, per_mask;
uint64_t start, stop, thisTime;
start = PPC_Get_timebase_register();
BSP_ISR_Count++;
if ( excNum < BSP_COUNTED_IRQ )
BSP_ISR_Count_Per[excNum]++;
else
printk( "not counting %d\n", excNum);
switch (excNum) {
/*

View File

@@ -20,6 +20,12 @@ extern int mpc5200_uart_pollRead(int minor);
void bsp_cleanup( void )
{
{
extern void BSP_report_IRQ_Timing(void);
BSP_report_IRQ_Timing();
}
#if defined(BSP_PRESS_KEY_FOR_RESET)
printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." );

View File

@@ -120,16 +120,7 @@ bd_t uboot_bdinfo_copy; /* will be overwritten with copy of bdinfo *
SPR_RW(SPRG0)
SPR_RW(SPRG1)
/*
* The original table from the application (in ROM) and our copy of it with
* some changes. Configuration is defined in <confdefs.h>. Make sure that
* our configuration tables are uninitialized so that they get allocated in
* the .bss section (RAM).
*/
extern rtems_configuration_table Configuration;
extern unsigned long intrStackPtr;
rtems_configuration_table BSP_Configuration;
char *rtems_progname;
/*
* Driver configuration parameters
@@ -304,31 +295,23 @@ void bsp_start(void)
rtems_cache_enable_data();
#endif
/*
* Allocate the memory for the RTEMS Work Space. This can come from
* a variety of places: hard coded address, malloc'ed from outside
* RTEMS world (e.g. simulator or primitive memory manager), or (as
* typically done by stock BSPs) by subtracting the required amount
* of work space from the last physical address on the CPU board.
*/
/*
* Need to "allocate" the memory for the RTEMS Workspace and
* tell the RTEMS configuration where it is. This memory is
* not malloc'ed. It is just "pulled from the air".
*/
BSP_Configuration.work_space_start = (void *)&_WorkspaceBase;
/*
BSP_Configuration.microseconds_per_tick = 1000;
*/
Configuration.work_space_start = (void *)&_WorkspaceBase;
/*
* Initalize RTEMS IRQ system
*/
BSP_rtems_irq_mng_init(0);
{
void BSP_initialize_IRQ_Timing(void);
BSP_initialize_IRQ_Timing();
}
#ifdef SHOW_MORE_INIT_SETTINGS
printk("Exit from bspstart\n");
#endif
@@ -344,17 +327,13 @@ void bsp_start(void)
* defined in HID0. HID0 is set during starup in start.S.
*
*/
Thread _Thread_Idle_body(uint32_t ignored )
{
for(;;)
{
asm volatile("mfmsr 3; oris 3,3,4; sync; mtmsr 3; isync; ori 3,3,0; ori 3,3,0");
}
return 0;
Thread _Thread_Idle_body(uint32_t ignored)
{
for(;;) {
asm volatile(
"mfmsr 3; oris 3,3,4; sync; mtmsr 3; isync; ori 3,3,0; ori 3,3,0"
);
}
return 0;
}