diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2024-07-12 14:06:49 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-07-25 22:55:15 +0000 |
commit | e9e71132a308acbe5c6d5371fbe5f7d6ffe30cf4 (patch) | |
tree | eb872c338ef1a006600815e874c2d8b01b062e7c /src/soc/amd/genoa_poc | |
parent | 9af1d3f85727342a0105eecdc2bbee4fca71b0b2 (diff) |
soc/amd/*/root_complex: introduce and use domain_iohc_info struct
Instead of implementing the functions get_iohc_misc_smn_base and
get_iohc_fabric_id in the SoC code, move those functions to the common
AMD code, and implement get_iohc_info in the SoC code that returns a
pointer to and the size of a SoC-specific array of domain_iohc_info
structs that contains the info needed by the common code instead. This
allows to iterate over the domain_iohc_info structs which will be used
in a later patch to find the PSP MMIO base address in both ramstage and
smm.
TEST=Mandolin still boots and all non-PCI MIO resources are still
reported to the resource allocator
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Ifce3d2b540d14ba3cba36f7cbf248fb7c63483fe
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83443
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-by: Varshit Pandya <pandyavarshit@gmail.com>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'src/soc/amd/genoa_poc')
-rw-r--r-- | src/soc/amd/genoa_poc/root_complex.c | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/src/soc/amd/genoa_poc/root_complex.c b/src/soc/amd/genoa_poc/root_complex.c index 849bf77a78..3171febe9f 100644 --- a/src/soc/amd/genoa_poc/root_complex.c +++ b/src/soc/amd/genoa_poc/root_complex.c @@ -2,26 +2,31 @@ #include <amdblocks/ioapic.h> #include <amdblocks/root_complex.h> -#include <console/console.h> -#include <device/device.h> #include <types.h> -uint32_t get_iohc_misc_smn_base(struct device *domain) +static const struct domain_iohc_info iohc_info[] = { + [0] = { + .fabric_id = 0x22, + .misc_smn_base = SMN_IOHC_MISC_BASE_13C1, + }, + [1] = { + .fabric_id = 0x23, + .misc_smn_base = SMN_IOHC_MISC_BASE_13B1, + }, + [2] = { + .fabric_id = 0x21, + .misc_smn_base = SMN_IOHC_MISC_BASE_13E1, + }, + [3] = { + .fabric_id = 0x20, + .misc_smn_base = SMN_IOHC_MISC_BASE_13D1, + }, +}; + +const struct domain_iohc_info *get_iohc_info(size_t *count) { - switch (domain->path.domain.domain) { - case 0: - return SMN_IOHC_MISC_BASE_13C1; - case 1: - return SMN_IOHC_MISC_BASE_13B1; - case 2: - return SMN_IOHC_MISC_BASE_13E1; - case 3: - return SMN_IOHC_MISC_BASE_13D1; - default: - printk(BIOS_ERR, "Invalid domain 0x%x with no corresponding IOHC device.\n", - domain->path.domain.domain); - return 0; - } + *count = ARRAY_SIZE(iohc_info); + return iohc_info; } static const struct non_pci_mmio_reg non_pci_mmio[] = { @@ -44,19 +49,3 @@ const struct non_pci_mmio_reg *get_iohc_non_pci_mmio_regs(size_t *count) *count = ARRAY_SIZE(non_pci_mmio); return non_pci_mmio; } - -signed int get_iohc_fabric_id(struct device *domain) -{ - switch (domain->path.domain.domain) { - case 0: - return 0x22; - case 1: - return 0x23; - case 2: - return 0x21; - case 3: - return 0x20; - default: - return -1; - } -} |