Print this page
de-linting of .s files
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/sparc/v9/ml/ddi_v9_asm.s
+++ new/usr/src/uts/sparc/v9/ml/ddi_v9_asm.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 (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 -#pragma ident "%Z%%M% %I% %E% SMI"
27 -
28 26 #include <sys/asi.h>
29 27 #include <sys/asm_linkage.h>
30 28 #include <sys/machthread.h>
31 29 #include <sys/privregs.h>
32 30 #include <sys/ontrap.h>
33 31 #include <sys/dditypes.h>
34 32
35 -#ifndef lint
36 33 #include "assym.h"
37 -#endif
38 34
39 -#if defined(lint)
40 -#include <sys/isa_defs.h>
41 -#include <sys/types.h>
42 -#include <sys/sunddi.h>
43 -#endif /* lint */
44 -
45 35 /*
46 36 * This file implements the following ddi common access
47 37 * functions:
48 38 *
49 39 * ddi_get{8,16,32,64}
50 40 * ddi_put{8,16,32,64}
51 41 *
52 42 * and the underlying "trivial" implementations
53 43 *
54 44 * i_ddi_{get,put}{8,16,32,64}
55 45 *
56 46 * which assume that there is no need to check the access handle -
57 47 * byte swapping will be done by the mmu and the address is always
58 48 * accessible via ld/st instructions.
59 49 */
60 50
61 -#if defined(lint)
62 -
63 -/*ARGSUSED*/
64 -uint8_t
65 -ddi_get8(ddi_acc_handle_t handle, uint8_t *addr)
66 -{
67 - return (0);
68 -}
69 -
70 -/*ARGSUSED*/
71 -uint8_t
72 -ddi_mem_get8(ddi_acc_handle_t handle, uint8_t *addr)
73 -{
74 - return (0);
75 -}
76 -
77 -/*ARGSUSED*/
78 -uint8_t
79 -ddi_io_get8(ddi_acc_handle_t handle, uint8_t *dev_addr)
80 -{
81 - return (0);
82 -}
83 -
84 -/*ARGSUSED*/
85 -uint16_t
86 -ddi_get16(ddi_acc_handle_t handle, uint16_t *addr)
87 -{
88 - return (0);
89 -}
90 -
91 -/*ARGSUSED*/
92 -uint16_t
93 -ddi_mem_get16(ddi_acc_handle_t handle, uint16_t *addr)
94 -{
95 - return (0);
96 -}
97 -
98 -/*ARGSUSED*/
99 -uint16_t
100 -ddi_io_get16(ddi_acc_handle_t handle, uint16_t *dev_addr)
101 -{
102 - return (0);
103 -}
104 -
105 -/*ARGSUSED*/
106 -uint32_t
107 -ddi_get32(ddi_acc_handle_t handle, uint32_t *addr)
108 -{
109 - return (0);
110 -}
111 -
112 -/*ARGSUSED*/
113 -uint32_t
114 -ddi_mem_get32(ddi_acc_handle_t handle, uint32_t *addr)
115 -{
116 - return (0);
117 -}
118 -
119 -/*ARGSUSED*/
120 -uint32_t
121 -ddi_io_get32(ddi_acc_handle_t handle, uint32_t *dev_addr)
122 -{
123 - return (0);
124 -}
125 -
126 -/*ARGSUSED*/
127 -uint64_t
128 -ddi_get64(ddi_acc_handle_t handle, uint64_t *addr)
129 -{
130 - return (0);
131 -}
132 -
133 -/*ARGSUSED*/
134 -uint64_t
135 -ddi_mem_get64(ddi_acc_handle_t handle, uint64_t *addr)
136 -{
137 - return (0);
138 -}
139 -
140 -/*ARGSUSED*/
141 -void
142 -ddi_put8(ddi_acc_handle_t handle, uint8_t *addr, uint8_t value) {}
143 -
144 -/*ARGSUSED*/
145 -void
146 -ddi_mem_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value) {}
147 -
148 -/*ARGSUSED*/
149 -void
150 -ddi_io_put8(ddi_acc_handle_t handle, uint8_t *dev_addr, uint8_t value) {}
151 -
152 -/*ARGSUSED*/
153 -void
154 -ddi_put16(ddi_acc_handle_t handle, uint16_t *addr, uint16_t value) {}
155 -
156 -/*ARGSUSED*/
157 -void
158 -ddi_mem_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value) {}
159 -
160 -/*ARGSUSED*/
161 -void
162 -ddi_io_put16(ddi_acc_handle_t handle, uint16_t *dev_addr, uint16_t value) {}
163 -
164 -/*ARGSUSED*/
165 -void
166 -ddi_put32(ddi_acc_handle_t handle, uint32_t *addr, uint32_t value) {}
167 -
168 -/*ARGSUSED*/
169 -void
170 -ddi_mem_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value) {}
171 -
172 -/*ARGSUSED*/
173 -void
174 -ddi_io_put32(ddi_acc_handle_t handle, uint32_t *dev_addr, uint32_t value) {}
175 -
176 -/*ARGSUSED*/
177 -void
178 -ddi_put64(ddi_acc_handle_t handle, uint64_t *addr, uint64_t value) {}
179 -
180 -/*ARGSUSED*/
181 -void
182 -ddi_mem_put64(ddi_acc_handle_t handle, uint64_t *dev_addr, uint64_t value) {}
183 -
184 -/*ARGSUSED*/
185 -void
186 -ddi_rep_get8(ddi_acc_handle_t handle, uint8_t *host_addr, uint8_t *dev_addr,
187 - size_t repcount, uint_t flags)
188 -{
189 -}
190 -
191 -/*ARGSUSED*/
192 -void
193 -ddi_rep_get16(ddi_acc_handle_t handle, uint16_t *host_addr, uint16_t *dev_addr,
194 - size_t repcount, uint_t flags)
195 -{
196 -}
197 -
198 -/*ARGSUSED*/
199 -void
200 -ddi_rep_get32(ddi_acc_handle_t handle, uint32_t *host_addr, uint32_t *dev_addr,
201 - size_t repcount, uint_t flags)
202 -{
203 -}
204 -
205 -/*ARGSUSED*/
206 -void
207 -ddi_rep_get64(ddi_acc_handle_t handle, uint64_t *host_addr, uint64_t *dev_addr,
208 - size_t repcount, uint_t flags)
209 -{
210 -}
211 -
212 -/*ARGSUSED*/
213 -void
214 -ddi_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr, uint8_t *dev_addr,
215 - size_t repcount, uint_t flags)
216 -{
217 -}
218 -
219 -/*ARGSUSED*/
220 -void
221 -ddi_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr, uint16_t *dev_addr,
222 - size_t repcount, uint_t flags)
223 -{
224 -}
225 -
226 -/*ARGSUSED*/
227 -void
228 -ddi_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr, uint32_t *dev_addr,
229 - size_t repcount, uint_t flags)
230 -{
231 -}
232 -
233 -/*ARGSUSED*/
234 -void
235 -ddi_rep_put64(ddi_acc_handle_t handle, uint64_t *host_addr, uint64_t *dev_addr,
236 - size_t repcount, uint_t flags)
237 -{
238 -}
239 -
240 -/*ARGSUSED*/
241 -void
242 -ddi_mem_rep_get8(ddi_acc_handle_t handle, uint8_t *host_addr,
243 - uint8_t *dev_addr, size_t repcount, uint_t flags)
244 -{
245 -}
246 -
247 -/*ARGSUSED*/
248 -void
249 -ddi_mem_rep_get16(ddi_acc_handle_t handle, uint16_t *host_addr,
250 - uint16_t *dev_addr, size_t repcount, uint_t flags)
251 -{
252 -}
253 -
254 -/*ARGSUSED*/
255 -void
256 -ddi_mem_rep_get32(ddi_acc_handle_t handle, uint32_t *host_addr,
257 - uint32_t *dev_addr, size_t repcount, uint_t flags)
258 -{
259 -}
260 -
261 -/*ARGSUSED*/
262 -void
263 -ddi_mem_rep_get64(ddi_acc_handle_t handle, uint64_t *host_addr,
264 - uint64_t *dev_addr, size_t repcount, uint_t flags)
265 -{
266 -}
267 -
268 -/*ARGSUSED*/
269 -void
270 -ddi_mem_rep_put8(ddi_acc_handle_t handle, uint8_t *host_addr,
271 - uint8_t *dev_addr, size_t repcount, uint_t flags)
272 -{
273 -}
274 -
275 -/*ARGSUSED*/
276 -void
277 -ddi_mem_rep_put16(ddi_acc_handle_t handle, uint16_t *host_addr,
278 - uint16_t *dev_addr, size_t repcount, uint_t flags)
279 -{
280 -}
281 -
282 -/*ARGSUSED*/
283 -void
284 -ddi_mem_rep_put32(ddi_acc_handle_t handle, uint32_t *host_addr,
285 - uint32_t *dev_addr, size_t repcount, uint_t flags)
286 -{
287 -}
288 -
289 -/*ARGSUSED*/
290 -void
291 -ddi_mem_rep_put64(ddi_acc_handle_t handle, uint64_t *host_addr,
292 - uint64_t *dev_addr, size_t repcount, uint_t flags)
293 -{
294 -}
295 -
296 -/*ARGSUSED*/
297 -void
298 -ddi_io_rep_get8(ddi_acc_handle_t handle,
299 - uint8_t *host_addr, uint8_t *dev_addr, size_t repcount) {}
300 -
301 -/*ARGSUSED*/
302 -void
303 -ddi_io_rep_get16(ddi_acc_handle_t handle,
304 - uint16_t *host_addr, uint16_t *dev_addr, size_t repcount) {}
305 -
306 -/*ARGSUSED*/
307 -void
308 -ddi_io_rep_get32(ddi_acc_handle_t handle,
309 - uint32_t *host_addr, uint32_t *dev_addr, size_t repcount) {}
310 -
311 -/*ARGSUSED*/
312 -void
313 -ddi_io_rep_put8(ddi_acc_handle_t handle,
314 - uint8_t *host_addr, uint8_t *dev_addr, size_t repcount) {}
315 -
316 -/*ARGSUSED*/
317 -void
318 -ddi_io_rep_put16(ddi_acc_handle_t handle,
319 - uint16_t *host_addr, uint16_t *dev_addr, size_t repcount) {}
320 -
321 -
322 -/*ARGSUSED*/
323 -void
324 -ddi_io_rep_put32(ddi_acc_handle_t handle,
325 - uint32_t *host_addr, uint32_t *dev_addr, size_t repcount) {}
326 -
327 -/*ARGSUSED*/
328 -uint8_t
329 -i_ddi_get8(ddi_acc_impl_t *hdlp, uint8_t *addr)
330 -{
331 - return (0);
332 -}
333 -
334 -/*ARGSUSED*/
335 -uint16_t
336 -i_ddi_get16(ddi_acc_impl_t *hdlp, uint16_t *addr)
337 -{
338 - return (0);
339 -}
340 -
341 -/*ARGSUSED*/
342 -uint32_t
343 -i_ddi_get32(ddi_acc_impl_t *hdlp, uint32_t *addr)
344 -{
345 - return (0);
346 -}
347 -
348 -/*ARGSUSED*/
349 -uint64_t
350 -i_ddi_get64(ddi_acc_impl_t *hdlp, uint64_t *addr)
351 -{
352 - return (0);
353 -}
354 -
355 -/*ARGSUSED*/
356 -void
357 -i_ddi_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value) {}
358 -
359 -/*ARGSUSED*/
360 -void
361 -i_ddi_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value) {}
362 -
363 -/*ARGSUSED*/
364 -void
365 -i_ddi_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value) {}
366 -
367 -/*ARGSUSED*/
368 -void
369 -i_ddi_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value) {}
370 -
371 -/*ARGSUSED*/
372 -void
373 -i_ddi_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
374 - size_t repcount, uint_t flags)
375 -{
376 -}
377 -
378 -/*ARGSUSED*/
379 -void
380 -i_ddi_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
381 - uint16_t *dev_addr, size_t repcount, uint_t flags)
382 -{
383 -}
384 -
385 -/*ARGSUSED*/
386 -void
387 -i_ddi_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
388 - uint32_t *dev_addr, size_t repcount, uint_t flags)
389 -{
390 -}
391 -
392 -/*ARGSUSED*/
393 -void
394 -i_ddi_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
395 - uint64_t *dev_addr, size_t repcount, uint_t flags)
396 -{
397 -}
398 -
399 -/*ARGSUSED*/
400 -void
401 -i_ddi_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
402 - size_t repcount, uint_t flags)
403 -{
404 -}
405 -
406 -/*ARGSUSED*/
407 -void
408 -i_ddi_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
409 - uint16_t *dev_addr, size_t repcount, uint_t flags)
410 -{
411 -}
412 -
413 -/*ARGSUSED*/
414 -void
415 -i_ddi_rep_put32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
416 - uint32_t *dev_addr, size_t repcount, uint_t flags)
417 -{
418 -}
419 -
420 -/*ARGSUSED*/
421 -void
422 -i_ddi_rep_put64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
423 - uint64_t *dev_addr, size_t repcount, uint_t flags)
424 -{
425 -}
426 -
427 -/*ARGSUSED*/
428 -uint8_t
429 -i_ddi_prot_get8(ddi_acc_impl_t *hdlp, uint8_t *addr)
430 -{
431 - return (0);
432 -}
433 -
434 -/*ARGSUSED*/
435 -uint16_t
436 -i_ddi_prot_get16(ddi_acc_impl_t *hdlp, uint16_t *addr)
437 -{
438 - return (0);
439 -}
440 -
441 -/*ARGSUSED*/
442 -uint32_t
443 -i_ddi_prot_get32(ddi_acc_impl_t *hdlp, uint32_t *addr)
444 -{
445 - return (0);
446 -}
447 -
448 -/*ARGSUSED*/
449 -uint64_t
450 -i_ddi_prot_get64(ddi_acc_impl_t *hdlp, uint64_t *addr)
451 -{
452 - return (0);
453 -}
454 -
455 -/*ARGSUSED*/
456 -void
457 -i_ddi_prot_put8(ddi_acc_impl_t *hdlp, uint8_t *addr, uint8_t value) {}
458 -
459 -/*ARGSUSED*/
460 -void
461 -i_ddi_prot_put16(ddi_acc_impl_t *hdlp, uint16_t *addr, uint16_t value) {}
462 -
463 -/*ARGSUSED*/
464 -void
465 -i_ddi_prot_put32(ddi_acc_impl_t *hdlp, uint32_t *addr, uint32_t value) {}
466 -
467 -/*ARGSUSED*/
468 -void
469 -i_ddi_prot_put64(ddi_acc_impl_t *hdlp, uint64_t *addr, uint64_t value) {}
470 -
471 -/*ARGSUSED*/
472 -void
473 -i_ddi_prot_rep_get8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
474 - size_t repcount, uint_t flags)
475 -{
476 -}
477 -
478 -/*ARGSUSED*/
479 -void
480 -i_ddi_prot_rep_get16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
481 - uint16_t *dev_addr, size_t repcount, uint_t flags)
482 -{
483 -}
484 -
485 -/*ARGSUSED*/
486 -void
487 -i_ddi_prot_rep_get32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
488 - uint32_t *dev_addr, size_t repcount, uint_t flags)
489 -{
490 -}
491 -
492 -/*ARGSUSED*/
493 -void
494 -i_ddi_prot_rep_get64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
495 - uint64_t *dev_addr, size_t repcount, uint_t flags)
496 -{
497 -}
498 -
499 -/*ARGSUSED*/
500 -void
501 -i_ddi_prot_rep_put8(ddi_acc_impl_t *hdlp, uint8_t *host_addr, uint8_t *dev_addr,
502 - size_t repcount, uint_t flags)
503 -{
504 -}
505 -
506 -/*ARGSUSED*/
507 -void
508 -i_ddi_prot_rep_put16(ddi_acc_impl_t *hdlp, uint16_t *host_addr,
509 - uint16_t *dev_addr, size_t repcount, uint_t flags)
510 -{
511 -}
512 -
513 -/*ARGSUSED*/
514 -void
515 -i_ddi_prot_rep_put32(ddi_acc_impl_t *hdlp, uint32_t *host_addr,
516 - uint32_t *dev_addr, size_t repcount, uint_t flags)
517 -{
518 -}
519 -
520 -/*ARGSUSED*/
521 -void
522 -i_ddi_prot_rep_put64(ddi_acc_impl_t *hdlp, uint64_t *host_addr,
523 - uint64_t *dev_addr, size_t repcount, uint_t flags)
524 -{
525 -}
526 -
527 -/*ARGSUSED*/
528 -int
529 -i_ddi_ontrap(ddi_acc_handle_t handle)
530 -{
531 - return (0);
532 -}
533 -
534 -/*ARGSUSED*/
535 -void
536 -i_ddi_notrap(ddi_acc_handle_t handle)
537 -{
538 -}
539 -
540 -/*ARGSUSED*/
541 -void
542 -i_ddi_caut_get(size_t getsz, void *addr, void *value)
543 -{
544 -}
545 -
546 -#else
547 -
548 51 /*
549 52 * The functionality of each of the ddi_get/put routines is performed by
550 53 * the respective indirect function defined in the access handle. Use of
551 54 * the access handle functions provides compatibility across platforms for
552 55 * drivers.
553 56 *
554 57 * By default, the indirect access handle functions are initialized to the
555 58 * i_ddi_get/put routines to perform memory mapped IO. If memory mapped IO
556 59 * is not possible or desired, the access handle must be intialized to another
557 60 * valid routine to perform the sepcified IO operation.
558 61 *
559 62 * The alignment and placement of the following functions have been optimized
560 63 * such that the implementation specific versions, i_ddi*, fall within the
561 64 * same cache-line of the generic versions, ddi_*. This insures that an
562 65 * I-cache hit will occur thus minimizing the performance impact of using the
563 66 * access handle.
564 67 */
565 68
566 69 .align 32
567 70 ENTRY(ddi_get8)
568 71 ALTENTRY(ddi_getb)
569 72 ALTENTRY(ddi_io_get8)
570 73 ALTENTRY(ddi_io_getb)
571 74 ALTENTRY(ddi_mem_get8)
572 75 ALTENTRY(ddi_mem_getb)
573 76 ldn [%o0 + AHI_GET8], %g1 /* hdl->ahi_get8 access hndl */
574 77 jmpl %g1, %g0 /* jump to access handle routine */
575 78 nop
576 79 SET_SIZE(ddi_get8)
577 80 SET_SIZE(ddi_getb)
578 81 SET_SIZE(ddi_io_get8)
579 82 SET_SIZE(ddi_io_getb)
580 83 SET_SIZE(ddi_mem_get8)
581 84 SET_SIZE(ddi_mem_getb)
582 85
583 86 .align 16
584 87 ENTRY(i_ddi_get8)
585 88 retl
586 89 ldub [%o1], %o0
587 90 SET_SIZE(i_ddi_get8)
588 91
589 92 .align 32
590 93 ENTRY(ddi_get16)
591 94 ALTENTRY(ddi_getw)
592 95 ALTENTRY(ddi_io_get16)
593 96 ALTENTRY(ddi_io_getw)
594 97 ALTENTRY(ddi_mem_get16)
595 98 ALTENTRY(ddi_mem_getw)
596 99 ldn [%o0 + AHI_GET16], %g1 /* hdl->ahi_get16 access hndl */
597 100 jmpl %g1, %g0 /* jump to access handle routine */
598 101 nop
599 102 SET_SIZE(ddi_get16)
600 103 SET_SIZE(ddi_getw)
601 104 SET_SIZE(ddi_io_get16)
602 105 SET_SIZE(ddi_io_getw)
603 106 SET_SIZE(ddi_mem_get16)
604 107 SET_SIZE(ddi_mem_getw)
605 108
606 109 .align 16
607 110 ENTRY(i_ddi_get16)
608 111 ALTENTRY(i_ddi_swap_get16)
609 112 retl
610 113 lduh [%o1], %o0
611 114 SET_SIZE(i_ddi_get16)
612 115 SET_SIZE(i_ddi_swap_get16)
613 116
614 117 .align 32
615 118 ENTRY(ddi_get32)
616 119 ALTENTRY(ddi_getl)
617 120 ALTENTRY(ddi_io_get32)
618 121 ALTENTRY(ddi_io_getl)
619 122 ALTENTRY(ddi_mem_get32)
620 123 ALTENTRY(ddi_mem_getl)
621 124 ldn [%o0 + AHI_GET32], %g1 /* hdl->ahi_get32 access handle */
622 125 jmpl %g1, %g0 /* jump to access handle routine */
623 126 nop
624 127 SET_SIZE(ddi_get32)
625 128 SET_SIZE(ddi_getl)
626 129 SET_SIZE(ddi_io_get32)
627 130 SET_SIZE(ddi_io_getl)
628 131 SET_SIZE(ddi_mem_get32)
629 132 SET_SIZE(ddi_mem_getl)
630 133
631 134 .align 16
632 135 ENTRY(i_ddi_get32)
633 136 ALTENTRY(i_ddi_swap_get32)
634 137 retl
635 138 ld [%o1], %o0
636 139 SET_SIZE(i_ddi_get32)
637 140 SET_SIZE(i_ddi_swap_get32)
638 141
639 142 .align 32
640 143 ENTRY(ddi_get64)
641 144 ALTENTRY(ddi_getll)
642 145 ALTENTRY(ddi_io_get64)
643 146 ALTENTRY(ddi_io_getll)
644 147 ALTENTRY(ddi_mem_get64)
645 148 ALTENTRY(ddi_mem_getll)
646 149 ldn [%o0 + AHI_GET64], %g1 /* hdl->ahi_get64 access handle */
647 150 jmpl %g1, %g0 /* jump to access handle routine */
648 151 nop
649 152 SET_SIZE(ddi_get64)
650 153 SET_SIZE(ddi_getll)
651 154 SET_SIZE(ddi_io_get64)
652 155 SET_SIZE(ddi_io_getll)
653 156 SET_SIZE(ddi_mem_get64)
654 157 SET_SIZE(ddi_mem_getll)
655 158
656 159 .align 16
657 160 ENTRY(i_ddi_get64)
658 161 ALTENTRY(i_ddi_swap_get64)
659 162 retl
660 163 ldx [%o1], %o0
661 164 SET_SIZE(i_ddi_get64)
662 165 SET_SIZE(i_ddi_swap_get64)
663 166
664 167 .align 32
665 168 ENTRY(ddi_put8)
666 169 ALTENTRY(ddi_putb)
667 170 ALTENTRY(ddi_io_put8)
668 171 ALTENTRY(ddi_io_putb)
669 172 ALTENTRY(ddi_mem_put8)
670 173 ALTENTRY(ddi_mem_putb)
671 174 ldn [%o0 + AHI_PUT8], %g1 /* hdl->ahi_put8 access handle */
672 175 jmpl %g1, %g0 /* jump to access handle routine */
673 176 nop
674 177 SET_SIZE(ddi_put8)
675 178 SET_SIZE(ddi_putb)
676 179 SET_SIZE(ddi_io_put8)
677 180 SET_SIZE(ddi_io_putb)
678 181 SET_SIZE(ddi_mem_put8)
679 182 SET_SIZE(ddi_mem_putb)
680 183
681 184 .align 16
682 185 ENTRY(i_ddi_put8)
683 186 retl
684 187 stub %o2, [%o1]
685 188 SET_SIZE(i_ddi_put8)
686 189
687 190 .align 32
688 191 ENTRY(ddi_put16)
689 192 ALTENTRY(ddi_putw)
690 193 ALTENTRY(ddi_io_put16)
691 194 ALTENTRY(ddi_io_putw)
692 195 ALTENTRY(ddi_mem_put16)
693 196 ALTENTRY(ddi_mem_putw)
694 197 ldn [%o0 + AHI_PUT16], %g1 /* hdl->ahi_put16 access handle */
695 198 jmpl %g1, %g0 /* jump to access handle routine */
696 199 nop
697 200 SET_SIZE(ddi_put16)
698 201 SET_SIZE(ddi_putw)
699 202 SET_SIZE(ddi_io_put16)
700 203 SET_SIZE(ddi_io_putw)
701 204 SET_SIZE(ddi_mem_put16)
702 205 SET_SIZE(ddi_mem_putw)
703 206
704 207 .align 16
705 208 ENTRY(i_ddi_put16)
706 209 ALTENTRY(i_ddi_swap_put16)
707 210 retl
708 211 stuh %o2, [%o1]
709 212 SET_SIZE(i_ddi_put16)
710 213 SET_SIZE(i_ddi_swap_put16)
711 214
712 215 .align 32
713 216 ENTRY(ddi_put32)
714 217 ALTENTRY(ddi_putl)
715 218 ALTENTRY(ddi_io_put32)
716 219 ALTENTRY(ddi_io_putl)
717 220 ALTENTRY(ddi_mem_put32)
718 221 ALTENTRY(ddi_mem_putl)
719 222 ldn [%o0 + AHI_PUT32], %g1 /* hdl->ahi_put16 access handle */
720 223 jmpl %g1, %g0 /* jump to access handle routine */
721 224 nop
722 225 SET_SIZE(ddi_put32)
723 226 SET_SIZE(ddi_putl)
724 227 SET_SIZE(ddi_io_put32)
725 228 SET_SIZE(ddi_io_putl)
726 229 SET_SIZE(ddi_mem_put32)
727 230 SET_SIZE(ddi_mem_putl)
728 231
729 232 .align 16
730 233 ENTRY(i_ddi_put32)
731 234 ALTENTRY(i_ddi_swap_put32)
732 235 retl
733 236 st %o2, [%o1]
734 237 SET_SIZE(i_ddi_put32)
735 238 SET_SIZE(i_ddi_swap_put32)
736 239
737 240 .align 32
738 241 ENTRY(ddi_put64)
739 242 ALTENTRY(ddi_putll)
740 243 ALTENTRY(ddi_io_put64)
741 244 ALTENTRY(ddi_io_putll)
742 245 ALTENTRY(ddi_mem_put64)
743 246 ALTENTRY(ddi_mem_putll)
744 247 ldn [%o0 + AHI_PUT64], %g1 /* hdl->ahi_put64 access handle */
745 248 jmpl %g1, %g0 /* jump to access handle routine */
746 249 nop
747 250 SET_SIZE(ddi_put64)
748 251 SET_SIZE(ddi_putll)
749 252 SET_SIZE(ddi_io_put64)
750 253 SET_SIZE(ddi_io_putll)
751 254 SET_SIZE(ddi_mem_put64)
752 255 SET_SIZE(ddi_mem_putll)
753 256
754 257 .align 16
755 258 ENTRY(i_ddi_put64)
756 259 ALTENTRY(i_ddi_swap_put64)
757 260 retl
758 261 stx %o2, [%o1]
759 262 SET_SIZE(i_ddi_put64)
760 263 SET_SIZE(i_ddi_swap_put64)
761 264
762 265 /*
763 266 * The ddi_io_rep_get/put routines don't take a flag argument like the "plain"
764 267 * and mem versions do. This flag is used to determine whether or not the
765 268 * device address or port should be automatically incremented. For IO space,
766 269 * the device port is never incremented and as such, the flag is always set
767 270 * to DDI_DEV_NO_AUTOINCR.
768 271 *
769 272 * This define processes the repetitive get functionality. Automatic
770 273 * incrementing of the device address is determined by the flag field
771 274 * %o4. If this is set for AUTOINCR, %o4 is updated with 1 for the
772 275 * subsequent increment in 2:.
773 276 *
774 277 * If this flag is not set for AUTOINCR, %o4 is update with a value of 0 thus
775 278 * making the increment operation a non-operation.
776 279 */
777 280
778 281 #define DDI_REP_GET(n,s) \
779 282 cmp DDI_DEV_NO_AUTOINCR, %o4; \
780 283 mov %g0, %o4; \
781 284 brz,pn %o3, 1f; \
782 285 movnz %xcc, n, %o4; \
783 286 2: \
784 287 dec %o3; \
785 288 ld/**/s [%o2], %g4; \
786 289 add %o2, %o4, %o2; \
787 290 st/**/s %g4, [%o1]; \
788 291 brnz,pt %o3, 2b; \
789 292 add %o1, n, %o1; \
790 293 1:
791 294
792 295 .align 32
793 296 ENTRY(ddi_rep_get8)
794 297 ALTENTRY(ddi_rep_getb)
795 298 ALTENTRY(ddi_mem_rep_get8)
796 299 ALTENTRY(ddi_mem_rep_getb)
797 300 ldn [%o0 + AHI_REP_GET8], %g1
798 301 jmpl %g1, %g0
799 302 nop
800 303 SET_SIZE(ddi_rep_get8)
801 304 SET_SIZE(ddi_rep_getb)
802 305 SET_SIZE(ddi_mem_rep_get8)
803 306 SET_SIZE(ddi_mem_rep_getb)
804 307
805 308 .align 16
806 309 ENTRY(i_ddi_rep_get8)
807 310 DDI_REP_GET(1,ub)
808 311 retl
809 312 nop
810 313 SET_SIZE(i_ddi_rep_get8)
811 314
812 315 .align 32
813 316 ENTRY(ddi_rep_get16)
814 317 ALTENTRY(ddi_rep_getw)
815 318 ALTENTRY(ddi_mem_rep_get16)
816 319 ALTENTRY(ddi_mem_rep_getw)
817 320 ldn [%o0 + AHI_REP_GET16], %g1
818 321 jmpl %g1, %g0
819 322 nop
820 323 SET_SIZE(ddi_rep_get16)
821 324 SET_SIZE(ddi_rep_getw)
822 325 SET_SIZE(ddi_mem_rep_get16)
823 326 SET_SIZE(ddi_mem_rep_getw)
824 327
825 328 .align 16
826 329 ENTRY(i_ddi_rep_get16)
827 330 ALTENTRY(i_ddi_swap_rep_get16)
828 331 DDI_REP_GET(2,uh)
829 332 retl
830 333 nop
831 334 SET_SIZE(i_ddi_rep_get16)
832 335 SET_SIZE(i_ddi_swap_rep_get16)
833 336
834 337 .align 32
835 338 ENTRY(ddi_rep_get32)
836 339 ALTENTRY(ddi_rep_getl)
837 340 ALTENTRY(ddi_mem_rep_get32)
838 341 ALTENTRY(ddi_mem_rep_getl)
839 342 ldn [%o0 + AHI_REP_GET32], %g1
840 343 jmpl %g1, %g0
841 344 nop
842 345 SET_SIZE(ddi_rep_get32)
843 346 SET_SIZE(ddi_rep_getl)
844 347 SET_SIZE(ddi_mem_rep_get32)
845 348 SET_SIZE(ddi_mem_rep_getl)
846 349
847 350 .align 16
848 351 ENTRY(i_ddi_rep_get32)
849 352 ALTENTRY(i_ddi_swap_rep_get32)
850 353 DDI_REP_GET(4,/**/)
851 354 retl
852 355 nop
853 356 SET_SIZE(i_ddi_rep_get32)
854 357 SET_SIZE(i_ddi_swap_rep_get32)
855 358
856 359 .align 32
857 360 ENTRY(ddi_rep_get64)
858 361 ALTENTRY(ddi_rep_getll)
859 362 ALTENTRY(ddi_mem_rep_get64)
860 363 ALTENTRY(ddi_mem_rep_getll)
861 364 ldn [%o0 + AHI_REP_GET64], %g1
862 365 jmpl %g1, %g0
863 366 nop
864 367 SET_SIZE(ddi_rep_get64)
865 368 SET_SIZE(ddi_rep_getll)
866 369 SET_SIZE(ddi_mem_rep_get64)
867 370 SET_SIZE(ddi_mem_rep_getll)
868 371
869 372 .align 16
870 373 ENTRY(i_ddi_rep_get64)
871 374 ALTENTRY(i_ddi_swap_rep_get64)
872 375 DDI_REP_GET(8,x)
873 376 retl
874 377 nop
875 378 SET_SIZE(i_ddi_rep_get64)
876 379 SET_SIZE(i_ddi_swap_rep_get64)
877 380
878 381 /*
879 382 * This define processes the repetitive put functionality. Automatic
880 383 * incrementing of the device address is determined by the flag field
881 384 * %o4. If this is set for AUTOINCR, %o4 is updated with 1 for the
882 385 * subsequent increment in 2:.
883 386 *
884 387 * If this flag is not set for AUTOINCR, %o4 is update with a value of 0 thus
885 388 * making the increment operation a non-operation.
886 389 */
887 390 #define DDI_REP_PUT(n,s) \
888 391 cmp DDI_DEV_NO_AUTOINCR, %o4; \
889 392 mov %g0, %o4; \
890 393 brz,pn %o3, 1f; \
891 394 movnz %xcc, n, %o4; \
892 395 2: \
893 396 dec %o3; \
894 397 ld/**/s [%o1], %g4; \
895 398 add %o1, n, %o1; \
896 399 st/**/s %g4, [%o2]; \
897 400 brnz,pt %o3, 2b; \
898 401 add %o2, %o4, %o2; \
899 402 1:
900 403
901 404 .align 32
902 405 ENTRY(ddi_rep_put8)
903 406 ALTENTRY(ddi_rep_putb)
904 407 ALTENTRY(ddi_mem_rep_put8)
905 408 ALTENTRY(ddi_mem_rep_putb)
906 409 ldn [%o0 + AHI_REP_PUT8], %g1
907 410 jmpl %g1, %g0
908 411 nop
909 412 SET_SIZE(ddi_rep_put8)
910 413 SET_SIZE(ddi_rep_putb)
911 414 SET_SIZE(ddi_mem_rep_put8)
912 415 SET_SIZE(ddi_mem_rep_putb)
913 416
914 417 .align 16
915 418 ENTRY(i_ddi_rep_put8)
916 419 DDI_REP_PUT(1,ub)
917 420 retl
918 421 nop
919 422 SET_SIZE(i_ddi_rep_put8)
920 423
921 424 .align 32
922 425 ENTRY(ddi_rep_put16)
923 426 ALTENTRY(ddi_rep_putw)
924 427 ALTENTRY(ddi_mem_rep_put16)
925 428 ALTENTRY(ddi_mem_rep_putw)
926 429 ldn [%o0 + AHI_REP_PUT16], %g1
927 430 jmpl %g1, %g0
928 431 nop
929 432 SET_SIZE(ddi_rep_put16)
930 433 SET_SIZE(ddi_rep_putw)
931 434 SET_SIZE(ddi_mem_rep_put16)
932 435 SET_SIZE(ddi_mem_rep_putw)
933 436
934 437 .align 16
935 438 ENTRY(i_ddi_rep_put16)
936 439 ALTENTRY(i_ddi_swap_rep_put16)
937 440 DDI_REP_PUT(2,uh)
938 441 retl
939 442 nop
940 443 SET_SIZE(i_ddi_rep_put16)
941 444 SET_SIZE(i_ddi_swap_rep_put16)
942 445
943 446 .align 32
944 447 ENTRY(ddi_rep_put32)
945 448 ALTENTRY(ddi_rep_putl)
946 449 ALTENTRY(ddi_mem_rep_put32)
947 450 ALTENTRY(ddi_mem_rep_putl)
948 451 ldn [%o0 + AHI_REP_PUT32], %g1
949 452 jmpl %g1, %g0
950 453 nop
951 454 SET_SIZE(ddi_rep_put32)
952 455 SET_SIZE(ddi_rep_putl)
953 456 SET_SIZE(ddi_mem_rep_put32)
954 457 SET_SIZE(ddi_mem_rep_putl)
955 458
956 459 .align 16
957 460 ENTRY(i_ddi_rep_put32)
958 461 ALTENTRY(i_ddi_swap_rep_put32)
959 462 DDI_REP_PUT(4,/**/)
960 463 retl
961 464 nop
962 465 SET_SIZE(i_ddi_rep_put32)
963 466 SET_SIZE(i_ddi_swap_rep_put32)
964 467
965 468 .align 32
966 469 ENTRY(ddi_rep_put64)
967 470 ALTENTRY(ddi_rep_putll)
968 471 ALTENTRY(ddi_mem_rep_put64)
969 472 ALTENTRY(ddi_mem_rep_putll)
970 473 ldn [%o0 + AHI_REP_PUT64], %g1
971 474 jmpl %g1, %g0
972 475 nop
973 476 SET_SIZE(ddi_rep_put64)
974 477 SET_SIZE(ddi_rep_putll)
975 478 SET_SIZE(ddi_mem_rep_put64)
976 479 SET_SIZE(ddi_mem_rep_putll)
977 480
978 481 .align 16
979 482 ENTRY(i_ddi_rep_put64)
980 483 ALTENTRY(i_ddi_swap_rep_put64)
981 484 DDI_REP_PUT(8,x)
982 485 retl
983 486 nop
984 487 SET_SIZE(i_ddi_rep_put64)
985 488 SET_SIZE(i_ddi_swap_rep_put64)
986 489
987 490 .align 16
988 491 ENTRY(ddi_io_rep_get8)
989 492 ALTENTRY(ddi_io_rep_getb)
990 493 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
991 494 ldn [%o0 + AHI_REP_GET8], %g1
992 495 jmpl %g1, %g0
993 496 nop
994 497 SET_SIZE(ddi_io_rep_get8)
995 498 SET_SIZE(ddi_io_rep_getb)
996 499
997 500 .align 16
998 501 ENTRY(ddi_io_rep_get16)
999 502 ALTENTRY(ddi_io_rep_getw)
1000 503 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1001 504 ldn [%o0 + AHI_REP_GET16], %g1
1002 505 jmpl %g1, %g0
1003 506 nop
1004 507 SET_SIZE(ddi_io_rep_get16)
1005 508 SET_SIZE(ddi_io_rep_getw)
1006 509
1007 510 .align 16
1008 511 ENTRY(ddi_io_rep_get32)
1009 512 ALTENTRY(ddi_io_rep_getl)
1010 513 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1011 514 ldn [%o0 + AHI_REP_GET32], %g1
1012 515 jmpl %g1, %g0
1013 516 nop
1014 517 SET_SIZE(ddi_io_rep_get32)
1015 518 SET_SIZE(ddi_io_rep_getl)
1016 519
1017 520 .align 16
1018 521 ENTRY(ddi_io_rep_get64)
1019 522 ALTENTRY(ddi_io_rep_getll)
1020 523 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1021 524 ldn [%o0 + AHI_REP_GET64], %g1
1022 525 jmpl %g1, %g0
1023 526 nop
1024 527 SET_SIZE(ddi_io_rep_get64)
1025 528 SET_SIZE(ddi_io_rep_getll)
1026 529
1027 530 .align 64
1028 531 ENTRY(ddi_check_acc_handle)
1029 532 save %sp, -SA(WINDOWSIZE), %sp ! get a new window
1030 533 ldn [%i0 + AHI_FAULT_CHECK], %g1
1031 534 jmpl %g1, %o7
1032 535 mov %i0, %o0
1033 536 brnz,a,pn %o0, 0f ! if (return_value != 0)
1034 537 mov -1, %o0 ! return (DDI_FAILURE)
1035 538 0: ! else return (DDI_SUCCESS)
1036 539 sra %o0, 0, %i0
1037 540 ret
1038 541 restore
1039 542 SET_SIZE(ddi_check_acc_handle)
1040 543
1041 544 .align 16
1042 545 ENTRY(i_ddi_acc_fault_check)
1043 546 retl
1044 547 ld [%o0 + AHI_FAULT], %o0
1045 548 SET_SIZE(i_ddi_acc_fault_check)
1046 549
1047 550 .align 16
1048 551 ENTRY(ddi_io_rep_put8)
1049 552 ALTENTRY(ddi_io_rep_putb)
1050 553 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1051 554 ldn [%o0 + AHI_REP_PUT8], %g1
1052 555 jmpl %g1, %g0
1053 556 nop
1054 557 SET_SIZE(ddi_io_rep_put8)
1055 558 SET_SIZE(ddi_io_rep_putb)
1056 559
1057 560 .align 16
1058 561 ENTRY(ddi_io_rep_put16)
1059 562 ALTENTRY(ddi_io_rep_putw)
1060 563 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1061 564 ldn [%o0 + AHI_REP_PUT16], %g1
1062 565 jmpl %g1, %g0
1063 566 nop
1064 567 SET_SIZE(ddi_io_rep_put16)
1065 568 SET_SIZE(ddi_io_rep_putw)
1066 569
1067 570 .align 16
1068 571 ENTRY(ddi_io_rep_put32)
1069 572 ALTENTRY(ddi_io_rep_putl)
1070 573 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1071 574 ldn [%o0 + AHI_REP_PUT32], %g1
1072 575 jmpl %g1, %g0
1073 576 nop
1074 577 SET_SIZE(ddi_io_rep_put32)
1075 578 SET_SIZE(ddi_io_rep_putl)
1076 579
1077 580 .align 16
1078 581 ENTRY(ddi_io_rep_put64)
1079 582 ALTENTRY(ddi_io_rep_putll)
1080 583 set DDI_DEV_NO_AUTOINCR, %o4 /* Set flag to DDI_DEV_NO_AUTOINCR */
1081 584 ldn [%o0 + AHI_REP_PUT64], %g1
1082 585 jmpl %g1, %g0
1083 586 nop
1084 587 SET_SIZE(ddi_io_rep_put64)
1085 588 SET_SIZE(ddi_io_rep_putll)
1086 589
1087 590 ENTRY(do_peek)
1088 591 rdpr %pstate, %o3 ! check ints
1089 592 andcc %o3, PSTATE_IE, %g0
1090 593 bz,a done
1091 594 or %g0, 1, %o0 ! Return failure if ints are disabled
1092 595 wrpr %o3, PSTATE_IE, %pstate
1093 596 cmp %o0, 8 ! 64-bit?
1094 597 bne,a .peek_int
1095 598 cmp %o0, 4 ! 32-bit?
1096 599 ldx [%o1], %g1
1097 600 ba .peekdone
1098 601 stx %g1, [%o2]
1099 602 .peek_int:
1100 603 bne,a .peek_half
1101 604 cmp %o0, 2 ! 16-bit?
1102 605 lduw [%o1], %g1
1103 606 ba .peekdone
1104 607 stuw %g1, [%o2]
1105 608 .peek_half:
1106 609 bne,a .peek_byte
1107 610 ldub [%o1], %g1 ! 8-bit!
1108 611 lduh [%o1], %g1
1109 612 ba .peekdone
1110 613 stuh %g1, [%o2]
1111 614 .peek_byte:
1112 615 stub %g1, [%o2]
1113 616 .peekdone:
1114 617 membar #Sync ! Make sure the loads take
1115 618 rdpr %pstate, %o3 ! check&enable ints
1116 619 andcc %o3, PSTATE_IE, %g0
1117 620 bnz 1f
1118 621 nop
1119 622 wrpr %o3, PSTATE_IE, %pstate
1120 623 1:
1121 624 mov %g0, %o0
1122 625 done:
1123 626 retl
1124 627 nop
1125 628 SET_SIZE(do_peek)
1126 629
1127 630 ENTRY(do_poke)
1128 631 cmp %o0, 8 ! 64 bit?
1129 632 bne,a .poke_int
1130 633 cmp %o0, 4 ! 32-bit?
1131 634 ldx [%o2], %g1
1132 635 ba .pokedone
1133 636 stx %g1, [%o1]
1134 637 .poke_int:
1135 638 bne,a .poke_half
1136 639 cmp %o0, 2 ! 16-bit?
1137 640 lduw [%o2], %g1
1138 641 ba .pokedone
1139 642 stuw %g1, [%o1]
1140 643 .poke_half:
1141 644 bne,a .poke_byte
1142 645 ldub [%o2], %g1 ! 8-bit!
1143 646 lduh [%o2], %g1
1144 647 ba .pokedone
1145 648 stuh %g1, [%o1]
1146 649 .poke_byte:
1147 650 stub %g1, [%o1]
1148 651 .pokedone:
1149 652 membar #Sync
1150 653 retl
1151 654 mov %g0, %o0
1152 655 SET_SIZE(do_poke)
1153 656
1154 657
1155 658 /*
1156 659 * The peek_fault() and poke_fault() routines below are used as on_trap()
1157 660 * trampoline routines. i_ddi_peek and i_ddi_poke execute do_peek and do_poke
1158 661 * under on_trap protection (see <sys/ontrap.h>), but modify ot_trampoline to
1159 662 * refer to the corresponding routine below. If a trap occurs, the trap code
1160 663 * will bounce back to the trampoline code, which will effectively cause
1161 664 * do_peek or do_poke to return DDI_FAILURE, instead of longjmp'ing back to
1162 665 * on_trap. In the case of a peek, we may also need to re-enable interrupts.
1163 666 */
1164 667 .seg ".data"
1165 668 .peek_panic:
1166 669 .asciz "peek_fault: missing or invalid on_trap_data"
1167 670 .poke_panic:
1168 671 .asciz "poke_fault: missing or invalid on_trap_data"
1169 672
1170 673 ENTRY(peek_fault)
1171 674 ldn [THREAD_REG + T_ONTRAP], %o0 ! %o0 = on_trap_data pointer
1172 675 brz,pn %o0, .peekfail ! if (%o0 == NULL) panic
1173 676 nop
1174 677 lduh [%o0 + OT_PROT], %o1 ! %o1 = %o0->ot_prot
1175 678 andcc %o1, OT_DATA_ACCESS, %g0 ! if (!(%o1 & OT_DATA_ACCESS))
1176 679 bz,pn %icc, .peekfail ! panic
1177 680 rdpr %pstate, %o3
1178 681
1179 682 andcc %o3, PSTATE_IE, %g0 ! enable interrupts
1180 683 bnz 1f
1181 684 nop
1182 685 wrpr %o3, PSTATE_IE, %pstate
1183 686 1:
1184 687 retl
1185 688 sub %g0, 1, %o0 ! return (DDI_FAILURE);
1186 689 .peekfail:
1187 690 set .peek_panic, %o0 ! Load panic message
1188 691 call panic ! Panic if bad t_ontrap data
1189 692 nop
1190 693 SET_SIZE(peek_fault)
1191 694
1192 695
1193 696 ENTRY(poke_fault)
1194 697 ldn [THREAD_REG + T_ONTRAP], %o0 ! %o0 = on_trap_data pointer
1195 698 brz,pn %o0, .pokefail ! if (%o0 == NULL) panic
1196 699 nop
1197 700 lduh [%o0 + OT_PROT], %o1 ! %o1 = %o0->ot_prot
1198 701 andcc %o1, OT_DATA_ACCESS, %g0 ! if (!(%o1 & OT_DATA_ACCESS))
1199 702 bz,pn %icc, .pokefail ! panic
1200 703 nop
1201 704 retl
1202 705 sub %g0, 1, %o0 ! return (DDI_FAILURE);
1203 706 .pokefail:
1204 707 set .poke_panic, %o0 ! Load panic message
1205 708 call panic ! Panic if bad t_ontrap data
1206 709 nop
1207 710 SET_SIZE(poke_fault)
1208 711
1209 712
1210 713 /*
1211 714 * IO Fault Services
1212 715 *
1213 716 * Support for protected IO accesses is implemented in the following
1214 717 * functions. A driver may request one of three protection mechanisms
1215 718 * that enable the system to survive an access errors. The protection
1216 719 * mechansim is set-up during ddi_regs_map_setup time and may be one of:
1217 720 *
1218 721 * DDI_DEFAULT_ACC - no error protection requested. We will
1219 722 * use the standard ddi_get/ddi_put operations
1220 723 * defined above.
1221 724 *
1222 725 * DDI_FLAGERR - Driver requests that errors encountered will
1223 726 * be flagged by the system. The driver is
1224 727 * responsible for checking the error status
1225 728 * of the access with a call to ddi_acc_err_get()
1226 729 * upon return of ddi_get or ddi_put. To prevent
1227 730 * an access from causing a system we use internal
1228 731 * on_trap semantics.
1229 732 *
1230 733 * The system, depending upon the error,
1231 734 * may or may not panic.
1232 735 *
1233 736 * DDI_CAUTIOUS_ACC - Driver expects that the access may cause
1234 737 * an error to occur. The system will return
1235 738 * an error status but will not generate an ereport.
1236 739 * The system will also ensure synchronous and
1237 740 * exclusive access to the IO space accessed by
1238 741 * the caller.
1239 742 *
1240 743 * To prevent an access from causing a system panic,
1241 744 * we use on_trap semantics to catch the error and
1242 745 * set error status.
1243 746 *
1244 747 * If a read access error is detected and DDI_CAUTIOUS_ACC or
1245 748 * DDI_FLAGERR_ACC protection was requested, we will trampoline to the
1246 749 * error handler, i_ddi_trampoline. i_ddi_trampoline will:
1247 750 * - check for proper protection semantics
1248 751 * - set the error status of the access handle to DDI_FM_NONFATAL
1249 752 * - re-enable interrupts if neccessary
1250 753 * - longjmp back to the initiating access function.
1251 754
1252 755 * If a write access error is detected, an interrupt is typically
1253 756 * generated and claimed by a bus nexus responsible for the write
1254 757 * transaction. The nexus error handler is expected to set the
1255 758 * error status and the IO initiating driver is expected to check
1256 759 * for a failed transaction via ddi_fm_acc_err_get().
1257 760 *
1258 761 */
1259 762
1260 763 .seg ".data"
1261 764 .acc_panic:
1262 765 .asciz "DDI access: missing or invalid on_trap_data"
1263 766
1264 767 ENTRY(i_ddi_caut_trampoline)
1265 768 ldn [THREAD_REG + T_ONTRAP], %o5 ! %o5 = curthread->t_ontrap
1266 769 lduh [%o5 + OT_PROT], %o1 ! %o1 = %o0->ot_prot
1267 770 andcc %o1, OT_DATA_ACCESS, %g0 ! if (!(%o1 & OT_DATA_ACCESS))
1268 771 bz,pn %icc, .cautaccfail ! panic
1269 772 rdpr %pstate, %o3
1270 773 andcc %o3, PSTATE_IE, %g0 ! enable interrupts
1271 774 bnz 1f
1272 775 nop
1273 776 wrpr %o3, PSTATE_IE, %pstate
1274 777 1:
1275 778 ldn [%o5 + OT_HANDLE], %o0 ! %o0 = ot_handle
1276 779 brz,pn %o0, .cautaccfail ! if (ot_handle == NULL) panic
1277 780 nop
1278 781 ldn [%o0 + AHI_ERR], %o4 ! %o4 = hp->ahi_err
1279 782 membar #Sync
1280 783 stx %g0, [%o4 + ERR_ENA] ! ahi_err->err_ena = 0
1281 784 mov -2, %o0
1282 785 st %o0, [%o4 + ERR_STATUS] ! ahi_err->err_status = NONFATAL
1283 786 b longjmp ! longjmp back
1284 787 add %o5, OT_JMPBUF, %o0 ! %o0 = &ot_jmpbuf
1285 788 .cautaccfail:
1286 789 set .acc_panic, %o0 ! Load panic message
1287 790 call panic ! Panic if bad t_ontrap data
1288 791 nop
1289 792 SET_SIZE(i_ddi_caut_trampoline)
1290 793
1291 794 /*
1292 795 * DDI on_trap set-up functions, i_ddi_ontrap() and i_ddinotrap() are used
1293 796 * to protect * ddi_get accesses for DDI_CAUT_ACC. i_ddi_ontrap() sets
1294 797 * the jumpbuf (setjmp) that will return back to the access routine from
1295 798 * i_ddi_trampoline(). DDI_NOPROTECT() clears the ontrap set-up.
1296 799 */
1297 800 ENTRY(i_ddi_ontrap)
1298 801 ldn [%o0 + AHI_ERR], %o4
1299 802 ldn [%o4 + ERR_ONTRAP], %o4 ! %o4 = hp->ahi_err->err_ontrap
1300 803 ldn [THREAD_REG + T_ONTRAP], %o5 ! %o5 = curthread->t_ontrap
1301 804 stn %o5, [%o4 + OT_PREV] ! ot_prev = t_ontrap
1302 805 membar #Sync ! force error barrier
1303 806 stn %o4, [THREAD_REG + T_ONTRAP] ! t_ontrap = err_ontrap
1304 807 b setjmp
1305 808 add %o4, OT_JMPBUF, %o0
1306 809 SET_SIZE(i_ddi_ontrap)
1307 810
1308 811 ENTRY(i_ddi_notrap)
1309 812 membar #Sync ! force error barrier
1310 813 ldn [%o0 + AHI_ERR], %o4
1311 814 ldn [%o4 + ERR_ONTRAP], %o4 ! %o4 = hp->ahi_err->err_ontrap
1312 815 ldn [%o4 + OT_PREV], %o4
1313 816 retl
1314 817 stn %o4, [THREAD_REG + T_ONTRAP] ! restore curthread->t_ontrap
1315 818 SET_SIZE(i_ddi_notrap)
1316 819
1317 820 /*
1318 821 * Internal on_trap set-up macros. DDI_PROTECT() and DDI_NOPROTECT() are used
1319 822 * to protect * ddi_get accesses for DDI_FLAGERR_ACC. DDI_NOPROTECT() sets
1320 823 * the jumpbuf that will return back to the access routine from
1321 824 * i_ddi_protect_trampoline(). DDI_NOPROTECT() clears the ontrap set-up.
1322 825 */
1323 826 ENTRY(i_ddi_prot_trampoline)
1324 827 ldn [THREAD_REG + T_ONTRAP], %o5 ! %o5 = curthread->t_ontrap
1325 828 lduh [%o5 + OT_PROT], %o1 ! %o1 = %o0->ot_prot
1326 829 andcc %o1, OT_DATA_ACCESS, %g0 ! if (!(%o1 & OT_DATA_ACCESS))
1327 830 bz,pn %icc, .protaccfail ! panic
1328 831 rdpr %pstate, %o3
1329 832 andcc %o3, PSTATE_IE, %g0 ! enable interrupts
1330 833 bnz 1f
1331 834 nop
1332 835 wrpr %o3, PSTATE_IE, %pstate
1333 836 1:
1334 837 ldn [%o5 + OT_HANDLE], %o0 ! %o0 = ot_handle
1335 838 brz,pn %o0, .protaccfail ! if (ot_handle == NULL) panic
1336 839 nop
1337 840 ldn [%o0 + AHI_ERR], %o4 ! %o4 = hp->ahi_err
1338 841 stn %g0, [%o4 + ERR_ENA] ! ahi_err->err_ena = 0
1339 842 mov -2, %o0
1340 843 st %o0, [%o4 + ERR_STATUS] ! ahi_err->err_status = NONFATAL
1341 844 ldn [%o5 + OT_PREV], %o0 ! restore ontrap
1342 845 membar #Sync ! force error barrier
1343 846 stn %o0, [THREAD_REG + T_ONTRAP];
1344 847 b longjmp ! longjmp back
1345 848 add %o5, OT_JMPBUF, %o0 ! %o0 = &ot_jmpbuf
1346 849 .protaccfail:
1347 850 set .acc_panic, %o0 ! Load panic message
1348 851 call panic ! Panic if bad t_ontrap data
1349 852 nop
1350 853 SET_SIZE(i_ddi_prot_trampoline)
1351 854
1352 855 #define DDI_PROTECT() \
1353 856 ldn [%o0 + AHI_ERR], %o4; \
1354 857 ldn [%o4 + ERR_ONTRAP], %o4; \
1355 858 ldn [THREAD_REG + T_ONTRAP], %o5; \
1356 859 stn %o5, [%o4 + OT_PREV]; \
1357 860 membar #Sync; \
1358 861 stn %o4, [THREAD_REG + T_ONTRAP]; \
1359 862 add %o4, OT_JMPBUF, %o0; \
1360 863 stn %o7, [%o0 + L_PC]; \
1361 864 stn %sp, [%o0 + L_SP]; \
1362 865 clr %o0;
1363 866
1364 867 #define DDI_NOPROTECT() \
1365 868 ldn [THREAD_REG + T_ONTRAP], %o4; \
1366 869 ldn [%o4 + OT_PREV], %o5; \
1367 870 membar #Sync; \
1368 871 stn %o5, [THREAD_REG + T_ONTRAP];
1369 872
1370 873 /*
1371 874 * DDI_FLAGERR_ACC specific get/put routines.
1372 875 */
1373 876 .align 16
1374 877 ENTRY(i_ddi_prot_get8)
1375 878 DDI_PROTECT() ! set ontrap protection
1376 879 ldub [%o1], %o2 ! do the io access
1377 880 DDI_NOPROTECT() ! remove protection & ret
1378 881 retl
1379 882 mov %o2, %o0 ! set return value
1380 883 SET_SIZE(i_ddi_prot_get8)
1381 884
1382 885 .align 16
1383 886 ENTRY(i_ddi_prot_get16)
1384 887 DDI_PROTECT() ! set ontrap protection
1385 888 lduh [%o1], %o2 ! do the io access
1386 889 DDI_NOPROTECT() ! remove protection & ret
1387 890 retl
1388 891 mov %o2, %o0 ! set return value
1389 892 SET_SIZE(i_ddi_prot_get16)
1390 893
1391 894 .align 16
1392 895 ENTRY(i_ddi_prot_get32)
1393 896 DDI_PROTECT() ! set ontrap protection
1394 897 ld [%o1], %o2 ! do the io access
1395 898 DDI_NOPROTECT() ! remove protection & ret
1396 899 retl
1397 900 mov %o2, %o0 ! set return value
1398 901 SET_SIZE(i_ddi_prot_get32)
1399 902
1400 903 .align 16
1401 904 ENTRY(i_ddi_prot_get64)
1402 905 DDI_PROTECT() ! set ontrap protection
1403 906 ldx [%o1], %o2 ! do the io access
1404 907 DDI_NOPROTECT() ! remove protection & ret
1405 908 retl
1406 909 mov %o2, %o0 ! set return value
1407 910 SET_SIZE(i_ddi_prot_get64)
1408 911
1409 912 .align 16
1410 913 ENTRY(i_ddi_prot_put8)
1411 914 stub %o2, [%o1] ! do the io access
1412 915 retl
1413 916 membar #Sync;
1414 917 SET_SIZE(i_ddi_prot_put8)
1415 918
1416 919 .align 16
1417 920 ENTRY(i_ddi_prot_put16)
1418 921 stuh %o2, [%o1] ! do the io access
1419 922 retl
1420 923 membar #Sync;
1421 924 SET_SIZE(i_ddi_prot_put16)
1422 925
1423 926 .align 16
1424 927 ENTRY(i_ddi_prot_put32)
1425 928 st %o2, [%o1] ! do the io access
1426 929 retl
1427 930 membar #Sync;
1428 931 SET_SIZE(i_ddi_prot_put32)
1429 932
1430 933 .align 16
1431 934 ENTRY(i_ddi_prot_put64)
1432 935 stx %o2, [%o1] ! do the io access
1433 936 retl
1434 937 membar #Sync;
1435 938 SET_SIZE(i_ddi_prot_put64)
1436 939
1437 940 .align 16
1438 941 ENTRY(i_ddi_prot_rep_get8)
1439 942 DDI_PROTECT() ! set ontrap protection
1440 943 tst %o0 ! check access error
1441 944 bnz,a 1f
1442 945 nop
1443 946 DDI_REP_GET(1,ub)
1444 947 1:
1445 948 DDI_NOPROTECT() ! remove protection & ret
1446 949 retl
1447 950 nop
1448 951 SET_SIZE(i_ddi_prot_rep_get8)
1449 952
1450 953 .align 16
1451 954 ENTRY(i_ddi_prot_rep_get16)
1452 955 DDI_PROTECT() ! set ontrap protection
1453 956 tst %o0 ! check access error
1454 957 bnz,a 1f
1455 958 nop
1456 959 DDI_REP_GET(2,uh)
1457 960 1:
1458 961 DDI_NOPROTECT() ! remove protection & ret
1459 962 retl
1460 963 nop
1461 964 SET_SIZE(i_ddi_prot_rep_get16)
1462 965
1463 966 .align 16
1464 967 ENTRY(i_ddi_prot_rep_get32)
1465 968 DDI_PROTECT() ! set ontrap protection
1466 969 tst %o0 ! check access error
1467 970 bnz,a 1f
1468 971 nop
1469 972 DDI_REP_GET(4,/**/)
1470 973 1:
1471 974 DDI_NOPROTECT() ! remove protection & ret
1472 975 retl
1473 976 nop
1474 977 SET_SIZE(i_ddi_prot_rep_get32)
1475 978
1476 979 .align 16
1477 980 ENTRY(i_ddi_prot_rep_get64)
1478 981 DDI_PROTECT() ! set ontrap protection
1479 982 tst %o0 ! check access error
1480 983 bnz,a 1f
1481 984 nop
1482 985 DDI_REP_GET(8,x)
1483 986 1:
1484 987 DDI_NOPROTECT() ! remove protection & ret
1485 988 retl
1486 989 nop
1487 990 SET_SIZE(i_ddi_prot_rep_get64)
1488 991
1489 992 .align 16
1490 993 ENTRY(i_ddi_prot_rep_put8)
1491 994 DDI_REP_PUT(1,ub)
1492 995 retl
1493 996 membar #Sync;
1494 997 SET_SIZE(i_ddi_prot_rep_put8)
1495 998
1496 999 .align 16
1497 1000 ENTRY(i_ddi_prot_rep_put16)
1498 1001 DDI_REP_PUT(2,uh)
1499 1002 retl
1500 1003 membar #Sync;
1501 1004 SET_SIZE(i_ddi_prot_rep_put16)
1502 1005
1503 1006 .align 16
1504 1007 ENTRY(i_ddi_prot_rep_put32)
1505 1008 DDI_REP_PUT(4,/**/)
1506 1009 retl
1507 1010 membar #Sync;
1508 1011 SET_SIZE(i_ddi_prot_rep_put32)
1509 1012
1510 1013 .align 16
1511 1014 ENTRY(i_ddi_prot_rep_put64)
1512 1015 DDI_REP_PUT(8,x)
1513 1016 retl
1514 1017 membar #Sync;
1515 1018 SET_SIZE(i_ddi_prot_rep_put64)
1516 1019
1517 1020 /*
1518 1021 * Common DDI_CAUTIOUS_ACC routine called from cautious access routines
1519 1022 * in ddi_impl.c
1520 1023 */
1521 1024 ENTRY(i_ddi_caut_get)
1522 1025 rdpr %pstate, %o3 ! check ints
1523 1026 andcc %o3, PSTATE_IE, %g0
1524 1027 bz,a cautdone
1525 1028 nop
1526 1029 wrpr %o3, PSTATE_IE, %pstate
1527 1030 cmp %o0, 8 ! 64-bit?
1528 1031 bne,a .get_int
1529 1032 cmp %o0, 4 ! 32-bit?
1530 1033 ldx [%o1], %g1
1531 1034 ba .getdone
1532 1035 stx %g1, [%o2]
1533 1036 .get_int:
1534 1037 bne,a .get_half
1535 1038 cmp %o0, 2 ! 16-bit?
1536 1039 lduw [%o1], %g1
1537 1040 ba .getdone
1538 1041 stuw %g1, [%o2]
1539 1042 .get_half:
1540 1043 bne,a .get_byte
1541 1044 ldub [%o1], %g1 ! 8-bit!
1542 1045 lduh [%o1], %g1
1543 1046 ba .getdone
1544 1047 stuh %g1, [%o2]
1545 1048 .get_byte:
1546 1049 stub %g1, [%o2]
1547 1050 .getdone:
↓ open down ↓ |
990 lines elided |
↑ open up ↑ |
1548 1051 rdpr %pstate, %o3 ! check&enable ints
1549 1052 andcc %o3, PSTATE_IE, %g0
1550 1053 bnz,a cautdone
1551 1054 nop
1552 1055 wrpr %o3, PSTATE_IE, %pstate
1553 1056 cautdone:
1554 1057 retl
1555 1058 nop
1556 1059 SET_SIZE(i_ddi_caut_get)
1557 1060
1558 -#endif /* lint */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX