coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
i8259.h File Reference
#include <stdint.h>
Include dependency graph for i8259.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IRQ_DIS   0x1F /* IRQ is disabled */
 
#define IRQ_0   0x00 /* Reserved - Timer IRQ */
 
#define IRQ_1   0x01 /* Keyboard controller */
 
#define IRQ_2   0x02 /* Reserved - Cascade to Slave PIC */
 
#define IRQ_3   0x03 /* Serial Port 2 & 4 */
 
#define IRQ_4   0x04 /* Serial Port 1 & 3 */
 
#define IRQ_5   0x05 /* Parallel Port 2 & 3 or Sound Card */
 
#define IRQ_6   0x06 /* Floppy Disk Controller */
 
#define IRQ_7   0x07 /* Parallel Port 1 */
 
#define IRQ_8   0x08 /* Reserved - RTC */
 
#define IRQ_9   0x09 /* Reserved - ACPI System Control Interrupt */
 
#define IRQ_10   0x0A /* Free or SCSI or NIC */
 
#define IRQ_11   0x0B /* Free or SCSI or NIC */
 
#define IRQ_12   0x0C /* PS/2 Mouse */
 
#define IRQ_13   0x0D /* Reserved - CPU Floating Point Unit */
 
#define IRQ_14   0x0E /* Primary ATA */
 
#define IRQ_15   0x0F /* Secondary ATA */
 
#define MASTER_PIC_ICW1   0x20
 
#define SLAVE_PIC_ICW1   0xa0
 
#define ICW_SELECT   (1 << 4)
 
#define OCW_SELECT   (0 << 4)
 
#define ADI   (1 << 2)
 
#define SNGL   (1 << 1)
 
#define IC4   (1 << 0)
 
#define MASTER_PIC_ICW2   0x21
 
#define SLAVE_PIC_ICW2   0xa1
 
#define INT_VECTOR_MASTER   0x20
 
#define IRQ0   0x00
 
#define IRQ1   0x01
 
#define INT_VECTOR_SLAVE   0x28
 
#define IRQ8   0x00
 
#define IRQ9   0x01
 
#define MASTER_PIC_ICW3   0x21
 
#define CASCADED_PIC   (1 << 2)
 
#define MASTER_PIC_ICW4   0x21
 
#define SLAVE_PIC_ICW4   0xa1
 
#define MICROPROCESSOR_MODE   (1 << 0)
 
#define SLAVE_PIC_ICW3   0xa1
 
#define SLAVE_ID   0x02
 
#define MASTER_PIC_OCW1   0x21
 
#define SLAVE_PIC_OCW1   0xa1
 
#define IRQ2   (1 << 2)
 
#define ALL_IRQS   0xff
 
#define ELCR1   0x4d0
 
#define ELCR2   0x4d1
 
#define IRQ_LEVEL_TRIGGERED   1
 
#define IRQ_EDGE_TRIGGERED   0
 

Functions

u16 pic_read_irq_mask (void)
 
void pic_write_irq_mask (u16 mask)
 
void pic_irq_enable (u8 int_num, u8 mask)
 
void setup_i8259 (void)
 
void i8259_configure_irq_trigger (int int_num, int is_level_triggered)
 Configure IRQ triggering in the i8259 compatible Interrupt Controller. More...
 

Macro Definition Documentation

◆ ADI

#define ADI   (1 << 2)

Definition at line 37 of file i8259.h.

◆ ALL_IRQS

#define ALL_IRQS   0xff

Definition at line 63 of file i8259.h.

◆ CASCADED_PIC

#define CASCADED_PIC   (1 << 2)

Definition at line 51 of file i8259.h.

◆ ELCR1

#define ELCR1   0x4d0

Definition at line 65 of file i8259.h.

◆ ELCR2

#define ELCR2   0x4d1

Definition at line 66 of file i8259.h.

◆ IC4

#define IC4   (1 << 0)

