From b30c9b1c9a676c3b85ac1de9cbc1c5f4424d6297 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 18 Sep 2014 11:52:16 -0500 Subject: arm64: split cpu.c The cpu.c contains some helpful construts as well as ramstage devicetree handling. Split the 2 pieces so that cpu.c can be reused in secmon. BUG=chrome-os-partner:30785 BRANCH=None TEST=Built and booted. Change-Id: Iec0f8462411897a255f7aa289191ce6761e08bb0 Signed-off-by: Patrick Georgi Original-Commit-Id: 4f30f1186950424b65df6858965a09ca51637e4f Original-Change-Id: Ie87bd35bf1ccd777331250dcdaae07dab82d3d18 Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/218842 Original-Reviewed-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/9089 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/arch/arm64/include/armv8/arch/cpu.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/arch/arm64/include/armv8') diff --git a/src/arch/arm64/include/armv8/arch/cpu.h b/src/arch/arm64/include/armv8/arch/cpu.h index 8d071adc61..fc31903f52 100644 --- a/src/arch/arm64/include/armv8/arch/cpu.h +++ b/src/arch/arm64/include/armv8/arch/cpu.h @@ -23,6 +23,7 @@ #define asmlinkage #if !defined(__PRE_RAM__) +#include #include enum { @@ -67,6 +68,12 @@ struct cpu_info { struct cpu_info *cpu_info(void); extern struct cpu_info *bsp_cpu_info; +extern struct cpu_info cpu_infos[CONFIG_MAX_CPUS]; + +static inline struct cpu_info *cpu_info_for_cpu(unsigned int id) +{ + return &cpu_infos[id]; +} /* Ran only by BSP at initial boot strapping. */ static inline void cpu_set_bsp(void) @@ -79,6 +86,16 @@ static inline int cpu_is_bsp(void) return cpu_info() == bsp_cpu_info; } +static inline int cpu_online(struct cpu_info *ci) +{ + return load_acquire(&ci->online) != 0; +} + +static inline void cpu_mark_online(struct cpu_info *ci) +{ + store_release(&ci->online, 1); +} + /* Control routines for starting CPUs. */ struct cpu_control_ops { /* Return the maximum number of CPUs supported. */ @@ -112,6 +129,9 @@ int arch_run_on_cpu_async(unsigned int cpu, struct cpu_action *action); int arch_run_on_all_cpus_async(struct cpu_action *action); int arch_run_on_all_cpus_but_self_async(struct cpu_action *action); +/* Wait for actions to be perfomed. */ +void arch_cpu_wait_for_action(void); + #endif /* !__PRE_RAM__ */ /* -- cgit v1.2.3