rtl8169: Improved interrupt handling.
git-svn-id: svn://kolibrios.org@9148 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b13c4c9c6d
commit
55487f48ed
@ -1027,15 +1027,14 @@ write_mac:
|
|||||||
; Description
|
; Description
|
||||||
; Transmits a packet of data via the ethernet card
|
; Transmits a packet of data via the ethernet card
|
||||||
;
|
;
|
||||||
; Destroyed registers
|
; In: pointer to device structure in ebx
|
||||||
; eax, edx, esi, edi
|
; Out: eax = 0 on success
|
||||||
;
|
;
|
||||||
;***************************************************************************
|
;***************************************************************************
|
||||||
|
align 16
|
||||||
proc transmit stdcall bufferptr
|
proc transmit stdcall bufferptr
|
||||||
|
|
||||||
pushf
|
spin_lock_irqsave
|
||||||
cli
|
|
||||||
|
|
||||||
mov esi, [bufferptr]
|
mov esi, [bufferptr]
|
||||||
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length]
|
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n", [bufferptr], [esi + NET_BUFF.length]
|
||||||
@ -1107,7 +1106,7 @@ proc transmit stdcall bufferptr
|
|||||||
add dword [ebx + device.bytes_tx], ecx
|
add dword [ebx + device.bytes_tx], ecx
|
||||||
adc dword [ebx + device.bytes_tx + 4], 0
|
adc dword [ebx + device.bytes_tx + 4], 0
|
||||||
|
|
||||||
popf
|
spin_unlock_irqrestore
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1116,7 +1115,7 @@ proc transmit stdcall bufferptr
|
|||||||
inc [ebx + device.packets_tx_err]
|
inc [ebx + device.packets_tx_err]
|
||||||
invoke NetFree, [bufferptr]
|
invoke NetFree, [bufferptr]
|
||||||
|
|
||||||
popf
|
spin_unlock_irqrestore
|
||||||
or eax, -1
|
or eax, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1125,7 +1124,7 @@ proc transmit stdcall bufferptr
|
|||||||
inc [ebx + device.packets_tx_ovr]
|
inc [ebx + device.packets_tx_ovr]
|
||||||
invoke NetFree, [bufferptr]
|
invoke NetFree, [bufferptr]
|
||||||
|
|
||||||
popf
|
spin_unlock_irqrestore
|
||||||
or eax, -1
|
or eax, -1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1138,43 +1137,28 @@ endp
|
|||||||
;; Interrupt handler ;;
|
;; Interrupt handler ;;
|
||||||
;; ;;
|
;; ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
align 16
|
||||||
align 4
|
|
||||||
int_handler:
|
int_handler:
|
||||||
|
|
||||||
push ebx esi edi
|
push ebx esi edi
|
||||||
|
|
||||||
DEBUGF 1,"INT\n"
|
mov ebx, [esp+4*4]
|
||||||
|
DEBUGF 1,"INT for 0x%x\n", ebx
|
||||||
|
|
||||||
; find pointer of device wich made IRQ occur
|
; TODO? if we are paranoid, we can check that the value from ebx is present in the current device_list
|
||||||
|
|
||||||
mov ecx, [devices]
|
|
||||||
test ecx, ecx
|
|
||||||
jz .nothing
|
|
||||||
mov esi, device_list
|
|
||||||
.nextdevice:
|
|
||||||
mov ebx, [esi]
|
|
||||||
|
|
||||||
set_io [ebx + device.io_addr], 0
|
set_io [ebx + device.io_addr], 0
|
||||||
set_io [ebx + device.io_addr], REG_IntrStatus
|
set_io [ebx + device.io_addr], REG_IntrStatus
|
||||||
in ax, dx
|
in ax, dx
|
||||||
out dx, ax ; ACK all interrupts
|
|
||||||
cmp ax, 0xffff ; if so, hardware is no longer present
|
|
||||||
je .nothing
|
|
||||||
test ax, ax
|
test ax, ax
|
||||||
jnz .got_it
|
jz .nothing
|
||||||
.continue:
|
cmp ax, 0xffff ; if so, hardware is no longer present
|
||||||
add esi, 4
|
je .nothing ;
|
||||||
dec ecx
|
test ax, ax
|
||||||
jnz .nextdevice
|
jz .nothing
|
||||||
.nothing:
|
out dx, ax ; ACK all interrupts
|
||||||
pop edi esi ebx
|
|
||||||
xor eax, eax
|
|
||||||
|
|
||||||
ret ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
|
DEBUGF 1,"Status: %x\n", ax
|
||||||
|
|
||||||
.got_it:
|
|
||||||
DEBUGF 1,"Device: %x Status: %x\n", ebx, ax
|
|
||||||
|
|
||||||
;--------
|
;--------
|
||||||
; Receive
|
; Receive
|
||||||
@ -1326,6 +1310,12 @@ int_handler:
|
|||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.nothing:
|
||||||
|
pop edi esi ebx
|
||||||
|
xor eax, eax
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
Loading…
Reference in New Issue
Block a user