blob: 5fbb83a6cb65134ae705d1ca4fd3e45c38a919a8 [file] [log] [blame]
Soby Mathewc6820d12016-05-09 17:49:55 +01001/*
Antonio Nino Diazac998032017-02-27 17:23:54 +00002 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
Soby Mathewc6820d12016-05-09 17:49:55 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathewc6820d12016-05-09 17:49:55 +01005 */
6
7#ifndef __ARCH_H__
8#define __ARCH_H__
9
Isla Mitchell02c63072017-07-21 14:44:36 +010010#include <utils_def.h>
11
Soby Mathewc6820d12016-05-09 17:49:55 +010012/*******************************************************************************
13 * MIDR bit definitions
14 ******************************************************************************/
15#define MIDR_IMPL_MASK 0xff
16#define MIDR_IMPL_SHIFT 24
17#define MIDR_VAR_SHIFT 20
18#define MIDR_VAR_BITS 4
19#define MIDR_REV_SHIFT 0
20#define MIDR_REV_BITS 4
21#define MIDR_PN_MASK 0xfff
22#define MIDR_PN_SHIFT 4
23
24/*******************************************************************************
25 * MPIDR macros
26 ******************************************************************************/
Summer Qin93c812f2017-02-28 16:46:17 +000027#define MPIDR_MT_MASK (1 << 24)
Soby Mathewc6820d12016-05-09 17:49:55 +010028#define MPIDR_CPU_MASK MPIDR_AFFLVL_MASK
29#define MPIDR_CLUSTER_MASK (MPIDR_AFFLVL_MASK << MPIDR_AFFINITY_BITS)
30#define MPIDR_AFFINITY_BITS 8
31#define MPIDR_AFFLVL_MASK 0xff
32#define MPIDR_AFFLVL_SHIFT 3
33#define MPIDR_AFF0_SHIFT 0
34#define MPIDR_AFF1_SHIFT 8
35#define MPIDR_AFF2_SHIFT 16
36#define MPIDR_AFFINITY_MASK 0x00ffffff
37#define MPIDR_AFFLVL0 0
38#define MPIDR_AFFLVL1 1
39#define MPIDR_AFFLVL2 2
40
41#define MPIDR_AFFLVL0_VAL(mpidr) \
42 (((mpidr) >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK)
43#define MPIDR_AFFLVL1_VAL(mpidr) \
44 (((mpidr) >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK)
45#define MPIDR_AFFLVL2_VAL(mpidr) \
46 (((mpidr) >> MPIDR_AFF2_SHIFT) & MPIDR_AFFLVL_MASK)
47
48/*
49 * The MPIDR_MAX_AFFLVL count starts from 0. Take care to
50 * add one while using this macro to define array sizes.
51 */
52#define MPIDR_MAX_AFFLVL 2
53
54/* Data Cache set/way op type defines */
55#define DC_OP_ISW 0x0
56#define DC_OP_CISW 0x1
57#define DC_OP_CSW 0x2
58
59/*******************************************************************************
60 * Generic timer memory mapped registers & offsets
61 ******************************************************************************/
62#define CNTCR_OFF 0x000
63#define CNTFID_OFF 0x020
64
65#define CNTCR_EN (1 << 0)
66#define CNTCR_HDBG (1 << 1)
67#define CNTCR_FCREQ(x) ((x) << 8)
68
69/*******************************************************************************
70 * System register bit definitions
71 ******************************************************************************/
72/* CLIDR definitions */
73#define LOUIS_SHIFT 21
74#define LOC_SHIFT 24
75#define CLIDR_FIELD_WIDTH 3
76
77/* CSSELR definitions */
78#define LEVEL_SHIFT 1
79
80/* ID_PFR1 definitions */
81#define ID_PFR1_VIRTEXT_SHIFT 12
82#define ID_PFR1_VIRTEXT_MASK 0xf
83#define GET_VIRT_EXT(id) (((id) >> ID_PFR1_VIRTEXT_SHIFT) \
84 & ID_PFR1_VIRTEXT_MASK)
85#define ID_PFR1_GIC_SHIFT 28
86#define ID_PFR1_GIC_MASK 0xf
87
88/* SCTLR definitions */
89#define SCTLR_RES1 ((1 << 23) | (1 << 22) | (1 << 11) | (1 << 4) | \
Soby Mathewa993c422016-09-29 14:15:57 +010090 (1 << 3))
Soby Mathewc6820d12016-05-09 17:49:55 +010091#define SCTLR_M_BIT (1 << 0)
92#define SCTLR_A_BIT (1 << 1)
93#define SCTLR_C_BIT (1 << 2)
94#define SCTLR_CP15BEN_BIT (1 << 5)
95#define SCTLR_ITD_BIT (1 << 7)
96#define SCTLR_I_BIT (1 << 12)
97#define SCTLR_V_BIT (1 << 13)
98#define SCTLR_NTWI_BIT (1 << 16)
99#define SCTLR_NTWE_BIT (1 << 18)
100#define SCTLR_WXN_BIT (1 << 19)
101#define SCTLR_UWXN_BIT (1 << 20)
102#define SCTLR_EE_BIT (1 << 25)
103#define SCTLR_TRE_BIT (1 << 28)
104#define SCTLR_AFE_BIT (1 << 29)
105#define SCTLR_TE_BIT (1 << 30)
David Cunadofee86532017-04-13 22:38:29 +0100106#define SCTLR_RESET_VAL (SCTLR_RES1 | SCTLR_NTWE_BIT | \
107 SCTLR_NTWI_BIT | SCTLR_CP15BEN_BIT)
Soby Mathewc6820d12016-05-09 17:49:55 +0100108
dp-arm595d0d52017-02-08 11:51:50 +0000109/* SDCR definitions */
110#define SDCR_SPD(x) ((x) << 14)
111#define SDCR_SPD_LEGACY 0x0
112#define SDCR_SPD_DISABLE 0x2
113#define SDCR_SPD_ENABLE 0x3
David Cunadofee86532017-04-13 22:38:29 +0100114#define SDCR_RESET_VAL 0x0
dp-arm595d0d52017-02-08 11:51:50 +0000115
David Cunadofee86532017-04-13 22:38:29 +0100116#if !ERROR_DEPRECATED
dp-arm595d0d52017-02-08 11:51:50 +0000117#define SDCR_DEF_VAL SDCR_SPD(SDCR_SPD_DISABLE)
David Cunadofee86532017-04-13 22:38:29 +0100118#endif
dp-arm595d0d52017-02-08 11:51:50 +0000119
Soby Mathewc6820d12016-05-09 17:49:55 +0100120/* HSCTLR definitions */
121#define HSCTLR_RES1 ((1 << 29) | (1 << 28) | (1 << 23) | (1 << 22) \
122 | (1 << 18) | (1 << 16) | (1 << 11) | (1 << 4) \
Soby Mathewa993c422016-09-29 14:15:57 +0100123 | (1 << 3))
Soby Mathewc6820d12016-05-09 17:49:55 +0100124#define HSCTLR_M_BIT (1 << 0)
125#define HSCTLR_A_BIT (1 << 1)
126#define HSCTLR_C_BIT (1 << 2)
127#define HSCTLR_CP15BEN_BIT (1 << 5)
128#define HSCTLR_ITD_BIT (1 << 7)
129#define HSCTLR_SED_BIT (1 << 8)
130#define HSCTLR_I_BIT (1 << 12)
131#define HSCTLR_WXN_BIT (1 << 19)
132#define HSCTLR_EE_BIT (1 << 25)
133#define HSCTLR_TE_BIT (1 << 30)
134
135/* CPACR definitions */
136#define CPACR_FPEN(x) ((x) << 20)
137#define CPACR_FP_TRAP_PL0 0x1
138#define CPACR_FP_TRAP_ALL 0x2
139#define CPACR_FP_TRAP_NONE 0x3
140
141/* SCR definitions */
142#define SCR_TWE_BIT (1 << 13)
143#define SCR_TWI_BIT (1 << 12)
144#define SCR_SIF_BIT (1 << 9)
145#define SCR_HCE_BIT (1 << 8)
146#define SCR_SCD_BIT (1 << 7)
147#define SCR_NET_BIT (1 << 6)
148#define SCR_AW_BIT (1 << 5)
149#define SCR_FW_BIT (1 << 4)
150#define SCR_EA_BIT (1 << 3)
151#define SCR_FIQ_BIT (1 << 2)
152#define SCR_IRQ_BIT (1 << 1)
153#define SCR_NS_BIT (1 << 0)
154#define SCR_VALID_BIT_MASK 0x33ff
David Cunadofee86532017-04-13 22:38:29 +0100155#define SCR_RESET_VAL 0x0
Soby Mathewc6820d12016-05-09 17:49:55 +0100156
157#define GET_NS_BIT(scr) ((scr) & SCR_NS_BIT)
158
159/* HCR definitions */
160#define HCR_AMO_BIT (1 << 5)
161#define HCR_IMO_BIT (1 << 4)
162#define HCR_FMO_BIT (1 << 3)
David Cunadofee86532017-04-13 22:38:29 +0100163#define HCR_RESET_VAL 0x0
Soby Mathewc6820d12016-05-09 17:49:55 +0100164
165/* CNTHCTL definitions */
David Cunadofee86532017-04-13 22:38:29 +0100166#define CNTHCTL_RESET_VAL 0x0
Soby Mathewc6820d12016-05-09 17:49:55 +0100167#define PL1PCEN_BIT (1 << 1)
168#define PL1PCTEN_BIT (1 << 0)
169
170/* CNTKCTL definitions */
171#define PL0PTEN_BIT (1 << 9)
172#define PL0VTEN_BIT (1 << 8)
173#define PL0PCTEN_BIT (1 << 0)
174#define PL0VCTEN_BIT (1 << 1)
175#define EVNTEN_BIT (1 << 2)
176#define EVNTDIR_BIT (1 << 3)
177#define EVNTI_SHIFT 4
178#define EVNTI_MASK 0xf
179
180/* HCPTR definitions */
David Cunadofee86532017-04-13 22:38:29 +0100181#define HCPTR_RES1 ((1 << 13) | (1<<12) | 0x3ff)
Soby Mathewc6820d12016-05-09 17:49:55 +0100182#define TCPAC_BIT (1 << 31)
183#define TTA_BIT (1 << 20)
184#define TCP11_BIT (1 << 10)
185#define TCP10_BIT (1 << 10)
David Cunadofee86532017-04-13 22:38:29 +0100186#define HCPTR_RESET_VAL HCPTR_RES1
187
188/* VTTBR defintions */
189#define VTTBR_RESET_VAL ULL(0x0)
190#define VTTBR_VMID_MASK ULL(0xff)
191#define VTTBR_VMID_SHIFT 48
192#define VTTBR_BADDR_MASK 0xffffffffffff
193#define VTTBR_BADDR_SHIFT 0
194
195/* HDCR definitions */
196#define HDCR_RESET_VAL 0x0
197
198/* HSTR definitions */
199#define HSTR_RESET_VAL 0x0
200
201/* CNTHP_CTL definitions */
202#define CNTHP_CTL_RESET_VAL 0x0
Soby Mathewc6820d12016-05-09 17:49:55 +0100203
204/* NASCR definitions */
205#define NSASEDIS_BIT (1 << 15)
Yatharth Kocharf528faf2016-06-28 16:58:26 +0100206#define NSTRCDIS_BIT (1 << 20)
David Cunadofee86532017-04-13 22:38:29 +0100207/* NOTE: correct typo in the definitions */
208#if !ERROR_DEPRECATED
Soby Mathewc6820d12016-05-09 17:49:55 +0100209#define NASCR_CP11_BIT (1 << 11)
210#define NASCR_CP10_BIT (1 << 10)
David Cunadofee86532017-04-13 22:38:29 +0100211#endif
212#define NSACR_CP11_BIT (1 << 11)
213#define NSACR_CP10_BIT (1 << 10)
214#define NSACR_IMP_DEF_MASK (0x7 << 16)
215#define NSACR_ENABLE_FP_ACCESS (NSACR_CP11_BIT | NSACR_CP10_BIT)
216#define NSACR_RESET_VAL 0x0
Soby Mathewc6820d12016-05-09 17:49:55 +0100217
218/* CPACR definitions */
219#define ASEDIS_BIT (1 << 31)
220#define TRCDIS_BIT (1 << 28)
221#define CPACR_CP11_SHIFT 22
222#define CPACR_CP10_SHIFT 20
223#define CPACR_ENABLE_FP_ACCESS (0x3 << CPACR_CP11_SHIFT |\
224 0x3 << CPACR_CP10_SHIFT)
David Cunadofee86532017-04-13 22:38:29 +0100225#define CPACR_RESET_VAL 0x0
Soby Mathewc6820d12016-05-09 17:49:55 +0100226
227/* FPEXC definitions */
David Cunadofee86532017-04-13 22:38:29 +0100228#define FPEXC_RES1 ((1 << 10) | (1 << 9) | (1 << 8))
Soby Mathewc6820d12016-05-09 17:49:55 +0100229#define FPEXC_EN_BIT (1 << 30)
David Cunadofee86532017-04-13 22:38:29 +0100230#define FPEXC_RESET_VAL FPEXC_RES1
Soby Mathewc6820d12016-05-09 17:49:55 +0100231
232/* SPSR/CPSR definitions */
233#define SPSR_FIQ_BIT (1 << 0)
234#define SPSR_IRQ_BIT (1 << 1)
235#define SPSR_ABT_BIT (1 << 2)
236#define SPSR_AIF_SHIFT 6
237#define SPSR_AIF_MASK 0x7
238
239#define SPSR_E_SHIFT 9
240#define SPSR_E_MASK 0x1
241#define SPSR_E_LITTLE 0
242#define SPSR_E_BIG 1
243
244#define SPSR_T_SHIFT 5
245#define SPSR_T_MASK 0x1
246#define SPSR_T_ARM 0
247#define SPSR_T_THUMB 1
248
249#define SPSR_MODE_SHIFT 0
250#define SPSR_MODE_MASK 0x7
251
252
253#define DISABLE_ALL_EXCEPTIONS \
254 (SPSR_FIQ_BIT | SPSR_IRQ_BIT | SPSR_ABT_BIT)
255
256/*
257 * TTBCR definitions
258 */
259/* The ARM Trusted Firmware uses the long descriptor format */
260#define TTBCR_EAE_BIT (1 << 31)
261
262#define TTBCR_SH1_NON_SHAREABLE (0x0 << 28)
263#define TTBCR_SH1_OUTER_SHAREABLE (0x2 << 28)
264#define TTBCR_SH1_INNER_SHAREABLE (0x3 << 28)
265
266#define TTBCR_RGN1_OUTER_NC (0x0 << 26)
267#define TTBCR_RGN1_OUTER_WBA (0x1 << 26)
268#define TTBCR_RGN1_OUTER_WT (0x2 << 26)
269#define TTBCR_RGN1_OUTER_WBNA (0x3 << 26)
270
271#define TTBCR_RGN1_INNER_NC (0x0 << 24)
272#define TTBCR_RGN1_INNER_WBA (0x1 << 24)
273#define TTBCR_RGN1_INNER_WT (0x2 << 24)
274#define TTBCR_RGN1_INNER_WBNA (0x3 << 24)
275
276#define TTBCR_EPD1_BIT (1 << 23)
277#define TTBCR_A1_BIT (1 << 22)
278
279#define TTBCR_T1SZ_SHIFT 16
280#define TTBCR_T1SZ_MASK (0x7)
Antonio Nino Diazd48ae612016-08-02 09:21:41 +0100281#define TTBCR_TxSZ_MIN 0
282#define TTBCR_TxSZ_MAX 7
Soby Mathewc6820d12016-05-09 17:49:55 +0100283
284#define TTBCR_SH0_NON_SHAREABLE (0x0 << 12)
285#define TTBCR_SH0_OUTER_SHAREABLE (0x2 << 12)
286#define TTBCR_SH0_INNER_SHAREABLE (0x3 << 12)
287
288#define TTBCR_RGN0_OUTER_NC (0x0 << 10)
289#define TTBCR_RGN0_OUTER_WBA (0x1 << 10)
290#define TTBCR_RGN0_OUTER_WT (0x2 << 10)
291#define TTBCR_RGN0_OUTER_WBNA (0x3 << 10)
292
293#define TTBCR_RGN0_INNER_NC (0x0 << 8)
294#define TTBCR_RGN0_INNER_WBA (0x1 << 8)
295#define TTBCR_RGN0_INNER_WT (0x2 << 8)
296#define TTBCR_RGN0_INNER_WBNA (0x3 << 8)
297
298#define TTBCR_EPD0_BIT (1 << 7)
299#define TTBCR_T0SZ_SHIFT 0
300#define TTBCR_T0SZ_MASK (0x7)
301
302#define MODE_RW_SHIFT 0x4
303#define MODE_RW_MASK 0x1
304#define MODE_RW_32 0x1
305
306#define MODE32_SHIFT 0
307#define MODE32_MASK 0x1f
308#define MODE32_usr 0x10
309#define MODE32_fiq 0x11
310#define MODE32_irq 0x12
311#define MODE32_svc 0x13
312#define MODE32_mon 0x16
313#define MODE32_abt 0x17
314#define MODE32_hyp 0x1a
315#define MODE32_und 0x1b
316#define MODE32_sys 0x1f
317
318#define GET_M32(mode) (((mode) >> MODE32_SHIFT) & MODE32_MASK)
319
320#define SPSR_MODE32(mode, isa, endian, aif) \
321 (MODE_RW_32 << MODE_RW_SHIFT | \
322 ((mode) & MODE32_MASK) << MODE32_SHIFT | \
323 ((isa) & SPSR_T_MASK) << SPSR_T_SHIFT | \
324 ((endian) & SPSR_E_MASK) << SPSR_E_SHIFT | \
325 ((aif) & SPSR_AIF_MASK) << SPSR_AIF_SHIFT)
326
327/*
Isla Mitchellc4a1a072017-08-07 11:20:13 +0100328 * TTBR definitions
329 */
330#define TTBR_CNP_BIT 0x1
331
332/*
Soby Mathewc6820d12016-05-09 17:49:55 +0100333 * CTR definitions
334 */
335#define CTR_CWG_SHIFT 24
336#define CTR_CWG_MASK 0xf
337#define CTR_ERG_SHIFT 20
338#define CTR_ERG_MASK 0xf
339#define CTR_DMINLINE_SHIFT 16
340#define CTR_DMINLINE_WIDTH 4
341#define CTR_DMINLINE_MASK ((1 << 4) - 1)
342#define CTR_L1IP_SHIFT 14
343#define CTR_L1IP_MASK 0x3
344#define CTR_IMINLINE_SHIFT 0
345#define CTR_IMINLINE_MASK 0xf
346
347#define MAX_CACHE_LINE_SIZE 0x800 /* 2KB */
348
David Cunado5f55e282016-10-31 17:37:34 +0000349/* PMCR definitions */
350#define PMCR_N_SHIFT 11
351#define PMCR_N_MASK 0x1f
352#define PMCR_N_BITS (PMCR_N_MASK << PMCR_N_SHIFT)
353
Soby Mathewc6820d12016-05-09 17:49:55 +0100354/*******************************************************************************
Antonio Nino Diazac998032017-02-27 17:23:54 +0000355 * Definitions of register offsets, fields and macros for CPU system
356 * instructions.
357 ******************************************************************************/
358
359#define TLBI_ADDR_SHIFT 0
360#define TLBI_ADDR_MASK 0xFFFFF000
361#define TLBI_ADDR(x) (((x) >> TLBI_ADDR_SHIFT) & TLBI_ADDR_MASK)
362
363/*******************************************************************************
Soby Mathewc6820d12016-05-09 17:49:55 +0100364 * Definitions of register offsets and fields in the CNTCTLBase Frame of the
365 * system level implementation of the Generic Timer.
366 ******************************************************************************/
367#define CNTNSAR 0x4
368#define CNTNSAR_NS_SHIFT(x) (x)
369
370#define CNTACR_BASE(x) (0x40 + ((x) << 2))
371#define CNTACR_RPCT_SHIFT 0x0
372#define CNTACR_RVCT_SHIFT 0x1
373#define CNTACR_RFRQ_SHIFT 0x2
374#define CNTACR_RVOFF_SHIFT 0x3
375#define CNTACR_RWVT_SHIFT 0x4
376#define CNTACR_RWPT_SHIFT 0x5
377
378/* MAIR macros */
379#define MAIR0_ATTR_SET(attr, index) ((attr) << ((index) << 3))
380#define MAIR1_ATTR_SET(attr, index) ((attr) << (((index) - 3) << 3))
381
382/* System register defines The format is: coproc, opt1, CRn, CRm, opt2 */
383#define SCR p15, 0, c1, c1, 0
384#define SCTLR p15, 0, c1, c0, 0
dp-arm595d0d52017-02-08 11:51:50 +0000385#define SDCR p15, 0, c1, c3, 1
Soby Mathewc6820d12016-05-09 17:49:55 +0100386#define MPIDR p15, 0, c0, c0, 5
387#define MIDR p15, 0, c0, c0, 0
388#define VBAR p15, 0, c12, c0, 0
389#define MVBAR p15, 0, c12, c0, 1
390#define NSACR p15, 0, c1, c1, 2
391#define CPACR p15, 0, c1, c0, 2
392#define DCCIMVAC p15, 0, c7, c14, 1
393#define DCCMVAC p15, 0, c7, c10, 1
394#define DCIMVAC p15, 0, c7, c6, 1
395#define DCCISW p15, 0, c7, c14, 2
396#define DCCSW p15, 0, c7, c10, 2
397#define DCISW p15, 0, c7, c6, 2
398#define CTR p15, 0, c0, c0, 1
399#define CNTFRQ p15, 0, c14, c0, 0
400#define ID_PFR1 p15, 0, c0, c1, 1
401#define MAIR0 p15, 0, c10, c2, 0
402#define MAIR1 p15, 0, c10, c2, 1
403#define TTBCR p15, 0, c2, c0, 2
404#define TTBR0 p15, 0, c2, c0, 0
405#define TTBR1 p15, 0, c2, c0, 1
406#define TLBIALL p15, 0, c8, c7, 0
407#define TLBIALLIS p15, 0, c8, c3, 0
408#define TLBIMVA p15, 0, c8, c7, 1
409#define TLBIMVAA p15, 0, c8, c7, 3
Antonio Nino Diazac998032017-02-27 17:23:54 +0000410#define TLBIMVAAIS p15, 0, c8, c3, 3
411#define BPIALLIS p15, 0, c7, c1, 6
Soby Mathewc6820d12016-05-09 17:49:55 +0100412#define HSCTLR p15, 4, c1, c0, 0
413#define HCR p15, 4, c1, c1, 0
414#define HCPTR p15, 4, c1, c1, 2
David Cunadofee86532017-04-13 22:38:29 +0100415#define HSTR p15, 4, c1, c1, 3
Soby Mathewc6820d12016-05-09 17:49:55 +0100416#define CNTHCTL p15, 4, c14, c1, 0
Yatharth Kochar2694cba2016-11-14 12:00:41 +0000417#define CNTKCTL p15, 0, c14, c1, 0
Soby Mathewc6820d12016-05-09 17:49:55 +0100418#define VPIDR p15, 4, c0, c0, 0
419#define VMPIDR p15, 4, c0, c0, 5
420#define ISR p15, 0, c12, c1, 0
421#define CLIDR p15, 1, c0, c0, 1
422#define CSSELR p15, 2, c0, c0, 0
423#define CCSIDR p15, 1, c0, c0, 0
Yatharth Kochara9f776c2016-11-10 16:17:51 +0000424#define DBGOSDLR p14, 0, c1, c3, 4
Soby Mathewc6820d12016-05-09 17:49:55 +0100425
David Cunado5f55e282016-10-31 17:37:34 +0000426/* Debug register defines. The format is: coproc, opt1, CRn, CRm, opt2 */
427#define HDCR p15, 4, c1, c1, 1
David Cunado5f55e282016-10-31 17:37:34 +0000428#define PMCR p15, 0, c9, c12, 0
David Cunadoc14b08e2016-11-25 00:21:59 +0000429#define CNTHP_CTL p15, 4, c14, c2, 1
David Cunado5f55e282016-10-31 17:37:34 +0000430
Soby Mathewc6820d12016-05-09 17:49:55 +0100431/* GICv3 CPU Interface system register defines. The format is: coproc, opt1, CRn, CRm, opt2 */
432#define ICC_IAR1 p15, 0, c12, c12, 0
433#define ICC_IAR0 p15, 0, c12, c8, 0
434#define ICC_EOIR1 p15, 0, c12, c12, 1
435#define ICC_EOIR0 p15, 0, c12, c8, 1
436#define ICC_HPPIR1 p15, 0, c12, c12, 2
437#define ICC_HPPIR0 p15, 0, c12, c8, 2
438#define ICC_BPR1 p15, 0, c12, c12, 3
439#define ICC_BPR0 p15, 0, c12, c8, 3
440#define ICC_DIR p15, 0, c12, c11, 1
441#define ICC_PMR p15, 0, c4, c6, 0
442#define ICC_RPR p15, 0, c12, c11, 3
443#define ICC_CTLR p15, 0, c12, c12, 4
444#define ICC_MCTLR p15, 6, c12, c12, 4
445#define ICC_SRE p15, 0, c12, c12, 5
446#define ICC_HSRE p15, 4, c12, c9, 5
447#define ICC_MSRE p15, 6, c12, c12, 5
448#define ICC_IGRPEN0 p15, 0, c12, c12, 6
449#define ICC_IGRPEN1 p15, 0, c12, c12, 7
450#define ICC_MGRPEN1 p15, 6, c12, c12, 7
451
452/* 64 bit system register defines The format is: coproc, opt1, CRm */
453#define TTBR0_64 p15, 0, c2
454#define TTBR1_64 p15, 1, c2
455#define CNTVOFF_64 p15, 4, c14
456#define VTTBR_64 p15, 6, c2
457#define CNTPCT_64 p15, 0, c14
458
459/* 64 bit GICv3 CPU Interface system register defines. The format is: coproc, opt1, CRm */
460#define ICC_SGI1R_EL1_64 p15, 0, c12
461#define ICC_ASGI1R_EL1_64 p15, 1, c12
462#define ICC_SGI0R_EL1_64 p15, 2, c12
463
Isla Mitchell02c63072017-07-21 14:44:36 +0100464/*******************************************************************************
465 * Definitions of MAIR encodings for device and normal memory
466 ******************************************************************************/
467/*
468 * MAIR encodings for device memory attributes.
469 */
470#define MAIR_DEV_nGnRnE U(0x0)
471#define MAIR_DEV_nGnRE U(0x4)
472#define MAIR_DEV_nGRE U(0x8)
473#define MAIR_DEV_GRE U(0xc)
474
475/*
476 * MAIR encodings for normal memory attributes.
477 *
478 * Cache Policy
479 * WT: Write Through
480 * WB: Write Back
481 * NC: Non-Cacheable
482 *
483 * Transient Hint
484 * NTR: Non-Transient
485 * TR: Transient
486 *
487 * Allocation Policy
488 * RA: Read Allocate
489 * WA: Write Allocate
490 * RWA: Read and Write Allocate
491 * NA: No Allocation
492 */
493#define MAIR_NORM_WT_TR_WA U(0x1)
494#define MAIR_NORM_WT_TR_RA U(0x2)
495#define MAIR_NORM_WT_TR_RWA U(0x3)
496#define MAIR_NORM_NC U(0x4)
497#define MAIR_NORM_WB_TR_WA U(0x5)
498#define MAIR_NORM_WB_TR_RA U(0x6)
499#define MAIR_NORM_WB_TR_RWA U(0x7)
500#define MAIR_NORM_WT_NTR_NA U(0x8)
501#define MAIR_NORM_WT_NTR_WA U(0x9)
502#define MAIR_NORM_WT_NTR_RA U(0xa)
503#define MAIR_NORM_WT_NTR_RWA U(0xb)
504#define MAIR_NORM_WB_NTR_NA U(0xc)
505#define MAIR_NORM_WB_NTR_WA U(0xd)
506#define MAIR_NORM_WB_NTR_RA U(0xe)
507#define MAIR_NORM_WB_NTR_RWA U(0xf)
508
509#define MAIR_NORM_OUTER_SHIFT 4
510
511#define MAKE_MAIR_NORMAL_MEMORY(inner, outer) ((inner) | ((outer) << MAIR_NORM_OUTER_SHIFT))
512
Soby Mathewc6820d12016-05-09 17:49:55 +0100513#endif /* __ARCH_H__ */