ALL ethernet drivers: return success/failed for transmit function, dump packet when failing.

git-svn-id: svn://kolibrios.org@4334 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2013-12-08 14:34:08 +00:00
parent 2e246fedfa
commit 72c96117d0
10 changed files with 31 additions and 22 deletions

View File

@ -2228,7 +2228,7 @@ vortex_transmit:
set_io REG_MASTER_STATUS set_io REG_MASTER_STATUS
in ax, dx in ax, dx
test ah, 0x80 test ah, 0x80
jnz .finish ; no DMA for sending jnz .fail ; no DMA for sending
; program frame address to be sent ; program frame address to be sent
set_io REG_MASTER_ADDRESS set_io REG_MASTER_ADDRESS
mov eax, [esp+4] mov eax, [esp+4]
@ -2244,11 +2244,13 @@ vortex_transmit:
mov ax, (10100b shl 11) + 1 ; StartDMADown mov ax, (10100b shl 11) + 1 ; StartDMADown
out dx, ax out dx, ax
.finish: .finish:
call KernelFree xor eax, eax
add esp, 4 ret 8
ret
.fail:
stdcall KernelFree, [esp+4]
or eax, -1
ret 8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;

View File

@ -823,6 +823,8 @@ transmit:
dec eax dec eax
.fail: .fail:
DEBUGF 1,"Send failed\n" DEBUGF 1,"Send failed\n"
stdcall KernelFree, [esp+4]
or eax, -1
ret 8 ret 8

View File

@ -729,9 +729,8 @@ transmit:
.err: .err:
DEBUGF 2, "Transmit error!\n" DEBUGF 2, "Transmit error!\n"
or eax, -1
stdcall KernelFree, [esp+4] stdcall KernelFree, [esp+4]
or eax, -1
ret 8 ret 8

View File

@ -633,23 +633,23 @@ probe:
call read_mac call read_mac
call PHY_config call PHY_config
; DEBUGF 1,"K : Set MAC Reg C+CR Offset 0x82h = 0x01h\n" DEBUGF 1,"Set MAC Reg C+CR Offset 0x82h = 0x01h\n"
set_io 0 set_io 0
set_io 0x82 set_io 0x82
mov al, 0x01 mov al, 0x01
out dx, al out dx, al
cmp [tpc.mcfg], MCFG_METHOD_03 cmp [tpc.mcfg], MCFG_METHOD_03
jae @f jae @f
; DEBUGF 1,"K : Set PCI Latency=0x40\n" DEBUGF 1,"Set PCI Latency=0x40\n"
; stdcall pci_write_config_byte,PCI_LATENCY_TIMER,0x40 PCI_adjust_latency 0x40
@@: @@:
cmp [tpc.mcfg], MCFG_METHOD_02 cmp [tpc.mcfg], MCFG_METHOD_02
jne @f jne @f
; DEBUGF 1,"K : Set MAC Reg C+CR Offset 0x82h = 0x01h\n" DEBUGF 1,"Set MAC Reg C+CR Offset 0x82h = 0x01h\n"
set_io 0x82 set_io 0x82
mov al, 0x01 mov al, 0x01
out dx, al out dx, al
; DEBUGF 1,"K : Set PHY Reg 0x0bh = 0x00h\n" DEBUGF 1,"Set PHY Reg 0x0bh = 0x00h\n"
WRITE_GMII_REG 0x0b, 0x0000 ; w 0x0b 15 0 0 WRITE_GMII_REG 0x0b, 0x0000 ; w 0x0b 15 0 0
@@: @@:
; if TBI is not enabled ; if TBI is not enabled
@ -1103,8 +1103,8 @@ transmit:
.fail: .fail:
DEBUGF 1,"transmit failed\n" DEBUGF 1,"transmit failed\n"
or eax, -1
stdcall KernelFree, [esp+4] stdcall KernelFree, [esp+4]
or eax, -1
ret 8 ret 8
@ -1122,7 +1122,7 @@ int_handler:
push ebx esi edi push ebx esi edi
DEBUGF 1,"\n%s int\n", my_service DEBUGF 1,"INT\n"
; find pointer of device wich made IRQ occur ; find pointer of device wich made IRQ occur

View File

@ -352,10 +352,13 @@ transmit:
add dword [device.bytes_tx], eax add dword [device.bytes_tx], eax
adc dword [device.bytes_tx + 4], 0 adc dword [device.bytes_tx + 4], 0
xor eax, eax
ret 8 ret 8
.fail: .fail:
DEBUGF 1,"Send failed\n" DEBUGF 1,"Send failed\n"
stdcall KernelFree, [esp+4]
or eax, -1
ret 8 ret 8

View File

@ -622,7 +622,7 @@ reset:
stdcall AttachIntHandler, eax, int_handler, dword 0 stdcall AttachIntHandler, eax, int_handler, dword 0
test eax, eax test eax, eax
jnz @f jnz @f
DEBUGF 1,"\nCould not attach int handler!\n" DEBUGF 2,"Could not attach int handler!\n"
; or eax, -1 ; or eax, -1
; ret ; ret
@@: @@:
@ -1010,8 +1010,8 @@ transmit:
.fail: .fail:
DEBUGF 1,"transmit failed\n" DEBUGF 1,"transmit failed\n"
or eax, -1
stdcall KernelFree, [esp+4] stdcall KernelFree, [esp+4]
or eax, -1
ret 8 ret 8

View File

@ -1843,8 +1843,8 @@ transmit:
ret 8 ret 8
.fail: .fail:
xor eax, eax stdcall KernelFree, [esp+4]
inc eax or eax, -1
ret 8 ret 8

View File

@ -656,7 +656,6 @@ transmit:
cmp dword [esp + 8], 60 cmp dword [esp + 8], 60
jb .fail jb .fail
; Program the descriptor (use legacy mode) ; Program the descriptor (use legacy mode)
lea edi, [device.tx_desc] ; Transmit Descriptor Base Address lea edi, [device.tx_desc] ; Transmit Descriptor Base Address
mov dword [edi + 16], eax ; Store the data location (for driver) mov dword [edi + 16], eax ; Store the data location (for driver)
@ -680,10 +679,13 @@ transmit:
add dword [device.bytes_tx], eax add dword [device.bytes_tx], eax
adc dword [device.bytes_tx + 4], 0 adc dword [device.bytes_tx + 4], 0
xor eax, eax
ret 8 ret 8
.fail: .fail:
DEBUGF 2,"Send failed\n" DEBUGF 2,"Send failed\n"
stdcall KernelFree, [esp+4]
or eax, -1
ret 8 ret 8

View File

@ -1062,8 +1062,8 @@ transmit:
.fail: .fail:
DEBUGF 1,"transmit failed\n" DEBUGF 1,"transmit failed\n"
or eax, -1
stdcall KernelFree, [esp + 4] stdcall KernelFree, [esp + 4]
or eax, -1
ret 8 ret 8

View File

@ -1461,6 +1461,7 @@ transmit:
.fail: .fail:
DEBUGF 2, "Transmit Failed!\n" DEBUGF 2, "Transmit Failed!\n"
stdcall KernelFree, [esp+4]
or eax, -1 ; Transmit failed or eax, -1 ; Transmit failed
ret 8 ret 8