Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Written by Stefan Reinauer <stepan@openbios.org> |
| 5 | * (C) 2005 Stefan Reinauer |
| 6 | * (C) 2005 Digital Design Corporation |
| 7 | * |
| 8 | * Ported to Intel XE7501DEVKIT by Agami Aruma |
| 9 | * Ported to AOpen DXPL Plus-U by Kyösti Mälkki |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; version 2 of the License. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #include <console/console.h> |
| 22 | #include <string.h> |
| 23 | #include <arch/acpi.h> |
| 24 | #include <device/pci.h> |
| 25 | #include <device/pci_ids.h> |
| 26 | #include <assert.h> |
| 27 | #include "bus.h" |
| 28 | |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 29 | unsigned long acpi_fill_madt(unsigned long current) |
| 30 | { |
| 31 | unsigned int irq_start = 0; |
| 32 | device_t dev = 0; |
| 33 | struct resource* res = NULL; |
| 34 | |
| 35 | // SJM: Hard-code CPU LAPIC entries for now |
| 36 | current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 0, 0); |
| 37 | current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 1, 6); |
| 38 | current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 2, 1); |
| 39 | current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, 3, 7); |
| 40 | |
| 41 | // Southbridge IOAPIC |
| 42 | current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_ICH4, 0xfec00000, irq_start); |
| 43 | irq_start += INTEL_IOAPIC_NUM_INTERRUPTS; |
| 44 | |
| 45 | // P64H2 Bus B IOAPIC |
| 46 | dev = dev_find_slot(PCI_BUS_E7501_HI_B, PCI_DEVFN(28, 0)); |
| 47 | if (!dev) |
| 48 | BUG(); // Config.lb error? |
| 49 | res = find_resource(dev, PCI_BASE_ADDRESS_0); |
| 50 | current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_P64H2_BUS_B, res->base, irq_start); |
| 51 | irq_start += INTEL_IOAPIC_NUM_INTERRUPTS; |
| 52 | |
| 53 | // P64H2 Bus A IOAPIC |
| 54 | dev = dev_find_slot(PCI_BUS_E7501_HI_B, PCI_DEVFN(30, 0)); |
| 55 | if (!dev) |
| 56 | BUG(); // Config.lb error? |
| 57 | res = find_resource(dev, PCI_BASE_ADDRESS_0); |
| 58 | current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, IOAPIC_P64H2_BUS_A, res->base, irq_start); |
| 59 | irq_start += INTEL_IOAPIC_NUM_INTERRUPTS; |
| 60 | |
| 61 | |
| 62 | // Map ISA IRQ 0 to IRQ 2 |
| 63 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 1, 0, 2, 0); |
| 64 | |
| 65 | // IRQ9 differs from ISA standard - ours is active high, level-triggered |
| 66 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 0, 9, 9, 0xD); |
| 67 | |
| 68 | return current; |
| 69 | } |