Attention is currently required from: Raul Rangel, Mariusz Szafrański, Jonathan Zhang, Arthur Heymans, Andrey Petrov, Patrick Rudolph, Jason Glenesk, Anjaneya "Reddy" Chagam, Marshall Dawson, Johnny Lin, Christian Walter, Suresh Bellampalli, Vanessa Eusebio, Michal Motyl, Felix Held, Tim Chu. Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58919 )
Change subject: cpu/x86/mp: Use unsigned type for CPU count ......................................................................
cpu/x86/mp: Use unsigned type for CPU count
Retype the return value of the `get_cpu_count` function pointer and all related functions to `unsigned int`. Also retype the `cpu_count` member in `struct mp_state`.
Change-Id: Ifb1e89a7e63952736503b0906dd11a6d38e9cc1c Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/cpu/intel/haswell/haswell_init.c M src/cpu/intel/model_1067x/mp_init.c M src/cpu/intel/model_2065x/model_2065x_init.c M src/cpu/intel/model_206ax/model_206ax_init.c M src/cpu/x86/mp_init.c M src/include/cpu/x86/mp.h M src/mainboard/emulation/qemu-i440fx/fw_cfg.c M src/mainboard/emulation/qemu-i440fx/fw_cfg.h M src/soc/amd/common/block/cpu/noncar/cpu.c M src/soc/amd/common/block/include/amdblocks/cpu.h M src/soc/amd/stoneyridge/cpu.c M src/soc/intel/apollolake/cpu.c M src/soc/intel/baytrail/cpu.c M src/soc/intel/braswell/cpu.c M src/soc/intel/common/block/cpu/mp_init.c M src/soc/intel/common/block/include/intelblocks/mp_init.h M src/soc/intel/denverton_ns/cpu.c M src/soc/intel/denverton_ns/include/soc/cpu.h M src/soc/intel/xeon_sp/cpx/cpu.c M src/soc/intel/xeon_sp/include/soc/util.h M src/soc/intel/xeon_sp/util.c 21 files changed, 21 insertions(+), 21 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/58919/1
diff --git a/src/cpu/intel/haswell/haswell_init.c b/src/cpu/intel/haswell/haswell_init.c index d4f3587..41a539f 100644 --- a/src/cpu/intel/haswell/haswell_init.c +++ b/src/cpu/intel/haswell/haswell_init.c @@ -585,7 +585,7 @@ configure_pch_power_sharing(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { msr_t msr; unsigned int num_threads; diff --git a/src/cpu/intel/model_1067x/mp_init.c b/src/cpu/intel/model_1067x/mp_init.c index bc53214..95536ff 100644 --- a/src/cpu/intel/model_1067x/mp_init.c +++ b/src/cpu/intel/model_1067x/mp_init.c @@ -20,7 +20,7 @@ x86_mtrr_check(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { const struct cpuid_result cpuid1 = cpuid(1); const unsigned int cores = (cpuid1.ebx >> 16) & 0xf; diff --git a/src/cpu/intel/model_2065x/model_2065x_init.c b/src/cpu/intel/model_2065x/model_2065x_init.c index e77f9aa..2dab60b 100644 --- a/src/cpu/intel/model_2065x/model_2065x_init.c +++ b/src/cpu/intel/model_2065x/model_2065x_init.c @@ -121,7 +121,7 @@ x86_mtrr_check(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { msr_t msr; unsigned int num_threads; diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c index 9de6b38..d28a690 100644 --- a/src/cpu/intel/model_206ax/model_206ax_init.c +++ b/src/cpu/intel/model_206ax/model_206ax_init.c @@ -377,7 +377,7 @@ x86_mtrr_check(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { msr_t msr; unsigned int num_threads; diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index c99732f..e4f3f08 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -671,7 +671,7 @@
struct mp_state { struct mp_ops ops; - int cpu_count; + unsigned int cpu_count; uintptr_t perm_smbase; size_t perm_smsize; /* Size of the real CPU save state */ diff --git a/src/include/cpu/x86/mp.h b/src/include/cpu/x86/mp.h index 7ed82dd..85697d5 100644 --- a/src/include/cpu/x86/mp.h +++ b/src/include/cpu/x86/mp.h @@ -31,7 +31,7 @@ * need to be brought out of SIPI state as well as have SMM * handlers installed. */ - int (*get_cpu_count)(void); + unsigned int (*get_cpu_count)(void); /* * Optionally fill in permanent SMM region and save state size. If * this callback is not present no SMM handlers will be installed. diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c index 3206e4c..6ef30ab 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c @@ -128,7 +128,7 @@ return (uintptr_t)top; }
-int fw_cfg_max_cpus(void) +unsigned int fw_cfg_max_cpus(void) { unsigned short max_cpus;
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.h b/src/mainboard/emulation/qemu-i440fx/fw_cfg.h index e68ad97..f24d276 100644 --- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.h +++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.h @@ -5,7 +5,7 @@
void fw_cfg_get(uint16_t entry, void *dst, int dstlen); int fw_cfg_check_file(FWCfgFile *file, const char *name); -int fw_cfg_max_cpus(void); +unsigned int fw_cfg_max_cpus(void); unsigned long fw_cfg_smbios_tables(int *handle, unsigned long *current); uintptr_t fw_cfg_tolud(void);
diff --git a/src/soc/amd/common/block/cpu/noncar/cpu.c b/src/soc/amd/common/block/cpu/noncar/cpu.c index 98926bf..9550bb0 100644 --- a/src/soc/amd/common/block/cpu/noncar/cpu.c +++ b/src/soc/amd/common/block/cpu/noncar/cpu.c @@ -6,7 +6,7 @@ #include <cpu/amd/msr.h> #include <soc/iomap.h>
-int get_cpu_count(void) +unsigned int get_cpu_count(void) { return 1 + (cpuid_ecx(0x80000008) & 0xff); } diff --git a/src/soc/amd/common/block/include/amdblocks/cpu.h b/src/soc/amd/common/block/include/amdblocks/cpu.h index 0627bc1..34ab0d3 100644 --- a/src/soc/amd/common/block/include/amdblocks/cpu.h +++ b/src/soc/amd/common/block/include/amdblocks/cpu.h @@ -3,7 +3,7 @@ #ifndef AMD_BLOCK_CPU_H #define AMD_BLOCK_CPU_H
-int get_cpu_count(void); +unsigned int get_cpu_count(void); void set_cstate_io_addr(void); void write_resume_eip(void);
diff --git a/src/soc/amd/stoneyridge/cpu.c b/src/soc/amd/stoneyridge/cpu.c index 99b40a6..805a0de 100644 --- a/src/soc/amd/stoneyridge/cpu.c +++ b/src/soc/amd/stoneyridge/cpu.c @@ -37,7 +37,7 @@ x86_mtrr_check(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { return (pci_read_config16(SOC_HT_DEV, D18F0_CPU_CNT) & CPU_CNT_MASK) + 1; diff --git a/src/soc/intel/apollolake/cpu.c b/src/soc/intel/apollolake/cpu.c index af0a6dc..b8ab51b 100644 --- a/src/soc/intel/apollolake/cpu.c +++ b/src/soc/intel/apollolake/cpu.c @@ -160,7 +160,7 @@ }
/* Find CPU topology */ -int get_cpu_count(void) +unsigned int get_cpu_count(void) { unsigned int num_virt_cores, num_phys_cores;
diff --git a/src/soc/intel/baytrail/cpu.c b/src/soc/intel/baytrail/cpu.c index 1dbc3d7..dc2e766 100644 --- a/src/soc/intel/baytrail/cpu.c +++ b/src/soc/intel/baytrail/cpu.c @@ -110,7 +110,7 @@ enable_turbo(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { const struct pattrs *pattrs = pattrs_get();
diff --git a/src/soc/intel/braswell/cpu.c b/src/soc/intel/braswell/cpu.c index 7c7a15d..403e10d 100644 --- a/src/soc/intel/braswell/cpu.c +++ b/src/soc/intel/braswell/cpu.c @@ -113,7 +113,7 @@ enable_turbo(); }
-static int get_cpu_count(void) +static unsigned int get_cpu_count(void) { const struct pattrs *pattrs = pattrs_get();
diff --git a/src/soc/intel/common/block/cpu/mp_init.c b/src/soc/intel/common/block/cpu/mp_init.c index acd15a8..3b0dc8b 100644 --- a/src/soc/intel/common/block/cpu/mp_init.c +++ b/src/soc/intel/common/block/cpu/mp_init.c @@ -84,7 +84,7 @@ * MP Init callback function to Find CPU Topology. This function is common * among all SOCs and thus its in Common CPU block. */ -int get_cpu_count(void) +unsigned int get_cpu_count(void) { unsigned int num_virt_cores, num_phys_cores;
diff --git a/src/soc/intel/common/block/include/intelblocks/mp_init.h b/src/soc/intel/common/block/include/intelblocks/mp_init.h index 8a413ea..d98cbca 100644 --- a/src/soc/intel/common/block/include/intelblocks/mp_init.h +++ b/src/soc/intel/common/block/include/intelblocks/mp_init.h @@ -11,7 +11,7 @@ * MP Init callback function to Find CPU Topology. This function is common * among all SOCs and thus its in Common CPU block. */ -int get_cpu_count(void); +unsigned int get_cpu_count(void);
/* * MP Init callback function(get_microcode_info) to find the Microcode at diff --git a/src/soc/intel/denverton_ns/cpu.c b/src/soc/intel/denverton_ns/cpu.c index 96eb79a..66a88de 100644 --- a/src/soc/intel/denverton_ns/cpu.c +++ b/src/soc/intel/denverton_ns/cpu.c @@ -197,7 +197,7 @@ }
/* Find CPU topology */ -int get_cpu_count(void) +unsigned int get_cpu_count(void) { unsigned int num_cpus = detect_num_cpus_via_mch();
diff --git a/src/soc/intel/denverton_ns/include/soc/cpu.h b/src/soc/intel/denverton_ns/include/soc/cpu.h index a8af626..f97b151 100644 --- a/src/soc/intel/denverton_ns/include/soc/cpu.h +++ b/src/soc/intel/denverton_ns/include/soc/cpu.h @@ -5,7 +5,7 @@
#include <cpu/intel/cpu_ids.h>
-int get_cpu_count(void); +unsigned int get_cpu_count(void);
/* Everything below this line is ignored in the DSDT */ #ifndef __ACPI__ diff --git a/src/soc/intel/xeon_sp/cpx/cpu.c b/src/soc/intel/xeon_sp/cpx/cpu.c index ba417a7..d0968a8 100644 --- a/src/soc/intel/xeon_sp/cpx/cpu.c +++ b/src/soc/intel/xeon_sp/cpx/cpu.c @@ -165,7 +165,7 @@ x86_mtrr_check(); }
-static int get_thread_count(void) +static unsigned int get_thread_count(void) { unsigned int num_phys = 0, num_virts = 0;
diff --git a/src/soc/intel/xeon_sp/include/soc/util.h b/src/soc/intel/xeon_sp/include/soc/util.h index 213735a..3027335 100644 --- a/src/soc/intel/xeon_sp/include/soc/util.h +++ b/src/soc/intel/xeon_sp/include/soc/util.h @@ -9,7 +9,7 @@ void unlock_pam_regions(void); uint8_t get_stack_busno(const uint8_t stack); msr_t read_msr_ppin(void); -int get_platform_thread_count(void); +unsigned int get_platform_thread_count(void); const IIO_UDS *get_iio_uds(void); unsigned int soc_get_num_cpus(void); void xeonsp_init_cpu_config(void); diff --git a/src/soc/intel/xeon_sp/util.c b/src/soc/intel/xeon_sp/util.c index 4295704..9716ae4 100644 --- a/src/soc/intel/xeon_sp/util.c +++ b/src/soc/intel/xeon_sp/util.c @@ -81,7 +81,7 @@ return thread_count; }
-int get_platform_thread_count(void) +unsigned int get_platform_thread_count(void) { return soc_get_num_cpus() * get_threads_per_package(); }