;	[]===========================================================[]
;
;	NOTICE: THIS PROGRAM BELONGS TO AWARD SOFTWARE INTERNATIONAL(R)
;	        INC. IT IS CONSIDERED A TRADE SECRET AND IS NOT TO BE 	
;	        DIVULGED OR USED BY PARTIES WHO HAVE NOT RECEIVED	
;	        WRITTEN AUTHORIZATION FROM THE OWNER.
;
; 	[]===========================================================[]
;

;----------------------------------------------------------------------------
;Rev	  Date	 Name	Description
;----------------------------------------------------------------------------
;R10	04/30/99 RIC	Fixed that AT Power hang in POST C0h when chang Power
;			to AT from ATX.
;R09	03/26/99 RAX	Added PME_SUPPORT define to support PME power up.
;R07A	02/23/99 RIC	Fixed that Power Fail setting 'Off' can PowerOn ATX
;			by Power Switch/Cable if last sytem PowerOn by Power
;			Buttom.
;R08	02/26/99 RIC	Fix that RI/RTC Resume can't work when Power Fail set
;			'Off' or 'Former-Sts'.
;R07	02/11/99 RIC	Fix that Hareware RESET cause syetm auto-PowerOff when
;			Power Fail item set 'OFF'.
;			 If you don't want to cover it.
;			    You want to the same as PIIX4, please define:
;			    "PowerFail_As_PIIX4		EQU	1"
;R06	02/11/99 RIC	Support Power Fail Function for new 686A chip.
;R05	01/21/99 RIC	Fix that Power Fail Code cause AT power hang in C0h
;			after normal PowerOff.
;R03B	12/28/98 RIC	Modify the CMOS index of the flag of exit form SETUP
;			(F0h => F4h)
;R04	12/02/98 RIC	Fix that system auto-Poweroff when system reset in green.
;R03A	11/16/98 RIC	Fix that exit from setup auto-PowerOff when Power Fail
;			Item set 'Off'.
;			And Fix that checksum fail still do Power Fail Function.
;R03	11/11/98 RIC	Fix that Power Fail function is abnormal.
;R02A	11/04/98 RIC	Active R02 code if define "Set_All_GPO_To_High_In_PowerOn".
;R02	10/19/98 RIC	Set all of GPO set to High if define "Ct_Preset_In_Decompress_Area"
;			or "Ct_Preset_In_Chipboot_Area".
;R01	09/02/98 RIC	Add "Record_PWRON_Status" define.
;R00	08/15/98 RIC	Initialization.

ifdef	Ct_Preset_In_Decompress_Area
Have_Ct_Decompress_Hook		EQU	1
endif;	Ct_Preset_In_Decompress_Area
ifdef	Ct_Preset_In_Chipboot_Area
Have_Ct_Decompress_Hook		EQU	1
endif;	Ct_Preset_In_Chipboot_Area

ifdef	Have_Ct_Decompress_Hook
;------- Macro ------------------------------------------------------------
ROMCALL	MACRO	RTN_NAME			;R03A
	LOCAL	RTN_ADD				;R03A
	mov	sp,offset DGROUP:RTN_ADD	;R03A
	jmp	RTN_NAME			;R03A
ifdef	CompileForExtROM			;R03A
	ALIGN	4				;R03A
endif	;CompileForExtROM			;R03A
RTN_ADD:					;R03A
		dw	DGROUP:$+2		;R03A
		ENDM				;R03A
;-------------------------------------------------------------------------

Ct_Decompress_Hook	proc	near
ifdef	Set_All_GPO_To_High_In_PowerOn		;R02A
		mov	dx, ACPI_Port+4Dh	;R02
		mov	al, 0BFh		;R02
		out	dx,al			;R02
		mov	dx, ACPI_Port+4Ch	;R02
		mov	al, 0FFh		;R02
		out	dx,al			;R02
		mov	dx, ACPI_Port+4Eh	;R02
		out	dx,al			;R02
		mov	dx, ACPI_Port+4Fh	;R02
		out	dx,al			;R02
endif;	Set_All_GPO_To_High_In_PowerOn		;R02A
;R01 - starts
ifdef	Record_PWRON_Status
;R05 - start
		;-------------------------------;
		;  Check If ATX Power Plugde ?	;
		;-------------------------------;
  IFNDEF	NO_ATX_Judgement
    ifndef	Always_ATX_Power
		;***************************************;
		;  ATX/AT power judge by GPI for 596	;
		;***************************************;
