context_mgmt: Make cm_init_context_common public
This function can be currently accessed through the wrappers cm_init_context_by_index() and cm_init_my_context(). However, they only work on contexts that are associated to a CPU. By making this function public, it is possible to set up a context that isn't associated to any CPU. For consistency, it has been renamed to cm_setup_context(). Change-Id: Ib2146105abc8137bab08745a8adb30ca2c4cedf4 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
This commit is contained in:
parent
41e48fed9a
commit
1634cae89d
|
@ -7,11 +7,11 @@
|
||||||
#ifndef __CM_H__
|
#ifndef __CM_H__
|
||||||
#define __CM_H__
|
#define __CM_H__
|
||||||
|
|
||||||
#ifndef AARCH32
|
|
||||||
#include <arch.h>
|
#include <arch.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <context.h>
|
||||||
|
#include <context_mgmt.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Forward declarations
|
* Forward declarations
|
||||||
|
@ -32,6 +32,7 @@ void cm_set_context(void *context, uint32_t security_state);
|
||||||
void cm_init_my_context(const struct entry_point_info *ep);
|
void cm_init_my_context(const struct entry_point_info *ep);
|
||||||
void cm_init_context_by_index(unsigned int cpu_idx,
|
void cm_init_context_by_index(unsigned int cpu_idx,
|
||||||
const struct entry_point_info *ep);
|
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);
|
void cm_prepare_el3_exit(uint32_t security_state);
|
||||||
|
|
||||||
#ifndef AARCH32
|
#ifndef AARCH32
|
||||||
|
|
|
@ -41,8 +41,7 @@ void cm_init(void)
|
||||||
* entry_point_info structure.
|
* entry_point_info structure.
|
||||||
*
|
*
|
||||||
* The security state to initialize is determined by the SECURE attribute
|
* The security state to initialize is determined by the SECURE attribute
|
||||||
* of the entry_point_info. The function returns a pointer to the initialized
|
* of the entry_point_info.
|
||||||
* context and sets this as the next context to return to.
|
|
||||||
*
|
*
|
||||||
* The EE and ST attributes are used to configure the endianness and secure
|
* The EE and ST attributes are used to configure the endianness and secure
|
||||||
* timer availability for the new execution context.
|
* timer availability for the new execution context.
|
||||||
|
@ -51,7 +50,7 @@ void cm_init(void)
|
||||||
* el3_exit(). For Secure-EL1 cm_prepare_el3_exit() is equivalent to
|
* el3_exit(). For Secure-EL1 cm_prepare_el3_exit() is equivalent to
|
||||||
* cm_e1_sysreg_context_restore().
|
* cm_e1_sysreg_context_restore().
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static void cm_init_context_common(cpu_context_t *ctx, const entry_point_info_t *ep)
|
void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
|
||||||
{
|
{
|
||||||
unsigned int security_state;
|
unsigned int security_state;
|
||||||
uint32_t scr, sctlr;
|
uint32_t scr, sctlr;
|
||||||
|
@ -149,7 +148,7 @@ void cm_init_context_by_index(unsigned int cpu_idx,
|
||||||
{
|
{
|
||||||
cpu_context_t *ctx;
|
cpu_context_t *ctx;
|
||||||
ctx = cm_get_context_by_index(cpu_idx, GET_SECURITY_STATE(ep->h.attr));
|
ctx = cm_get_context_by_index(cpu_idx, GET_SECURITY_STATE(ep->h.attr));
|
||||||
cm_init_context_common(ctx, ep);
|
cm_setup_context(ctx, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -161,7 +160,7 @@ void cm_init_my_context(const entry_point_info_t *ep)
|
||||||
{
|
{
|
||||||
cpu_context_t *ctx;
|
cpu_context_t *ctx;
|
||||||
ctx = cm_get_context(GET_SECURITY_STATE(ep->h.attr));
|
ctx = cm_get_context(GET_SECURITY_STATE(ep->h.attr));
|
||||||
cm_init_context_common(ctx, ep);
|
cm_setup_context(ctx, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -49,8 +49,7 @@ void cm_init(void)
|
||||||
* entry_point_info structure.
|
* entry_point_info structure.
|
||||||
*
|
*
|
||||||
* The security state to initialize is determined by the SECURE attribute
|
* The security state to initialize is determined by the SECURE attribute
|
||||||
* of the entry_point_info. The function returns a pointer to the initialized
|
* of the entry_point_info.
|
||||||
* context and sets this as the next context to return to.
|
|
||||||
*
|
*
|
||||||
* The EE and ST attributes are used to configure the endianess and secure
|
* The EE and ST attributes are used to configure the endianess and secure
|
||||||
* timer availability for the new execution context.
|
* timer availability for the new execution context.
|
||||||
|
@ -59,7 +58,7 @@ void cm_init(void)
|
||||||
* el3_exit(). For Secure-EL1 cm_prepare_el3_exit() is equivalent to
|
* el3_exit(). For Secure-EL1 cm_prepare_el3_exit() is equivalent to
|
||||||
* cm_e1_sysreg_context_restore().
|
* cm_e1_sysreg_context_restore().
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static void cm_init_context_common(cpu_context_t *ctx, const entry_point_info_t *ep)
|
void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
|
||||||
{
|
{
|
||||||
unsigned int security_state;
|
unsigned int security_state;
|
||||||
uint32_t scr_el3, pmcr_el0;
|
uint32_t scr_el3, pmcr_el0;
|
||||||
|
@ -258,7 +257,7 @@ void cm_init_context_by_index(unsigned int cpu_idx,
|
||||||
{
|
{
|
||||||
cpu_context_t *ctx;
|
cpu_context_t *ctx;
|
||||||
ctx = cm_get_context_by_index(cpu_idx, GET_SECURITY_STATE(ep->h.attr));
|
ctx = cm_get_context_by_index(cpu_idx, GET_SECURITY_STATE(ep->h.attr));
|
||||||
cm_init_context_common(ctx, ep);
|
cm_setup_context(ctx, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -270,7 +269,7 @@ void cm_init_my_context(const entry_point_info_t *ep)
|
||||||
{
|
{
|
||||||
cpu_context_t *ctx;
|
cpu_context_t *ctx;
|
||||||
ctx = cm_get_context(GET_SECURITY_STATE(ep->h.attr));
|
ctx = cm_get_context(GET_SECURITY_STATE(ep->h.attr));
|
||||||
cm_init_context_common(ctx, ep);
|
cm_setup_context(ctx, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue