Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
| 4 | #include <device/pci_def.h> |
| 5 | |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 6 | unsigned long acpi_fill_madt(unsigned long current) |
| 7 | { |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 8 | struct device *bdev, *dev = NULL; |
| 9 | struct resource *res = NULL; |
| 10 | |
Kyösti Mälkki | c87814d | 2022-11-12 20:51:23 +0200 | [diff] [blame] | 11 | current = acpi_create_madt_lapics_with_nmis(current); |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 12 | |
| 13 | /* Southbridge IOAPIC */ |
Kyösti Mälkki | c045735 | 2021-06-08 06:12:25 +0300 | [diff] [blame] | 14 | current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, 0xfec00000); |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 15 | |
| 16 | bdev = pcidev_on_root(2, 0); |
| 17 | /* P64H2 Bus B IOAPIC */ |
| 18 | if (bdev) |
| 19 | dev = pcidev_path_behind(bdev->link_list, PCI_DEVFN(28, 0)); |
| 20 | if (dev) { |
| 21 | res = find_resource(dev, PCI_BASE_ADDRESS_0); |
Kyösti Mälkki | c045735 | 2021-06-08 06:12:25 +0300 | [diff] [blame] | 22 | current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, res->base); |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | /* P64H2 Bus A IOAPIC */ |
| 26 | if (bdev) |
| 27 | dev = pcidev_path_behind(bdev->link_list, PCI_DEVFN(30, 0)); |
| 28 | if (dev) { |
| 29 | res = find_resource(dev, PCI_BASE_ADDRESS_0); |
Kyösti Mälkki | c045735 | 2021-06-08 06:12:25 +0300 | [diff] [blame] | 30 | current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, res->base); |
Kyösti Mälkki | 7b73e852 | 2022-11-08 04:43:41 +0000 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | /* Map ISA IRQ 0 to IRQ 2 */ |
| 34 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 1, 0, 2, 0); |
| 35 | |
| 36 | /* IRQ9 differs from ISA standard - ours is active high, level-triggered */ |
| 37 | current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)current, 0, 9, 9, 0xD); |
| 38 | |
| 39 | return current; |
| 40 | } |