Power_Type_Judge_In_GPI_7_0	=	00h
Power_Type_Judge_In_GPI_15_8	=	00h
Power_Type_Judge_In_GPI_21_16	=	00h
		;***************************************;
		;  Use "ATX_High_AT_Low_In_GPI" Define	;
		;***************************************;
	  ifdef	ATX_High_AT_Low_In_GPI
		if	ATX_High_AT_Low_In_GPI	LE	7
		 if	ATX_High_AT_Low_In_GPI	GE	0
Power_Type_Judge_In_GPI_7_0 = Power_Type_Judge_In_GPI_7_0 or (01h shl ATX_High_AT_Low_In_GPI)
		 endif;	ATX_High_AT_Low_In_GPI	GE	0
		endif;	ATX_High_AT_Low_In_GPI	LE	7
		if	ATX_High_AT_Low_In_GPI	LE	15
		 if	ATX_High_AT_Low_In_GPI	GE	8
Power_Type_Judge_In_GPI_15_8 = Power_Type_Judge_In_GPI_15_8 or (01h shl (ATX_High_AT_Low_In_GPI-8))
		 endif;	ATX_High_AT_Low_In_GPI	GE	8
		endif;	ATX_High_AT_Low_In_GPI	LE	15
		if	ATX_High_AT_Low_In_GPI	LE	21
		 if	ATX_High_AT_Low_In_GPI	GE	16
Power_Type_Judge_In_GPI_21_16 = Power_Type_Judge_In_GPI_21_16 or (01h shl (ATX_High_AT_Low_In_GPI-16))
		 endif;	ATX_High_AT_Low_In_GPI	GE	16
		endif;	ATX_High_AT_Low_In_GPI	LE	21
	  endif;ATX_High_AT_Low_In_GPI
		;***************************************;
		;  Use "ATX_Low_AT_High_In_GPI" Define	;
		;***************************************;
	  ifdef	ATX_Low_AT_High_In_GPI
		if	ATX_Low_AT_High_In_GPI	LE	7
		 if	ATX_Low_AT_High_In_GPI	GE	0
Power_Type_Judge_In_GPI_7_0 = Power_Type_Judge_In_GPI_7_0 or (01h shl ATX_Low_AT_High_In_GPI)
		 endif;	ATX_Low_AT_High_In_GPI	GE	0
		endif;	ATX_Low_AT_High_In_GPI	LE	7
		if	ATX_Low_AT_High_In_GPI	LE	15
		 if	ATX_Low_AT_High_In_GPI	GE	8
Power_Type_Judge_In_GPI_15_8 = Power_Type_Judge_In_GPI_15_8 or (01h shl (ATX_Low_AT_High_In_GPI-8))
		 endif;	ATX_Low_AT_High_In_GPI	GE	8
		endif;	ATX_Low_AT_High_In_GPI	LE	15
		if	ATX_Low_AT_High_In_GPI	LE	21
		 if	ATX_Low_AT_High_In_GPI	GE	16
Power_Type_Judge_In_GPI_21_16 = Power_Type_Judge_In_GPI_21_16 or (01h shl (ATX_Low_AT_High_In_GPI-16))
		 endif;	ATX_Low_AT_High_In_GPI	GE	16
		endif;	ATX_Low_AT_High_In_GPI	LE	21
	  endif;ATX_Low_AT_High_In_GPI

		;***************************************;
		;  ATX => CMOS Protect, AT => Skip	;
		;***************************************;
	  if	Power_Type_Judge_In_GPI_7_0	NE	00h
		mov	dx, ACPI_Port + 48h
		in	al, dx
		test	al, Power_Type_Judge_In_GPI_7_0
	  endif;Power_Type_Judge_In_GPI_7_0	NE	00h
	  if	Power_Type_Judge_In_GPI_15_8	NE	00h
		mov	dx, ACPI_Port + 49h
		in	al, dx
		test	al, Power_Type_Judge_In_GPI_15_8
	  endif;Power_Type_Judge_In_GPI_15_8	NE	00h
	  if	Power_Type_Judge_In_GPI_21_16	NE	00h
		mov	dx, ACPI_Port + 4Ah
		in	al, dx
		test	al, Power_Type_Judge_In_GPI_21_16
	  endif;Power_Type_Judge_In_GPI_21_16	NE	00h

	  ifdef	ATX_High_AT_Low_In_GPI		; If ATX power ?
