📄 e0post.asm
字号:
call F000_Out_8042_Full ; wait til output buffer full
jz short p5_91_1
;use cpu loop in case refresh is not stable in this stage
mov al,55H ; clear bus
in al,DATA8042 ; get returned value...
NEWIODELAY
cmp al,KB_ACK ; ack?
je short p5_41 ; yes...
p5_40:
;Resend command if received data is not 0FAH or 0AAH
dec dl ; retries left?
jnz short p5_4 ; yes...
jmp short p5_91_1
;
; Check return code
;
p5_41:
mov cx,10
delay_for_kbd_reset:
push cx
xor bx,bx
mov cx,256*2 ; wait 512*30 microseconds = 6.7 milliseconds
call wait_refresh1
call F000_Out_8042_Full ; wait for output buffer to be full
pop cx
loopz delay_for_kbd_reset
in al,DATA8042
NEWIODELAY
cmp al,0aah ; all OK?
jne short p5_40 ; no, error
;
; Return with no error
;
p5_9:
jmp short Keybord_Init_Exit
p5_91_1:
or byte ptr CMOS_STATUS[bp],EQUIP_STATUS+KBD_STATUS
;R280 - start
ifdef ACPI_SUPPORT
call E_F000_Shadow_W
push es
mov ax,0F000h
mov es,ax
mov si,offset DGROUP:ACPI_Info_Byte
or byte ptr es:[si],01h
pop es
call E_F000_Shadow_R
endif ;ACPI_SUPPORT
;R280 - end
Keybord_Init_Exit:
mov al,0aeh ; disable keyboard interface
call F000_Out_8042
popf
ret
Reset_Kb endp
;[]==========================================================[]
;KBD_A20_OFF
;
; Procedure to disable GATE A20 on the keyboard
; controller. This is necessary for FAST A20
; operation because if KBD A20 is enabled, gate A20
; cannot be disabled with FAST A20 (the A20 line
; will always be enabled which will screw up any
; software that needs the 1 meg wrap around.
;
; INPUT: NONE
; OUTPUT: KBD gate A20 is disabled
;
; SAVES: AX BX CX DX
;
;[]==========================================================[]
ALIGN 4
PUBLIC KBD_A20_OFF
KBD_A20_OFF PROC NEAR
push ax
mov al,0ddh ;gate a20 off command
push ds
push 0f000h
pop ds
lea bx,SPD_DEF
test byte ptr [bx],01H
pop ds
jz short No_Active_Low
and al,11110011b ;set 23 and 24 pins low
No_Active_Low:
a20_op:
push bx
push cx
push dx
push ax
call F000_Buffer_8042_Full ; wait for kb inbuff empty
jnz short a20_op_bad ; return if empty
mov al,0D1h ; write output port command
out STAT8042,al
call F000_Buffer_8042_Full ; and wait
jnz short a20_op_bad ; timeout, jump out of here
pop ax ; command byte
out DATA8042,al
call F000_Buffer_8042_Full ; and make sure got there
jz short a20_op_ret
push ax ; push junk onto stack
a20_op_bad:
pop ax ; get junk off stack
stc ; set carry for error
a20_op_ret:
pop dx
pop cx
pop bx
pop ax
ret
KBD_A20_OFF ENDP
;[]==============================================================[]
;
; POST_1S:
;
; Force default values into almost everything, including
; CMOS timers, math coprocessor, timers, DMA controllers,
; interrupt controller, basic video, etc.
;
;Saves: NONE + NO STACK
;
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_1S PROC NEAR
;0810; start
;for run time decompress code ret
mov bx,2000h
mov es,bx
;R260 start
ifdef FLASH_64k_unit
;----- move 1000h:0(decompress code) to 2000h:0 -----
sub bh,10h
mov ds,bx ;source segment
xor si,si ;source offset
xor di,di ;destination offset
mov cx,4000h
cld
rep movsd
;----------------------------------------------------
else ;FLASH_64k_unit
;R260 end
mov byte ptr es:[0dfffh],0CBh ;machine code for retf
;R266 mov si,Temp_VGA_Seg
;R266 mov ds,si
;R266 mov si,Temp_VGA_Off
;R266 mov ax,ds:[si+4] ;get expand offset
;R266 mov di,Temp_Exp_Seg
;R266 mov es,di
;R266 mov di,Temp_Exp_Off
;R266 mov es:[di+4],ax
;R266 cmp ax,0ffffh ;no full screen logo?
;R266 je short No_Full_Scr_Logo ;Yes,skip
;R266 mov ax,ds:[si]
;R266 mov es:[di+4],ax
;R266 mov ax,ds:[si+2]
;R255A ifndef linear_rom_support ;R255
;R255A shr ax,12 ;R236
;R255A endif ;linear_rom_support ;R255
;R266 mov es:[di+6],ax
;R266No_Full_Scr_Logo:
endif ;FLASH_64k_unit ;R260
mov di,(XGroup_Expand_Address+1)*4+8000h;;;;;(7fh+1)*4+8000h ;XGROUP index
mov si,Xgroup_Segment
call POST_decompress
;R255A ifdef linear_rom_support ;R255
jc short not_xgroup ;R255
;R255A endif ;linear_rom_support ;R255
;0810; end
call Restore_WarmFlag
;R267 IF BUS_TYPE EQ EISA_BUS
;R267 call Eisa_Early_Init
;R267 ENDIF ;BUS_TYPE
;R255A ifdef linear_rom_support ;R255
not_xgroup: ;R255
;R255A endif ;linear_rom_support ;R255
clc
ret
POST_1S ENDP
POST_2S:
ret
;[]========================================[]
; Restore_WarmFlag
; Clear warm boot flag stored in CMOS for next warm reset
;Saves: NONE
;Entry: NONE
;Exit: None
;[]========================================[]
Restore_WarmFlag proc near
ifdef PCI_RESET_SUPPORT
mov ax,G_RAM
mov ds,ax
assume ds:G_RAM
mov al,0FH NMI_OFF
call F000_Get_Cmos
cmp al,0AAH
jne short Not_WarmBoot
mov word ptr ds:USER_REBOOT, CTRL_ALT_DEL ; warm boot
;clear warm boot flag
mov al,0FH NMI_OFF
xor ah,ah
call F000_Set_Cmos
Not_WarmBoot:
endif; PCI_RESET_SUPPORT
ret
Restore_WarmFlag endp
;[]==============================================================[]
; POST_3S:
; Superio_Early_Init
; for some superio cann't Init at Earlyio.asm
;Saves: NONE
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_3S PROC NEAR
ifdef PNP_BIOS
ifdef NEW_SUPERIO_KERNEL
call Superio_Early_Init
endif ;NEW_SUPERIO_KERNEL
endif; PNP_BIOS
clc
ret
POST_3S ENDP
POST_4S:
ret
;Begin move keyboard stuff
;[]==============================================================[]
;
; POST_5S:
;
; Blank out the video screen.
;
;Saves: NONE + NO STACK
;
;Entry: NONE
; Exit: C Set if fatal error
;
;[]==============================================================[]
POST_5S PROC NEAR
ifdef RPB_ENABLED
ifndef RPB_NOVIDEO
extrn rpb_set_bios_error:near
xor cx,cx
call rpb_set_bios_error ; clear error bits
endif
endif ; RPB_ENABLED
;
;
; Blank out the video screen
;
ifndef DTK_PCI_BOARD
in al,64H ;keyboard controller read status
test al,04H ;power up ?
jz short KB_alread_installed ;skip if yes
mov dx,03c0h ;Attribute controller index register
xor al,al
out dx,al ;index to color palette
NEWIODELAY
out dx,al ;Blank color palette
NEWIODELAY
KB_alread_installed:
endif ;DTK_PCI_BOARD
;
; Clear CMOS status byte
;
mov al,CMOS_ERROR NMI_OFF
xor ah,ah
call F000_Set_Cmos ; reset status byte
clc
ret
POST_5S ENDP
POST_6S:
ret
;[]==============================================================[]
; POST_7S:
; Initialize the keyboard.
;Saves: NONE
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_7S PROC NEAR
;; Note : Switch "Special_KB_Test" will cause system hang up if
;; Phoneix Multi-Key KBC is used (like W83627F-PW).
;;
;=======================================
; Clear 8042 interface...
;=======================================
xor cx,cx
Init_KB_start:
in al,STAT8042 ; see if any data
NEWIODELAY
test al,IBF_8042+OBF_8042 ; any input and/or output?
jz short KB_Self_test_start; no, next part of test
ifdef Special_KB_Test ;
jmp short Init_KB_Failed ; IBF & OBF must be cleared
endif; Special_KB_Test ;
test al,OBF_8042 ; input?
jz short Init_KB_Wait ; no, just keep waiting
in al,DATA8042 ; yes, clear out data
NEWIODELAY
Init_KB_Wait:
loop short Init_KB_start
Init_KB_Failed:
call PCI_RESET ; failure of 8042
ret
;======================================================
; Tell 8042 to do self-test
;======================================================
KB_Self_test_start:
mov bl,10 ;self-test loop
KB_Self_test:
mov al,TEST_KBRD
out STAT8042,al ; send self-test cmd.
NEWIODELAY
call F000_Buffer_8042_Full ; wait for buffer to clear
jnz short Init_KB_Failed ; failure of 8042
call F000_Out_8042_Full ; wait for 8042 output to be full
jz short Init_KB_Failed ; IBF & OBF must be cleared
; yes, error...
in al,DATA8042
NEWIODELAY
cmp al,055h ; any errors on keyboard ctlr?
je short KB_SW_Delay
dec bl ;;self-test loop counter -1
jnz short KB_Self_test
KB_SW_Delay:
ifndef No_Keyboard_Switch_Delay
; Auto-switch delay
mov cx,8000h
loop short $
endif ;No_Keyboard_Switch_Delay
ret
POST_7S ENDP
;[]==============================================================[]
; POST_8S:
; Special KeyBoard Test
;Saves: NONE
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_8S PROC NEAR
;================================================
; Set 8042 command byte
;================================================
ifdef Special_KB_Test
in al,STAT8042
test al,OBF_8042 ; Check OBF
jz short Dis_Mouse
in al,DATA8042 ; clear output Buffer
Dis_Mouse:
mov al,0a7h ; Disable Mouse
out STAT8042,al
NEWIODELAY
call F000_Buffer_8042_Full ; wait for input buffer to be empty
jnz short Special_KB_Test_Failed_1 ; timeout error
mov al,0cah ; Test PS2/AT Mode
out STAT8042,al
call F000_Buffer_8042_Full ; wait for buffer to clear
jnz short Special_KB_Test_Failed_1 ; timeout error
call F000_Out_8042_Full ; wait output buffer full
jz short Special_KB_Test_Failed_1 ; timeout error
in al,DATA8042
test al,1
jz short Special_KB_Test_Failed_1 ; mode error
mov al,0d2h
out STAT8042,al ; write KBD output buffer
NEWIODELAY
call F000_Buffer_8042_Full ; wait for buffer to clear
jnz short Special_KB_Test_Failed
mov al,0aah
out DATA8042,al
NEWIODELAY
jnz short Special_KB_Test_Failed
call F000_Out_8042_Full
jz short Special_KB_Test_Failed
in al,DATA8042
cmp al,0aah
jnz short Special_KB_Test_Failed
mov al,0aah
out STAT8042,al
call F000_Buffer_8042_Full ; wait for buffer to clear
jnz short Special_KB_Test_Failed
call F000_Out_8042_Full
jz short Special_KB_Test_Failed
in al,DATA8042
cmp al,055h
jz short Special_KB_Enable
Special_KB_Test_Failed_1:
jmp short Special_KB_Test_Failed
Special_KB_Enable:
mov al,0f4h ; Default enable
out DATA8042,al
P5_32: call F000_Buffer_8042_Full ; wait for buffer to clear
jnz short Special_KB_Test_Failed ; timeout error
P5_33: in al,STAT8042
test al,40h ; General Time out ??
jnz short P5_39 ; Yes, KB is not connected
test al,01h ; Output Buffer Full??
jz short P5_33 ; No!!
in al,DATA8042
cmp al,0fah
jnz short Special_KB_Test_Failed
P5_39:
endif; Special_KB_Test
ifndef Special_Patch_For_Abit_P6
mov al,60h ; 60h = write 8042 command byte
out STAT8042,al
NEWIODELAY
call F000_Buffer_8042_Full ; wait for input buffer to be empty
jnz short Special_KB_Test_Failed ; timeout error...
mov al,45h ; AT interface, keyboard enabled, system flag
out DATA8042,al
NEWIODELAY
call F000_Buffer_8042_Full ; wait for input buffer to be empty
jnz short Special_KB_Test_Failed ; timeout error...
endif; Special_Patch_For_Abit_P6
mov al,ENABLE_KBRD ;enable keyboard
out STAT8042,al
newiodelay
call F000_Buffer_8042_Full ; wait for input buffer to be empty
jnz short Special_KB_Test_Failed ; timeout error...
ret
Special_KB_Test_Failed:
call PCI_RESET ; failure of 8042
ret
POST_8S ENDP
POST_9S:
ret
;[]==============================================================[]
; POST_10S:
; Mouse Init
;Saves: NONE
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_10S PROC NEAR
ifndef DISABLE_PS2_AT_POST5
call Check_PS2_Mouse_Support
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -