soc/amd/common/data_fabric/domain: factor out report_data_fabric_io
As a preparation to read the IO decode ranges from the data fabric
registers instead of having it hard-coded, factor out the
report_data_fabric_io function to report one IO producer region from
add_io_regions.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I51c3f8cd6749623f1a4bad14873d53b8a52be737
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76933
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/amd/common/block/data_fabric/domain.c b/src/soc/amd/common/block/data_fabric/domain.c
index 9f0f48c..66ad8b3 100644
--- a/src/soc/amd/common/block/data_fabric/domain.c
+++ b/src/soc/amd/common/block/data_fabric/domain.c
@@ -139,18 +139,23 @@
}
}
+static void report_data_fabric_io(struct device *domain, unsigned int idx,
+ resource_t io_base, resource_t io_limit)
+{
+ struct resource *res;
+ res = new_resource(domain, idx);
+ res->base = io_base;
+ res->limit = io_limit;
+ res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED;
+}
+
/* Tell the resource allocator about the usable I/O space */
static void add_io_regions(struct device *domain, unsigned int *idx)
{
- struct resource *res;
-
/* TODO: Systems with more than one PCI root need to read the data fabric registers to
see which IO ranges get decoded to which PCI root. */
- res = new_resource(domain, (*idx)++);
- res->base = 0;
- res->limit = 0xffff;
- res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED;
+ report_data_fabric_io(domain, (*idx)++, 0, 0xffff);
}
void amd_pci_domain_read_resources(struct device *domain)