]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* cif.S: PROM entry/exit assembler trampolines. |
2 | * | |
3 | * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | |
4 | * Copyright (C) 2005 David S. Miller <davem@davemloft.net> | |
5 | */ | |
6 | ||
7 | #include <asm/pstate.h> | |
8 | ||
9 | .text | |
10 | .globl prom_cif_interface | |
11 | prom_cif_interface: | |
12 | sethi %hi(p1275buf), %o0 | |
13 | or %o0, %lo(p1275buf), %o0 | |
14 | ldx [%o0 + 0x010], %o1 ! prom_cif_stack | |
15 | save %o1, -0x190, %sp | |
16 | ldx [%i0 + 0x008], %l2 ! prom_cif_handler | |
17 | rdpr %pstate, %l4 | |
18 | wrpr %g0, 0x15, %pstate ! save alternate globals | |
19 | stx %g1, [%sp + 2047 + 0x0b0] | |
20 | stx %g2, [%sp + 2047 + 0x0b8] | |
21 | stx %g3, [%sp + 2047 + 0x0c0] | |
22 | stx %g4, [%sp + 2047 + 0x0c8] | |
23 | stx %g5, [%sp + 2047 + 0x0d0] | |
24 | stx %g6, [%sp + 2047 + 0x0d8] | |
25 | stx %g7, [%sp + 2047 + 0x0e0] | |
26 | wrpr %g0, 0x814, %pstate ! save interrupt globals | |
27 | stx %g1, [%sp + 2047 + 0x0e8] | |
28 | stx %g2, [%sp + 2047 + 0x0f0] | |
29 | stx %g3, [%sp + 2047 + 0x0f8] | |
30 | stx %g4, [%sp + 2047 + 0x100] | |
31 | stx %g5, [%sp + 2047 + 0x108] | |
32 | stx %g6, [%sp + 2047 + 0x110] | |
33 | stx %g7, [%sp + 2047 + 0x118] | |
34 | wrpr %g0, 0x14, %pstate ! save normal globals | |
35 | stx %g1, [%sp + 2047 + 0x120] | |
36 | stx %g2, [%sp + 2047 + 0x128] | |
37 | stx %g3, [%sp + 2047 + 0x130] | |
38 | stx %g4, [%sp + 2047 + 0x138] | |
39 | stx %g5, [%sp + 2047 + 0x140] | |
40 | stx %g6, [%sp + 2047 + 0x148] | |
41 | stx %g7, [%sp + 2047 + 0x150] | |
42 | wrpr %g0, 0x414, %pstate ! save mmu globals | |
43 | stx %g1, [%sp + 2047 + 0x158] | |
44 | stx %g2, [%sp + 2047 + 0x160] | |
45 | stx %g3, [%sp + 2047 + 0x168] | |
46 | stx %g4, [%sp + 2047 + 0x170] | |
47 | stx %g5, [%sp + 2047 + 0x178] | |
48 | stx %g6, [%sp + 2047 + 0x180] | |
49 | stx %g7, [%sp + 2047 + 0x188] | |
50 | mov %g1, %l0 ! also save to locals, so we can handle | |
51 | mov %g2, %l1 ! tlb faults later on, when accessing | |
52 | mov %g3, %l3 ! the stack. | |
53 | mov %g7, %l5 | |
54 | wrpr %l4, PSTATE_IE, %pstate ! turn off interrupts | |
55 | call %l2 | |
56 | add %i0, 0x018, %o0 ! prom_args | |
57 | wrpr %g0, 0x414, %pstate ! restore mmu globals | |
58 | mov %l0, %g1 | |
59 | mov %l1, %g2 | |
60 | mov %l3, %g3 | |
61 | mov %l5, %g7 | |
62 | wrpr %g0, 0x14, %pstate ! restore normal globals | |
63 | ldx [%sp + 2047 + 0x120], %g1 | |
64 | ldx [%sp + 2047 + 0x128], %g2 | |
65 | ldx [%sp + 2047 + 0x130], %g3 | |
66 | ldx [%sp + 2047 + 0x138], %g4 | |
67 | ldx [%sp + 2047 + 0x140], %g5 | |
68 | ldx [%sp + 2047 + 0x148], %g6 | |
69 | ldx [%sp + 2047 + 0x150], %g7 | |
70 | wrpr %g0, 0x814, %pstate ! restore interrupt globals | |
71 | ldx [%sp + 2047 + 0x0e8], %g1 | |
72 | ldx [%sp + 2047 + 0x0f0], %g2 | |
73 | ldx [%sp + 2047 + 0x0f8], %g3 | |
74 | ldx [%sp + 2047 + 0x100], %g4 | |
75 | ldx [%sp + 2047 + 0x108], %g5 | |
76 | ldx [%sp + 2047 + 0x110], %g6 | |
77 | ldx [%sp + 2047 + 0x118], %g7 | |
78 | wrpr %g0, 0x15, %pstate ! restore alternate globals | |
79 | ldx [%sp + 2047 + 0x0b0], %g1 | |
80 | ldx [%sp + 2047 + 0x0b8], %g2 | |
81 | ldx [%sp + 2047 + 0x0c0], %g3 | |
82 | ldx [%sp + 2047 + 0x0c8], %g4 | |
83 | ldx [%sp + 2047 + 0x0d0], %g5 | |
84 | ldx [%sp + 2047 + 0x0d8], %g6 | |
85 | ldx [%sp + 2047 + 0x0e0], %g7 | |
86 | wrpr %l4, 0, %pstate ! restore original pstate | |
87 | ret | |
88 | restore | |
89 | ||
90 | .globl prom_cif_callback | |
91 | prom_cif_callback: | |
92 | sethi %hi(p1275buf), %o1 | |
93 | or %o1, %lo(p1275buf), %o1 | |
94 | save %sp, -0x270, %sp | |
95 | rdpr %pstate, %l4 | |
96 | wrpr %g0, 0x15, %pstate ! save PROM alternate globals | |
97 | stx %g1, [%sp + 2047 + 0x0b0] | |
98 | stx %g2, [%sp + 2047 + 0x0b8] | |
99 | stx %g3, [%sp + 2047 + 0x0c0] | |
100 | stx %g4, [%sp + 2047 + 0x0c8] | |
101 | stx %g5, [%sp + 2047 + 0x0d0] | |
102 | stx %g6, [%sp + 2047 + 0x0d8] | |
103 | stx %g7, [%sp + 2047 + 0x0e0] | |
104 | ! restore Linux alternate globals | |
105 | ldx [%sp + 2047 + 0x190], %g1 | |
106 | ldx [%sp + 2047 + 0x198], %g2 | |
107 | ldx [%sp + 2047 + 0x1a0], %g3 | |
108 | ldx [%sp + 2047 + 0x1a8], %g4 | |
109 | ldx [%sp + 2047 + 0x1b0], %g5 | |
110 | ldx [%sp + 2047 + 0x1b8], %g6 | |
111 | ldx [%sp + 2047 + 0x1c0], %g7 | |
112 | wrpr %g0, 0x814, %pstate ! save PROM interrupt globals | |
113 | stx %g1, [%sp + 2047 + 0x0e8] | |
114 | stx %g2, [%sp + 2047 + 0x0f0] | |
115 | stx %g3, [%sp + 2047 + 0x0f8] | |
116 | stx %g4, [%sp + 2047 + 0x100] | |
117 | stx %g5, [%sp + 2047 + 0x108] | |
118 | stx %g6, [%sp + 2047 + 0x110] | |
119 | stx %g7, [%sp + 2047 + 0x118] | |
120 | ! restore Linux interrupt globals | |
121 | ldx [%sp + 2047 + 0x1c8], %g1 | |
122 | ldx [%sp + 2047 + 0x1d0], %g2 | |
123 | ldx [%sp + 2047 + 0x1d8], %g3 | |
124 | ldx [%sp + 2047 + 0x1e0], %g4 | |
125 | ldx [%sp + 2047 + 0x1e8], %g5 | |
126 | ldx [%sp + 2047 + 0x1f0], %g6 | |
127 | ldx [%sp + 2047 + 0x1f8], %g7 | |
128 | wrpr %g0, 0x14, %pstate ! save PROM normal globals | |
129 | stx %g1, [%sp + 2047 + 0x120] | |
130 | stx %g2, [%sp + 2047 + 0x128] | |
131 | stx %g3, [%sp + 2047 + 0x130] | |
132 | stx %g4, [%sp + 2047 + 0x138] | |
133 | stx %g5, [%sp + 2047 + 0x140] | |
134 | stx %g6, [%sp + 2047 + 0x148] | |
135 | stx %g7, [%sp + 2047 + 0x150] | |
136 | ! restore Linux normal globals | |
137 | ldx [%sp + 2047 + 0x200], %g1 | |
138 | ldx [%sp + 2047 + 0x208], %g2 | |
139 | ldx [%sp + 2047 + 0x210], %g3 | |
140 | ldx [%sp + 2047 + 0x218], %g4 | |
141 | ldx [%sp + 2047 + 0x220], %g5 | |
142 | ldx [%sp + 2047 + 0x228], %g6 | |
143 | ldx [%sp + 2047 + 0x230], %g7 | |
144 | wrpr %g0, 0x414, %pstate ! save PROM mmu globals | |
145 | stx %g1, [%sp + 2047 + 0x158] | |
146 | stx %g2, [%sp + 2047 + 0x160] | |
147 | stx %g3, [%sp + 2047 + 0x168] | |
148 | stx %g4, [%sp + 2047 + 0x170] | |
149 | stx %g5, [%sp + 2047 + 0x178] | |
150 | stx %g6, [%sp + 2047 + 0x180] | |
151 | stx %g7, [%sp + 2047 + 0x188] | |
152 | ! restore Linux mmu globals | |
153 | ldx [%sp + 2047 + 0x238], %o0 | |
154 | ldx [%sp + 2047 + 0x240], %o1 | |
155 | ldx [%sp + 2047 + 0x248], %l2 | |
156 | ldx [%sp + 2047 + 0x250], %l3 | |
157 | ldx [%sp + 2047 + 0x258], %l5 | |
158 | ldx [%sp + 2047 + 0x260], %l6 | |
159 | ldx [%sp + 2047 + 0x268], %l7 | |
160 | ! switch to Linux tba | |
161 | sethi %hi(sparc64_ttable_tl0), %l1 | |
162 | rdpr %tba, %l0 ! save PROM tba | |
163 | mov %o0, %g1 | |
164 | mov %o1, %g2 | |
165 | mov %l2, %g3 | |
166 | mov %l3, %g4 | |
167 | mov %l5, %g5 | |
168 | mov %l6, %g6 | |
169 | mov %l7, %g7 | |
170 | wrpr %l1, %tba ! install Linux tba | |
171 | wrpr %l4, 0, %pstate ! restore PSTATE | |
172 | call prom_world | |
173 | mov %g0, %o0 | |
174 | ldx [%i1 + 0x000], %l2 | |
175 | call %l2 | |
176 | mov %i0, %o0 | |
177 | mov %o0, %l1 | |
178 | call prom_world | |
179 | or %g0, 1, %o0 | |
180 | wrpr %g0, 0x14, %pstate ! interrupts off | |
181 | ! restore PROM mmu globals | |
182 | ldx [%sp + 2047 + 0x158], %o0 | |
183 | ldx [%sp + 2047 + 0x160], %o1 | |
184 | ldx [%sp + 2047 + 0x168], %l2 | |
185 | ldx [%sp + 2047 + 0x170], %l3 | |
186 | ldx [%sp + 2047 + 0x178], %l5 | |
187 | ldx [%sp + 2047 + 0x180], %l6 | |
188 | ldx [%sp + 2047 + 0x188], %l7 | |
189 | wrpr %g0, 0x414, %pstate ! restore PROM mmu globals | |
190 | mov %o0, %g1 | |
191 | mov %o1, %g2 | |
192 | mov %l2, %g3 | |
193 | mov %l3, %g4 | |
194 | mov %l5, %g5 | |
195 | mov %l6, %g6 | |
196 | mov %l7, %g7 | |
197 | wrpr %l0, %tba ! restore PROM tba | |
198 | wrpr %g0, 0x14, %pstate ! restore PROM normal globals | |
199 | ldx [%sp + 2047 + 0x120], %g1 | |
200 | ldx [%sp + 2047 + 0x128], %g2 | |
201 | ldx [%sp + 2047 + 0x130], %g3 | |
202 | ldx [%sp + 2047 + 0x138], %g4 | |
203 | ldx [%sp + 2047 + 0x140], %g5 | |
204 | ldx [%sp + 2047 + 0x148], %g6 | |
205 | ldx [%sp + 2047 + 0x150], %g7 | |
206 | wrpr %g0, 0x814, %pstate ! restore PROM interrupt globals | |
207 | ldx [%sp + 2047 + 0x0e8], %g1 | |
208 | ldx [%sp + 2047 + 0x0f0], %g2 | |
209 | ldx [%sp + 2047 + 0x0f8], %g3 | |
210 | ldx [%sp + 2047 + 0x100], %g4 | |
211 | ldx [%sp + 2047 + 0x108], %g5 | |
212 | ldx [%sp + 2047 + 0x110], %g6 | |
213 | ldx [%sp + 2047 + 0x118], %g7 | |
214 | wrpr %g0, 0x15, %pstate ! restore PROM alternate globals | |
215 | ldx [%sp + 2047 + 0x0b0], %g1 | |
216 | ldx [%sp + 2047 + 0x0b8], %g2 | |
217 | ldx [%sp + 2047 + 0x0c0], %g3 | |
218 | ldx [%sp + 2047 + 0x0c8], %g4 | |
219 | ldx [%sp + 2047 + 0x0d0], %g5 | |
220 | ldx [%sp + 2047 + 0x0d8], %g6 | |
221 | ldx [%sp + 2047 + 0x0e0], %g7 | |
222 | wrpr %l4, 0, %pstate | |
223 | ret | |
224 | restore %l1, 0, %o0 | |
225 |