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
in ax, dx
test ah, 0x80
jnz .finish ; no DMA for sending
jnz .fail ; no DMA for sending
; program frame address to be sent
set_io REG_MASTER_ADDRESS
mov eax, [esp+4]
@ -2243,12 +2243,14 @@ vortex_transmit:
set_io REG_COMMAND
mov ax, (10100b shl 11) + 1 ; StartDMADown
out dx, ax
.finish:
call KernelFree
add esp, 4
ret
.finish:
xor eax, eax
ret 8
.fail:
stdcall KernelFree, [esp+4]
or eax, -1
ret 8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;

View File

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

View File

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

View File

@ -633,23 +633,23 @@ probe:
call read_mac
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 0x82
mov al, 0x01
out dx, al
cmp [tpc.mcfg], MCFG_METHOD_03
jae @f
; DEBUGF 1,"K : Set PCI Latency=0x40\n"
; stdcall pci_write_config_byte,PCI_LATENCY_TIMER,0x40
DEBUGF 1,"Set PCI Latency=0x40\n"
PCI_adjust_latency 0x40
@@:
cmp [tpc.mcfg], MCFG_METHOD_02
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
mov al, 0x01
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
@@:
; if TBI is not enabled
@ -736,7 +736,7 @@ reset:
align 4
PHY_config:
DEBUGF 1,"hw_PHY_config: priv.mcfg=%d, priv.pcfg=%d\n",[tpc.mcfg],[tpc.pcfg]
DEBUGF 1,"hw_PHY_config: priv.mcfg=%d, priv.pcfg=%d\n", [tpc.mcfg], [tpc.pcfg]
cmp [tpc.mcfg], MCFG_METHOD_04
jne .not_4
@ -1103,8 +1103,8 @@ transmit:
.fail:
DEBUGF 1,"transmit failed\n"
or eax, -1
stdcall KernelFree, [esp+4]
or eax, -1
ret 8
@ -1122,7 +1122,7 @@ int_handler:
push ebx esi edi
DEBUGF 1,"\n%s int\n", my_service
DEBUGF 1,"INT\n"
; find pointer of device wich made IRQ occur

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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