From d0b7c4e61eaac3a4afcbce5ca4bf8d0e4aaba2e1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 22 Apr 1996 16:30:02 +0000 Subject: updartes from Tony Bennett --- cpukit/score/cpu/hppa1.1/cpu.c | 336 ++++++++++------------------------------- 1 file changed, 80 insertions(+), 256 deletions(-) (limited to 'cpukit') diff --git a/cpukit/score/cpu/hppa1.1/cpu.c b/cpukit/score/cpu/hppa1.1/cpu.c index 48e09b908a..89bb8a8447 100644 --- a/cpukit/score/cpu/hppa1.1/cpu.c +++ b/cpukit/score/cpu/hppa1.1/cpu.c @@ -19,117 +19,52 @@ #include #include +void hppa_cpu_halt(unsigned32 the_error); -void hppa_external_interrupt_initialize(void); -void hppa_external_interrupt_enable(unsigned32); -void hppa_external_interrupt_disable(unsigned32); -void hppa_external_interrupt(unsigned32, CPU_Interrupt_frame *); -void hppa_cpu_halt(unsigned32); -/* - * The first level interrupt handler for first 32 interrupts/traps. - * Indexed by vector; generally each entry is _Generic_ISR_Handler. - * Some TLB traps may have their own first level handler. - */ - -extern void _Generic_ISR_Handler(void); -unsigned32 HPPA_first_level_interrupt_handler[HPPA_INTERNAL_INTERRUPTS]; - -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: - * cpu_table - CPU table to initialize - * thread_dispatch - address of disptaching routine +/*PAGE * + * _CPU_ISR_install_raw_handler */ - -void _CPU_Initialize( - rtems_cpu_table *cpu_table, - void (*thread_dispatch) /* ignored on this CPU */ + +void _CPU_ISR_install_raw_handler( + unsigned32 vector, + proc_ptr new_handler, + proc_ptr *old_handler ) { - register unsigned8 *fp_context; - unsigned32 iva; - unsigned32 iva_table; - int i; - - extern void IVA_Table(void); - - /* - * XXX; need to setup fpsr smarter perhaps - */ - - fp_context = (unsigned8*) &_CPU_Null_fp_context; - for (i=0 ; i= HPPA_INTERRUPT_EXTERNAL_BASE) - { - unsigned32 external_vector; - - external_vector = vector - HPPA_INTERRUPT_EXTERNAL_BASE; - if (new_handler) - hppa_external_interrupt_enable(external_vector); - else - /* XXX this can never happen due to _ISR_Is_valid_user_handler */ - hppa_external_interrupt_disable(external_vector); - } } - -/* - * Support for external and spurious interrupts on HPPA +/* _CPU_Initialize + * + * This routine performs processor dependent initialization. + * + * INPUT PARAMETERS: + * cpu_table - CPU table to initialize + * thread_dispatch - address of disptaching routine * - * TODO: - * Count interrupts - * make sure interrupts disabled properly - */ - -#define DISMISS(mask) set_eirr(mask) -#define DISABLE(mask) set_eiem(get_eiem() & ~(mask)) -#define ENABLE(mask) set_eiem(get_eiem() | (mask)) -#define VECTOR_TO_MASK(v) (1 << (31 - (v))) - -/* - * Init the external interrupt scheme - * called by bsp_start() */ -void -hppa_external_interrupt_initialize(void) +void _CPU_Initialize( + rtems_cpu_table *cpu_table, + void (*thread_dispatch) /* ignored on this CPU */ +) { - proc_ptr ignore; - - /* mark them all unused */ - DISABLE(~0); - DISMISS(~0); - - /* install the external interrupt handler */ - _CPU_ISR_install_vector( - HPPA_INTERRUPT_EXTERNAL_INTERRUPT, - (proc_ptr)hppa_external_interrupt, &ignore -); -} - -/* - * Enable a specific external interrupt - */ + register unsigned8 *fp_context; + int i; + proc_ptr old_handler; -void -hppa_external_interrupt_enable(unsigned32 v) -{ - unsigned32 isrlevel; + /* + * XXX; need to setup fpsr smarter perhaps + */ - _CPU_ISR_Disable(isrlevel); - ENABLE(VECTOR_TO_MASK(v)); - _CPU_ISR_Enable(isrlevel); -} + fp_context = (unsigned8*) &_CPU_Null_fp_context; + for (i=0 ; iInterrupt.pcoqfront); -*/ -} + for (i=0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++) + _CPU_ISR_install_vector(i, + hppa_interrupt_report_spurious, + &old_handler); -void -hppa_external_interrupt_report_spurious(unsigned32 spurious_mask, - CPU_Interrupt_frame *iframe) -{ - int v; - for (v=0; v < HPPA_EXTERNAL_INTERRUPTS; v++) - if (VECTOR_TO_MASK(v) & spurious_mask) - { - DISMISS(VECTOR_TO_MASK(v)); - DISABLE(VECTOR_TO_MASK(v)); - hppa_external_interrupt_spurious_handler(v, iframe); - } - DISMISS(spurious_mask); + _CPU_Table = *cpu_table; + } -/* - * External interrupt handler. - * This is installed as cpu interrupt handler for - * HPPA_INTERRUPT_EXTERNAL_INTERRUPT. It vectors out to - * specific external interrupt handlers. - */ - -void -hppa_external_interrupt(unsigned32 vector, - CPU_Interrupt_frame *iframe) -{ - unsigned32 mask; - unsigned32 *vp, *max_vp; - unsigned32 external_vector; - unsigned32 global_vector; - hppa_rtems_isr_entry handler; - - max_vp = &_CPU_Table.external_interrupt[_CPU_Table.external_interrupts]; - while ( (mask = (get_eirr() & get_eiem())) ) - { - for (vp = _CPU_Table.external_interrupt; (vp < max_vp) && mask; vp++) - { - unsigned32 m; - - external_vector = *vp; - global_vector = external_vector + HPPA_INTERRUPT_EXTERNAL_BASE; - m = VECTOR_TO_MASK(external_vector); - handler = (hppa_rtems_isr_entry) _ISR_Vector_table[global_vector]; - if ((m & mask) && handler) - { - DISMISS(m); - mask &= ~m; - handler(global_vector, iframe); - } - } - - if (mask != 0) { - if ( _CPU_Table.spurious_handler ) - { - handler = (hppa_rtems_isr_entry) _CPU_Table.spurious_handler; - handler(mask, iframe); - } - else - hppa_external_interrupt_report_spurious(mask, iframe); - } - } -} - /* * Halt the system. * Called by the _CPU_Fatal_halt macro @@ -351,8 +161,17 @@ hppa_external_interrupt(unsigned32 vector, * XXX * Later on, this will allow us to return to the prom. * For now, we just ignore 'type_of_halt' + * + * XXX + * NOTE: for gcc, this function must be at the bottom + * of the file, that is because if it is at the top + * of the file, gcc will inline it's calls. Since + * the function uses the HPPA_ASM_LABEL() macro, when + * gcc inlines it, you get two definitions of the same + * label name, which is an assembly error. */ + void hppa_cpu_halt(unsigned32 the_error) { @@ -360,6 +179,11 @@ hppa_cpu_halt(unsigned32 the_error) _CPU_ISR_Disable(isrlevel); + /* + * XXXXX NOTE: This label is only needed that that when + * the simulator stops, it shows the label name specified + */ HPPA_ASM_LABEL("_hppa_cpu_halt"); - HPPA_ASM_BREAK(1, 0); + HPPA_ASM_BREAK(0, 0); } + -- cgit v1.2.3