speed up booting in some configurations

git-svn-id: svn://kolibrios.org@5012 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2014-07-29 10:41:27 +00:00
parent 7626be8544
commit 90df12563a
3 changed files with 37 additions and 115 deletions

View File

@ -394,7 +394,6 @@ sayerr:
push 0 push 0
popf popf
sti
; set up esp ; set up esp
movzx esp, sp movzx esp, sp
@ -402,15 +401,20 @@ sayerr:
push 0 push 0
pop es pop es
xor cx, cx
@@:
in al, 64h
test al, 2
loopnz @b
mov al, 0xf6 ; Сброс клавиатуры, разрешить сканирование mov al, 0xf6 ; Сброс клавиатуры, разрешить сканирование
out 0x60, al out 0x60, al
xor cx, cx xor cx, cx
wait_loop: ; variant 2 @@:
; reading state of port of 8042 controller
in al, 64h in al, 64h
and al, 00000010b ; ready flag test al, 1
; wait until 8042 controller is ready loopnz @b
loopnz wait_loop in al, 0x60
;;;/diamond today 5.02.2008 ;;;/diamond today 5.02.2008
; set keyboard typematic rate & delay ; set keyboard typematic rate & delay
@ -419,16 +423,19 @@ wait_loop: ; variant 2
xor cx, cx xor cx, cx
@@: @@:
in al, 64h in al, 64h
test al, 2 test al, 1
loopnz @b loopnz @b
in al, 0x60
mov al, 0 mov al, 0
out 0x60, al out 0x60, al
xor cx, cx xor cx, cx
@@: @@:
in al, 64h in al, 64h
test al, 2 test al, 1
loopnz @b loopnz @b
in al, 0x60
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sti
; --------------- APM --------------------- ; --------------- APM ---------------------
and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found) and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found)
mov ax, 0x5300 mov ax, 0x5300

View File

@ -551,9 +551,9 @@ set_lights:
ps2_set_lights: ps2_set_lights:
stdcall disable_irq, 1 stdcall disable_irq, 1
mov al, 0xED mov al, 0xED
call kb_write call kb_write_wait_ack
mov al, [esp+8] mov al, [esp+8]
call kb_write call kb_write_wait_ack
stdcall enable_irq, 1 stdcall enable_irq, 1
ret 8 ret 8

View File

@ -971,17 +971,10 @@ first_app_found:
; SET KEYBOARD PARAMETERS ; SET KEYBOARD PARAMETERS
mov al, 0xf6 ; reset keyboard, scan enabled mov al, 0xf6 ; reset keyboard, scan enabled
call kb_write call kb_write_wait_ack
test ah, ah test ah, ah
jnz .no_keyboard jnz .no_keyboard
; wait until 8042 is ready
xor ecx, ecx
@@:
in al, 64h
and al, 00000010b
loopnz @b
iglobal iglobal
align 4 align 4
ps2_keyboard_functions: ps2_keyboard_functions:
@ -992,18 +985,14 @@ ps2_keyboard_functions:
endg endg
stdcall register_keyboard, ps2_keyboard_functions, 0 stdcall register_keyboard, ps2_keyboard_functions, 0
; mov al, 0xED ; Keyboard LEDs - only for testing! ; mov al, 0xED ; Keyboard LEDs - only for testing!
; call kb_write ; call kb_write_wait_ack
; call kb_read
; mov al, 111b ; mov al, 111b
; call kb_write ; call kb_write_wait_ack
; call kb_read
mov al, 0xF3 ; set repeat rate & delay mov al, 0xF3 ; set repeat rate & delay
call kb_write call kb_write_wait_ack
; call kb_read
mov al, 0; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500 mov al, 0; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500
call kb_write call kb_write_wait_ack
; call kb_read
;// mike.dld [ ;// mike.dld [
call set_lights call set_lights
;// mike.dld ] ;// mike.dld ]
@ -4490,113 +4479,39 @@ putimage_get16bpp:
; ret ; ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
kb_read: kb_write_wait_ack:
push ecx edx
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
kr_loop:
in al, 0x64
test al, 1
jnz kr_ready
loop kr_loop
mov ah, 1
jmp kr_exit
kr_ready:
push ecx
mov ecx, 32
kr_delay:
loop kr_delay
pop ecx
in al, 0x60
xor ah, ah
kr_exit:
pop edx ecx
ret
;-----------------------------------------------------------------------------
align 4
kb_write:
push ecx edx push ecx edx
mov dl, al mov dl, al
; mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
; kw_loop1:
; in al,0x64
; test al,0x20
; jz kw_ok1
; loop kw_loop1
; mov ah,1
; jmp kw_exit
; kw_ok1:
in al, 0x60
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
kw_loop: .wait_output_ready:
in al, 0x64 in al, 0x64
test al, 2 test al, 2
jz kw_ok jz @f
loop kw_loop loop .wait_output_ready
mov ah, 1 mov ah, 1
jmp kw_exit jmp .nothing
kw_ok: @@:
mov al, dl mov al, dl
out 0x60, al out 0x60, al
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's mov ecx, 0xfffff; last 0xffff, new value in view of fast CPU's
kw_loop3: .wait_ack:
in al, 0x64
test al, 2
jz kw_ok3
loop kw_loop3
mov ah, 1
jmp kw_exit
kw_ok3:
mov ah, 8
kw_loop4:
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
kw_loop5:
in al, 0x64 in al, 0x64
test al, 1 test al, 1
jnz kw_ok4 jnz @f
loop kw_loop5 loop .wait_ack
dec ah mov ah, 1
jnz kw_loop4 jmp .nothing
kw_ok4: @@:
in al, 0x60
xor ah, ah xor ah, ah
kw_exit:
.nothing:
pop edx ecx pop edx ecx
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4
kb_cmd:
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
c_wait:
in al, 0x64
test al, 2
jz c_send
loop c_wait
jmp c_error
c_send:
mov al, bl
out 0x64, al
mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
c_accept:
in al, 0x64
test al, 2
jz c_ok
loop c_accept
c_error:
mov ah, 1
jmp c_exit
c_ok:
xor ah, ah
c_exit:
ret
setmouse: ; set mousepicture -pointer setmouse: ; set mousepicture -pointer
; ps2 mouse enable ; ps2 mouse enable