]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/parisc/kernel/real2.S
[PARISC] Use work queue in LED/LCD driver instead of tasklet.
[mirror_ubuntu-bionic-kernel.git] / arch / parisc / kernel / real2.S
CommitLineData
1da177e4
LT
1/*
2 *
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 2000 Hewlett Packard (Paul Bame bame@puffin.external.hp.com)
8 *
9 */
1da177e4 10#include <asm/psw.h>
896a3756 11#include <asm/assembly.h>
1da177e4
LT
12
13 .section .bss
14 .export real_stack
15 .export real32_stack
16 .export real64_stack
17 .align 64
18real_stack:
19real32_stack:
20real64_stack:
21 .block 8192
22
23#ifdef __LP64__
24# define REG_SZ 8
25#else
26# define REG_SZ 4
27#endif
28
29#define N_SAVED_REGS 9
30
31save_cr_space:
32 .block REG_SZ * N_SAVED_REGS
33save_cr_end:
34
35
36/************************ 32-bit real-mode calls ***********************/
37/* This can be called in both narrow and wide kernels */
38
39 .text
40
41 .export real32_call_asm
42
43 /* unsigned long real32_call_asm(unsigned int *sp,
44 * unsigned int *arg0p,
45 * unsigned int iodc_fn)
46 * sp is value of stack pointer to adopt before calling PDC (virt)
47 * arg0p points to where saved arg values may be found
48 * iodc_fn is the IODC function to call
49 */
50
51real32_call_asm:
52 STREG %rp, -RP_OFFSET(%sp) /* save RP */
53#ifdef __LP64__
54 callee_save
55 ldo 2*REG_SZ(%sp), %sp /* room for a couple more saves */
56 STREG %r27, -1*REG_SZ(%sp)
57 STREG %r29, -2*REG_SZ(%sp)
58#endif
59 STREG %sp, -REG_SZ(%arg0) /* save SP on real-mode stack */
60 copy %arg0, %sp /* adopt the real-mode SP */
61
62 /* save iodc_fn */
63 copy %arg2, %r31
64
65 /* load up the arg registers from the saved arg area */
66 /* 32-bit calling convention passes first 4 args in registers */
67 ldw 0(%arg1), %arg0 /* note overwriting arg0 */
68 ldw -8(%arg1), %arg2
69 ldw -12(%arg1), %arg3
70 ldw -4(%arg1), %arg1 /* obviously must do this one last! */
71
72 tophys_r1 %sp
73
74 b,l rfi_virt2real,%r2
75 nop
76
77 b,l save_control_regs,%r2 /* modifies r1, r2, r28 */
78 nop
79
80#ifdef __LP64__
81 rsm PSW_SM_W, %r0 /* go narrow */
82#endif
83
84 load32 PA(ric_ret), %r2
85 bv 0(%r31)
86 nop
87ric_ret:
88#ifdef __LP64__
89 ssm PSW_SM_W, %r0 /* go wide */
90#endif
91 /* restore CRs before going virtual in case we page fault */
92 b,l restore_control_regs, %r2 /* modifies r1, r2, r26 */
93 nop
94
95 b,l rfi_real2virt,%r2
96 nop
97
98 tovirt_r1 %sp
99 LDREG -REG_SZ(%sp), %sp /* restore SP */
100#ifdef __LP64__
101 LDREG -1*REG_SZ(%sp), %r27
102 LDREG -2*REG_SZ(%sp), %r29
103 ldo -2*REG_SZ(%sp), %sp
104 callee_rest
105#endif
106 LDREG -RP_OFFSET(%sp), %rp /* restore RP */
107 bv 0(%rp)
108 nop
109
110
111# define PUSH_CR(r, where) mfctl r, %r1 ! STREG,ma %r1, REG_SZ(where)
112# define POP_CR(r, where) LDREG,mb -REG_SZ(where), %r1 ! mtctl %r1, r
113
114 .text
115save_control_regs:
116 load32 PA(save_cr_space), %r28
117 PUSH_CR(%cr24, %r28)
118 PUSH_CR(%cr25, %r28)
119 PUSH_CR(%cr26, %r28)
120 PUSH_CR(%cr27, %r28)
121 PUSH_CR(%cr28, %r28)
122 PUSH_CR(%cr29, %r28)
123 PUSH_CR(%cr30, %r28)
124 PUSH_CR(%cr31, %r28)
125 PUSH_CR(%cr15, %r28)
126 bv 0(%r2)
127 nop
128
129restore_control_regs:
130 load32 PA(save_cr_end), %r26
131 POP_CR(%cr15, %r26)
132 POP_CR(%cr31, %r26)
133 POP_CR(%cr30, %r26)
134 POP_CR(%cr29, %r26)
135 POP_CR(%cr28, %r26)
136 POP_CR(%cr27, %r26)
137 POP_CR(%cr26, %r26)
138 POP_CR(%cr25, %r26)
139 POP_CR(%cr24, %r26)
140 bv 0(%r2)
141 nop
142
143/* rfi_virt2real() and rfi_real2virt() could perhaps be adapted for
144 * more general-purpose use by the several places which need RFIs
145 */
146 .align 128
147 .text
148rfi_virt2real:
149 /* switch to real mode... */
896a3756
GG
150 rsm PSW_SM_I,%r0
151 load32 PA(rfi_v2r_1), %r1
1da177e4
LT
152 nop
153 nop
154 nop
155 nop
156 nop
157
896a3756 158 rsm PSW_SM_Q,%r0 /* disable Q & I bits to load iia queue */
1da177e4
LT
159 mtctl %r0, %cr17 /* Clear IIASQ tail */
160 mtctl %r0, %cr17 /* Clear IIASQ head */
1da177e4
LT
161 mtctl %r1, %cr18 /* IIAOQ head */
162 ldo 4(%r1), %r1
163 mtctl %r1, %cr18 /* IIAOQ tail */
164 load32 REAL_MODE_PSW, %r1
165 mtctl %r1, %cr22
166 rfi
167
168 nop
169 nop
170 nop
171 nop
172 nop
173 nop
174 nop
175 nop
176rfi_v2r_1:
177 tophys_r1 %r2
178 bv 0(%r2)
179 nop
180
181 .text
182 .align 128
183rfi_real2virt:
896a3756
GG
184 rsm PSW_SM_I,%r0
185 load32 (rfi_r2v_1), %r1
1da177e4
LT
186 nop
187 nop
188 nop
189 nop
190 nop
191
192 rsm PSW_SM_Q,%r0 /* disable Q bit to load iia queue */
193 mtctl %r0, %cr17 /* Clear IIASQ tail */
194 mtctl %r0, %cr17 /* Clear IIASQ head */
1da177e4
LT
195 mtctl %r1, %cr18 /* IIAOQ head */
196 ldo 4(%r1), %r1
197 mtctl %r1, %cr18 /* IIAOQ tail */
198 load32 KERNEL_PSW, %r1
199 mtctl %r1, %cr22
200 rfi
201
202 nop
203 nop
204 nop
205 nop
206 nop
207 nop
208 nop
209 nop
210rfi_r2v_1:
211 tovirt_r1 %r2
212 bv 0(%r2)
213 nop
214
215#ifdef __LP64__
216
217/************************ 64-bit real-mode calls ***********************/
218/* This is only usable in wide kernels right now and will probably stay so */
219 .text
220 .export real64_call_asm
221 /* unsigned long real64_call_asm(unsigned long *sp,
222 * unsigned long *arg0p,
223 * unsigned long fn)
224 * sp is value of stack pointer to adopt before calling PDC (virt)
225 * arg0p points to where saved arg values may be found
226 * iodc_fn is the IODC function to call
227 */
228real64_call_asm:
229 std %rp, -0x10(%sp) /* save RP */
230 std %sp, -8(%arg0) /* save SP on real-mode stack */
231 copy %arg0, %sp /* adopt the real-mode SP */
232
233 /* save fn */
234 copy %arg2, %r31
235
236 /* set up the new ap */
237 ldo 64(%arg1), %r29
238
239 /* load up the arg registers from the saved arg area */
240 /* 32-bit calling convention passes first 4 args in registers */
241 ldd 0*REG_SZ(%arg1), %arg0 /* note overwriting arg0 */
242 ldd 2*REG_SZ(%arg1), %arg2
243 ldd 3*REG_SZ(%arg1), %arg3
244 ldd 4*REG_SZ(%arg1), %r22
245 ldd 5*REG_SZ(%arg1), %r21
246 ldd 6*REG_SZ(%arg1), %r20
247 ldd 7*REG_SZ(%arg1), %r19
248 ldd 1*REG_SZ(%arg1), %arg1 /* do this one last! */
249
250 tophys_r1 %sp
251
252 b,l rfi_virt2real,%r2
253 nop
254
255 b,l save_control_regs,%r2 /* modifies r1, r2, r28 */
256 nop
257
258 load32 PA(r64_ret), %r2
259 bv 0(%r31)
260 nop
261r64_ret:
262 /* restore CRs before going virtual in case we page fault */
263 b,l restore_control_regs, %r2 /* modifies r1, r2, r26 */
264 nop
265
266 b,l rfi_real2virt,%r2
267 nop
268
269 tovirt_r1 %sp
270 ldd -8(%sp), %sp /* restore SP */
271 ldd -0x10(%sp), %rp /* restore RP */
272 bv 0(%rp)
273 nop
274
275#endif
276
277 .export pc_in_user_space
278 .text
279 /* Doesn't belong here but I couldn't find a nicer spot. */
280 /* Should never get called, only used by profile stuff in time.c */
281pc_in_user_space:
282 bv,n 0(%rp)
283 nop
284
285
286 .export __canonicalize_funcptr_for_compare
287 .text
288 /* http://lists.parisc-linux.org/hypermail/parisc-linux/10916.html
289 ** GCC 3.3 and later has a new function in libgcc.a for
290 ** comparing function pointers.
291 */
292__canonicalize_funcptr_for_compare:
293#ifdef __LP64__
294 bve (%r2)
295#else
296 bv %r0(%r2)
297#endif
298 copy %r26,%r28