Subversion Repositories Kolibri OS

Rev

Rev 3347 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3347 Rev 3350
Line 275... Line 275...
275
        TXCTL_BPE               = 0x0080
275
        TXCTL_BPE               = 0x0080
Line 276... Line 276...
276
 
276
 
277
        TXCTL_MBO               = 0x0000F000
277
        TXCTL_MBO               = 0x0000F000
Line -... Line 278...
-
 
278
        TXCTL_BUFSZ             = 0x00000FFF
-
 
279
 
-
 
280
;
-
 
281
 
Line 278... Line 282...
278
        TXCTL_BUFSZ             = 0x00000FFF
282
        MAX_PHYS                = 32
Line 279... Line 283...
279
 
283
 
Line 317... Line 321...
317
        .io_addr        dd ?
321
        .io_addr        dd ?
318
        .irq_line       db ?
322
        .irq_line       db ?
319
        .pci_bus        dd ?
323
        .pci_bus        dd ?
320
        .pci_dev        dd ?
324
        .pci_dev        dd ?
Line -... Line 325...
-
 
325
 
-
 
326
        .phy            dw ?
321
 
327
 
322
        .read_csr       dd ?
328
        .read_csr       dd ?
323
        .write_csr      dd ?
329
        .write_csr      dd ?
324
        .read_bcr       dd ?
330
        .read_bcr       dd ?
325
        .write_bcr      dd ?
331
        .write_bcr      dd ?
Line 814... Line 820...
814
        shl     eax, 7
820
        shl     eax, 7
815
        mov     [device.mode_], ax
821
        mov     [device.mode_], ax
816
        mov     dword [device.filter], -1
822
        mov     dword [device.filter], -1
817
        mov     dword [device.filter+4], -1
823
        mov     dword [device.filter+4], -1
Line -... Line 824...
-
 
824
 
-
 
825
 
-
 
826
 
-
 
827
;-----------------------------
-
 
828
 
-
 
829
        test    [device.mii], 1
-
 
830
        jz      .no_mii
-
 
831
 
-
 
832
        mov     [device.phy], 0
-
 
833
 
-
 
834
  .mii_loop:
-
 
835
        mov     ecx, MII_PHYSID1
-
 
836
        call    mdio_read
-
 
837
        cmp     ax, 0xffff
-
 
838
        je      .next
-
 
839
 
-
 
840
        DEBUGF  1, "0x%x\n", ax
-
 
841
 
-
 
842
        mov     ecx, MII_PHYSID2
-
 
843
        call    mdio_read
-
 
844
        cmp     ax, 0xffff
-
 
845
        je      .next
-
 
846
 
-
 
847
        DEBUGF  1, "0x%x\n", ax
-
 
848
 
-
 
849
        jmp     .got_phy
-
 
850
 
-
 
851
        cmp     [device.phy], 31
-
 
852
        jne     .next
-
 
853
        mov     ax, [device.chip_version]
-
 
854
        inc     ax
-
 
855
        and     ax, 0xfffe
-
 
856
        cmp     ax, 0x2624              ; 79c971 & 79c972 have phantom phy at id 31
-
 
857
        je      .got_phy
-
 
858
 
-
 
859
  .next:
-
 
860
        inc     [device.phy]
-
 
861
        cmp     [device.phy], MAX_PHYS
-
 
862
        jb      .mii_loop
-
 
863
 
-
 
864
        DEBUGF  1, "No PHY found!\n"
-
 
865
 
-
 
866
        or      eax, -1
-
 
867
        ret
-
 
868
 
-
 
869
  .got_phy:
-
 
870
        DEBUGF  1, "Found PHY at 0x%x\n", [device.phy]:4
-
 
871
 
-
 
872
  .no_mii:
-
 
873
 
-
 
874
;-----------------------------------------------
818
 
875
 
Line 819... Line 876...
819
        call    read_mac
876
        call    read_mac
820
 
877
 
821
        lea     esi, [device.mac]
878
        lea     esi, [device.mac]
Line 873... Line 930...
873
        mov     [device.mtu], 1514
930
        mov     [device.mtu], 1514
Line 874... Line 931...
874
 
931
 
875
; get link status
932
; get link status
Line -... Line 933...
-
 
933
        mov     [device.state], ETH_LINK_UNKOWN
-
 
934
 
876
        mov     [device.state], ETH_LINK_UNKOWN
935
        call    check_media
877
 
936
 
878
        DEBUGF 1,"reset complete\n"
937
        DEBUGF 1,"reset complete\n"
Line 1412... Line 1471...
1412
        sub     edx, DWIO_RESET
1471
        sub     edx, DWIO_RESET
Line 1413... Line 1472...
1413
 
1472
 
Line -... Line 1473...
-
 
1473
        ret
-
 
1474
 
-
 
1475
 
-
 
1476
align 4
-
 
1477
mdio_read:
-
 
1478
 
-
 
1479
        and     ecx, 0x1f
-
 
1480
        mov     ax, [device.phy]
-
 
1481
        and     ax, 0x1f
-
 
1482
        shl     ax, 5
-
 
1483
        or      ax, cx
-
 
1484
 
-
 
1485
        mov     ecx, BCR_MIIADDR
-
 
1486
        call    [device.write_bcr]
-
 
1487
 
-
 
1488
        mov     ecx, BCR_MIIDATA
-
 
1489
        call    [device.read_bcr]
-
 
1490
 
-
 
1491
        ret
-
 
1492
 
-
 
1493
 
-
 
1494
align 4
-
 
1495
mdio_write:
-
 
1496
 
-
 
1497
        push    eax
-
 
1498
        and     ecx, 0x1f
-
 
1499
        mov     ax, [device.phy]
-
 
1500
        and     ax, 0x1f
-
 
1501
        shl     ax, 5
-
 
1502
        or      ax, cx
-
 
1503
 
-
 
1504
        mov     ecx, BCR_MIIADDR
-
 
1505
        call    [device.write_bcr]
-
 
1506
 
-
 
1507
        pop     eax
-
 
1508
        mov     ecx, BCR_MIIDATA
-
 
1509
        call    [device.write_bcr]
-
 
1510
 
-
 
1511
        ret
-
 
1512
 
-
 
1513
 
-
 
1514
align 4
-
 
1515
check_media:
-
 
1516
 
-
 
1517
        DEBUGF  1, "check_media\n"
-
 
1518
 
-
 
1519
        test    [device.mii], 1
-
 
1520
        jnz      mii_link_ok
-
 
1521
 
-
 
1522
        mov     ecx, BCR_LED0
-
 
1523
        call    [device.read_bcr]
-
 
1524
        cmp     eax, 0xc0
-
 
1525
 
-
 
1526
        DEBUGF  1, "link status=0x%x\n", eax
-
 
1527
 
Line 1414... Line 1528...
1414
        ret
1528
        ret
Line 1415... Line 1529...
1415
 
1529