2019-11-10 16:17:19 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com<
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Private kernel definitions (ARM64)
|
|
|
|
*
|
|
|
|
* This file contains private kernel function definitions and various
|
|
|
|
* other definitions for the ARM Cortex-A processor architecture family.
|
|
|
|
*
|
|
|
|
* This file is also included by assembly language files which must #define
|
|
|
|
* _ASMLANGUAGE before including this header file. Note that kernel
|
|
|
|
* assembly source files obtains structure offset values via "absolute symbols"
|
|
|
|
* in the offsets.o module.
|
|
|
|
*/
|
|
|
|
|
2021-03-26 15:22:59 +01:00
|
|
|
#ifndef ZEPHYR_ARCH_ARM64_INCLUDE_KERNEL_ARCH_FUNC_H_
|
|
|
|
#define ZEPHYR_ARCH_ARM64_INCLUDE_KERNEL_ARCH_FUNC_H_
|
2019-11-10 16:17:19 +00:00
|
|
|
|
|
|
|
#include <kernel_arch_data.h>
|
|
|
|
|
2024-10-30 22:19:51 +08:00
|
|
|
#include <zephyr/platform/hooks.h>
|
|
|
|
|
2019-11-10 16:17:19 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _ASMLANGUAGE
|
|
|
|
|
2024-07-08 17:17:09 -04:00
|
|
|
extern void xen_enlighten_init(void);
|
|
|
|
|
2019-11-10 16:17:19 +00:00
|
|
|
static ALWAYS_INLINE void arch_kernel_init(void)
|
|
|
|
{
|
2024-07-08 17:17:09 -04:00
|
|
|
#ifdef CONFIG_XEN
|
|
|
|
xen_enlighten_init();
|
|
|
|
#endif
|
2024-10-30 22:19:51 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_SOC_PER_CORE_INIT_HOOK
|
|
|
|
soc_per_core_init_hook();
|
|
|
|
#endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */
|
2019-11-10 16:17:19 +00:00
|
|
|
}
|
|
|
|
|
2020-08-04 12:52:16 +02:00
|
|
|
static inline void arch_switch(void *switch_to, void **switched_from)
|
2019-11-10 16:17:19 +00:00
|
|
|
{
|
2022-03-14 12:51:40 -05:00
|
|
|
extern void z_arm64_context_switch(struct k_thread *new,
|
|
|
|
struct k_thread *old);
|
|
|
|
struct k_thread *new = switch_to;
|
|
|
|
struct k_thread *old = CONTAINER_OF(switched_from, struct k_thread,
|
|
|
|
switch_handle);
|
2020-08-04 12:52:16 +02:00
|
|
|
|
2022-03-14 12:51:40 -05:00
|
|
|
z_arm64_context_switch(new, old);
|
2019-11-10 16:17:19 +00:00
|
|
|
}
|
|
|
|
|
2024-06-01 00:07:14 +08:00
|
|
|
extern void z_arm64_fatal_error(unsigned int reason, struct arch_esf *esf);
|
2022-12-12 16:33:31 +01:00
|
|
|
extern void z_arm64_set_ttbr0(uint64_t ttbr0);
|
2021-07-20 10:14:17 +08:00
|
|
|
extern void z_arm64_mem_cfg_ipi(void);
|
2019-11-10 16:17:19 +00:00
|
|
|
|
2021-04-07 23:31:44 -04:00
|
|
|
#ifdef CONFIG_FPU_SHARING
|
2023-12-13 16:04:15 -05:00
|
|
|
void arch_flush_local_fpu(void);
|
|
|
|
void arch_flush_fpu_ipi(unsigned int cpu);
|
2021-04-07 23:31:44 -04:00
|
|
|
#endif
|
|
|
|
|
2022-11-01 16:03:42 +08:00
|
|
|
#ifdef CONFIG_ARM64_SAFE_EXCEPTION_STACK
|
|
|
|
void z_arm64_safe_exception_stack_init(void);
|
|
|
|
#endif
|
|
|
|
|
2019-11-10 16:17:19 +00:00
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-03-26 15:22:59 +01:00
|
|
|
#endif /* ZEPHYR_ARCH_ARM64_INCLUDE_KERNEL_ARCH_FUNC_H_ */
|