TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
psa_service.c File Reference
#include <inttypes.h>
#include <stdio.h>
#include "tfm/tfm_core_svc.h"
#include "psa/client.h"
#include "psa/service.h"
Include dependency graph for psa_service.c:

Go to the source code of this file.

Functions

psa_signal_t psa_wait (psa_signal_t signal_mask, uint32_t timeout)
 Return the Secure Partition interrupt signals that have been asserted from a subset of signals provided by the caller. More...
 
psa_status_t psa_get (psa_signal_t signal, psa_msg_t *msg)
 Retrieve the message which corresponds to a given RoT Service signal and remove the message from the RoT Service queue. More...
 
void psa_set_rhandle (psa_handle_t msg_handle, void *rhandle)
 Associate some RoT Service private data with a client connection. More...
 
size_t psa_read (psa_handle_t msg_handle, uint32_t invec_idx, void *buffer, size_t num_bytes)
 Read a message parameter or part of a message parameter from a client input vector. More...
 
size_t psa_skip (psa_handle_t msg_handle, uint32_t invec_idx, size_t num_bytes)
 Skip over part of a client input vector. More...
 
void psa_write (psa_handle_t msg_handle, uint32_t outvec_idx, const void *buffer, size_t num_bytes)
 Write a message response to a client output vector. More...
 
void psa_reply (psa_handle_t msg_handle, psa_status_t retval)
 Complete handling of a specific message and unblock the client. More...
 
void psa_notify (int32_t partition_id)
 Send a PSA_DOORBELL signal to a specific Secure Partition. More...
 
void psa_clear (void)
 Clear the PSA_DOORBELL signal. More...
 
void psa_eoi (psa_signal_t irq_signal)
 Inform the SPM that an interrupt has been handled (end of interrupt). More...
 
void psa_panic (void)
 Terminate execution within the calling Secure Partition and will not return. More...
 

Function Documentation

void psa_clear ( void  )

Clear the PSA_DOORBELL signal.

Return values
voidSuccess.
PROGRAMMER ERRORThe Secure Partition's doorbell signal is not currently asserted.

Definition at line 83 of file psa_service.c.

void psa_eoi ( psa_signal_t  irq_signal)

Inform the SPM that an interrupt has been handled (end of interrupt).

Parameters
[in]irq_signalThe interrupt signal that has been processed.
Return values
voidSuccess.
PROGRAMMER ERRORThe call is invalid, one or more of the following are true:
  • irq_signal is not an interrupt signal.
  • irq_signal indicates more than one signal.
  • irq_signal is not currently asserted.

Definition at line 91 of file psa_service.c.

psa_status_t psa_get ( psa_signal_t  signal,
psa_msg_t msg 
)

Retrieve the message which corresponds to a given RoT Service signal and remove the message from the RoT Service queue.

Parameters
[in]signalThe signal value for an asserted RoT Service.
[out]msgPointer to psa_msg_t object for receiving the message.
Return values
PSA_SUCCESSSuccess, *msg will contain the delivered message.
PSA_ERROR_DOES_NOT_EXISTMessage could not be delivered.
PROGRAMMER ERRORThe call is invalid because one or more of the following are true:
  • signal has more than a single bit set.
  • signal does not correspond to an RoT Service.
  • The RoT Service signal is not currently asserted.
  • The msg pointer provided is not a valid memory reference.

Definition at line 24 of file psa_service.c.

Here is the caller graph for this function:

void psa_notify ( int32_t  partition_id)

Send a PSA_DOORBELL signal to a specific Secure Partition.

Parameters
[in]partition_idSecure Partition ID of the target partition.
Return values
voidSuccess.
PROGRAMMER ERRORpartition_id does not correspond to a Secure Partition.

Definition at line 75 of file psa_service.c.

void psa_panic ( void  )

Terminate execution within the calling Secure Partition and will not return.

Return values
Does not return

Definition at line 99 of file psa_service.c.

Here is the caller graph for this function:

