[U-Boot] [PATCH v2 23/41] common: Move some CPU functions out of common.h
Simon Glass
sjg at chromium.org
Fri Nov 8 19:53:30 UTC 2019
These functions belong in cpu_legacy.h since they do not use driver model.
Move them over. Don't bother adding comments since these functions should
be deleted.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v2: None
arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 1 +
.../armv8/fsl-layerscape/fsl_lsch2_speed.c | 1 +
.../armv8/fsl-layerscape/fsl_lsch3_speed.c | 1 +
arch/arm/cpu/armv8/s32v234/cpu.c | 1 +
arch/powerpc/cpu/mpc85xx/speed.c | 1 +
arch/powerpc/cpu/mpc86xx/cpu.c | 1 +
arch/powerpc/cpu/mpc8xxx/cpu.c | 1 +
arch/powerpc/cpu/mpc8xxx/fdt.c | 1 +
board/freescale/qemu-ppce500/qemu-ppce500.c | 1 +
include/common.h | 20 -------------------
include/cpu_legacy.h | 19 ++++++++++++++++++
11 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 0843d4207d..824fbd1d89 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <env.h>
#include <fsl_ddr_sdram.h>
#include <vsprintf.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
index df4df9aca7..500c06642b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <linux/compiler.h>
#include <asm/io.h>
#include <asm/processor.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
index b3e67321b4..d14b308718 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
@@ -7,6 +7,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <linux/compiler.h>
#include <fsl_ifc.h>
#include <asm/processor.h>
diff --git a/arch/arm/cpu/armv8/s32v234/cpu.c b/arch/arm/cpu/armv8/s32v234/cpu.c
index b4cb67a66a..bc4b8bf86f 100644
--- a/arch/arm/cpu/armv8/s32v234/cpu.c
+++ b/arch/arm/cpu/armv8/s32v234/cpu.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/armv8/mmu.h>
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index acc2f2bb81..c6026f3381 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <ppc_asm.tmpl>
#include <linux/compiler.h>
#include <asm/processor.h>
diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index 1c3c78217c..5ee3a56b47 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <vsprintf.h>
#include <watchdog.h>
#include <command.h>
diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c
index 467eac4a2e..333dfa3090 100644
--- a/arch/powerpc/cpu/mpc8xxx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xxx/cpu.c
@@ -10,6 +10,7 @@
#include <config.h>
#include <common.h>
#include <command.h>
+#include <cpu_legacy.h>
#include <tsec.h>
#include <fm_eth.h>
#include <netdev.h>
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
index 0d877c43be..40ee46c24a 100644
--- a/arch/powerpc/cpu/mpc8xxx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <cpu_legacy.h>
#include <linux/libfdt.h>
#include <fdt_support.h>
#include <asm/mp.h>
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index fb36d8366c..6814bed27c 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <cpu_legacy.h>
#include <env.h>
#include <pci.h>
#include <asm/processor.h>
diff --git a/include/common.h b/include/common.h
index 992675100d..4de05032b2 100644
--- a/include/common.h
+++ b/include/common.h
@@ -203,26 +203,6 @@ void relocate_code(ulong, gd_t *, ulong) __attribute__ ((noreturn));
ulong get_endaddr (void);
void trap_init (ulong);
-/* $(CPU)/cpu.c */
-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);
-
void s_init(void);
int checkcpu (void);
diff --git a/include/cpu_legacy.h b/include/cpu_legacy.h
index a99b69b976..75b93bc11e 100644
--- a/include/cpu_legacy.h
+++ b/include/cpu_legacy.h
@@ -20,4 +20,23 @@ 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);
+
#endif
--
2.24.0.rc1.363.gb1bccd3e3d-goog
More information about the U-Boot
mailing list