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 <plat/common/platform.h> 12 13 /* The per_cpu_ptr_cache_t space allocation */ 14 cpu_data_t percpu_data[PLATFORM_CORE_COUNT]; 15 16 #ifndef __aarch64__ 17 cpu_data_t *_cpu_data(void) 18 { 19 return _cpu_data_by_index(plat_my_core_pos()); 20 } 21 #endif 22 23 /* 24 * Initializes the cpu_ops_ptr if not already initialized in cpu_data. 25 * May only be called after the data cache is enabled. 26 */ 27 void cpu_data_init_cpu_ops(void) 28 { 29 struct cpu_ops *ops; 30 31 if (get_cpu_data(cpu_ops_ptr) == NULL) { 32 ops = get_cpu_ops_ptr(); 33 34 set_cpu_data(cpu_ops_ptr, ops); 35 } 36 } 37