1 /*
2  * Copyright (c) 2014-2016 Wind River Systems, Inc.
3  * Copyright (c) 2019 Stephanos Ioannidis <root@stephanos.io>
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_
9 #define ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_
10 
11 #ifndef _ASMLANGUAGE
12 
13 #include <zephyr/kernel_structs.h>
14 
15 #include <zephyr/arch/arc/v2/aux_regs.h>
16 
arch_curr_cpu(void)17 static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
18 {
19 #ifdef CONFIG_SMP
20 	uint32_t core;
21 
22 	core = z_arc_v2_core_id();
23 
24 	return &_kernel.cpus[core];
25 #else
26 	return &_kernel.cpus[0];
27 #endif /* CONFIG_SMP */
28 }
29 
arch_proc_id(void)30 static ALWAYS_INLINE uint32_t arch_proc_id(void)
31 {
32 	/*
33 	 * Placeholder implementation to be replaced with an architecture
34 	 * specific call to get processor ID
35 	 */
36 	return arch_curr_cpu()->id;
37 }
38 
arch_num_cpus(void)39 static ALWAYS_INLINE unsigned int arch_num_cpus(void)
40 {
41 	return CONFIG_MP_MAX_NUM_CPUS;
42 }
43 
44 #endif /* !_ASMLANGUAGE */
45 #endif /* ZEPHYR_INCLUDE_ARCH_XTENSA_ARCH_INLINES_H_ */
46