Tobias Diedrich | 6222fe0 | 2010-11-09 22:11:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2010 Tobias Diedrich <ranma+coreboot@tdiedrich.de> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
Tobias Diedrich | 6222fe0 | 2010-11-09 22:11:00 +0000 | [diff] [blame] | 15 | * IRQ Routing Table |
| 16 | * |
| 17 | * Documentation at : http://www.microsoft.com/hwdev/busbios/PCIIRQ.HTM |
| 18 | */ |
| 19 | #include <string.h> |
| 20 | #include <stdint.h> |
| 21 | #include <arch/pirq_routing.h> |
| 22 | #include <device/pci_ids.h> |
| 23 | |
| 24 | /* Free irqs are 3, 5, 10 and 11 */ |
Elyes HAOUAS | 6350a2e | 2016-09-16 20:49:38 +0200 | [diff] [blame] | 25 | #define IRQBM ((1 << 3)|(1 << 5)|(1 << 10)|(1 << 11)) |
Tobias Diedrich | 6222fe0 | 2010-11-09 22:11:00 +0000 | [diff] [blame] | 26 | |
| 27 | #define LNKA 1 |
| 28 | #define LNKB 2 |
| 29 | #define LNKC 3 |
| 30 | #define LNKD 4 |
| 31 | |
| 32 | /* |
| 33 | * For simplicity map LNK[E-H] to LNK[A-D]. |
| 34 | * This also means we are 82C596 compatible. |
| 35 | * Needs 0:11.0 0x46[4] set to 0. |
| 36 | */ |
| 37 | #define LNKE 1 |
| 38 | #define LNKF 2 |
| 39 | #define LNKG 3 |
| 40 | #define LNKH 4 |
| 41 | |
Stefan Reinauer | a47bd91 | 2012-11-15 15:15:15 -0800 | [diff] [blame] | 42 | static const struct irq_routing_table intel_irq_routing_table = { |
Tobias Diedrich | 6222fe0 | 2010-11-09 22:11:00 +0000 | [diff] [blame] | 43 | PIRQ_SIGNATURE, /* u32 signature */ |
| 44 | PIRQ_VERSION, /* u16 version */ |
| 45 | 32+16*CONFIG_IRQ_SLOT_COUNT, /* there can be total CONFIG_IRQ_SLOT_COUNT devices on the bus */ |
| 46 | 0, /* Where the interrupt router lies (bus) */ |
Elyes HAOUAS | 6350a2e | 2016-09-16 20:49:38 +0200 | [diff] [blame] | 47 | (0x11 << 3)|0, /* Where the interrupt router lies (dev) */ |
Tobias Diedrich | 6222fe0 | 2010-11-09 22:11:00 +0000 | [diff] [blame] | 48 | 0, /* IRQs devoted exclusively to PCI usage */ |
| 49 | PCI_VENDOR_ID_VIA, /* Compatible Vendor (VIA) */ |
| 50 | PCI_DEVICE_ID_VIA_82C596, /* Compatible Device (82C596) */ |
| 51 | 0, /* Miniport data */ |
| 52 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* u8 rfu[11] */ |
| 53 | 0x5f, /* u8 checksum, this has to be set to some value that would give 0 after the sum of all bytes for this structure (including checksum) */ |
| 54 | { |
| 55 | /* bus, dev | fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ |
| 56 | /* peg bridge */ |
| 57 | {0x00, (0x02 << 3) | 0x0, {{LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}}, 0x0, 0x0}, |
| 58 | /* pcie bridge */ |
| 59 | {0x00, (0x03 << 3) | 0x0, {{LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}}, 0x0, 0x0}, |
| 60 | /* sata/ide */ |
| 61 | {0x00, (0x0f << 3) | 0x0, {{0x00, 0x0000}, {LNKB, IRQBM}, {0x00, 0x0000}, {0x00, 0x0000}}, 0x0, 0x0}, |
| 62 | /* usb */ |
| 63 | {0x00, (0x10 << 3) | 0x0, {{LNKA, IRQBM}, {LNKB, IRQBM}, {LNKC, IRQBM}, {LNKD, IRQBM}}, 0x0, 0x0}, |
| 64 | /* agp bus? */ |
| 65 | {0x01, (0x00 << 3) | 0x0, {{LNKA, IRQBM}, {LNKB, IRQBM}, {LNKC, IRQBM}, {LNKD, IRQBM}}, 0x0, 0x0}, |
| 66 | /* pcie graphics */ |
| 67 | {0x02, (0x00 << 3) | 0x0, {{LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}}, 0x6, 0x0}, |
| 68 | /* onboard pcie atl1 ethernet */ |
| 69 | {0x03, (0x00 << 3) | 0x0, {{LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}}, 0x0, 0x0}, |
| 70 | /* pcie slot */ |
| 71 | {0x04, (0x00 << 3) | 0x0, {{LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}}, 0x5, 0x0}, |
| 72 | /* onboard marvell mv6121 sata */ |
| 73 | {0x05, (0x00 << 3) | 0x0, {{LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}, {LNKH, IRQBM}}, 0x0, 0x0}, |
| 74 | /* Azalia HDAC */ |
| 75 | {0x06, (0x01 << 3) | 0x0, {{LNKB, IRQBM}, {0x00, 0x0000}, {0x00, 0x0000}, {0x00, 0x0000}}, 0x0, 0x0}, |
| 76 | /* PCI slots */ |
| 77 | {0x07, (0x06 << 3) | 0x0, {{LNKA, IRQBM}, {LNKB, IRQBM}, {LNKC, IRQBM}, {LNKD, IRQBM}}, 0x1, 0x0}, |
| 78 | {0x07, (0x07 << 3) | 0x0, {{LNKB, IRQBM}, {LNKC, IRQBM}, {LNKD, IRQBM}, {LNKA, IRQBM}}, 0x2, 0x0}, |
| 79 | {0x07, (0x08 << 3) | 0x0, {{LNKC, IRQBM}, {LNKD, IRQBM}, {LNKA, IRQBM}, {LNKB, IRQBM}}, 0x3, 0x0}, |
| 80 | {0x07, (0x09 << 3) | 0x0, {{LNKD, IRQBM}, {LNKA, IRQBM}, {LNKB, IRQBM}, {LNKC, IRQBM}}, 0x4, 0x0}, |
| 81 | } |
| 82 | }; |
| 83 | |
| 84 | unsigned long write_pirq_routing_table(unsigned long addr) |
| 85 | { |
Stefan Reinauer | a47bd91 | 2012-11-15 15:15:15 -0800 | [diff] [blame] | 86 | return copy_pirq_routing_table(addr, &intel_irq_routing_table); |
Tobias Diedrich | 6222fe0 | 2010-11-09 22:11:00 +0000 | [diff] [blame] | 87 | } |