summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-02-12 22:28:17 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-02-29 15:39:06 +0000
commite549ee093b84d40da8b128595419165ac7966444 (patch)
treeea5840f08f08f22d6221e2a5d65321f5b9bed610 /src/soc/amd/common/block
parentd361163f6b1a2d040117e10daea197ab27dd00e7 (diff)
soc/amd: move common pci_domain_fill_ssdt implementation to acpi/
Even though it has an 'amd_' prefix, the amd_pci_domain_fill_ssdt implementation doesn't contain any AMD-specific code and can also be used by other SoCs. So factor it out, move the implementation to src/acpi/acpigen_pci_root_resource_producer.c, and rename it to pci_domain_fill_ssdt. When a SoC now assigns pci_domain_fill_ssdt to its domain operation's acpi_fill_ssdt function pointer, the PCI domain resource producer information will be added to the SSDT. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I7bd8568cf0b7051c74adbedfe0e416a0938ccb99 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80464 Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/amd/common/block')
-rw-r--r--src/soc/amd/common/block/data_fabric/domain.c99
-rw-r--r--src/soc/amd/common/block/include/amdblocks/data_fabric.h2
2 files changed, 0 insertions, 101 deletions
diff --git a/src/soc/amd/common/block/data_fabric/domain.c b/src/soc/amd/common/block/data_fabric/domain.c
index ab85e2b592..b056d607c7 100644
--- a/src/soc/amd/common/block/data_fabric/domain.c
+++ b/src/soc/amd/common/block/data_fabric/domain.c
@@ -1,10 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <acpi/acpigen.h>
#include <amdblocks/data_fabric.h>
#include <amdblocks/root_complex.h>
#include <arch/ioapic.h>
-#include <arch/vga.h>
#include <console/console.h>
#include <cpu/amd/mtrr.h>
#include <cpu/cpu.h>
@@ -214,100 +212,3 @@ void amd_pci_domain_read_resources(struct device *domain)
read_soc_memmap_resources(domain, &idx);
}
}
-
-static void write_ssdt_domain_io_producer_range_helper(const char *domain_name,
- resource_t base, resource_t limit)
-{
- printk(BIOS_DEBUG, "%s _CRS: adding IO range [%llx-%llx]\n", domain_name, base, limit);
- acpigen_resource_producer_io(base, limit);
-}
-
-static void write_ssdt_domain_io_producer_range(const char *domain_name,
- resource_t base, resource_t limit)
-{
- /*
- * Split the IO region at the PCI config IO ports so that the IO resource producer
- * won't cover the same IO ports that the IO resource consumer for the PCI config IO
- * ports in the same ACPI device already covers.
- */
- if (base < PCI_IO_CONFIG_INDEX) {
- write_ssdt_domain_io_producer_range_helper(domain_name,
- base,
- MIN(limit, PCI_IO_CONFIG_INDEX - 1));
- }
- if (limit > PCI_IO_CONFIG_LAST_PORT) {
- write_ssdt_domain_io_producer_range_helper(domain_name,
- MAX(base, PCI_IO_CONFIG_LAST_PORT + 1),
- limit);
- }
-}
-
-static void write_ssdt_domain_mmio_producer_range(const char *domain_name,
- resource_t base, resource_t limit)
-{
- printk(BIOS_DEBUG, "%s _CRS: adding MMIO range [%llx-%llx]\n",
- domain_name, base, limit);
- acpigen_resource_producer_mmio(base, limit,
- MEM_RSRC_FLAG_MEM_READ_WRITE | MEM_RSRC_FLAG_MEM_ATTR_NON_CACHE);
-}
-
-void amd_pci_domain_fill_ssdt(const struct device *domain)
-{
- const char *acpi_scope = acpi_device_path(domain);
- printk(BIOS_DEBUG, "%s ACPI scope: '%s'\n", __func__, acpi_scope);
- acpigen_write_scope(acpi_device_path(domain));
-
- acpigen_write_name("_CRS");
- acpigen_write_resourcetemplate_header();
-
- /* PCI bus number range in domain */
- printk(BIOS_DEBUG, "%s _CRS: adding busses [%x-%x] in segment group %x\n",
- acpi_device_name(domain), domain->downstream->secondary,
- domain->downstream->max_subordinate, domain->downstream->segment_group);
- acpigen_resource_producer_bus_number(domain->downstream->secondary,
- domain->downstream->max_subordinate);
-
- if (domain->path.domain.domain == 0) {
- /* ACPI 6.4.2.5 I/O Port Descriptor */
- acpigen_write_io16(PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_LAST_PORT, 1,
- PCI_IO_CONFIG_PORT_COUNT, 1);
- }
-
- struct resource *res;
- for (res = domain->resource_list; res != NULL; res = res->next) {
- if (!(res->flags & IORESOURCE_ASSIGNED))
- continue;
- /* Don't add MMIO producer ranges for reserved MMIO regions from non-PCI
- devices */
- if (res->flags & IORESOURCE_RESERVE)
- continue;
- /* Don't add MMIO producer ranges for DRAM regions */
- if (res->flags & IORESOURCE_STORED)
- continue;
- switch (res->flags & IORESOURCE_TYPE_MASK) {
- case IORESOURCE_IO:
- write_ssdt_domain_io_producer_range(acpi_device_name(domain),
- res->base, res->limit);
- break;
- case IORESOURCE_MEM:
- write_ssdt_domain_mmio_producer_range(acpi_device_name(domain),
- res->base, res->limit);
- break;
- default:
- break;
- }
- }
-
- if (domain->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA) {
- printk(BIOS_DEBUG, "%s _CRS: adding VGA resource\n", acpi_device_name(domain));
- acpigen_resource_producer_mmio(VGA_MMIO_BASE, VGA_MMIO_LIMIT,
- MEM_RSRC_FLAG_MEM_READ_WRITE | MEM_RSRC_FLAG_MEM_ATTR_CACHE);
- }
-
- acpigen_write_resourcetemplate_footer();
-
- acpigen_write_SEG(domain->downstream->segment_group);
- acpigen_write_BBN(domain->downstream->secondary);
- /* Scope */
- acpigen_pop_len();
-}
diff --git a/src/soc/amd/common/block/include/amdblocks/data_fabric.h b/src/soc/amd/common/block/include/amdblocks/data_fabric.h
index f0073dfb4e..fbed0b22a0 100644
--- a/src/soc/amd/common/block/include/amdblocks/data_fabric.h
+++ b/src/soc/amd/common/block/include/amdblocks/data_fabric.h
@@ -55,6 +55,4 @@ void data_fabric_get_mmio_base_size(unsigned int reg, resource_t *mmio_base,
void amd_pci_domain_read_resources(struct device *domain);
void amd_pci_domain_scan_bus(struct device *domain);
-void amd_pci_domain_fill_ssdt(const struct device *domain);
-
#endif /* AMD_BLOCK_DATA_FABRIC_H */