Print this page
de-linting of .s files
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/sparc/ml/sparc_ddi.s
+++ new/usr/src/uts/sparc/ml/sparc_ddi.s
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
25 25 */
26 26 /*
27 27 * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
28 28 */
29 29
30 30 /*
31 31 * Assembler routines to make some DDI routines go faster.
32 32 * These routines should ONLY be ISA-dependent.
33 33 */
34 34
35 -#if defined(lint)
36 -
37 -#include <sys/types.h>
38 -#include <sys/systm.h>
39 -#include <sys/file.h>
40 -#include <sys/sunddi.h>
41 -
42 -#else /* lint */
43 -
44 35 #include <sys/asm_linkage.h>
45 36 #include <sys/clock.h>
46 37 #include <sys/intreg.h>
47 38
48 39 #include "assym.h" /* for FKIOCTL etc. */
49 40
50 -#endif /* lint */
51 41
52 -
53 42 /*
54 43 * Layered driver routines.
55 44 *
56 45 * At the time of writing, the compiler converts
57 46 *
58 47 * a() { return (b()); }
59 48 *
60 49 * into
61 50 * save, call b, restore
62 51 *
63 52 * Though this is sort of ok, if the called routine is leaf routine,
64 53 * then we just burnt a register window.
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
65 54 *
66 55 * When the compiler understands this optimization, many
67 56 * of these routines can go back to C again.
68 57 */
69 58
70 59 #define FLATCALL(routine) \
71 60 mov %o7, %g1; \
72 61 call routine; \
73 62 mov %g1, %o7
74 63
75 -#ifdef lint
76 -
77 -int
78 -ddi_copyin(const void *buf, void *kernbuf, size_t size, int flags)
79 -{
80 - if (flags & FKIOCTL)
81 - return (kcopy(buf, kernbuf, size) ? -1 : 0);
82 - return (copyin(buf, kernbuf, size));
83 -}
84 -
85 -#else /* lint */
86 -
87 64 ENTRY(ddi_copyin)
88 65 set FKIOCTL, %o4
89 66 andcc %o3, %o4, %g0
90 67 bne .do_kcopy ! share code with ddi_copyout
91 68 FLATCALL(copyin)
92 69 /*NOTREACHED*/
93 70
94 71 .do_kcopy:
95 72 save %sp, -SA(MINFRAME), %sp
96 73 mov %i2, %o2
97 74 mov %i1, %o1
98 75 call kcopy
99 76 mov %i0, %o0
100 77 orcc %g0, %o0, %i0 ! if kcopy returns EFAULT ..
101 78 bne,a 1f
102 79 mov -1, %i0 ! .. we return -1
103 80 1: ret
104 81 restore
105 82 SET_SIZE(ddi_copyin)
106 83
107 -#endif /* lint */
108 -
109 -#ifdef lint
110 -
111 -int
112 -ddi_copyout(const void *buf, void *kernbuf, size_t size, int flags)
113 -{
114 - if (flags & FKIOCTL)
115 - return (kcopy(buf, kernbuf, size) ? -1 : 0);
116 - return (copyout(buf, kernbuf, size));
117 -}
118 -
119 -#else /* lint */
120 -
121 84 ENTRY(ddi_copyout)
122 85 set FKIOCTL, %o4
123 86 andcc %o3, %o4, %g0
124 87 bne .do_kcopy ! share code with ddi_copyin
125 88 FLATCALL(copyout)
126 89 /*NOTREACHED*/
127 90 SET_SIZE(ddi_copyout)
128 91
129 -#endif /* lint */
130 -
131 92 /*
132 93 * DDI spine wrapper routines - here so as to not have to
133 94 * buy register windows when climbing the device tree (which cost!)
134 95 */
135 96
136 -#if defined(lint)
137 -
138 -/*ARGSUSED*/
139 -int
140 -ddi_ctlops(dev_info_t *d, dev_info_t *r, ddi_ctl_enum_t op, void *a, void *v)
141 -{
142 - return (DDI_SUCCESS);
143 -}
144 -
145 -#else /* lint */
146 -
147 97 ENTRY(ddi_ctlops)
148 98 tst %o0 ! dip != 0?
149 99 be,pn %ncc, 2f ! nope
150 100 tst %o1 ! rdip != 0?
151 101 be,pn %ncc, 2f ! nope
152 102 ldn [%o0 + DEVI_BUS_CTL], %o0
153 103 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_ctl;
154 104 brz,pn %o0, 2f
155 105 nop ! Delay slot
156 106 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
157 107 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
158 108 ldn [%g1 + OPS_CTL], %g1 ! dip->dev_ops->devo_bus_ops->bus_ctl
159 109 jmpl %g1, %g0 ! bop off to new routine
160 110 nop ! as if we had never been here
161 111 2: retl
162 112 sub %g0, 1, %o0 ! return (DDI_FAILURE);
163 113 SET_SIZE(ddi_ctlops)
164 114
165 -#endif /* lint */
166 -
167 -#if defined(lint)
168 -
169 -/* ARGSUSED */
170 -int
171 -ddi_dma_allochdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_attr_t *attr,
172 - int (*waitfp)(caddr_t), caddr_t arg, ddi_dma_handle_t *handlep)
173 -{
174 - return (DDI_SUCCESS);
175 -}
176 -
177 -#else /* lint */
178 -
179 115 ENTRY(ddi_dma_allochdl)
180 116 ldn [%o0 + DEVI_BUS_DMA_ALLOCHDL], %o0
181 117 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_allochdl;
182 118 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
183 119 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
184 120 ldn [%g1 + OPS_ALLOCHDL], %g1
185 121 ! dip->dev_ops->devo_bus_ops->bus_dma_allochdl
186 122 jmpl %g1, %g0 ! bop off to new routine
187 123 nop ! as if we had never been here
188 124 SET_SIZE(ddi_dma_allochdl)
189 125
190 -#endif /* lint */
191 -
192 -#if defined(lint)
193 -
194 -/* ARGSUSED */
195 -int
196 -ddi_dma_freehdl(dev_info_t *dip, dev_info_t *rdip, ddi_dma_handle_t handlep)
197 -{
198 - return (DDI_SUCCESS);
199 -}
200 -
201 -#else /* lint */
202 -
203 126 ENTRY(ddi_dma_freehdl)
204 127 ldn [%o0 + DEVI_BUS_DMA_FREEHDL], %o0
205 128 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_freehdl;
206 129 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
207 130 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
208 131 ldn [%g1 + OPS_FREEHDL], %g1
209 132 ! dip->dev_ops->devo_bus_ops->bus_dma_freehdl
210 133 jmpl %g1, %g0 ! bop off to new routine
211 134 nop ! as if we had never been here
212 135 SET_SIZE(ddi_dma_freehdl)
213 136
214 -#endif /* lint */
215 -
216 -#if defined(lint)
217 -
218 -/* ARGSUSED */
219 -int
220 -ddi_dma_bindhdl(dev_info_t *dip, dev_info_t *rdip,
221 - ddi_dma_handle_t handle, struct ddi_dma_req *dmareq,
222 - ddi_dma_cookie_t *cp, u_int *ccountp)
223 -{
224 - return (DDI_SUCCESS);
225 -}
226 -
227 -#else /* lint */
228 -
229 137 ENTRY(ddi_dma_bindhdl)
230 138 ldn [%o0 + DEVI_BUS_DMA_BINDHDL], %o0
231 139 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_bindhdl;
232 140 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
233 141 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
234 142 ldn [%g1 + OPS_BINDHDL], %g1
235 143 ! dip->dev_ops->devo_bus_ops->bus_dma_bindhdl
236 144 jmpl %g1, %g0 ! bop off to new routine
237 145 nop ! as if we had never been here
238 146 SET_SIZE(ddi_dma_bindhdl)
239 147
240 -#endif /* lint */
241 -
242 -#if defined(lint)
243 -
244 -/* ARGSUSED */
245 -int
246 -ddi_dma_unbindhdl(dev_info_t *dip, dev_info_t *rdip,
247 - ddi_dma_handle_t handle)
248 -{
249 - return (DDI_SUCCESS);
250 -}
251 -
252 -#else /* lint */
253 -
254 148 ENTRY(ddi_dma_unbindhdl)
255 149 ldn [%o0 + DEVI_BUS_DMA_UNBINDHDL], %o0
256 150 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_unbindhdl;
257 151 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
258 152 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
259 153 ldn [%g1 + OPS_UNBINDHDL], %g1
260 154 ! dip->dev_ops->devo_bus_ops->bus_dma_unbindhdl
261 155 jmpl %g1, %g0 ! bop off to new routine
262 156 nop ! as if we had never been here
263 157 SET_SIZE(ddi_dma_unbindhdl)
264 158
265 -#endif /* lint */
266 -
267 -#if defined(lint)
268 -
269 -/* ARGSUSED */
270 -int
271 -ddi_dma_flush(dev_info_t *dip, dev_info_t *rdip,
272 - ddi_dma_handle_t handle, off_t off, size_t len,
273 - u_int cache_flags)
274 -{
275 - return (DDI_SUCCESS);
276 -}
277 -
278 -#else /* lint */
279 -
280 159 ENTRY(ddi_dma_flush)
281 160 ldn [%o0 + DEVI_BUS_DMA_FLUSH], %o0
282 161 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_flush;
283 162 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
284 163 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
285 164 ldn [%g1 + OPS_FLUSH], %g1
286 165 ! dip->dev_ops->devo_bus_ops->bus_dma_flush
287 166 jmpl %g1, %g0 ! bop off to new routine
288 167 nop ! as if we had never been here
289 168 SET_SIZE(ddi_dma_flush)
290 169
291 -#endif /* lint */
292 -
293 -#if defined(lint)
294 -
295 -/* ARGSUSED */
296 -int
297 -ddi_dma_win(dev_info_t *dip, dev_info_t *rdip,
298 - ddi_dma_handle_t handle, uint_t win, off_t *offp,
299 - size_t *lenp, ddi_dma_cookie_t *cookiep, uint_t *ccountp)
300 -{
301 - return (DDI_SUCCESS);
302 -}
303 -
304 -#else /* lint */
305 -
306 170 ENTRY(ddi_dma_win)
307 171 ldn [%o0 + DEVI_BUS_DMA_WIN], %o0
308 172 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_win;
309 173 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
310 174 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
311 175 ldn [%g1 + OPS_WIN], %g1
312 176 ! dip->dev_ops->devo_bus_ops->bus_dma_win
313 177 jmpl %g1, %g0 ! bop off to new routine
314 178 nop ! as if we had never been here
315 179 SET_SIZE(ddi_dma_win)
316 180
317 -#endif /* lint */
318 -
319 -#if defined(lint)
320 -
321 -/* ARGSUSED */
322 -int
323 -ddi_dma_sync(ddi_dma_handle_t h, off_t o, size_t l, u_int whom)
324 -{
325 - return (DDI_SUCCESS);
326 -}
327 -
328 -#else /* lint */
329 -
330 181 ENTRY(ddi_dma_sync)
331 182 ld [%o0 + DMA_HANDLE_RFLAGS], %o4 ! hp->dmai_rflags;
332 183 sethi %hi(DMP_NOSYNC), %o5
333 184 and %o4, %o5, %o4
334 185 cmp %o4, %o5
335 186 bne 1f
336 187 mov %o3, %o5
337 188 retl
338 189 clr %o0
339 190 1: mov %o1, %o3
340 191 ldn [%o0 + DMA_HANDLE_RDIP], %o1 ! dip = hp->dmai_rdip;
341 192 mov %o0, %g2
342 193 ldn [%o1 + DEVI_BUS_DMA_FLUSH], %o0
343 194 ! dip = DEVI(dip)->devi_bus_dma_flush;
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
344 195 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
345 196 mov %o2, %o4
346 197 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
347 198 mov %g2, %o2
348 199 ldn [%g1 + OPS_FLUSH], %g1
349 200 ! dip->dev_ops->devo_bus_ops->bus_dma_flush
350 201 jmpl %g1, %g0 ! bop off to new routine
351 202 nop ! as if we had never been here
352 203 SET_SIZE(ddi_dma_sync)
353 204
354 -#endif /* lint */
355 -
356 -#if defined(lint)
357 -
358 -/* ARGSUSED */
359 -int
360 -ddi_dma_unbind_handle(ddi_dma_handle_t h)
361 -{
362 - return (DDI_SUCCESS);
363 -}
364 -
365 -#else /* lint */
366 -
367 205 ENTRY(ddi_dma_unbind_handle)
368 206 ldn [%o0 + DMA_HANDLE_RDIP], %o1 ! dip = hp->dmai_rdip;
369 207 mov %o0, %o2
370 208 ldn [%o1 + DEVI_BUS_DMA_UNBINDFUNC ], %g1
371 209 ! funcp = DEVI(dip)->devi_bus_dma_unbindfunc;
372 210 jmpl %g1, %g0 ! bop off to new routine
373 211 ldn [%o1 + DEVI_BUS_DMA_UNBINDHDL], %o0
374 212 ! hdip = (dev_info_t *)DEVI(dip)->devi_bus_dma_unbindhdl;
375 213 SET_SIZE(ddi_dma_unbind_handle)
376 214
377 -#endif /* lint */
378 215
379 -
380 -#if defined(lint)
381 -
382 -/*ARGSUSED*/
383 -int
384 -ddi_dma_mctl(register dev_info_t *dip, dev_info_t *rdip,
385 - ddi_dma_handle_t handle, enum ddi_dma_ctlops request,
386 - off_t *offp, size_t *lenp, caddr_t *objp, u_int flags)
387 -{
388 - return (DDI_SUCCESS);
389 -}
390 -
391 -#else /* lint */
392 -
393 216 ENTRY(ddi_dma_mctl)
394 217 ldn [%o0 + DEVI_BUS_DMA_CTL], %o0
395 218 ! dip = (dev_info_t *)DEVI(dip)->devi_bus_dma_ctl;
396 219 ldn [%o0 + DEVI_DEV_OPS], %g1 ! dip->dev_ops
397 220 ldn [%g1 + DEVI_BUS_OPS], %g1 ! dip->dev_ops->devo_bus_ops
398 221 ldn [%g1 + OPS_MCTL], %g1 ! dip->dev_ops->devo_bus_ops->bus_dma_ctl
399 222 jmpl %g1, %g0 ! bop off to new routine
400 223 nop ! as if we had never been here
401 224 SET_SIZE(ddi_dma_mctl)
402 225
403 -#endif /* lint */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX