Changeset 3daba42e in mainline
- Timestamp:
- 2019-04-06T09:27:04Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b81644b, 3d0fd0d
- Parents:
- 534bcdf
- Location:
- kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/amd64.c
r534bcdf r3daba42e 121 121 /* PIC */ 122 122 i8259_init((i8259_t *) I8259_PIC0_BASE, 123 (i8259_t *) I8259_PIC1_BASE, I RQ_PIC1, IVT_IRQBASE);123 (i8259_t *) I8259_PIC1_BASE, IVT_IRQBASE); 124 124 125 125 /* -
kernel/arch/ia32/src/ia32.c
r534bcdf r3daba42e 110 110 /* PIC */ 111 111 i8259_init((i8259_t *) I8259_PIC0_BASE, 112 (i8259_t *) I8259_PIC1_BASE, I RQ_PIC1, IVT_IRQBASE);112 (i8259_t *) I8259_PIC1_BASE, IVT_IRQBASE); 113 113 114 114 /* -
kernel/arch/mips32/src/mach/malta/malta.c
r534bcdf r3daba42e 99 99 irq_init(ISA_IRQ_COUNT, ISA_IRQ_COUNT); 100 100 101 i8259_init((i8259_t *) PIC0_BASE, (i8259_t *) PIC1_BASE, 2,0);101 i8259_init((i8259_t *) PIC0_BASE, (i8259_t *) PIC1_BASE, 0); 102 102 103 103 int_handler[INT_HW0] = malta_isa_irq_handler; -
kernel/genarch/include/genarch/drivers/i8259/i8259.h
r534bcdf r3daba42e 52 52 #define PIC_OCW4_NSEOI (1 << 5) 53 53 54 #define PIC_IRQ_COUNT 8 55 #define PIC_SPURIOUS_IRQ 7 54 #define PIC0_IRQ_COUNT 8 55 #define PIC1_IRQ_COUNT 8 56 57 #define PIC0_IRQ_PIC1 2 56 58 57 59 typedef struct { … … 60 62 } __attribute__((packed)) i8259_t; 61 63 62 extern void i8259_init(i8259_t *, i8259_t *, inr_t,unsigned int);64 extern void i8259_init(i8259_t *, i8259_t *, unsigned int); 63 65 extern void pic_enable_irqs(uint16_t); 64 66 extern void pic_disable_irqs(uint16_t); -
kernel/genarch/src/drivers/i8259/i8259.c
r534bcdf r3daba42e 47 47 static i8259_t *saved_pic1; 48 48 49 void i8259_init(i8259_t *pic0, i8259_t *pic1, inr_t pic1_irq, 50 unsigned int irq0_vec) 49 void i8259_init(i8259_t *pic0, i8259_t *pic1, unsigned int irq0_vec) 51 50 { 52 51 saved_pic0 = pic0; … … 59 58 pio_write_8(&pic0->port2, irq0_vec); 60 59 61 /* ICW3: pic1 using IRQ IRQ_PIC1 */62 pio_write_8(&pic0->port2, 1 << pic1_irq);60 /* ICW3: pic1 using IRQ PIC0_IRQ_PIC1 */ 61 pio_write_8(&pic0->port2, 1 << PIC0_IRQ_PIC1); 63 62 64 63 /* ICW4: i8086 mode */ … … 69 68 70 69 /* ICW2: IRQ 8 maps to interrupt vector address irq0_vec + 8 */ 71 pio_write_8(&pic1->port2, irq0_vec + PIC _IRQ_COUNT);70 pio_write_8(&pic1->port2, irq0_vec + PIC0_IRQ_COUNT); 72 71 73 /* ICW3: pic1 is known as IRQ_PIC1 */74 pio_write_8(&pic1->port2, pic1_irq);72 /* ICW3: pic1 is known as PIC0_IRQ_PIC1 */ 73 pio_write_8(&pic1->port2, PIC0_IRQ_PIC1); 75 74 76 75 /* ICW4: i8086 mode */ … … 78 77 79 78 pic_disable_irqs(0xffff); /* disable all irq's */ 80 pic_enable_irqs(1 << pic1_irq); /* but enable pic1_irq*/79 pic_enable_irqs(1 << PIC0_IRQ_PIC1); /* but enable PIC0_IRQ_PIC1 */ 81 80 } 82 81 … … 90 89 (uint8_t) (x & (~(irqmask & 0xff)))); 91 90 } 92 if (irqmask >> PIC _IRQ_COUNT) {91 if (irqmask >> PIC0_IRQ_COUNT) { 93 92 x = pio_read_8(&saved_pic1->port2); 94 93 pio_write_8(&saved_pic1->port2, 95 (uint8_t) (x & (~(irqmask >> PIC _IRQ_COUNT))));94 (uint8_t) (x & (~(irqmask >> PIC0_IRQ_COUNT)))); 96 95 } 97 96 } … … 106 105 (uint8_t) (x | (irqmask & 0xff))); 107 106 } 108 if (irqmask >> PIC _IRQ_COUNT) {107 if (irqmask >> PIC0_IRQ_COUNT) { 109 108 x = pio_read_8(&saved_pic1->port2); 110 109 pio_write_8(&saved_pic1->port2, 111 (uint8_t) (x | (irqmask >> PIC _IRQ_COUNT)));110 (uint8_t) (x | (irqmask >> PIC0_IRQ_COUNT))); 112 111 } 113 112 } … … 115 114 void pic_eoi(unsigned int irq) 116 115 { 117 if (irq >= PIC _IRQ_COUNT)116 if (irq >= PIC0_IRQ_COUNT) 118 117 pio_write_8(&saved_pic1->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 119 118 pio_write_8(&saved_pic0->port1, PIC_OCW4 | PIC_OCW4_NSEOI); … … 126 125 uint8_t isr_lo = pio_read_8(&saved_pic0->port1); 127 126 uint8_t isr_hi = pio_read_8(&saved_pic1->port1); 128 return !(((isr_hi << PIC _IRQ_COUNT) | isr_lo) & (1 << irq));127 return !(((isr_hi << PIC0_IRQ_COUNT) | isr_lo) & (1 << irq)); 129 128 } 130 129 … … 132 131 { 133 132 /* For spurious IRQs from pic1, we need to isssue an EOI to pic0 */ 134 if (irq >= PIC _IRQ_COUNT)133 if (irq >= PIC0_IRQ_COUNT) 135 134 pio_write_8(&saved_pic0->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 136 135 }
Note:
See TracChangeset
for help on using the changeset viewer.