UPSTREAM: soc/amd/stoneyridge/acpi: use available number of CPUs for CPU entries

It's sufficient to generate CPU devices for all available CPU cores/
threads instead of for the maximum number of possible CPU cores/threads.

TEST=google/careena with 2 cores still boots and Linux doesn't complain
about ACPI errors due to referenced but not present CPU objects.

(cherry picked from commit 15024e06e89dba6f7254bd16b3cd0d1f60a82ebf)

Original-Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Original-Change-Id: I6850edfa305304060092cb5480f4296f4f5ddacc
Original-Reviewed-on: https://review.coreboot.org/c/coreboot/+/73070
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
GitOrigin-RevId: 15024e06e89dba6f7254bd16b3cd0d1f60a82ebf
Change-Id: I4753200334cde8de08f05e82ad455866158d567b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/4297818
Tested-by: CopyBot Service Account <copybot.service@gmail.com>
Reviewed-by: Reka Norman <rekanorman@chromium.org>
Commit-Queue: Reka Norman <rekanorman@chromium.org>
diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c
index bc3e73a..34d1571 100644
--- a/src/soc/amd/stoneyridge/acpi.c
+++ b/src/soc/amd/stoneyridge/acpi.c
@@ -16,6 +16,7 @@
 #include <gpio.h>
 #include <amdblocks/acpimmio.h>
 #include <amdblocks/acpi.h>
+#include <amdblocks/cpu.h>
 #include <amdblocks/ioapic.h>
 #include <soc/acpi.h>
 #include <soc/pci_devs.h>
@@ -94,11 +95,8 @@
 
 void generate_cpu_entries(const struct device *device)
 {
-	int cores, cpu;
-
-	/* Stoney Ridge is single node, just report # of cores */
-	cores = pci_read_config32(SOC_NB_DEV, NB_CAPABILITIES2) & CMP_CAP_MASK;
-	cores++; /* number of cores is CmpCap+1 */
+	int cpu;
+	const int cores = get_cpu_count();
 
 	printk(BIOS_DEBUG, "ACPI \\_SB report %d core(s)\n", cores);