blob: 12ab570ef53207a976be89b13496ffa492ccd4d0 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Dan Handleyab2d31e2013-12-02 19:25:12 +00002 * Copyright (c) 2013, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef __ARCH_HELPERS_H__
32#define __ARCH_HELPERS_H__
33
34#include <arch.h>
35
Achin Gupta4f6ad662013-10-25 09:08:21 +010036#ifndef __ASSEMBLY__
37
38/*******************************************************************************
39 * TLB maintenance accessor prototypes
40 ******************************************************************************/
Achin Gupta4f6ad662013-10-25 09:08:21 +010041extern void tlbialle1(void);
42extern void tlbialle1is(void);
43extern void tlbialle2(void);
44extern void tlbialle2is(void);
45extern void tlbialle3(void);
46extern void tlbialle3is(void);
47extern void tlbivmalle1(void);
48
49/*******************************************************************************
50 * Cache maintenance accessor prototypes
51 ******************************************************************************/
52extern void dcisw(unsigned long);
53extern void dccisw(unsigned long);
54extern void dccsw(unsigned long);
55extern void dccvac(unsigned long);
56extern void dcivac(unsigned long);
57extern void dccivac(unsigned long);
58extern void dccvau(unsigned long);
59extern void dczva(unsigned long);
60extern void flush_dcache_range(unsigned long, unsigned long);
61extern void inv_dcache_range(unsigned long, unsigned long);
62extern void dcsw_op_louis(unsigned int);
63extern void dcsw_op_all(unsigned int);
64
65/*******************************************************************************
66 * Misc. accessor prototypes
67 ******************************************************************************/
68extern void enable_irq(void);
69extern void enable_fiq(void);
70extern void enable_serror(void);
Sandrine Bailleux37382742013-11-18 17:26:59 +000071extern void enable_debug_exceptions(void);
Achin Gupta4f6ad662013-10-25 09:08:21 +010072
73extern void disable_irq(void);
74extern void disable_fiq(void);
75extern void disable_serror(void);
Sandrine Bailleux37382742013-11-18 17:26:59 +000076extern void disable_debug_exceptions(void);
Achin Gupta4f6ad662013-10-25 09:08:21 +010077
78extern unsigned long read_id_pfr1_el1(void);
79extern unsigned long read_id_aa64pfr0_el1(void);
80extern unsigned long read_current_el(void);
81extern unsigned long read_daif(void);
82extern unsigned long read_spsr(void);
83extern unsigned long read_spsr_el1(void);
84extern unsigned long read_spsr_el2(void);
85extern unsigned long read_spsr_el3(void);
86extern unsigned long read_elr(void);
87extern unsigned long read_elr_el1(void);
88extern unsigned long read_elr_el2(void);
89extern unsigned long read_elr_el3(void);
90
91extern void write_daif(unsigned long);
92extern void write_spsr(unsigned long);
93extern void write_spsr_el1(unsigned long);
94extern void write_spsr_el2(unsigned long);
95extern void write_spsr_el3(unsigned long);
96extern void write_elr(unsigned long);
97extern void write_elr_el1(unsigned long);
98extern void write_elr_el2(unsigned long);
99extern void write_elr_el3(unsigned long);
100
101extern void wfi(void);
102extern void wfe(void);
103extern void rfe(void);
104extern void sev(void);
105extern void dsb(void);
106extern void isb(void);
107
108extern unsigned int get_afflvl_shift(unsigned int);
109extern unsigned int mpidr_mask_lower_afflvls(unsigned long, unsigned int);
110
111extern void eret(unsigned long, unsigned long,
112 unsigned long, unsigned long,
113 unsigned long, unsigned long,
114 unsigned long, unsigned long);
115
116extern unsigned long smc(unsigned long, unsigned long,
117 unsigned long, unsigned long,
118 unsigned long, unsigned long,
119 unsigned long, unsigned long);
120
121/*******************************************************************************
122 * System register accessor prototypes
123 ******************************************************************************/
124extern unsigned long read_midr(void);
125extern unsigned long read_mpidr(void);
126
127extern unsigned long read_scr(void);
128extern unsigned long read_hcr(void);
129
130extern unsigned long read_vbar(void);
131extern unsigned long read_vbar_el1(void);
132extern unsigned long read_vbar_el2(void);
133extern unsigned long read_vbar_el3(void);
134
135extern unsigned long read_sctlr(void);
136extern unsigned long read_sctlr_el1(void);
137extern unsigned long read_sctlr_el2(void);
138extern unsigned long read_sctlr_el3(void);
139
140extern unsigned long read_actlr(void);
141extern unsigned long read_actlr_el1(void);
142extern unsigned long read_actlr_el2(void);
143extern unsigned long read_actlr_el3(void);
144
145extern unsigned long read_esr(void);
146extern unsigned long read_esr_el1(void);
147extern unsigned long read_esr_el2(void);
148extern unsigned long read_esr_el3(void);
149
150extern unsigned long read_afsr0(void);
151extern unsigned long read_afsr0_el1(void);
152extern unsigned long read_afsr0_el2(void);
153extern unsigned long read_afsr0_el3(void);
154
155extern unsigned long read_afsr1(void);
156extern unsigned long read_afsr1_el1(void);
157extern unsigned long read_afsr1_el2(void);
158extern unsigned long read_afsr1_el3(void);
159
160extern unsigned long read_far(void);
161extern unsigned long read_far_el1(void);
162extern unsigned long read_far_el2(void);
163extern unsigned long read_far_el3(void);
164
165extern unsigned long read_mair(void);
166extern unsigned long read_mair_el1(void);
167extern unsigned long read_mair_el2(void);
168extern unsigned long read_mair_el3(void);
169
170extern unsigned long read_amair(void);
171extern unsigned long read_amair_el1(void);
172extern unsigned long read_amair_el2(void);
173extern unsigned long read_amair_el3(void);
174
175extern unsigned long read_rvbar(void);
176extern unsigned long read_rvbar_el1(void);
177extern unsigned long read_rvbar_el2(void);
178extern unsigned long read_rvbar_el3(void);
179
180extern unsigned long read_rmr(void);
181extern unsigned long read_rmr_el1(void);
182extern unsigned long read_rmr_el2(void);
183extern unsigned long read_rmr_el3(void);
184
185extern unsigned long read_tcr(void);
186extern unsigned long read_tcr_el1(void);
187extern unsigned long read_tcr_el2(void);
188extern unsigned long read_tcr_el3(void);
189
190extern unsigned long read_ttbr0(void);
191extern unsigned long read_ttbr0_el1(void);
192extern unsigned long read_ttbr0_el2(void);
193extern unsigned long read_ttbr0_el3(void);
194
195extern unsigned long read_ttbr1(void);
196extern unsigned long read_ttbr1_el1(void);
197extern unsigned long read_ttbr1_el2(void);
198
199extern unsigned long read_cptr(void);
200extern unsigned long read_cptr_el2(void);
201extern unsigned long read_cptr_el3(void);
202
203extern unsigned long read_cpacr(void);
204extern unsigned long read_cpuectlr(void);
205extern unsigned int read_cntfrq_el0(void);
206extern unsigned long read_cnthctl_el2(void);
207
208extern void write_scr(unsigned long);
209extern void write_hcr(unsigned long);
210extern void write_cpacr(unsigned long);
211extern void write_cntfrq_el0(unsigned int);
212extern void write_cnthctl_el2(unsigned long);
213
214extern void write_vbar(unsigned long);
215extern void write_vbar_el1(unsigned long);
216extern void write_vbar_el2(unsigned long);
217extern void write_vbar_el3(unsigned long);
218
219extern void write_sctlr(unsigned long);
220extern void write_sctlr_el1(unsigned long);
221extern void write_sctlr_el2(unsigned long);
222extern void write_sctlr_el3(unsigned long);
223
224extern void write_actlr(unsigned long);
225extern void write_actlr_el1(unsigned long);
226extern void write_actlr_el2(unsigned long);
227extern void write_actlr_el3(unsigned long);
228
229extern void write_esr(unsigned long);
230extern void write_esr_el1(unsigned long);
231extern void write_esr_el2(unsigned long);
232extern void write_esr_el3(unsigned long);
233
234extern void write_afsr0(unsigned long);
235extern void write_afsr0_el1(unsigned long);
236extern void write_afsr0_el2(unsigned long);
237extern void write_afsr0_el3(unsigned long);
238
239extern void write_afsr1(unsigned long);
240extern void write_afsr1_el1(unsigned long);
241extern void write_afsr1_el2(unsigned long);
242extern void write_afsr1_el3(unsigned long);
243
244extern void write_far(unsigned long);
245extern void write_far_el1(unsigned long);
246extern void write_far_el2(unsigned long);
247extern void write_far_el3(unsigned long);
248
249extern void write_mair(unsigned long);
250extern void write_mair_el1(unsigned long);
251extern void write_mair_el2(unsigned long);
252extern void write_mair_el3(unsigned long);
253
254extern void write_amair(unsigned long);
255extern void write_amair_el1(unsigned long);
256extern void write_amair_el2(unsigned long);
257extern void write_amair_el3(unsigned long);
258
259extern void write_rmr(unsigned long);
260extern void write_rmr_el1(unsigned long);
261extern void write_rmr_el2(unsigned long);
262extern void write_rmr_el3(unsigned long);
263
264extern void write_tcr(unsigned long);
265extern void write_tcr_el1(unsigned long);
266extern void write_tcr_el2(unsigned long);
267extern void write_tcr_el3(unsigned long);
268
269extern void write_ttbr0(unsigned long);
270extern void write_ttbr0_el1(unsigned long);
271extern void write_ttbr0_el2(unsigned long);
272extern void write_ttbr0_el3(unsigned long);
273
274extern void write_ttbr1(unsigned long);
275extern void write_ttbr1_el1(unsigned long);
276extern void write_ttbr1_el2(unsigned long);
277
278extern void write_cptr(unsigned long);
279extern void write_cpuectlr(unsigned long);
280extern void write_cptr_el2(unsigned long);
281extern void write_cptr_el3(unsigned long);
282
283#endif /*__ASSEMBLY__*/
284
285#endif /* __ARCH_HELPERS_H__ */