Changeset fd67c9f in mainline
- Timestamp:
- 2019-04-06T08:10:27Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 534bcdf
- Parents:
- ef56a43
- Location:
- kernel
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/interrupt.c
ref56a43 rfd67c9f 172 172 bool ack = false; 173 173 assert(inum < IRQ_COUNT); 174 assert(inum != IRQ_PIC0_SPUR);175 assert(inum != IRQ_PIC1_SPUR);176 174 assert(inum != IRQ_PIC1); 177 175 … … 190 188 irq_spinlock_unlock(&irq->lock, false); 191 189 } else { 192 /*193 * Spurious interrupt.194 */195 190 #ifdef CONFIG_DEBUG 196 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt (inum=%u)",197 CPU->id,inum);191 log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id, 192 inum); 198 193 #endif 199 194 } … … 205 200 static void pic_spurious(unsigned int n, istate_t *istate) 206 201 { 207 /* 208 * XXX: Examine ISR to figure out whether this is indeed a spurious 209 * or actual IRQ. 210 */ 202 unsigned int inum = n - IVT_IRQBASE; 203 if (!pic_is_spurious(inum)) { 204 /* This is actually not a spurious IRQ, so proceed as usual. */ 205 irq_interrupt(n, istate); 206 return; 207 } 208 pic_handle_spurious(n); 211 209 #ifdef CONFIG_DEBUG 212 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id); 210 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id, 211 inum); 213 212 #endif 214 213 } -
kernel/arch/ia32/src/interrupt.c
ref56a43 rfd67c9f 192 192 bool ack = false; 193 193 assert(inum < IRQ_COUNT); 194 assert(inum != IRQ_PIC0_SPUR);195 assert(inum != IRQ_PIC1_SPUR);196 194 assert(inum != IRQ_PIC1); 197 195 … … 210 208 irq_spinlock_unlock(&irq->lock, false); 211 209 } else { 212 /*213 * Spurious interrupt.214 */215 210 #ifdef CONFIG_DEBUG 216 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum); 211 log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id, 212 inum); 217 213 #endif 218 214 } … … 224 220 static void pic_spurious(unsigned int n, istate_t *istate) 225 221 { 226 /* 227 * XXX: Examine ISR to figure out whether this is indeed a spurious 228 * or actual IRQ. 229 */ 222 unsigned int inum = n - IVT_IRQBASE; 223 if (!pic_is_spurious(inum)) { 224 /* This is actually not a spurious IRQ, so proceed as usual. */ 225 irq_interrupt(n, istate); 226 return; 227 } 228 pic_handle_spurious(n); 230 229 #ifdef CONFIG_DEBUG 231 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id); 230 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id, 231 inum); 232 232 #endif 233 233 } -
kernel/arch/mips32/include/arch/mach/malta/malta.h
ref56a43 rfd67c9f 45 45 46 46 #define PIC0_BASE (MALTA_PCI_BASE + 0x20) 47 #define PIC0_SPURIOUS_IRQ 748 47 #define PIC1_BASE (MALTA_PCI_BASE + 0xa0) 49 #define PIC1_SPURIOUS_IRQ 1550 48 51 49 #define ISA_IRQ_COUNT 16 -
kernel/arch/mips32/src/mach/malta/malta.c
ref56a43 rfd67c9f 74 74 { 75 75 uint8_t isa_irq = host2uint32_t_le(pio_read_32(GT64120_PCI0_INTACK)); 76 if (isa_irq == PIC0_SPURIOUS_IRQ || isa_irq == PIC1_SPURIOUS_IRQ) { 77 /* 78 * XXX: Examine ISR to figure out whether this is indeed a 79 * spurious or actual IRQ. 80 */ 76 if (pic_is_spurious(isa_irq)) { 77 pic_handle_spurious(isa_irq); 81 78 #ifdef CONFIG_DEBUG 82 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt ",83 CPU->id );79 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", 80 CPU->id, isa_irq); 84 81 return; 85 82 #endif … … 91 88 } else { 92 89 #ifdef CONFIG_DEBUG 93 log(LF_ARCH, LVL_DEBUG, "cpu%u: spuriousIRQ (irq=%u)",90 log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ (irq=%u)", 94 91 CPU->id, isa_irq); 95 92 #endif -
kernel/genarch/include/genarch/drivers/i8259/i8259.h
ref56a43 rfd67c9f 38 38 #include <typedefs.h> 39 39 #include <arch/interrupt.h> 40 #include <stdbool.h> 40 41 41 42 /* ICW1 bits */ … … 43 44 #define PIC_ICW1_NEEDICW4 (1 << 0) 44 45 46 /* OCW3 bits */ 47 #define PIC_OCW3 (1 << 3) 48 #define PIC_OCW3_READ_ISR (3 << 0) 49 45 50 /* OCW4 bits */ 46 51 #define PIC_OCW4 (0 << 3) 47 52 #define PIC_OCW4_NSEOI (1 << 5) 53 54 #define PIC_IRQ_COUNT 8 55 #define PIC_SPURIOUS_IRQ 7 48 56 49 57 typedef struct { … … 56 64 extern void pic_disable_irqs(uint16_t); 57 65 extern void pic_eoi(unsigned int); 66 extern bool pic_is_spurious(unsigned int); 67 extern void pic_handle_spurious(unsigned int); 58 68 59 69 #endif -
kernel/genarch/src/drivers/i8259/i8259.c
ref56a43 rfd67c9f 90 90 (uint8_t) (x & (~(irqmask & 0xff)))); 91 91 } 92 if (irqmask >> 8) {92 if (irqmask >> PIC_IRQ_COUNT) { 93 93 x = pio_read_8(&saved_pic1->port2); 94 94 pio_write_8(&saved_pic1->port2, 95 (uint8_t) (x & (~(irqmask >> 8))));95 (uint8_t) (x & (~(irqmask >> PIC_IRQ_COUNT)))); 96 96 } 97 97 } … … 106 106 (uint8_t) (x | (irqmask & 0xff))); 107 107 } 108 if (irqmask >> 8) {108 if (irqmask >> PIC_IRQ_COUNT) { 109 109 x = pio_read_8(&saved_pic1->port2); 110 pio_write_8(&saved_pic1->port2, (uint8_t) (x | (irqmask >> 8))); 110 pio_write_8(&saved_pic1->port2, 111 (uint8_t) (x | (irqmask >> PIC_IRQ_COUNT))); 111 112 } 112 113 } … … 114 115 void pic_eoi(unsigned int irq) 115 116 { 116 if (irq >= 8)117 if (irq >= PIC_IRQ_COUNT) 117 118 pio_write_8(&saved_pic1->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 118 119 pio_write_8(&saved_pic0->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 119 120 } 120 121 122 bool pic_is_spurious(unsigned int irq) 123 { 124 pio_write_8(&saved_pic0->port1, PIC_OCW3 | PIC_OCW3_READ_ISR); 125 pio_write_8(&saved_pic1->port1, PIC_OCW3 | PIC_OCW3_READ_ISR); 126 uint8_t isr_lo = pio_read_8(&saved_pic0->port1); 127 uint8_t isr_hi = pio_read_8(&saved_pic1->port1); 128 return !(((isr_hi << PIC_IRQ_COUNT) | isr_lo) & (1 << irq)); 129 } 130 131 void pic_handle_spurious(unsigned int irq) 132 { 133 /* For spurious IRQs from pic1, we need to isssue an EOI to pic0 */ 134 if (irq >= PIC_IRQ_COUNT) 135 pio_write_8(&saved_pic0->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 136 } 137 121 138 /** @} 122 139 */
Note:
See TracChangeset
for help on using the changeset viewer.