Rev 534 | Rev 672 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 534 | Rev 576 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | #include <arch/smp/apic.h> |
30 | #include <arch/smp/apic.h> |
31 | #include <arch/smp/ap.h> |
31 | #include <arch/smp/ap.h> |
32 | #include <arch/smp/mps.h> |
32 | #include <arch/smp/mps.h> |
33 | #include <mm/page.h> |
33 | #include <mm/page.h> |
34 | #include <time/delay.h> |
34 | #include <time/delay.h> |
- | 35 | #include <interrupt.h> |
|
35 | #include <arch/interrupt.h> |
36 | #include <arch/interrupt.h> |
36 | #include <print.h> |
37 | #include <print.h> |
37 | #include <arch/asm.h> |
38 | #include <arch/asm.h> |
38 | #include <arch.h> |
39 | #include <arch.h> |
39 | 40 | ||
Line 106... | Line 107... | ||
106 | "Polarity High", |
107 | "Polarity High", |
107 | "Polarity Low" |
108 | "Polarity Low" |
108 | }; |
109 | }; |
109 | #endif /* LAPIC_VERBOSE */ |
110 | #endif /* LAPIC_VERBOSE */ |
110 | 111 | ||
- | 112 | ||
- | 113 | static void apic_spurious(int n, void *stack); |
|
- | 114 | static void l_apic_timer_interrupt(int n, void *stack); |
|
- | 115 | ||
111 | /** Initialize APIC on BSP. */ |
116 | /** Initialize APIC on BSP. */ |
112 | void apic_init(void) |
117 | void apic_init(void) |
113 | { |
118 | { |
114 | io_apic_id_t idreg; |
119 | io_apic_id_t idreg; |
115 | int i; |
120 | int i; |
116 | 121 | ||
117 | trap_register(VECTOR_APIC_SPUR, apic_spurious); |
122 | exc_register(VECTOR_APIC_SPUR, "apic_spurious", apic_spurious); |
118 | 123 | ||
119 | enable_irqs_function = io_apic_enable_irqs; |
124 | enable_irqs_function = io_apic_enable_irqs; |
120 | disable_irqs_function = io_apic_disable_irqs; |
125 | disable_irqs_function = io_apic_disable_irqs; |
121 | eoi_function = l_apic_eoi; |
126 | eoi_function = l_apic_eoi; |
122 | 127 | ||
Line 124... | Line 129... | ||
124 | * Configure interrupt routing. |
129 | * Configure interrupt routing. |
125 | * IRQ 0 remains masked as the time signal is generated by l_apic's themselves. |
130 | * IRQ 0 remains masked as the time signal is generated by l_apic's themselves. |
126 | * Other interrupts will be forwarded to the lowest priority CPU. |
131 | * Other interrupts will be forwarded to the lowest priority CPU. |
127 | */ |
132 | */ |
128 | io_apic_disable_irqs(0xffff); |
133 | io_apic_disable_irqs(0xffff); |
129 | trap_register(VECTOR_CLK, l_apic_timer_interrupt); |
134 | exc_register(VECTOR_CLK, "l_apic_timer", l_apic_timer_interrupt); |
130 | for (i = 0; i < IRQ_COUNT; i++) { |
135 | for (i = 0; i < IRQ_COUNT; i++) { |
131 | int pin; |
136 | int pin; |
132 | 137 | ||
133 | if ((pin = smp_irq_to_pin(i)) != -1) { |
138 | if ((pin = smp_irq_to_pin(i)) != -1) { |
134 | io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE+i, LOPRI); |
139 | io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE+i, LOPRI); |
Line 160... | Line 165... | ||
160 | /** APIC spurious interrupt handler. |
165 | /** APIC spurious interrupt handler. |
161 | * |
166 | * |
162 | * @param n Interrupt vector. |
167 | * @param n Interrupt vector. |
163 | * @param stack Interrupted stack. |
168 | * @param stack Interrupted stack. |
164 | */ |
169 | */ |
165 | void apic_spurious(__u8 n, __native stack[]) |
170 | void apic_spurious(int n, void *stack) |
166 | { |
171 | { |
167 | printf("cpu%d: APIC spurious interrupt\n", CPU->id); |
172 | printf("cpu%d: APIC spurious interrupt\n", CPU->id); |
168 | } |
173 | } |
169 | 174 | ||
170 | /** Poll for APIC errors. |
175 | /** Poll for APIC errors. |
Line 399... | Line 404... | ||
399 | /** Local APIC Timer Interrupt. |
404 | /** Local APIC Timer Interrupt. |
400 | * |
405 | * |
401 | * @param n Interrupt vector number. |
406 | * @param n Interrupt vector number. |
402 | * @param stack Interrupted stack. |
407 | * @param stack Interrupted stack. |
403 | */ |
408 | */ |
404 | void l_apic_timer_interrupt(__u8 n, __native stack[]) |
409 | void l_apic_timer_interrupt(int n, void *stack) |
405 | { |
410 | { |
406 | l_apic_eoi(); |
411 | l_apic_eoi(); |
407 | clock(); |
412 | clock(); |
408 | } |
413 | } |
409 | 414 |