Attention is currently required from: Jason Glenesk, Marshall Dawson, Felix Held. Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52913 )
Change subject: soc/amd/common/fsp/pci: Implement populate_pirq_data ......................................................................
soc/amd/common/fsp/pci: Implement populate_pirq_data
This method will use the PCI routing table provided by FSP and populate the pirq data. This data is used to set the PCI_INTR registers on the PCI devices.
BUG=b:184766519 TEST=Build guybrush
Signed-off-by: Raul E Rangel rrangel@chromium.org Change-Id: I297fc3ca7227fb4794ac70bd046ce2f93da8b869 --- M src/soc/amd/common/fsp/pci/Makefile.inc A src/soc/amd/common/fsp/pci/pirq.c 2 files changed, 39 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/52913/1
diff --git a/src/soc/amd/common/fsp/pci/Makefile.inc b/src/soc/amd/common/fsp/pci/Makefile.inc index cc1377a..9cfc9ff 100644 --- a/src/soc/amd/common/fsp/pci/Makefile.inc +++ b/src/soc/amd/common/fsp/pci/Makefile.inc @@ -1,5 +1,6 @@ ifeq ($(CONFIG_SOC_AMD_COMMON_FSP_PCI),y)
ramstage-y += pci_routing_info.c +ramstage-y += pirq.c
endif # CONFIG_SOC_AMD_COMMON_FSP_PCI diff --git a/src/soc/amd/common/fsp/pci/pirq.c b/src/soc/amd/common/fsp/pci/pirq.c new file mode 100644 index 0000000..93fd280 --- /dev/null +++ b/src/soc/amd/common/fsp/pci/pirq.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "pci_routing_info.h" +#include <amdblocks/amd_pci_util.h> +#include <stdlib.h> +#include <types.h> + +void populate_pirq_data(void) +{ + const struct pci_routing_info *routing_table, *routing_entry; + size_t entries = 0; + struct pirq_struct *pirq; + unsigned int irq; + + routing_table = get_pci_routing_table(&entries); + + if (!routing_table) + return; + + pirq = calloc(entries, sizeof(*pirq)); + + if (!pirq) + return; + + for (size_t i = 0; i < entries; ++i) { + routing_entry = &routing_table[i]; + + pirq[i].devfn = routing_entry->devfn; + for (size_t j = 0; j < 4; ++j) { + irq = pci_calculate_irq(routing_entry, j); + + pirq[i].PIN[j] = irq % 8; + } + } + + pirq_data_ptr = pirq; + pirq_data_size = entries; +}