Felix Held | be9fcf1 | 2023-08-23 22:15:39 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Felix Held | 474c5d6 | 2024-01-09 16:56:56 +0100 | [diff] [blame] | 3 | #include <amdblocks/ioapic.h> |
Felix Held | be9fcf1 | 2023-08-23 22:15:39 +0200 | [diff] [blame] | 4 | #include <amdblocks/root_complex.h> |
| 5 | #include <console/console.h> |
| 6 | #include <device/device.h> |
| 7 | #include <types.h> |
| 8 | |
| 9 | uint32_t get_iohc_misc_smn_base(struct device *domain) |
| 10 | { |
| 11 | switch (domain->path.domain.domain) { |
| 12 | case 0: |
| 13 | return SMN_IOHC_MISC_BASE_13C1; |
| 14 | case 1: |
| 15 | return SMN_IOHC_MISC_BASE_13B1; |
| 16 | case 2: |
| 17 | return SMN_IOHC_MISC_BASE_13E1; |
| 18 | case 3: |
| 19 | return SMN_IOHC_MISC_BASE_13D1; |
| 20 | default: |
| 21 | printk(BIOS_ERR, "Invalid domain 0x%x with no corresponding IOHC device.\n", |
| 22 | domain->path.domain.domain); |
| 23 | return 0; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | static const struct non_pci_mmio_reg non_pci_mmio[] = { |
| 28 | { 0x2d8, 0xfffffff00000ull, 1 * MiB, NON_PCI_RES_IDX_AUTO }, |
| 29 | { 0x2e0, 0xfffffff00000ull, 1 * MiB, NON_PCI_RES_IDX_AUTO }, |
| 30 | { 0x2e8, 0xfffffff00000ull, 1 * MiB, NON_PCI_RES_IDX_AUTO }, |
| 31 | /* The hardware has a 256 byte alignment requirement for the IOAPIC MMIO base, but we |
| 32 | tell the FSP to configure a 4k-aligned base address and this is reported as 4 KiB |
| 33 | resource. */ |
| 34 | { 0x2f0, 0xffffffffff00ull, 4 * KiB, IOMMU_IOAPIC_IDX }, |
| 35 | { 0x2f8, 0xfffffff00000ull, 1 * MiB, NON_PCI_RES_IDX_AUTO }, |
| 36 | { 0x300, 0xfffffff00000ull, 1 * MiB, NON_PCI_RES_IDX_AUTO }, |
| 37 | { 0x308, 0xfffffffff000ull, 4 * KiB, NON_PCI_RES_IDX_AUTO }, |
| 38 | { 0x310, 0xfffffff00000ull, 1 * MiB, NON_PCI_RES_IDX_AUTO }, |
| 39 | { 0x318, 0xfffffff80000ull, 512 * KiB, NON_PCI_RES_IDX_AUTO }, |
| 40 | }; |
| 41 | |
| 42 | const struct non_pci_mmio_reg *get_iohc_non_pci_mmio_regs(size_t *count) |
| 43 | { |
| 44 | *count = ARRAY_SIZE(non_pci_mmio); |
| 45 | return non_pci_mmio; |
| 46 | } |
| 47 | |
| 48 | signed int get_iohc_fabric_id(struct device *domain) |
| 49 | { |
| 50 | switch (domain->path.domain.domain) { |
| 51 | case 0: |
| 52 | return 0x22; |
| 53 | case 1: |
| 54 | return 0x23; |
| 55 | case 2: |
| 56 | return 0x21; |
| 57 | case 3: |
| 58 | return 0x20; |
| 59 | default: |
| 60 | return -1; |
| 61 | } |
| 62 | } |