forked from KolibriOS/kolibrios
RTL8139: Do not register driver if reset failed.
git-svn-id: svn://kolibrios.org@6682 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
d6e2af9385
commit
b1100a5fe6
@ -370,10 +370,11 @@ proc service_proc stdcall, ioctl:dword
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
; If an error occured, remove all allocated data and exit (returning -1 in eax)
|
; If an error occured, remove all allocated data and exit (returning -1 in eax)
|
||||||
|
|
||||||
.destroy:
|
.destroy:
|
||||||
; todo: unregister device from device_list
|
; unregister device from device_list
|
||||||
; todo: reset device into virgin state
|
mov eax, [devices]
|
||||||
|
mov dword[device_list-4+4*eax], 0
|
||||||
|
dec [devices]
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
DEBUGF 2, "Error, removing all data !\n"
|
DEBUGF 2, "Error, removing all data !\n"
|
||||||
@ -508,17 +509,6 @@ probe:
|
|||||||
reset:
|
reset:
|
||||||
DEBUGF 1, "Reset\n"
|
DEBUGF 1, "Reset\n"
|
||||||
|
|
||||||
; attach int handler
|
|
||||||
movzx eax, [ebx + device.irq_line]
|
|
||||||
DEBUGF 1, "Attaching int handler to irq %x\n", eax:1
|
|
||||||
invoke AttachIntHandler, eax, int_handler, ebx
|
|
||||||
test eax, eax
|
|
||||||
jnz @f
|
|
||||||
DEBUGF 2, "Could not attach int handler!\n"
|
|
||||||
or eax, -1
|
|
||||||
ret
|
|
||||||
@@:
|
|
||||||
|
|
||||||
; reset chip
|
; reset chip
|
||||||
DEBUGF 1, "Resetting chip\n"
|
DEBUGF 1, "Resetting chip\n"
|
||||||
set_io [ebx + device.io_addr], 0
|
set_io [ebx + device.io_addr], 0
|
||||||
@ -533,11 +523,24 @@ reset:
|
|||||||
dec cx
|
dec cx
|
||||||
jns .wait_for_reset
|
jns .wait_for_reset
|
||||||
DEBUGF 2, "Reset timeout!\n"
|
DEBUGF 2, "Reset timeout!\n"
|
||||||
|
or eax, -1
|
||||||
|
ret
|
||||||
.reset_completed:
|
.reset_completed:
|
||||||
|
|
||||||
; Read MAC address
|
; Read MAC address
|
||||||
call read_mac
|
call read_mac
|
||||||
|
|
||||||
|
; attach int handler
|
||||||
|
movzx eax, [ebx + device.irq_line]
|
||||||
|
DEBUGF 1, "Attaching int handler to irq %x\n", eax:1
|
||||||
|
invoke AttachIntHandler, eax, int_handler, ebx
|
||||||
|
test eax, eax
|
||||||
|
jnz @f
|
||||||
|
DEBUGF 2, "Could not attach int handler!\n"
|
||||||
|
or eax, -1
|
||||||
|
ret
|
||||||
|
@@:
|
||||||
|
|
||||||
; unlock config and BMCR registers
|
; unlock config and BMCR registers
|
||||||
set_io [ebx + device.io_addr], 0
|
set_io [ebx + device.io_addr], 0
|
||||||
set_io [ebx + device.io_addr], REG_9346CR
|
set_io [ebx + device.io_addr], REG_9346CR
|
||||||
|
Loading…
Reference in New Issue
Block a user