📄 e0post.asm
字号:
jz short No_Mouse_Support
endif ;DISABLE_PS2_AT_POST5
ifndef No_Disable_PS2_Mouse_In_POST5
mov al,0A7H ; disable mouse interface
out STAT8042,al
newiodelay
call F000_Buffer_8042_Full ; wait for input buffer to be empty
endif; No_Disable_PS2_Mouse_In_POST5
No_Mouse_Support:
ifdef KBC_KBDMOUSE_SWAP
call KbdMouse_Swap
endif; KBC_KBDMOUSE_SWAP
ifdef MOUSE_BUTTON_ON_SUPPORT
if Early_Init_PS2Mouse
call Init_Ps2Mouse_Proc
endif; Early_Init_PS2Mouse
endif; MOUSE_BUTTON_ON_SUPPORT
ifdef Special_KB_Test
call Reset_Kb ;reset KB
endif; Special_KB_Test
ret
POST_10S ENDP
POST_11S:
ret
ifdef KBC_KBDMOUSE_SWAP
KbdMouse_Swap proc near
call Special_KBC_Init
call Free_8042_Ibuf ;wait for input buffer free
mov al,0aeh ;enable keyboard
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
mov al,0a8h ;enable PS2 mouse
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
;Read data to clear self test
mov dl,6 ;try 6 times
DataRetry:
xor cx,cx ;timeout count
DataRd_Loop:
in al,64h
test al,1 ;output buffer full ?
loopz short DataRd_Loop
jz short DataRd_Exit
in al,60h ;read data
dec dl
jnz short DataRetry
DataRd_Exit:
;Disable PS2 mouse
mov al,0a7h ;disable PS2 mouse
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
;Save keyboard controller command byte
mov al,20h ;read KBC command byte
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
call Full_8042_Obuf ;wait for output buffer full
mov bl,al ;save command byte
;Make primary connector keyboard
mov al,0c8h
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
;Issue read ID command to primary port
call Send_KbRdId
cmp al,0f2h ;check if mouse found on primary port
je short MouseOn_Pport
cmp al,0fah
jne short MoreChk_Needed
call Full_8042_Obuf ;wait for output buffer full
cmp al,0ffh ;mouse on primary port ?
je short MouseOn_Pport ;find ps2 mouse at PPort
or al,al ;check if mouse on primary port
je short MouseOn_Pport
call Full_8042_Obuf ;wait for output buffer full
MoreChk_Needed:
in al,64h
test al,40h ;check if keyboard found on Pport
jz short KbdOn_PPort
SwapIt:
;At this moment, nothing found on primary port
; Select secondary port
mov al,0d4h
; out 64h,al
; call Free_8042_Ibuf ;wait for input buffer free
;issue command to swap ports
ifndef Superio_KBC_KBDMOUSE_SWAP ;R281
call Swap_8042Port
;R281 - start
else ;Superio_KBC_KBDMOUSE_SWAP
Xcall Superio_Swap_KBC
endif ;Superio_KBC_KBDMOUSE_SWAP
;R281 - end
;Issue read ID command to secondary port
call Send_KbRdId
cmp al,0f2h ;check if mouse found on primary port
je short MouseOn_SPort
cmp al,0fah
jne short MoreChk_Needed_Sec
call Full_8042_Obuf ;wait for output buffer full
cmp al,0ffh ;mouse on secondary port ?
je short Make_primary_connector_keyboard
or al,al ;check if mouse on primary port
je short MouseOn_SPort
call Full_8042_Obuf ;wait for output buffer full
MoreChk_Needed_Sec:
in al,64h
test al,40h ;check if keyboard found on Pport
jz short NonOn_SPort
Make_primary_connector_keyboard:
mov al,0c8h
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
jmp short NonOn_SPort
MouseOn_Pport:
;issue command to swap ports
ifndef Superio_KBC_KBDMOUSE_SWAP ;R281
call Swap_8042Port
;R281 - start
else ;Superio_KBC_KBDMOUSE_SWAP
Xcall Superio_Swap_KBC
endif ;Superio_KBC_KBDMOUSE_SWAP
;R281 - end
KbdOn_PPort:
MouseOn_SPort:
NonOn_SPort:
;Restore keyboard controller command byte
mov al,60h ;write KBC command byte
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
mov al,bl
out 60h,al
call Free_8042_Ibuf ;wait for input buffer free
ret
KbdMouse_Swap endp
Swap_8042Port proc near
mov al,0c9h
out 64h,al
call Free_8042_Ibuf ;wait for input buffer free
ret
Swap_8042Port endp
Send_KbRdId proc near
mov al,0f2h
out 60h,al
call Free_8042_Ibuf ;wait for input buffer free
call Full_8042_Obuf ;wait for output buffer full
ret
Send_KbRdId endp
Free_8042_Ibuf:
in al,64h ;get status
test al,02h ;input buffer
jnz short Free_8042_Ibuf
ret
Full_8042_Obuf:
push cx
push dx
mov dl, 6
aa:
xor cx, cx
@@:
in al,64h
test al,01h ;output buffer
jnz short Full_8042_Obuf_EXIT
loop short @b
dec dl
jnz short aa
Full_8042_Obuf_EXIT:
in al,60h ;read input data
pop dx
pop cx
ret
endif; KBC_KBDMOUSE_SWAP
;[]==================================================[]
; PCI Reset
;Saves: NONE
;Entry: NONE
;Exit: Carry set
;
;[]==================================================[]
PCI_Reset:
stc
ifdef FIX_W83C43_BTC5339
;issue hardware reset signal to reset keyboard controller
mov dx,0cf9h
mov al,2 ;enable hardware reset
out dx,al
NEWIODELAY
mov al,6 ;issue reset
out dx,al
endif; FIX_W83C43_BTC5339
ifdef ALiM153x_Hardware_RESET
mov eax,80001044H ;index port
mov dx,0cf8H
out dx,eax
NEWIODELAY
mov dl,0fcH
mov al,80h
out dx,al
NEWIODELAY
mov al,0feh
out 64h,al
jmp $
endif ;ALiM153x_Hardware_RESET
ifdef VIA_PCI_RESET
ifndef No_Cut_IRQ12_When_No_PS2_Pluged ;R167E
Disable_VIA_PS2_In_PCI_RESET EQU 1 ;R167E
endif; No_Cut_IRQ12_When_No_PS2_Pluged ;R167E
IFDEF Disable_VIA_PS2_In_PCI_RESET ;R167D - start
mov eax,80000000H + VT586 + 058h ;Release IRQ12
mov dx,0cf8H
out dx,eax
NEWIODELAY
mov dl,0feH ;Register 5Ah Bit 1
in al,dx
NEWIODELAY
and al,not 02H ;Clear Bit 1
out dx,al
ENDIF; Disable_VIA_PS2_In_PCI_RESET ;R167D - end
ifdef VT586_ACPI
mov eax,80000000H + VT586_ACPI + 40h
mov dx,0cf8H
out dx,eax
NEWIODELAY
mov dl,0fdH ;Register 41h Bit 7
in al,dx
NEWIODELAY
and al,not 80H ;Clear Bit 7
out dx,al
endif; VT586_ACPI
ifndef VT596 ;R167C
mov eax,80000000H + VT586 + 08h ; index port
mov dx,0cf8H
out dx,eax
NEWIODELAY
mov dl,0fcH ;register 08H = Revision
in al,dx
cmp al,22h
jb @f
endif; VT596 ;R167C
mov eax,80000000H + VT586 + 44h ; index port
mov dx,0cf8H
out dx,eax
NEWIODELAY
mov dl,0ffH ;register 47H bit 0 to reset
in al,dx
NEWIODELAY
or al,01H ;enable system reset
out dx,al
jmp $
@@:
endif ;VIA_PCI_RESET
ifdef SIS_5598_PCI_RESET
mov dx,0cf9h
mov al,0ch ;issue CPU reset
out dx,al
jmp short $
endif; SIS_5598_PCI_RESET
ret
;[]==============================================================[]
;POST_12S:
;Saves: NONE
;Entry: NONE
;Exit: NONE
;[]==============================================================[]
POST_12S PROC NEAR
ret
POST_12S ENDP
;[]==============================================================[]
;POST_13S:
;Saves: NONE
;Entry: NONE
;Exit: NONE
;
;[]==============================================================[]
POST_13S PROC NEAR
ret
POST_13S ENDP
;[]==============================================================[]
;
; POST_14S:
;
; Checksum the ROM. There are four basic checksums:
; the entire BIOS, the sign-on message, the evaluation
; message and the ATORGS region.
;
;Saves: NONE + NO STACK
;
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_14S PROC NEAR
ifdef PATCH_FOR_NEC_SDRAM
RESET_CMOS EQU 37H+80H
mov al,RESET_CMOS
call F000_Get_Cmos
cmp al,0BBH ;second boot ?
je short Not_1stBoot
call Check_Warm_Boot
je short Not_1stBoot
mov al,RESET_CMOS
mov ah,0BBH ;mark second boot flag
call F000_Set_Cmos
mov si,0e000h ;from e000:0
mov di,02000h ;to 2000:0
mov cx,8000h
call E000_Move_Codes
far_jmp <offset DoReset>,02000h
DoReset:
;clear register of 59H to disable F000 shadow
mov eax,80000058H ;enable PCI config.
mov dx,0cf8h
out dx,eax
add dl,5 ;start from 0cfch
xor al,al ;disable F000 shadow
out dx,al
;issue CPU reset
ifdef PATCH_FOR_NEC_SDRAM_USE_CPU_RESET
mov al,4
mov dx,0cf9h
out dx,al ;CPU reset
else; PATCH_FOR_NEC_SDRAM_USE_CPU_RESET
mov al,0feh ;
out 64h,al ;
endif; PATCH_FOR_NEC_SDRAM_USE_CPU_RESET
Not_1stBoot:
mov al,RESET_CMOS
xor ah,ah ;mark not second boot flag
call F000_Set_Cmos
endif; PATCH_FOR_NEC_SDRAM
;----- Test F000h segment shadow readable and writeable
;----- for POST access correct
Test_Address equ 10h
Test_Address1 equ 8010h
F000_Shadow_Err equ 0EFh
call E_F000_Shadow_W
mov ax,0f000h
mov ds,ax
mov ecx,ds:[Test_Address] ;save original pattern
mov edx,ds:[Test_Address1] ;save original pattern
mov dword ptr ds:[Test_Address],55aa33cch
mov dword ptr ds:[Test_Address1],0cc33aa55h
cmp dword ptr ds:[Test_Address],55aa33cch
je short Check_F_next
F000_Err_Out:
;Display error code at 80H if F-segment shadow RAM can not be
;accessed.
POST_CODE F000_Shadow_Err
;
; Short beeps loop
;
Shadow_Err_Beep:
mov dl,2
align 4
short_beep: MOV BL,1
call E000_Snd_Spkr
xor cx,cx
loop $
dec dl
jnz short short_beep
loop $
loop $
loop $
loop $
jmp short Shadow_Err_Beep
Check_F_next:
cmp dword ptr ds:[Test_Address1],0cc33aa55h
jne short F000_Err_Out
mov ds:[Test_Address],ecx ;restore original pattern
mov ds:[Test_Address1],edx ;restore original pattern
call E_F000_Shadow_R
clc
ret
POST_14S ENDP
POST_15S:
ret
;[]==============================================================[]
;
; POST_16S:
; Check EEPROM type & copy write and erase subrotuine to 0F000h.
;
;Saves: NONE + NO STACK
;
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_16S PROC NEAR
ifdef FLASH_SUPPORT
ifdef AUTO_DETECT_EEPROM_ID
xcall Detect_EEPROM
endif ;AUTO_DETECT_EEPROM_ID
endif ;FLASH_SUPPORT
ret
POST_16S ENDP
POST_17S:
ret
;[]==============================================================[]
;
; POST_18S:
;
; Use walking 1's algorithm to check out interface to
; CMOS circuitry. Also set real-time clock power status.
; Then check for override.
;
;Saves: NONE + NO STACK
;Entry: NONE
;Exit: C Set if fatal error
;
;[]==============================================================[]
POST_18S PROC NEAR
if STD_Function EQ 1
mov al,0fh NMI_OFF ;Shutdown status command byte
call F000_Get_Cmos
mov bh,al
endif ;STD_Function EQ 1
mov ah,1 ; initial value
mov bl,ah ; save pattern
CMOS_Access_Test_Loop:
mov al,0fh NMI_OFF
call F000_Set_Cmos ; set shutdown
in al,80h ; change bus state
mov al,0fh NMI_OFF
call F000_Get_Cmos
cmp al,bl ; same as before?
jne short CMOS_Access_Test_fail ; no, test failed
or bl,bl ; done with test?
jz short CMOS_Access_Test_2 ; no, not finished yet
shl bl,1 ; test bit 0 ,1,,,7
mov ah,bl
jmp short CMOS_Access_Test_Loop
;
; If CMOS circuitry OK, reset CMOS_STATUS
;
CMOS_Access_Test_2:
if STD_Function EQ 1
mov ah,bh
mov al,0fh NMI_OFF
call F000_Set_Cmos
endif ;STD_Function EQ 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -