Marc Jones has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46970 )
Change subject: soc/intel/xeon_sp: Call common soc_get_num_cpus() ......................................................................
soc/intel/xeon_sp: Call common soc_get_num_cpus()
Use a common function to get the number of CPUs for each soc. This removes a #if for different function names in the common code.
Change-Id: I3348d37fcae72247731e465ec2a65d9583a2f180 Signed-off-by: Marc Jones marcjones@sysproconsulting.com --- M src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h M src/soc/intel/xeon_sp/cpx/soc_util.c M src/soc/intel/xeon_sp/nb_acpi.c M src/soc/intel/xeon_sp/skx/include/soc/cpu.h M src/soc/intel/xeon_sp/skx/include/soc/soc_util.h M src/soc/intel/xeon_sp/skx/soc_util.c 6 files changed, 10 insertions(+), 16 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/46970/1
diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h index 3e19bac..f0c2575 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h @@ -19,7 +19,7 @@ void get_cpu_info_from_apicid(uint32_t apicid, uint32_t core_bits, uint32_t thread_bits, uint8_t *package, uint8_t *core, uint8_t *thread); /* Return socket count, as obtained from FSP HOB */ -unsigned int xeon_sp_get_socket_count(void); +unsigned int soc_get_num_cpus(void);
int get_platform_thread_count(void); int get_threads_per_package(void); diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c index 8debc6a..bc4a1e1 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_util.c +++ b/src/soc/intel/xeon_sp/cpx/soc_util.c @@ -22,7 +22,7 @@
int get_platform_thread_count(void) { - return xeon_sp_get_socket_count() * get_threads_per_package(); + return soc_get_num_cpus() * get_threads_per_package(); }
const struct SystemMemoryMapHob *get_system_memory_map(void) @@ -86,7 +86,7 @@ return hob; }
-unsigned int xeon_sp_get_socket_count(void) +unsigned int soc_get_num_cpus(void) { /* The FSP IIO UDS HOB has field numCpus, it is actually socket count */ return get_iio_uds()->SystemStatus.numCpus; @@ -119,7 +119,7 @@ if (num_apics > 1) bubblesort(apic_ids, num_apics, NUM_ASCENDING);
- num_sockets = xeon_sp_get_socket_count(); + num_sockets = soc_get_num_cpus(); cpu_read_topology(&core_count, &thread_count); assert(num_apics == (num_sockets * thread_count));
@@ -310,7 +310,7 @@ * to receive the BIOS init completion message. So, we send it to all non-SBSP * sockets first. */ - for (uint32_t socket = 0; socket < xeon_sp_get_socket_count(); ++socket) { + for (uint32_t socket = 0; socket < soc_get_num_cpus(); ++socket) { if (socket == sbsp_socket_id) continue; set_bios_init_completion_for_package(socket); diff --git a/src/soc/intel/xeon_sp/nb_acpi.c b/src/soc/intel/xeon_sp/nb_acpi.c index 1329feb..5955fa0 100644 --- a/src/soc/intel/xeon_sp/nb_acpi.c +++ b/src/soc/intel/xeon_sp/nb_acpi.c @@ -121,13 +121,7 @@
static unsigned long acpi_fill_slit(unsigned long current) { -#if (CONFIG(SOC_INTEL_COOPERLAKE_SP)) - unsigned int nodes = xeon_sp_get_socket_count(); -#endif /* SOC_INTEL_COOPERLAKE_SP */ - -#if (CONFIG(SOC_INTEL_SKYLAKE_SP)) - int nodes = get_cpu_count(); -#endif /* SOC_INTEL_SKYLAKE_SP */ + unsigned int nodes = soc_get_num_cpus();
uint8_t *p = (uint8_t *)current; memset(p, 0, 8 + nodes * nodes); diff --git a/src/soc/intel/xeon_sp/skx/include/soc/cpu.h b/src/soc/intel/xeon_sp/skx/include/soc/cpu.h index 0e3028d..433598b 100644 --- a/src/soc/intel/xeon_sp/skx/include/soc/cpu.h +++ b/src/soc/intel/xeon_sp/skx/include/soc/cpu.h @@ -14,7 +14,6 @@ /* CPU bus clock is fixed at 100MHz */ #define CPU_BCLK 100
-int get_cpu_count(void); void xeon_sp_init_cpus(struct device *dev);
#endif diff --git a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h index 76f7c8b..2566830 100644 --- a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h @@ -26,5 +26,6 @@ const struct SystemMemoryMapHob *get_system_memory_map(void);
void set_bios_init_completion(void); +unsigned int soc_get_num_cpus(void);
#endif /* _SOC_UTIL_H_ */ diff --git a/src/soc/intel/xeon_sp/skx/soc_util.c b/src/soc/intel/xeon_sp/skx/soc_util.c index 3b37ca3..7dd954f 100644 --- a/src/soc/intel/xeon_sp/skx/soc_util.c +++ b/src/soc/intel/xeon_sp/skx/soc_util.c @@ -264,7 +264,7 @@ *thread = (uint32_t)(apicid & ~((~0) << thread_bits)); }
-int get_cpu_count(void) +unsigned int soc_get_num_cpus(void) { size_t hob_size; const uint8_t fsp_hob_iio_universal_data_guid[16] = FSP_HOB_IIO_UNIVERSAL_DATA_GUID; @@ -285,7 +285,7 @@
int get_platform_thread_count(void) { - return get_cpu_count() * get_threads_per_package(); + return soc_get_num_cpus() * get_threads_per_package(); }
uint8_t get_iiostack_info(struct iiostack_resource *info) @@ -353,7 +353,7 @@ if (num_apics > 1) bubblesort(apic_ids, num_apics, NUM_ASCENDING);
- num_cpus = get_cpu_count(); + num_cpus = soc_get_num_cpus(); cpu_read_topology(&core_count, &thread_count); assert(num_apics == (num_cpus * thread_count));
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46970 )
Change subject: soc/intel/xeon_sp: Call common soc_get_num_cpus() ......................................................................
Patch Set 1: Code-Review+2
Marc Jones has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46970 )
Change subject: soc/intel/xeon_sp: Call common soc_get_num_cpus() ......................................................................
soc/intel/xeon_sp: Call common soc_get_num_cpus()
Use a common function to get the number of CPUs for each soc. This removes a #if for different function names in the common code.
Change-Id: I3348d37fcae72247731e465ec2a65d9583a2f180 Signed-off-by: Marc Jones marcjones@sysproconsulting.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/46970 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Stefan Reinauer stefan.reinauer@coreboot.org --- M src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h M src/soc/intel/xeon_sp/cpx/soc_util.c M src/soc/intel/xeon_sp/nb_acpi.c M src/soc/intel/xeon_sp/skx/include/soc/cpu.h M src/soc/intel/xeon_sp/skx/include/soc/soc_util.h M src/soc/intel/xeon_sp/skx/soc_util.c 6 files changed, 10 insertions(+), 16 deletions(-)
Approvals: build bot (Jenkins): Verified Stefan Reinauer: Looks good to me, approved
diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h index 3e19bac..f0c2575 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h @@ -19,7 +19,7 @@ void get_cpu_info_from_apicid(uint32_t apicid, uint32_t core_bits, uint32_t thread_bits, uint8_t *package, uint8_t *core, uint8_t *thread); /* Return socket count, as obtained from FSP HOB */ -unsigned int xeon_sp_get_socket_count(void); +unsigned int soc_get_num_cpus(void);
int get_platform_thread_count(void); int get_threads_per_package(void); diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c index 8debc6a..bc4a1e1 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_util.c +++ b/src/soc/intel/xeon_sp/cpx/soc_util.c @@ -22,7 +22,7 @@
int get_platform_thread_count(void) { - return xeon_sp_get_socket_count() * get_threads_per_package(); + return soc_get_num_cpus() * get_threads_per_package(); }
const struct SystemMemoryMapHob *get_system_memory_map(void) @@ -86,7 +86,7 @@ return hob; }
-unsigned int xeon_sp_get_socket_count(void) +unsigned int soc_get_num_cpus(void) { /* The FSP IIO UDS HOB has field numCpus, it is actually socket count */ return get_iio_uds()->SystemStatus.numCpus; @@ -119,7 +119,7 @@ if (num_apics > 1) bubblesort(apic_ids, num_apics, NUM_ASCENDING);
- num_sockets = xeon_sp_get_socket_count(); + num_sockets = soc_get_num_cpus(); cpu_read_topology(&core_count, &thread_count); assert(num_apics == (num_sockets * thread_count));
@@ -310,7 +310,7 @@ * to receive the BIOS init completion message. So, we send it to all non-SBSP * sockets first. */ - for (uint32_t socket = 0; socket < xeon_sp_get_socket_count(); ++socket) { + for (uint32_t socket = 0; socket < soc_get_num_cpus(); ++socket) { if (socket == sbsp_socket_id) continue; set_bios_init_completion_for_package(socket); diff --git a/src/soc/intel/xeon_sp/nb_acpi.c b/src/soc/intel/xeon_sp/nb_acpi.c index 1329feb..5955fa0 100644 --- a/src/soc/intel/xeon_sp/nb_acpi.c +++ b/src/soc/intel/xeon_sp/nb_acpi.c @@ -121,13 +121,7 @@
static unsigned long acpi_fill_slit(unsigned long current) { -#if (CONFIG(SOC_INTEL_COOPERLAKE_SP)) - unsigned int nodes = xeon_sp_get_socket_count(); -#endif /* SOC_INTEL_COOPERLAKE_SP */ - -#if (CONFIG(SOC_INTEL_SKYLAKE_SP)) - int nodes = get_cpu_count(); -#endif /* SOC_INTEL_SKYLAKE_SP */ + unsigned int nodes = soc_get_num_cpus();
uint8_t *p = (uint8_t *)current; memset(p, 0, 8 + nodes * nodes); diff --git a/src/soc/intel/xeon_sp/skx/include/soc/cpu.h b/src/soc/intel/xeon_sp/skx/include/soc/cpu.h index 0e3028d..433598b 100644 --- a/src/soc/intel/xeon_sp/skx/include/soc/cpu.h +++ b/src/soc/intel/xeon_sp/skx/include/soc/cpu.h @@ -14,7 +14,6 @@ /* CPU bus clock is fixed at 100MHz */ #define CPU_BCLK 100
-int get_cpu_count(void); void xeon_sp_init_cpus(struct device *dev);
#endif diff --git a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h index 76f7c8b..2566830 100644 --- a/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/skx/include/soc/soc_util.h @@ -26,5 +26,6 @@ const struct SystemMemoryMapHob *get_system_memory_map(void);
void set_bios_init_completion(void); +unsigned int soc_get_num_cpus(void);
#endif /* _SOC_UTIL_H_ */ diff --git a/src/soc/intel/xeon_sp/skx/soc_util.c b/src/soc/intel/xeon_sp/skx/soc_util.c index 3b37ca3..7dd954f 100644 --- a/src/soc/intel/xeon_sp/skx/soc_util.c +++ b/src/soc/intel/xeon_sp/skx/soc_util.c @@ -264,7 +264,7 @@ *thread = (uint32_t)(apicid & ~((~0) << thread_bits)); }
-int get_cpu_count(void) +unsigned int soc_get_num_cpus(void) { size_t hob_size; const uint8_t fsp_hob_iio_universal_data_guid[16] = FSP_HOB_IIO_UNIVERSAL_DATA_GUID; @@ -285,7 +285,7 @@
int get_platform_thread_count(void) { - return get_cpu_count() * get_threads_per_package(); + return soc_get_num_cpus() * get_threads_per_package(); }
uint8_t get_iiostack_info(struct iiostack_resource *info) @@ -353,7 +353,7 @@ if (num_apics > 1) bubblesort(apic_ids, num_apics, NUM_ASCENDING);
- num_cpus = get_cpu_count(); + num_cpus = soc_get_num_cpus(); cpu_read_topology(&core_count, &thread_count); assert(num_apics == (num_cpus * thread_count));