arch/x86/smbios.c: Fix for CONFIG_MAX_CPUS > 255

Change-Id: I079c99006fea95ba3dc2fb02c95a3747af55e218
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63482
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Arthur Heymans 2022-04-07 22:08:23 +02:00 committed by Martin L Roth
parent 1684b0aa67
commit 13c8dc5d23
1 changed files with 3 additions and 1 deletions

View File

@ -516,6 +516,8 @@ static int smbios_write_type3(unsigned long *current, int handle)
return len; return len;
} }
#define MAX_CPUS_ENABLED (CONFIG_MAX_CPUS > 0xff ? 0xff : CONFIG_MAX_CPUS)
static int smbios_write_type4(unsigned long *current, int handle) static int smbios_write_type4(unsigned long *current, int handle)
{ {
unsigned int cpu_voltage; unsigned int cpu_voltage;
@ -570,7 +572,7 @@ static int smbios_write_type4(unsigned long *current, int handle)
t->thread_count = t->thread_count2; t->thread_count = t->thread_count2;
} }
/* Assume we enable all the cores always, capped only by MAX_CPUS */ /* 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->core_enabled2 = MIN(t->core_count2, CONFIG_MAX_CPUS);
t->l1_cache_handle = 0xffff; t->l1_cache_handle = 0xffff;
t->l2_cache_handle = 0xffff; t->l2_cache_handle = 0xffff;