Bugfix in SIS900 init, added some debug output, Bugfix in set_rxd, some refactoring

git-svn-id: svn://kolibrios.org@2909 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2012-08-07 09:59:58 +00:00
parent 0b4a7112cd
commit c9bbdd57de

View File

@ -25,6 +25,12 @@
format MS COFF format MS COFF
NUM_RX_DESC = 4 ;* Number of RX descriptors *
NUM_TX_DESC = 1 ;* Number of TX descriptors *
RX_BUFF_SZ = 1520 ;* Buffer size for each Rx buffer *
TX_BUFF_SZ = 1516 ;* Buffer size for each Tx buffer *
MAX_ETH_FRAME_SIZE = 1516
API_VERSION = 0x01000100 API_VERSION = 0x01000100
DRIVER_VERSION = 5 DRIVER_VERSION = 5
@ -42,12 +48,6 @@ include 'netdrv.inc'
public START public START
public version public version
NUM_RX_DESC = 4 ;* Number of RX descriptors *
NUM_TX_DESC = 1 ;* Number of TX descriptors *
RX_BUFF_SZ = 1520 ;* Buffer size for each Rx buffer *
TX_BUFF_SZ = 1516 ;* Buffer size for each Tx buffer *
MAX_ETH_FRAME_SIZE = 1516
virtual at ebx virtual at ebx
device: device:
@ -222,7 +222,6 @@ service_proc:
.err: .err:
stdcall KernelFree, ebx stdcall KernelFree, ebx
.fail: .fail:
xor eax, eax xor eax, eax
ret 4 ret 4
@ -422,6 +421,7 @@ ret
;*************************************************************************** ;***************************************************************************
align 4 align 4
probe: probe:
DEBUGF 1, "Probe\n"
movzx eax, [device.pci_bus] movzx eax, [device.pci_bus]
movzx edx, [device.pci_dev] movzx edx, [device.pci_dev]
@ -490,8 +490,10 @@ probe:
;*************************************************************************** ;***************************************************************************
align 4 align 4
init: init:
DEBUGF 1, "Init\n"
call reset call reset
jnz .ret
call init_rxfilter call init_rxfilter
call init_txd call init_txd
call init_rxd call init_rxd
@ -515,6 +517,7 @@ init:
mov [device.mtu], 1514 mov [device.mtu], 1514
.ret:
ret ret
;*************************************************************************** ;***************************************************************************
@ -526,6 +529,8 @@ init:
;*************************************************************************** ;***************************************************************************
align 4 align 4
reset: reset:
DEBUGF 1, "reset\n"
movzx eax, [device.irq_line] movzx eax, [device.irq_line]
stdcall AttachIntHandler, eax, int_handler, 0 stdcall AttachIntHandler, eax, int_handler, 0
@ -560,8 +565,8 @@ reset:
dec ecx dec ecx
jz .error jz .error
in eax, dx ; move interrup status to eax in eax, dx ; move interrup status to eax
cmp eax, 0x03000000 test eax, 0x03000000 ; CHECKME
jne .loop jz .loop
;------------------------------------------------------ ;------------------------------------------------------
; Set Configuration Register depending on Card Revision ; Set Configuration Register depending on Card Revision
@ -598,6 +603,7 @@ reset:
;*************************************************************************** ;***************************************************************************
align 4 align 4
init_rxfilter: init_rxfilter:
DEBUGF 1, "Init RxFilter\n"
;------------------------------------ ;------------------------------------
; Get Receive Filter Control Register ; Get Receive Filter Control Register
@ -649,6 +655,7 @@ RXINT_Mac_Write: ; high word of eax tells card which mac byte to write
;*************************************************************************** ;***************************************************************************
align 4 align 4
init_txd: init_txd:
DEBUGF 1, "Init TxD\n"
;------------------------- ;-------------------------
; initialize TX descriptor ; initialize TX descriptor
@ -677,25 +684,29 @@ init_txd:
;*************************************************************************** ;***************************************************************************
align 4 align 4
init_rxd: init_rxd:
DEBUGF 1, "Init RxD\n"
; init RX descriptors ; init RX descriptors
mov ecx, NUM_RX_DESC mov ecx, NUM_RX_DESC
lea esi, [device.rxd] lea esi, [device.rxd]
.loop: .loop:
lea eax, [esi + 16] lea eax, [esi + 16] ; next ptr
GetRealAddr GetRealAddr
mov dword [esi+0], eax mov dword [esi], eax
mov dword [esi+4], RX_BUFF_SZ mov dword [esi + 4], RX_BUFF_SZ ; size
push ecx
stdcall KernelAlloc, RX_BUFF_SZ stdcall KernelAlloc, RX_BUFF_SZ
pop ecx
test eax, eax test eax, eax
jz .fail jz .fail
mov dword [esi+12], eax mov dword [esi + 12], eax ; address
GetRealAddr GetRealAddr
mov dword [esi+8], eax mov dword [esi + 8], eax ; real address
add esi, 16 add esi, 16
loop .loop dec ecx
jnz .loop
lea eax, [device.rxd] lea eax, [device.rxd]
GetRealAddr GetRealAddr
@ -734,6 +745,7 @@ init_rxd:
;*************************************************************************** ;***************************************************************************
align 4 align 4
set_tx_mode: set_tx_mode:
DEBUGF 1, "set TX mode\n"
set_io 0 set_io 0
set_io cr set_io cr
@ -776,6 +788,7 @@ set_tx_mode:
;*************************************************************************** ;***************************************************************************
align 4 align 4
set_rx_mode: set_rx_mode:
DEBUGF 1, "set RX mode\n"
;---------------------------------------------- ;----------------------------------------------
; update Multicast Hash Table in Receive Filter ; update Multicast Hash Table in Receive Filter
@ -846,6 +859,7 @@ set_rx_mode:
;*************************************************************************** ;***************************************************************************
align 4 align 4
SIS960_get_mac_addr: SIS960_get_mac_addr:
DEBUGF 1, "SIS960 - get mac: "
;------------------------------- ;-------------------------------
; Send Request for eeprom access ; Send Request for eeprom access
@ -919,6 +933,7 @@ SIS960_get_mac_addr:
;*************************************************************************** ;***************************************************************************
align 4 align 4
SIS900_get_mac_addr: SIS900_get_mac_addr:
DEBUGF 1, "SIS900 - get mac: "
;------------------------------------ ;------------------------------------
; check to see if we have sane EEPROM ; check to see if we have sane EEPROM
@ -967,6 +982,8 @@ SIS900_get_mac_addr:
align 4 align 4
Get_Mac_SIS635_900_REV: Get_Mac_SIS635_900_REV:
DEBUGF 1, "SIS635 - get mac: "
set_io 0 set_io 0
set_io rfcr set_io rfcr
in eax, dx in eax, dx
@ -1012,6 +1029,8 @@ Get_Mac_SIS635_900_REV:
; or eax, RFEN ; or eax, RFEN
; out dx, eax ; out dx, eax
DEBUGF 2,"%x-%x-%x-%x-%x-%x\n",[device.mac]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
xor eax, eax xor eax, eax
ret ret
@ -1122,6 +1141,8 @@ write_mac:
;*************************************************************************** ;***************************************************************************
align 4 align 4
int_handler: int_handler:
DEBUGF 1, "Int!\n"
; find pointer of device which made IRQ occur ; find pointer of device which made IRQ occur
mov esi, device_list mov esi, device_list
mov ecx, [devices] mov ecx, [devices]