xref: /arm-trusted-firmware/plat/nxp/common/aarch64/bl31_data.S (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu/*
2*91f16700Schasinglulu * Copyright 2018-2020 NXP
3*91f16700Schasinglulu *
4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu *
6*91f16700Schasinglulu */
7*91f16700Schasinglulu
8*91f16700Schasinglulu#include <asm_macros.S>
9*91f16700Schasinglulu
10*91f16700Schasinglulu#include "bl31_data.h"
11*91f16700Schasinglulu#include "plat_psci.h"
12*91f16700Schasinglulu#include "platform_def.h"
13*91f16700Schasinglulu
14*91f16700Schasinglulu.global _getCoreData
15*91f16700Schasinglulu.global _setCoreData
16*91f16700Schasinglulu.global _getCoreState
17*91f16700Schasinglulu.global _setCoreState
18*91f16700Schasinglulu.global _init_global_data
19*91f16700Schasinglulu.global _get_global_data
20*91f16700Schasinglulu.global _set_global_data
21*91f16700Schasinglulu.global _initialize_psci
22*91f16700Schasinglulu.global _init_task_flags
23*91f16700Schasinglulu.global _set_task1_start
24*91f16700Schasinglulu.global _set_task1_done
25*91f16700Schasinglulu
26*91f16700Schasinglulu
27*91f16700Schasinglulu/* Function returns the specified data field value from the specified cpu
28*91f16700Schasinglulu * core data area
29*91f16700Schasinglulu * in:  x0 = core mask lsb
30*91f16700Schasinglulu *	x1 = data field name/offset
31*91f16700Schasinglulu * out: x0 = data value
32*91f16700Schasinglulu * uses x0, x1, x2, [x13, x14, x15]
33*91f16700Schasinglulu */
34*91f16700Schasinglulufunc _getCoreData
35*91f16700Schasinglulu
36*91f16700Schasinglulu	/* generate a 0-based core number from the input mask */
37*91f16700Schasinglulu	clz   x2, x0
38*91f16700Schasinglulu	mov   x0, #63
39*91f16700Schasinglulu	sub   x0, x0, x2
40*91f16700Schasinglulu
41*91f16700Schasinglulu	/* x0 = core number (0-based) */
42*91f16700Schasinglulu	/* x1 = field offset */
43*91f16700Schasinglulu
44*91f16700Schasinglulu	/* determine if this is bootcore or secondary core */
45*91f16700Schasinglulu	cbnz  x0, 1f
46*91f16700Schasinglulu
47*91f16700Schasinglulu	/* get base address for bootcore data */
48*91f16700Schasinglulu	ldr  x2, =BC_PSCI_BASE
49*91f16700Schasinglulu	add  x2, x2, x1
50*91f16700Schasinglulu	b	2f
51*91f16700Schasinglulu
52*91f16700Schasinglulu1:	/* get base address for secondary core data */
53*91f16700Schasinglulu
54*91f16700Schasinglulu	/* x0 = core number (0-based) */
55*91f16700Schasinglulu	/* x1 = field offset */
56*91f16700Schasinglulu
57*91f16700Schasinglulu	/* generate number of regions to offset */
58*91f16700Schasinglulu	mov   x2, #SEC_REGION_SIZE
59*91f16700Schasinglulu	mul   x2, x2, x0
60*91f16700Schasinglulu
61*91f16700Schasinglulu	/* x1 = field offset */
62*91f16700Schasinglulu	/* x2 = region offset */
63*91f16700Schasinglulu
64*91f16700Schasinglulu	/* generate the total offset to data element */
65*91f16700Schasinglulu	sub   x1, x2, x1
66*91f16700Schasinglulu
67*91f16700Schasinglulu	/* x1 = total offset to data element */
68*91f16700Schasinglulu
69*91f16700Schasinglulu	/* get the base address */
70*91f16700Schasinglulu	ldr   x2, =SECONDARY_TOP
71*91f16700Schasinglulu
72*91f16700Schasinglulu	/* apply offset to base addr */
73*91f16700Schasinglulu	sub   x2, x2, x1
74*91f16700Schasinglulu2:
75*91f16700Schasinglulu	/* x2 = data element address */
76*91f16700Schasinglulu
77*91f16700Schasinglulu	dc   ivac, x2
78*91f16700Schasinglulu	dsb  sy
79*91f16700Schasinglulu	isb
80*91f16700Schasinglulu	/* read data */
81*91f16700Schasinglulu	ldr  x0, [x2]
82*91f16700Schasinglulu
83*91f16700Schasinglulu	ret
84*91f16700Schasingluluendfunc _getCoreData
85*91f16700Schasinglulu
86*91f16700Schasinglulu
87*91f16700Schasinglulu/* Function returns the SoC-specific state of the specified cpu
88*91f16700Schasinglulu * in:  x0 = core mask lsb
89*91f16700Schasinglulu * out: x0 = data value
90*91f16700Schasinglulu * uses x0, x1, x2, [x13, x14, x15]
91*91f16700Schasinglulu */
92*91f16700Schasinglulufunc _getCoreState
93*91f16700Schasinglulu
94*91f16700Schasinglulu	mov   x1, #CORE_STATE_DATA
95*91f16700Schasinglulu
96*91f16700Schasinglulu	/* generate a 0-based core number from the input mask */
97*91f16700Schasinglulu	clz   x2, x0
98*91f16700Schasinglulu	mov   x0, #63
99*91f16700Schasinglulu	sub   x0, x0, x2
100*91f16700Schasinglulu
101*91f16700Schasinglulu	/* x0 = core number (0-based) */
102*91f16700Schasinglulu	/* x1 = field offset */
103*91f16700Schasinglulu
104*91f16700Schasinglulu	/* determine if this is bootcore or secondary core */
105*91f16700Schasinglulu	cbnz  x0, 1f
106*91f16700Schasinglulu
107*91f16700Schasinglulu	/* get base address for bootcore data */
108*91f16700Schasinglulu	ldr  x2, =BC_PSCI_BASE
109*91f16700Schasinglulu	add  x2, x2, x1
110*91f16700Schasinglulu	b	2f
111*91f16700Schasinglulu
112*91f16700Schasinglulu1:	/* get base address for secondary core data */
113*91f16700Schasinglulu
114*91f16700Schasinglulu	/* x0 = core number (0-based) */
115*91f16700Schasinglulu	/* x1 = field offset */
116*91f16700Schasinglulu
117*91f16700Schasinglulu	/* generate number of regions to offset */
118*91f16700Schasinglulu	mov   x2, #SEC_REGION_SIZE
119*91f16700Schasinglulu	mul   x2, x2, x0
120*91f16700Schasinglulu
121*91f16700Schasinglulu	/* x1 = field offset */
122*91f16700Schasinglulu	/* x2 = region offset */
123*91f16700Schasinglulu
124*91f16700Schasinglulu	/* generate the total offset to data element */
125*91f16700Schasinglulu	sub   x1, x2, x1
126*91f16700Schasinglulu
127*91f16700Schasinglulu	/* x1 = total offset to data element */
128*91f16700Schasinglulu
129*91f16700Schasinglulu	/* get the base address */
130*91f16700Schasinglulu	ldr   x2, =SECONDARY_TOP
131*91f16700Schasinglulu
132*91f16700Schasinglulu	/* apply offset to base addr */
133*91f16700Schasinglulu	sub   x2, x2, x1
134*91f16700Schasinglulu2:
135*91f16700Schasinglulu	/* x2 = data element address */
136*91f16700Schasinglulu
137*91f16700Schasinglulu	dc   ivac, x2
138*91f16700Schasinglulu	dsb  sy
139*91f16700Schasinglulu	isb
140*91f16700Schasinglulu
141*91f16700Schasinglulu	/* read data */
142*91f16700Schasinglulu	ldr  x0, [x2]
143*91f16700Schasinglulu
144*91f16700Schasinglulu	ret
145*91f16700Schasingluluendfunc _getCoreState
146*91f16700Schasinglulu
147*91f16700Schasinglulu
148*91f16700Schasinglulu/* Function writes the specified data value into the specified cpu
149*91f16700Schasinglulu * core data area
150*91f16700Schasinglulu * in:  x0 = core mask lsb
151*91f16700Schasinglulu *	  x1 = data field offset
152*91f16700Schasinglulu *	  x2 = data value to write/store
153*91f16700Schasinglulu * out: none
154*91f16700Schasinglulu * uses x0, x1, x2, x3, [x13, x14, x15]
155*91f16700Schasinglulu */
156*91f16700Schasinglulufunc _setCoreData
157*91f16700Schasinglulu	/* x0 = core mask */
158*91f16700Schasinglulu	/* x1 = field offset */
159*91f16700Schasinglulu	/* x2 = data value */
160*91f16700Schasinglulu
161*91f16700Schasinglulu	clz   x3, x0
162*91f16700Schasinglulu	mov   x0, #63
163*91f16700Schasinglulu	sub   x0, x0, x3
164*91f16700Schasinglulu
165*91f16700Schasinglulu	/* x0 = core number (0-based) */
166*91f16700Schasinglulu	/* x1 = field offset */
167*91f16700Schasinglulu	/* x2 = data value */
168*91f16700Schasinglulu
169*91f16700Schasinglulu	/* determine if this is bootcore or secondary core */
170*91f16700Schasinglulu	cbnz  x0, 1f
171*91f16700Schasinglulu
172*91f16700Schasinglulu	/* get base address for bootcore data */
173*91f16700Schasinglulu	ldr  x3, =BC_PSCI_BASE
174*91f16700Schasinglulu	add  x3, x3, x1
175*91f16700Schasinglulu	b	2f
176*91f16700Schasinglulu
177*91f16700Schasinglulu1:	/* get base address for secondary core data */
178*91f16700Schasinglulu
179*91f16700Schasinglulu	/* x0 = core number (0-based) */
180*91f16700Schasinglulu	/* x1 = field offset */
181*91f16700Schasinglulu	/* x2 = data value */
182*91f16700Schasinglulu
183*91f16700Schasinglulu	/* generate number of regions to offset */
184*91f16700Schasinglulu	mov   x3, #SEC_REGION_SIZE
185*91f16700Schasinglulu	mul   x3, x3, x0
186*91f16700Schasinglulu
187*91f16700Schasinglulu	/* x1 = field offset */
188*91f16700Schasinglulu	/* x2 = data value */
189*91f16700Schasinglulu	/* x3 = region offset */
190*91f16700Schasinglulu
191*91f16700Schasinglulu	/* generate the total offset to data element */
192*91f16700Schasinglulu	sub   x1, x3, x1
193*91f16700Schasinglulu
194*91f16700Schasinglulu	/* x1 = total offset to data element */
195*91f16700Schasinglulu	/* x2 = data value */
196*91f16700Schasinglulu
197*91f16700Schasinglulu	ldr   x3, =SECONDARY_TOP
198*91f16700Schasinglulu
199*91f16700Schasinglulu	/* apply offset to base addr */
200*91f16700Schasinglulu	sub   x3, x3, x1
201*91f16700Schasinglulu
202*91f16700Schasinglulu2:
203*91f16700Schasinglulu	/* x2 = data value */
204*91f16700Schasinglulu	/* x3 = data element address */
205*91f16700Schasinglulu
206*91f16700Schasinglulu	str   x2, [x3]
207*91f16700Schasinglulu
208*91f16700Schasinglulu	dc	cvac, x3
209*91f16700Schasinglulu	dsb   sy
210*91f16700Schasinglulu	isb
211*91f16700Schasinglulu	ret
212*91f16700Schasingluluendfunc _setCoreData
213*91f16700Schasinglulu
214*91f16700Schasinglulu
215*91f16700Schasinglulu/* Function stores the specified core state
216*91f16700Schasinglulu * in:  x0 = core mask lsb
217*91f16700Schasinglulu *	x1 = data value to write/store
218*91f16700Schasinglulu * out: none
219*91f16700Schasinglulu * uses x0, x1, x2, x3, [x13, x14, x15]
220*91f16700Schasinglulu */
221*91f16700Schasinglulufunc _setCoreState
222*91f16700Schasinglulu	mov  x2, #CORE_STATE_DATA
223*91f16700Schasinglulu
224*91f16700Schasinglulu	clz   x3, x0
225*91f16700Schasinglulu	mov   x0, #63
226*91f16700Schasinglulu	sub   x0, x0, x3
227*91f16700Schasinglulu
228*91f16700Schasinglulu	/* x0 = core number (0-based) */
229*91f16700Schasinglulu	/* x1 = data value */
230*91f16700Schasinglulu	/* x2 = field offset */
231*91f16700Schasinglulu
232*91f16700Schasinglulu	/* determine if this is bootcore or secondary core */
233*91f16700Schasinglulu	cbnz  x0, 1f
234*91f16700Schasinglulu
235*91f16700Schasinglulu	/* get base address for bootcore data */
236*91f16700Schasinglulu	ldr  x3, =BC_PSCI_BASE
237*91f16700Schasinglulu	add  x3, x3, x2
238*91f16700Schasinglulu	b	2f
239*91f16700Schasinglulu
240*91f16700Schasinglulu1:	/* get base address for secondary core data */
241*91f16700Schasinglulu
242*91f16700Schasinglulu	/* x0 = core number (0-based) */
243*91f16700Schasinglulu	/* x1 = data value */
244*91f16700Schasinglulu	/* x2 = field offset */
245*91f16700Schasinglulu
246*91f16700Schasinglulu	/* generate number of regions to offset */
247*91f16700Schasinglulu	mov   x3, #SEC_REGION_SIZE
248*91f16700Schasinglulu	mul   x3, x3, x0
249*91f16700Schasinglulu
250*91f16700Schasinglulu	/* x1 = data value */
251*91f16700Schasinglulu	/* x2 = field offset */
252*91f16700Schasinglulu	/* x3 = region offset */
253*91f16700Schasinglulu
254*91f16700Schasinglulu	/* generate the total offset to data element */
255*91f16700Schasinglulu	sub   x2, x3, x2
256*91f16700Schasinglulu
257*91f16700Schasinglulu	/* x1 = data value */
258*91f16700Schasinglulu	/* x2 = total offset to data element */
259*91f16700Schasinglulu
260*91f16700Schasinglulu	ldr   x3, =SECONDARY_TOP
261*91f16700Schasinglulu
262*91f16700Schasinglulu	/* apply offset to base addr */
263*91f16700Schasinglulu	sub   x3, x3, x2
264*91f16700Schasinglulu
265*91f16700Schasinglulu2:
266*91f16700Schasinglulu	/* x1 = data value */
267*91f16700Schasinglulu	/* x3 = data element address */
268*91f16700Schasinglulu
269*91f16700Schasinglulu	str   x1, [x3]
270*91f16700Schasinglulu
271*91f16700Schasinglulu	dc	civac, x3
272*91f16700Schasinglulu	dsb   sy
273*91f16700Schasinglulu	isb
274*91f16700Schasinglulu	ret
275*91f16700Schasingluluendfunc _setCoreState
276*91f16700Schasinglulu
277*91f16700Schasinglulu
278*91f16700Schasinglulu/* Function sets the task1 start
279*91f16700Schasinglulu * in:  w0 = value to set flag to
280*91f16700Schasinglulu * out: none
281*91f16700Schasinglulu * uses x0, x1
282*91f16700Schasinglulu */
283*91f16700Schasinglulufunc _set_task1_start
284*91f16700Schasinglulu
285*91f16700Schasinglulu	ldr  x1, =SMC_TASK1_BASE
286*91f16700Schasinglulu
287*91f16700Schasinglulu	add  x1, x1, #TSK_START_OFFSET
288*91f16700Schasinglulu	str  w0, [x1]
289*91f16700Schasinglulu	dc   cvac, x1
290*91f16700Schasinglulu	dsb  sy
291*91f16700Schasinglulu	isb
292*91f16700Schasinglulu	ret
293*91f16700Schasingluluendfunc _set_task1_start
294*91f16700Schasinglulu
295*91f16700Schasinglulu
296*91f16700Schasinglulu/* Function sets the state of the task 1 done flag
297*91f16700Schasinglulu * in:  w0 = value to set flag to
298*91f16700Schasinglulu * out: none
299*91f16700Schasinglulu * uses x0, x1
300*91f16700Schasinglulu */
301*91f16700Schasinglulufunc _set_task1_done
302*91f16700Schasinglulu
303*91f16700Schasinglulu	ldr  x1, =SMC_TASK1_BASE
304*91f16700Schasinglulu
305*91f16700Schasinglulu	add  x1, x1, #TSK_DONE_OFFSET
306*91f16700Schasinglulu	str  w0, [x1]
307*91f16700Schasinglulu	dc   cvac, x1
308*91f16700Schasinglulu	dsb  sy
309*91f16700Schasinglulu	isb
310*91f16700Schasinglulu	ret
311*91f16700Schasingluluendfunc _set_task1_done
312*91f16700Schasinglulu
313*91f16700Schasinglulu
314*91f16700Schasinglulu/* Function initializes the smc global data entries
315*91f16700Schasinglulu * Note: the constant LAST_SMC_GLBL_OFFSET must reference the last entry in the
316*91f16700Schasinglulu *	   smc global region
317*91f16700Schasinglulu * in:  none
318*91f16700Schasinglulu * out: none
319*91f16700Schasinglulu * uses x0, x1, x2
320*91f16700Schasinglulu */
321*91f16700Schasinglulufunc _init_global_data
322*91f16700Schasinglulu
323*91f16700Schasinglulu	ldr  x1, =SMC_GLBL_BASE
324*91f16700Schasinglulu
325*91f16700Schasinglulu	/* x1 = SMC_GLBL_BASE */
326*91f16700Schasinglulu
327*91f16700Schasinglulu	mov x2, #LAST_SMC_GLBL_OFFSET
328*91f16700Schasinglulu	add x2, x2, x1
329*91f16700Schasinglulu1:
330*91f16700Schasinglulu	str  xzr, [x1]
331*91f16700Schasinglulu	dc   cvac, x1
332*91f16700Schasinglulu	cmp  x2, x1
333*91f16700Schasinglulu	add  x1, x1, #8
334*91f16700Schasinglulu	b.hi 1b
335*91f16700Schasinglulu
336*91f16700Schasinglulu	dsb  sy
337*91f16700Schasinglulu	isb
338*91f16700Schasinglulu	ret
339*91f16700Schasingluluendfunc _init_global_data
340*91f16700Schasinglulu
341*91f16700Schasinglulu
342*91f16700Schasinglulu/* Function gets the value of the specified global data element
343*91f16700Schasinglulu * in:  x0 = offset of data element
344*91f16700Schasinglulu * out: x0 = requested data element
345*91f16700Schasinglulu * uses x0, x1
346*91f16700Schasinglulu */
347*91f16700Schasinglulufunc _get_global_data
348*91f16700Schasinglulu
349*91f16700Schasinglulu	ldr  x1, =SMC_GLBL_BASE
350*91f16700Schasinglulu	add  x1, x1, x0
351*91f16700Schasinglulu	dc   ivac, x1
352*91f16700Schasinglulu	isb
353*91f16700Schasinglulu
354*91f16700Schasinglulu	ldr  x0, [x1]
355*91f16700Schasinglulu	ret
356*91f16700Schasingluluendfunc _get_global_data
357*91f16700Schasinglulu
358*91f16700Schasinglulu
359*91f16700Schasinglulu/* Function sets the value of the specified global data element
360*91f16700Schasinglulu * in:  x0 = offset of data element
361*91f16700Schasinglulu *	  x1 = value to write
362*91f16700Schasinglulu * out: none
363*91f16700Schasinglulu * uses x0, x1, x2
364*91f16700Schasinglulu */
365*91f16700Schasinglulufunc _set_global_data
366*91f16700Schasinglulu
367*91f16700Schasinglulu	ldr  x2, =SMC_GLBL_BASE
368*91f16700Schasinglulu	add  x0, x0, x2
369*91f16700Schasinglulu	str  x1, [x0]
370*91f16700Schasinglulu	dc   cvac, x0
371*91f16700Schasinglulu
372*91f16700Schasinglulu	dsb  sy
373*91f16700Schasinglulu	isb
374*91f16700Schasinglulu	ret
375*91f16700Schasingluluendfunc _set_global_data
376*91f16700Schasinglulu
377*91f16700Schasinglulu
378*91f16700Schasinglulu/* Function initializes the core data areas
379*91f16700Schasinglulu * only executed by the boot core
380*91f16700Schasinglulu * in:   none
381*91f16700Schasinglulu * out:  none
382*91f16700Schasinglulu * uses: x0, x1, x2, x3, x4, x5, x6, x7, [x13, x14, x15]
383*91f16700Schasinglulu */
384*91f16700Schasinglulufunc _initialize_psci
385*91f16700Schasinglulu	mov   x7, x30
386*91f16700Schasinglulu
387*91f16700Schasinglulu	/* initialize the bootcore psci data */
388*91f16700Schasinglulu	ldr   x5, =BC_PSCI_BASE
389*91f16700Schasinglulu	mov   x6, #CORE_RELEASED
390*91f16700Schasinglulu
391*91f16700Schasinglulu	str   x6,  [x5], #8
392*91f16700Schasinglulu	dc cvac, x5
393*91f16700Schasinglulu	str   xzr, [x5], #8
394*91f16700Schasinglulu	dc cvac, x5
395*91f16700Schasinglulu	str   xzr, [x5], #8
396*91f16700Schasinglulu	dc cvac, x5
397*91f16700Schasinglulu	str   xzr, [x5], #8
398*91f16700Schasinglulu	dc cvac, x5
399*91f16700Schasinglulu	str   xzr, [x5], #8
400*91f16700Schasinglulu	dc cvac, x5
401*91f16700Schasinglulu	str   xzr, [x5], #8
402*91f16700Schasinglulu	dc cvac, x5
403*91f16700Schasinglulu	str   xzr, [x5], #8
404*91f16700Schasinglulu	dc cvac, x5
405*91f16700Schasinglulu	str   xzr, [x5], #8
406*91f16700Schasinglulu	dc cvac, x5
407*91f16700Schasinglulu	str   xzr, [x5], #8
408*91f16700Schasinglulu	dc cvac, x5
409*91f16700Schasinglulu	str   xzr, [x5], #8
410*91f16700Schasinglulu	dc cvac, x5
411*91f16700Schasinglulu	str   xzr, [x5], #8
412*91f16700Schasinglulu	dc cvac, x5
413*91f16700Schasinglulu	str   xzr, [x5], #8
414*91f16700Schasinglulu	dc cvac, x5
415*91f16700Schasinglulu	str   xzr, [x5], #8
416*91f16700Schasinglulu	dc cvac, x5
417*91f16700Schasinglulu	str   xzr, [x5], #8
418*91f16700Schasinglulu	dc cvac, x5
419*91f16700Schasinglulu	str   xzr, [x5], #8
420*91f16700Schasinglulu	dc cvac, x5
421*91f16700Schasinglulu	str   xzr, [x5]
422*91f16700Schasinglulu	dc cvac, x5
423*91f16700Schasinglulu	dsb sy
424*91f16700Schasinglulu	isb
425*91f16700Schasinglulu
426*91f16700Schasinglulu	/* see if we have any secondary cores */
427*91f16700Schasinglulu	mov   x4, #PLATFORM_CORE_COUNT
428*91f16700Schasinglulu	sub   x4, x4, #1
429*91f16700Schasinglulu	cbz   x4, 3f
430*91f16700Schasinglulu
431*91f16700Schasinglulu	/* initialize the secondary core's psci data */
432*91f16700Schasinglulu	ldr  x5, =SECONDARY_TOP
433*91f16700Schasinglulu	/* core mask lsb for core 1 */
434*91f16700Schasinglulu	mov  x3, #2
435*91f16700Schasinglulu	sub  x5, x5, #SEC_REGION_SIZE
436*91f16700Schasinglulu
437*91f16700Schasinglulu	/* x3 = core1 mask lsb */
438*91f16700Schasinglulu	/* x4 = number of secondary cores */
439*91f16700Schasinglulu	/* x5 = core1 psci data base address */
440*91f16700Schasinglulu2:
441*91f16700Schasinglulu	/* set core state in x6 */
442*91f16700Schasinglulu	mov  x0, x3
443*91f16700Schasinglulu	mov  x6, #CORE_IN_RESET
444*91f16700Schasinglulu	bl   _soc_ck_disabled
445*91f16700Schasinglulu	cbz  x0, 1f
446*91f16700Schasinglulu	mov  x6, #CORE_DISABLED
447*91f16700Schasinglulu1:
448*91f16700Schasinglulu	add   x2, x5, #CORE_STATE_DATA
449*91f16700Schasinglulu	str   x6,  [x2]
450*91f16700Schasinglulu	dc cvac, x2
451*91f16700Schasinglulu	add   x2, x5, #SPSR_EL3_DATA
452*91f16700Schasinglulu	str   xzr, [x2]
453*91f16700Schasinglulu	dc cvac, x2
454*91f16700Schasinglulu	add   x2, x5, #CNTXT_ID_DATA
455*91f16700Schasinglulu	str   xzr, [x2]
456*91f16700Schasinglulu	dc cvac, x2
457*91f16700Schasinglulu	add   x2, x5, #START_ADDR_DATA
458*91f16700Schasinglulu	str   xzr, [x2]
459*91f16700Schasinglulu	dc cvac, x2
460*91f16700Schasinglulu	add   x2, x5, #LINK_REG_DATA
461*91f16700Schasinglulu	str   xzr, [x2]
462*91f16700Schasinglulu	dc cvac, x2
463*91f16700Schasinglulu	add   x2, x5, #GICC_CTLR_DATA
464*91f16700Schasinglulu	str   xzr, [x2]
465*91f16700Schasinglulu	dc cvac, x2
466*91f16700Schasinglulu	add   x2, x5, #ABORT_FLAG_DATA
467*91f16700Schasinglulu	str   xzr, [x2]
468*91f16700Schasinglulu	dc cvac, x2
469*91f16700Schasinglulu	add   x2, x5, #SCTLR_DATA
470*91f16700Schasinglulu	str   xzr, [x2]
471*91f16700Schasinglulu	dc cvac, x2
472*91f16700Schasinglulu	add   x2, x5, #CPUECTLR_DATA
473*91f16700Schasinglulu	str   xzr, [x2]
474*91f16700Schasinglulu	dc cvac, x2
475*91f16700Schasinglulu	add   x2, x5, #AUX_01_DATA
476*91f16700Schasinglulu	str   xzr, [x2]
477*91f16700Schasinglulu	dc cvac, x2
478*91f16700Schasinglulu	add   x2, x5, #AUX_02_DATA
479*91f16700Schasinglulu	str   xzr, [x2]
480*91f16700Schasinglulu	dc cvac, x2
481*91f16700Schasinglulu	add   x2, x5, #AUX_03_DATA
482*91f16700Schasinglulu	str   xzr, [x2]
483*91f16700Schasinglulu	dc cvac, x2
484*91f16700Schasinglulu	add   x2, x5, #AUX_04_DATA
485*91f16700Schasinglulu	str   xzr, [x2]
486*91f16700Schasinglulu	dc cvac, x2
487*91f16700Schasinglulu	add   x2, x5, #AUX_05_DATA
488*91f16700Schasinglulu	str   xzr, [x2]
489*91f16700Schasinglulu	dc cvac, x2
490*91f16700Schasinglulu	add   x2, x5, #SCR_EL3_DATA
491*91f16700Schasinglulu	str   xzr, [x2]
492*91f16700Schasinglulu	dc cvac, x2
493*91f16700Schasinglulu	add   x2, x5, #HCR_EL2_DATA
494*91f16700Schasinglulu	str   xzr, [x2]
495*91f16700Schasinglulu	dc cvac, x2
496*91f16700Schasinglulu	dsb sy
497*91f16700Schasinglulu	isb
498*91f16700Schasinglulu
499*91f16700Schasinglulu	sub   x4, x4, #1
500*91f16700Schasinglulu	cbz   x4, 3f
501*91f16700Schasinglulu
502*91f16700Schasinglulu	/* generate next core mask */
503*91f16700Schasinglulu	lsl  x3, x3, #1
504*91f16700Schasinglulu
505*91f16700Schasinglulu	/* decrement base address to next data area */
506*91f16700Schasinglulu	sub  x5, x5, #SEC_REGION_SIZE
507*91f16700Schasinglulu	b	2b
508*91f16700Schasinglulu3:
509*91f16700Schasinglulu	mov   x30, x7
510*91f16700Schasinglulu	ret
511*91f16700Schasingluluendfunc _initialize_psci
512*91f16700Schasinglulu
513*91f16700Schasinglulu
514*91f16700Schasinglulu/* Function initializes the soc init task flags
515*91f16700Schasinglulu * in:  none
516*91f16700Schasinglulu * out: none
517*91f16700Schasinglulu * uses x0, x1, [x13, x14, x15]
518*91f16700Schasinglulu */
519*91f16700Schasinglulufunc _init_task_flags
520*91f16700Schasinglulu
521*91f16700Schasinglulu	/* get the base address of the first task structure */
522*91f16700Schasinglulu	ldr  x0, =SMC_TASK1_BASE
523*91f16700Schasinglulu
524*91f16700Schasinglulu	/* x0 = task1 base address */
525*91f16700Schasinglulu
526*91f16700Schasinglulu	str  wzr, [x0, #TSK_START_OFFSET]
527*91f16700Schasinglulu	str  wzr, [x0, #TSK_DONE_OFFSET]
528*91f16700Schasinglulu	str  wzr, [x0, #TSK_CORE_OFFSET]
529*91f16700Schasinglulu	dc   cvac, x0
530*91f16700Schasinglulu
531*91f16700Schasinglulu	/* move to task2 structure */
532*91f16700Schasinglulu	add  x0, x0, #SMC_TASK_OFFSET
533*91f16700Schasinglulu
534*91f16700Schasinglulu	str  wzr, [x0, #TSK_START_OFFSET]
535*91f16700Schasinglulu	str  wzr, [x0, #TSK_DONE_OFFSET]
536*91f16700Schasinglulu	str  wzr, [x0, #TSK_CORE_OFFSET]
537*91f16700Schasinglulu	dc   cvac, x0
538*91f16700Schasinglulu
539*91f16700Schasinglulu	/* move to task3 structure */
540*91f16700Schasinglulu	add  x0, x0, #SMC_TASK_OFFSET
541*91f16700Schasinglulu
542*91f16700Schasinglulu	str  wzr, [x0, #TSK_START_OFFSET]
543*91f16700Schasinglulu	str  wzr, [x0, #TSK_DONE_OFFSET]
544*91f16700Schasinglulu	str  wzr, [x0, #TSK_CORE_OFFSET]
545*91f16700Schasinglulu	dc   cvac, x0
546*91f16700Schasinglulu
547*91f16700Schasinglulu	/* move to task4 structure */
548*91f16700Schasinglulu	add  x0, x0, #SMC_TASK_OFFSET
549*91f16700Schasinglulu
550*91f16700Schasinglulu	str  wzr, [x0, #TSK_START_OFFSET]
551*91f16700Schasinglulu	str  wzr, [x0, #TSK_DONE_OFFSET]
552*91f16700Schasinglulu	str  wzr, [x0, #TSK_CORE_OFFSET]
553*91f16700Schasinglulu	dc   cvac, x0
554*91f16700Schasinglulu
555*91f16700Schasinglulu	dsb  sy
556*91f16700Schasinglulu	isb
557*91f16700Schasinglulu	ret
558*91f16700Schasingluluendfunc _init_task_flags
559