1 /* 2 * Copyright (c) 2021-2022, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 #ifndef __PSA_INTERFACE_REDIRECT_H__ 8 #define __PSA_INTERFACE_REDIRECT_H__ 9 10 #include "config_spm.h" 11 #include "psa/framework_feature.h" 12 13 #if CONFIG_TFM_PSA_API_SUPERVISOR_CALL == 1 14 15 #define psa_framework_version psa_framework_version_svc 16 #define psa_version psa_version_svc 17 #define tfm_psa_call_pack tfm_psa_call_pack_svc 18 #define psa_wait psa_wait_svc 19 #define psa_get psa_get_svc 20 #define psa_read psa_read_svc 21 #define psa_skip psa_skip_svc 22 #define psa_write psa_write_svc 23 #define psa_reply psa_reply_svc 24 #define psa_panic psa_panic_svc 25 #define psa_rot_lifecycle_state psa_rot_lifecycle_state_svc 26 27 #if CONFIG_TFM_DOORBELL_API == 1 28 #define psa_notify psa_notify_svc 29 #define psa_clear psa_clear_svc 30 #endif /* CONFIG_TFM_DOORBELL_API == 1 */ 31 32 /* Following PSA APIs are only needed by connection-based services */ 33 #if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1 34 #define psa_connect psa_connect_svc 35 #define psa_close psa_close_svc 36 #define psa_set_rhandle psa_set_rhandle_svc 37 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */ 38 39 #if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 40 #define psa_irq_enable psa_irq_enable_svc 41 #define psa_irq_disable psa_irq_disable_svc 42 /* This API is only used for FLIH. */ 43 #if CONFIG_TFM_FLIH_API == 1 44 #define psa_reset_signal psa_reset_signal_svc 45 #endif 46 /* This API is only used for SLIH. */ 47 #if CONFIG_TFM_SLIH_API == 1 48 #define psa_eoi psa_eoi_svc 49 #endif 50 #endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */ 51 52 #elif CONFIG_TFM_PSA_API_CROSS_CALL == 1 53 54 #define psa_framework_version psa_framework_version_cross 55 #define psa_version psa_version_cross 56 #define tfm_psa_call_pack tfm_psa_call_pack_cross 57 #define psa_wait psa_wait_cross 58 #define psa_get psa_get_cross 59 #define psa_read psa_read_cross 60 #define psa_skip psa_skip_cross 61 #define psa_write psa_write_cross 62 #define psa_reply psa_reply_cross 63 #define psa_panic psa_panic_cross 64 #define psa_rot_lifecycle_state psa_rot_lifecycle_state_cross 65 66 #if CONFIG_TFM_DOORBELL_API == 1 67 #define psa_notify psa_notify_cross 68 #define psa_clear psa_clear_cross 69 #endif /* CONFIG_TFM_DOORBELL_API == 1 */ 70 71 /* Following PSA APIs are only needed by connection-based services */ 72 #if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1 73 #define psa_connect psa_connect_cross 74 #define psa_close psa_close_cross 75 #define psa_set_rhandle psa_set_rhandle_cross 76 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */ 77 78 #if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 79 #define psa_irq_enable psa_irq_enable_cross 80 #define psa_irq_disable psa_irq_disable_cross 81 /* This API is only used for FLIH. */ 82 #if CONFIG_TFM_FLIH_API == 1 83 #define psa_reset_signal psa_reset_signal_cross 84 #endif 85 /* This API is only used for SLIH. */ 86 #if CONFIG_TFM_SLIH_API == 1 87 #define psa_eoi psa_eoi_cross 88 #endif 89 #endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */ 90 91 #if PSA_FRAMEWORK_HAS_MM_IOVEC 92 #define psa_map_invec psa_map_invec_cross 93 #define psa_unmap_invec psa_unmap_invec_cross 94 #define psa_map_outvec psa_map_outvec_cross 95 #define psa_unmap_outvec psa_unmap_outvec_cross 96 #endif /* PSA_FRAMEWORK_HAS_MM_IOVEC */ 97 98 #elif CONFIG_TFM_PSA_API_SFN_CALL == 1 99 100 #define psa_framework_version psa_framework_version_sfn 101 #define psa_version psa_version_sfn 102 #define tfm_psa_call_pack psa_call_pack_sfn 103 #define psa_read psa_read_sfn 104 #define psa_skip psa_skip_sfn 105 #define psa_write psa_write_sfn 106 #define psa_panic psa_panic_sfn 107 /* Following PSA APIs are only needed by connection-based services */ 108 #if CONFIG_TFM_CONNECTION_BASED_SERVICE_API == 1 109 #define psa_connect psa_connect_sfn 110 #define psa_close psa_close_sfn 111 #endif /* CONFIG_TFM_CONNECTION_BASED_SERVICE_API */ 112 #if CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 113 #define psa_wait psa_wait_sfn 114 #define psa_irq_enable psa_irq_enable_sfn 115 #define psa_irq_disable psa_irq_disable_sfn 116 /* This API is only used for FLIH. */ 117 #if CONFIG_TFM_FLIH_API == 1 118 #define psa_reset_signal psa_reset_signal_sfn 119 #endif 120 /* This API is only used for SLIH. */ 121 #if CONFIG_TFM_SLIH_API == 1 122 #define psa_eoi psa_eoi_sfn 123 #endif 124 #endif /* CONFIG_TFM_FLIH_API == 1 || CONFIG_TFM_SLIH_API == 1 */ 125 126 #if PSA_FRAMEWORK_HAS_MM_IOVEC 127 #define psa_map_invec psa_map_invec_sfn 128 #define psa_unmap_invec psa_unmap_invec_sfn 129 #define psa_map_outvec psa_map_outvec_sfn 130 #define psa_unmap_outvec psa_unmap_outvec_sfn 131 #endif /* PSA_FRAMEWORK_HAS_MM_IOVEC */ 132 133 #endif 134 135 #endif /* __PSA_INTERFACE_REDIRECT_H__ */ 136