Changeset d1cbad5 in mainline for kernel/genarch/src/drivers/i8259/i8259.c
- Timestamp:
- 2019-03-30T15:24:52Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a773b8b
- Parents:
- 87a5796
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/i8259/i8259.c
r87a5796 rd1cbad5 47 47 static void pic_spurious(unsigned int n, istate_t *istate); 48 48 49 void i8259_init(void) 49 // XXX: need to change pic_* API to get rid of these 50 static i8259_t *saved_pic0; 51 static i8259_t *saved_pic1; 52 53 void i8259_init(i8259_t *pic0, i8259_t *pic1) 50 54 { 55 saved_pic0 = pic0; 56 saved_pic1 = pic1; 57 51 58 /* ICW1: this is ICW1, ICW4 to follow */ 52 pio_write_8( PIC_PIC0PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);59 pio_write_8(&pic0->port1, PIC_ICW1 | PIC_ICW1_NEEDICW4); 53 60 54 61 /* ICW2: IRQ 0 maps to INT IRQBASE */ 55 pio_write_8( PIC_PIC0PORT2, IVT_IRQBASE);62 pio_write_8(&pic0->port2, IVT_IRQBASE); 56 63 57 64 /* ICW3: pic1 using IRQ IRQ_PIC1 */ 58 pio_write_8( PIC_PIC0PORT2, 1 << IRQ_PIC1);65 pio_write_8(&pic0->port2, 1 << IRQ_PIC1); 59 66 60 67 /* ICW4: i8086 mode */ 61 pio_write_8( PIC_PIC0PORT2, 1);68 pio_write_8(&pic0->port2, 1); 62 69 63 70 /* ICW1: ICW1, ICW4 to follow */ 64 pio_write_8( PIC_PIC1PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);71 pio_write_8(&pic1->port1, PIC_ICW1 | PIC_ICW1_NEEDICW4); 65 72 66 73 /* ICW2: IRQ 8 maps to INT (IVT_IRQBASE + 8) */ 67 pio_write_8( PIC_PIC1PORT2, IVT_IRQBASE + 8);74 pio_write_8(&pic1->port2, IVT_IRQBASE + 8); 68 75 69 76 /* ICW3: pic1 is known as IRQ_PIC1 */ 70 pio_write_8( PIC_PIC1PORT2, IRQ_PIC1);77 pio_write_8(&pic1->port2, IRQ_PIC1); 71 78 72 79 /* ICW4: i8086 mode */ 73 pio_write_8( PIC_PIC1PORT2, 1);80 pio_write_8(&pic1->port2, 1); 74 81 75 82 /* … … 97 104 98 105 if (irqmask & 0xff) { 99 x = pio_read_8(PIC_PIC0PORT2); 100 pio_write_8(PIC_PIC0PORT2, (uint8_t) (x & (~(irqmask & 0xff)))); 106 x = pio_read_8(&saved_pic0->port2); 107 pio_write_8(&saved_pic0->port2, 108 (uint8_t) (x & (~(irqmask & 0xff)))); 101 109 } 102 110 if (irqmask >> 8) { 103 x = pio_read_8(PIC_PIC1PORT2); 104 pio_write_8(PIC_PIC1PORT2, (uint8_t) (x & (~(irqmask >> 8)))); 111 x = pio_read_8(&saved_pic1->port2); 112 pio_write_8(&saved_pic1->port2, 113 (uint8_t) (x & (~(irqmask >> 8)))); 105 114 } 106 115 } … … 111 120 112 121 if (irqmask & 0xff) { 113 x = pio_read_8(PIC_PIC0PORT2); 114 pio_write_8(PIC_PIC0PORT2, (uint8_t) (x | (irqmask & 0xff))); 122 x = pio_read_8(&saved_pic0->port2); 123 pio_write_8(&saved_pic0->port2, 124 (uint8_t) (x | (irqmask & 0xff))); 115 125 } 116 126 if (irqmask >> 8) { 117 x = pio_read_8( PIC_PIC1PORT2);118 pio_write_8( PIC_PIC1PORT2, (uint8_t) (x | (irqmask >> 8)));127 x = pio_read_8(&saved_pic1->port2); 128 pio_write_8(&saved_pic1->port2, (uint8_t) (x | (irqmask >> 8))); 119 129 } 120 130 } … … 122 132 void pic_eoi(void) 123 133 { 124 pio_write_8( PIC_PIC0PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);125 pio_write_8( PIC_PIC1PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);134 pio_write_8(&saved_pic0->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 135 pio_write_8(&saved_pic1->port1, PIC_OCW4 | PIC_OCW4_NSEOI); 126 136 } 127 137
Note:
See TracChangeset
for help on using the changeset viewer.