Changeset d1cbad5 in mainline
- Timestamp:
- 2019-03-30T15:24:52Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a773b8b
- Parents:
- 87a5796
- Location:
- kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/amd64.c
r87a5796 rd1cbad5 120 120 121 121 /* PIC */ 122 i8259_init(); 122 i8259_init((i8259_t *) I8259_PIC0_BASE, 123 (i8259_t *) I8259_PIC1_BASE); 123 124 } 124 125 } -
kernel/arch/ia32/src/ia32.c
r87a5796 rd1cbad5 109 109 110 110 /* PIC */ 111 i8259_init(); 111 i8259_init((i8259_t *) I8259_PIC0_BASE, 112 (i8259_t *) I8259_PIC1_BASE); 112 113 } 113 114 } -
kernel/genarch/include/genarch/drivers/i8259/i8259.h
r87a5796 rd1cbad5 39 39 #include <arch/interrupt.h> 40 40 41 #define PIC_PIC0PORT1 ((ioport8_t *) 0x20U)42 #define PIC_PIC0PORT2 ((ioport8_t *) 0x21U)43 #define PIC_PIC1PORT1 ((ioport8_t *) 0xa0U)44 #define PIC_PIC1PORT2 ((ioport8_t *) 0xa1U)45 46 41 /* ICW1 bits */ 47 42 #define PIC_ICW1 (1 << 4) … … 52 47 #define PIC_OCW4_NSEOI (1 << 5) 53 48 54 extern void i8259_init(void); 49 typedef struct { 50 ioport8_t port1; 51 ioport8_t port2; 52 } __attribute__((packed)) i8259_t; 53 54 extern void i8259_init(i8259_t *, i8259_t *); 55 55 extern void pic_enable_irqs(uint16_t); 56 56 extern void pic_disable_irqs(uint16_t); -
kernel/genarch/include/genarch/drivers/legacy/ia32/io.h
r87a5796 rd1cbad5 44 44 #define NS16550_BASE ((ioport8_t *) 0x3f8) 45 45 46 #define I8259_PIC0_BASE ((ioport8_t *) 0x20U) 47 #define I8259_PIC1_BASE ((ioport8_t *) 0xA0U) 48 46 49 #define EGA_VIDEORAM 0xb8000 47 50 -
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.