From: Simon Glass Date: Thu, 14 Nov 2019 19:57:34 +0000 (-0700) Subject: common: Move checkcpu() out of common.h X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=30c7c4347307c807b0f9f9045053339507fd699e;p=u-boot.git common: Move checkcpu() out of common.h This function belongs in cpu_func.h so move it over. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c index 363c0ffd28..0710f5ab36 100644 --- a/arch/powerpc/cpu/mpc83xx/cpu.c +++ b/arch/powerpc/cpu/mpc83xx/cpu.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c index 6ad86e9a1d..2b7c5d4301 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu.c +++ b/arch/powerpc/cpu/mpc8xx/cpu.c @@ -17,6 +17,7 @@ */ #include +#include #include #include #include diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c index a8b50a9ff5..ee36aca407 100644 --- a/arch/sh/cpu/sh4/cpu.c +++ b/arch/sh/cpu/sh4/cpu.c @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/arch/x86/cpu/broadwell/cpu_from_spl.c b/arch/x86/cpu/broadwell/cpu_from_spl.c index c3d4a8d547..2aa6f245e7 100644 --- a/arch/x86/cpu/broadwell/cpu_from_spl.c +++ b/arch/x86/cpu/broadwell/cpu_from_spl.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c index 9686f8ed5b..0c4c6348d1 100644 --- a/arch/x86/cpu/coreboot/coreboot.c +++ b/arch/x86/cpu/coreboot/coreboot.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include diff --git a/arch/x86/cpu/efi/app.c b/arch/x86/cpu/efi/app.c index ba7c02bd7e..13077411dc 100644 --- a/arch/x86/cpu/efi/app.c +++ b/arch/x86/cpu/efi/app.c @@ -4,6 +4,7 @@ */ #include +#include #include #include diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c index 225aef7bf6..af6dd2f743 100644 --- a/arch/x86/cpu/efi/payload.c +++ b/arch/x86/cpu/efi/payload.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index 6db9da81b7..8f30cdbe24 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -11,6 +11,7 @@ */ #include +#include #include #include #include diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c index 5e8b4f068e..716351ad7f 100644 --- a/arch/x86/cpu/qemu/qemu.c +++ b/arch/x86/cpu/qemu/qemu.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c index d39edb2271..d6611eea5d 100644 --- a/arch/x86/cpu/quark/quark.c +++ b/arch/x86/cpu/quark/quark.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include diff --git a/arch/x86/cpu/slimbootloader/slimbootloader.c b/arch/x86/cpu/slimbootloader/slimbootloader.c index e6b174ca88..21dcfb2142 100644 --- a/arch/x86/cpu/slimbootloader/slimbootloader.c +++ b/arch/x86/cpu/slimbootloader/slimbootloader.c @@ -4,6 +4,7 @@ */ #include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/x86/cpu/tangier/tangier.c b/arch/x86/cpu/tangier/tangier.c index df2c600be3..43bee1fb70 100644 --- a/arch/x86/cpu/tangier/tangier.c +++ b/arch/x86/cpu/tangier/tangier.c @@ -4,6 +4,7 @@ */ #include +#include #include /* diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c index 42abb23a9e..90925e46ea 100644 --- a/arch/x86/cpu/x86_64/cpu.c +++ b/arch/x86/cpu/x86_64/cpu.c @@ -5,6 +5,7 @@ */ #include +#include #include /* diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c index 40ba866d77..a5efe35f59 100644 --- a/arch/x86/lib/fsp/fsp_common.c +++ b/arch/x86/lib/fsp/fsp_common.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include diff --git a/common/board_f.c b/common/board_f.c index 01044452bf..05f4b73c6e 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/include/common.h b/include/common.h index ce08bfe11f..96bb42ce71 100644 --- a/include/common.h +++ b/include/common.h @@ -203,7 +203,6 @@ void trap_init (ulong); void s_init(void); -int checkcpu (void); int checkicache (void); int checkdcache (void); void upmconfig (unsigned int, unsigned int *, unsigned int); diff --git a/include/cpu_func.h b/include/cpu_func.h index a99b69b976..03feaa63e9 100644 --- a/include/cpu_func.h +++ b/include/cpu_func.h @@ -20,4 +20,33 @@ int cpu_reset(u32 nr); int cpu_disable(u32 nr); int cpu_release(u32 nr, int argc, char * const argv[]); +static inline int cpumask_next(int cpu, unsigned int mask) +{ + for (cpu++; !((1 << cpu) & mask); cpu++) + ; + + return cpu; +} + +#define for_each_cpu(iter, cpu, num_cpus, mask) \ + for (iter = 0, cpu = cpumask_next(-1, mask); \ + iter < num_cpus; \ + iter++, cpu = cpumask_next(cpu, mask)) \ + +int cpu_numcores(void); +int cpu_num_dspcores(void); +u32 cpu_mask(void); +u32 cpu_dsp_mask(void); +int is_core_valid(unsigned int core); + +/** + * checkcpu() - perform an early check of the CPU + * + * This is used on PowerPC, SH and X86 machines as a CPU init mechanism. It is + * called during the pre-relocation init sequence in board_init_f(). + * + * @return 0 if oK, -ve on error + */ +int checkcpu(void); + #endif