soc/amd/common/acpi: factor out common MADT code
The acpi_fill_madt implementation from the Genoa PoC also works for the other AMD SoCs that select SOC_AMD_COMMON_BLOCK_DATA_FABRIC_DOMAIN, so factor out this function to the common AMD ACPI code and change those other SoCs to use the new common functionality instead of having their own implementations. The old code on the single-domain SoCs used the GNB_IO_APIC_ADDR base address to create the MADT entry for the additional IOAPIC in the root complex. The new code iterates over all domains and looks for a resource with the IOMMU_IOAPIC_IDX index in each domain and if it finds it, it creates an MADT entry for that IOAPIC. This resource is created earlier in the boot process when the non-PCI resources are read from the IOHC registers and reported to the allocator. TEST=The resulting MADT doesn't change on Mandolin Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I4cc0d3f30b4e6ba29542dcfde84ccac90820d258 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79861 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
		| @@ -6,29 +6,12 @@ | ||||
| #include <amdblocks/acpi.h> | ||||
| #include <amdblocks/acpimmio.h> | ||||
| #include <amdblocks/cpu.h> | ||||
| #include <amdblocks/data_fabric.h> | ||||
| #include <arch/ioapic.h> | ||||
| #include <console/console.h> | ||||
| #include <device/device.h> | ||||
| #include <soc/acpi.h> | ||||
| #include <vendorcode/amd/opensil/genoa_poc/opensil.h> | ||||
|  | ||||
| /* TODO: this can go in a common place */ | ||||
| unsigned long acpi_fill_madt(unsigned long current) | ||||
| { | ||||
| 	struct device *dev = NULL; | ||||
| 	while ((dev = dev_find_path(dev, DEVICE_PATH_DOMAIN)) != NULL) { | ||||
| 		struct resource *res = probe_resource(dev, IOMMU_IOAPIC_IDX); | ||||
| 		if (!res) | ||||
| 			continue; | ||||
|  | ||||
| 		current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, | ||||
| 						   res->base); | ||||
| 	} | ||||
|  | ||||
| 	return current; | ||||
| } | ||||
|  | ||||
| void acpi_fill_fadt(acpi_fadt_t *fadt) | ||||
| { | ||||
| 	/* Fill in pm1_evt, pm1_cnt, pm_tmr, gpe0_blk from openSIL input structure */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user