x86: Use shared ISR for I2C and GPIO
This patch permits interrupts to be generated by both the I2C and GPIO controllers for simultaneously-executing applications. The controllers share a single interrupt pin, INTC. Prior to this patch, quarkX1000_gpio_init() routed INTA to PIRQC and IRQ 10 (due to an incorrect assumption that INTA is connected to the GPIO controller), and quarkX1000_i2c_init() routed INTC to PIRQC and IRQ 9. The I2C controller initialization is a prerequisite for GPIO initialization, so the final configuration was that INTA and INTC were both routed to PIRQC and IRQ 10. Thus, only the GPIO ISR was being invoked, even if the I2C controller was actually responsible for the interrupt. This patch refactors the I2C and GPIO ISR setup and handler code so that the shared portions are combined in cpu/x86/drivers/legacy_pc/shared-isr.[ch]. The I2C and GPIO drivers communicate their interrupt information to the shared component by placing structures in a specific section of the binary.
This commit is contained in:
parent
0e17b98372
commit
c815fa4511
8 changed files with 229 additions and 58 deletions
|
@ -48,6 +48,19 @@ struct interrupt_context {
|
|||
uint32_t eip;
|
||||
};
|
||||
|
||||
#define ISR_STUB(label_str, has_error_code, handler_str) \
|
||||
"jmp 2f\n\t" \
|
||||
".align 4\n\t" \
|
||||
label_str ":\n\t" \
|
||||
" pushal\n\t" \
|
||||
" call " handler_str "\n\t" \
|
||||
" popal\n\t" \
|
||||
" .if " #has_error_code "\n\t" \
|
||||
" add $4, %%esp\n\t" \
|
||||
" .endif\n\t" \
|
||||
" iret\n\t" \
|
||||
"2:\n\t"
|
||||
|
||||
/* Helper macro to register interrupt handler function.
|
||||
*
|
||||
* num: Interrupt number (0-255)
|
||||
|
@ -75,17 +88,7 @@ struct interrupt_context {
|
|||
"push %0\n\t" \
|
||||
"call %P1\n\t" \
|
||||
"add $8, %%esp\n\t" \
|
||||
"jmp 2f\n\t" \
|
||||
".align 4\n\t" \
|
||||
"1:\n\t" \
|
||||
" pushal\n\t" \
|
||||
" call %P2\n\t" \
|
||||
" popal\n\t" \
|
||||
" .if " #has_error_code "\n\t" \
|
||||
" add $4, %%esp\n\t" \
|
||||
" .endif\n\t" \
|
||||
" iret\n\t" \
|
||||
"2:\n\t" \
|
||||
ISR_STUB("1", has_error_code, "%P2") \
|
||||
:: "g" (num), "i" (idt_set_intr_gate_desc), "i" (handler) \
|
||||
: "eax", "ecx", "edx" \
|
||||
); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue