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

📄 pmupost.asm

📁 AWARD BIOS源代码,支持的CHIPSET请看文件,有同型号的板子烧上去就可以跑
💻 ASM
📖 第 1 页 / 共 5 页
字号:

		pusha
		mov	di,offset PM_RAM:PM_RAM_START
		mov	cx,PM_RAM_LEN
		xor	ax,ax
		cld
		rep	stosb
		popa
		ret

Clear_PM_RAM	Endp

;[]========================================================================[]
;Procedure:	Ct_PMRAM_Use_SYSRAM
;
;Function :	To tell the BIOS kernel that if you are using the SYSRAM
;		for PM_RAM
;
;Input	  :	None
;
;Output   :	AL = Size of PM_RAM that you want to reserved from SYSRAM.
;		0=None, 1=1K, 2=2k  etc.
;
;Save	  :	All registers except AL & FLAGS
;
;Note	  :	1. called before PM_INIT (POST 79)
;		2. simply return AL=0 if PM_RAM is located at shadow RAM
;		   or SMRAM
;		4. stack available
;[]========================================================================[]
		Public	Ct_PMRAM_Use_SYSRAM
Ct_PMRAM_Use_SYSRAM	Proc	Near
		xor	al,al
		ret
Ct_PMRAM_Use_SYSRAM	Endp

;[]========================================================================[]
;Procedure:	Ct_Early_PM_Init
;
;Function :	Early PM chip initializations
;
;Input	  :	None
;
;Output   :	None
;
;Preserve :	All
;
;Note	  :	1. Call from POST 9
;		2. Stack available
;		3. You can initialize any PM function which is needed
;		   to be done earlier!
;[]========================================================================[]
		Public	Ct_Early_PM_Init
Ct_Early_PM_Init	Proc	Near
 ifndef	MP_SUPPORT					;R75
		Post_Func_Call E000_Ct_Early_PM_Init
 endif;	MP_SUPPORT					;R75
		ret
Ct_Early_PM_Init	Endp

ifndef	New_Superio_Led_Function		;R42
ifdef	PM_LED_USE_GPIO				
F000_Set_PM_LED Proc	Far			
		call	Set_PM_LED		
		retf				
F000_Set_PM_LED Endp				
endif;	PM_LED_USE_GPIO				
ifdef	LED_Blinking_at_PM			
F000_Set_PM_LED_Blinking Proc	Far		
		call	Set_PM_LED_Blinking	
		retf				
F000_Set_PM_LED_Blinking Endp			
endif;	LED_Blinking_at_PM			
ifdef	POWER_LED_USE				
F000_Set_POWER_LED Proc	Far			
		call	Set_POWER_LED		
		retf				
F000_Set_POWER_LED Endp				
endif;	POWER_LED_USE				
;R42 - start
else	;New_Superio_Led_Function
ifdef	LED_Blinking_at_PM				
F000_LED_Flash	Proc	Far			
		call	Set_POWER_LED		
		retf				
F000_LED_Flash	Endp				
endif;	LED_Blinking_at_PM				
endif	;New_Superio_Led_Function

;R42Aifdef	Superio_Support_Fan
;R42AF000_Fan_Power_On Proc	Far
;R42A		call	Fan_Power_On
;R42A		retf
;R42AF000_Fan_Power_On Endp
;R42A
;R42AF000_Fan_Power_Off Proc	Far
;R42A		call	Fan_Power_Off
;R42A		retf
;R42AF000_Fan_Power_Off Endp
;R42Aendif;	Superio_Support_Fan
;R42 - end
;[]========================================================================[]
;Input	:	None
;Output	:	AL = 0 			 --> Currently MODEM Ring cannot 
;					     wake up system
;		AL = RING_WAKEUP_ENABLED --> Currently MODEM Ring can
;					     wake up system
;[]========================================================================[]
		Public	CT_RING_WAKEUP_STATUS
