aarch64: add arch_curr_cpu
Following other ARCHs, add arch_curr_cpu in arch_inlines.h Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
db71e4dac7
commit
cfc7673c28
2 changed files with 33 additions and 0 deletions
|
@ -14,6 +14,8 @@
|
|||
|
||||
#if defined(CONFIG_X86) || defined(CONFIG_X86_64)
|
||||
#include <arch/x86/arch_inlines.h>
|
||||
#elif defined(CONFIG_ARM64)
|
||||
#include <arch/arm/aarch64/arch_inlines.h>
|
||||
#elif defined(CONFIG_ARC)
|
||||
#include <arch/arc/arch_inlines.h>
|
||||
#elif defined(CONFIG_XTENSA)
|
||||
|
|
31
include/arch/arm/aarch64/arch_inlines.h
Normal file
31
include/arch/arm/aarch64/arch_inlines.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright 2020 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_ARCH_ARM_AARCH64_ARCH_INLINES_H
|
||||
#define ZEPHYR_INCLUDE_ARCH_ARM_AARCH64_ARCH_INLINES_H
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
#include <kernel_structs.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <arch/arm/aarch64/lib_helpers.h>
|
||||
|
||||
static ALWAYS_INLINE _cpu_t *arch_curr_cpu(void)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
uint64_t core;
|
||||
|
||||
/* Note: Only support one Cluster */
|
||||
core = MPIDR_TO_CORE(GET_MPIDR());
|
||||
|
||||
return &_kernel.cpus[core];
|
||||
#else
|
||||
return &_kernel.cpus[0];
|
||||
#endif /* CONFIG_SMP */
|
||||
}
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
#endif /* ZEPHYR_INCLUDE_ARCH_ARM_AARCH64_ARCH_INLINES_H */
|
Loading…
Add table
Add a link
Reference in a new issue