Changeset a773b8b in mainline


Ignore:
Timestamp:
2019-03-30T16:20:53Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bbb99f82
Parents:
d1cbad5
Message:

Make i8259_init() more generic

Location:
kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/amd64.c

    rd1cbad5 ra773b8b  
    121121                /* PIC */
    122122                i8259_init((i8259_t *) I8259_PIC0_BASE,
    123                     (i8259_t *) I8259_PIC1_BASE);
     123                    (i8259_t *) I8259_PIC1_BASE, IRQ_PIC1, IVT_IRQBASE,
     124                    IVT_IRQBASE + 8);
    124125        }
    125126}
  • kernel/arch/ia32/src/ia32.c

    rd1cbad5 ra773b8b  
    110110                /* PIC */
    111111                i8259_init((i8259_t *) I8259_PIC0_BASE,
    112                     (i8259_t *) I8259_PIC1_BASE);
     112                    (i8259_t *) I8259_PIC1_BASE, IRQ_PIC1, IVT_IRQBASE,
     113                    IVT_IRQBASE + 8);
    113114        }
    114115}
  • kernel/genarch/include/genarch/drivers/i8259/i8259.h

    rd1cbad5 ra773b8b  
    5252} __attribute__((packed)) i8259_t;
    5353
    54 extern void i8259_init(i8259_t *, i8259_t *);
     54extern void i8259_init(i8259_t *, i8259_t *, inr_t, unsigned int, unsigned int);
    5555extern void pic_enable_irqs(uint16_t);
    5656extern void pic_disable_irqs(uint16_t);
  • kernel/genarch/src/drivers/i8259/i8259.c

    rd1cbad5 ra773b8b  
    3838
    3939#include <genarch/drivers/i8259/i8259.h>
    40 #include <cpu.h>
     40#include <typedefs.h>
    4141#include <stdint.h>
    42 #include <arch/asm.h>
    43 #include <arch.h>
    4442#include <log.h>
    4543#include <interrupt.h>
     
    5149static i8259_t *saved_pic1;
    5250
    53 void i8259_init(i8259_t *pic0, i8259_t *pic1)
     51void i8259_init(i8259_t *pic0, i8259_t *pic1, inr_t pic1_irq,
     52    unsigned int irq0_int, unsigned int irq8_int)
    5453{
    5554        saved_pic0 = pic0;
     
    5958        pio_write_8(&pic0->port1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
    6059
    61         /* ICW2: IRQ 0 maps to INT IRQBASE */
    62         pio_write_8(&pic0->port2, IVT_IRQBASE);
     60        /* ICW2: IRQ 0 maps to INT irq0_int */
     61        pio_write_8(&pic0->port2, irq0_int);
    6362
    6463        /* ICW3: pic1 using IRQ IRQ_PIC1 */
    65         pio_write_8(&pic0->port2, 1 << IRQ_PIC1);
     64        pio_write_8(&pic0->port2, 1 << pic1_irq);
    6665
    6766        /* ICW4: i8086 mode */
     
    7170        pio_write_8(&pic1->port1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
    7271
    73         /* ICW2: IRQ 8 maps to INT (IVT_IRQBASE + 8) */
    74         pio_write_8(&pic1->port2, IVT_IRQBASE + 8);
     72        /* ICW2: IRQ 8 maps to INT irq8_int */
     73        pio_write_8(&pic1->port2, irq8_int);
    7574
    7675        /* ICW3: pic1 is known as IRQ_PIC1 */
    77         pio_write_8(&pic1->port2, IRQ_PIC1);
     76        pio_write_8(&pic1->port2, pic1_irq);
    7877
    7978        /* ICW4: i8086 mode */
     
    9695
    9796        pic_disable_irqs(0xffff);               /* disable all irq's */
    98         pic_enable_irqs(1 << IRQ_PIC1);         /* but enable pic1 */
     97        pic_enable_irqs(1 << pic1_irq);         /* but enable pic1_irq */
    9998}
    10099
Note: See TracChangeset for help on using the changeset viewer.