CT_RING_WAKEUP_STATUS	Proc	Near

		mov	cx, VT586_ACPI + 44h
		call	Get_PMU
		mov	bl,al
		mov	[WAKE_MODEM0],al

		mov	cx,VT586_ACPI + 45h
		call	Get_PMU
		mov	bh,al
		mov	[WAKE_MODEM1],al

		mov	cx, VT586_ACPI + 46h
		call	Get_PMU	
		or	bl,al

		mov	cx, VT586_ACPI + 47h
		call	Get_PMU	
		mov	bh,al

		mov	word ptr PM_RAM:[DEASSERT_STPCLK_IRQS],bx

		extrn	Modem_IRQ_Item:near
		mov	si, offset Modem_IRQ_Item
		call	GetItem_Value
		mov	word ptr [APM_Modem_IRQ], 0
		or	al, al
		jz	short @F

		mov	bx, 1
		mov	cl, al
		shl	bx, cl
		mov	word ptr [APM_Modem_IRQ], bx
		or	word ptr PM_RAM:[DEASSERT_STPCLK_IRQS],bx
		or	byte ptr [WAKE_MODEM0],bl		 
		or	byte ptr [WAKE_MODEM1],bh		 

		test	ax,bx
		mov	al, RING_WAKEUP_ENABLED		;current ON
		jnz	short @F
		xor	al, al				;current OFF
	@@:
		ret

CT_RING_WAKEUP_STATUS	Endp

;[]========================================================================[]
;Input	:	None
;Output	:	AL = 0 			--> PM Timer is currently disabled
;		AL = PMU_TIMER_ENABLED	--> PM Timer is currently Enabled
;[]========================================================================[]
		Public	CT_PMU_TIMER_STATUS
CT_PMU_TIMER_STATUS	Proc	Near

		mov	al, PMU_TIMER_ENABLED		;assume enabled 

		mov	cx,VT586_ACPI+50h
		call	Get_PMU
		test	al,80h
		jnz	short @F			;No
		xor	al, al				;all mode disable
	@@:
		ret

CT_PMU_TIMER_STATUS	Endp

;[]========================================================================[]
;Procedure:	Ct_PM_Final_Init
;
;Function :	PM initialization before boot
;
;Input    :	None
;
;Output   :	None
;
;Registers:	Please preserve all registers
;
;Note	  :	1. Call from POST 82
;		2. Stack available
;[]========================================================================[]
		Public	Ct_PM_Final_Init
Ct_PM_Final_Init	Proc	Near

ifdef	Move_F000_PMU_INIT_To_E000				
		Post_Func_Call E000_Ct_PM_Final_Init
else;	Move_F000_PMU_INIT_To_E000				

ifdef	Have_Conserve_Item
		mov	si,offset Conserve_Mode_Item
		call	GetItem_Value
		mov	bl,al
		shl	bl,4
else;	Have_Conserve_Item				
		xor	bl,bl
endif;	Have_Conserve_Item				
		mov	cx,VT586_ACPI + 53h
		call	Get_Set_PMU_OR

		mov	cl, 30h
		call	Set_PMIO_Clear

;R67		mov	ah,0			; Clear Y-M-D Alarm Setting.

;R67A		mov	al,32h			;R67 Set ACPI Century Field
;R67A		call	Get_Cmos		;R67  to the year of Now !
;R67A		mov	ah,al			;R67
;R67A		mov	al,7fh			;
;R67A		call	Set_Cmos		;
		mov	ah,0			;R67A Clear M-D Alarm Setting.

;R67B		xchg	al,ah			; Clear M-D Alarm Setting.
		mov	al,7eh			;
		call	Set_Cmos		;
		xchg	al,ah			;
		mov	al,7dh			;
		call	Set_Cmos		;
ifdef	Disable_ExtSMI_SW_In_POST
 		mov	cl, 01h			; Clear Power Buttom Status
 		call	Get_PMIO		;
 		call	Set_PMIO		;
 		Post_Func_call	Delay_About_1_Second
 		mov	cl, 01h			;
 		call	Get_PMIO		;
 		call	Set_PMIO		;
 
 		mov	cl, 03h			; Enable Power Buttom
 		mov	bl, 01h			;
 		call	Get_Set_PMIO_OR		;
