;	[]===========================================================[]
;
;	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
;----------------------------------------------------------------------------
;R00   10/17/96  DNL	Initialize

;		+-------------------------------+
;		|				|
;		|  SMI BIOS CODE AREA		|
;		|				|
;		+-------------------------------+

;[]---------------------------[]
;
;   CODE START FROM HERE
;
;[]---------------------------[]

		PUBLIC	E000_GET_PMU
E000_GET_PMU	PROC	NEAR
CONFIG_ADDR	EQU	0cf8h
		mov	ax,8000H	;enable PCI config.
		shl	eax,16
		mov	ax,cx
		and	al,NOT 03h	;32 bit access for PCI
		mov	dx,CONFIG_ADDR	;index is 0cf8h
		out	dx,eax
		add	dl,4		;start from 0cfch
		mov	al,cl
		and	al,03h
		add	dl,al	  	;byte index to read
		in	al,dx
		ret

E000_GET_PMU	ENDP


		PUBLIC	E000_SET_PMU
E000_SET_PMU	PROC	NEAR

		xchg	ax,cx
		shl	ecx,16		;save value
		xchg	ax,cx		;restore cx
		mov	ax,8000H	;enable PCI config.
		shl	eax,16
		mov	ax,cx
		and	al,NOT 03h	;32 bit access for PCI
		mov	dx,CONFIG_ADDR	;index is 0cf8h
		out	dx,eax
		add	dl,4		;start from 0cfch
		mov	al,cl
		and	al,03h
		add	dl,al	  	;byte index to read
		mov	eax,ecx		
		shr	eax,16		
		out	dx,al
		ret

E000_SET_PMU	ENDP

;[]=======================================================================[]
;
; Setup_Intel_Stack:
;
; 		This routine is used to setup SMM stack for intel CPU
;
; Saves :	NONE
;
; Input :	CS = SMM SEGMENT
;
; Output :	None
;
; Note  :     	Use AX,SS,ESP registers only ! Don't destroy other registers
;
;[]=======================================================================[]

SM_Stack_top	EQU	0BFF0h
		ALIGN	4
Setup_Intel_Stack:
		mov     eax,dword ptr cs:[0FEF8h]
		shr	eax,4
		mov	ss,ax
		mov	esp,SM_Stack_top

		jmp	Intel_Stack_Ret

;[]=======================================================================[]
;
; Open_E000_Shadow:
;
; 		This routine is used to open E segment 64K shadow RAM and
;		use EBX register to save original value of E segment register in 
;
; Saves :	NONE
;
; Input :	None
;
; Output :	EBX : original value of E segment register
;
;[]=======================================================================[]
		Public	Open_E000_Shadow
Open_E000_Shadow	Proc	Near

		mov     cx,(MTSC_ID SHL 8)+5eh
		CALL    E000_Get_PMU
		mov	bl,al
		mov     al,00010001b
		CALL    E000_Set_PMU
		mov     cx,(MTSC_ID SHL 8)+5fh
		CALL    E000_Get_PMU
		mov	bh,al
		mov     al,00010001b
		CALL    E000_Set_PMU
		ret

Open_E000_Shadow	Endp

ifndef	NO_CYRIX_CPU_SUPPORT
;[]=======================================================================[]
;
; Setup_Cyrix_Stack:
;
; 		This routine is used to setup SMM stack for cyrix CPU
;
; Saves :	NONE
;
; Input :	CS = SMM SEGMENT
;
; Output :	None
;
; Note  :     	Use AX,SS,ESP register only ! Don't destroy other registers
;
;[]=======================================================================[]

Setup_Cyrix_Stack:
		jmp	Cyrix_Stack_Ret

;[]=======================================================================[]
;
; Setup_Cyrix_Segment_Register:
;
; 		This routine is used to setup segment register for cyrix CPU
;
; Saves  :	None
;
; Input  :	None
;
; Output :	None
;
; Note	 :	Must set FS register equal CS register !!!!!
;
;[]=======================================================================[]

Setup_Cyrix_Segment_Register:
		jmp	Setup_Segment_Register_Ret

endif	;NO_CYRIX_CPU_SUPPORT

;[]---------------------------[]
;
;     CODE END
;
;[]---------------------------[]
