diff options
Diffstat (limited to 'c/src/lib/libbsp/powerpc/motorola_powerpc/irq')
4 files changed, 17 insertions, 8 deletions
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/i8259.c b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/i8259.c index c5c31e2d23..00ed073956 100644 --- a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/i8259.c +++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/i8259.c @@ -21,9 +21,8 @@ /* * lower byte is interrupt mask on the master PIC. * while upper bits are interrupt on the slave PIC. - * This cache is initialized in ldseg.s */ -volatile rtems_i8259_masks i8259s_cache; +volatile rtems_i8259_masks i8259s_cache = 0xfffb; /*-------------------------------------------------------------------------+ | Function: BSP_irq_disable_at_i8259s @@ -53,7 +52,7 @@ int BSP_irq_disable_at_i8259s (const rtems_irq_symbolic_name irqLine) } else { - outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) > 8)); + outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8)); } _CPU_ISR_Enable (level); @@ -88,7 +87,7 @@ int BSP_irq_enable_at_i8259s (const rtems_irq_symbolic_name irqLine) } else { - outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) > 8)); + outport_byte(PIC_SLAVE_IMR_IO_PORT, ((i8259s_cache & 0xff00) >> 8)); } _CPU_ISR_Enable (level); @@ -119,9 +118,12 @@ int BSP_irq_enabled_at_i8259s (const rtems_irq_symbolic_name irqLine) int BSP_irq_ack_at_i8259s (const rtems_irq_symbolic_name irqLine) { if (irqLine >= 8) { - outport_byte(PIC_SLAVE_COMMAND_IO_PORT, PIC_EOI); + outport_byte(PIC_MASTER_COMMAND_IO_PORT, SLAVE_PIC_EOSI); + outport_byte(PIC_SLAVE_COMMAND_IO_PORT, (PIC_EOSI | (irqLine - 8))); + } + else { + outport_byte(PIC_MASTER_COMMAND_IO_PORT, (PIC_EOSI | irqLine)); } - outport_byte(PIC_MASTER_COMMAND_IO_PORT, PIC_EOI); return 0; @@ -146,6 +148,5 @@ void BSP_i8259s_init(void) outport_byte(PIC_SLAVE_IMR_IO_PORT, 0x01); /* Select 8086 mode */ outport_byte(PIC_SLAVE_IMR_IO_PORT, 0xFF); /* Mask all */ - i8259s_cache = 0xFFFB; } diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.c b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.c index 54c11b5ee3..4c2226a48f 100644 --- a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.c +++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.c @@ -378,7 +378,7 @@ void C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum) -void _ThreadProcessSignalsFromIrq (exception_frame* ctx) +void _ThreadProcessSignalsFromIrq (BSP_Exception_frame* ctx) { /* * Process pending signals that have not already been diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.h b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.h index 6f80064847..aaf438c8dd 100644 --- a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.h +++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq.h @@ -54,6 +54,7 @@ /* Command for specific EOI (End Of Interrupt): Interrupt acknowledge */ #define PIC_EOSI 0x60 /* End of Specific Interrupt (EOSI) */ +#define SLAVE_PIC_EOSI 0x62 /* End of Specific Interrupt (EOSI) for cascade */ #define PIC_EOI 0x20 /* Generic End of Interrupt (EOI) */ #ifndef ASM diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq_asm.S b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq_asm.S index 47c8850510..3d09c16c15 100644 --- a/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq_asm.S +++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/irq/irq_asm.S @@ -212,6 +212,13 @@ nested: */ stmw r16, GPR16_OFFSET(r1) addi r3, r1, 0x8 + /* + * compute SP at exception entry + */ + addi r2, r1, EXCEPTION_FRAME_END + /* + * store it at the right place + */ bl _ISR_Signals_to_thread_executing /* * start restoring exception like frame |