⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pmupost.asm

📁 惠普公司bios完整源代码大机密!
💻 ASM
📖 第 1 页 / 共 5 页
字号:
Reset_8237	Proc	near
		push	ds
		mov	ax,0f000h		;segment address
		mov	ds,ax

		mov	si,offset DGROUP:SYS_INITS
		mov	cx,SIZE_SYS_INITS
		cld

;
;	Initialize everything except for DMA page registers
;

ch0_dma_init:
		lodsw				; get the port
		mov	dx,ax			; put in correct reg

		mov	al,cl
		out	80h,al

		lodsb				; get byte to ouput
		out	dx,al

		IODELAY

		loop	short ch0_dma_init

;
;	Initialize page registers
;

		mov	cx,0fh
		mov	dx,81h
		xor	ax,ax


init_pg_regs:
		IODELAY

		out	dx,al
		inc	dx

		loop	short init_pg_regs

		pop	ds

		ret
Reset_8237	endp
endif	;S3_SUPPORT

;R35 - starts
ifndef	Not_Init_Cyrix			;R35A
;[]==============================================================[]
; F_Init_Cyrix : (POST 09h) (CPUPOST.asm INIT_CYRIX )
;	Program chipset register for CYRIX CPU
; Input : None
; Output: None
; Save: all
; [Note]: 1. Just return if chipset did not need programming
;[]==============================================================[]
		public	F_Init_Cyrix
F_Init_Cyrix   proc    near

;R35A ifndef	Not_Init_Cyrix

		pusha
		mov	ax,cs
		mov	ds,ax
		mov	si,offset Ct_Cyrix_Reg
		mov	cx,NO_OF_Ct_CYRIX_REG
		or	cx,cx
		jz	short No_Cy_Reg
Write_Cyrix:
		lodsw
		out	22h,al
		xchg	ah,al
       		out	23h,al
		NEWIODELAY
		loop	short Write_Cyrix
No_Cy_Reg:

		popa
;R35A endif	 ;Not_Init_Cyrix

		ret			; Dummy Return
F_Init_Cyrix   endp

;R35A ifndef	Not_Init_Cyrix
Ct_Cyrix_Reg:

		   db   0c1h,082h    ;enable Smi

                   db 	0cdh,000h    ;Set SmBase = 0a800h
		   db 	0ceh,00ah
		   db   0cfh,084h    ;Size = 32k

NO_OF_Ct_CYRIX_REG EQU	($ - Ct_Cyrix_Reg) / 2

;[]=======================================================[]
;	Input	:	None
;	Output	:	ZF
;[]=======================================================[]
		Public	StrCheckCyrix
StrCheckCyrix	Proc	Near
		pushad
		mov	al,0C3h
		out	22h, al
		NEWIODELAY
		in	al, 23h
		NEWIODELAY
		cmp	al, 0ffh
		popad
		ret
StrCheckCyrix	Endp
endif	;Not_Init_Cyrix
;R35 - ends
;[]-------------------------------------------------------------------[]
;
; PPPPPPPP	 AA	  RRRRRRRR   TTTTTTTTTTT	       111
; PPPPPPPPP	AAAA	  RRRRRRRRR  TTTTTTTTTTT    ***       1111
; PPP	 PPP   AAAAAA	  RRR	 RRR	 TTT	    ***      11111
; PPPPPPPPP   AAA  AAA	  RRRRRRRRR	 TTT		       111
; PPPPPPPP   AAAAAAAAAA   RRRRRRRR	 TTT	    ***        111
; PPP	    AAAAAAAAAAAA  RRR	RRR	 TTT	    ***        111
; PPP	   AAA	      AAA RRR	 RRR	 TTT		       111
;
;
;   1. Standard routines that must be filled in to let the BIOS KERNAL
;      to program the PMU registers
;   2. Called during POST & after POST
;
;[]-------------------------------------------------------------------[]
;[]==============================================================[]
; Disable_E000_ROM_Shadow : (POST 63h)
;	Disable E000 ROM Shadow (Direct Access to ISA)
; Input : None
; Output: None
; Save: all
;[]==============================================================[]
		public	Disable_E000_ROM_Shadow
Disable_E000_ROM_Shadow	proc	near

	;disable E0000 shadow RAM
ifdef	VT8371
		mov	cx,VT8371 + 63h		;R04
		mov	bl,NOT 0c0H		;R04
		call	Get_Set_Ct_AND		;R04
		xor	eax, eax		;disable E-segment shadow
		mov	ecx,MTRRfix4k_E000
		call	K7_FixMtrr32K_Wr
else;	VT8371
		mov	cx,VT694X + 63h
		mov	bl,NOT 0c0H
		call	Get_Set_Ct_AND
endif;	VT8371

	;disable onboard E0000 ROM
		mov	cx,VT586 + 43h
		mov	bl,NOT 30H
		call	Get_Set_Ct_AND

		ret
