Rev 869 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 869 | Rev 907 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | ;; ;; |
24 | ;; ;; |
25 | ;; See file COPYING for details ;; |
25 | ;; See file COPYING for details ;; |
26 | ;; ;; |
26 | ;; ;; |
27 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
27 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 28... | Line 28... | ||
28 | 28 | ||
Line 29... | Line 29... | ||
29 | $Revision: 869 $ |
29 | $Revision: 907 $ |
30 | 30 | ||
31 | 31 | ||
Line 522... | Line 522... | ||
522 | 522 | ||
523 | ; Set device to be a busmaster in case BIOS neglected to do so. |
523 | ; Set device to be a busmaster in case BIOS neglected to do so. |
524 | ; Also adjust PCI latency timer to a reasonable value, 32. |
524 | ; Also adjust PCI latency timer to a reasonable value, 32. |
Line 525... | Line 525... | ||
525 | proc adjust_pci_device |
525 | proc adjust_pci_device |
Line 526... | Line 526... | ||
526 | 526 | ||
527 | DEBUGF 1,"K : adjust_pci_device\n" |
527 | ; DEBUGF 1,"K : adjust_pci_device\n" |
528 | 528 | ||
529 | stdcall pci_read_config_word,PCI_COMMAND |
529 | stdcall pci_read_config_word,PCI_COMMAND |
530 | mov bx,ax |
530 | mov bx,ax |
531 | or bx,PCI_COMMAND_MASTER or PCI_COMMAND_IO |
531 | or bx,PCI_COMMAND_MASTER or PCI_COMMAND_IO |
532 | cmp ax,bx |
532 | cmp ax,bx |
533 | je @f |
533 | je @f |
534 | DEBUGF 1,"K : adjust_pci_device: The PCI BIOS has not enabled this device!\nK : Updating PCI command %x->%x. pci_bus %x pci_device_fn %x\n",ax,bx,[pci_bus]:2,[pci_dev]:2 |
534 | ; DEBUGF 1,"K : adjust_pci_device: The PCI BIOS has not enabled this device!\nK : Updating PCI command %x->%x. pci_bus %x pci_device_fn %x\n",ax,bx,[pci_bus]:2,[pci_dev]:2 |
535 | stdcall pci_write_config_word,PCI_COMMAND,ebx |
535 | stdcall pci_write_config_word,PCI_COMMAND,ebx |
536 | @@: |
536 | @@: |
537 | stdcall pci_read_config_byte,PCI_LATENCY_TIMER |
537 | stdcall pci_read_config_byte,PCI_LATENCY_TIMER |
538 | cmp al,32 |
538 | cmp al,32 |
539 | jae @f |
539 | jae @f |
540 | DEBUGF 1,"K : adjust_pci_device: PCI latency timer (CFLT) is unreasonably low at %d.\nK : Setting to 32 clocks.\n",al |
540 | ; DEBUGF 1,"K : adjust_pci_device: PCI latency timer (CFLT) is unreasonably low at %d.\nK : Setting to 32 clocks.\n",al |
541 | stdcall pci_write_config_byte,PCI_LATENCY_TIMER,32 |
541 | stdcall pci_write_config_byte,PCI_LATENCY_TIMER,32 |
Line 557... | Line 557... | ||
557 | mov eax,[index] |
557 | mov eax,[index] |
558 | add eax,4 |
558 | add eax,4 |
559 | stdcall pci_read_config_dword,eax |
559 | stdcall pci_read_config_dword,eax |
560 | or eax,eax |
560 | or eax,eax |
561 | jz .not64 |
561 | jz .not64 |
562 | DEBUGF 1,"K : pci_bar_start: Unhandled 64bit BAR\n" |
562 | ; DEBUGF 1,"K : pci_bar_start: Unhandled 64bit BAR\n" |
563 | add esp,4 |
563 | add esp,4 |
564 | or eax,-1 |
564 | or eax,-1 |
565 | ret |
565 | ret |
566 | .not64: |
566 | .not64: |
567 | pop eax |
567 | pop eax |
Line 570... | Line 570... | ||
570 | ret |
570 | ret |
571 | endp |
571 | endp |
Line 572... | Line 572... | ||
572 | 572 | ||
Line 573... | Line 573... | ||
573 | proc rtl8169_init_board |
573 | proc rtl8169_init_board |
Line 574... | Line 574... | ||
574 | 574 | ||
Line 575... | Line 575... | ||
575 | DEBUGF 1,"K : rtl8169_init_board\n" |
575 | ; DEBUGF 1,"K : rtl8169_init_board\n" |
576 | 576 | ||
Line 590... | Line 590... | ||
590 | loop @b |
590 | loop @b |
591 | @@: |
591 | @@: |
592 | ; identify config method |
592 | ; identify config method |
593 | RTL_R32 RTL8169_REG_TxConfig |
593 | RTL_R32 RTL8169_REG_TxConfig |
594 | and eax,0x7c800000 |
594 | and eax,0x7c800000 |
595 | DEBUGF 1,"K : rtl8169_init_board: TxConfig & 0x7c800000 = 0x%x\n",eax |
595 | ; DEBUGF 1,"K : rtl8169_init_board: TxConfig & 0x7c800000 = 0x%x\n",eax |
596 | mov esi,mac_info-8 |
596 | mov esi,mac_info-8 |
597 | @@: add esi,8 |
597 | @@: add esi,8 |
598 | mov ecx,eax |
598 | mov ecx,eax |
599 | and ecx,[esi] |
599 | and ecx,[esi] |
600 | cmp ecx,[esi] |
600 | cmp ecx,[esi] |
Line 623... | Line 623... | ||
623 | jne @b |
623 | jne @b |
624 | mov [rtl8169_tpc.chipset],ecx |
624 | mov [rtl8169_tpc.chipset],ecx |
625 | jmp .match |
625 | jmp .match |
626 | @@: |
626 | @@: |
627 | ; if unknown chip, assume array element #0, original RTL-8169 in this case |
627 | ; if unknown chip, assume array element #0, original RTL-8169 in this case |
628 | DEBUGF 1,"K : rtl8169_init_board: PCI device: unknown chip version, assuming RTL-8169\n" |
628 | ; DEBUGF 1,"K : rtl8169_init_board: PCI device: unknown chip version, assuming RTL-8169\n" |
629 | RTL_R32 RTL8169_REG_TxConfig |
629 | RTL_R32 RTL8169_REG_TxConfig |
630 | DEBUGF 1,"K : rtl8169_init_board: PCI device: TxConfig = 0x%x\n",eax |
630 | ; DEBUGF 1,"K : rtl8169_init_board: PCI device: TxConfig = 0x%x\n",eax |
Line 631... | Line 631... | ||
631 | 631 | ||
Line 632... | Line 632... | ||
632 | mov [rtl8169_tpc.chipset],0 |
632 | mov [rtl8169_tpc.chipset],0 |
633 | 633 | ||
Line 640... | Line 640... | ||
640 | ret |
640 | ret |
641 | endp |
641 | endp |
Line 642... | Line 642... | ||
642 | 642 | ||
Line 643... | Line 643... | ||
643 | proc rtl8169_hw_PHY_config |
643 | proc rtl8169_hw_PHY_config |
Line 644... | Line 644... | ||
644 | 644 | ||
Line 645... | Line 645... | ||
645 | DEBUGF 1,"K : rtl8169_hw_PHY_config: priv.mcfg=%d, priv.pcfg=%d\n",[rtl8169_tpc.mcfg],[rtl8169_tpc.pcfg] |
645 | ; DEBUGF 1,"K : rtl8169_hw_PHY_config: priv.mcfg=%d, priv.pcfg=%d\n",[rtl8169_tpc.mcfg],[rtl8169_tpc.pcfg] |
646 | 646 | ||
Line 703... | Line 703... | ||
703 | stdcall RTL8169_WRITE_GMII_REG,0x1F,0x0000 |
703 | stdcall RTL8169_WRITE_GMII_REG,0x1F,0x0000 |
704 | stdcall RTL8169_WRITE_GMII_REG,0x0B,0x0000 |
704 | stdcall RTL8169_WRITE_GMII_REG,0x0B,0x0000 |
705 | jmp .exit |
705 | jmp .exit |
706 | .not_2_or_3: |
706 | .not_2_or_3: |
707 | ; DBG_PRINT("tpc->mcfg=%d. Discard hw PHY config.\n", tpc->mcfg); |
707 | ; DBG_PRINT("tpc->mcfg=%d. Discard hw PHY config.\n", tpc->mcfg); |
708 | DEBUGF 1,"K : tpc.mcfg=%d, discard hw PHY config\n",[rtl8169_tpc.mcfg] |
708 | ; DEBUGF 1,"K : tpc.mcfg=%d, discard hw PHY config\n",[rtl8169_tpc.mcfg] |
709 | .exit: |
709 | .exit: |
710 | ret |
710 | ret |
711 | endp |
711 | endp |
Line 712... | Line 712... | ||
712 | 712 | ||
Line 765... | Line 765... | ||
765 | ret |
765 | ret |
766 | endp |
766 | endp |
Line 767... | Line 767... | ||
767 | 767 | ||
Line 768... | Line 768... | ||
768 | proc rtl8169_set_rx_mode |
768 | proc rtl8169_set_rx_mode |
Line 769... | Line 769... | ||
769 | 769 | ||
770 | DEBUGF 1,"K : rtl8169_set_rx_mode\n" |
770 | ; DEBUGF 1,"K : rtl8169_set_rx_mode\n" |
771 | 771 | ||
772 | ; IFF_ALLMULTI |
772 | ; IFF_ALLMULTI |
Line 783... | Line 783... | ||
783 | ret |
783 | ret |
784 | endp |
784 | endp |
Line 785... | Line 785... | ||
785 | 785 | ||
Line 786... | Line 786... | ||
786 | proc rtl8169_init_ring |
786 | proc rtl8169_init_ring |
Line 787... | Line 787... | ||
787 | 787 | ||
788 | DEBUGF 1,"K : rtl8169_init_ring\n" |
788 | ; DEBUGF 1,"K : rtl8169_init_ring\n" |
789 | 789 | ||
Line 832... | Line 832... | ||
832 | ret |
832 | ret |
833 | endp |
833 | endp |
Line 834... | Line 834... | ||
834 | 834 | ||
Line 835... | Line 835... | ||
835 | proc rtl8169_hw_start |
835 | proc rtl8169_hw_start |
Line 836... | Line 836... | ||
836 | 836 | ||
837 | DEBUGF 1,"K : rtl8169_hw_start\n" |
837 | ; DEBUGF 1,"K : rtl8169_hw_start\n" |
838 | 838 | ||
839 | ; Soft reset the chip |
839 | ; Soft reset the chip |
Line 918... | Line 918... | ||
918 | ; eax, ebx, ecx, edx |
918 | ; eax, ebx, ecx, edx |
919 | ; |
919 | ; |
920 | ;*************************************************************************** |
920 | ;*************************************************************************** |
921 | proc rtl8169_probe |
921 | proc rtl8169_probe |
Line 922... | Line 922... | ||
922 | 922 | ||
Line 923... | Line 923... | ||
923 | DEBUGF 1,"K : rtl8169_probe: 0x%x : 0x%x 0x%x\n",[io_addr]:8,[pci_bus]:2,[pci_dev]:2 |
923 | ; DEBUGF 1,"K : rtl8169_probe: 0x%x : 0x%x 0x%x\n",[io_addr]:8,[pci_bus]:2,[pci_dev]:2 |
Line 924... | Line 924... | ||
924 | 924 | ||
925 | call rtl8169_init_board |
925 | call rtl8169_init_board |
Line 933... | Line 933... | ||
933 | mov [node_addr+ebx],al |
933 | mov [node_addr+ebx],al |
934 | inc edx |
934 | inc edx |
935 | inc ebx |
935 | inc ebx |
936 | loop @b |
936 | loop @b |
Line 937... | Line 937... | ||
937 | 937 | ||
Line 938... | Line 938... | ||
938 | DEBUGF 1,"K : rtl8169_probe: MAC = %x-%x-%x-%x-%x-%x\n",[node_addr+0]:2,[node_addr+1]:2,[node_addr+2]:2,[node_addr+3]:2,[node_addr+4]:2,[node_addr+5]:2 |
938 | ; DEBUGF 1,"K : rtl8169_probe: MAC = %x-%x-%x-%x-%x-%x\n",[node_addr+0]:2,[node_addr+1]:2,[node_addr+2]:2,[node_addr+3]:2,[node_addr+4]:2,[node_addr+5]:2 |
939 | 939 | ||
940 | ; Config PHY |
940 | ; Config PHY |
941 | stdcall rtl8169_hw_PHY_config |
941 | stdcall rtl8169_hw_PHY_config |
Line 993... | Line 993... | ||
993 | ; eax, ebx, ecx, edx |
993 | ; eax, ebx, ecx, edx |
994 | ; |
994 | ; |
995 | ;*************************************************************************** |
995 | ;*************************************************************************** |
996 | proc rtl8169_reset |
996 | proc rtl8169_reset |
Line 997... | Line 997... | ||
997 | 997 | ||
Line 998... | Line 998... | ||
998 | DEBUGF 1,"K : rtl8169_reset: 0x%x : 0x%x 0x%x\n",[io_addr]:8,[pci_bus]:2,[pci_dev]:2 |
998 | ; DEBUGF 1,"K : rtl8169_reset: 0x%x : 0x%x 0x%x\n",[io_addr]:8,[pci_bus]:2,[pci_dev]:2 |
999 | 999 | ||
1000 | mov [rtl8169_tpc.TxDescArrays],rtl8169_tx_ring |
1000 | mov [rtl8169_tpc.TxDescArrays],rtl8169_tx_ring |
Line 1038... | Line 1038... | ||
1038 | ; eax, edx, esi, edi |
1038 | ; eax, edx, esi, edi |
1039 | ; |
1039 | ; |
1040 | ;*************************************************************************** |
1040 | ;*************************************************************************** |
1041 | proc rtl8169_transmit |
1041 | proc rtl8169_transmit |
Line 1042... | Line 1042... | ||
1042 | 1042 | ||
Line 1043... | Line 1043... | ||
1043 | DEBUGF 1,"K : rtl8169_transmit\n" ;: 0x%x : 0x%x 0x%x 0x%x 0x%x\n",[io_addr]:8,edi,bx,ecx,esi |
1043 | ; DEBUGF 1,"K : rtl8169_transmit\n" ;: 0x%x : 0x%x 0x%x 0x%x 0x%x\n",[io_addr]:8,edi,bx,ecx,esi |
1044 | 1044 | ||
1045 | push ecx edx esi |
1045 | push ecx edx esi |
1046 | mov eax,MAX_ETH_FRAME_SIZE |
1046 | mov eax,MAX_ETH_FRAME_SIZE |
Line 1116... | Line 1116... | ||
1116 | mov ecx,TX_TIMEOUT / 10 |
1116 | mov ecx,TX_TIMEOUT / 10 |
1117 | @@: test [ebx + rtl8169_TxDesc.status],RTL8169_DSB_OWNbit |
1117 | @@: test [ebx + rtl8169_TxDesc.status],RTL8169_DSB_OWNbit |
1118 | jnz @f |
1118 | jnz @f |
1119 | stdcall udelay,10 |
1119 | stdcall udelay,10 |
1120 | loop @b |
1120 | loop @b |
1121 | DEBUGF 1,"K : rtl8169_transmit: TX Time Out\n" |
1121 | ; DEBUGF 1,"K : rtl8169_transmit: TX Time Out\n" |
1122 | @@: |
1122 | @@: |
Line 1123... | Line 1123... | ||
1123 | 1123 | ||
1124 | ret |
1124 | ret |
Line 1174... | Line 1174... | ||
1174 | and eax,0x00001FFF |
1174 | and eax,0x00001FFF |
1175 | ; jz .exit.pop |
1175 | ; jz .exit.pop |
1176 | add eax,-4 |
1176 | add eax,-4 |
1177 | mov [eth_rx_data_len],ax |
1177 | mov [eth_rx_data_len],ax |
Line 1178... | Line 1178... | ||
1178 | 1178 | ||
Line 1179... | Line 1179... | ||
1179 | DEBUGF 1,"K : rtl8169_poll: data length = %u\n",ax |
1179 | ; DEBUGF 1,"K : rtl8169_poll: data length = %u\n",ax |
1180 | 1180 | ||
1181 | push eax |
1181 | push eax |
1182 | mov ecx,eax |
1182 | mov ecx,eax |
Line 1199... | Line 1199... | ||
1199 | 1199 | ||
1200 | mov [ebx + rtl8169_RxDesc.buf_addr],edx |
1200 | mov [ebx + rtl8169_RxDesc.buf_addr],edx |
1201 | sub [ebx + rtl8169_RxDesc.buf_addr],OS_BASE ; shurf 28.09.2008 |
1201 | sub [ebx + rtl8169_RxDesc.buf_addr],OS_BASE ; shurf 28.09.2008 |
1202 | jmp @f |
1202 | jmp @f |
1203 | .else: |
1203 | .else: |
1204 | DEBUGF 1,"K : rtl8169_poll: Rx Error\n" |
1204 | ; DEBUGF 1,"K : rtl8169_poll: Rx Error\n" |
1205 | ; FIXME: shouldn't I reset the status on an error |
1205 | ; FIXME: shouldn't I reset the status on an error |
1206 | @@: |
1206 | @@: |
1207 | inc [rtl8169_tpc.cur_rx] |
1207 | inc [rtl8169_tpc.cur_rx] |
1208 | and [rtl8169_tpc.cur_rx],NUM_RX_DESC - 1 |
1208 | and [rtl8169_tpc.cur_rx],NUM_RX_DESC - 1 |