1 /* 2 * Copyright (c) 2014-2025, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <platform_def.h> 8 9 #include <lib/cpus/cpu_ops.h> 10 #include <lib/el3_runtime/cpu_data.h> 11 #include <lib/per_cpu/per_cpu.h> 12 #include <plat/common/platform.h> 13 14 /* percpu_data space allocation */ 15 PER_CPU_DEFINE(cpu_data_t, percpu_data); 16 17 #ifndef __aarch64__ 18 cpu_data_t *_cpu_data(void) 19 { 20 return PER_CPU_CUR(percpu_data); 21 } 22 #endif 23 24 /* 25 * Initializes the cpu_ops_ptr if not already initialized in cpu_data. 26 * May only be called after the data cache is enabled. 27 */ 28 void cpu_data_init_cpu_ops(void) 29 { 30 struct cpu_ops *ops; 31 32 if (get_cpu_data(cpu_ops_ptr) == NULL) { 33 ops = get_cpu_ops_ptr(); 34 35 set_cpu_data(cpu_ops_ptr, ops); 36 } 37 } 38