1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright 2012-2016 Freescale Semiconductor, Inc.
9 #define CONFIG_NUM_PAMU 16
10 #define NUM_PPAACT_ENTRIES 512
11 #define NUM_SPAACT_ENTRIES 256
13 /* PAMU_OFFSET to the next pamu space in ccsr */
14 #define PAMU_OFFSET 0x1000
16 #define PAMU_TABLE_ALIGNMENT 0x00001000
18 #define PAMU_PAGE_SHIFT 12
19 #define PAMU_PAGE_SIZE 4096U
21 #define PAACE_M_COHERENCE_REQ 0x01
23 #define PAACE_DA_HOST_CR 0x80
24 #define PAACE_DA_HOST_CR_SHIFT 7
26 #define PAACE_AF_PT 0x00000002
27 #define PAACE_AF_PT_SHIFT 1
29 #define PAACE_PT_PRIMARY 0x0
30 #define PAACE_PT_SECONDARY 0x1
32 #define PPAACE_AF_WBAL 0xfffff000
33 #define PPAACE_AF_WBAL_SHIFT 12
35 #define OME_NUMBER_ENTRIES 16 /* based on P4080 2.0 silicon plan */
37 #define PAACE_IA_CID 0x00FF0000
38 #define PAACE_IA_CID_SHIFT 16
39 #define PAACE_IA_WCE 0x000000F0
40 #define PAACE_IA_WCE_SHIFT 4
41 #define PAACE_IA_ATM 0x0000000C
42 #define PAACE_IA_ATM_SHIFT 2
43 #define PAACE_IA_OTM 0x00000003
44 #define PAACE_IA_OTM_SHIFT 0
46 #define PAACE_OTM_NO_XLATE 0x00
47 #define PAACE_OTM_IMMEDIATE 0x01
48 #define PAACE_OTM_INDEXED 0x02
49 #define PAACE_OTM_RESERVED 0x03
50 #define PAACE_ATM_NO_XLATE 0x00
51 #define PAACE_ATM_WINDOW_XLATE 0x01
52 #define PAACE_ATM_PAGE_XLATE 0x02
53 #define PAACE_ATM_WIN_PG_XLATE \
54 (PAACE_ATM_WINDOW_XLATE | PAACE_ATM_PAGE_XLATE)
55 #define PAACE_WIN_TWBAL 0xfffff000
56 #define PAACE_WIN_TWBAL_SHIFT 12
57 #define PAACE_WIN_SWSE 0x00000fc0
58 #define PAACE_WIN_SWSE_SHIFT 6
60 #define PAACE_AF_AP 0x00000018
61 #define PAACE_AF_AP_SHIFT 3
62 #define PAACE_AF_DD 0x00000004
63 #define PAACE_AF_DD_SHIFT 2
64 #define PAACE_AF_PT 0x00000002
65 #define PAACE_AF_PT_SHIFT 1
66 #define PAACE_AF_V 0x00000001
67 #define PAACE_AF_V_SHIFT 0
68 #define PPAACE_AF_WSE 0x00000fc0
69 #define PPAACE_AF_WSE_SHIFT 6
70 #define PPAACE_AF_MW 0x00000020
71 #define PPAACE_AF_MW_SHIFT 5
73 #define PAACE_AP_PERMS_DENIED 0x0
74 #define PAACE_AP_PERMS_QUERY 0x1
75 #define PAACE_AP_PERMS_UPDATE 0x2
76 #define PAACE_AP_PERMS_ALL 0x3
78 #define SPAACE_AF_LIODN 0xffff0000
79 #define SPAACE_AF_LIODN_SHIFT 16
80 #define PAACE_V_VALID 0x1
82 #define set_bf(v, m, x) (v = ((v) & ~(m)) | (((x) << \
84 #define get_bf(v, m) (((v) & (m)) >> (m##_SHIFT))
86 #define DEFAULT_NUM_SUBWINDOWS 128
87 #define PAMU_PCR_OFFSET 0xc10
88 #define PAMU_PCR_PE 0x40000000
90 struct pamu_addr_tbl {
91 phys_addr_t start_addr[10];
92 phys_addr_t end_addr[10];
97 /* PAACE Offset 0x00 */
98 uint32_t wbah; /* only valid for Primary PAACE */
99 uint32_t addr_bitfields; /* See P/S PAACE_AF_* */
101 /* PAACE Offset 0x08 */
102 /* Interpretation of first 32 bits dependent on DD above */
105 /* Destination ID, see PAACE_DID_* defines */
111 /* coherency_required : 1 reserved : 7 */
112 uint8_t coherency_required; /* See PAACE_DA_* */
115 /* Destination ID, see PAACE_DID_* defines */
122 /* Implementation attributes + window count + address & operation
125 uint32_t impl_attr; /* See PAACE_IA_* */
127 /* PAACE Offset 0x10 */
128 /* Translated window base address */
130 uint32_t win_bitfields; /* See PAACE_WIN_* */
132 /* PAACE Offset 0x18 */
133 /* first secondary paace entry */
134 uint32_t fspi; /* only valid for Primary PAACE */
148 /* PAACE Offset 0x20 */
149 uint32_t reserved1[2]; /* not currently implemented */
151 /* PAACE Offset 0x28 */
152 uint32_t reserved2[2]; /* not currently implemented */
154 /* PAACE Offset 0x30 */
155 uint32_t reserved3[2]; /* not currently implemented */
157 /* PAACE Offset 0x38 */
158 uint32_t reserved4[2]; /* not currently implemented */
163 void pamu_enable(void);
164 void pamu_disable(void);
165 int config_pamu(struct pamu_addr_tbl *tbl, int num_entries, uint32_t liodn);
166 int sec_config_pamu_table(uint32_t liodn_ns, uint32_t liodn_s);