endif;	Disable_ExtSMI_SW_In_POST

;R01A - starts
ifdef	VT596
  IFDEF	Thermal_Enable
                mov     cx,VT586_ACPI + 4ch
;R08		mov     bl,70h
;R08		call    E000_Get_Set_PMU_OR
		mov     bl,0D0h			;R08
		call    Get_Set_PMU_OR		;R08
		mov	cx, VT596 + 08h		;R74
		call	Get_PMU			;R74
		cmp	al, 10h			;R74 if 596B(Reversion ID >= 10h)
		jb	short Not_596B_1	;R74 No, jmp !
                mov     cx,VT586_ACPI + 4ch	;R74
		mov	bl,08h			;R74
		call    Get_Set_PMU_OR		;R74
	Not_596B_1:				;R74
    ifndef	Thermal_Active_By_High		;R08
                mov     cl,2ch			;R08
                mov     bl,40h			;R08
                call    Get_Set_PMIO_OR		;R08
    endif;	Thermal_Active_By_High		;R08
  ENDIF;Thermal_Enable			
endif;	VT596
;R01A - ends

endif;	Move_F000_PMU_INIT_To_E000				

		ret
Ct_PM_Final_Init	Endp

;[]========================================================================[]
;Procedure:	Ct_PM_Init
;
;Function :	Special PM init which the standard code can't do
;
;Input	  :	DS = DGROUP
;		ES = PM_RAM
;
;Output   :	None
;
;Note	  :	1. Call from POST 79S (PM initialization)
;		2. Stack available
;		3. Don't destroy any SEGMENT registers!
;[]========================================================================[]
		ASSUME	ES:PM_RAM
		ASSUME	DS:DGROUP
		Public	Ct_PM_Init
Ct_PM_Init	Proc	Near

ifdef	Move_F000_PMU_INIT_To_E000				
		Post_Func_Call E000_Ct_Pm_Init
else;	Move_F000_PMU_INIT_To_E000				
		pusha
		push	ds
		push	es
		pop	ds

;--------------- Set 32bit Timer for ACPI ------------------------
;R39		mov	cx, VT586_ACPI + 41h
;R39		mov	bl, 08h			
;R39		call	Get_Set_PMU_OR		

		mov	si, offset DGROUP:Alarm_Item
		call	GetItem_Value		;get setup setting
		mov	bl,al
		mov	si, offset DGROUP:PWRBTN_OVRD_Item
		call	GetItem_Value		;get setup setting
		shl	al,1
		or	bl,al
		mov	PM_RAM:[ALARM_RESUME], bl

		mov	si, offset DGROUP:Ring_Item	; Set Ring Resume
		call	GetItem_Value		; By Setup Item
		mov	bh,al				;R32
		shl	al,3
		or	PM_RAM:[ALARM_RESUME], al
ifndef	VT596						;R32
		mov	cl, 27h
		mov	bl,not 04h
		call	Get_Set_PMIO_AND
else;	VT596						;R32
		mov	cl, 25h				;R32
		mov	bl,not 01h			;R32
		call	Get_Set_PMIO			;R32
endif;	VT596						;R32
ifdef Set_APM_According_PM_Setup
		call	PM_Option_Check			   ; If PM set Disable
		jc	short @f			   ; No, Jmp !
		or	byte ptr PM_RAM:[ALARM_RESUME],80h ; Set Flag to be PM Disable ?
@@:
endif; Set_APM_According_PM_Setup

ifdef	ABIT_Have_Suspend_Fan_Item
		mov	si, offset DGROUP:Fan_Item
		call	GetItem_Value
		shl	al,2
		or	PM_RAM:[ALARM_RESUME], al
endif;	ABIT_Have_Suspend_Fan_Item


;--------------- Save miscellaneous setup settings ---------------

		mov	si,offset DGROUP:Doze_Timer_Item
		mov	di,offset PM_RAM:DOZE_TIME
;R62 start
		call	Timer_Transfer

		mov	si,offset DGROUP:Susp_Timer_Item
		mov	di,offset PM_RAM:SUSPEND_TIME
		call	Timer_Transfer
