Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2018 NXP |
| 4 | */ |
| 5 | |
| 6 | #ifndef SC_RM_API_H |
| 7 | #define SC_RM_API_H |
| 8 | |
Peng Fan | 2e0644a | 2023-04-28 12:08:09 +0800 | [diff] [blame] | 9 | #include <firmware/imx/sci/types.h> |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 10 | |
| 11 | /* Defines for type widths */ |
| 12 | #define SC_RM_PARTITION_W 5U /* Width of sc_rm_pt_t */ |
| 13 | #define SC_RM_MEMREG_W 6U /* Width of sc_rm_mr_t */ |
| 14 | #define SC_RM_DID_W 4U /* Width of sc_rm_did_t */ |
| 15 | #define SC_RM_SID_W 6U /* Width of sc_rm_sid_t */ |
| 16 | #define SC_RM_SPA_W 2U /* Width of sc_rm_spa_t */ |
| 17 | #define SC_RM_PERM_W 3U /* Width of sc_rm_perm_t */ |
| 18 | |
| 19 | /* Defines for ALL parameters */ |
| 20 | #define SC_RM_PT_ALL ((sc_rm_pt_t)UINT8_MAX) /* All partitions */ |
| 21 | #define SC_RM_MR_ALL ((sc_rm_mr_t)UINT8_MAX) /* All memory regions */ |
| 22 | |
| 23 | /* Defines for sc_rm_spa_t */ |
| 24 | #define SC_RM_SPA_PASSTHRU 0U /* Pass through (attribute driven by master) */ |
| 25 | #define SC_RM_SPA_PASSSID 1U /* Pass through and output on SID */ |
| 26 | #define SC_RM_SPA_ASSERT 2U /* Assert (force to be secure/privileged) */ |
| 27 | #define SC_RM_SPA_NEGATE 3U /* Negate (force to be non-secure/user) */ |
| 28 | |
| 29 | /* Defines for sc_rm_perm_t */ |
| 30 | #define SC_RM_PERM_NONE 0U /* No access */ |
| 31 | #define SC_RM_PERM_SEC_R 1U /* Secure RO */ |
| 32 | #define SC_RM_PERM_SECPRIV_RW 2U /* Secure privilege R/W */ |
| 33 | #define SC_RM_PERM_SEC_RW 3U /* Secure R/W */ |
| 34 | #define SC_RM_PERM_NSPRIV_R 4U /* Secure R/W, non-secure privilege RO */ |
| 35 | #define SC_RM_PERM_NS_R 5U /* Secure R/W, non-secure RO */ |
| 36 | #define SC_RM_PERM_NSPRIV_RW 6U /* Secure R/W, non-secure privilege R/W */ |
| 37 | #define SC_RM_PERM_FULL 7U /* Full access */ |
| 38 | |
| 39 | /* Types */ |
| 40 | |
Peng Fan | e89a391 | 2023-06-15 18:09:04 +0800 | [diff] [blame] | 41 | /* |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 42 | * This type is used to declare a resource partition. |
| 43 | */ |
| 44 | typedef u8 sc_rm_pt_t; |
| 45 | |
Peng Fan | e89a391 | 2023-06-15 18:09:04 +0800 | [diff] [blame] | 46 | /* |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 47 | * This type is used to declare a memory region. |
| 48 | */ |
| 49 | typedef u8 sc_rm_mr_t; |
| 50 | |
Peng Fan | e89a391 | 2023-06-15 18:09:04 +0800 | [diff] [blame] | 51 | /* |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 52 | * This type is used to declare a resource domain ID used by the |
| 53 | * isolation HW. |
| 54 | */ |
| 55 | typedef u8 sc_rm_did_t; |
| 56 | |
Peng Fan | e89a391 | 2023-06-15 18:09:04 +0800 | [diff] [blame] | 57 | /* |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 58 | * This type is used to declare an SMMU StreamID. |
| 59 | */ |
| 60 | typedef u16 sc_rm_sid_t; |
| 61 | |
Peng Fan | e89a391 | 2023-06-15 18:09:04 +0800 | [diff] [blame] | 62 | /* |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 63 | * This type is a used to declare master transaction attributes. |
| 64 | */ |
| 65 | typedef u8 sc_rm_spa_t; |
| 66 | |
Peng Fan | e89a391 | 2023-06-15 18:09:04 +0800 | [diff] [blame] | 67 | /* |
| 68 | * This type is used to declare a resource/memory region access permission. |
| 69 | * Refer to the XRDC2 Block Guide for more information. |
| 70 | */ |
Peng Fan | 0c830d3 | 2018-10-18 14:28:07 +0200 | [diff] [blame] | 71 | typedef u8 sc_rm_perm_t; |
| 72 | |
| 73 | #endif /* SC_RM_API_H */ |