;R10		jz	Turn_On_ATX_Power		; No,jmp!
		jz	Is_AT_Power		;R10
	  endif;	ATX_High_AT_Low_In_GPI		; (1:ATX, 0:AT)
	  ifdef	ATX_Low_AT_High_In_GPI		; If ATX power ?
;R10		jnz	short Turn_On_ATX_Power		; No,jmp!
		jnz	Is_AT_Power		;R10
	  endif;	ATX_Low_AT_High_In_GPI		; (0:ATX, 1:AT)
    endif;	Always_ATX_Power

    ifdef	Detect_ATX_Power_By_CMOS_Bank2
		mov	al, 90h			;
		out	72h, al			;
		mov	al, 55h			;
		out	73h, al			;
		mov	al, 90h			;
		out	72h, al			;
		in	al, 73h			;
		cmp	al, 55h			; Is ATX power ?
;R10		jnz	short Turn_On_ATX_Power		; No,jump
		jnz	Is_AT_Power		;R10
    endif;	Detect_ATX_Power_By_CMOS_Bank2
  ENDIF;	NO_ATX_Judgement
;R05 - end
;R06 - starts
  IFDEF	VT686
		;---------------------------------------;
		;     Set CMOS 0Dh[7] Value to 0	;
		;---------------------------------------;
	SetCMOS_0Dh:
		mov	al, 0dh			; Set CMOS 0D[7] to 0
		out	70h, al			; (Set Can Auto-PowerOn)
		in	al, 71h			;
		and	al,not 80h		;
		out	71h, al			;

		mov	cx, VT586_ACPI + 42h	; 42h[4]
		rom_call Get_Ct			; Get CMOS 0D[7] status
		test	al, 10h			;
		jnz	short SetCMOS_0Dh
  ENDIF;VT686
;R06 - ends
;R03A - starts
		;---------------------------------------;
		;   Check If CMOS Checksum Error ?	;
		;---------------------------------------;
		xor	bx,bx
		xor	ah,ah
		mov	cl,10h NMI_OFF
	CMOS_CHKSM_1:
		mov	al,cl
		ROMCALL get_cmos
		add	bx,ax
		inc	cl
		cmp	cl, 2eh nmi_off
		jne	short CMOS_CHKSM_1
		
		mov	al,2eh NMI_OFF
		ROMCALL get_cmos
		mov	ah,al
		mov	al,2Fh NMI_OFF
		ROMCALL get_cmos
		cmp	bx,ax
		jne	CMOS_CHKSM_Not_OK_
;R03A - ends

		;---------------------------------------;
		;    Check system If WarmBoot ?		;
		;---------------------------------------;
		mov	ax,G_RAM
		mov	es,ax
		assume	es:G_RAM
		cmp	es:USER_REBOOT,CTRL_ALT_DEL
		je	Its_WarmBoot_

		mov	al,0fh NMI_OFF		;R04
		out	70h,al			;R04
		jmp	short $+2		;R04
		in	al,71h			;R04
		jmp	short $+2		;R04
		cmp	al,0aah	      		;R04 If warm-boot ?
		je	Its_WarmBoot_		;R09 
;R09 		je	short Its_WarmBoot_	;R04

  IFDEF	PowerFail_As_PIIX4 			;R07
;R03B		mov	al,0F0h			;R03A If exit from SETUP
		mov	al,0F4h			;R03B If exit from SETUP
		out	72h,al			;R03A
		in	al,73h			;R03A
		cmp	al,0A5h			;R03A
		je	short Its_WarmBoot_	;R03A
  ENDIF;PowerFail_As_PIIX4			;R07

;R09 start
	RING_ON	=	0100h
	PME_ON	=	0000h		;default not support
ifdef	PME_SUPPORT
	PME_ON	=	0020h		;support PME ON.
endif	;PME_SUPPORT
;R09 end

;R03 Word_00h_Val	=	0000h
;R08 Word_00h_Val	=	0100h			;R03
;R08 Word_20h_Val	=	0000h
Word_00h_Val	=	0500h				;R08
;R09 Word_20h_Val	=	0100h				;R08
Word_20h_Val	=	RING_ON+PME_ON		;R09
Word_28h_Val	=	0000h

		mov	dx, ACPI_Port + 0h	; Check =>
		in	ax,dx			; If Normal Power On Event ?
		and	ax, Word_00h_Val	;
		or	ax,ax			;
		jnz	short Turn_On_ATX_Power	;
		mov	dx,ACPI_Port + 20h	;
		in	ax,dx	       		;
		and	ax, Word_20h_Val	;
		or	ax,ax			;
		jnz	short Turn_On_ATX_Power	;
		mov	dx,ACPI_Port + 28h	;
		in	ax,dx	       		;
		and	ax, Word_28h_Val	;
		or	ax,ax			;
		jnz	short Turn_On_ATX_Power	;

		mov	al,RdRsmSts_CMOS
		OUT	70h,al
		jcxz	short $+2
		IN	AL,71h
		jcxz	short $+2
		mov	bl,al
;R03		test	al,(RdRsmSts_CMOS_Bits AND (RdRsmSts_CMOS_Bits SHL 1))
;R03		jnz	Power_Fail_Not_Set_Auto	; High Bit = 0 : Set Auto
;R03						; High Bit = 1 : not Set Auto
;R03		and	al,not(RdRsmSts_CMOS_Bits AND (RdRsmSts_CMOS_Bits SHR 1))
;R03		OUT	71h,al
;R03		jcxz	short $+2
;R03Power_Fail_Not_Set_Auto:
;		and	bl,RdRsmSts_CMOS_Bits
		test	bl,(RdRsmSts_CMOS_Bits AND (RdRsmSts_CMOS_Bits SHR 1))
		jz	Turn_On_ATX_Power	; Low Bit = 0 : Power On
						; Low Bit = 1 : Power Off
ifndef	PowerFail_As_PIIX4			;R07
		and	al,RdRsmSts_CMOS_Bits	;R07
		cmp	al,RdRsmSts_CMOS_Bits	;R07
		jz	short Set_RTC_0Dh_To_1	;R07
endif;	PowerFail_As_PIIX4			;R07
Turn_Off_ATX_Power:
		mov	dx, ACPI_Port + 0h	; Clear Wake Up Status
		in	ax,dx			;
		out	dx,ax			;
		mov	dx,ACPI_Port + 20h	;
		in	ax,dx	       		;
		out	dx,ax			;
		mov	dx,ACPI_Port + 30h	;
		in	ax,dx	       		;
		out	dx,ax			;
		mov	dx,ACPI_Port + 32h	;
		in	ax,dx	       		;
		out	dx,ax			;
		mov	dx,ACPI_Port + 28h	;
		in	ax,dx	       		;
		out	dx,ax			;

		mov	dx, ACPI_Port + 05h	; Do S5(Soft Off).
		mov	al, 28h			;
		out	dx,al			;

		jmp	short	Turn_Off_ATX_Power

ifndef	PowerFail_As_PIIX4			;R07 - starts
Set_RTC_0Dh_To_1:
		;---------------------------------------;
		;   Turn Off Auto-PowerOn Function	;
		;---------------------------------------;
	SetCMOS_0Dh_:
		mov	al, 0dh			; Set CMOS 0D[7] to 0
		out	70h, al			; (Set Can Auto-PowerOn)
		in	al, 71h			;
		or	al, 80h			;
		out	71h, al			;

		mov	cx, VT586_ACPI + 42h	; 42h[4]
		rom_call Get_Ct			; Get CMOS 0D[7] status
		test	al, 10h			;
		jz	short SetCMOS_0Dh_

		jmp	short Power_Fail_Not_Set_Auto	;R07A 
endif;	PowerFail_As_PIIX4			;R07 - ends

Turn_On_ATX_Power:
ifndef	PowerFail_As_PIIX4			;R07A - starts
		mov	al,RdRsmSts_CMOS
		OUT	70h,al
		jcxz	short $+2
		IN	AL,71h
		jcxz	short $+2
		and	al,RdRsmSts_CMOS_Bits	
		cmp	al,RdRsmSts_CMOS_Bits	
		jz	short Set_RTC_0Dh_To_1	
endif;	PowerFail_As_PIIX4			;R07A - ends
Its_WarmBoot_:
CMOS_CHKSM_Not_OK_:				;R03A
;R03 - starts
		mov	al,RdRsmSts_CMOS
		OUT	70h,al
		jcxz	short $+2
		IN	AL,71h
		jcxz	short $+2
		test	al,(RdRsmSts_CMOS_Bits AND (RdRsmSts_CMOS_Bits SHL 1))
		jnz	Power_Fail_Not_Set_Auto	; High Bit = 0 : Set Auto
						; High Bit = 1 : not Set Auto
		and	al,not(RdRsmSts_CMOS_Bits AND (RdRsmSts_CMOS_Bits SHR 1))
		OUT	71h,al
		jcxz	short $+2
	Power_Fail_Not_Set_Auto:
  IFDEF	PowerFail_As_PIIX4			;R07
;R03B		mov	al,0F0h			;R03A Clear Flag of Entry SETUP.
		mov	al,0F4h			;R03B Clear Flag of Entry SETUP.
		out	72h,al			;R03A
		mov	al,0h			;R03A
		out	73h,al			;R03A
  ENDIF;PowerFail_As_PIIX4			;R07
;R03 - ends
Is_AT_Power:		;R10

endif;	Record_PWRON_Status
;R01 - ends


IFDEF	VT596
		;---------------------------------------;
		;    >> 596(3050) : <<			;
		;  Control GPO to Low When PowerOn	;
		;---------------------------------------;
			;---------;
			; GPO0-7  ;
			;---------;
		GPO_Port_4C_VAL	= 00h
	ifdef	PowerOn_Send_Low_To_GPO0
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 01h
	endif;	PowerOn_Send_Low_To_GPO0
	ifdef	PowerOn_Send_Low_To_GPO1
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 02h
	endif;	PowerOn_Send_Low_To_GPO1
	ifdef	PowerOn_Send_Low_To_GPO2
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 04h
	endif;	PowerOn_Send_Low_To_GPO2
	ifdef	PowerOn_Send_Low_To_GPO3
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 08h
	endif;	PowerOn_Send_Low_To_GPO3
	ifdef	PowerOn_Send_Low_To_GPO4
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 10h
	endif;	PowerOn_Send_Low_To_GPO4
	ifdef	PowerOn_Send_Low_To_GPO5
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 20h
	endif;	PowerOn_Send_Low_To_GPO5
	ifdef	PowerOn_Send_Low_To_GPO6
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 40h
	endif;	PowerOn_Send_Low_To_GPO6
	ifdef	PowerOn_Send_Low_To_GPO7
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 80h
	endif;	PowerOn_Send_Low_To_GPO7
 ifdef	PowerOn_Send_Low_To_GPO
  if	PowerOn_Send_Low_To_GPO LE	7
GPO_Port_4C_VAL = GPO_Port_4C_VAL OR (01h SHL PowerOn_Send_Low_To_GPO)
  endif;PowerOn_Send_Low_To_GPO LE	7
 endif;	PowerOn_Send_Low_To_GPO
if	GPO_Port_4C_VAL		NE	00h
		mov	dx, ACPI_Port+4Ch
		in	al, dx
		and	al, not GPO_Port_4C_VAL
		out	dx,al
endif;	GPO_Port_4C_VAL		NE	00h
			;---------;
			; GPO8-15 ;
			;---------;
		GPO_Port_4D_VAL	= 00h
	ifdef	PowerOn_Send_Low_To_GPO8
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 01h
	endif;	PowerOn_Send_Low_To_GPO8
	ifdef	PowerOn_Send_Low_To_GPO9
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 02h
	endif;	PowerOn_Send_Low_To_GPO9
	ifdef	PowerOn_Send_Low_To_GPO10
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 04h
	endif;	PowerOn_Send_Low_To_GPO10
	ifdef	PowerOn_Send_Low_To_GPO11
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 08h
	endif;	PowerOn_Send_Low_To_GPO11
	ifdef	PowerOn_Send_Low_To_GPO12
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 10h
	endif;	PowerOn_Send_Low_To_GPO12
	ifdef	PowerOn_Send_Low_To_GPO13
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 20h
	endif;	PowerOn_Send_Low_To_GPO13
	ifdef	PowerOn_Send_Low_To_GPO14
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 40h
	endif;	PowerOn_Send_Low_To_GPO14
	ifdef	PowerOn_Send_Low_To_GPO15
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 80h
	endif;	PowerOn_Send_Low_To_GPO15
 ifdef	PowerOn_Send_Low_To_GPO
  if	PowerOn_Send_Low_To_GPO LE	15
  if	PowerOn_Send_Low_To_GPO GE	8
GPO_Port_4D_VAL = GPO_Port_4D_VAL OR (01h SHL (PowerOn_Send_Low_To_GPO-8))
  endif;PowerOn_Send_Low_To_GPO LE	8
  endif;PowerOn_Send_Low_To_GPO LE	15
 endif;	PowerOn_Send_Low_To_GPO
if	GPO_Port_4D_VAL		NE	00h
		mov	dx, ACPI_Port+4Dh
		in	al, dx
		and	al, not GPO_Port_4D_VAL
		out	dx,al
endif;	GPO_Port_4D_VAL		NE	00h
			;----------;
			; GPO16-23 ;
			;----------;
		GPO_Port_4E_VAL	= 00h
	ifdef	PowerOn_Send_Low_To_GPO16
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 01h
	endif;	PowerOn_Send_Low_To_GPO16
	ifdef	PowerOn_Send_Low_To_GPO17
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 02h
	endif;	PowerOn_Send_Low_To_GPO17
	ifdef	PowerOn_Send_Low_To_GPO18
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 04h
	endif;	PowerOn_Send_Low_To_GPO18
	ifdef	PowerOn_Send_Low_To_GPO19
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 08h
	endif;	PowerOn_Send_Low_To_GPO19
	ifdef	PowerOn_Send_Low_To_GPO20
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 10h
	endif;	PowerOn_Send_Low_To_GPO20
	ifdef	PowerOn_Send_Low_To_GPO21
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 20h
	endif;	PowerOn_Send_Low_To_GPO21
	ifdef	PowerOn_Send_Low_To_GPO22
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 40h
	endif;	PowerOn_Send_Low_To_GPO22
	ifdef	PowerOn_Send_Low_To_GPO23
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 80h
	endif;	PowerOn_Send_Low_To_GPO23
 ifdef	PowerOn_Send_Low_To_GPO
  if	PowerOn_Send_Low_To_GPO LE	23
  if	PowerOn_Send_Low_To_GPO GE	16
GPO_Port_4E_VAL = GPO_Port_4E_VAL OR (01h SHL (PowerOn_Send_Low_To_GPO-16))
  endif;PowerOn_Send_Low_To_GPO LE	16
  endif;PowerOn_Send_Low_To_GPO LE	23
 endif;	PowerOn_Send_Low_To_GPO
if	GPO_Port_4E_VAL		NE	00h
		mov	dx, ACPI_Port+4Eh
		in	al, dx
		and	al, not GPO_Port_4E_VAL
		out	dx,al
endif;	GPO_Port_4E_VAL		NE	00h
			;----------;
			; GPO24-30 ;
			;----------;
		GPO_Port_4F_VAL	= 00h
	ifdef	PowerOn_Send_Low_To_GPO24
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 01h
	endif;	PowerOn_Send_Low_To_GPO24
	ifdef	PowerOn_Send_Low_To_GPO25
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 02h
	endif;	PowerOn_Send_Low_To_GPO25
	ifdef	PowerOn_Send_Low_To_GPO26
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 04h
	endif;	PowerOn_Send_Low_To_GPO26
	ifdef	PowerOn_Send_Low_To_GPO27
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 08h
	endif;	PowerOn_Send_Low_To_GPO27
	ifdef	PowerOn_Send_Low_To_GPO28
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 10h
	endif;	PowerOn_Send_Low_To_GPO28
	ifdef	PowerOn_Send_Low_To_GPO29
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 20h
	endif;	PowerOn_Send_Low_To_GPO29
	ifdef	PowerOn_Send_Low_To_GPO30
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 40h
	endif;	PowerOn_Send_Low_To_GPO30
 ifdef	PowerOn_Send_Low_To_GPO
  if	PowerOn_Send_Low_To_GPO LE	30
  if	PowerOn_Send_Low_To_GPO GE	24
GPO_Port_4F_VAL = GPO_Port_4F_VAL OR (01h SHL (PowerOn_Send_Low_To_GPO-24))
  endif;PowerOn_Send_Low_To_GPO LE	24
  endif;PowerOn_Send_Low_To_GPO LE	30
 endif;	PowerOn_Send_Low_To_GPO
if	GPO_Port_4F_VAL		NE	00h
		mov	dx, ACPI_Port+4Fh
		in	al, dx
		and	al, not GPO_Port_4F_VAL
		out	dx,al
endif;	GPO_Port_4F_VAL		NE	00h

		;---------------------------------------;
		;    >> 596(3050) : <<			;
		;  Control GPO to High When PowerOn	;
		;---------------------------------------;
			;---------;
			; GPO0-7  ;
			;---------;
		GPO_Port_4C_VAL	= 00h
	ifdef	PowerOn_Send_High_To_GPO0
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 01h
	endif;	PowerOn_Send_High_To_GPO0
	ifdef	PowerOn_Send_High_To_GPO1
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 02h
	endif;	PowerOn_Send_High_To_GPO1
	ifdef	PowerOn_Send_High_To_GPO2
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 04h
	endif;	PowerOn_Send_High_To_GPO2
	ifdef	PowerOn_Send_High_To_GPO3
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 08h
	endif;	PowerOn_Send_High_To_GPO3
	ifdef	PowerOn_Send_High_To_GPO4
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 10h
	endif;	PowerOn_Send_High_To_GPO4
	ifdef	PowerOn_Send_High_To_GPO5
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 20h
	endif;	PowerOn_Send_High_To_GPO5
	ifdef	PowerOn_Send_High_To_GPO6
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 40h
	endif;	PowerOn_Send_High_To_GPO6
	ifdef	PowerOn_Send_High_To_GPO7
		GPO_Port_4C_VAL	= GPO_Port_4C_VAL OR 80h
	endif;	PowerOn_Send_High_To_GPO7
 ifdef	PowerOn_Send_High_To_GPO
  if	PowerOn_Send_High_To_GPO LE	7
GPO_Port_4C_VAL = GPO_Port_4C_VAL OR (01h SHL PowerOn_Send_High_To_GPO)
  endif;PowerOn_Send_High_To_GPO LE	7
 endif;	PowerOn_Send_High_To_GPO
if	GPO_Port_4C_VAL		NE	00h
		mov	dx, ACPI_Port+4Ch
		in	al, dx
		or	al, GPO_Port_4C_VAL
		out	dx,al
endif;	GPO_Port_4C_VAL		NE	00h
			;---------;
			; GPO8-15 ;
			;---------;
		GPO_Port_4D_VAL	= 00h
	ifdef	PowerOn_Send_High_To_GPO8
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 01h
	endif;	PowerOn_Send_High_To_GPO8
	ifdef	PowerOn_Send_High_To_GPO9
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 02h
	endif;	PowerOn_Send_High_To_GPO9
	ifdef	PowerOn_Send_High_To_GPO10
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 04h
	endif;	PowerOn_Send_High_To_GPO10
	ifdef	PowerOn_Send_High_To_GPO11
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 08h
	endif;	PowerOn_Send_High_To_GPO11
	ifdef	PowerOn_Send_High_To_GPO12
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 10h
	endif;	PowerOn_Send_High_To_GPO12
	ifdef	PowerOn_Send_High_To_GPO13
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 20h
	endif;	PowerOn_Send_High_To_GPO13
	ifdef	PowerOn_Send_High_To_GPO14
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 40h
	endif;	PowerOn_Send_High_To_GPO14
	ifdef	PowerOn_Send_High_To_GPO15
		GPO_Port_4D_VAL	= GPO_Port_4D_VAL OR 80h
	endif;	PowerOn_Send_High_To_GPO15
 ifdef	PowerOn_Send_High_To_GPO
  if	PowerOn_Send_High_To_GPO LE	15
  if	PowerOn_Send_High_To_GPO GE	8
GPO_Port_4D_VAL = GPO_Port_4D_VAL OR (01h SHL (PowerOn_Send_High_To_GPO-8))
  endif;PowerOn_Send_High_To_GPO LE	8
  endif;PowerOn_Send_High_To_GPO LE	15
 endif;	PowerOn_Send_High_To_GPO
if	GPO_Port_4D_VAL		NE	00h
		mov	dx, ACPI_Port+4Dh
		in	al, dx
		or	al, GPO_Port_4D_VAL
		out	dx,al
endif;	GPO_Port_4D_VAL		NE	00h
			;----------;
			; GPO16-23 ;
			;----------;
		GPO_Port_4E_VAL	= 00h
	ifdef	PowerOn_Send_High_To_GPO16
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 01h
	endif;	PowerOn_Send_High_To_GPO16
	ifdef	PowerOn_Send_High_To_GPO17
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 02h
	endif;	PowerOn_Send_High_To_GPO17
	ifdef	PowerOn_Send_High_To_GPO18
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 04h
	endif;	PowerOn_Send_High_To_GPO18
	ifdef	PowerOn_Send_High_To_GPO19
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 08h
	endif;	PowerOn_Send_High_To_GPO19
	ifdef	PowerOn_Send_High_To_GPO20
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 10h
	endif;	PowerOn_Send_High_To_GPO20
	ifdef	PowerOn_Send_High_To_GPO21
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 20h
	endif;	PowerOn_Send_High_To_GPO21
	ifdef	PowerOn_Send_High_To_GPO22
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 40h
	endif;	PowerOn_Send_High_To_GPO22
	ifdef	PowerOn_Send_High_To_GPO23
		GPO_Port_4E_VAL	= GPO_Port_4E_VAL OR 80h
	endif;	PowerOn_Send_High_To_GPO23
 ifdef	PowerOn_Send_High_To_GPO
  if	PowerOn_Send_High_To_GPO LE	23
  if	PowerOn_Send_High_To_GPO GE	16
GPO_Port_4E_VAL = GPO_Port_4E_VAL OR (01h SHL (PowerOn_Send_High_To_GPO-16))
  endif;PowerOn_Send_High_To_GPO LE	16
  endif;PowerOn_Send_High_To_GPO LE	23
 endif;	PowerOn_Send_High_To_GPO
if	GPO_Port_4E_VAL		NE	00h
		mov	dx, ACPI_Port+4Eh
		in	al, dx
		or	al, GPO_Port_4E_VAL
		out	dx,al
endif;	GPO_Port_4E_VAL		NE	00h
			;----------;
			; GPO24-30 ;
			;----------;
		GPO_Port_4F_VAL	= 00h
	ifdef	PowerOn_Send_High_To_GPO24
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 01h
	endif;	PowerOn_Send_High_To_GPO24
	ifdef	PowerOn_Send_High_To_GPO25
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 02h
	endif;	PowerOn_Send_High_To_GPO25
	ifdef	PowerOn_Send_High_To_GPO26
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 04h
	endif;	PowerOn_Send_High_To_GPO26
	ifdef	PowerOn_Send_High_To_GPO27
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 08h
	endif;	PowerOn_Send_High_To_GPO27
	ifdef	PowerOn_Send_High_To_GPO28
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 10h
	endif;	PowerOn_Send_High_To_GPO28
	ifdef	PowerOn_Send_High_To_GPO29
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 20h
	endif;	PowerOn_Send_High_To_GPO29
	ifdef	PowerOn_Send_High_To_GPO30
		GPO_Port_4F_VAL	= GPO_Port_4F_VAL OR 40h
	endif;	PowerOn_Send_High_To_GPO30
 ifdef	PowerOn_Send_High_To_GPO
  if	PowerOn_Send_High_To_GPO LE	30
  if	PowerOn_Send_High_To_GPO GE	24
GPO_Port_4F_VAL = GPO_Port_4F_VAL OR (01h SHL (PowerOn_Send_High_To_GPO-24))
  endif;PowerOn_Send_High_To_GPO LE	24
  endif;PowerOn_Send_High_To_GPO LE	30
 endif;	PowerOn_Send_High_To_GPO
if	GPO_Port_4F_VAL		NE	00h
		mov	dx, ACPI_Port+4Fh
		in	al, dx
		or	al, GPO_Port_4F_VAL
		out	dx,al
endif;	GPO_Port_4F_VAL		NE	00h
ENDIF;	VT596

		jmp	Ct_Decompress_Hook_End
Ct_Decompress_Hook	endp
endif;	Have_Ct_Decompress_Hook