Disable_E000_ROM_Shadow	endp
;[]==============================================================[]
;E000_Shadow_R:
;	Set video BIOS(E000-E800) shadow readonly
;Input : none
;Output: none
;[]==============================================================[]
		Public	E000_Shadow_R
E000_Shadow_R   proc    near
ifdef	VT8371
		mov     cx,VT8371 + 63h		;R04
		mov	bx,803fh		;R04
		call    GET_SET_PMU		;R04
		call	Enable_FixMtrr_Mod
		mov	eax,MemWPr		;Memory type=Mem-WP-R(15h)
		mov	edx,eax
		mov	ecx,MTRRfix4k_E000
		WRMSR				;E seg lower 32k
		inc	cl
		WRMSR				;E seg upper 32k
		WBINVD
		call	Disable_FixMtrr_mod
else;	VT8371
;R04B		extrn	GET_SET_CT:near
		mov     cx,VT694X + 63h
		mov	bx,803fh
		call    GET_SET_CT
endif;	VT8371
		ret
E000_Shadow_R   endp

		Public	E000_64k_Shadow_R
E000_64k_Shadow_R   proc    near
ifdef	VT8371
		mov     cx,VT8371 + 63h		;R04
		mov	bx,803fh		;R04
		call    GET_SET_PMU		;R04
		mov  	eax, 10101010h		;WB & Readonly
		mov	ecx,MTRRfix4k_E000
		call	K7_FixMtrr32K_Wr
else;	VT8371
		jmp	E000_Shadow_R
endif;	VT8371
E000_64k_Shadow_R   endp

;R45 - start
ifdef	VT8601
		Public	Int15_Func5F
Int15_Func5F   proc    near
		pushf
		;---------------;
		;   Func 11h	;
		;---------------;
		cmp	al,11h
		jnz	Not_AL_11h
		cmp	bx,0h
		jnz	Not_AL_11h
	ifdef	VIA_TV_Out_Support
		mov	cx,01h		; CX = 1 : VIA TV Capture On
	else;	VIA_TV_Out_Support
		xor	cx,cx		; CX = 0 : TV Capture Off
	endif;	VIA_TV_Out_Support
		jmp	short Int15_Func5F_Ok_
	Not_AL_11h:
		;---------------;
		;   Func 02h	;
		;---------------;
		cmp	al,02h
		jnz	Not_AL_02h
	ifdef	VIA_TV_Out_Support
		mov	dx, 70h
		mov	al, VIA_TV_Out_CMOS
		out	dx, al
		inc	dx			 ; AL = 00h : NTSC TV Out Support.
		in	al, dx			 ; AL = 01h : PAL TV Out Support.
		push	cx
		xor	cx, cx
		mov	dl, VIA_TV_Out_CMOS_BITS
Cal_CMOS_Bits:					;caluation CMOS bits loc
		shr	dl, 1
		inc	cl
		cmp	dl ,01h
		jne	short Cal_CMOS_Bits
		dec	cl
		cmp	cl, 0h
		jz	short Set_CMOS_Loc
Get_CMOS_Loc:
		shr	al, 1
	     	loop	short Get_CMOS_Loc
Set_CMOS_Loc:					;set cmos to bit[0,1]
		and	al, 03h
		cmp	al, 02h			; AL = 03h : BRAJIL TV Out Support.
		pop	cx
		je	short Is_BRAJIL
		jmp	short Int15_Func5F_Ok_
Is_BRAJIL:
		inc	al
	else;	VIA_TV_Out_Support
		mov	al,02h		; AL = 02h : No TV Out Support.
	endif;	VIA_TV_Out_Support
		jmp	short Int15_Func5F_Ok_
	Not_AL_02h:
   Int15_Func5F_Fail_:
		popf
		stc
		ret

   Int15_Func5F_Ok_:
		xor	ah,ah		; AH = 0 : Success.
		popf
		clc			; CY = 0 : Success.
		ret
Int15_Func5F   endp
endif;	VT8601
;R45 - end

;[]========================================================================[]
;Procedure:	Get_PM_IRQ
;
;Function :	Tell BIOS which IRQ is PMI using
;
;Input	  :	None
;
;Output   :	NC:
;			AL = 1	- PMI using IRQ 15
;			AL = 2	- PMI using NMI
;			AL = 3	- PMI using SMI
;		CF:
;			No IRQ or NMI or SMI is available
;
;Preserve :	All except AX & FLAG
;
;Note	  :	1. Stack available
;		2. called from PM_Init
;[]========================================================================[]
		Public	Get_PM_IRQ
Get_PM_IRQ	Proc	Near
		mov	al,03h		;always SMI for PENTIUM CPU
		clc
		ret
Get_PM_IRQ	Endp

;[]========================================================================[]
;Procedure:	Check_PM_Using_NMI
;
;Function :	To handle the NMI which is caused by a PMU
;
;Input	  :	None
;
;Output   :	None
;
;Saves	  :	Please save all registers
;
;[Note]   :	1. Called every time a NMI is occured
;		2. check to see if this SMI is issue by PMU
;
;		     if PMI ;  Serve the PMI then
;
;			       sti
;			       iret
;
;		     if not PMI : jump back to a external label(near)
;				  named "NMI_Original" & do nothing!
;
;		   So if your chip never use NMI, just "jmp NMI_Original"!
;
;[]========================================================================[]
		Public	Check_PM_Using_NMI
