Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
Mike Loptien | ce740c4 | 2014-01-03 16:54:56 -0700 | [diff] [blame] | 5 | * Copyright (C) 2014 Sage Electronic Engineering, LLC. |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef PC80_I8259_H |
| 18 | #define PC80_I8259_H |
| 19 | |
Mike Loptien | ce740c4 | 2014-01-03 16:54:56 -0700 | [diff] [blame] | 20 | /* |
| 21 | * IRQ numbers and common usage |
| 22 | * If an IRQ does not say it is 'Reserved' |
| 23 | * then it can be used by a device, though |
| 24 | * some systems may not adhere to this map. |
| 25 | */ |
| 26 | /* PIC IRQs */ |
| 27 | #define IRQ_DIS 0x1F /* IRQ is disabled */ |
| 28 | #define IRQ_0 0x00 /* Reserved - Timer IRQ */ |
| 29 | #define IRQ_1 0x01 /* Keyboard controller */ |
| 30 | #define IRQ_2 0x02 /* Reserved - Cascade to Slave PIC */ |
| 31 | #define IRQ_3 0x03 /* Serial Port 2 & 4 */ |
| 32 | #define IRQ_4 0x04 /* Serial Port 1 & 3 */ |
| 33 | #define IRQ_5 0x05 /* Parallel Port 2 & 3 or Sound Card */ |
| 34 | #define IRQ_6 0x06 /* Floppy Disk Controller */ |
| 35 | #define IRQ_7 0x07 /* Parallel Port 1 */ |
| 36 | #define IRQ_8 0x08 /* Reserved - RTC */ |
| 37 | #define IRQ_9 0x09 /* Reserved - ACPI System Control Interrupt */ |
| 38 | #define IRQ_10 0x0A /* Free or SCSI or NIC */ |
| 39 | #define IRQ_11 0x0B /* Free or SCSI or NIC */ |
| 40 | #define IRQ_12 0x0C /* PS/2 Mouse */ |
| 41 | #define IRQ_13 0x0D /* Reserved - CPU Floating Point Unit */ |
| 42 | #define IRQ_14 0x0E /* Primary ATA */ |
| 43 | #define IRQ_15 0x0F /* Secondary ATA */ |
| 44 | |
| 45 | #define MASTER_PIC_ICW1 0x20 |
| 46 | #define SLAVE_PIC_ICW1 0xa0 |
| 47 | #define ICW_SELECT (1 << 4) |
| 48 | #define OCW_SELECT (0 << 4) |
| 49 | #define ADI (1 << 2) |
| 50 | #define SNGL (1 << 1) |
| 51 | #define IC4 (1 << 0) |
| 52 | |
| 53 | #define MASTER_PIC_ICW2 0x21 |
| 54 | #define SLAVE_PIC_ICW2 0xa1 |
| 55 | #define INT_VECTOR_MASTER 0x20 |
| 56 | #define IRQ0 0x00 |
| 57 | #define IRQ1 0x01 |
| 58 | #define INT_VECTOR_SLAVE 0x28 |
| 59 | #define IRQ8 0x00 |
| 60 | #define IRQ9 0x01 |
| 61 | |
| 62 | #define MASTER_PIC_ICW3 0x21 |
| 63 | #define CASCADED_PIC (1 << 2) |
| 64 | |
| 65 | #define MASTER_PIC_ICW4 0x21 |
| 66 | #define SLAVE_PIC_ICW4 0xa1 |
| 67 | #define MICROPROCESSOR_MODE (1 << 0) |
| 68 | |
| 69 | #define SLAVE_PIC_ICW3 0xa1 |
| 70 | #define SLAVE_ID 0x02 |
| 71 | |
| 72 | #define MASTER_PIC_OCW1 0x21 |
| 73 | #define SLAVE_PIC_OCW1 0xa1 |
| 74 | #define IRQ2 (1 << 2) |
| 75 | #define ALL_IRQS 0xff |
| 76 | |
| 77 | #define ELCR1 0x4d0 |
| 78 | #define ELCR2 0x4d1 |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 79 | |
Stefan Reinauer | 4d933dd | 2009-07-21 21:36:41 +0000 | [diff] [blame] | 80 | #define IRQ_LEVEL_TRIGGERED 1 |
| 81 | #define IRQ_EDGE_TRIGGERED 0 |
Mike Loptien | ce740c4 | 2014-01-03 16:54:56 -0700 | [diff] [blame] | 82 | |
| 83 | u16 pic_read_irq_mask(void); |
| 84 | void pic_write_irq_mask(u16 mask); |
| 85 | void pic_irq_enable(u8 int_num, u8 mask); |
| 86 | void setup_i8259(void); |
Stefan Reinauer | 4d933dd | 2009-07-21 21:36:41 +0000 | [diff] [blame] | 87 | void i8259_configure_irq_trigger(int int_num, int is_level_triggered); |
| 88 | |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 89 | #endif /* PC80_I8259_H */ |