Definition at line 39 of file i8259.h.

◆ ICW_SELECT

#define ICW_SELECT   (1 << 4)

Definition at line 35 of file i8259.h.

◆ INT_VECTOR_MASTER

#define INT_VECTOR_MASTER   0x20

Definition at line 43 of file i8259.h.

◆ INT_VECTOR_SLAVE

#define INT_VECTOR_SLAVE   0x28

Definition at line 46 of file i8259.h.

◆ IRQ0

#define IRQ0   0x00

Definition at line 44 of file i8259.h.

◆ IRQ1

#define IRQ1   0x01

Definition at line 45 of file i8259.h.

◆ IRQ2

#define IRQ2   (1 << 2)

Definition at line 62 of file i8259.h.

◆ IRQ8

#define IRQ8   0x00

Definition at line 47 of file i8259.h.

◆ IRQ9

#define IRQ9   0x01

Definition at line 48 of file i8259.h.

◆ IRQ_0

#define IRQ_0   0x00 /* Reserved - Timer IRQ */

Definition at line 16 of file i8259.h.

◆ IRQ_1

#define IRQ_1   0x01 /* Keyboard controller */

Definition at line 17 of file i8259.h.

◆ IRQ_10

#define IRQ_10   0x0A /* Free or SCSI or NIC */

Definition at line 26 of file i8259.h.

◆ IRQ_11

#define IRQ_11   0x0B /* Free or SCSI or NIC */

Definition at line 27 of file i8259.h.

◆ IRQ_12

#define IRQ_12   0x0C /* PS/2 Mouse */

Definition at line 28 of file i8259.h.

◆ IRQ_13

#define IRQ_13   0x0D /* Reserved - CPU Floating Point Unit */

Definition at line 29 of file i8259.h.

◆ IRQ_14

#define IRQ_14   0x0E /* Primary ATA */

Definition at line 30 of file i8259.h.

◆ IRQ_15

#define IRQ_15   0x0F /* Secondary ATA */

Definition at line 31 of file i8259.h.

◆ IRQ_2

#define IRQ_2   0x02 /* Reserved - Cascade to Slave PIC */

Definition at line 18 of file i8259.h.

◆ IRQ_3

#define IRQ_3   0x03 /* Serial Port 2 & 4 */

Definition at line 19 of file i8259.h.

◆ IRQ_4

#define IRQ_4   0x04 /* Serial Port 1 & 3 */

Definition at line 20 of file i8259.h.

◆ IRQ_5

#define IRQ_5   0x05 /* Parallel Port 2 & 3 or Sound Card */

Definition at line 21 of file i8259.h.

◆ IRQ_6

#define IRQ_6   0x06 /* Floppy Disk Controller */

Definition at line 22 of file i8259.h.

◆ IRQ_7

#define IRQ_7   0x07 /* Parallel Port 1 */

Definition at line 23 of file i8259.h.

◆ IRQ_8

#define IRQ_8   0x08 /* Reserved - RTC */

Definition at line 24 of file i8259.h.

◆ IRQ_9

#define IRQ_9   0x09 /* Reserved - ACPI System Control Interrupt */

Definition at line 25 of file i8259.h.

◆ IRQ_DIS

#define IRQ_DIS   0x1F /* IRQ is disabled */

Definition at line 15 of file i8259.h.

◆ IRQ_EDGE_TRIGGERED

#define IRQ_EDGE_TRIGGERED   0

Definition at line 69 of file i8259.h.

◆ IRQ_LEVEL_TRIGGERED

#define IRQ_LEVEL_TRIGGERED   1

Definition at line 68 of file i8259.h.

◆ MASTER_PIC_ICW1

#define MASTER_PIC_ICW1   0x20

Definition at line 33 of file i8259.h.

◆ MASTER_PIC_ICW2

#define MASTER_PIC_ICW2   0x21

Definition at line 41 of file i8259.h.

