forked from KolibriOS/kolibrios
1)sound.asm: disable previous patch by default
2)uhci transfer descriptors git-svn-id: svn://kolibrios.org@567 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5ddaca390b
commit
3880bd7325
@ -77,6 +77,7 @@ AMD_str db "AuthenticAMD",0
|
|||||||
;szInfinity db 'INFINITY',0
|
;szInfinity db 'INFINITY',0
|
||||||
szHwMouse db 'ATI2D',0
|
szHwMouse db 'ATI2D',0
|
||||||
szPS2MDriver db 'PS2MOUSE',0
|
szPS2MDriver db 'PS2MOUSE',0
|
||||||
|
szUSB db 'USB',0
|
||||||
|
|
||||||
szSTART db 'START',0
|
szSTART db 'START',0
|
||||||
szEXPORTS db 'EXPORTS',0
|
szEXPORTS db 'EXPORTS',0
|
||||||
|
@ -321,6 +321,8 @@ proc CreateBuffer stdcall, format:dword, size:dword
|
|||||||
test eax, PCM_RING
|
test eax, PCM_RING
|
||||||
jnz .test_ring
|
jnz .test_ring
|
||||||
;staic
|
;staic
|
||||||
|
test eax, PCM_STATIC
|
||||||
|
jz .fail
|
||||||
test eax, PCM_OUT+PCM_RING
|
test eax, PCM_OUT+PCM_RING
|
||||||
jnz .fail
|
jnz .fail
|
||||||
jmp .test_ok
|
jmp .test_ok
|
||||||
@ -754,7 +756,15 @@ proc ResetBuffer stdcall, str:dword, flags:dword
|
|||||||
mov [edx+STREAM.in_wp], edi
|
mov [edx+STREAM.in_wp], edi
|
||||||
mov [edx+STREAM.in_rp], edi
|
mov [edx+STREAM.in_rp], edi
|
||||||
|
|
||||||
|
test [edx+STREAM.flags], PCM_STATIC
|
||||||
|
jnz .static
|
||||||
mov [edx+STREAM.in_count], 0
|
mov [edx+STREAM.in_count], 0
|
||||||
|
jmp @F
|
||||||
|
.static:
|
||||||
|
mov eax, [edx+STREAM.in_size]
|
||||||
|
mov [edx+STREAM.in_count], eax
|
||||||
|
@@:
|
||||||
|
|
||||||
mov eax, [edx+STREAM.in_size]
|
mov eax, [edx+STREAM.in_size]
|
||||||
sub eax, 128
|
sub eax, 128
|
||||||
mov [edx+STREAM.in_free], eax
|
mov [edx+STREAM.in_free], eax
|
||||||
@ -807,6 +817,8 @@ proc GetBufferPos stdcall, str:dword
|
|||||||
jnz .fail
|
jnz .fail
|
||||||
|
|
||||||
mov ebx, [edx+STREAM.in_rp]
|
mov ebx, [edx+STREAM.in_rp]
|
||||||
|
sub ebx, [edx+STREAM.in_base]
|
||||||
|
sub ebx, 128
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
ret
|
ret
|
||||||
.fail:
|
.fail:
|
||||||
@ -967,7 +979,7 @@ proc play_buffer stdcall, str:dword, flags:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; for static buffers only
|
; for static and ring buffers only
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc stop_buffer stdcall, str:dword
|
proc stop_buffer stdcall, str:dword
|
||||||
|
@ -343,19 +343,19 @@ proc START stdcall, state:dword
|
|||||||
in al, 0x21
|
in al, 0x21
|
||||||
test ebx, ebx
|
test ebx, ebx
|
||||||
jz .skip
|
jz .skip
|
||||||
bts ax, bx
|
bts ax, bx ;mask old line
|
||||||
.skip
|
.skip
|
||||||
bts ax, IRQ_LINE
|
bts ax, IRQ_LINE ;mask new ine
|
||||||
out 0x21, al
|
out 0x21, al
|
||||||
mov al, ah
|
mov al, ah
|
||||||
out 0xA1, al
|
out 0xA1, al
|
||||||
|
;remap IRQ
|
||||||
stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE
|
stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE
|
||||||
|
|
||||||
mov dx, 0x4d0
|
mov dx, 0x4d0 ;8259 ELCR1
|
||||||
in al, dx
|
in al, dx
|
||||||
bts ax, IRQ_LINE
|
bts ax, IRQ_LINE
|
||||||
out dx, al
|
out dx, al ;set level-triggered mode
|
||||||
mov [ctrl.int_line], IRQ_LINE
|
mov [ctrl.int_line], IRQ_LINE
|
||||||
popf
|
popf
|
||||||
mov esi, msgRemap
|
mov esi, msgRemap
|
||||||
@ -642,7 +642,6 @@ proc detect_controller
|
|||||||
je .found
|
je .found
|
||||||
add edi, 12
|
add edi, 12
|
||||||
jmp @B
|
jmp @B
|
||||||
|
|
||||||
.next:
|
.next:
|
||||||
inc [devfn]
|
inc [devfn]
|
||||||
cmp [devfn], 256
|
cmp [devfn], 256
|
||||||
@ -749,6 +748,8 @@ proc init_controller
|
|||||||
call dword2str
|
call dword2str
|
||||||
call SysMsgBoardStr
|
call SysMsgBoardStr
|
||||||
|
|
||||||
|
if 0
|
||||||
|
|
||||||
;;patch for some ugly BIOS
|
;;patch for some ugly BIOS
|
||||||
cmp [ctrl.vendor], VID_INTEL
|
cmp [ctrl.vendor], VID_INTEL
|
||||||
jne .default
|
jne .default
|
||||||
@ -763,6 +764,8 @@ proc init_controller
|
|||||||
jnc @F
|
jnc @F
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
jmp @F
|
jmp @F
|
||||||
|
end if
|
||||||
|
|
||||||
.default:
|
.default:
|
||||||
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
|
stdcall PciRead32, [ctrl.bus], [ctrl.devfn], dword 0x3C
|
||||||
and eax, 0xFF
|
and eax, 0xFF
|
||||||
@ -1446,13 +1449,12 @@ msgInvIRQ db 'IRQ line not assigned or invalid', 13,10, 0
|
|||||||
msgPlay db 'start play', 13,10,0
|
msgPlay db 'start play', 13,10,0
|
||||||
msgStop db 'stop play', 13,10,0
|
msgStop db 'stop play', 13,10,0
|
||||||
;msgNotify db 'call notify',13,10,0
|
;msgNotify db 'call notify',13,10,0
|
||||||
msgIRQ db 'AC97 IRQ', 13,10,0
|
msgIRQ db 'AC97 IRQ', 13,10,0
|
||||||
msgInitCtrl db 'init controller',13,10,0
|
msgInitCtrl db 'init controller',13,10,0
|
||||||
;msgInitCodec db 'init codec',13,10,0
|
;msgInitCodec db 'init codec',13,10,0
|
||||||
msgPrimBuff db 'create primary buffer ...',0
|
msgPrimBuff db 'create primary buffer ...',0
|
||||||
msgDone db 'done',13,10,0
|
msgDone db 'done',13,10,0
|
||||||
msgRemap db 'Remap IRQ',13,10,0
|
msgRemap db 'Remap IRQ',13,10,0
|
||||||
msgIrqMap db 'irq remap ',0
|
|
||||||
;msgReg db 'set service handler',13,10,0
|
;msgReg db 'set service handler',13,10,0
|
||||||
msgOk db 'service installed',13,10,0
|
msgOk db 'service installed',13,10,0
|
||||||
msgCold db 'cold reset',13,10,0
|
msgCold db 'cold reset',13,10,0
|
||||||
@ -1469,6 +1471,7 @@ msgCtrlIsaIo db 'controller io base ',0
|
|||||||
msgMixIsaIo db 'codec io base ',0
|
msgMixIsaIo db 'codec io base ',0
|
||||||
msgCtrlMMIo db 'controller mmio base ',0
|
msgCtrlMMIo db 'controller mmio base ',0
|
||||||
msgMixMMIo db 'codec mmio base ',0
|
msgMixMMIo db 'codec mmio base ',0
|
||||||
|
msgIrqMap db 'AC97 irq map as ',0
|
||||||
|
|
||||||
section '.data' data readable writable align 16
|
section '.data' data readable writable align 16
|
||||||
|
|
||||||
|
@ -14,20 +14,25 @@ API_VERSION equ 0 ;debug
|
|||||||
include '../proc32.inc'
|
include '../proc32.inc'
|
||||||
include '../imports.inc'
|
include '../imports.inc'
|
||||||
|
|
||||||
OS_BASE equ 0x80000000
|
|
||||||
SLOT_BASE equ OS_BASE+0x0080000
|
|
||||||
|
|
||||||
struc UHCI
|
struc UHCI
|
||||||
{
|
{
|
||||||
.bus dd ?
|
.bus dd ?
|
||||||
.devfn dd ?
|
.devfn dd ?
|
||||||
.io_base dd ?
|
.io_base dd ?
|
||||||
.mm_base dd ?
|
.mm_base dd ?
|
||||||
.irq dd ?
|
.irq dd ?
|
||||||
.flags dd ?
|
.flags dd ?
|
||||||
.reset dd ?
|
.reset dd ?
|
||||||
.start dd ?
|
.start dd ?
|
||||||
.stop dd ?
|
.stop dd ?
|
||||||
|
|
||||||
|
.port_c_suspend dd ?
|
||||||
|
.resuming_ports dd ?
|
||||||
|
.rh_state dd ?
|
||||||
|
.rh_numports dd ?
|
||||||
|
.is_stopped dd ?
|
||||||
|
.dead dd ?
|
||||||
|
|
||||||
.sizeof:
|
.sizeof:
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +53,24 @@ virtual at 0
|
|||||||
IOCTL IOCTL
|
IOCTL IOCTL
|
||||||
end virtual
|
end virtual
|
||||||
|
|
||||||
|
struc TD ;transfer descriptor
|
||||||
|
{
|
||||||
|
.link dd ?
|
||||||
|
.status dd ?
|
||||||
|
.token dd ?
|
||||||
|
.buffer dd ?
|
||||||
|
|
||||||
|
.addr dd ?
|
||||||
|
.frame dd ?
|
||||||
|
.fd dd ?
|
||||||
|
.bk dd ?
|
||||||
|
.sizeof:
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual at 0
|
||||||
|
TD TD
|
||||||
|
end virtual
|
||||||
|
|
||||||
public START
|
public START
|
||||||
public service_proc
|
public service_proc
|
||||||
public version
|
public version
|
||||||
@ -187,7 +210,7 @@ proc detect
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
PCI_BASE equ 0x20
|
PCI_BASE equ 0x20
|
||||||
USB_LEGKEY equ 0xC0
|
USB_LEGKEY equ 0xC0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -209,6 +232,7 @@ proc init
|
|||||||
|
|
||||||
stdcall uhci_reset, esi
|
stdcall uhci_reset, esi
|
||||||
|
|
||||||
|
stdcall finish_reset, [uhci]
|
||||||
|
|
||||||
.fail:
|
.fail:
|
||||||
if DEBUG
|
if DEBUG
|
||||||
@ -218,21 +242,39 @@ proc init
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
UHCI_USBINTR equ 4 ; interrupt register
|
UHCI_USBINTR equ 4 ; interrupt register
|
||||||
|
|
||||||
UHCI_USBLEGSUP_RWC equ 0x8f00 ; the R/WC bits
|
UHCI_USBLEGSUP_RWC equ 0x8f00 ; the R/WC bits
|
||||||
UHCI_USBLEGSUP_RO equ 0x5040 ; R/O and reserved bits
|
UHCI_USBLEGSUP_RO equ 0x5040 ; R/O and reserved bits
|
||||||
|
|
||||||
UHCI_USBCMD_RUN equ 0x0001 ; RUN/STOP bit
|
UHCI_USBCMD_RUN equ 0x0001 ; RUN/STOP bit
|
||||||
UHCI_USBCMD_HCRESET equ 0x0002 ; Host Controller reset
|
UHCI_USBCMD_HCRESET equ 0x0002 ; Host Controller reset
|
||||||
UHCI_USBCMD_EGSM equ 0x0008 ; Global Suspend Mode
|
UHCI_USBCMD_EGSM equ 0x0008 ; Global Suspend Mode
|
||||||
UHCI_USBCMD_CONFIGURE equ 0x0040 ; Config Flag
|
UHCI_USBCMD_CONFIGURE equ 0x0040 ; Config Flag
|
||||||
UHCI_USBINTR_RESUME equ 0x0002 ; Resume interrupt enable
|
UHCI_USBINTR_RESUME equ 0x0002 ; Resume interrupt enable
|
||||||
|
|
||||||
|
PORTSC0 equ 0x10
|
||||||
|
PORTSC1 equ 0x12
|
||||||
|
|
||||||
|
|
||||||
|
UHCI_RH_RESET equ 0
|
||||||
|
UHCI_RH_SUSPENDED equ 1
|
||||||
|
UHCI_RH_AUTO_STOPPED equ 2
|
||||||
|
UHCI_RH_RESUMING equ 3
|
||||||
|
|
||||||
|
; In this state the HC changes from running to halted
|
||||||
|
; so it can legally appear either way.
|
||||||
|
UHCI_RH_SUSPENDING equ 4
|
||||||
|
|
||||||
|
; In the following states it's an error if the HC is halted.
|
||||||
|
; These two must come last.
|
||||||
|
UHCI_RH_RUNNING equ 5 ; The normal state
|
||||||
|
UHCI_RH_RUNNING_NODEVS equ 6 ; Running with no devices
|
||||||
|
|
||||||
|
UHCI_IS_STOPPED equ 9999
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc uhci_reset stdcall, uhci:dword
|
proc uhci_reset stdcall, uhci:dword
|
||||||
|
|
||||||
mov esi, [uhci]
|
mov esi, [uhci]
|
||||||
stdcall PciRead16, [esi+UHCI.bus], [esi+UHCI.devfn], USB_LEGKEY
|
stdcall PciRead16, [esi+UHCI.bus], [esi+UHCI.devfn], USB_LEGKEY
|
||||||
test eax, not (UHCI_USBLEGSUP_RO or UHCI_USBLEGSUP_RWC)
|
test eax, not (UHCI_USBLEGSUP_RO or UHCI_USBLEGSUP_RWC)
|
||||||
@ -248,6 +290,11 @@ proc uhci_reset stdcall, uhci:dword
|
|||||||
|
|
||||||
test ax, UHCI_USBCMD_EGSM
|
test ax, UHCI_USBCMD_EGSM
|
||||||
jz .reset
|
jz .reset
|
||||||
|
|
||||||
|
add edx, UHCI_USBINTR
|
||||||
|
in ax, dx
|
||||||
|
test ax, not UHCI_USBINTR_RESUME
|
||||||
|
jnz .reset
|
||||||
ret
|
ret
|
||||||
.reset:
|
.reset:
|
||||||
stdcall PciWrite16, [esi+UHCI.bus], [esi+UHCI.devfn], USB_LEGKEY, UHCI_USBLEGSUP_RWC
|
stdcall PciWrite16, [esi+UHCI.bus], [esi+UHCI.devfn], USB_LEGKEY, UHCI_USBLEGSUP_RWC
|
||||||
@ -263,16 +310,77 @@ proc uhci_reset stdcall, uhci:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
proc finish_reset stdcall, uhci:dword
|
||||||
|
|
||||||
DEVICE_ID equ 0x8086; pci device id
|
mov esi, [uhci]
|
||||||
VENDOR_ID equ 0x24D4; device vendor id
|
mov edx, [esi+UHCI.io_base]
|
||||||
|
add edx, PORTSC0
|
||||||
|
xor eax, eax
|
||||||
|
out dx, ax
|
||||||
|
add edx, (PORTSC1-PORTSC0)
|
||||||
|
out dx, ax
|
||||||
|
|
||||||
|
mov [esi+UHCI.port_c_suspend], eax
|
||||||
|
mov [esi+UHCI.resuming_ports], eax
|
||||||
|
mov [esi+UHCI.rh_state], UHCI_RH_RESET
|
||||||
|
mov [esi+UHCI.rh_numports], 2
|
||||||
|
|
||||||
|
mov [esi+UHCI.is_stopped], UHCI_IS_STOPPED
|
||||||
|
; mov [ uhci_to_hcd(uhci)->state = HC_STATE_HALT;
|
||||||
|
; uhci_to_hcd(uhci)->poll_rh = 0;
|
||||||
|
|
||||||
|
mov [esi+UHCI.dead], eax ; Full reset resurrects the controller
|
||||||
|
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
proc insert_td stdcall, td:dword, frame:dword
|
||||||
|
|
||||||
|
mov edi, [td]
|
||||||
|
mov eax, [frame]
|
||||||
|
and eax, -1024
|
||||||
|
mov [edi+TD.frame], eax
|
||||||
|
|
||||||
|
mov ebx, [framelist]
|
||||||
|
mov edx, [dma_framelist]
|
||||||
|
shl eax, 5
|
||||||
|
|
||||||
|
mov ecx, [eax+ebx]
|
||||||
|
test ecx, ecx
|
||||||
|
jz .empty
|
||||||
|
|
||||||
|
mov ecx, [ecx+TD.bk] ;last TD
|
||||||
|
|
||||||
|
mov edx, [ecx+TD.fd]
|
||||||
|
mov [edi+TD.fd], edx
|
||||||
|
mov [edi+TD.bk], ecx
|
||||||
|
mov [ecx+TD.fd], edi
|
||||||
|
mov [edx+TD.bk], edi
|
||||||
|
|
||||||
|
mov eax, [ecx+TD.link]
|
||||||
|
mov [edi+TD.link], eax
|
||||||
|
mov ebx, [edi+TD.addr]
|
||||||
|
mov [ecx+TD.link], ebx
|
||||||
|
ret
|
||||||
|
.empty:
|
||||||
|
mov ecx, [eax+edx]
|
||||||
|
mov [edi+TD.link], ecx
|
||||||
|
mov [ebx+eax], edi
|
||||||
|
mov ecx, [edi+TD.addr]
|
||||||
|
mov [eax+edx], ecx
|
||||||
|
ret
|
||||||
|
endp
|
||||||
|
|
||||||
|
DEVICE_ID equ 0x24D2 ; pci device id
|
||||||
|
VENDOR_ID equ 0x8086 ; device vendor id
|
||||||
|
QEMU_USB equ 0x7020
|
||||||
|
|
||||||
;all initialized data place here
|
;all initialized data place here
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
devices dd (DEVICE_ID shl 16)+VENDOR_ID
|
devices dd (DEVICE_ID shl 16)+VENDOR_ID
|
||||||
dd 0 ;terminator
|
dd (QEMU_USB shl 16)+VENDOR_ID
|
||||||
|
dd 0 ;terminator
|
||||||
|
|
||||||
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
|
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
|
||||||
|
|
||||||
|
@ -610,6 +610,9 @@ no_lib_load:
|
|||||||
|
|
||||||
mov esi,boot_devices
|
mov esi,boot_devices
|
||||||
call boot_log
|
call boot_log
|
||||||
|
|
||||||
|
mov [pci_access_enabled],1
|
||||||
|
|
||||||
call detect_devices
|
call detect_devices
|
||||||
stdcall load_driver, szPS2MDriver
|
stdcall load_driver, szPS2MDriver
|
||||||
|
|
||||||
@ -630,7 +633,6 @@ no_lib_load:
|
|||||||
call boot_log
|
call boot_log
|
||||||
call setmouse
|
call setmouse
|
||||||
|
|
||||||
mov [pci_access_enabled],1
|
|
||||||
|
|
||||||
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
||||||
|
|
||||||
@ -2960,7 +2962,7 @@ sys_drawwindow:
|
|||||||
cmp edi,4 ; type V - skinned window not sized! {not_sized_skin_window}
|
cmp edi,4 ; type V - skinned window not sized! {not_sized_skin_window}
|
||||||
jne nosyswV
|
jne nosyswV
|
||||||
draw_skin_window:
|
draw_skin_window:
|
||||||
|
|
||||||
; parameter for drawwindow_IV
|
; parameter for drawwindow_IV
|
||||||
push 0
|
push 0
|
||||||
mov edi, [TASK_COUNT]
|
mov edi, [TASK_COUNT]
|
||||||
@ -3003,7 +3005,7 @@ draw_window_caption:
|
|||||||
je .draw_caption_style_3 ;{for 3 and 4 style write caption}
|
je .draw_caption_style_3 ;{for 3 and 4 style write caption}
|
||||||
cmp bl,4
|
cmp bl,4
|
||||||
je .draw_caption_style_3
|
je .draw_caption_style_3
|
||||||
|
|
||||||
jmp .not_style_3
|
jmp .not_style_3
|
||||||
.draw_caption_style_3:
|
.draw_caption_style_3:
|
||||||
|
|
||||||
@ -3042,9 +3044,9 @@ draw_window_caption:
|
|||||||
je .skinned
|
je .skinned
|
||||||
cmp al,4
|
cmp al,4
|
||||||
je .skinned
|
je .skinned
|
||||||
|
|
||||||
jmp .not_skinned
|
jmp .not_skinned
|
||||||
.skinned:
|
.skinned:
|
||||||
mov ebp,[edi+window_data+WDATA.box.left-2]
|
mov ebp,[edi+window_data+WDATA.box.left-2]
|
||||||
mov bp,word[edi+window_data+WDATA.box.top]
|
mov bp,word[edi+window_data+WDATA.box.top]
|
||||||
movzx eax,word[edi+window_data+WDATA.box.width]
|
movzx eax,word[edi+window_data+WDATA.box.width]
|
||||||
@ -3201,8 +3203,8 @@ sys_set_window:
|
|||||||
je set_APPDATA_wnd_caption
|
je set_APPDATA_wnd_caption
|
||||||
cmp cl,4 ; {SPraid.simba}
|
cmp cl,4 ; {SPraid.simba}
|
||||||
je set_APPDATA_wnd_caption
|
je set_APPDATA_wnd_caption
|
||||||
|
|
||||||
jmp @f
|
jmp @f
|
||||||
set_APPDATA_wnd_caption:
|
set_APPDATA_wnd_caption:
|
||||||
mov [edi+APPDATA.wnd_caption],esi
|
mov [edi+APPDATA.wnd_caption],esi
|
||||||
@@: mov esi,[esp+0]
|
@@: mov esi,[esp+0]
|
||||||
|
Loading…
Reference in New Issue
Block a user