Netware debugger stub NLM.
[binutils-gdb.git] / gdb / nlm / alpha-io.S
1 /*
2 * Copyright (C) 1993, 1994 by
3 * Digital Equipment Corporation, Maynard, Massachusetts.
4 * All rights reserved.
5 *
6 * This software is furnished under a license and may be used and copied
7 * only in accordance of the terms of such license and with the
8 * inclusion of the above copyright notice. This software or any other
9 * copies thereof may not be provided or otherwise made available to any
10 * other person. No title to and ownership of the software is hereby
11 * transferred.
12 *
13 * The information in this software is subject to change without notice
14 * and should not be construed as a commitment by Digital Equipment
15 * Corporation.
16 *
17 * Digital assumes no responsibility for the use or reliability of its
18 * software on equipment which is not supplied by Digital.
19 *
20 */
21
22
23 /*#include "kxalpha.h"*/
24 #include "alpha-regdef.h"
25
26 #define LEAF_ENTRY(NAME) .text ; .align 4 ; .globl NAME ; .ent NAME, 0 ; NAME: ; .frame sp, 0, ra ; .prologue 0 ;
27
28
29 #define PICIACKADR 0xfffffc0100000000
30 #define EISABAD 0xfffffc0200000000
31 #define EISABIO 0xfffffc0300000000
32 #define EISA_SHIFT 7
33 #define EISA_BYTE_ADJ 0x80
34 #define EISA_WORD_ADJ 0x100
35 #define EISA_LONG_ADJ 0x200
36 #define HALF_USEC 75
37 #define ONE_USEC 150
38
39
40 LEAF_ENTRY(flush_i_cache)
41 call_pal 0x86 // IMB
42 ret zero, (ra) // return
43 .end outportb
44
45 //++
46 //
47 // VOID
48 // { outportX
49 // ULONG port
50 // ULONG data
51 // )
52 // X variants are:
53 //
54 // b - byte 8 bits
55 // w - word 16 bits
56 // t - tri-byte 24 bits
57 // l - long 32 bits
58 //
59 //
60 // Routine Description:
61 //
62 // This function uses the 64-bit super-page to write data to a port
63 // of the EISA bus for JENSEN. Only AT (ISA) cycles are supported.
64 //
65 // Arguments:
66 //
67 // port (a0) - port address on the EISA to which to write data
68 // data (a1) - data to write to the port.
69 //
70 //
71 // Return Value:
72 //
73 // None.
74 //
75 //--
76
77
78 //+
79 // outportb
80 //--
81 LEAF_ENTRY(outportb)
82 //
83 // generate super-page address of EISA base address
84 // upper bits must be sign extension of bit 42
85 // va<42:41> = 10 (binary) for super-page address
86 //
87 and a0,3,t0 // get byte index from address
88 insbl a1,t0,t5 // put byte in proper position
89 and a0,0x1ffffff,t1 // 25 bit mask
90 ldiq t0,EISABIO // get EISA IO base address
91 sll t1, 7, a0 // shift 7 for EISA
92 bis t0,a0,t0 // t0 = address of EISA
93 stl t5, 0(t0) // write data to port
94 mb // guarantee write ordering
95 ret zero, (ra) // return
96 .end outportb
97
98
99 //+
100 // outportw
101 //--
102 LEAF_ENTRY(outportw)
103 //
104 // generate super-page address of EISA base address
105 // upper bits must be sign extension of bit 42
106 // va<42:41> = 10 (binary) for super-page address
107 //
108 and a0,3,t0 // get byte index from address
109 inswl a1,t0,t5 // put byte in proper position
110 and a0,0x1ffffff,t1 // 25 bit mask
111 ldiq t0,EISABIO // get EISA IO base address
112 or t0,0x20,t0 // t0 = ffff fc03 0000 0020 - word
113 sll t1, 7, a0 // shift 7 for EISA
114 bis t0,a0,t0 // t0 = address of EISA
115 stl t5, 0(t0) // write data to port
116 mb // guarantee write ordering
117 ret zero, (ra) // return
118 .end outportw
119
120
121 //+
122 // outportl
123 //--
124 LEAF_ENTRY(outportl)
125 //
126 // generate super-page address of EISA base address
127 // upper bits must be sign extension of bit 42
128 // va<42:41> = 10 (binary) for super-page address
129 //
130 and a0,0x1ffffff,t1 // 25 bit mask
131 ldiq t0,EISABIO // get EISA IO base address
132 or t0,0x60,t0 // t0 = ffff fc03 0000 0060 - long
133 sll t1, 7, a0 // shift 7 for EISA
134 bis t0,a0,t0 // t0 = address of EISA
135 stl a1, 0(t0) // write data to port
136 mb // guarantee write ordering
137 ret zero, (ra) // return
138 .end outportl
139
140
141
142 //+
143 // vgastl
144 //--
145 LEAF_ENTRY(vgastl)
146 //
147 // generate super-page address of EISA base address
148 // upper bits must be sign extension of bit 42
149 // va<42:41> = 10 (binary) for super-page address
150 //
151 sra a0, 3, t0 // right shift addr by 3
152 and t0, 3, t1 // and addr with 3
153 s8addq t1, zero, t2 // multiply by 8
154 sll a1, t2, t3 // left shift data
155 sll a0, 4, t4 // left shift addr by 4
156 lda t0,0xfc00 // t0 = 0000 0000 0000 0c00
157 ldah t0,-1(t0) // t0 = ffff ffff ffff 0c00
158 sll t0,32,t0 // t0 = ffff fc00 0000 0000
159 or t0,t4,t4 // make io address
160 stl t3, 0(t4) // store data
161 mb // guarantee write ordering
162 ret zero, (ra) // return
163 .end vgastl
164
165
166
167
168 //++
169 //
170 // ULONG
171 // inportX(
172 // ULONG port
173 // )
174 //
175 // X variants are:
176 //
177 // b - byte 8 bits
178 // w - word 16 bits
179 // t - tri-byte 24 bits
180 // l - long 32 bits
181 //
182 // Routine Description:
183 //
184 // This function uses the 64-bit super-page to read data from an EISA
185 // port for JENSEN.
186 //
187 // Arguments:
188 //
189 // port (a0) - EISA port number.
190 //
191 // Return Value:
192 //
193 // data (v0) - the data read and only the low byte is valid
194 //
195 //--
196
197 //+
198 // inportb
199 //--
200 LEAF_ENTRY(inportb)
201
202 //
203 // generate super-page address of EISA, base address
204 // upper bits must be sign extension of bit 42
205 // va<42:41> = 10 (binary) for super-page address
206 //
207 and a0,0x1ffffff,t1 // 25 bit mask
208 ldiq t0,EISABIO // get EISA IO base address
209 sll t1, 7, t2 // shift 7 for EISA
210 bis t0,t2,t0 // t0 = address of EISA
211 ldl v0, 0(t0) // get EISA IO byte
212 and a0,0x3,t1 // setup word shift count
213 extbl v0,t1,v0 // put into low byte
214 ret zero, (ra) // return
215 .end inportb
216
217
218 //+
219 // inportw
220 //--
221 LEAF_ENTRY(inportw)
222 //
223 // generate super-page address of vti, base address
224 // upper bits must be sign extension of bit 42
225 // va<42:41> = 10 (binary) for super-page address
226 //
227 and a0,0x1ffffff,t1 // 25 bit mask
228 ldiq t0,EISABIO // get EISA IO base addr
229 or t0,0x20,t0 // t0 = ffff fc03 0000 0020 - word
230 sll t1, 7, t2 // shift 7 for EISA
231 bis t0,t2,t0 // t0 = address of EISA
232 ldl v0, 0(t0) // load EISA word
233 and a0,0x3,t1 // setup shift count
234 extwl v0,t1,v0 // put into low word
235 ret zero, (ra) // return
236 .end inportw
237
238
239
240 //+
241 // inportl
242 //--
243 LEAF_ENTRY(inportl)
244 //
245 // generate super-page address of vti, base address
246 // upper bits must be sign extension of bit 42
247 // va<42:41> = 10 (binary) for super-page address
248 //
249 and a0,0x1ffffff,t1 // 25 bit mask
250 ldiq t0,EISABIO // get EISA IO base address
251 or t0,0x60,t0 // t0 = ffff fc03 0000 0060
252 sll t1, 7, t2 // shift 7 for EISA
253 bis t0,t2,t0 // t0 = address of EISA
254 ldl v0, 0(t0) // load EISA word
255 ret zero, (ra) // return
256 .end inportl
257
258
259 //+
260 // vgaldl
261 //--
262 LEAF_ENTRY(vgaldl)
263 //
264 // generate super-page address of EISA base address
265 // upper bits must be sign extension of bit 42
266 // va<42:41> = 10 (binary) for super-page address
267 //
268 sll a0, 4, t5 // left shift address by 4
269 lda t0,0xfc00 // t0 = 0000 0000 0000 fc00
270 ldah t0,-1(t0) // t0 = ffff ffff ffff fc00
271 sll t0,32,t0 // t0 = ffff fc00 0000 0000
272 or t0,t5,t0 // make io address
273 ldl t4, 0(t0) // load data
274 sra a0, 3, t1 // right shift addr by 3
275 and t1, 3, t2 // and addr with 3
276 s8addq t2, zero, t3 // multiply by 8
277 srl t4, t3, v0 // right shift data
278 ret zero, (ra) // return
279 .end vgaldl
280
281
282
283
284 //+
285 // inIack
286 //--
287
288 LEAF_ENTRY(inIack)
289
290 //
291 // get Iack from pic, need two to get the vector
292 //
293 ldiq t0,PICIACKADR
294 ldl v0,0(t0) // load data
295 and v0,0xff,v0 // make it a byte
296 ret zero, (ra) // return
297 .end inIack
298
299
300
301
302
303 LEAF_ENTRY(outmemb)
304 //
305 // generate super-page address of EISA base address
306 // upper bits must be sign extension of bit 42
307 // va<42:41> = 10 (binary) for super-page address
308 //
309 and a0,3,t0 // get byte index from address
310 insbl a1,t0,t5 // put byte in proper position
311
312 and a0,0x1ffffff,t1 // 25 bit mask
313 ldiq t0,EISABAD // get EISA address
314
315 sll t1, 7, a0 // shift 7 for EISA
316 bis t0,a0,t0 // t0 = address of EISA
317 stl t5, 0(t0) // write data to port
318 ret zero, (ra) // return
319
320 .end outmemb
321
322
323
324 LEAF_ENTRY(outmemw)
325 //
326 // generate super-page address of EISA base address
327 // upper bits must be sign extension of bit 42
328 // va<42:41> = 10 (binary) for super-page address
329 //
330 and a0,3,t0 // get byte index from address
331 inswl a1,t0,t5 // put byte in proper position
332
333 and a0,0x1ffffff,t1 // 25 bit mask
334
335 ldiq t0,EISABAD // get EISA address
336 or t0,0x20,t0 // t0 = ffff fc02 0000 0020 - word
337
338 sll t1, 7, a0 // shift 7 for EISA
339 bis t0,a0,t0 // t0 = address of EISA
340 stl t5, 0(t0) // write data to port
341 ret zero, (ra) // return
342
343 .end outmemw
344
345
346
347
348 LEAF_ENTRY(outmeml)
349 //
350 // generate super-page address of EISA base address
351 // upper bits must be sign extension of bit 42
352 // va<42:41> = 10 (binary) for super-page address
353 //
354 and a0,0x1ffffff,t1 // 25 bit mask
355
356 ldiq t0,EISABAD // get EISA address
357 or t0,0x60,t0 // t0 = ffff fc02 0000 0060 - long
358
359 sll t1, 7, a0 // shift 7 for EISA
360 bis t0,a0,t0 // t0 = address of EISA
361 stl a1, 0(t0) // write data to port
362 ret zero, (ra) // return
363
364 .end outmeml
365
366
367
368 LEAF_ENTRY(outbuffb)
369
370 /* Arguments:
371 a0 address of destination buffer (byte aligned).
372 a1 address of source buffer in memory (byte aligned)
373 a2 Number of bytes to move (Count).
374 */
375
376 //
377 // generate super-page address of EISA base address
378 // upper bits must be sign extension of bit 42
379 // va<42:41> = 10 (binary) for super-page address
380 //
381 beq a2, donewb // leave if nothing to do
382
383 ldiq t0,EISABAD // get EISA address
384
385 and a0,3,t3 // get byte index from dst address
386
387 and a0,0x1ffffff,t1 // 25 bit mask
388 sll t1,EISA_SHIFT,t4 // shift 7 for EISA
389 bis t0,t4,t0 // t0 = address of EISA
390
391 loopwb:
392 ldq_u t1, 0(a1) // get src data
393 subl a2, 1, a2 // decrement count
394 extbl t1, a1,t1 // extract byte
395 addl a1, 1, a1 // point ot next src address
396 insbl t1,t3,t1 // insert byte in proper place
397 stl t1, 0(t0) // write data to EISA memory
398 addq t0,EISA_BYTE_ADJ, t0 // increment EISA memory pointer
399 addl t3,1,t3 // increment index
400 and t3,3,t3 // mask off overflow
401 bne a2, loopwb
402 donewb:
403 ret zero, (ra)
404
405 .end outbuffb
406
407
408
409 LEAF_ENTRY(outbuffw)
410
411 /* Arguments:
412 a0 address of destination buffer (word aligned), eisa.
413 a1 address of source buffer in memory (word aligned)
414 a2 Number of words to move (Count).
415 */
416
417 //
418 // generate super-page address of EISA base address
419 // upper bits must be sign extension of bit 42
420 // va<42:41> = 10 (binary) for super-page address
421 //
422 beq a2, doneww // leave if nothing to do
423
424 ldiq t0,EISABAD // get EISA address
425 or t0,0x20,t0 // t0 = ffff fc02 0000 0020 - word
426
427 and a0,3,t3 // get word index from dst address
428
429 and a0,0x1ffffff,t1 // 25 bit mask
430 sll t1,EISA_SHIFT,t4 // shift 7 for EISA
431 bis t0,t4,t0 // t0 = address of EISA
432
433 loopww:
434 ldq_u t1, 0(a1) // get src data
435 subl a2, 1, a2 // decrement count
436 extwl t1, a1,t1 // extract word
437 addl a1, 2, a1 // point ot next src address
438 inswl t1,t3,t1 // insert in proper place
439 stl t1, 0(t0) // write data to EISA memory
440 addq t0,EISA_WORD_ADJ, t0 // increment EISA memory pointer
441 addl t3,2,t3 // increment index
442 and t3,3,t3 // mask off overflow
443 bne a2, loopww
444 doneww:
445 ret zero, (ra)
446
447 .end outbuffw
448
449
450
451
452
453 LEAF_ENTRY(outbuffl)
454
455 /* Arguments:
456 a0 address of destination buffer (long aligned), eisa.
457 a1 address of source buffer in memory (long aligned)
458 a2 Number of longs to move (Count).
459 */
460
461 //
462 // generate super-page address of EISA base address
463 // upper bits must be sign extension of bit 42
464 // va<42:41> = 10 (binary) for super-page address
465 //
466 beq a2, donewl // leave if nothing to do
467
468 ldiq t0,EISABAD // get EISA address
469 or t0,0x60,t0 // t0 = ffff fc02 0000 0060 - long
470
471 and a0,0x1ffffff,t1 // 25 bit mask
472 sll t1,EISA_SHIFT,t4 // shift 7 for EISA
473 bis t0,t4,t0 // t0 = address of EISA
474
475 loopwl:
476 ldl t1, 0(a1) // get src data
477 subl a2, 1, a2 // decrement count
478 stl t1, 0(t0) // write data to EISA memory
479 addl a1, 4, a1 // point ot next src address
480 addq t0,EISA_LONG_ADJ, t0 // increment EISA memory pointer
481 bne a2, loopwl
482 donewl:
483 ret zero, (ra)
484
485 .end outbuffw
486
487
488
489 LEAF_ENTRY(inmemb)
490
491 //
492 // generate super-page address of EISA, base address
493 // upper bits must be sign extension of bit 42
494 // va<42:41> = 10 (binary) for super-page address
495 //
496 and a0,0x1ffffff,t1 // 25 bit mask
497
498 ldiq t0,EISABAD // get EISA address
499
500 sll t1, 7, t2 // shift 7 for EISA
501 bis t0,t2,t0 // t0 = address of EISA
502 ldl v0, 0(t0) // get EISA byte
503
504 and a0,0x3,t1 // setup word shift count
505 extbl v0,t1,v0 // put into low byte
506
507 ret zero, (ra) // return
508
509 .end inmemb
510
511
512
513
514 LEAF_ENTRY(inmemw)
515
516 //
517 // generate super-page address of EISA, base address
518 // upper bits must be sign extension of bit 42
519 // va<42:41> = 10 (binary) for super-page address
520 //
521 and a0,0x1ffffff,t1 // 25 bit mask
522
523 ldiq t0,EISABAD // get EISA base addr
524 or t0,0x20,t0 // t0 = ffff fc02 0000 0020 - word
525
526 sll t1, 7, t2 // shift 7 for EISA
527 bis t0,t2,t0 // t0 = address of EISA
528
529 ldl v0, 0(t0) // get EISA short
530
531 and a0,0x3,t1 // setup byte shift count
532 extwl v0,t1,v0 // put into low word
533
534 ret zero, (ra) // return
535
536 .end inmemw
537
538
539
540
541 LEAF_ENTRY(inmeml)
542
543 //
544 // generate super-page address of EISA, base address
545 // upper bits must be sign extension of bit 42
546 // va<42:41> = 10 (binary) for super-page address
547 //
548 and a0,0x1ffffff,t1 // 25 bit mask
549
550 ldiq t0,EISABAD // get EISA base address
551 or t0,0x60,t0 // t0 = ffff fc02 0000 0060 - long
552
553 sll t1, 7, t2 // shift 7 for EISA
554 bis t0,t2,t0 // t0 = address of EISA
555
556 ldl v0, 0(t0) // get EISA 4 bytes
557 ret zero, (ra) // return
558
559 .end inmeml
560
561
562
563
564 LEAF_ENTRY(inbuffb)
565
566 /*
567 Arguments:
568
569 a0 source buffer in eisa bus memory.
570 a1 destination buffer in memory.
571 a2 Number of bytes to move (Count).
572 */
573
574 //
575 // generate super-page address of EISA, base address
576 // upper bits must be sign extension of bit 42
577 // va<42:41> = 10 (binary) for super-page address
578 //
579 beq a2, donerb // leave if nothing to do
580
581 ldiq t0,EISABAD // get EISA base address
582
583 and a0,3,t3 // get byte index from src address
584
585 and a0,0x1ffffff,t1 // 25 bit mask
586 sll t1, EISA_SHIFT, t4 // shift 7 for EISA
587 bis t0,t4,t0 // t0 = address of EISA
588
589 looprb:
590 ldl t1, 0(t0) // get EISA 4 bytes
591 subl a2, 1, a2 // decrement byte count
592 extbl t1, t3, t1 // extract byte
593 addq t0, EISA_BYTE_ADJ, t0 // increment EISA address
594 stb t1, 0(a1) // assembler preserves the memory
595 // behind the newly stored byte
596 addl a1, 1, a1 // increment memory pointer
597 addl t3, 1, t3 // point to next byte in long
598 and t3, 3, t3 // get new index
599 bne a2, looprb
600 donerb:
601 ret zero, (ra) // return
602
603 .end inbuffb
604
605
606
607
608 LEAF_ENTRY(inbuffw)
609 /*
610 Arguments:
611
612 a0 source buffer in eisa bus memory.
613 a1 destination buffer in memory.
614 a2 Number of words to move (Count).
615 */
616
617
618 //
619 // generate super-page address of EISA, base address
620 // upper bits must be sign extension of bit 42
621 // va<42:41> = 10 (binary) for super-page address
622 //
623 beq a2, donerw // leave if nothing to do
624
625 ldiq t0,EISABAD // get EISA base address
626 or t0,0x20,t0 // t0 = ffff fc02 0000 0020 - word
627
628
629 and a0,3,t3 // get byte index from src address
630
631 and a0,0x1ffffff,t1 // 25 bit mask
632 sll t1, EISA_SHIFT, t4 // shift 7 for EISA
633 bis t0,t4,t0 // t0 = address of EISA
634
635 looprw:
636 ldl t1, 0(t0) // get EISA 4 bytes
637 subl a2, 1, a2 // decrement word count
638 extwl t1, t3, t1 // extract word
639 addq t0, EISA_WORD_ADJ, t0 // increment EISA address
640 stw t1, 0(a1) // store in dst memory
641 addl a1, 2, a1 // increment memory pointer
642 addl t3, 2, t3 // point to next word in long
643 and t3, 3, t3 // get new index
644 bne a2, looprw
645 donerw:
646 ret zero, (ra) // return
647
648 .end inbuffw
649
650
651
652 LEAF_ENTRY(inbuffl)
653 /*
654 Arguments:
655
656 a0 source buffer in eisa bus memory.
657 a1 destination buffer in memory.
658 a2 Number of longs to move (Count).
659 */
660
661 //
662 // generate super-page address of EISA, base address
663 // upper bits must be sign extension of bit 42
664 // va<42:41> = 10 (binary) for super-page address
665 //
666 beq a2, donerl // leave if nothing to do
667
668 ldiq t0,EISABAD // get EISA base address
669 or t0,0x60,t0 // t0 = ffff fc02 0000 0060 - long
670
671 and a0,0x1ffffff,t1 // 25 bit mask
672 sll t1, EISA_SHIFT, t4 // shift 7 for EISA
673 bis t0,t4,t0 // t0 = address of EISA
674
675 looprl:
676 ldl v0, 0(t0) // get EISA 4 bytes
677 subl a2, 1, a2 // decrement long count
678 stl v0, 0(a1) // store in dst memory
679 addl a1, 4, a1 // increment memory pointer
680 addq t0, EISA_LONG_ADJ, t0 // increment EISA address
681 bne a2, looprl
682 donerl:
683 ret zero, (ra) // return
684
685 .end inbuffl
686
687
688
689 LEAF_ENTRY(inctl)
690
691 //
692 // generate super-page address of EISA, base address
693 // upper bits must be sign extension of bit 42
694 // va<42:41> = 10 (binary) for super-page address
695 //
696 lda t0,0xfc01 // t0 = 0000 0000 0000 fc01
697 ldah t0,-1(t0) // t0 = ffff ffff ffff fc01
698 sll t0,32,t0 // t0 = ffff fc01 0000 0000
699 bis t0,0xe0000000,t0 // t0 = ffff fc01 e000 0000
700
701 ldl v0, 0(t0) // get EISA byte
702 and v0,0xff,v0
703
704 ret zero, (ra) // return
705
706 .end inctl
707
708
709
710
711 //++
712 //
713 // VOID
714 // outVti(
715 // ULONG port
716 // ULONG data
717 // )
718 //
719 // Routine Description:
720 //
721 // This function uses the 64-bit super-page to write data to a port
722 // of the on-board VTI combo chip for JENSEN.
723 //
724 // Arguments:
725 //
726 // port (a0) - port number on VTI chip to which to write data
727 // data (a1) - data to write to the port, only low byte is significant
728 // to the VTI
729 //
730 // Return Value:
731 //
732 // None.
733 //
734 //--
735
736 LEAF_ENTRY(outVti)
737
738 //
739 // generate super-page address of vti, base address
740 // N.B. - upper bits must be sign extension of bit 42
741 // va<42:41> = 10 (binary) for super-page address
742 //
743
744 lda t0, 0xc01c(zero) // t0 = 0000 0000 0000 c01c
745 ldah t0, -1(t0) // t0 = ffff ffff ffff c01c
746 sll t0, 28, t0 // t0 = ffff fc01 c000 0000
747
748
749 //
750 // Shift in the port number to generate the port address we
751 // wish to access
752 // N.B. - access width is always zero = byte access for VTI
753 //
754
755 sll a0, 9, a0 // a0 << 9
756 bis t0, a0, t0 // t0 = address of VTI port
757
758
759 //
760 // Do the port write, guarantee that subsequent writes (and reads)
761 // are ordered with respect to this write and return to caller
762 //
763
764 stl a1, 0(t0) // write data to port
765 mb // guarantee write ordering
766
767 ret zero, (ra) // return
768
769 .end outVti
770
771
772
773 //++
774 //
775 // ULONG
776 // inVti(
777 // ULONG port
778 // )
779 //
780 // Routine Description:
781 //
782 // This function uses the 64-bit super-page to read data from a port
783 // of the on-board VTI combo chip for JENSEN.
784 //
785 // Arguments:
786 //
787 // port (a0) - port number on VTI chip to which to write data
788 //
789 // Return Value:
790 //
791 // data (v0) - the data read from the VTI chip, only the low byte will
792 // be valid
793 //
794 //--
795
796 LEAF_ENTRY(inVti)
797
798 //
799 // generate super-page address of vti, base address
800 // N.B. - upper bits must be sign extension of bit 42
801 // va<42:41> = 10 (binary) for super-page address
802 //
803
804 lda t0, 0xc01c(zero) // t0 = 0000 0000 0000 c01c
805 ldah t0, -1(t0) // t0 = ffff ffff ffff c01c
806 sll t0, 28, t0 // t0 = ffff fc01 c000 0000
807
808
809 //
810 // Shift in the port number to generate the port address we
811 // wish to access
812 // N.B. - access width for VTI is always 0 = byte access
813 //
814
815 sll a0, 9, a0 // a0 << 9
816 bis t0, a0, t0 // t0 = address of VTI port
817
818
819 //
820 // Do the super-page i/o access and return data to caller
821 //
822
823 ldl v0, 0(t0) // read data from port
824 and v0, 0xff, v0
825
826 ret zero, (ra) // return
827
828 .end inVti
829
830
831
832 LEAF_ENTRY(delay_us)
833 bis zero, ONE_USEC, t1
834 rpcc t0 /* RCC T0, read cycle counter */
835
836 loop0: rpcc t2 /* RCC T2, read cycle counter */
837 subl t2, t0, t2 /* check for wrapping */
838 bge t2, over0 /* check, and see if negative */
839
840 ornot t0, zero, t4 /* calculate the offset */
841 zap t4, 0xf0, t4
842 cmplt t4, t1, t2
843 beq t2, done0
844 subl t1, t4, t1 /* adjust the counter */
845 and zero, t0, t0 /* set t0 to zero */
846
847 over0: cmplt t2, t1, t2 /* compare these for usec timer */
848 bne t2, loop0 /* stay in... */
849 done0: ret zero, (ra)
850 .end delay_us
851
852
853
854 LEAF_ENTRY(delay_500ns)
855 bis zero, HALF_USEC, t1
856 rpcc t0 /* RCC T0, read cycle counter */
857
858 loop1: rpcc t2 /* RCC T2, read cycle counter */
859 subl t2, t0, t2 /* check for wrapping */
860 bge t2, over1 /* check, and see if negative */
861
862 ornot t0, zero, t4 /* calculate the offset */
863 zap t4, 0xf0, t4
864 cmplt t4, t1, t2
865 beq t2, done1
866 subl t1, t4, t1 /* adjust the counter */
867 and zero, t0, t0 /* set t0 to zero */
868
869 over1: cmplt t2, t1, t2 /* compare these for usec timer */
870 bne t2, loop1 /* stay in... */
871 done1: ret zero, (ra)
872 .end delay_500ns
873
874
875