Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 1 | ########################## |
| 2 | Hardware Abstraction Layer |
| 3 | ########################## |
| 4 | |
| 5 | :Organization: Arm Limited |
| 6 | :Contact: tf-m@lists.trustedfirmware.org |
| 7 | |
| 8 | :API Version: 0.9 |
| 9 | |
| 10 | ************ |
| 11 | Introduction |
| 12 | ************ |
| 13 | :term:`TF-M` :term:`HAL` abstracts the hardware-oriented and platform specific |
| 14 | operations on the :term:`SPE` side and provides a set of APIs to the upper |
| 15 | layers such as :term:`SPM`, :term:`RoT Service`. |
| 16 | The :term:`HAL` aims to cover the platform different aspects whereas common |
| 17 | architecturally defined aspects are done generically within the common |
| 18 | :term:`SPE`. |
| 19 | In some cases, although the operations are defined architecturally, |
| 20 | it may not be possible to generalize implementations because lots of information |
| 21 | is only known to platforms. |
| 22 | It is more efficient to define a :term:`HAL` API for those architectural |
| 23 | operations as well. |
| 24 | |
| 25 | .. note:: |
| 26 | :term:`TBSA-M` provides the hardware requirements for security purposes. |
| 27 | :term:`TF-M` :term:`HAL` tries to reference :term:`TBSA-M` recommendations in |
| 28 | the interfaces from the software perspective only. Please reference |
| 29 | :term:`TBSA-M` for your security hardware design. |
| 30 | |
| 31 | Design Goals |
| 32 | ============ |
| 33 | :term:`TF-M` :term:`HAL` is designed to simplify the integration efforts on |
| 34 | different platforms. |
| 35 | |
| 36 | :term:`TF-M` :term:`HAL` is designed to make it easy to use the hardware and |
| 37 | develop the :term:`SPM` and :term:`RoT Service` which need to access the |
| 38 | devices. |
| 39 | |
| 40 | :term:`TF-M` :term:`HAL` is designed to make the structure clearer and let the |
| 41 | :term:`TF-M` mainly focus on :term:`PSA` implementation. |
| 42 | |
| 43 | ******** |
| 44 | Overview |
| 45 | ******** |
| 46 | This section provides an overview of the abstraction layer structure. |
| 47 | |
| 48 | .. figure:: media/hal_structure.png |
| 49 | |
| 50 | Here lists a minimal set of necessary functionalities: |
| 51 | |
| 52 | - **Isolation API**: Provides the necessary isolation functionalities required |
| 53 | by the :term:`PSA-FF-M` and :term:`TBSA-M`, and provides APIs to :term:`SPM` |
| 54 | to check the permissions of memory access. |
| 55 | - **Platform API**: Provides the platform initialization, platform-specific |
| 56 | memory information, system reset, etc. |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 57 | - **Log dev API**: Provides the log system functions. |
| 58 | - **Interrupt API**: Provides the interrupt functions. |
| 59 | |
| 60 | .. note:: |
| 61 | - There is a non-secure :term:`HAL` that focuses on the mailbox operation API |
| 62 | for Dual-core topology. For more information about it, please refer to |
| 63 | :doc:`Mailbox Design in TF-M on Dual-core System |
Anton Komlev | ff7cbae | 2023-01-12 16:28:26 +0000 | [diff] [blame] | 64 | </design_docs/dual-cpu/mailbox_design_on_dual_core_system>`. |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 65 | - The minimal set of :term:`TF-M` :term:`HAL` is sufficient for Secure |
| 66 | Partitions by using customized peripheral interfaces. To provide easier |
| 67 | portability for the Secure Partitions, a Secure Partition :term:`HAL` is |
| 68 | provided in this design too. |
| 69 | - The debug mechanisms give the external entity the corresponding right to |
| 70 | access the system assets. :term:`TF-M` ensures that the external entity is |
| 71 | permitted access to those assets. Currently, :term:`TF-M` only needs the |
| 72 | debug authentication. The whole debug mechanism and related :term:`HAL` will |
| 73 | be enhanced in the future. Please refer to the :doc:`Debug authentication |
Anton Komlev | e69cf68 | 2023-01-31 11:59:25 +0000 | [diff] [blame^] | 74 | settings section </integration_guide/source_structure/platform_folder>` |
| 75 | for more details. |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 76 | |
| 77 | ***************** |
| 78 | Design Principles |
| 79 | ***************** |
| 80 | As :term:`TF-M` runs on resource-constrained devices, the :term:`HAL` tries to |
| 81 | avoid multiple level abstractions which cost more resources. |
| 82 | |
| 83 | Part of the :term:`HAL` interfaces does not focus on exact hardware operations |
| 84 | such as power on/off or PIN manipulation. |
| 85 | Instead, the :term:`HAL` abstracts higher-level interfaces to reserve the |
| 86 | implementation flexibility for the platform vendors. |
| 87 | |
| 88 | The :term:`TF-M` :term:`HAL` should be easy to deprecate APIs and provide |
| 89 | compatibilities. |
| 90 | Any API incompatibility should be detected during building. |
| 91 | |
| 92 | :term:`TF-M` relies on the :term:`HAL` APIs to be implemented correctly and |
| 93 | trusts the :term:`HAL` APIs. |
| 94 | :term:`TFM` can provide assertions to detect common programming errors but |
| 95 | essentially no further extensive checks will be provided. |
| 96 | |
| 97 | ************ |
| 98 | Source Files |
| 99 | ************ |
| 100 | This section describes the source file of the :term:`TF-M` :term:`HAL`, |
| 101 | including the header and c files. |
| 102 | |
| 103 | tfm_hal_defs.h |
| 104 | ============== |
| 105 | This header file contains the definitions of common macros and types used by all |
| 106 | :term:`HAL` APIs. Please refer to `Status Codes`_ for detailed definitions. |
| 107 | |
| 108 | tfm_hal_[module].[h/c] |
| 109 | ====================== |
| 110 | All other headers and c files are classified by the modules, such as isolation, |
| 111 | platform, interrupt, devices, etc. |
| 112 | |
| 113 | .. note:: |
| 114 | There are common files in the platform folder include the implemented |
| 115 | :term:`HAL` APIs. The platform vendors can use them directly but need to |
| 116 | implement all the sub APIs. |
| 117 | |
| 118 | ************ |
| 119 | Status Codes |
| 120 | ************ |
| 121 | These are common status and error codes for all :term:`HAL` APIs. |
| 122 | |
| 123 | Types |
| 124 | ===== |
| 125 | tfm_hal_status_t |
| 126 | ---------------- |
| 127 | This is a status code to be used as the return type of :term:`HAL` APIs. |
| 128 | |
| 129 | .. code-block:: c |
| 130 | |
Summer Qin | 2ecfc9f | 2020-08-20 14:20:27 +0800 | [diff] [blame] | 131 | enum tfm_hal_status_t { |
Mingyang Sun | 45c6c20 | 2020-09-23 16:17:50 +0800 | [diff] [blame] | 132 | TFM_HAL_ERROR_MEM_FAULT = SCHAR_MIN, |
Summer Qin | 2ecfc9f | 2020-08-20 14:20:27 +0800 | [diff] [blame] | 133 | TFM_HAL_ERROR_MAX_VALUE, |
| 134 | TFM_HAL_ERROR_BAD_STATE, |
| 135 | TFM_HAL_ERROR_NOT_SUPPORTED, |
| 136 | TFM_HAL_ERROR_INVALID_INPUT, |
| 137 | TFM_HAL_ERROR_NOT_INIT, |
| 138 | TFM_HAL_ERROR_GENERIC, |
| 139 | TFM_HAL_SUCCESS = 0 |
| 140 | }; |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 141 | |
| 142 | Error Codes |
| 143 | =========== |
| 144 | Negative values indicate an error. Zero and positive values indicate success. |
| 145 | |
| 146 | Here is the general list. The detailed usages for each error code are described |
| 147 | in the API introduction sections. |
| 148 | |
| 149 | TFM_HAL_SUCCESS |
| 150 | --------------- |
| 151 | Status code to indicate general success. |
| 152 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 153 | TFM_HAL_ERROR_GENERIC |
| 154 | --------------------- |
| 155 | Status code to indicate an error that does not correspond to any defined failure |
| 156 | cause. |
| 157 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 158 | TFM_HAL_ERROR_NOT_INIT |
| 159 | ---------------------- |
| 160 | Status code to indicate that the module is not initialed. |
| 161 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 162 | TFM_HAL_ERROR_INVALID_INPUT |
| 163 | --------------------------- |
| 164 | Status code to indicate that the input is invalid. |
| 165 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 166 | TFM_HAL_ERROR_NOT_SUPPORTED |
| 167 | --------------------------- |
| 168 | Status code to indicate that the requested operation or a parameter is not |
| 169 | supported. |
| 170 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 171 | TFM_HAL_ERROR_BAD_STATE |
| 172 | ----------------------- |
| 173 | Status code to indicate that the requested action cannot be performed in the |
| 174 | current state. |
| 175 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 176 | TFM_HAL_ERROR_MAX_VALUE |
| 177 | ----------------------- |
| 178 | Status code to indicate that the current number has got the max value. |
| 179 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 180 | TFM_HAL_ERROR_MEM_FAULT |
| 181 | ----------------------- |
| 182 | Status code to indicate that the memory check failed. |
| 183 | |
Edison Ai | f4b6113 | 2020-07-01 18:35:17 +0800 | [diff] [blame] | 184 | *************************** |
| 185 | API Definition for TF-M SPM |
| 186 | *************************** |
| 187 | This section describes the APIs defined for :term:`TF-M` :term:`SPM`. |
| 188 | |
Edison Ai | f542e6b | 2020-07-01 17:55:42 +0800 | [diff] [blame] | 189 | Platform API |
| 190 | ============ |
| 191 | The platform API is a higher-level abstraction layer of the platform, other than |
| 192 | a dedicated API set for the special hardware devices. |
| 193 | |
| 194 | APIs |
| 195 | ---- |
| 196 | tfm_hal_platform_init() |
| 197 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 198 | **Prototype** |
| 199 | |
| 200 | .. code-block:: c |
| 201 | |
| 202 | enum tfm_hal_status_t tfm_hal_platform_init(void) |
| 203 | |
| 204 | **Description** |
| 205 | |
Kevin Peng | b8bc0d2 | 2021-09-08 14:37:50 +0800 | [diff] [blame] | 206 | This API performs the platform initializations **before** the :term:`SPM` |
| 207 | initialization. |
Edison Ai | f542e6b | 2020-07-01 17:55:42 +0800 | [diff] [blame] | 208 | |
Kevin Peng | b8bc0d2 | 2021-09-08 14:37:50 +0800 | [diff] [blame] | 209 | The initializations could include but not limited to: |
| 210 | - Fault handlers |
| 211 | - Reset configurations |
| 212 | - Debug init |
| 213 | - NVIC init |
Edison Ai | f542e6b | 2020-07-01 17:55:42 +0800 | [diff] [blame] | 214 | |
| 215 | **Parameter** |
| 216 | |
| 217 | - ``void`` - None. |
| 218 | |
| 219 | **Return Values** |
| 220 | |
| 221 | - ``TFM_HAL_SUCCESS`` - Init success. |
| 222 | - ``TFM_HAL_ERROR_GENERIC`` - Generic errors. |
| 223 | |
| 224 | tfm_hal_system_reset() |
| 225 | ^^^^^^^^^^^^^^^^^^^^^^ |
| 226 | **Prototype** |
| 227 | |
| 228 | .. code-block:: c |
| 229 | |
| 230 | void tfm_hal_system_reset(void) |
| 231 | |
| 232 | **Description** |
| 233 | |
| 234 | This API performs a system reset. |
| 235 | |
| 236 | The platform can uninitialize some resources before reset. |
| 237 | |
Joakim Andersson | e0a1dc3 | 2022-09-27 10:39:18 +0200 | [diff] [blame] | 238 | When ``CONFIG_TFM_HALT_ON_CORE_PANIC`` is disabled this function is called to reset |
Sebastian Bøe | 055d83a | 2022-02-21 12:01:41 +0100 | [diff] [blame] | 239 | the system when a fatal error occurs. |
| 240 | |
| 241 | **Parameter** |
| 242 | |
| 243 | - ``void`` - None |
| 244 | |
| 245 | **Return Values** |
| 246 | |
| 247 | - ``void`` - None |
| 248 | |
| 249 | **Note** |
| 250 | |
| 251 | This API should not return. |
| 252 | |
| 253 | tfm_hal_system_halt() |
| 254 | ^^^^^^^^^^^^^^^^^^^^^ |
| 255 | **Prototype** |
| 256 | |
| 257 | .. code-block:: c |
| 258 | |
| 259 | void tfm_hal_system_halt(void) |
| 260 | |
| 261 | **Description** |
| 262 | |
| 263 | This API enters the CPU into an infinite loop. |
| 264 | |
| 265 | The platform can uninitialize some resources before looping forever. |
| 266 | |
Joakim Andersson | e0a1dc3 | 2022-09-27 10:39:18 +0200 | [diff] [blame] | 267 | When ``CONFIG_TFM_HALT_ON_CORE_PANIC`` is enabled this function is called to halt the |
Sebastian Bøe | 055d83a | 2022-02-21 12:01:41 +0100 | [diff] [blame] | 268 | system when a fatal error occurs. |
| 269 | |
Edison Ai | f542e6b | 2020-07-01 17:55:42 +0800 | [diff] [blame] | 270 | **Parameter** |
| 271 | |
| 272 | - ``void`` - None |
| 273 | |
| 274 | **Return Values** |
| 275 | |
| 276 | - ``void`` - None |
| 277 | |
| 278 | **Note** |
| 279 | |
| 280 | This API should not return. |
| 281 | |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 282 | Isolation API |
| 283 | ============= |
| 284 | The :term:`PSA-FF-M` defines three isolation levels and a memory access rule to |
| 285 | provide diverse levels of securitiy. The isolation API provides the functions to |
| 286 | implement these requirements. |
| 287 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 288 | The Isolation API operates on boundaries. A boundary represents a set of |
| 289 | protection settings that isolates components and domains. Below are the |
| 290 | boundary examples in the current implementation: |
| 291 | |
| 292 | - Boundaries between SPM and Secure Partitions. |
| 293 | - Boundaries between ARoT domain and PRoT domain. |
| 294 | |
| 295 | There are two types of boundaries: |
| 296 | |
| 297 | - Static boundaries: Set up when the system is initializing and |
| 298 | persistent after the initialization. This type of boundary needs the |
| 299 | set-up operations only. |
| 300 | - Partition boundaries: Keeps switching from one to another when the system |
| 301 | is running. This type of boundary needs both set-up and switching |
| 302 | operations. |
| 303 | |
| 304 | The boundary operations are abstracted as HAL interfaces because isolation |
| 305 | hardwares can be different for platforms: |
| 306 | |
| 307 | - The set-up HAL interface creates a partition boundary based on given |
| 308 | partition information. This created boundary is bound with the partition |
| 309 | for subsequent usage. The binding is done by storing the boundary into |
| 310 | partition runtime data. |
| 311 | - The activation HAL interface activates the partition boundary to secure |
| 312 | the execution for the partition to be switched. The target partition's |
| 313 | information and boundary are given to the activation HAL to accomplish |
| 314 | the operation. |
| 315 | |
| 316 | The data representing the partition boundary in runtime is defined with the |
| 317 | opaque type ``uintptr_t``: |
| 318 | |
| 319 | - It is required that one value represents one boundary. The different values |
| 320 | represent different boundaries. |
| 321 | - The value is created by HAL implementation with its own-defined encoding |
| 322 | scheme. |
| 323 | |
| 324 | The HAL implementation defined encoding scheme can be designed for |
| 325 | implementation convenience. For example: |
| 326 | |
| 327 | - The implementation scheme can encode attribute flags into integer bits. |
| 328 | This could help the activation HAL to extract the protection settings |
| 329 | quickly from this encoded value, or even write to hardware registers |
| 330 | directly in the most ideal case. The initial TF-M Isolation HAL reference |
| 331 | implementation applies this scheme. |
| 332 | - The implementation scheme can reference the addresses of isolation |
| 333 | hardware description data. This could help the activation HAL to reference |
| 334 | the protection settings directly by pointers. |
| 335 | |
| 336 | Multiple Secure Partitions can bind with the same boundary value. This |
| 337 | flexibility is useful for specific configurations. Take Isolation Level 2 as |
| 338 | an example, assigning PRoT and ARoT domain boundaries to respective partitions |
| 339 | can make execution more efficient, because switching two partitions in the |
| 340 | same domain does not need to change the activated boundary. |
| 341 | |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 342 | The boundary contains the partition's memory accessibility information, hence |
| 343 | memory access check shall be performed based on boundary. |
| 344 | |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 345 | Memory Access Attributes |
| 346 | ------------------------ |
| 347 | The memory access attributes are encoded as bit fields, you can logic OR them to |
| 348 | have a combination of the atrributes, for example |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 349 | ``TFM_HAL_ACCESS_UNPRIVILEGED | TFM_HAL_ACCESS_READABLE`` is unprivileged |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 350 | readable. The data type is `uint32_t`. |
| 351 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 352 | TFM_HAL_ACCESS_EXECUTABLE |
| 353 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 354 | The memory is executable. |
| 355 | |
| 356 | .. code-block:: c |
| 357 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 358 | #define TFM_HAL_ACCESS_EXECUTABLE (1UL << 0) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 359 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 360 | TFM_HAL_ACCESS_READABLE |
| 361 | ^^^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 362 | The memory is readable. |
| 363 | |
| 364 | .. code-block:: c |
| 365 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 366 | #define TFM_HAL_ACCESS_READABLE (1UL << 1) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 367 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 368 | TFM_HAL_ACCESS_WRITABLE |
| 369 | ^^^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 370 | The memory is writable. |
| 371 | |
| 372 | .. code-block:: c |
| 373 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 374 | #define TFM_HAL_ACCESS_WRITABLE (1UL << 2) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 375 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 376 | TFM_HAL_ACCESS_UNPRIVILEGED |
| 377 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 378 | The memory is unprivileged mode accessible. |
| 379 | |
| 380 | .. code-block:: c |
| 381 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 382 | #define TFM_HAL_ACCESS_UNPRIVILEGED (1UL << 3) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 383 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 384 | TFM_HAL_ACCESS_DEVICE |
| 385 | ^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 386 | The memory is a MMIO device. |
| 387 | |
| 388 | .. code-block:: c |
| 389 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 390 | #define TFM_HAL_ACCESS_DEVICE (1UL << 4) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 391 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 392 | TFM_HAL_ACCESS_NS |
| 393 | ^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 394 | The memory is accessible from :term:`NSPE` |
| 395 | |
| 396 | .. code-block:: c |
| 397 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 398 | #define TFM_HAL_ACCESS_NS (1UL << 5) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 399 | |
| 400 | APIs |
| 401 | ---- |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 402 | |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 403 | tfm_hal_set_up_static_boundaries() |
| 404 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 405 | **Prototype** |
| 406 | |
| 407 | .. code-block:: c |
| 408 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 409 | enum tfm_hal_status_t tfm_hal_set_up_static_boundaries(void) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 410 | |
| 411 | **Description** |
| 412 | |
| 413 | This API sets up the static isolation boundaries which are constant throughout |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 414 | the system runtime. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 415 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 416 | These boundaries include: |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 417 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 418 | - The boundary between the :term:`SPE` and the :term:`NSPE` |
| 419 | - The boundary to protect the SPM execution. For example, the PSA RoT |
| 420 | isolation boundary between the PSA Root of Trust and the Application Root of |
| 421 | Trust which is for isolation level 2 and 3 only. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 422 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 423 | Refer to the :term:`PSA-FF-M` for the definitions of the isolation boundaries. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 424 | |
| 425 | **Return Values** |
| 426 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 427 | - ``TFM_HAL_SUCCESS`` - Isolation boundaries have been set up. |
| 428 | - ``TFM_HAL_ERROR_GENERIC`` - Failed to set up the static boundaries. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 429 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 430 | tfm_hal_bind_boundary() |
| 431 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 432 | **Prototype** |
| 433 | |
| 434 | .. code-block:: c |
| 435 | |
| 436 | enum tfm_hal_status_t tfm_hal_bind_boundary( |
| 437 | const struct partition_load_info_t *p_ldinf, |
| 438 | uintptr_t *p_boundary); |
| 439 | |
| 440 | **Description** |
| 441 | |
| 442 | This API binds partition with a platform-generated boundary. The boundary is |
| 443 | bound by writing the generated value into ``p_boundary``. And this bound |
| 444 | boundary is used in subsequent calls to `tfm_hal_activate_boundary()`_ when |
| 445 | boundary's owner partition get scheduled for running. |
| 446 | |
| 447 | **Parameter** |
| 448 | |
| 449 | - ``p_ldinf`` - Load information of the partition that is under loading. |
| 450 | - ``p_boundary`` - Pointer for holding a partition's boundary. |
| 451 | |
| 452 | **Return Values** |
| 453 | |
| 454 | - ``TFM_HAL_SUCCESS`` - The boundary has been bound successfully. |
| 455 | - ``TFM_HAL_ERROR_GENERIC`` - Failed to bind the handle. |
| 456 | |
| 457 | tfm_hal_activate_boundary() |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 458 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 459 | **Prototype** |
| 460 | |
| 461 | .. code-block:: c |
| 462 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 463 | enum tfm_hal_status_t tfm_hal_activate_boundary( |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 464 | const struct partition_load_info_t *p_ldinf, |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 465 | uintptr_t boundary); |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 466 | |
| 467 | **Description** |
| 468 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 469 | This API requires the platform to activate the boundary to ensure the given |
| 470 | Secure Partition can run successfully. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 471 | |
Ken Liu | ce58bfc | 2021-05-12 17:54:48 +0800 | [diff] [blame] | 472 | The access permissions outside the boundary is platform-dependent. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 473 | |
| 474 | **Parameter** |
| 475 | |
Ken Liu | 967ffa9 | 2022-05-25 15:13:34 +0800 | [diff] [blame] | 476 | - ``p_ldinf`` - The load information of the partition that is going to be run. |
| 477 | - ``boundary`` - The boundary for the owner partition of ``p_ldinf``. This |
| 478 | value is bound in function ``tfm_hal_bind_boundary``. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 479 | |
| 480 | **Return Values** |
| 481 | |
| 482 | - ``TFM_HAL_SUCCESS`` - the isolation boundary has been set up. |
| 483 | - ``TFM_HAL_ERROR_GENERIC`` - failed to set upthe isolation boundary. |
| 484 | |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 485 | tfm_hal_memory_check() |
| 486 | ^^^^^^^^^^^^^^^^^^^^^^ |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 487 | **Prototype** |
| 488 | |
| 489 | .. code-block:: c |
| 490 | |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 491 | tfm_hal_status_t tfm_hal_memory_check(uintptr_t boundary, |
| 492 | uintptr_t base, |
| 493 | size_t size, |
| 494 | uint32_t access_type) |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 495 | |
| 496 | **Description** |
| 497 | |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 498 | This API checks if a given range of memory can be accessed with specified |
| 499 | access types in boundary. The boundary belongs to a partition which |
| 500 | contains asset info. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 501 | |
| 502 | **Parameter** |
| 503 | |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 504 | - ``boundary`` - Boundary of a Secure Partition. |
| 505 | Check `tfm_hal_bind_boundary` for details. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 506 | - ``base`` - The base address of the region. |
| 507 | - ``size`` - The size of the region. |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 508 | - ``access_type`` - The memory access types to be checked between given memory |
| 509 | and boundaries. The `Memory Access Attributes`_. |
edison.ai | 37e0f60 | 2020-07-13 18:30:58 +0800 | [diff] [blame] | 510 | |
| 511 | **Return Values** |
| 512 | |
| 513 | - ``TFM_HAL_SUCCESS`` - The memory region has the access permissions. |
| 514 | - ``TFM_HAL_ERROR_MEM_FAULT`` - The memory region does not have the access |
| 515 | permissions. |
| 516 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - Invalid inputs. |
| 517 | - ``TFM_HAL_ERROR_GENERIC`` - An error occurred. |
| 518 | |
Summer Qin | 56725eb | 2022-05-06 15:23:40 +0800 | [diff] [blame] | 519 | **Note** |
| 520 | |
| 521 | If the implementation chooses to encode a pointer as the boundary, |
| 522 | a platform-specific pointer validation needs to be considered before |
| 523 | referencing the content in this pointer. |
| 524 | |
Edison Ai | f4b6113 | 2020-07-01 18:35:17 +0800 | [diff] [blame] | 525 | Log API |
| 526 | ======= |
| 527 | The log API is used by the :term:`TF-M` :doc:`log system <tfm_log_system_design_document>`. |
| 528 | The log device could be uart, memory, usb, etc. |
| 529 | |
| 530 | APIs |
| 531 | ---- |
| 532 | tfm_hal_output_partition_log() |
| 533 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 534 | **Prototype** |
| 535 | |
| 536 | .. code-block:: c |
| 537 | |
| 538 | int32_t tfm_hal_output_partition_log(const unsigned char *str, uint32_t len) |
| 539 | |
| 540 | **Description** |
| 541 | |
| 542 | This API is called by Secure Partition to output logs. |
| 543 | |
| 544 | **Parameter** |
| 545 | |
| 546 | - ``str`` - The string to output. |
| 547 | - ``len`` - Length of the string in bytes. |
| 548 | |
| 549 | **Return Values** |
| 550 | |
| 551 | - Positive values - Number of bytes output. |
| 552 | - ``TFM_HAL_ERROR_NOT_INIT`` - The log device has not been initialized. |
| 553 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - Invalid inputs when ``str`` is ``NULL`` or |
| 554 | ``len`` is zero. |
| 555 | |
| 556 | **Note** |
| 557 | |
| 558 | None. |
| 559 | |
| 560 | tfm_hal_output_spm_log() |
| 561 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 562 | **Prototype** |
| 563 | |
| 564 | .. code-block:: c |
| 565 | |
| 566 | int32_t tfm_hal_output_spm_log(const unsigned char *str, uint32_t len) |
| 567 | |
| 568 | **Description** |
| 569 | |
| 570 | This API is called by :term:`SPM` to output logs. |
| 571 | |
| 572 | **Parameter** |
| 573 | |
| 574 | - ``str`` - The string to output. |
| 575 | - ``len`` - Length of the string in bytes. |
| 576 | |
| 577 | **Return Values** |
| 578 | |
| 579 | - Positive numbers - Number of bytes output. |
| 580 | - ``TFM_HAL_ERROR_NOT_INIT`` - The log device has not been initialized. |
| 581 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - Invalid inputs when ``str`` is ``NULL`` |
| 582 | or ``len`` is zero. |
| 583 | |
| 584 | **Note** |
| 585 | |
| 586 | Please check :doc:`TF-M log system <tfm_log_system_design_document>` for more |
| 587 | information. |
| 588 | |
Kevin Peng | d399a1f | 2021-09-08 15:33:14 +0800 | [diff] [blame] | 589 | Interrupt APIs |
| 590 | ============== |
| 591 | |
| 592 | The SPM HAL interrupt APIs are intended for operations on Interrupt Controllers |
| 593 | of platforms. |
| 594 | |
| 595 | APIs for control registers of interrupt sources are not in the scope of this set |
| 596 | of APIs. |
| 597 | Secure Partitions should define the APIs for managing interrupts with those MMIO |
| 598 | registers. |
| 599 | |
| 600 | APIs |
| 601 | ---- |
| 602 | |
| 603 | tfm_hal_irq_enable() |
| 604 | ^^^^^^^^^^^^^^^^^^^^ |
| 605 | |
| 606 | **Prototype** |
| 607 | |
| 608 | .. code-block:: c |
| 609 | |
| 610 | enum tfm_hal_status_t tfm_hal_irq_enable(uint32_t irq_num) |
| 611 | |
| 612 | **Description** |
| 613 | |
| 614 | This API enables an interrupt from the Interrupt Controller of the platform. |
| 615 | |
| 616 | **Parameter** |
| 617 | |
| 618 | - ``irq_num`` - the interrupt to be enabled with a number |
| 619 | |
| 620 | **Return Values** |
| 621 | |
| 622 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - the ``irq_num`` exceeds The maximum |
| 623 | supported number of external interrupts. |
| 624 | - ``TFM_HAL_ERROR_GENERIC`` - failed to enable the interrupt. |
| 625 | - ``TFM_HAL_SUCCESS`` - the interrupt is successfully enabled. |
| 626 | |
| 627 | tfm_hal_irq_disable() |
| 628 | ^^^^^^^^^^^^^^^^^^^^^ |
| 629 | |
| 630 | **Prototype** |
| 631 | |
| 632 | .. code-block:: c |
| 633 | |
| 634 | enum tfm_hal_status_t tfm_hal_irq_disable(uint32_t irq_num) |
| 635 | |
| 636 | **Description** |
| 637 | |
| 638 | This API disables an interrupt from the Interrupt Controller of the platform. |
| 639 | |
| 640 | **Parameter** |
| 641 | |
| 642 | - ``irq_num`` - the interrupt to be disabled with a number |
| 643 | |
| 644 | **Return Values** |
| 645 | |
| 646 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - the ``irq_num`` exceeds The maximum |
| 647 | supported number of external interrupts. |
| 648 | - ``TFM_HAL_ERROR_GENERIC`` - failed to disable the interrupt. |
| 649 | - ``TFM_HAL_SUCCESS`` - the interrupt is successfully disabled. |
| 650 | |
| 651 | tfm_hal_irq_clear_pending() |
| 652 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 653 | |
| 654 | **Prototype** |
| 655 | |
| 656 | .. code-block:: c |
| 657 | |
| 658 | enum tfm_hal_status_t tfm_hal_irq_clear_pending(uint32_t irq_num) |
| 659 | |
| 660 | **Description** |
| 661 | |
| 662 | This API clears an active and pending interrupt. |
| 663 | |
| 664 | **Parameter** |
| 665 | |
| 666 | - ``irq_num`` - the interrupt to be disabled with a number |
| 667 | |
| 668 | **Return Values** |
| 669 | |
| 670 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - the ``irq_num`` exceeds The maximum |
| 671 | supported number of external interrupts. |
| 672 | - ``TFM_HAL_ERROR_GENERIC`` - failed to clear the pending interrupt. |
| 673 | - ``TFM_HAL_SUCCESS`` - the pending interrupt has been cleared. |
| 674 | |
Kevin Peng | ec239bb | 2021-09-03 15:40:27 +0800 | [diff] [blame] | 675 | Initializations |
| 676 | ^^^^^^^^^^^^^^^ |
| 677 | |
| 678 | **Prototype** |
| 679 | |
| 680 | .. code-block:: c |
| 681 | |
| 682 | enum tfm_hal_status_t {source_symbol}_init(void *p_pt, |
Chris Brand | 11ff8a5 | 2022-10-18 17:46:50 -0700 | [diff] [blame] | 683 | const struct irq_load_info_t *p_ildi) |
Kevin Peng | ec239bb | 2021-09-03 15:40:27 +0800 | [diff] [blame] | 684 | |
| 685 | The ``{source_symbol}`` is: |
| 686 | |
| 687 | - ``irq_{source}``, if the ``source`` attribute of the IRQ in Partition manifest |
| 688 | is a number |
| 689 | - Lowercase of ``source`` attribute, if ``source`` is a symbolic name |
| 690 | |
| 691 | **Description** |
| 692 | |
| 693 | Each interrupt has an initialization function individually. |
| 694 | The :term:`SPM` calls the functions while loading the Partitions. |
| 695 | |
| 696 | The following initializations are required for each interrupt: |
| 697 | |
| 698 | - Setting the priority. The value must between 0 to 0x80 exclusively. |
| 699 | - Ensuring that the interrupt targets the Secure State. |
| 700 | - Saving the input parameters for future use. |
| 701 | |
| 702 | Platforms can have extra initializations as well. |
| 703 | |
| 704 | **Parameter** |
| 705 | |
| 706 | - ``p_pt`` - pointer to Partition runtime struct of the owner Partition |
| 707 | - ``p_ildi`` - pointer to ``irq_load_info_t`` struct of the interrupt |
| 708 | |
| 709 | **Note** |
| 710 | |
| 711 | Please refer to the |
| 712 | :doc: `IRQ intergration guide<tfm_secure_irq_integration_guide>` |
| 713 | for more information. |
| 714 | |
Edison Ai | b28b971 | 2020-06-04 14:41:23 +0800 | [diff] [blame] | 715 | ************************************ |
| 716 | API Definition for Secure Partitions |
| 717 | ************************************ |
| 718 | The Secure Partition (SP) :term:`HAL` mainly focuses on two parts: |
| 719 | |
| 720 | - Peripheral devices. The peripherals accessed by the :term:`TF-M` default |
| 721 | Secure Partitions. |
| 722 | - Secure Partition abstraction support. The Secure Partition data that must be |
| 723 | provided by the platform. |
| 724 | |
| 725 | The Secure Partition abstraction support will be introduced in the peripheral |
| 726 | API definition. |
| 727 | |
| 728 | ITS and PS flash API |
| 729 | ==================== |
| 730 | There are two kinds of flash: |
| 731 | |
| 732 | - Internal flash. Accessed by the PSA Internal Trusted Storage (ITS) service. |
| 733 | - External flash. Accessed by the PSA Protected Storage (PS) service. |
| 734 | |
| 735 | The ITS HAL for the internal flash device is defined in the ``tfm_hal_its.h`` |
| 736 | header and the PS HAL in the ``tfm_hal_ps.h`` header. |
| 737 | |
| 738 | Macros |
| 739 | ------ |
| 740 | Internal Trusted Storage |
| 741 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 742 | TFM_HAL_ITS_FLASH_DRIVER |
| 743 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 744 | Defines the identifier of the CMSIS Flash ARM_DRIVER_FLASH object to use for |
| 745 | ITS. It must have been allocated by the platform and will be declared extern in |
| 746 | the HAL header. |
| 747 | |
| 748 | TFM_HAL_ITS_PROGRAM_UNIT |
| 749 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 750 | Defines the size of the ITS flash device's physical program unit (the smallest |
| 751 | unit of data that can be individually programmed to flash). It must be equal to |
| 752 | TFM_HAL_ITS_FLASH_DRIVER.GetInfo()->program_unit, but made available at compile |
| 753 | time so that filesystem structures can be statically sized. |
| 754 | |
| 755 | TFM_HAL_ITS_FLASH_AREA_ADDR |
| 756 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 757 | Defines the base address of the dedicated flash area for ITS. |
| 758 | |
| 759 | TFM_HAL_ITS_FLASH_AREA_SIZE |
| 760 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 761 | Defines the size of the dedicated flash area for ITS in bytes. |
| 762 | |
| 763 | TFM_HAL_ITS_SECTORS_PER_BLOCK |
| 764 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 765 | Defines the number of contiguous physical flash erase sectors that form a |
| 766 | logical filesystem erase block. |
| 767 | |
| 768 | Protected Storage |
| 769 | ^^^^^^^^^^^^^^^^^ |
| 770 | TFM_HAL_PS_FLASH_DRIVER |
| 771 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 772 | Defines the identifier of the CMSIS Flash ARM_DRIVER_FLASH object to use for |
| 773 | PS. It must have been allocated by the platform and will be declared extern in |
| 774 | the HAL header. |
| 775 | |
| 776 | TFM_HAL_PS_PROGRAM_UNIT |
| 777 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 778 | Defines the size of the PS flash device's physical program unit (the smallest |
| 779 | unit of data that can be individually programmed to flash). It must be equal to |
| 780 | TFM_HAL_PS_FLASH_DRIVER.GetInfo()->program_unit, but made available at compile |
| 781 | time so that filesystem structures can be statically sized. |
| 782 | |
| 783 | TFM_HAL_PS_FLASH_AREA_ADDR |
| 784 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 785 | Defines the base address of the dedicated flash area for PS. |
| 786 | |
| 787 | TFM_HAL_PS_FLASH_AREA_SIZE |
| 788 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 789 | Defines the size of the dedicated flash area for PS in bytes. |
| 790 | |
| 791 | TFM_HAL_PS_SECTORS_PER_BLOCK |
| 792 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 793 | Defines the number of contiguous physical flash erase sectors that form a |
| 794 | logical filesystem erase block. |
| 795 | |
| 796 | Optional definitions |
| 797 | -------------------- |
| 798 | The ``TFM_HAL_ITS_FLASH_AREA_ADDR``, ``TFM_HAL_ITS_FLASH_AREA_SIZE`` and |
| 799 | ``TFM_HAL_ITS_SECTORS_PER_BLOCK`` definitions are optional. If not defined, the |
| 800 | platform must implement ``tfm_hal_its_fs_info()`` instead. |
| 801 | |
| 802 | Equivalently, ``tfm_hal_its_ps_info()`` must be implemented by the platform if |
| 803 | ``TFM_HAL_ITS_FLASH_AREA_ADDR``, ``TFM_HAL_ITS_FLASH_AREA_SIZE`` or |
| 804 | ``TFM_HAL_ITS_SECTORS_PER_BLOCK`` is not defined. |
| 805 | |
| 806 | Objects |
| 807 | ------- |
| 808 | ARM_DRIVER_FLASH |
| 809 | ^^^^^^^^^^^^^^^^ |
| 810 | The ITS and PS HAL headers each expose a CMSIS Flash Driver instance. |
| 811 | |
| 812 | .. code-block:: c |
| 813 | |
| 814 | extern ARM_DRIVER_FLASH TFM_HAL_ITS_FLASH_DRIVER |
| 815 | |
| 816 | extern ARM_DRIVER_FLASH TFM_HAL_PS_FLASH_DRIVER |
| 817 | |
| 818 | The CMSIS Flash Driver provides the flash primitives ReadData(), ProgramData() |
| 819 | and EraseSector() as well as GetInfo() to access flash device properties such |
| 820 | as the sector size. |
| 821 | |
| 822 | Types |
| 823 | ----- |
| 824 | tfm_hal_its_fs_info_t |
| 825 | ^^^^^^^^^^^^^^^^^^^^^ |
| 826 | Struct containing information required from the platform at runtime to configure |
| 827 | the ITS filesystem. |
| 828 | |
| 829 | .. code-block:: c |
| 830 | |
| 831 | struct tfm_hal_its_fs_info_t { |
| 832 | uint32_t flash_area_addr; |
| 833 | size_t flash_area_size; |
| 834 | uint8_t sectors_per_block; |
| 835 | }; |
| 836 | |
| 837 | Each attribute is described below: |
| 838 | |
| 839 | - ``flash_area_addr`` - Location of the block of flash to use for ITS |
| 840 | - ``flash_area_size`` - Number of bytes of flash to use for ITS |
| 841 | - ``sectors_per_block`` - Number of erase sectors per logical FS block |
| 842 | |
| 843 | tfm_hal_ps_fs_info_t |
| 844 | ^^^^^^^^^^^^^^^^^^^^^ |
| 845 | Struct containing information required from the platform at runtime to configure |
| 846 | the PS filesystem. |
| 847 | |
| 848 | .. code-block:: c |
| 849 | |
| 850 | struct tfm_hal_ps_fs_info_t { |
| 851 | uint32_t flash_area_addr; |
| 852 | size_t flash_area_size; |
| 853 | uint8_t sectors_per_block; |
| 854 | }; |
| 855 | |
| 856 | Each attribute is described below: |
| 857 | |
| 858 | - ``flash_area_addr`` - Location of the block of flash to use for PS |
| 859 | - ``flash_area_size`` - Number of bytes of flash to use for PS |
| 860 | - ``sectors_per_block`` - Number of erase sectors per logical FS block |
| 861 | |
| 862 | Functions |
| 863 | --------- |
| 864 | tfm_hal_its_fs_info() |
| 865 | ^^^^^^^^^^^^^^^^^^^^^ |
| 866 | **Prototype** |
| 867 | |
| 868 | .. code-block:: c |
| 869 | |
| 870 | enum tfm_hal_status_t tfm_hal_its_fs_info(struct tfm_hal_its_fs_info_t *fs_info); |
| 871 | |
| 872 | **Description** |
| 873 | |
| 874 | Retrieves the filesystem configuration parameters for ITS. |
| 875 | |
| 876 | **Parameter** |
| 877 | |
| 878 | - ``fs_info`` - Filesystem config information |
| 879 | |
| 880 | **Return values** |
| 881 | |
| 882 | - ``TFM_HAL_SUCCESS`` - The operation completed successfully |
| 883 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - Invalid parameter |
| 884 | |
| 885 | **Note** |
| 886 | |
| 887 | This function should ensure that the values returned do not result in a security |
| 888 | compromise. The block of flash supplied must meet the security requirements of |
| 889 | Internal Trusted Storage. |
| 890 | |
| 891 | tfm_hal_ps_fs_info() |
| 892 | ^^^^^^^^^^^^^^^^^^^^ |
| 893 | **Prototype** |
| 894 | |
| 895 | .. code-block:: c |
| 896 | |
| 897 | enum tfm_hal_status_t tfm_hal_ps_fs_info(struct tfm_hal_ps_fs_info_t *fs_info); |
| 898 | |
| 899 | **Description** |
| 900 | |
| 901 | Retrieves the filesystem configuration parameters for PS. |
| 902 | |
| 903 | **Parameter** |
| 904 | |
| 905 | - ``fs_info`` - Filesystem config information |
| 906 | |
| 907 | **Return values** |
| 908 | |
| 909 | - ``TFM_HAL_SUCCESS`` - The operation completed successfully |
| 910 | - ``TFM_HAL_ERROR_INVALID_INPUT`` - Invalid parameter |
| 911 | |
| 912 | **Note** |
| 913 | |
| 914 | This function should ensure that the values returned do not result in a security |
| 915 | compromise. |
| 916 | |
Edison Ai | 75afd37 | 2020-04-21 18:29:57 +0800 | [diff] [blame] | 917 | -------------- |
| 918 | |
Sebastian Bøe | 055d83a | 2022-02-21 12:01:41 +0100 | [diff] [blame] | 919 | *Copyright (c) 2020-2022, Arm Limited. All rights reserved.* |
Chris Brand | 11ff8a5 | 2022-10-18 17:46:50 -0700 | [diff] [blame] | 920 | *Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) |
| 921 | or an affiliate of Cypress Semiconductor Corporation. All rights reserved.* |