Subversion Repositories Kolibri OS

Rev

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

Rev 3155 Rev 3205
Line 340... Line 340...
340
        .upd_buffer       rd (upd.size*NUM_RX_DESC)/4
340
        .upd_buffer       rd (upd.size*NUM_RX_DESC)/4
341
        .curr_upd         dd ?
341
        .curr_upd         dd ?
342
        .prev_dpd         dd ?
342
        .prev_dpd         dd ?
Line 343... Line 343...
343
 
343
 
344
        .io_addr          dd ?
344
        .io_addr          dd ?
345
        .pci_bus          db ?
345
        .pci_bus          dd ?
346
        .pci_dev          db ?
346
        .pci_dev          dd ?
-
 
347
        .irq_line         db ?
Line 347... Line 348...
347
        .irq_line         db ?
348
		rb 3	; alignment
348
 
349
 
349
        .prev_tx_frame            dd ?
350
        .prev_tx_frame            dd ?
350
        .ver_id                   db ?
351
        .ver_id                   db ?
Line 436... Line 437...
436
        mov     esi, VORTEX_LIST
437
        mov     esi, VORTEX_LIST
437
        mov     eax, [IOCTL.input]                      ; get the pci bus and device numbers
438
        mov     eax, [IOCTL.input]                      ; get the pci bus and device numbers
438
        mov     ax , [eax+1]                            ;
439
        mov     ax , [eax+1]                            ;
439
  .nextdevice:
440
  .nextdevice:
440
        mov     ebx, [esi]
441
        mov     ebx, [esi]
441
        cmp     ax , word [device.pci_bus]              ; compare with pci and device num in device list (notice the usage of word instead of byte)
442
        cmp     al, byte[device.pci_bus]
-
 
443
        jne     @f
-
 
444
        cmp     ah, byte[device.pci_dev]
442
        je      .find_devicenum                         ; Device is already loaded, let's find it's device number
445
        je      .find_devicenum                         ; Device is already loaded, let's find it's device number
-
 
446
       @@:
443
        add     esi, 4
447
        add     esi, 4
444
        loop    .nextdevice
448
        loop    .nextdevice
Line 445... Line 449...
445
 
449
 
Line 452... Line 456...
452
        mov     esi, BOOMERANG_LIST
456
        mov     esi, BOOMERANG_LIST
453
        mov     eax, [IOCTL.input]                      ; get the pci bus and device numbers
457
        mov     eax, [IOCTL.input]                      ; get the pci bus and device numbers
454
        mov     ax , [eax+1]                            ;
458
        mov     ax , [eax+1]                            ;
455
  .nextdevice2:
459
  .nextdevice2:
456
        mov     ebx, [esi]
460
        mov     ebx, [esi]
457
        cmp     ax , word [device.pci_bus]              ; compare with pci and device num in device list (notice the usage of word instead of byte)
461
        cmp     al, byte[device.pci_bus]
-
 
462
        jne     @f
-
 
463
        cmp     ah, byte[device.pci_dev]
458
        je      .find_devicenum                         ; Device is already loaded, let's find it's device number
464
        je      .find_devicenum                         ; Device is already loaded, let's find it's device number
-
 
465
       @@:
459
        add     esi, 4
466
        add     esi, 4
460
        loop    .nextdevice2
467
        loop    .nextdevice2
Line 461... Line 468...
461
 
468
 
Line 479... Line 486...
479
        mov     [device.name], my_service
486
        mov     [device.name], my_service
Line 480... Line 487...
480
 
487
 
Line 481... Line 488...
481
; save the pci bus and device numbers
488
; save the pci bus and device numbers
482
 
489
 
483
        mov     eax, [IOCTL.input]
490
        mov     eax, [IOCTL.input]
484
        mov     cl , [eax+1]
491
        movzx   ecx, byte[eax+1]
485
        mov     [device.pci_bus], cl
492
        mov     [device.pci_bus], ecx
Line 486... Line 493...
486
        mov     cl , [eax+2]
493
        movzx   ecx, byte[eax+2]
487
        mov     [device.pci_dev], cl
494
        mov     [device.pci_dev], ecx
Line 488... Line 495...
488
 
495
 
489
; Now, it's time to find the base io addres of the PCI device
496
; Now, it's time to find the base io addres of the PCI device
Line 490... Line 497...
490
        find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
497
        PCI_find_io
491
 
498
 
