blob: 4acf5512d7599ae2f07e89f3b6c6ea7f9fe029b9 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Dan Handleye83b0ca2014-01-14 18:17:09 +00002 * Copyright (c) 2013-2014, 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__
Achin Guptae4d084e2014-02-19 17:18:23 +000037#include <stdio.h>
Achin Gupta4f6ad662013-10-25 09:08:21 +010038
39/*******************************************************************************
40 * TLB maintenance accessor prototypes
41 ******************************************************************************/
Achin Gupta4f6ad662013-10-25 09:08:21 +010042extern void tlbialle1(void);
43extern void tlbialle1is(void);
44extern void tlbialle2(void);
45extern void tlbialle2is(void);
46extern void tlbialle3(void);
47extern void tlbialle3is(void);
48extern void tlbivmalle1(void);
49
50/*******************************************************************************
51 * Cache maintenance accessor prototypes
52 ******************************************************************************/
53extern void dcisw(unsigned long);
54extern void dccisw(unsigned long);
55extern void dccsw(unsigned long);
56extern void dccvac(unsigned long);
57extern void dcivac(unsigned long);
58extern void dccivac(unsigned long);
59extern void dccvau(unsigned long);
60extern void dczva(unsigned long);
61extern void flush_dcache_range(unsigned long, unsigned long);
62extern void inv_dcache_range(unsigned long, unsigned long);
63extern void dcsw_op_louis(unsigned int);
64extern void dcsw_op_all(unsigned int);
65
66/*******************************************************************************
67 * Misc. accessor prototypes
68 ******************************************************************************/
69extern void enable_irq(void);
70extern void enable_fiq(void);
71extern void enable_serror(void);
Sandrine Bailleux37382742013-11-18 17:26:59 +000072extern void enable_debug_exceptions(void);
Achin Gupta4f6ad662013-10-25 09:08:21 +010073
74extern void disable_irq(void);
75extern void disable_fiq(void);
76extern void disable_serror(void);
Sandrine Bailleux37382742013-11-18 17:26:59 +000077extern void disable_debug_exceptions(void);
Achin Gupta4f6ad662013-10-25 09:08:21 +010078
79extern unsigned long read_id_pfr1_el1(void);
80extern unsigned long read_id_aa64pfr0_el1(void);
81extern unsigned long read_current_el(void);
82extern unsigned long read_daif(void);
83extern unsigned long read_spsr(void);
84extern unsigned long read_spsr_el1(void);
85extern unsigned long read_spsr_el2(void);
86extern unsigned long read_spsr_el3(void);
87extern unsigned long read_elr(void);
88extern unsigned long read_elr_el1(void);
89extern unsigned long read_elr_el2(void);
90extern unsigned long read_elr_el3(void);
91
92extern void write_daif(unsigned long);
93extern void write_spsr(unsigned long);
94extern void write_spsr_el1(unsigned long);
95extern void write_spsr_el2(unsigned long);
96extern void write_spsr_el3(unsigned long);
97extern void write_elr(unsigned long);
98extern void write_elr_el1(unsigned long);
99extern void write_elr_el2(unsigned long);
100extern void write_elr_el3(unsigned long);
101
102extern void wfi(void);
103extern void wfe(void);
104extern void rfe(void);
105extern void sev(void);
106extern void dsb(void);
107extern void isb(void);
108
109extern unsigned int get_afflvl_shift(unsigned int);
110extern unsigned int mpidr_mask_lower_afflvls(unsigned long, unsigned int);
111
Achin Guptae4d084e2014-02-19 17:18:23 +0000112extern void __dead2 eret(unsigned long, unsigned long,
113 unsigned long, unsigned long,
114 unsigned long, unsigned long,
115 unsigned long, unsigned long);
Achin Gupta4f6ad662013-10-25 09:08:21 +0100116
Achin Guptae4d084e2014-02-19 17:18:23 +0000117extern void __dead2 smc(unsigned long, unsigned long,
118 unsigned long, unsigned long,
119 unsigned long, unsigned long,
Achin Gupta4f6ad662013-10-25 09:08:21 +0100120 unsigned long, unsigned long);
121
122/*******************************************************************************
123 * System register accessor prototypes
124 ******************************************************************************/
125extern unsigned long read_midr(void);
126extern unsigned long read_mpidr(void);
127
128extern unsigned long read_scr(void);
129extern unsigned long read_hcr(void);
130
131extern unsigned long read_vbar(void);
132extern unsigned long read_vbar_el1(void);
133extern unsigned long read_vbar_el2(void);
134extern unsigned long read_vbar_el3(void);
135
136extern unsigned long read_sctlr(void);
137extern unsigned long read_sctlr_el1(void);
138extern unsigned long read_sctlr_el2(void);
139extern unsigned long read_sctlr_el3(void);
140
141extern unsigned long read_actlr(void);
142extern unsigned long read_actlr_el1(void);
143extern unsigned long read_actlr_el2(void);
144extern unsigned long read_actlr_el3(void);
145
146extern unsigned long read_esr(void);
147extern unsigned long read_esr_el1(void);
148extern unsigned long read_esr_el2(void);
149extern unsigned long read_esr_el3(void);
150
151extern unsigned long read_afsr0(void);
152extern unsigned long read_afsr0_el1(void);
153extern unsigned long read_afsr0_el2(void);
154extern unsigned long read_afsr0_el3(void);
155
156extern unsigned long read_afsr1(void);
157extern unsigned long read_afsr1_el1(void);
158extern unsigned long read_afsr1_el2(void);
159extern unsigned long read_afsr1_el3(void);
160
161extern unsigned long read_far(void);
162extern unsigned long read_far_el1(void);
163extern unsigned long read_far_el2(void);
164extern unsigned long read_far_el3(void);
165
166extern unsigned long read_mair(void);
167extern unsigned long read_mair_el1(void);
168extern unsigned long read_mair_el2(void);
169extern unsigned long read_mair_el3(void);
170
171extern unsigned long read_amair(void);
172extern unsigned long read_amair_el1(void);
173extern unsigned long read_amair_el2(void);
174extern unsigned long read_amair_el3(void);
175
176extern unsigned long read_rvbar(void);
177extern unsigned long read_rvbar_el1(void);
178extern unsigned long read_rvbar_el2(void);
179extern unsigned long read_rvbar_el3(void);
180
181extern unsigned long read_rmr(void);
182extern unsigned long read_rmr_el1(void);
183extern unsigned long read_rmr_el2(void);
184extern unsigned long read_rmr_el3(void);
185
186extern unsigned long read_tcr(void);
187extern unsigned long read_tcr_el1(void);
188extern unsigned long read_tcr_el2(void);
189extern unsigned long read_tcr_el3(void);
190
191extern unsigned long read_ttbr0(void);
192extern unsigned long read_ttbr0_el1(void);
193extern unsigned long read_ttbr0_el2(void);
194extern unsigned long read_ttbr0_el3(void);
195
196extern unsigned long read_ttbr1(void);
197extern unsigned long read_ttbr1_el1(void);
198extern unsigned long read_ttbr1_el2(void);
199
200extern unsigned long read_cptr(void);
201extern unsigned long read_cptr_el2(void);
202extern unsigned long read_cptr_el3(void);
203
204extern unsigned long read_cpacr(void);
205extern unsigned long read_cpuectlr(void);
206extern unsigned int read_cntfrq_el0(void);
207extern unsigned long read_cnthctl_el2(void);
208
209extern void write_scr(unsigned long);
210extern void write_hcr(unsigned long);
211extern void write_cpacr(unsigned long);
212extern void write_cntfrq_el0(unsigned int);
213extern void write_cnthctl_el2(unsigned long);
214
215extern void write_vbar(unsigned long);
216extern void write_vbar_el1(unsigned long);
217extern void write_vbar_el2(unsigned long);
218extern void write_vbar_el3(unsigned long);
219
220extern void write_sctlr(unsigned long);
221extern void write_sctlr_el1(unsigned long);
222extern void write_sctlr_el2(unsigned long);
223extern void write_sctlr_el3(unsigned long);
224
225extern void write_actlr(unsigned long);
226extern void write_actlr_el1(unsigned long);
227extern void write_actlr_el2(unsigned long);
228extern void write_actlr_el3(unsigned long);
229
230extern void write_esr(unsigned long);
231extern void write_esr_el1(unsigned long);
232extern void write_esr_el2(unsigned long);
233extern void write_esr_el3(unsigned long);
234
235extern void write_afsr0(unsigned long);
236extern void write_afsr0_el1(unsigned long);
237extern void write_afsr0_el2(unsigned long);
238extern void write_afsr0_el3(unsigned long);
239
240extern void write_afsr1(unsigned long);
241extern void write_afsr1_el1(unsigned long);
242extern void write_afsr1_el2(unsigned long);
243extern void write_afsr1_el3(unsigned long);
244
245extern void write_far(unsigned long);
246extern void write_far_el1(unsigned long);
247extern void write_far_el2(unsigned long);
248extern void write_far_el3(unsigned long);
249
250extern void write_mair(unsigned long);
251extern void write_mair_el1(unsigned long);
252extern void write_mair_el2(unsigned long);
253extern void write_mair_el3(unsigned long);
254
255extern void write_amair(unsigned long);
256extern void write_amair_el1(unsigned long);
257extern void write_amair_el2(unsigned long);
258extern void write_amair_el3(unsigned long);
259
260extern void write_rmr(unsigned long);
261extern void write_rmr_el1(unsigned long);
262extern void write_rmr_el2(unsigned long);
263extern void write_rmr_el3(unsigned long);
264
265extern void write_tcr(unsigned long);
266extern void write_tcr_el1(unsigned long);
267extern void write_tcr_el2(unsigned long);
268extern void write_tcr_el3(unsigned long);
269
270extern void write_ttbr0(unsigned long);
271extern void write_ttbr0_el1(unsigned long);
272extern void write_ttbr0_el2(unsigned long);
273extern void write_ttbr0_el3(unsigned long);
274
275extern void write_ttbr1(unsigned long);
276extern void write_ttbr1_el1(unsigned long);
277extern void write_ttbr1_el2(unsigned long);
278
279extern void write_cptr(unsigned long);
280extern void write_cpuectlr(unsigned long);
281extern void write_cptr_el2(unsigned long);
282extern void write_cptr_el3(unsigned long);
283
284#endif /*__ASSEMBLY__*/
285
286#endif /* __ARCH_HELPERS_H__ */