◆ MASTER_PIC_ICW3

#define MASTER_PIC_ICW3   0x21

Definition at line 50 of file i8259.h.

◆ MASTER_PIC_ICW4

#define MASTER_PIC_ICW4   0x21

Definition at line 53 of file i8259.h.

◆ MASTER_PIC_OCW1

#define MASTER_PIC_OCW1   0x21

Definition at line 60 of file i8259.h.

◆ MICROPROCESSOR_MODE

#define MICROPROCESSOR_MODE   (1 << 0)

Definition at line 55 of file i8259.h.

◆ OCW_SELECT

#define OCW_SELECT   (0 << 4)

Definition at line 36 of file i8259.h.

◆ SLAVE_ID

#define SLAVE_ID   0x02

Definition at line 58 of file i8259.h.

◆ SLAVE_PIC_ICW1

#define SLAVE_PIC_ICW1   0xa0

Definition at line 34 of file i8259.h.

◆ SLAVE_PIC_ICW2

#define SLAVE_PIC_ICW2   0xa1

Definition at line 42 of file i8259.h.

◆ SLAVE_PIC_ICW3

#define SLAVE_PIC_ICW3   0xa1

Definition at line 57 of file i8259.h.

◆ SLAVE_PIC_ICW4

#define SLAVE_PIC_ICW4   0xa1

Definition at line 54 of file i8259.h.

◆ SLAVE_PIC_OCW1

#define SLAVE_PIC_OCW1   0xa1

Definition at line 61 of file i8259.h.

◆ SNGL

#define SNGL   (1 << 1)

Definition at line 38 of file i8259.h.

Function Documentation

◆ i8259_configure_irq_trigger()

void i8259_configure_irq_trigger ( int  int_num,
int  is_level_triggered 
)

Configure IRQ triggering in the i8259 compatible Interrupt Controller.

Switch a certain interrupt to be level / edge triggered.

Parameters
int_numlegacy interrupt number (3-7, 9-15)
is_level_triggered1 for level triggered interrupt, 0 for edge triggered interrupt

Definition at line 99 of file i8259.c.

References ELCR1, ELCR2, inb(), and outb().

Referenced by lpc_init(), lpc_soc_init(), sc_init(), write_pci_cfg_irqs(), and write_pci_config_irqs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pic_irq_enable()

void pic_irq_enable ( u8  int_num,
u8  mask 
)

Definition at line 40 of file i8259.c.

References mask, pic_read_irq_mask(), and pic_write_irq_mask().

Here is the call graph for this function:

◆ pic_read_irq_mask()

u16 pic_read_irq_mask ( void  )

Definition at line 8 of file i8259.c.

References BIOS_DEBUG, BIOS_SPEW, inb(), mask, MASTER_PIC_OCW1, printk, and SLAVE_PIC_OCW1.

Referenced by pic_irq_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pic_write_irq_mask()

void pic_write_irq_mask ( u16  mask)

Definition at line 29 of file i8259.c.

References mask, MASTER_PIC_OCW1, outb(), and SLAVE_PIC_OCW1.

Referenced by pic_irq_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_i8259()

void setup_i8259 ( void  )

Definition at line 46 of file i8259.c.

References ALL_IRQS, CASCADED_PIC, IC4, ICW_SELECT, INT_VECTOR_MASTER, INT_VECTOR_SLAVE, IRQ0, IRQ2, IRQ8, MASTER_PIC_ICW1, MASTER_PIC_ICW2, MASTER_PIC_ICW3, MASTER_PIC_OCW1, MICROPROCESSOR_MODE, outb(), SLAVE_ID, SLAVE_PIC_ICW1, SLAVE_PIC_ICW2, SLAVE_PIC_ICW3, and SLAVE_PIC_OCW1.

Referenced by lpc_init(), lpc_soc_init(), run_bios(), and sc_init().

Here is the call graph for this function:
Here is the caller graph for this function: