summaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-07-26 16:42:46 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-07-27 16:00:53 +0000
commit6b248a2da381928a5670aa1e50e7c9e790749c51 (patch)
tree65d2e74552fcc87de99367ab94e3a3962c7dc17e /src/soc/amd/picasso
parentaebf534364de1e7dc449920bc25fe2123cf4dd75 (diff)
soc/amd/common/fsp: factor out read_fsp_resources from root_complex.c
Factor out the common FSP-specific code to report the usable and reserved memory resources read from the HOBs that FSP has put into memory. This both reduces code duplication and also moves FSP-specific code out of the SoC code into the FSP-specific common AMD SoC code folder. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ib373c52030209235559c9cd383f48ee1b3f8f79b Reviewed-on: https://review.coreboot.org/c/coreboot/+/76759 Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin L Roth <gaumless@gmail.com>
Diffstat (limited to 'src/soc/amd/picasso')
-rw-r--r--src/soc/amd/picasso/root_complex.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c
index 7ae1df0481..b74a132c8b 100644
--- a/src/soc/amd/picasso/root_complex.c
+++ b/src/soc/amd/picasso/root_complex.c
@@ -15,7 +15,6 @@
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
-#include <fsp/util.h>
#include <stdint.h>
#include <soc/iomap.h>
#include "chip.h"
@@ -106,8 +105,6 @@ static void read_resources(struct device *dev)
{
uint32_t mem_usable = (uintptr_t)cbmem_top();
unsigned int idx = 0;
- const struct hob_header *hob_iterator;
- const struct hob_resource *res;
uintptr_t early_reserved_dram_start, early_reserved_dram_end;
const struct memmap_early_dram *e = memmap_get_early_dram_usage();
@@ -144,25 +141,7 @@ static void read_resources(struct device *dev)
/* Reserve fixed IOMMU MMIO region */
mmio_range(dev, idx++, IOMMU_RESERVED_MMIO_BASE, IOMMU_RESERVED_MMIO_SIZE);
- if (fsp_hob_iterator_init(&hob_iterator) != CB_SUCCESS) {
- printk(BIOS_ERR, "%s incomplete because no HOB list was found\n", __func__);
- return;
- }
-
- while (fsp_hob_iterator_get_next_resource(&hob_iterator, &res) == CB_SUCCESS) {
- if (res->type == EFI_RESOURCE_SYSTEM_MEMORY && res->addr < mem_usable)
- continue; /* 0 through low usable was set above */
- if (res->type == EFI_RESOURCE_MEMORY_MAPPED_IO)
- continue; /* Done separately */
-
- if (res->type == EFI_RESOURCE_SYSTEM_MEMORY)
- ram_range(dev, idx++, res->addr, res->length);
- else if (res->type == EFI_RESOURCE_MEMORY_RESERVED)
- reserved_ram_range(dev, idx++, res->addr, res->length);
- else
- printk(BIOS_ERR, "failed to set resources for type %d\n",
- res->type);
- }
+ read_fsp_resources(dev, &idx);
}
static void root_complex_init(struct device *dev)