From c391bff443c7fc5db0fc8c470952d5a3387b1166 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Thu, 16 Feb 2023 19:38:49 +0100 Subject: cpu,nb/amd/pi/00730F01: dynamically generate CPU devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of having the maximum number of possible CPU objects defined in the DSDT, dynamically generate the number of needed CPU devices in the SSDT like it's done on all other x86 platforms in coreboot. TEST=APU2 still boots and Linux doesn't show any ACPI errors with this patch applied and it prints "ACPI: \_SB_.P000: Found 2 idle states". Signed-off-by: Felix Held Change-Id: Id6f057ad130a27b371722fa66ce0a982afc43c6c Reviewed-on: https://review.coreboot.org/c/coreboot/+/73073 Reviewed-by: Martin Roth Tested-by: build bot (Jenkins) Reviewed-by: Michał Żygowski Reviewed-by: Kyösti Mälkki --- src/northbridge/amd/pi/00730F01/northbridge.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/northbridge/amd') diff --git a/src/northbridge/amd/pi/00730F01/northbridge.c b/src/northbridge/amd/pi/00730F01/northbridge.c index 46610c51e2..355820a815 100644 --- a/src/northbridge/amd/pi/00730F01/northbridge.c +++ b/src/northbridge/amd/pi/00730F01/northbridge.c @@ -869,10 +869,25 @@ void mp_init_cpus(struct bus *cpu_bus) MTRR_TYPE_WRPROT); } +void generate_cpu_entries(const struct device *device) +{ + int cpu; + const int cores = get_cpu_count(); + + printk(BIOS_DEBUG, "ACPI \\_SB report %d core(s)\n", cores); + + /* Generate \_SB.Pxxx */ + for (cpu = 0; cpu < cores; cpu++) { + acpigen_write_processor_device(cpu); + acpigen_write_processor_device_end(); + } +} + static struct device_operations cpu_bus_ops = { - .read_resources = noop_read_resources, - .set_resources = noop_set_resources, - .init = mp_cpu_bus_init, + .read_resources = noop_read_resources, + .set_resources = noop_set_resources, + .init = mp_cpu_bus_init, + .acpi_fill_ssdt = generate_cpu_entries, }; static void root_complex_enable_dev(struct device *dev) -- cgit v1.2.3