From 13c8dc5d2364168c8ddd323e355f9a8d86f7ff2e Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 7 Apr 2022 22:08:23 +0200 Subject: arch/x86/smbios.c: Fix for CONFIG_MAX_CPUS > 255 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I079c99006fea95ba3dc2fb02c95a3747af55e218 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/63482 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki Reviewed-by: Angel Pons --- src/arch/x86/smbios.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index c48ce86c47..fd41ff23f1 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -516,6 +516,8 @@ static int smbios_write_type3(unsigned long *current, int handle) return len; } +#define MAX_CPUS_ENABLED (CONFIG_MAX_CPUS > 0xff ? 0xff : CONFIG_MAX_CPUS) + static int smbios_write_type4(unsigned long *current, int handle) { unsigned int cpu_voltage; @@ -570,7 +572,7 @@ static int smbios_write_type4(unsigned long *current, int handle) t->thread_count = t->thread_count2; } /* Assume we enable all the cores always, capped only by MAX_CPUS */ - t->core_enabled = MIN(t->core_count, CONFIG_MAX_CPUS); + t->core_enabled = MIN(t->core_count, MAX_CPUS_ENABLED); t->core_enabled2 = MIN(t->core_count2, CONFIG_MAX_CPUS); t->l1_cache_handle = 0xffff; t->l2_cache_handle = 0xffff; -- cgit v1.2.3