diff options
author | Nikolai Vyssotski <nikolai.vyssotski@amd.corp-partner.google.com> | 2021-06-04 10:35:15 -0500 |
---|---|---|
committer | Raul Rangel <rrangel@chromium.org> | 2021-06-07 16:04:36 +0000 |
commit | 177a402b6eb554cf3ad1dce12bc558582877cba3 (patch) | |
tree | 5ed7f628bb62f8b123d851bee87049ae915ce034 /src/soc/amd/common | |
parent | 0889a80c6300db1d39f00e0650cef48f99ccbf70 (diff) |
soc/amd/common/fsp/pci: Add size field to PCIe interrupt routing HOB
EDK2 mandates HOB to be in increments of qword (8). This HOB has 13
elements which causes it be padded with 4 bytes of garbage. This
results in coreboot failing intermittently with invalid data. Add
"number of entries" field to specify the number of valid entries in
the table.
BUG=b:190153208
Cq-depend: chrome-internal:3889619
TEST=verify HOB is present and correct size (13) is reported
Change-Id: Iaafae304f04a5f26d75a41a6d6fcb4ee69954d20
Signed-off-by: Nikolai Vyssotski <nikolai.vyssotski@amd.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55237
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r-- | src/soc/amd/common/fsp/pci/pci_routing_info.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/soc/amd/common/fsp/pci/pci_routing_info.c b/src/soc/amd/common/fsp/pci/pci_routing_info.c index 21423da210..2ea8dfcdbf 100644 --- a/src/soc/amd/common/fsp/pci/pci_routing_info.c +++ b/src/soc/amd/common/fsp/pci/pci_routing_info.c @@ -11,23 +11,27 @@ const struct pci_routing_info *get_pci_routing_table(size_t *entries) { static const struct pci_routing_info *routing_table; static size_t routing_table_entries; - size_t hob_size = 0; + const struct { + uint32_t num_of_entries; + struct pci_routing_info routing_table[]; + } __packed *routing_hob; if (routing_table) { *entries = routing_table_entries; return routing_table; } - routing_table = fsp_find_extension_hob_by_guid(AMD_FSP_PCIE_DEVFUNC_REMAP_HOB_GUID.b, + routing_hob = fsp_find_extension_hob_by_guid(AMD_FSP_PCIE_DEVFUNC_REMAP_HOB_GUID.b, &hob_size); - if (routing_table == NULL || hob_size == 0) { - printk(BIOS_ERR, "Couldn't find PCIe routing HOB.\n"); + if (routing_hob == NULL || hob_size == 0 || routing_hob->num_of_entries == 0) { + printk(BIOS_ERR, "ERROR: Couldn't find valid PCIe interrupt routing HOB.\n"); return NULL; } - routing_table_entries = hob_size / sizeof(struct pci_routing_info); + routing_table = routing_hob->routing_table; + routing_table_entries = routing_hob->num_of_entries; for (size_t i = 0; i < routing_table_entries; ++i) { printk(BIOS_DEBUG, "%02x.%x: group: %u, swizzle: %u, irq: %u\n", |