1
2 .psize 0
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 #include <linux/hdlc.h>
36 #include <linux/hdlc/ioctl.h>
37 #include "wanxl.h"
38
39
40
41 MAX_RAM_SIZE = 16 * 1024 * 1024
42
43 PCI9060_VECTOR = 0x0000006C
44 CPM_IRQ_BASE = 0x40
45 ERROR_VECTOR = CPM_IRQ_BASE * 4
46 SCC1_VECTOR = (CPM_IRQ_BASE + 0x1E) * 4
47 SCC2_VECTOR = (CPM_IRQ_BASE + 0x1D) * 4
48 SCC3_VECTOR = (CPM_IRQ_BASE + 0x1C) * 4
49 SCC4_VECTOR = (CPM_IRQ_BASE + 0x1B) * 4
50 CPM_IRQ_LEVEL = 4
51 TIMER_IRQ = 128
52 TIMER_IRQ_LEVEL = 4
53 PITR_CONST = 0x100 + 16
54
55 MBAR = 0x0003FF00
56
57 VALUE_WINDOW = 0x40000000
58 ORDER_WINDOW = 0xC0000000
59
60 PLX = 0xFFF90000
61
62 CSRA = 0xFFFB0000
63 CSRB = 0xFFFB0002
64 CSRC = 0xFFFB0004
65 CSRD = 0xFFFB0006
66 STATUS_CABLE_LL = 0x2000
67 STATUS_CABLE_DTR = 0x1000
68
69 DPRBASE = 0xFFFC0000
70
71 SCC1_BASE = DPRBASE + 0xC00
72 MISC_BASE = DPRBASE + 0xCB0
73 SCC2_BASE = DPRBASE + 0xD00
74 SCC3_BASE = DPRBASE + 0xE00
75 SCC4_BASE = DPRBASE + 0xF00
76
77
78
79 SCC_RBASE = 0
80 SCC_TBASE = 2
81 SCC_RFCR = 4
82 SCC_TFCR = 5
83 SCC_MRBLR = 6
84 SCC_C_MASK = 0x34
85 SCC_C_PRES = 0x38
86 SCC_MFLR = 0x46
87
88 REGBASE = DPRBASE + 0x1000
89 PICR = REGBASE + 0x026
90 PITR = REGBASE + 0x02A
91 OR1 = REGBASE + 0x064
92 CICR = REGBASE + 0x540
93 CIMR = REGBASE + 0x548
94 CISR = REGBASE + 0x54C
95 PADIR = REGBASE + 0x550
96 PAPAR = REGBASE + 0x552
97 PAODR = REGBASE + 0x554
98 PADAT = REGBASE + 0x556
99
100 PCDIR = REGBASE + 0x560
101 PCPAR = REGBASE + 0x562
102 PCSO = REGBASE + 0x564
103 PCDAT = REGBASE + 0x566
104 PCINT = REGBASE + 0x568
105 CR = REGBASE + 0x5C0
106
107 SCC1_REGS = REGBASE + 0x600
108 SCC2_REGS = REGBASE + 0x620
109 SCC3_REGS = REGBASE + 0x640
110 SCC4_REGS = REGBASE + 0x660
111 SICR = REGBASE + 0x6EC
112
113
114 SCC_GSMR_L = 0x00
115 SCC_GSMR_H = 0x04
116 SCC_PSMR = 0x08
117 SCC_TODR = 0x0C
118 SCC_DSR = 0x0E
119 SCC_SCCE = 0x10
120 SCC_SCCM = 0x14
121 SCC_SCCS = 0x17
122
123 #if QUICC_MEMCPY_USES_PLX
124 .macro memcpy_from_pci src, dest, len
125 addl #3, \len
126 andl #0xFFFFFFFC, \len
127 movel \src, PLX_DMA_0_PCI
128 movel \dest, PLX_DMA_0_LOCAL
129 movel \len, PLX_DMA_0_LENGTH
130 movel #0x0103, PLX_DMA_CMD_STS
131 bsr memcpy_from_pci_run
132 .endm
133
134 .macro memcpy_to_pci src, dest, len
135 addl #3, \len
136 andl #0xFFFFFFFC, \len
137 movel \src, PLX_DMA_1_LOCAL
138 movel \dest, PLX_DMA_1_PCI
139 movel \len, PLX_DMA_1_LENGTH
140 movel #0x0301, PLX_DMA_CMD_STS
141 bsr memcpy_to_pci_run
142 .endm
143
144 #else
145
146 .macro memcpy src, dest, len
147 movel %d7, -(%sp)
148 movel \len, %d7
149 lsrl #2, \len
150 andl \len, \len
151 beq 99f
152 subl #1, \len
153 98: movel (\src)+, (\dest)+
154 dbfw \len, 98b
155 99: movel %d7, \len
156 btstl #1, \len
157 beq 99f
158 movew (\src)+, (\dest)+
159 99: btstl #0, \len
160 beq 99f
161 moveb (\src)+, (\dest)+
162 99:
163 movel (%sp)+, %d7
164 .endm
165
166 .macro memcpy_from_pci src, dest, len
167 addl #VALUE_WINDOW, \src
168 memcpy \src, \dest, \len
169 .endm
170
171 .macro memcpy_to_pci src, dest, len
172 addl #VALUE_WINDOW, \dest
173 memcpy \src, \dest, \len
174 .endm
175 #endif
176
177
178 .macro wait_for_command
179 99: btstl #0, CR
180 bne 99b
181 .endm
182
183
184
185
186
187 .text
188 .global _start
189 _start: bra init
190
191 .org _start + 4
192 ch_status_addr: .long 0, 0, 0, 0
193 rx_descs_addr: .long 0
194
195 init:
196 #if DETECT_RAM
197 movel OR1, %d0
198 andl #0xF00007FF, %d0
199 orl #0xFFFF800 & ~(MAX_RAM_SIZE - 1), %d0
200 movel %d0, OR1
201 #endif
202
203 addl #VALUE_WINDOW, rx_descs_addr
204 clrl %d0
205 init_1: tstl ch_status_addr(%d0)
206 beq init_2
207 addl #VALUE_WINDOW, ch_status_addr(%d0)
208 init_2: addl #4, %d0
209 cmpl #4 * 4, %d0
210 bne init_1
211
212 movel #pci9060_interrupt, PCI9060_VECTOR
213 movel #error_interrupt, ERROR_VECTOR
214 movel #port_interrupt_1, SCC1_VECTOR
215 movel #port_interrupt_2, SCC2_VECTOR
216 movel #port_interrupt_3, SCC3_VECTOR
217 movel #port_interrupt_4, SCC4_VECTOR
218 movel #timer_interrupt, TIMER_IRQ * 4
219
220 movel #0x78000000, CIMR
221 movew #(TIMER_IRQ_LEVEL << 8) + TIMER_IRQ, PICR
222 movew #PITR_CONST, PITR
223
224
225 movel #0xD41F40 + (CPM_IRQ_LEVEL << 13), CICR
226 movel #0x543, PLX_DMA_0_MODE
227 movel #0x543, PLX_DMA_1_MODE
228 movel #0x0, PLX_DMA_0_DESC
229 movel #0x8, PLX_DMA_1_DESC
230 movel #0x101, PLX_DMA_CMD_STS
231
232 orl #0x000F0300, PLX_INTERRUPT_CS
233
234 #if DETECT_RAM
235 bsr ram_test
236 #else
237 movel #1, PLX_MAILBOX_5
238 #endif
239 bsr check_csr
240
241 movew #0xFFFF, PAPAR
242 clrw PADIR
243 clrw PCSO
244
245
246
247
248 main: movel channel_stats, %d7
249 clrl channel_stats
250
251 tstl %d7
252 bne main_1
253
254 stop #0x2200
255 movew #0x2700, %sr
256 bra main
257
258 main_1: clrl %d0
259 clrl %d6
260
261 main_l: btstl #DOORBELL_TO_CARD_CLOSE_0, %d7
262 beq main_op
263 bclrl #DOORBELL_TO_CARD_OPEN_0, %d7
264 bsr close_port
265 main_op:
266 btstl #DOORBELL_TO_CARD_OPEN_0, %d7
267 beq main_cl
268 bsr open_port
269 main_cl:
270 btstl #DOORBELL_TO_CARD_TX_0, %d7
271 beq main_txend
272 bsr tx
273 main_txend:
274 btstl #TASK_SCC_0, %d7
275 beq main_next
276 bsr tx_end
277 bsr rx
278
279 main_next:
280 lsrl #1, %d7
281 addl #4, %d0
282 cmpl #4 * 4, %d0
283 bne main_l
284 movel %d6, PLX_DOORBELL_FROM_CARD
285 bra main
286
287
288
289
290 open_port:
291 movel ch_status_addr(%d0), %a0
292 tstl STATUS_OPEN(%a0)
293 bne open_port_ret
294 movel #1, STATUS_OPEN(%a0)
295
296 clrl tx_in(%d0)
297 clrl tx_out(%d0)
298 clrl tx_count(%d0)
299 clrl rx_in(%d0)
300
301 movel SICR, %d1
302 andl clocking_mask(%d0), %d1
303 cmpl #CLOCK_TXFROMRX, STATUS_CLOCKING(%a0)
304 bne open_port_clock_ext
305 orl clocking_txfromrx(%d0), %d1
306 bra open_port_set_clock
307
308 open_port_clock_ext:
309 orl clocking_ext(%d0), %d1
310 open_port_set_clock:
311 movel %d1, SICR
312
313 orw #STATUS_CABLE_DTR, csr_output(%d0)
314 bsr check_csr
315
316
317 movel first_buffer(%d0), %d1
318 movel tx_first_bd(%d0), %a1
319 movel #TX_BUFFERS - 2, %d2
320 movel #0x18000000, %d3
321 cmpl #PARITY_NONE, STATUS_PARITY(%a0)
322 beq open_port_tx_loop
323 bsetl #26, %d3
324 open_port_tx_loop:
325 movel %d3, (%a1)+
326 movel %d1, (%a1)+
327 addl #BUFFER_LENGTH, %d1
328 dbfw %d2, open_port_tx_loop
329
330 bsetl #29, %d3
331 movel %d3, (%a1)+
332 movel %d1, (%a1)+
333
334
335 movel #RX_BUFFERS - 2, %d2
336 open_port_rx_loop:
337 movel #0x90000000, (%a1)+
338 movel %d1, (%a1)+
339 addl #BUFFER_LENGTH, %d1
340 dbfw %d2, open_port_rx_loop
341
342 movel #0xB0000000, (%a1)+
343 movel %d1, (%a1)+
344
345
346 movel scc_base_addr(%d0), %a1
347 movel scc_reg_addr(%d0), %a2
348
349 movel #0xFFFF, SCC_SCCE(%a2)
350 movel #0x0000, SCC_SCCM(%a2)
351
352 movel tx_first_bd(%d0), %d1
353 movew %d1, SCC_TBASE(%a1)
354 addl #TX_BUFFERS * 8, %d1
355 movew %d1, SCC_RBASE(%a1)
356 moveb #0x8, SCC_RFCR(%a1)
357 moveb #0x8, SCC_TFCR(%a1)
358
359
360 cmpl #PARITY_CRC16_PR1_CCITT, STATUS_PARITY(%a0)
361 bne open_port_parity_1
362 clrw SCC_PSMR(%a2)
363 movel #0xF0B8, SCC_C_MASK(%a1)
364 movel #0xFFFF, SCC_C_PRES(%a1)
365 movew #HDLC_MAX_MRU + 2, SCC_MFLR(%a1)
366 movew #2, parity_bytes(%d0)
367 bra open_port_2
368
369 open_port_parity_1:
370 cmpl #PARITY_CRC32_PR1_CCITT, STATUS_PARITY(%a0)
371 bne open_port_parity_2
372 movew #0x0800, SCC_PSMR(%a2)
373 movel #0xDEBB20E3, SCC_C_MASK(%a1)
374 movel #0xFFFFFFFF, SCC_C_PRES(%a1)
375 movew #HDLC_MAX_MRU + 4, SCC_MFLR(%a1)
376 movew #4, parity_bytes(%d0)
377 bra open_port_2
378
379 open_port_parity_2:
380 cmpl #PARITY_CRC16_PR0_CCITT, STATUS_PARITY(%a0)
381 bne open_port_parity_3
382 clrw SCC_PSMR(%a2)
383 movel #0xF0B8, SCC_C_MASK(%a1)
384 clrl SCC_C_PRES(%a1)
385 movew #HDLC_MAX_MRU + 2, SCC_MFLR(%a1)
386 movew #2, parity_bytes(%d0)
387 bra open_port_2
388
389 open_port_parity_3:
390 cmpl #PARITY_CRC32_PR0_CCITT, STATUS_PARITY(%a0)
391 bne open_port_parity_4
392 movew #0x0800, SCC_PSMR(%a2)
393 movel #0xDEBB20E3, SCC_C_MASK(%a1)
394 clrl SCC_C_PRES(%a1)
395 movew #HDLC_MAX_MRU + 4, SCC_MFLR(%a1)
396 movew #4, parity_bytes(%d0)
397 bra open_port_2
398
399 open_port_parity_4:
400 clrw SCC_PSMR(%a2)
401 movel #0xF0B8, SCC_C_MASK(%a1)
402 movel #0xFFFF, SCC_C_PRES(%a1)
403 movew #HDLC_MAX_MRU, SCC_MFLR(%a1)
404 clrw parity_bytes(%d0)
405
406 open_port_2:
407 movel #0x00000003, SCC_GSMR_H(%a2)
408 cmpl #ENCODING_NRZI, STATUS_ENCODING(%a0)
409 bne open_port_nrz
410 movel #0x10040900, SCC_GSMR_L(%a2)
411 bra open_port_3
412
413 open_port_nrz:
414 movel #0x10040000, SCC_GSMR_L(%a2)
415 open_port_3:
416 movew #BUFFER_LENGTH, SCC_MRBLR(%a1)
417 movel %d0, %d1
418 lsll #4, %d1
419 orl #1, %d1
420 movew %d1, CR
421 wait_for_command
422
423
424 movew #0x001F, SCC_SCCM(%a2)
425 orl #0x00000030, SCC_GSMR_L(%a2)
426 open_port_ret:
427 rts
428
429
430
431
432 close_port:
433 movel scc_reg_addr(%d0), %a0
434 clrw SCC_SCCM(%a0)
435 andl #0xFFFFFFCF, SCC_GSMR_L(%a0)
436
437 andw #~STATUS_CABLE_DTR, csr_output(%d0)
438 bsr check_csr
439
440 movel ch_status_addr(%d0), %d1
441 clrl STATUS_OPEN(%d1)
442 rts
443
444
445
446
447 tx:
448 cmpl #TX_BUFFERS, tx_count(%d0)
449 beq tx_ret
450
451 movel tx_out(%d0), %d1
452 movel %d1, %d2
453 mulul #DESC_LENGTH, %d2
454 addl ch_status_addr(%d0), %d2
455 addl #STATUS_TX_DESCS, %d2
456 cmpl #PACKET_FULL, (%d2)
457 bne tx_ret
458
459
460 movel 4(%d2), %a0
461 lsll #3, %d1
462 addl tx_first_bd(%d0), %d1
463
464 movel 4(%d1), %a1
465 movel 8(%d2), %d2
466 movew %d2, 2(%d1)
467 memcpy_from_pci %a0, %a1, %d2
468 bsetl #31, (%d1)
469
470
471 movel tx_out(%d0), %d1
472 addl #1, %d1
473 cmpl #TX_BUFFERS, %d1
474 bne tx_1
475 clrl %d1
476 tx_1: movel %d1, tx_out(%d0)
477
478 addl #1, tx_count(%d0)
479 bra tx
480
481 tx_ret: rts
482
483
484
485
486
487 rx: movel rx_in(%d0), %d1
488 lsll #3, %d1
489 addl rx_first_bd(%d0), %d1
490 movew (%d1), %d2
491 btstl #15, %d2
492 bne rx_ret
493
494 btstl #1, %d2
495 bne rx_overrun
496
497 tstw parity_bytes(%d0)
498 bne rx_parity
499 bclrl #2, %d2
500 rx_parity:
501 andw #0x0CBC, %d2
502 cmpw #0x0C00, %d2
503 bne rx_bad_frame
504 clrl %d3
505 movew 2(%d1), %d3
506 subw parity_bytes(%d0), %d3
507 cmpw #HDLC_MAX_MRU, %d3
508 bgt rx_bad_frame
509
510 rx_good_frame:
511 movel rx_out, %d2
512 mulul #DESC_LENGTH, %d2
513 addl rx_descs_addr, %d2
514 cmpl #PACKET_EMPTY, (%d2)
515 bne rx_overrun
516
517 movel %d3, 8(%d2)
518 movel 4(%d1), %a0
519 movel 4(%d2), %a1
520 tstl %a1
521 beq rx_ignore_data
522 memcpy_to_pci %a0, %a1, %d3
523 rx_ignore_data:
524 movel packet_full(%d0), (%d2)
525
526
527 bsetl #DOORBELL_FROM_CARD_RX, %d6
528 movel rx_out, %d2
529 addl #1, %d2
530 cmpl #RX_QUEUE_LENGTH, %d2
531 bne rx_1
532 clrl %d2
533 rx_1: movel %d2, rx_out
534
535 rx_free_bd:
536 andw #0xF000, (%d1)
537 bsetl #31, (%d1)
538
539 movel rx_in(%d0), %d1
540 addl #1, %d1
541 cmpl #RX_BUFFERS, %d1
542 bne rx_2
543 clrl %d1
544 rx_2: movel %d1, rx_in(%d0)
545 bra rx
546
547 rx_overrun:
548 movel ch_status_addr(%d0), %d2
549 addl #1, STATUS_RX_OVERRUNS(%d2)
550 bra rx_free_bd
551
552 rx_bad_frame:
553 movel ch_status_addr(%d0), %d2
554 addl #1, STATUS_RX_FRAME_ERRORS(%d2)
555 bra rx_free_bd
556
557 rx_ret: rts
558
559
560
561
562
563 tx_end: tstl tx_count(%d0)
564 beq tx_end_ret
565
566 movel tx_in(%d0), %d1
567 movel %d1, %d2
568 lsll #3, %d1
569 addl tx_first_bd(%d0), %d1
570 movew (%d1), %d3
571 btstl #15, %d3
572 bne tx_end_ret
573
574
575 orl bell_tx(%d0), %d6
576 subl #1, tx_count(%d0)
577 movel tx_in(%d0), %d1
578 addl #1, %d1
579 cmpl #TX_BUFFERS, %d1
580 bne tx_end_1
581 clrl %d1
582 tx_end_1:
583 movel %d1, tx_in(%d0)
584
585
586 mulul #DESC_LENGTH, %d2
587 addl ch_status_addr(%d0), %d2
588 addl #STATUS_TX_DESCS, %d2
589 btstl #1, %d3
590 bne tx_end_underrun
591 movel #PACKET_SENT, (%d2)
592 bra tx_end
593
594 tx_end_underrun:
595 movel #PACKET_UNDERRUN, (%d2)
596 bra tx_end
597
598 tx_end_ret: rts
599
600
601
602
603 #if QUICC_MEMCPY_USES_PLX
604
605 memcpy_from_pci_run:
606 movel %d0, -(%sp)
607 movew %sr, -(%sp)
608 memcpy_1:
609 movel PLX_DMA_CMD_STS, %d0
610 btstl #4, %d0
611 bne memcpy_end
612 stop #0x2200
613 movew #0x2700, %sr
614 bra memcpy_1
615
616 memcpy_to_pci_run:
617 movel %d0, -(%sp)
618 movew %sr, -(%sp)
619 memcpy_2:
620 movel PLX_DMA_CMD_STS, %d0
621 btstl #12, %d0
622 bne memcpy_end
623 stop #0x2200
624 movew #0x2700, %sr
625 bra memcpy_2
626
627 memcpy_end:
628 movew (%sp)+, %sr
629 movel (%sp)+, %d0
630 rts
631 #endif
632
633
634
635
636
637
638
639
640 pci9060_interrupt:
641 movel %d0, -(%sp)
642
643 movel PLX_DOORBELL_TO_CARD, %d0
644 movel %d0, PLX_DOORBELL_TO_CARD
645 orl %d0, channel_stats
646
647 movel #0x0909, PLX_DMA_CMD_STS
648
649 movel (%sp)+, %d0
650 rte
651
652
653
654 port_interrupt_1:
655 orl #0, SCC1_REGS + SCC_SCCE;
656 orl #1 << TASK_SCC_0, channel_stats
657 movel #0x40000000, CISR
658 rte
659
660 port_interrupt_2:
661 orl #0, SCC2_REGS + SCC_SCCE;
662 orl #1 << TASK_SCC_1, channel_stats
663 movel #0x20000000, CISR
664 rte
665
666 port_interrupt_3:
667 orl #0, SCC3_REGS + SCC_SCCE;
668 orl #1 << TASK_SCC_2, channel_stats
669 movel #0x10000000, CISR
670 rte
671
672 port_interrupt_4:
673 orl #0, SCC4_REGS + SCC_SCCE;
674 orl #1 << TASK_SCC_3, channel_stats
675 movel #0x08000000, CISR
676 rte
677
678 error_interrupt:
679 rte
680
681
682
683
684 check_csr:
685 movel %d0, -(%sp)
686 movel %d1, -(%sp)
687 movel %d2, -(%sp)
688 movel %a0, -(%sp)
689 movel %a1, -(%sp)
690
691 clrl %d0
692 movel #CSRA, %a0
693
694 check_csr_loop:
695 movew (%a0), %d1
696 andl #0xE7, %d1
697 cmpw #STATUS_CABLE_V35 * (1 + 1 << STATUS_CABLE_PM_SHIFT), %d1
698 bne check_csr_1
699 movew #0x0E08, %d1
700 bra check_csr_valid
701
702 check_csr_1:
703 cmpw #STATUS_CABLE_X21 * (1 + 1 << STATUS_CABLE_PM_SHIFT), %d1
704 bne check_csr_2
705 movew #0x0408, %d1
706 bra check_csr_valid
707
708 check_csr_2:
709 cmpw #STATUS_CABLE_V24 * (1 + 1 << STATUS_CABLE_PM_SHIFT), %d1
710 bne check_csr_3
711 movew #0x0208, %d1
712 bra check_csr_valid
713
714 check_csr_3:
715 cmpw #STATUS_CABLE_EIA530 * (1 + 1 << STATUS_CABLE_PM_SHIFT), %d1
716 bne check_csr_disable
717 movew #0x0D08, %d1
718 bra check_csr_valid
719
720 check_csr_disable:
721 movew #0x0008, %d1
722 movew #0x80E7, %d2
723 bra check_csr_write
724
725 check_csr_valid:
726 movew csr_output(%d0), %d2
727 andw #0x3000, %d2
728 orw %d2, %d1
729 movew #0x80FF, %d2
730
731 check_csr_write:
732 cmpw old_csr_output(%d0), %d1
733 beq check_csr_input
734 movew %d1, old_csr_output(%d0)
735 movew %d1, (%a0)
736
737 check_csr_input:
738 movew (PCDAT), %d1
739 andw dcd_mask(%d0), %d1
740 beq check_csr_dcd_on
741 movew (%a0), %d1
742 andw #~STATUS_CABLE_DCD, %d1
743 bra check_csr_previous
744
745 check_csr_dcd_on:
746 movew (%a0), %d1
747 orw #STATUS_CABLE_DCD, %d1
748 check_csr_previous:
749 andw %d2, %d1
750 movel ch_status_addr(%d0), %a1
751 cmpl STATUS_CABLE(%a1), %d1
752 beq check_csr_next
753 movel %d1, STATUS_CABLE(%a1)
754 movel bell_cable(%d0), PLX_DOORBELL_FROM_CARD
755
756 check_csr_next:
757 addl #2, %a0
758 addl #4, %d0
759 cmpl #4 * 4, %d0
760 bne check_csr_loop
761
762 movel (%sp)+, %a1
763 movel (%sp)+, %a0
764 movel (%sp)+, %d2
765 movel (%sp)+, %d1
766 movel (%sp)+, %d0
767 rts
768
769
770
771
772 timer_interrupt:
773 bsr check_csr
774 rte
775
776
777
778 #if DETECT_RAM
779 ram_test:
780 movel #0x12345678, %d1
781 movel %d1, (128 * 1024 - 4)
782 movel #128 * 1024, %d0
783 ram_test_size:
784 cmpl #MAX_RAM_SIZE, %d0
785 beq ram_test_size_found
786 movel %d0, %a0
787 addl #128 * 1024 - 4, %a0
788 cmpl (%a0), %d1
789 beq ram_test_size_check
790 ram_test_next_size:
791 lsll #1, %d0
792 bra ram_test_size
793
794 ram_test_size_check:
795 eorl #0xFFFFFFFF, %d1
796 movel %d1, (128 * 1024 - 4)
797 cmpl (%a0), %d1
798 bne ram_test_next_size
799
800 ram_test_size_found:
801 movel %d0, %a0
802 subl #firmware_end + 4, %d0
803 lsrl #2, %d0
804 movel %d0, %d1
805 ram_test_fill:
806 movel %a0, -(%a0)
807 dbfw %d1, ram_test_fill
808 subl #0x10000, %d1
809 cmpl #0xFFFFFFFF, %d1
810 bne ram_test_fill
811
812 ram_test_loop:
813 cmpl (%a0)+, %a0
814 dbnew %d0, ram_test_loop
815 bne ram_test_found_bad
816 subl #0x10000, %d0
817 cmpl #0xFFFFFFFF, %d0
818 bne ram_test_loop
819 bra ram_test_all_ok
820
821 ram_test_found_bad:
822 subl #4, %a0
823 ram_test_all_ok:
824 movel %a0, PLX_MAILBOX_5
825 rts
826 #endif
827
828
829
830
831 scc_reg_addr:
832 .long SCC1_REGS, SCC2_REGS, SCC3_REGS, SCC4_REGS
833 scc_base_addr:
834 .long SCC1_BASE, SCC2_BASE, SCC3_BASE, SCC4_BASE
835
836 tx_first_bd:
837 .long DPRBASE
838 .long DPRBASE + (TX_BUFFERS + RX_BUFFERS) * 8
839 .long DPRBASE + (TX_BUFFERS + RX_BUFFERS) * 8 * 2
840 .long DPRBASE + (TX_BUFFERS + RX_BUFFERS) * 8 * 3
841
842 rx_first_bd:
843 .long DPRBASE + TX_BUFFERS * 8
844 .long DPRBASE + TX_BUFFERS * 8 + (TX_BUFFERS + RX_BUFFERS) * 8
845 .long DPRBASE + TX_BUFFERS * 8 + (TX_BUFFERS + RX_BUFFERS) * 8 * 2
846 .long DPRBASE + TX_BUFFERS * 8 + (TX_BUFFERS + RX_BUFFERS) * 8 * 3
847
848 first_buffer:
849 .long BUFFERS_ADDR
850 .long BUFFERS_ADDR + (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH
851 .long BUFFERS_ADDR + (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * 2
852 .long BUFFERS_ADDR + (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * 3
853
854 bell_tx:
855 .long 1 << DOORBELL_FROM_CARD_TX_0, 1 << DOORBELL_FROM_CARD_TX_1
856 .long 1 << DOORBELL_FROM_CARD_TX_2, 1 << DOORBELL_FROM_CARD_TX_3
857
858 bell_cable:
859 .long 1 << DOORBELL_FROM_CARD_CABLE_0, 1 << DOORBELL_FROM_CARD_CABLE_1
860 .long 1 << DOORBELL_FROM_CARD_CABLE_2, 1 << DOORBELL_FROM_CARD_CABLE_3
861
862 packet_full:
863 .long PACKET_FULL, PACKET_FULL + 1, PACKET_FULL + 2, PACKET_FULL + 3
864
865 clocking_ext:
866 .long 0x0000002C, 0x00003E00, 0x002C0000, 0x3E000000
867 clocking_txfromrx:
868 .long 0x0000002D, 0x00003F00, 0x002D0000, 0x3F000000
869 clocking_mask:
870 .long 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000
871 dcd_mask:
872 .word 0x020, 0, 0x080, 0, 0x200, 0, 0x800
873
874 .ascii "wanXL firmware\n"
875 .asciz "Copyright (C) 2003 Krzysztof Halasa <khc@pm.waw.pl>\n"
876
877
878
879
880 .align 4
881 channel_stats: .long 0
882
883 tx_in: .long 0, 0, 0, 0
884 tx_out: .long 0, 0, 0, 0
885 tx_count: .long 0, 0, 0, 0
886
887 rx_in: .long 0, 0, 0, 0
888 rx_out: .long 0
889 parity_bytes: .word 0, 0, 0, 0, 0, 0, 0
890
891 csr_output: .word 0
892 old_csr_output: .word 0, 0, 0, 0, 0, 0, 0
893 .align 4
894 firmware_end: