Rev 5561 | Rev 6948 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5561 | Rev 5562 | ||
---|---|---|---|
Line 71... | Line 71... | ||
71 | RX_ADDR_LOAD = 0x0006 |
71 | RX_ADDR_LOAD = 0x0006 |
72 | RX_RESUMENR = 0x0007 |
72 | RX_RESUMENR = 0x0007 |
73 | INT_MASK = 0x0100 |
73 | INT_MASK = 0x0100 |
74 | DRVR_INT = 0x0200 ; Driver generated interrupt |
74 | DRVR_INT = 0x0200 ; Driver generated interrupt |
Line 75... | Line -... | ||
75 | - | ||
76 | CmdIASetup = 0x0001 |
- | |
77 | CmdConfigure = 0x0002 |
- | |
78 | CmdTx = 0x0004 |
- | |
79 | CmdTxFlex = 0x0008 |
- | |
80 | Cmdsuspend = 0x4000 |
- | |
81 | - | ||
82 | CmdRxFlex = 0x0008 |
- | |
83 | 75 | ||
84 | reg_scb_status = 0 |
76 | REG_SCB_STATUS = 0 |
85 | reg_scb_cmd = 2 |
77 | REG_SCB_CMD = 2 |
86 | reg_scb_ptr = 4 |
78 | REG_SCB_PTR = 4 |
87 | reg_port = 8 |
79 | REG_PORT = 8 |
88 | reg_eeprom = 14 |
80 | REG_EEPROM = 14 |
89 | reg_mdi_ctrl = 16 |
81 | REG_MDI_CTRL = 16 |
90 | 82 | ||
91 | phy_100a = 0x000003E0 |
83 | PHY_100a = 0x000003E0 |
92 | phy_100c = 0x035002A8 |
84 | PHY_100c = 0x035002A8 |
93 | phy_82555_tx = 0x015002A8 |
85 | PHY_82555_tx = 0x015002A8 |
94 | phy_nsc_tx = 0x5C002000 |
86 | PHY_nsc_tx = 0x5C002000 |
95 | phy_82562_et = 0x033002A8 |
87 | PHY_82562_et = 0x033002A8 |
96 | phy_82562_em = 0x032002A8 |
88 | PHY_82562_em = 0x032002A8 |
97 | phy_82562_ek = 0x031002A8 |
89 | PHY_82562_ek = 0x031002A8 |
98 | phy_82562_eh = 0x017002A8 |
90 | PHY_82562_eh = 0x017002A8 |
99 | phy_82552_v = 0xd061004d |
91 | PHY_82552_v = 0xd061004d |
100 | phy_unknown = 0xFFFFFFFF |
92 | PHY_unknown = 0xFFFFFFFF |
101 | 93 | ||
102 | mac_82557_D100_A = 0 |
94 | MAC_82557_D100_A = 0 |
103 | mac_82557_D100_B = 1 |
95 | MAC_82557_D100_B = 1 |
104 | mac_82557_D100_C = 2 |
96 | MAC_82557_D100_C = 2 |
105 | mac_82558_D101_A4 = 4 |
97 | MAC_82558_D101_A4 = 4 |
106 | mac_82558_D101_B0 = 5 |
98 | MAC_82558_D101_B0 = 5 |
107 | mac_82559_D101M = 8 |
99 | MAC_82559_D101M = 8 |
108 | mac_82559_D101S = 9 |
100 | MAC_82559_D101S = 9 |
109 | mac_82550_D102 = 12 |
101 | MAC_82550_D102 = 12 |
110 | mac_82550_D102_C = 13 |
102 | MAC_82550_D102_C = 13 |
111 | mac_82551_E = 14 |
103 | MAC_82551_E = 14 |
112 | mac_82551_F = 15 |
104 | MAC_82551_F = 15 |
113 | mac_82551_10 = 16 |
105 | MAC_82551_10 = 16 |
- | 106 | MAC_unknown = 0xFF |
|
- | 107 | ||
- | 108 | SCB_STATUS_RUS = 111100b ; RU Status |
|
- | 109 | RU_STATUS_IDLE = 0000b shl 2 |
|
- | 110 | RU_STATUS_SUSPENDED = 0001b shl 2 |
|
- | 111 | RU_STATUS_NO_RESOURCES = 0010b shl 2 |
|
- | 112 | RU_STATUS_READY = 0100b shl 2 |
|
- | 113 | SCB_STATUS_FCP = 1 shl 8 ; Flow Control Pause |
|
- | 114 | SCB_STATUS_SWI = 1 shl 10 ; Software Interrupt |
|
- | 115 | SCB_STATUS_MDI = 1 shl 11 ; MDI read/write complete |
|
- | 116 | SCB_STATUS_RNR = 1 shl 12 ; Receiver Not Ready |
|
- | 117 | SCB_STATUS_CNA = 1 shl 13 ; Command unit Not Active |
|
- | 118 | SCB_STATUS_FR = 1 shl 14 ; Frame received |
|
Line 114... | Line 119... | ||
114 | mac_unknown = 0xFF |
119 | SCB_STATUS_CX_TNO = 1 shl 15 ; Command finished / Transmit Not Okay |
Line 115... | Line 120... | ||
115 | 120 | ||
116 | struct rxfd |
121 | struct rxfd |
Line 123... | Line 128... | ||
123 | size dw ? |
128 | size dw ? |
124 | packet rb 1500 |
129 | packet rb 1500 |
Line 125... | Line 130... | ||
125 | 130 | ||
Line -... | Line 131... | ||
- | 131 | ends |
|
- | 132 | ||
- | 133 | RXFD_STATUS_RC = 1 shl 0 ; Receive collision |
|
- | 134 | RXFD_STATUS_IA = 1 shl 1 ; IA mismatch |
|
- | 135 | RXFD_STATUS_NA = 1 shl 2 ; No address match |
|
- | 136 | RXFD_STATUS_RE = 1 shl 4 ; Receive Error |
|
- | 137 | RXFD_STATUS_TL = 1 shl 5 ; Type/length |
|
- | 138 | RXFD_STATUS_FS = 1 shl 7 ; Frame too short |
|
- | 139 | RXFD_STATUS_DMA_FAIL = 1 shl 8 ; DMA overrun failure |
|
- | 140 | RXFD_STATUS_NR = 1 shl 9 ; Out of buffer space; no resources |
|
- | 141 | RXFD_STATUS_MISA = 1 shl 10 ; Alignment error |
|
- | 142 | RXFD_STATUS_CRC_ERR = 1 shl 11 ; CRC error in aligned frame |
|
- | 143 | RXFD_STATUS_OK = 1 shl 13 ; Frame received and stored |
|
- | 144 | RXFD_STATUS_C = 1 shl 15 ; Completion of frame reception |
|
- | 145 | ||
- | 146 | RXFD_CMD_SF = 1 shl 3 |
|
- | 147 | RXFD_CMD_H = 1 shl 4 ; Header RFD |
|
- | 148 | RXFD_CMD_SUSPEND = 1 shl 14 ; Suspends RU after receiving the frame |
|
126 | ends |
149 | RXFD_CMD_EL = 1 shl 15 ; Last RFD in RFA |
Line 127... | Line 150... | ||
127 | 150 | ||
128 | struct txfd |
151 | struct txfd |
129 | 152 | ||
Line 138... | Line 161... | ||
138 | virt_addr dd ? |
161 | virt_addr dd ? |
139 | dd ? ; alignment |
162 | dd ? ; alignment |
Line 140... | Line 163... | ||
140 | 163 | ||
Line -... | Line 164... | ||
- | 164 | ends |
|
- | 165 | ||
- | 166 | TXFD_CMD_IA = 1 shl 0 |
|
- | 167 | TXFD_CMD_CFG = 1 shl 1 |
|
- | 168 | TXFD_CMD_TX = 1 shl 2 |
|
- | 169 | TXFD_CMD_TX_FLEX = 1 shl 3 |
|
141 | ends |
170 | TXFD_CMD_SUSPEND = 1 shl 14 |
Line 142... | Line 171... | ||
142 | 171 | ||
143 | struc confcmd { |
172 | struc confcmd { |
144 | 173 | ||
Line 453... | Line 482... | ||
453 | 482 | ||
454 | ;--------------- |
483 | ;--------------- |
Line 455... | Line 484... | ||
455 | ; reset the card |
484 | ; reset the card |
456 | 485 | ||
457 | set_io [ebx + device.io_addr], 0 |
486 | set_io [ebx + device.io_addr], 0 |
458 | set_io [ebx + device.io_addr], reg_port |
487 | set_io [ebx + device.io_addr], REG_PORT |
Line 459... | Line 488... | ||
459 | xor eax, eax ; Software Reset |
488 | xor eax, eax ; Software Reset |
460 | out dx, eax |
489 | out dx, eax |
Line 466... | Line 495... | ||
466 | ; Tell device where to store stats |
495 | ; Tell device where to store stats |
Line 467... | Line 496... | ||
467 | 496 | ||
468 | lea eax, [ebx + device.lstats.tx_good_frames] ; lstats |
497 | lea eax, [ebx + device.lstats.tx_good_frames] ; lstats |
469 | invoke GetPhysAddr |
498 | invoke GetPhysAddr |
470 | set_io [ebx + device.io_addr], 0 |
499 | set_io [ebx + device.io_addr], 0 |
471 | set_io [ebx + device.io_addr], reg_scb_ptr |
500 | set_io [ebx + device.io_addr], REG_SCB_PTR |
Line 472... | Line 501... | ||
472 | out dx, eax |
501 | out dx, eax |
473 | 502 | ||
474 | set_io [ebx + device.io_addr], reg_scb_cmd |
503 | set_io [ebx + device.io_addr], REG_SCB_CMD |
475 | mov ax, CU_STATSADDR or INT_MASK |
504 | mov ax, CU_STATSADDR or INT_MASK |
Line 476... | Line 505... | ||
476 | out dx, ax |
505 | out dx, ax |
477 | call cmd_wait |
506 | call cmd_wait |
Line 478... | Line 507... | ||
478 | 507 | ||
479 | ;------------------------ |
508 | ;------------------------ |
480 | ; setup RX base addr to 0 |
509 | ; setup RX base addr to 0 |
Line 481... | Line 510... | ||
481 | 510 | ||
482 | set_io [ebx + device.io_addr], reg_scb_ptr |
511 | set_io [ebx + device.io_addr], REG_SCB_PTR |
483 | xor eax, eax |
512 | xor eax, eax |
484 | out dx, eax |
513 | out dx, eax |
Line 485... | Line 514... | ||
485 | 514 | ||
Line 502... | Line 531... | ||
502 | ; Start RX |
531 | ; Start RX |
Line 503... | Line 532... | ||
503 | 532 | ||
Line 504... | Line 533... | ||
504 | DEBUGF 1, "Starting RX" |
533 | DEBUGF 1, "Starting RX" |
505 | 534 | ||
506 | set_io [ebx + device.io_addr], 0 |
535 | set_io [ebx + device.io_addr], 0 |
507 | set_io [ebx + device.io_addr], reg_scb_ptr |
536 | set_io [ebx + device.io_addr], REG_SCB_PTR |
508 | mov eax, [ebx + device.rx_desc] |
537 | mov eax, [ebx + device.rx_desc] |
509 | invoke GetPhysAddr |
538 | invoke GetPhysAddr |
Line 510... | Line 539... | ||
510 | add eax, NET_BUFF.data |
539 | add eax, NET_BUFF.data |
511 | out dx, eax |
540 | out dx, eax |
512 | 541 | ||
513 | set_io [ebx + device.io_addr], reg_scb_cmd |
542 | set_io [ebx + device.io_addr], REG_SCB_CMD |
Line 514... | Line 543... | ||
514 | mov ax, RX_START or INT_MASK |
543 | mov ax, RX_START or INT_MASK |
515 | out dx, ax |
544 | out dx, ax |
Line 516... | Line 545... | ||
516 | call cmd_wait |
545 | call cmd_wait |
517 | 546 | ||
518 | ;---------- |
547 | ;---------- |
Line 519... | Line 548... | ||
519 | ; Set-up TX |
548 | ; Set-up TX |
520 | 549 | ||
521 | set_io [ebx + device.io_addr], reg_scb_ptr |
550 | set_io [ebx + device.io_addr], REG_SCB_PTR |
522 | xor eax, eax |
551 | xor eax, eax |
Line 523... | Line 552... | ||
523 | out dx, eax |
552 | out dx, eax |
524 | 553 | ||
Line 525... | Line 554... | ||
525 | set_io [ebx + device.io_addr], reg_scb_cmd |
554 | set_io [ebx + device.io_addr], REG_SCB_CMD |
526 | mov ax, CU_CMD_BASE or INT_MASK |
555 | mov ax, CU_CMD_BASE or INT_MASK |
527 | out dx, ax |
556 | out dx, ax |
528 | call cmd_wait |
557 | call cmd_wait |
529 | 558 | ||
530 | ;------------------------- |
559 | ;------------------------- |
531 | ; Individual address setup |
560 | ; Individual address setup |
532 | 561 | ||
533 | mov [ebx + device.confcmd.command], CmdIASetup + Cmdsuspend |
562 | mov [ebx + device.confcmd.command], TXFD_CMD_IA + TXFD_CMD_SUSPEND |
Line 534... | Line 563... | ||
534 | mov [ebx + device.confcmd.status], 0 |
563 | mov [ebx + device.confcmd.status], 0 |
535 | lea eax, [ebx + device.tx_ring] |
564 | lea eax, [ebx + device.tx_ring] |
536 | invoke GetPhysAddr |
565 | invoke GetPhysAddr |
537 | mov [ebx + device.confcmd.link], eax |
566 | mov [ebx + device.confcmd.link], eax |
Line 538... | Line 567... | ||
538 | lea edi, [ebx + device.confcmd.data] |
567 | lea edi, [ebx + device.confcmd.data] |
539 | lea esi, [ebx + device.mac] |
568 | lea esi, [ebx + device.mac] |
540 | movsd |
569 | movsd |
541 | movsw |
570 | movsw |
Line 542... | Line 571... | ||
542 | 571 | ||
543 | set_io [ebx + device.io_addr], reg_scb_ptr |
572 | set_io [ebx + device.io_addr], REG_SCB_PTR |
Line 544... | Line 573... | ||
544 | lea eax, [ebx + device.confcmd.status] |
573 | lea eax, [ebx + device.confcmd.status] |
545 | invoke GetPhysAddr |
574 | invoke GetPhysAddr |
546 | out dx, eax |
575 | out dx, eax |
547 | 576 | ||
548 | set_io [ebx + device.io_addr], reg_scb_cmd |
577 | set_io [ebx + device.io_addr], REG_SCB_CMD |
Line 569... | Line 598... | ||
569 | mov byte[ebx + device.confcmd.data + 5], 0x80 |
598 | mov byte[ebx + device.confcmd.data + 5], 0x80 |
570 | mov byte[ebx + device.confcmd.data + 15], 0x48 |
599 | mov byte[ebx + device.confcmd.data + 15], 0x48 |
571 | mov byte[ebx + device.confcmd.data + 19], 0x80 |
600 | mov byte[ebx + device.confcmd.data + 19], 0x80 |
572 | mov byte[ebx + device.confcmd.data + 21], 0x05 |
601 | mov byte[ebx + device.confcmd.data + 21], 0x05 |
Line 573... | Line 602... | ||
573 | 602 | ||
574 | set_io [ebx + device.io_addr], reg_scb_ptr |
603 | set_io [ebx + device.io_addr], REG_SCB_PTR |
575 | lea eax, [ebx + device.confcmd.status] |
604 | lea eax, [ebx + device.confcmd.status] |
576 | invoke GetPhysAddr |
605 | invoke GetPhysAddr |
Line 577... | Line 606... | ||
577 | out dx, eax |
606 | out dx, eax |
578 | 607 | ||
579 | set_io [ebx + device.io_addr], reg_scb_cmd |
608 | set_io [ebx + device.io_addr], REG_SCB_CMD |
580 | mov ax, CU_START ; expect Interrupts from now on |
609 | mov ax, CU_START ; expect Interrupts from now on |
Line 581... | Line 610... | ||
581 | out dx, ax |
610 | out dx, ax |
Line 608... | Line 637... | ||
608 | jz .out_of_mem |
637 | jz .out_of_mem |
609 | mov [ebx + device.rx_desc], eax |
638 | mov [ebx + device.rx_desc], eax |
610 | mov esi, eax |
639 | mov esi, eax |
611 | invoke GetPhysAddr |
640 | invoke GetPhysAddr |
612 | add eax, NET_BUFF.data |
641 | add eax, NET_BUFF.data |
613 | mov [esi + sizeof.NET_BUFF + rxfd.status], 0x0000 |
642 | mov [esi + sizeof.NET_BUFF + rxfd.status], 0 |
614 | mov [esi + sizeof.NET_BUFF + rxfd.command], 0xc000 ; End of list + Suspend |
643 | mov [esi + sizeof.NET_BUFF + rxfd.command], RXFD_CMD_EL or RXFD_CMD_SUSPEND |
615 | mov [esi + sizeof.NET_BUFF + rxfd.link], eax |
644 | mov [esi + sizeof.NET_BUFF + rxfd.link], eax |
616 | mov [esi + sizeof.NET_BUFF + rxfd.count], 0 |
645 | mov [esi + sizeof.NET_BUFF + rxfd.count], 0 |
617 | mov [esi + sizeof.NET_BUFF + rxfd.size], 1528 |
646 | mov [esi + sizeof.NET_BUFF + rxfd.size], 1528 |
Line 618... | Line 647... | ||
618 | 647 | ||
Line 691... | Line 720... | ||
691 | cmp [edi + txfd.status], 0 |
720 | cmp [edi + txfd.status], 0 |
692 | jne .fail |
721 | jne .fail |
Line 693... | Line 722... | ||
693 | 722 | ||
694 | ; Fill in status and command values |
723 | ; Fill in status and command values |
695 | mov [edi + txfd.status], 0 |
724 | mov [edi + txfd.status], 0 |
696 | mov [edi + txfd.command], Cmdsuspend + CmdTx + CmdTxFlex ;;;+ 1 shl 15 ;;; EL bit |
725 | mov [edi + txfd.command], TXFD_CMD_SUSPEND + TXFD_CMD_TX + TXFD_CMD_TX_FLEX |
Line 697... | Line 726... | ||
697 | mov [edi + txfd.count], 0x01208000 |
726 | mov [edi + txfd.count], 0x01208000 |
698 | 727 | ||
699 | ; Fill in buffer address and size |
728 | ; Fill in buffer address and size |
Line 709... | Line 738... | ||
709 | 738 | ||
710 | ; Inform device of the new/updated transmit descriptor |
739 | ; Inform device of the new/updated transmit descriptor |
711 | mov eax, edi |
740 | mov eax, edi |
712 | invoke GetPhysAddr |
741 | invoke GetPhysAddr |
713 | set_io [ebx + device.io_addr], 0 |
742 | set_io [ebx + device.io_addr], 0 |
714 | set_io [ebx + device.io_addr], reg_scb_ptr |
743 | set_io [ebx + device.io_addr], REG_SCB_PTR |
Line 715... | Line 744... | ||
715 | out dx, eax |
744 | out dx, eax |
716 | 745 | ||
717 | ; Start the transmit |
746 | ; Start the transmit |
718 | set_io [ebx + device.io_addr], reg_scb_cmd |
747 | set_io [ebx + device.io_addr], REG_SCB_CMD |
Line 719... | Line 748... | ||
719 | mov ax, CU_START |
748 | mov ax, CU_START |
720 | out dx, ax |
749 | out dx, ax |
Line 765... | Line 794... | ||
765 | jz .nothing |
794 | jz .nothing |
766 | mov esi, device_list |
795 | mov esi, device_list |
767 | .nextdevice: |
796 | .nextdevice: |
768 | mov ebx, [esi] |
797 | mov ebx, [esi] |
Line 769... | Line 798... | ||
769 | 798 | ||
770 | ; set_io [ebx + device.io_addr], 0 ; reg_scb_status = 0 |
799 | ; set_io [ebx + device.io_addr], 0 ; REG_SCB_STATUS = 0 |
771 | set_io [ebx + device.io_addr], reg_scb_status |
800 | set_io [ebx + device.io_addr], REG_SCB_STATUS |
772 | in ax, dx |
801 | in ax, dx |
773 | out dx, ax ; send it back to ACK |
802 | out dx, ax ; send it back to ACK |
774 | test ax, ax |
803 | test ax, ax |
775 | jnz .got_it |
804 | jnz .got_it |
Line 785... | Line 814... | ||
785 | 814 | ||
Line 786... | Line 815... | ||
786 | .got_it: |
815 | .got_it: |
Line 787... | Line 816... | ||
787 | 816 | ||
788 | DEBUGF 1,"Device: %x Status: %x\n", ebx, ax |
817 | DEBUGF 1,"Device: %x Status: %x\n", ebx, ax |
Line 789... | Line 818... | ||
789 | 818 | ||
Line 790... | Line 819... | ||
790 | test ax, 1 shl 14 ; did we receive a frame? |
819 | test ax, SCB_STATUS_FR ; did we receive a frame? |
Line 797... | Line 826... | ||
797 | push ebx |
826 | push ebx |
798 | .rx_loop: |
827 | .rx_loop: |
799 | pop ebx |
828 | pop ebx |
Line 800... | Line 829... | ||
800 | 829 | ||
801 | mov esi, [ebx + device.rx_desc] |
830 | mov esi, [ebx + device.rx_desc] |
802 | cmp [esi + sizeof.NET_BUFF + rxfd.status], 0 ; we could also check bits C and OK (bit 15 and 13) |
831 | test [esi + sizeof.NET_BUFF + rxfd.status], RXFD_STATUS_C ; Completed? |
- | 832 | jz .no_rx_ |
|
- | 833 | test [esi + sizeof.NET_BUFF + rxfd.status], RXFD_STATUS_OK ; OK? |
|
Line 803... | Line 834... | ||
803 | je .nodata |
834 | jz .not_ok |
Line 804... | Line 835... | ||
804 | 835 | ||
805 | DEBUGF 1,"rxfd status=0x%x\n", [esi + sizeof.NET_BUFF + rxfd.status]:4 |
836 | DEBUGF 1,"rxfd status=0x%x\n", [esi + sizeof.NET_BUFF + rxfd.status]:4 |
Line 826... | Line 857... | ||
826 | jz .out_of_mem |
857 | jz .out_of_mem |
827 | mov [ebx + device.rx_desc], eax |
858 | mov [ebx + device.rx_desc], eax |
828 | mov esi, eax |
859 | mov esi, eax |
829 | invoke GetPhysAddr |
860 | invoke GetPhysAddr |
830 | add eax, NET_BUFF.data |
861 | add eax, NET_BUFF.data |
831 | mov [esi + sizeof.NET_BUFF + rxfd.status], 0x0000 |
862 | mov [esi + sizeof.NET_BUFF + rxfd.status], 0 |
832 | mov [esi + sizeof.NET_BUFF + rxfd.command], 0xc000 ; End of list + Suspend |
863 | mov [esi + sizeof.NET_BUFF + rxfd.command], RXFD_CMD_EL or RXFD_CMD_SUSPEND |
833 | mov [esi + sizeof.NET_BUFF + rxfd.link], eax |
864 | mov [esi + sizeof.NET_BUFF + rxfd.link], eax |
834 | mov [esi + sizeof.NET_BUFF + rxfd.count], 0 |
865 | mov [esi + sizeof.NET_BUFF + rxfd.count], 0 |
835 | mov [esi + sizeof.NET_BUFF + rxfd.size], 1528 |
866 | mov [esi + sizeof.NET_BUFF + rxfd.size], 1528 |
Line 836... | Line 867... | ||
836 | 867 | ||
Line 837... | Line 868... | ||
837 | ; restart RX |
868 | ; restart RX |
838 | 869 | ||
839 | set_io [ebx + device.io_addr], 0 |
870 | set_io [ebx + device.io_addr], 0 |
840 | set_io [ebx + device.io_addr], reg_scb_ptr |
871 | set_io [ebx + device.io_addr], REG_SCB_PTR |
841 | ; mov eax, [ebx + device.rx_desc] |
872 | ; mov eax, [ebx + device.rx_desc] |
842 | ; invoke GetPhysAddr |
873 | ; invoke GetPhysAddr |
Line 843... | Line 874... | ||
843 | ; add eax, NET_BUFF.data |
874 | ; add eax, NET_BUFF.data |
844 | out dx, eax |
875 | out dx, eax |
845 | 876 | ||
846 | set_io [ebx + device.io_addr], reg_scb_cmd |
877 | set_io [ebx + device.io_addr], REG_SCB_CMD |
847 | mov ax, RX_START |
878 | mov ax, RX_START |
Line 848... | Line 879... | ||
848 | out dx, ax |
879 | out dx, ax |
849 | call cmd_wait |
880 | call cmd_wait |
Line 850... | Line 881... | ||
850 | .out_of_mem: |
881 | .out_of_mem: |
- | 882 | ||
- | 883 | ; Hand the frame over to the kernel |
|
- | 884 | jmp [EthInput] |
|
- | 885 | ||
- | 886 | .not_ok: |
|
- | 887 | ; Reset the FD |
|
- | 888 | mov [esi + sizeof.NET_BUFF + rxfd.status], 0 |
|
- | 889 | mov [esi + sizeof.NET_BUFF + rxfd.command], RXFD_CMD_EL or RXFD_CMD_SUSPEND |
|
- | 890 | mov [esi + sizeof.NET_BUFF + rxfd.count], 0 |
|
- | 891 | ||
- | 892 | ; Restart RX |
|
- | 893 | set_io [ebx + device.io_addr], 0 |
|
- | 894 | set_io [ebx + device.io_addr], REG_SCB_PTR |
|
- | 895 | mov eax, esi |
|
- | 896 | invoke GetPhysAddr |
|
- | 897 | add eax, NET_BUFF.data |
|
- | 898 | out dx, eax |
|
- | 899 | ||
- | 900 | set_io [ebx + device.io_addr], REG_SCB_CMD |
|
- | 901 | mov ax, RX_START |
|
- | 902 | out dx, ax |
|
- | 903 | call cmd_wait |
|
851 | 904 | ||
852 | ; And give packet to kernel |
905 | push ebx |
Line 853... | Line 906... | ||
853 | jmp [EthInput] |
906 | jmp .rx_loop |
Line 854... | Line 907... | ||
854 | 907 | ||
855 | .nodata: |
908 | .no_rx_: |
856 | DEBUGF 1, "no more data\n" |
909 | DEBUGF 1, "no more data\n" |
Line 857... | Line 910... | ||
857 | pop ax |
910 | pop ax |
858 | 911 | ||
Line 887... | Line 940... | ||
887 | jmp .loop_tx |
940 | jmp .loop_tx |
888 | .tx_done: |
941 | .tx_done: |
889 | pop eax |
942 | pop eax |
890 | .no_tx: |
943 | .no_tx: |
Line 891... | Line -... | ||
891 | - | ||
892 | and ax, 00111100b |
944 | |
893 | cmp ax, 00001000b |
945 | test ax, RU_STATUS_NO_RESOURCES |
Line 894... | Line 946... | ||
894 | jne .fail |
946 | jne .fail |
Line 895... | Line -... | ||
895 | - | ||
896 | DEBUGF 2, "Out of resources!\n" |
- | |
897 | - | ||
898 | ; call init_rx_ring |
- | |
899 | ; test eax, eax |
- | |
900 | ; jz .fail |
- | |
901 | - | ||
902 | ; restart RX |
- | |
903 | set_io [ebx + device.io_addr], 0 |
- | |
904 | set_io [ebx + device.io_addr], reg_scb_ptr |
- | |
905 | mov eax, [ebx + device.rx_desc] |
- | |
906 | invoke GetPhysAddr |
- | |
907 | add eax, NET_BUFF.data |
- | |
908 | out dx, eax |
- | |
909 | - | ||
910 | set_io [ebx + device.io_addr], reg_scb_cmd |
- | |
911 | mov ax, RX_START |
- | |
912 | out dx, ax |
947 | |
913 | call cmd_wait |
948 | DEBUGF 2, "Out of resources!\n" |
914 | 949 | ||
915 | .fail: |
950 | .fail: |
Line 940... | Line 975... | ||
940 | ee_read: ; esi = address to read |
975 | ee_read: ; esi = address to read |
Line 941... | Line 976... | ||
941 | 976 | ||
Line 942... | Line 977... | ||
942 | DEBUGF 1,"Eeprom read from 0x%x\n", esi |
977 | DEBUGF 1,"Eeprom read from 0x%x\n", esi |
943 | 978 | ||
Line 944... | Line 979... | ||
944 | set_io [ebx + device.io_addr], 0 |
979 | set_io [ebx + device.io_addr], 0 |
945 | set_io [ebx + device.io_addr], reg_eeprom |
980 | set_io [ebx + device.io_addr], REG_EEPROM |
946 | 981 | ||
Line 1018... | Line 1053... | ||
1018 | ee_write: ; esi = address to write to, di = data |
1053 | ee_write: ; esi = address to write to, di = data |
Line 1019... | Line 1054... | ||
1019 | 1054 | ||
Line 1020... | Line 1055... | ||
1020 | DEBUGF 1,"Eeprom write 0x%x to 0x%x\n", di, esi |
1055 | DEBUGF 1,"Eeprom write 0x%x to 0x%x\n", di, esi |
1021 | 1056 | ||
Line 1022... | Line 1057... | ||
1022 | set_io [ebx + device.io_addr], 0 |
1057 | set_io [ebx + device.io_addr], 0 |
1023 | set_io [ebx + device.io_addr], reg_eeprom |
1058 | set_io [ebx + device.io_addr], REG_EEPROM |
1024 | 1059 | ||
Line 1088... | Line 1123... | ||
1088 | 1123 | ||
1089 | align 4 |
1124 | align 4 |
Line 1090... | Line 1125... | ||
1090 | ee_get_width: |
1125 | ee_get_width: |
1091 | 1126 | ||
Line 1092... | Line 1127... | ||
1092 | set_io [ebx + device.io_addr], 0 |
1127 | set_io [ebx + device.io_addr], 0 |
1093 | set_io [ebx + device.io_addr], reg_eeprom |
1128 | set_io [ebx + device.io_addr], REG_EEPROM |
1094 | 1129 | ||
Line 1165... | Line 1200... | ||
1165 | mov eax, ecx |
1200 | mov eax, ecx |
1166 | or eax, edx |
1201 | or eax, edx |
1167 | or eax, 10b shl 26 ; read opcode |
1202 | or eax, 10b shl 26 ; read opcode |
Line 1168... | Line 1203... | ||
1168 | 1203 | ||
1169 | set_io [ebx + device.io_addr], 0 |
1204 | set_io [ebx + device.io_addr], 0 |
1170 | set_io [ebx + device.io_addr], reg_mdi_ctrl |
1205 | set_io [ebx + device.io_addr], REG_MDI_CTRL |
Line 1171... | Line 1206... | ||
1171 | out dx, eax |
1206 | out dx, eax |
1172 | 1207 | ||
1173 | .wait: |
1208 | .wait: |
Line 1197... | Line 1232... | ||
1197 | or eax, ecx |
1232 | or eax, ecx |
1198 | or eax, edx |
1233 | or eax, edx |
1199 | or eax, 01b shl 26 ; write opcode |
1234 | or eax, 01b shl 26 ; write opcode |
Line 1200... | Line 1235... | ||
1200 | 1235 | ||
1201 | set_io [ebx + device.io_addr], 0 |
1236 | set_io [ebx + device.io_addr], 0 |
1202 | set_io [ebx + device.io_addr], reg_mdi_ctrl |
1237 | set_io [ebx + device.io_addr], REG_MDI_CTRL |
Line 1203... | Line 1238... | ||
1203 | out dx, eax |
1238 | out dx, eax |
1204 | 1239 | ||
1205 | .wait: |
1240 | .wait: |