From 6eb5db39d04d137915232a0b0eba9630244b205c Mon Sep 17 00:00:00 2001 From: Nina Wu Date: Tue, 5 Sep 2023 16:47:45 +0800 Subject: soc/mediatek: Move common devapc definitions to common/ Move following definitions to common/ 1) the definition of the bit fields for domain remap 2) the definition of the structure for the permission of all domains Change-Id: Iac84ebc908ae384a6280388af4120f6349a32ed4 Signed-off-by: Nina Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/77860 Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) --- .../mediatek/common/include/soc/devapc_common.h | 46 +++++++++++++++++++++- src/soc/mediatek/mt8186/include/soc/devapc.h | 20 ---------- src/soc/mediatek/mt8188/include/soc/devapc.h | 12 ------ src/soc/mediatek/mt8195/include/soc/devapc.h | 36 ----------------- 4 files changed, 44 insertions(+), 70 deletions(-) (limited to 'src/soc/mediatek') diff --git a/src/soc/mediatek/common/include/soc/devapc_common.h b/src/soc/mediatek/common/include/soc/devapc_common.h index ab718d2500..7e01e65c2e 100644 --- a/src/soc/mediatek/common/include/soc/devapc_common.h +++ b/src/soc/mediatek/common/include/soc/devapc_common.h @@ -3,6 +3,19 @@ #ifndef SOC_MEDIATEK_COMMON_DEVAPC_H #define SOC_MEDIATEK_COMMON_DEVAPC_H +/* Permission Setting */ +struct apc_infra_peri_dom_16 { + unsigned char d_permission[16]; +}; + +struct apc_infra_peri_dom_8 { + unsigned char d_permission[8]; +}; + +struct apc_infra_peri_dom_4 { + unsigned char d_permission[4]; +}; + #define DAPC_PERM_ATTR_4(DEV_NAME, PERM_ATTR0, PERM_ATTR1, \ PERM_ATTR2, PERM_ATTR3) \ (unsigned char)PERM_ATTR0, (unsigned char)PERM_ATTR1, \ @@ -36,8 +49,9 @@ #define FORBIDDEN5 FORBIDDEN4, FORBIDDEN #define FORBIDDEN6 FORBIDDEN5, FORBIDDEN #define FORBIDDEN7 FORBIDDEN6, FORBIDDEN -#define FORBIDDEN9 FORBIDDEN7, FORBIDDEN2 -#define FORBIDDEN10 FORBIDDEN3, FORBIDDEN7 +#define FORBIDDEN8 FORBIDDEN7, FORBIDDEN +#define FORBIDDEN9 FORBIDDEN8, FORBIDDEN +#define FORBIDDEN10 FORBIDDEN9, FORBIDDEN #define FORBIDDEN11 FORBIDDEN10, FORBIDDEN #define FORBIDDEN12 FORBIDDEN11, FORBIDDEN #define FORBIDDEN13 FORBIDDEN12, FORBIDDEN @@ -48,6 +62,34 @@ #define NO_PROTECTION3 NO_PROTECTION2, NO_PROTECTION #define NO_PROTECTION4 NO_PROTECTION3, NO_PROTECTION +/* Domain Remap */ +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_0, 3, 0) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_1, 7, 4) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_2, 11, 8) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_3, 15, 12) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_4, 19, 16) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_5, 23, 20) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_6, 27, 24) +DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_7, 31, 28) + +DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_0, 2, 0) +DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_1, 5, 3) +DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_2, 8, 6) +DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_3, 11, 9) +DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_4, 14, 12) +DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_5, 17, 15) + +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_0, 1, 0) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_1, 3, 2) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_2, 5, 4) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_3, 7, 6) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_4, 9, 8) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_5, 11, 10) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_6, 13, 12) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_7, 15, 14) +DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_8, 17, 16) + +/* Attribute */ enum trans_type { NON_SECURE_TRANS = 0, SECURE_TRANS, diff --git a/src/soc/mediatek/mt8186/include/soc/devapc.h b/src/soc/mediatek/mt8186/include/soc/devapc.h index eab8cb2cbf..c1d2c7223c 100644 --- a/src/soc/mediatek/mt8186/include/soc/devapc.h +++ b/src/soc/mediatek/mt8186/include/soc/devapc.h @@ -25,18 +25,6 @@ enum devapc_ao_offset { /****************************************************************************** * STRUCTURE DEFINITION ******************************************************************************/ -struct apc_infra_peri_dom_16 { - unsigned char d_permission[16]; -}; - -struct apc_infra_peri_dom_8 { - unsigned char d_permission[8]; -}; - -struct apc_infra_peri_dom_4 { - unsigned char d_permission[4]; -}; - enum devapc_sys_dom_num { DOM_NUM_INFRA_AO_SYS0 = 8, DOM_NUM_MM_AO_SYS0 = 4, @@ -67,12 +55,4 @@ DEFINE_BITFIELD(SPM_DOM, 11, 8) DEFINE_BITFIELD(SCP_DOM, 3, 0) DEFINE_BITFIELD(ADSP_DOM, 3, 0) -/* Domain Remap */ -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_0, 1, 0) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_1, 3, 2) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_2, 5, 4) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_3, 7, 6) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_4, 9, 8) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_5, 11, 10) - #endif diff --git a/src/soc/mediatek/mt8188/include/soc/devapc.h b/src/soc/mediatek/mt8188/include/soc/devapc.h index 1ea71bfe5a..161ae9b28b 100644 --- a/src/soc/mediatek/mt8188/include/soc/devapc.h +++ b/src/soc/mediatek/mt8188/include/soc/devapc.h @@ -21,18 +21,6 @@ DEFINE_BIT(MCUPM_SEC, 1) /****************************************************************************** * STRUCTURE DEFINITION ******************************************************************************/ -struct apc_infra_peri_dom_16 { - unsigned char d_permission[16]; -}; - -struct apc_infra_peri_dom_8 { - unsigned char d_permission[8]; -}; - -struct apc_infra_peri_dom_4 { - unsigned char d_permission[4]; -}; - enum devapc_sys_dom_num { DOM_NUM_INFRA_AO_SYS0 = 16, DOM_NUM_INFRA_AO_SYS1 = 4, diff --git a/src/soc/mediatek/mt8195/include/soc/devapc.h b/src/soc/mediatek/mt8195/include/soc/devapc.h index ecf171eba3..f25f67784a 100644 --- a/src/soc/mediatek/mt8195/include/soc/devapc.h +++ b/src/soc/mediatek/mt8195/include/soc/devapc.h @@ -30,18 +30,6 @@ enum scp_offset { /****************************************************************************** * STRUCTURE DEFINITION ******************************************************************************/ -struct apc_infra_peri_dom_16 { - unsigned char d_permission[16]; -}; - -struct apc_infra_peri_dom_8 { - unsigned char d_permission[8]; -}; - -struct apc_infra_peri_dom_4 { - unsigned char d_permission[4]; -}; - enum devapc_sys_dom_num { DOM_NUM_INFRA_AO_SYS0 = 16, DOM_NUM_INFRA_AO_SYS1 = 4, @@ -95,28 +83,4 @@ DEFINE_BIT(SSUSB_P3_SEC, 4) DEFINE_BITFIELD(PCIE0_DOM, 11, 8) /* 17 */ DEFINE_BITFIELD(PCIE1_DOM, 19, 16) /* 18 */ -/* Domain Remap */ -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_0, 3, 0) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_1, 7, 4) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_2, 11, 8) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_3, 15, 12) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_4, 19, 16) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_5, 23, 20) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_6, 27, 24) -DEFINE_BITFIELD(FOUR_BIT_DOM_REMAP_7, 31, 28) - -DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_0, 2, 0) -DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_1, 5, 3) -DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_2, 8, 6) -DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_3, 11, 9) -DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_4, 14, 12) -DEFINE_BITFIELD(THREE_BIT_DOM_REMAP_5, 17, 15) - -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_0, 1, 0) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_1, 3, 2) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_2, 5, 4) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_3, 7, 6) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_4, 9, 8) -DEFINE_BITFIELD(TWO_BIT_DOM_REMAP_5, 11, 10) - #endif /* SOC_MEDIATEK_MT8195_DEVAPC_H */ -- cgit v1.2.3