xref: /rk3399_ARM-atf/drivers/qti/accesscontrol/vmidmt/vmidmt_internal.h (revision 5de3e03dbd7c2da6748e294f423c83f9582f459c)
1 /*
2  * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef VMIDMT_INTERNAL_H
8 #define VMIDMT_INTERNAL_H
9 
10 #include <stdint.h>
11 
12 #include <vmidmt_hal.h>
13 
14 #define ACC_VMIDMT_ERR_INT_STATUS_REG_NUM 1
15 #define ACC_VMIDMT_ERR_NUM_PER_REG 32
16 
17 #define VMIDMT_ERR_OPT                                                  \
18 	(HAL_VMIDMT_ERROR_O_SMCFCFG_EN | HAL_VMIDMT_ERROR_O_USFCFG_EN | \
19 	 HAL_VMIDMT_ERROR_O_GCFGFIE | HAL_VMIDMT_ERROR_O_GCFGFRE |      \
20 	 HAL_VMIDMT_ERROR_O_GFIE)
21 
22 /* Default MemType when not overridden (implementation defined). */
23 #define ACC_VMIDMT_MEMTYPE_DEFAULT 0xFF
24 #define ACC_VMIDMT_MEMTYPE_STRONGLY_ORDERED 0
25 
26 struct vmidmt_err_pos_to_hal_map {
27 	uint8_t bit_pos; /* Bit position in status register */
28 	uint8_t vmidmt; /* Corresponding HAL VMIDMT index */
29 };
30 
31 struct vmidmt_cfg {
32 	uint8_t table; /* VMIDMT master port ID */
33 	uint8_t err_opt; /* Error reporting options */
34 	hal_vmidmt_secure_status_det *ssd_table; /* Pointer to SSD table */
35 	uint8_t ssd_table_num_elements; /* Number of SSD elements */
36 	uint8_t static_cfg; /* 1: configured statically at boot; 0: runtime */
37 };
38 
39 struct vmidmt_map {
40 	uint8_t table; /* VMIDMT master port ID */
41 	uint8_t index; /* Master index before VMID mapping */
42 	uint32_t sid_list[5]; /* SID list */
43 	uint8_t num_sids; /* Number of SIDs */
44 	uint8_t vmid; /* VMID to assign */
45 	uint8_t static_cfg; /* 1: static at boot; 0: configured at runtime */
46 	uint8_t memattr; /* Non-default memory attribute override */
47 };
48 
49 #endif /* VMIDMT_INTERNAL_H */
50