;R62 end
;R62 		mov	cx,2
;R62 
;R62 	Prg_Next_Item:
;R62 
;R62 		call	GetItem_Value		;get setup setting
;R62 		xor	ah,ah
;R62 		shl	ax,1	
;R62 		mov	bx,offset Timer_Value	;value table
;R62 		add	bx,ax			;translate
;R62 		mov	ax,cs:[bx]		;into reg. value	
;R62 		mov	es:[di],ax		;save value in PM_RAM	
;R62 
;R62 		add	si,ITEM_SIZE
;R62 		inc	di
;R62 		inc	di						
;R62 		loop	short Prg_Next_Item

		mov	ax,PM_RAM:[DOZE_Time]			
		mov	PM_RAM:[Doze_Setting],ax		
								
		mov	ax,PM_RAM:[SUSPEND_TIME]		
		mov	PM_RAM:[Suspend_Setting],ax		

        ;Primary/Secondary Setting
;R62 		mov	si,offset DGROUP:IRQ3_Event_Item
;R62 		mov	cx,13
;R62                 xor     bx, bx
;R62 		xor	dx,dx
;R62         set_pri:
;R62                 call    GetItem_Value
;R62                 or      bl, al
;R62                 and     bl, 11111101b
;R62                 shr     al, 1
;R62                 or      dl, al
;R62 pri:
;R62                 add     si, ITEM_SIZE
;R62                 ror     bx, 1
;R62                 ror     dx, 1
;R62                 loop    set_pri
;R62 start
		mov	di,offset DGROUP:IRQ_Evnt_TBL
		mov	cx,IRQ_Evnt_TBL_Len
                xor     bx, bx
		xor	dx,dx
        set_pri:
		mov	si,word ptr CS:[DI]
		push	di
                call    GetItem_Value
		pop	di
                or      bl, al
                and     bl, 11111101b
                shr     al, 1
                or      dl, al
pri:
                add     di, 2
                ror     bx, 1
                ror     dx, 1
                loop    short set_pri
;R62 end
		test	byte ptr FLOPPY_TYPE[bp],0ffH	; no floppy installed ?
		jnz	short Fdd_Attach
		and	bl,NOT 01000000b 	;disable IRQ6 primary event
Fdd_Attach:
;R23A ifdef	Cover_Garbage_IRQ12			;R23 - starts
;R23A 		test	bh,10h
;R23A 		jz	short W_IRQ12_Dis
;R23A 		or	PM_RAM:[ALARM_RESUME], 80h	;Wake Event IRQ12 Enabled.
;R23A 		and	bh,not 10h
;R23A 	W_IRQ12_Dis:
;R23A endif;	Cover_Garbage_IRQ12			;R23 - ends
ifdef	VT686					;R52A
		or	bl,00000010b		;R52A Always Enable IRQ1(Keyboard Event).
endif;	VT686					;R52A
                push    dx
;R73 - starts
                mov     cx, VT586 + 02h		;If 596B chip ?
                call    Get_PMU			;
		cmp	al,96h			;
		jnz	Not_596B
                mov     cx, VT586 + 08h		;If 596B chip ?
                call    Get_PMU			;
		cmp	al,10h			;
		jb	Not_596B

		or	bl,00000010b		; If 596B => Set IRQ1 Event.
	Not_596B:
;R73 - ends
                mov     cx, VT586_ACPI + 44h
                mov     al, bl
                call    Set_PMU

                mov     cx, VT586_ACPI + 45h
                mov     al, bh
                call    Set_PMU
                pop     dx
                mov     bx, dx
                mov     cx, VT586_ACPI + 46h

                mov     al, bl
                call    Set_PMU
		mov     cx, VT586_ACPI + 47h

                mov     al, bh
                call    Set_PMU

	;APM option

		mov	si,offset DGROUP:Wait_APM_Item
		call	GetItem_Value
		mov	PM_RAM:[Wait_APM_Flag],al

	;video off option

⌨️ 快捷键说明

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