![]() |
TF-M Reference Manual
1.2.0
TrustedFirmware-M
|
Go to the source code of this file.
Data Structures | |
struct | iovec_args_t |
Holds the iovec parameters that are passed to a service. More... | |
struct | interrupted_ctx_stack_frame_t |
struct | handler_ctx_stack_frame_t |
struct | spm_partition_runtime_data_t |
Runtime context information of a partition. More... | |
struct | spm_partition_static_data_t |
struct | spm_partition_desc_t |
struct | spm_partition_db_t |
Macros | |
#define | SPM_PARTITION_STATE_UNINIT 0 |
#define | SPM_PARTITION_STATE_IDLE 1 |
#define | SPM_PARTITION_STATE_RUNNING 2 |
#define | SPM_PARTITION_STATE_HANDLING_IRQ 3 |
#define | SPM_PARTITION_STATE_SUSPENDED 4 |
#define | SPM_PARTITION_STATE_BLOCKED 5 |
#define | SPM_PARTITION_STATE_CLOSED 6 |
#define | EXC_NUM_THREAD_MODE (0) |
#define | EXC_NUM_SVCALL (11) |
#define | EXC_NUM_PENDSV (14) |
#define | EXC_NUM_SYSTICK (15) |
#define | SPM_INVALID_PARTITION_IDX (~0U) |
#define | TFM_PARTITION_UNPRIVILEGED_MODE 0 |
#define | TFM_PARTITION_PRIVILEGED_MODE 1 |
#define | SPM_PART_FLAG_APP_ROT 0x01 |
#define | SPM_PART_FLAG_PSA_ROT 0x02 |
#define | SPM_PART_FLAG_IPC 0x04 |
#define | TFM_PRIORITY_HIGH 0 |
#define | TFM_PRIORITY_NORMAL 0x7F |
#define | TFM_PRIORITY_LOW 0xFF |
#define | TFM_PRIORITY(LEVEL) TFM_PRIORITY_##LEVEL |
Functions | |
void | tfm_spm_partition_push_interrupted_ctx (uint32_t partition_idx) |
Save interrupted partition context on ctx stack. More... | |
void | tfm_spm_partition_pop_interrupted_ctx (uint32_t partition_idx) |
Restores interrupted partition context on ctx stack. More... | |
void | tfm_spm_partition_push_handler_ctx (uint32_t partition_idx) |
Save handler partition context on ctx stack. More... | |
void | tfm_spm_partition_pop_handler_ctx (uint32_t partition_idx) |
Restores handler partition context on ctx stack. More... | |
const struct spm_partition_runtime_data_t * | tfm_spm_partition_get_runtime_data (uint32_t partition_idx) |
Get the current runtime data of a partition. More... | |
uint32_t | tfm_spm_partition_get_running_partition_idx (void) |
Returns the index of the partition that has running state. More... | |
void | tfm_spm_partition_store_context (uint32_t partition_idx, uint32_t stack_ptr, uint32_t lr) |
Save stack pointer and link register for partition in database. More... | |
void | tfm_spm_partition_set_state (uint32_t partition_idx, uint32_t state) |
Set the current state of a partition. More... | |
void | tfm_spm_partition_set_caller_partition_idx (uint32_t partition_idx, uint32_t caller_partition_idx) |
Set the caller partition index for a given partition. More... | |
void | tfm_spm_partition_set_caller_client_id (uint32_t partition_idx, int32_t caller_client_id) |
Set the caller client ID for a given partition. More... | |
enum spm_err_t | tfm_spm_partition_set_iovec (uint32_t partition_idx, const int32_t *args) |
Set the iovec parameters for the partition. More... | |
enum spm_err_t | tfm_spm_partition_init (void) |
Execute partition init function. More... | |
void | tfm_spm_partition_cleanup_context (uint32_t partition_idx) |
Clears the context info from the database for a partition. More... | |
void | tfm_spm_partition_set_signal_mask (uint32_t partition_idx, uint32_t signal_mask) |
Set the signal mask for a given partition. More... | |
void | tfm_spm_secure_api_init_done (void) |
Signal that secure partition initialisation is finished. More... | |
uint32_t | tfm_spm_partition_request_svc_handler (const uint32_t *svc_args, uint32_t lr) |
Called if veneer is running in thread mode. More... | |
uint32_t | tfm_spm_partition_return_handler (uint32_t lr) |
Called when secure service returns. More... | |
void | tfm_spm_get_caller_client_id_handler (uint32_t *svc_args) |
Stores caller's client id in state context. More... | |
void | tfm_spm_memory_permission_check_handler (uint32_t *svc_args) |
Checks if a secure service's access to a memory location is permitted. More... | |
int32_t | tfm_spm_check_buffer_access (uint32_t partition_idx, void *start_addr, size_t len, uint32_t alignment) |
Check whether a buffer is ok for writing to by the privileged API function. More... | |
uint32_t | tfm_spm_depriv_req_handler (uint32_t *svc_args, uint32_t excReturn) |
Handle deprivileged request. More... | |
uint32_t | tfm_spm_depriv_return_handler (uint32_t *irq_svc_args, uint32_t lr) |
Handle request to return to privileged. More... | |
void | tfm_spm_enable_irq_handler (uint32_t *svc_args) |
Handle IRQ enable request. More... | |
void | tfm_spm_disable_irq_handler (uint32_t *svc_args) |
Handle IRQ disable request. More... | |
void | tfm_spm_psa_wait (uint32_t *svc_args) |
Handle signal wait request. More... | |
void | tfm_spm_psa_eoi (uint32_t *svc_args) |
Handle request to record IRQ processed. More... | |
uint32_t | tfm_spm_partition_get_partition_id (uint32_t partition_idx) |
Get the id of the partition for its index from the db. More... | |
enum spm_err_t | tfm_spm_db_init (void) |
Initialize partition database. More... | |
uint32_t | tfm_spm_partition_get_privileged_mode (uint32_t partition_flags) |
Get the current partition mode. More... | |
void | tfm_spm_request_handler (const struct tfm_state_context_t *svc_ctx) |
Handle an SPM request by a secure service. More... | |
void | tfm_spm_seal_psp_stacks (void) |
Function to seal the PSP stacks for Function mode. More... | |
#define EXC_NUM_PENDSV (14) |
Definition at line 26 of file spm_func.h.
#define EXC_NUM_SVCALL (11) |
Definition at line 25 of file spm_func.h.
#define EXC_NUM_SYSTICK (15) |
Definition at line 27 of file spm_func.h.
#define EXC_NUM_THREAD_MODE (0) |
Definition at line 24 of file spm_func.h.
#define SPM_INVALID_PARTITION_IDX (~0U) |
Definition at line 29 of file spm_func.h.
#define SPM_PART_FLAG_APP_ROT 0x01 |
Definition at line 35 of file spm_func.h.
#define SPM_PART_FLAG_IPC 0x04 |
Definition at line 37 of file spm_func.h.
#define SPM_PART_FLAG_PSA_ROT 0x02 |
Definition at line 36 of file spm_func.h.
#define SPM_PARTITION_STATE_BLOCKED 5 |
Definition at line 21 of file spm_func.h.
#define SPM_PARTITION_STATE_CLOSED 6 |
Definition at line 22 of file spm_func.h.
#define SPM_PARTITION_STATE_HANDLING_IRQ 3 |
Definition at line 19 of file spm_func.h.
#define SPM_PARTITION_STATE_IDLE 1 |
Definition at line 17 of file spm_func.h.
#define SPM_PARTITION_STATE_RUNNING 2 |
Definition at line 18 of file spm_func.h.
#define SPM_PARTITION_STATE_SUSPENDED 4 |
Definition at line 20 of file spm_func.h.
#define SPM_PARTITION_STATE_UNINIT 0 |
Definition at line 16 of file spm_func.h.
#define TFM_PARTITION_PRIVILEGED_MODE 1 |
Definition at line 33 of file spm_func.h.
#define TFM_PARTITION_UNPRIVILEGED_MODE 0 |
Definition at line 32 of file spm_func.h.
#define TFM_PRIORITY | ( | LEVEL | ) | TFM_PRIORITY_##LEVEL |
Definition at line 42 of file spm_func.h.
#define TFM_PRIORITY_HIGH 0 |
Definition at line 39 of file spm_func.h.
#define TFM_PRIORITY_LOW 0xFF |
Definition at line 41 of file spm_func.h.
#define TFM_PRIORITY_NORMAL 0x7F |
Definition at line 40 of file spm_func.h.
enum spm_err_t |
Definition at line 44 of file spm_func.h.
int32_t tfm_spm_check_buffer_access | ( | uint32_t | partition_idx, |
void * | start_addr, | ||
size_t | len, | ||
uint32_t | alignment | ||
) |
Check whether a buffer is ok for writing to by the privileged API function.
This function checks whether the caller partition owns the buffer, can write to it, and the buffer has proper alignment.
[in] | partition_idx | Partition index |
[in] | start_addr | The start address of the buffer |
[in] | len | The length of the buffer |
[in] | alignment | The expected alignment (in bits) |
Definition at line 818 of file spm_func.c.
enum spm_err_t tfm_spm_db_init | ( | void | ) |
Initialize partition database.
Definition at line 1415 of file spm_func.c.
uint32_t tfm_spm_depriv_req_handler | ( | uint32_t * | svc_args, |
uint32_t | excReturn | ||
) |
Handle deprivileged request.
Definition at line 921 of file spm_func.c.
uint32_t tfm_spm_depriv_return_handler | ( | uint32_t * | irq_svc_args, |
uint32_t | lr | ||
) |
Handle request to return to privileged.
Definition at line 976 of file spm_func.c.
void tfm_spm_disable_irq_handler | ( | uint32_t * | svc_args | ) |
Handle IRQ disable request.
Definition at line 1060 of file spm_func.c.
void tfm_spm_enable_irq_handler | ( | uint32_t * | svc_args | ) |
Handle IRQ enable request.
Definition at line 1033 of file spm_func.c.
void tfm_spm_get_caller_client_id_handler | ( | uint32_t * | svc_args | ) |
Stores caller's client id in state context.
Definition at line 851 of file spm_func.c.
void tfm_spm_memory_permission_check_handler | ( | uint32_t * | svc_args | ) |
Checks if a secure service's access to a memory location is permitted.
void tfm_spm_partition_cleanup_context | ( | uint32_t | partition_idx | ) |
Clears the context info from the database for a partition.
[in] | partition_idx | Partition index |
Definition at line 1362 of file spm_func.c.
uint32_t tfm_spm_partition_get_partition_id | ( | uint32_t | partition_idx | ) |
Get the id of the partition for its index from the db.
[in] | partition_idx | Partition index |
Definition at line 707 of file spm_func.c.
uint32_t tfm_spm_partition_get_privileged_mode | ( | uint32_t | partition_flags | ) |
Get the current partition mode.
[in] | partition_flags | Flags of current partition |
TFM_PARTITION_PRIVILEGED_MODE | Privileged mode |
TFM_PARTITION_UNPRIVILEGED_MODE | Unprivileged mode |
Definition at line 713 of file spm_func.c.
uint32_t tfm_spm_partition_get_running_partition_idx | ( | void | ) |
Returns the index of the partition that has running state.
Definition at line 1357 of file spm_func.c.
const struct spm_partition_runtime_data_t* tfm_spm_partition_get_runtime_data | ( | uint32_t | partition_idx | ) |
Get the current runtime data of a partition.
[in] | partition_idx | Partition index |
Definition at line 1292 of file spm_func.c.
enum spm_err_t tfm_spm_partition_init | ( | void | ) |
Execute partition init function.
Definition at line 1168 of file spm_func.c.
void tfm_spm_partition_pop_handler_ctx | ( | uint32_t | partition_idx | ) |
Restores handler partition context on ctx stack.
[in] | partition_idx | Partition index |
Definition at line 1263 of file spm_func.c.
void tfm_spm_partition_pop_interrupted_ctx | ( | uint32_t | partition_idx | ) |
Restores interrupted partition context on ctx stack.
[in] | partition_idx | Partition index |
Definition at line 1233 of file spm_func.c.
void tfm_spm_partition_push_handler_ctx | ( | uint32_t | partition_idx | ) |
Save handler partition context on ctx stack.
[in] | partition_idx | Partition index |
Definition at line 1248 of file spm_func.c.
void tfm_spm_partition_push_interrupted_ctx | ( | uint32_t | partition_idx | ) |
Save interrupted partition context on ctx stack.
[in] | partition_idx | Partition index |
Definition at line 1220 of file spm_func.c.
uint32_t tfm_spm_partition_request_svc_handler | ( | const uint32_t * | svc_args, |
uint32_t | lr | ||
) |
Called if veneer is running in thread mode.
Definition at line 894 of file spm_func.c.
uint32_t tfm_spm_partition_return_handler | ( | uint32_t | lr | ) |
Called when secure service returns.
Definition at line 949 of file spm_func.c.
void tfm_spm_partition_set_caller_client_id | ( | uint32_t | partition_idx, |
int32_t | caller_client_id | ||
) |
Set the caller client ID for a given partition.
[in] | partition_idx | Partition index |
[in] | caller_client_id | The ID of the calling client |
Definition at line 1321 of file spm_func.c.
void tfm_spm_partition_set_caller_partition_idx | ( | uint32_t | partition_idx, |
uint32_t | caller_partition_idx | ||
) |
Set the caller partition index for a given partition.
[in] | partition_idx | Partition index |
[in] | caller_partition_idx | The index of the caller partition |
Definition at line 1307 of file spm_func.c.
enum spm_err_t tfm_spm_partition_set_iovec | ( | uint32_t | partition_idx, |
const int32_t * | args | ||
) |
Set the iovec parameters for the partition.
[in] | partition_idx | Partition index |
[in] | args | The arguments of the secure function |
args is expected to be of type int32_t[4] where: args[0] is in_vec args[1] is in_len args[2] is out_vec args[3] is out_len
Definition at line 1328 of file spm_func.c.
void tfm_spm_partition_set_signal_mask | ( | uint32_t | partition_idx, |
uint32_t | signal_mask | ||
) |
Set the signal mask for a given partition.
[in] | partition_idx | Partition index |
[in] | signal_mask | The signal mask to be set for the partition |
Definition at line 1314 of file spm_func.c.
void tfm_spm_partition_set_state | ( | uint32_t | partition_idx, |
uint32_t | state | ||
) |
Set the current state of a partition.
[in] | partition_idx | Partition index |
[in] | state | The state to be set |
Definition at line 1297 of file spm_func.c.
void tfm_spm_partition_store_context | ( | uint32_t | partition_idx, |
uint32_t | stack_ptr, | ||
uint32_t | lr | ||
) |
Save stack pointer and link register for partition in database.
[in] | partition_idx | Partition index |
[in] | stack_ptr | Stack pointer to be stored |
[in] | lr | Link register to be stored |
Definition at line 1282 of file spm_func.c.
void tfm_spm_psa_eoi | ( | uint32_t * | svc_args | ) |
Handle request to record IRQ processed.
Definition at line 1118 of file spm_func.c.
void tfm_spm_psa_wait | ( | uint32_t * | svc_args | ) |
Handle signal wait request.
Definition at line 1087 of file spm_func.c.
void tfm_spm_request_handler | ( | const struct tfm_state_context_t * | svc_ctx | ) |
Handle an SPM request by a secure service.
[in] | svc_ctx | The stacked SVC context |
Definition at line 1382 of file spm_func.c.
void tfm_spm_seal_psp_stacks | ( | void | ) |
Function to seal the PSP stacks for Function mode.
Definition at line 51 of file spm_func.c.
void tfm_spm_secure_api_init_done | ( | void | ) |
Signal that secure partition initialisation is finished.
Definition at line 730 of file spm_func.c.