mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-26 14:55:16 +00:00

Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way:e0ea0928d5
("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems:46f9b2c3a2
("drivers: add tzc380 support"). This problem was introduced in commit4ecca33988
("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
83 lines
2.6 KiB
C
83 lines
2.6 KiB
C
/*
|
|
* Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef CONTEXT_MGMT_H
|
|
#define CONTEXT_MGMT_H
|
|
|
|
#include <assert.h>
|
|
#include <context.h>
|
|
#include <stdint.h>
|
|
|
|
#include <arch.h>
|
|
|
|
/*******************************************************************************
|
|
* Forward declarations
|
|
******************************************************************************/
|
|
struct entry_point_info;
|
|
|
|
/*******************************************************************************
|
|
* Function & variable prototypes
|
|
******************************************************************************/
|
|
void cm_init(void);
|
|
void *cm_get_context_by_index(unsigned int cpu_idx,
|
|
unsigned int security_state);
|
|
void cm_set_context_by_index(unsigned int cpu_idx,
|
|
void *context,
|
|
unsigned int security_state);
|
|
void *cm_get_context(uint32_t security_state);
|
|
void cm_set_context(void *context, uint32_t security_state);
|
|
void cm_init_my_context(const struct entry_point_info *ep);
|
|
void cm_init_context_by_index(unsigned int cpu_idx,
|
|
const struct entry_point_info *ep);
|
|
void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep);
|
|
void cm_prepare_el3_exit(uint32_t security_state);
|
|
|
|
#ifndef AARCH32
|
|
void cm_el1_sysregs_context_save(uint32_t security_state);
|
|
void cm_el1_sysregs_context_restore(uint32_t security_state);
|
|
void cm_set_elr_el3(uint32_t security_state, uintptr_t entrypoint);
|
|
void cm_set_elr_spsr_el3(uint32_t security_state,
|
|
uintptr_t entrypoint, uint32_t spsr);
|
|
void cm_write_scr_el3_bit(uint32_t security_state,
|
|
uint32_t bit_pos,
|
|
uint32_t value);
|
|
void cm_set_next_eret_context(uint32_t security_state);
|
|
uint32_t cm_get_scr_el3(uint32_t security_state);
|
|
|
|
/* Inline definitions */
|
|
|
|
/*******************************************************************************
|
|
* This function is used to program the context that's used for exception
|
|
* return. This initializes the SP_EL3 to a pointer to a 'cpu_context' set for
|
|
* the required security state
|
|
******************************************************************************/
|
|
static inline void cm_set_next_context(void *context)
|
|
{
|
|
#if ENABLE_ASSERTIONS
|
|
uint64_t sp_mode;
|
|
|
|
/*
|
|
* Check that this function is called with SP_EL0 as the stack
|
|
* pointer
|
|
*/
|
|
__asm__ volatile("mrs %0, SPSel\n"
|
|
: "=r" (sp_mode));
|
|
|
|
assert(sp_mode == MODE_SP_EL0);
|
|
#endif /* ENABLE_ASSERTIONS */
|
|
|
|
__asm__ volatile("msr spsel, #1\n"
|
|
"mov sp, %0\n"
|
|
"msr spsel, #0\n"
|
|
: : "r" (context));
|
|
}
|
|
|
|
#else
|
|
void *cm_get_next_context(void);
|
|
void cm_set_next_context(void *context);
|
|
#endif /* AARCH32 */
|
|
|
|
#endif /* CONTEXT_MGMT_H */
|