Line 492... Line 499...
492
; We've found the io address, find IRQ now
499
; We've found the io address, find IRQ now
Line 576... Line 583...
576
align 4
583
align 4
577
probe:
584
probe:
Line 578... Line 585...
578
 
585
 
Line 579... Line 586...
579
        DEBUGF  1,"Probing 3com card\n"
586
        DEBUGF  1,"Probing 3com card\n"
Line 580... Line 587...
580
 
587
 
581
        make_bus_master [device.pci_bus], [device.pci_dev]
588
        PCI_make_bus_master
Line 582... Line -...
582
 
-
 
583
; wake up the card
-
 
584
        call    wake_up
589
 
Line 585... Line 590...
585
 
590
; wake up the card
Line 586... Line 591...
586
        movzx   ecx, [device.pci_bus]
591
        call    wake_up
587
        movzx   edx, [device.pci_dev]
592
 
Line 616... Line 621...
616
; set pci latency for vortex cards
621
; set pci latency for vortex cards
617
        test    word [hw_versions+2+ecx*4], IS_VORTEX
622
        test    word [hw_versions+2+ecx*4], IS_VORTEX
618
        jz      .not_vortex
623
        jz      .not_vortex
Line 619... Line 624...
619
 
624
 
620
        mov     eax, 11111000b ; 248 = max latency
-
 
621
        movzx   ecx, [device.pci_bus]
-
 
622
        movzx   edx, [device.pci_dev]
625
        mov     eax, 11111000b ; 248 = max latency
Line 623... Line 626...
623
        stdcall PciWrite32, ecx, edx, PCI_REG_LATENCY, eax
626
        stdcall PciWrite32, [device.pci_bus], [device.pci_dev], PCI_REG_LATENCY, eax
624
 
627
 
625
  .not_vortex:
628
  .not_vortex:
626
; set RX/TX functions
629
; set RX/TX functions
Line 1801... Line 1804...
1801
 
1804
 
Line 1802... Line 1805...
1802
        DEBUGF 1,"Waking up NIC: "
1805
        DEBUGF 1,"Waking up NIC: "
1803
 
1806
 
1804
; wake up - we directly do it by programming PCI
-
 
1805
; check if the device is power management capable
-
 
1806
        movzx   ecx, [device.pci_bus]
1807
; wake up - we directly do it by programming PCI
Line 1807... Line 1808...
1807
        movzx   edx, [device.pci_dev]
1808
; check if the device is power management capable
1808
        stdcall PciRead32, ecx, edx, PCI_REG_STATUS
1809
        stdcall PciRead32, [device.pci_bus], [device.pci_dev], PCI_REG_STATUS
Line 1809... Line 1810...
1809
 
1810
 
1810
        test    al, 10000b      ; is there "new capabilities" linked list?
1811
        test    al, 10000b      ; is there "new capabilities" linked list?
1811
        jz      .device_awake
1812
        jz      .device_awake
1812
 
1813
 
Line 1813... Line 1814...
1813
; search for power management register
1814
; search for power management register
1814
        stdcall PciRead16, ecx, edx, PCI_REG_CAP_PTR
1815
        stdcall PciRead16, [device.pci_bus], [device.pci_dev], PCI_REG_CAP_PTR
1815
        cmp     al, 0x3f
1816
        cmp     al, 0x3f
1816
        jbe     .device_awake
1817
        jbe     .device_awake
Line 1817... Line 1818...
1817
 
1818
 
1818
; traverse the list
1819
; traverse the list
Line 1819... Line 1820...
1819
        movzx   esi, al
1820
        movzx   esi, al
Line 1831... Line 1832...
1831
 
1832
 
1832
; waku up the device if necessary
1833
; waku up the device if necessary
Line 1833... Line 1834...
1833
  .set_pm_state:
1834
  .set_pm_state:
1834
 
1835
 
1835
        add     esi, PCI_REG_PM_CTRL
1836
        add     esi, PCI_REG_PM_CTRL
1836
        stdcall PciRead32, ecx, edx, esi
1837
        stdcall PciRead32, [device.pci_bus], [device.pci_dev], esi
1837
        test    al, 3
1838
        test    al, 3
1838
        jz      .device_awake
1839
        jz      .device_awake
Line 1839... Line 1840...
1839
        and     al, not 11b ; set state to D0
1840
        and     al, not 11b ; set state to D0
1840
        stdcall PciWrite32, ecx, edx, esi, eax
1841
        stdcall PciWrite32, [device.pci_bus], [device.pci_dev], esi, eax
Line 1841... Line 1842...
1841
 
1842