size_t psa_read ( psa_handle_t  msg_handle,
uint32_t  invec_idx,
void *  buffer,
size_t  num_bytes 
)

Read a message parameter or part of a message parameter from a client input vector.

Parameters
[in]msg_handleHandle for the client's message.
[in]invec_idxIndex of the input vector to read from. Must be less than PSA_MAX_IOVEC.
[out]bufferBuffer in the Secure Partition to copy the requested data to.
[in]num_bytesMaximum number of bytes to be read from the client input vector.
Return values
>0Number of bytes copied.
0There was no remaining data in this input vector.
PROGRAMMER ERRORThe call is invalid, one or more of the following are true:
  • msg_handle is invalid.
  • msg_handle does not refer to a PSA_IPC_CALL message.
  • invec_idx is equal to or greater than PSA_MAX_IOVEC.
  • the memory reference for buffer is invalid or not writable.

Definition at line 40 of file psa_service.c.

Here is the caller graph for this function:

void psa_reply ( psa_handle_t  msg_handle,
psa_status_t  status 
)

Complete handling of a specific message and unblock the client.

Parameters
[in]msg_handleHandle for the client's message.
[in]statusMessage result value to be reported to the client.
Return values
voidSuccess.
PROGRAMMER ERRORThe call is invalid, one or more of the following are true:
  • msg_handle is invalid.
  • An invalid status code is specified for the type of message.

Definition at line 67 of file psa_service.c.

Here is the caller graph for this function:

void psa_set_rhandle ( psa_handle_t  msg_handle,
void *  rhandle 
)

Associate some RoT Service private data with a client connection.

Parameters
[in]msg_handleHandle for the client's message.
[in]rhandleReverse handle allocated by the RoT Service.
Return values
voidSuccess, rhandle will be provided with all subsequent messages delivered on this connection.
PROGRAMMER ERRORmsg_handle is invalid.

Definition at line 32 of file psa_service.c.

size_t psa_skip ( psa_handle_t  msg_handle,
uint32_t  invec_idx,
size_t  num_bytes 
)

Skip over part of a client input vector.

Parameters
[in]msg_handleHandle for the client's message.
[in]invec_idxIndex of input vector to skip from. Must be less than PSA_MAX_IOVEC.
[in]num_bytesMaximum number of bytes to skip in the client input vector.
Return values
>0Number of bytes skipped.
0There was no remaining data in this input vector.
PROGRAMMER ERRORThe call is invalid, one or more of the following are true:
  • msg_handle is invalid.
  • msg_handle does not refer to a request message.
  • invec_idx is equal to or greater than PSA_MAX_IOVEC.

Definition at line 50 of file psa_service.c.

psa_signal_t psa_wait ( psa_signal_t  signal_mask,
uint32_t  timeout 
)

Return the Secure Partition interrupt signals that have been asserted from a subset of signals provided by the caller.

Parameters
[in]signal_maskA set of signals to query. Signals that are not in this set will be ignored.
[in]timeoutSpecify either blocking PSA_BLOCK or polling PSA_POLL operation.
Return values
>0At least one signal is asserted.
0No signals are asserted. This is only seen when a polling timeout is used.

Definition at line 15 of file psa_service.c.

void psa_write ( psa_handle_t  msg_handle,
uint32_t  outvec_idx,
const void *  buffer,
size_t  num_bytes 
)

Write a message response to a client output vector.

Parameters
[in]msg_handleHandle for the client's message.
[out]outvec_idxIndex of output vector in message to write to. Must be less than PSA_MAX_IOVEC.
[in]bufferBuffer with the data to write.
[in]num_bytesNumber of bytes to write to the client output vector.
Return values
voidSuccess
PROGRAMMER ERRORThe call is invalid, one or more of the following are true:
  • msg_handle is invalid.
  • msg_handle does not refer to a request message.
  • outvec_idx is equal to or greater than PSA_MAX_IOVEC.
  • The memory reference for buffer is invalid.
  • The call attempts to write data past the end of the client output vector.

Definition at line 58 of file psa_service.c.

Here is the caller graph for this function: