small fix in OHCI driver

git-svn-id: svn://kolibrios.org@5246 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2014-12-19 18:03:04 +00:00
parent 661b6a726e
commit 9e74531bdb

View File

@ -853,7 +853,7 @@ end virtual
; debugging output, not needed for work ; debugging output, not needed for work
; test eax, 1F0000h ; test eax, 1F0000h
; jz @f ; jz @f
; DEBUGF 1,'K : ohci irq [%d] status of port %d is %x\n',[timer_ticks],ecx,eax ; DEBUGF 1,'K : ohci %x status of port %d is %x\n',esi,ecx,eax
;@@: ;@@:
; 11c. Ignore any events until all ports are powered up. ; 11c. Ignore any events until all ports are powered up.
; They will be processed by ohci_init. ; They will be processed by ohci_init.
@ -1323,6 +1323,10 @@ proc ohci_process_deferred
; 1. Initialize the return value. ; 1. Initialize the return value.
push -1 push -1
; 2. Process disconnect events. ; 2. Process disconnect events.
; Capture NewConnected mask in the state before disconnect processing;
; IRQ handler could asynchronously signal disconnect+connect event,
; connect events should be handled after disconnect events.
push [esi+usb_controller.NewConnected]
invoke usbhc_api.usb_disconnect_stage2 invoke usbhc_api.usb_disconnect_stage2
; 3. Check for connected devices. ; 3. Check for connected devices.
; If there is a connected device which was connected less than ; If there is a connected device which was connected less than
@ -1330,10 +1334,10 @@ proc ohci_process_deferred
; Otherwise, call ohci_new_port. ; Otherwise, call ohci_new_port.
mov edi, [esi+ohci_controller.MMIOBase-sizeof.ohci_controller] mov edi, [esi+ohci_controller.MMIOBase-sizeof.ohci_controller]
xor ecx, ecx xor ecx, ecx
cmp [esi+usb_controller.NewConnected], ecx cmp [esp], ecx
jz .skip_newconnected jz .skip_newconnected
.portloop: .portloop:
bt [esi+usb_controller.NewConnected], ecx bt [esp], ecx
jnc .noconnect jnc .noconnect
; If this port is shared with the EHCI companion and we see the connect event, ; If this port is shared with the EHCI companion and we see the connect event,
; then the device is USB1 dropped by EHCI, ; then the device is USB1 dropped by EHCI,
@ -1348,9 +1352,9 @@ proc ohci_process_deferred
sub eax, USB_CONNECT_DELAY sub eax, USB_CONNECT_DELAY
jge .connected jge .connected
neg eax neg eax
cmp [esp], eax cmp [esp+4], eax
jb .nextport jb .nextport
mov [esp], eax mov [esp+4], eax
jmp .nextport jmp .nextport
.connected: .connected:
lock btr [esi+usb_controller.NewConnected], ecx lock btr [esi+usb_controller.NewConnected], ecx
@ -1362,6 +1366,7 @@ proc ohci_process_deferred
cmp ecx, [esi+usb_controller.NumPorts] cmp ecx, [esi+usb_controller.NumPorts]
jb .portloop jb .portloop
.skip_newconnected: .skip_newconnected:
pop eax
; 4. Check for end of reset signalling. If so, call ohci_port_after_reset. ; 4. Check for end of reset signalling. If so, call ohci_port_after_reset.
cmp [esi+usb_controller.ResettingStatus], 2 cmp [esi+usb_controller.ResettingStatus], 2
jnz .no_reset_recovery jnz .no_reset_recovery