Check_PM_Using_NMI:
PM_Not_NMI:
		extrn	NMI_Original:near
		jmp	NMI_Original

;[]-------------------------------------------------------------------[]
;
; PPPPPPPP	 AA	  RRRRRRRR   TTTTTTTTTTT	       2222222
; PPPPPPPPP	AAAA	  RRRRRRRRR  TTTTTTTTTTT    ***       22222222
; PPP	 PPP   AAAAAA	  RRR	 RRR	 TTT	    ***      222  222
; PPPPPPPPP   AAA  AAA	  RRRRRRRRR	 TTT			 222
; PPPPPPPP   AAAAAAAAAA   RRRRRRRR	 TTT	    *** 	222
; PPP	    AAAAAAAAAAAA  RRR	RRR	 TTT	    ***        2222222
; PPP	   AAA	      AAA RRR	 RRR	 TTT		      22222222
;
;
;		Called during POST Only
;
;[]-------------------------------------------------------------------[]

;[]========================================================================[]
;Procedure:	Ct_Check_Green_VGA
;
;Function :	To tell BIOS kernel that if the VGA adaptor's V/H SYNC
;		signal should be turned off or not when video off.
;		This should refer to the setup setting.
;
;Input    :	None
;
;Output   :	ZF : don't turned off V/H SYNC
;		NZ : V/H SYNC can be turned off
;
;Note	  :	1. Some VGA adaptors use V/H SYNC signals for special
;		   purpose, e.g. TSENG LAB use them for DRAM refresh.
;		   Therefore, these signals must never be turn off
;		   at any time.
;		2. called from POST at POST 82
;[]========================================================================[]
			Public	Ct_Check_Green_VGA
Ct_Check_Green_VGA	Proc	Near
		pushad
		mov	si,offset VGA_Type_Item
		call	GetItem_Value
		or	al,al
		popad
		ret
Ct_Check_Green_VGA	Endp

;[]==============================================================[]
;Input: None
;Function :	To see if it is a SMI
;[]==============================================================[]
			Public	Ct_Check_SMI_Start
Ct_Check_SMI_Start	Proc	Near

		extrn	Not_SMI_Start:near
		jmp	Not_SMI_Start

Ct_Check_SMI_Start	Endp

;[]==============================================================[]
;Procedure:	PM_Option_Check
;
;Function :	Get PM option
;
;Input	  :	None
;
;Output   :	1. ZF  - User Defined!
;			 i.e. use CMOS value to prg PM chip
;
;		   NZ  - Use Pre-defined value to prg PM chip
;			 AL = PM option
;			    i.e. DISBLED
;				 MAX-POWER_SAVING
;				 MIN-POWERING-SAVING....
;			 SI = offset of auto-table
;			    i.e. MIN_PM_SAVING_TABLE
;				 MAX_PM_SAVING_TABLE
;				 PM_DISABLE_TABLE	   in file PFEATURE.ASM
;
;		2. CF  - Global Power Management should be disabled
;
;		   NC  - Global Power Management should be enabled
;
;Registers :	FLAGS, AX, SI - destroyed
;		Others	      - should be preserved
;[]==============================================================[]
		Public	PM_Option_Check
PM_Option_Check Proc	Near
		mov	si,offset cs:PM_Option_Item
		call	GetItem_Value
		mov	cl,al
		xor	ch,ch

		mov	si,offset cs:PM_Auto_Table
		shl	cx,1
		dec	cx
		add	si,cx
		mov	si,cs:[si]

PM_Option_Check_Exit:

		cmp	al,1			;PM disabled?
		je	short @F		;yes

	;if PM option is "user defined" then OEM routine should
	;check here for both items disabled

		or	al,al			;set/clear Zero Flag
		clc
		ret

	@@:
		or	al,al			;set/clear Zero Flag
ifdef Set_APM_According_PM_Setup
		stc				;indicate PM disable
else; Set_APM_According_PM_Setup
		clc				;indicate PM disable
endif; Set_APM_According_PM_Setup

		ret
PM_Option_Check Endp

;[]==================================================================[]
;Procedure:	Ct_Global_PM_Disable
;
;Function :	To disable all power management features
;
;Input	  :	None

;Output   :	None
;
;Registers:	all registers preserved
;
;[Note]   :	called from PM_INIT before PM_RAM is available
;[]==================================================================[]
			Public	Ct_Global_PM_Disable
Ct_Global_PM_Disable	Proc	Near
		pusha
ifdef	USB_SUPPORT
		POST_FUNC_CALL	Ct_Check_Usb_Disabled
		jnc	short @f
endif	;USB_SUPPORT
	@@:
		popa
		ret
Ct_Global_PM_Disable	Endp

;[]==================================================================[]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -