;	[]===========================================================[]
;
;	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
;----------------------------------------------------------------------------
;R61	02/12/99 GAR	Add PC87364/366
;R60	02/12/99 GAR	Add ITE8702/12
;R59A	02/10/99 GAR	Change Ali5113D to Ali5113B
;R59	02/02/99 GAR	Add Ali5113D
;R58	01/26/99 GAR	Support W83627F/HF
;R57A	01/22/99 GAR	cancel R57
;R57	01/19/99 GAR	Ali513x and Ali513xB use Ali513xF code
;R56	10/22/98 GAR	Add ITE8693 and ITE8673
;R55	07/01/98 GAR    Change "Disable_Secondary_SuperIO_ComLptPort" to
;			"Secondio_Early_Prg" 
;R54	06/18/98 LAW	add hook Move multi-Node to E000 for more free F000 Space
;R53	03/11/98 JDN	Add define for suspend/resume
;R52	02/28/98 LAW	added some Extrn for move Special Show Code to E000 Segment
;R51	12/24/97 LAW	added "Secondary_IO_Use" for dual superio, but you must
;			by part mnuber copy file from H:\bios\450\SecondIO
;R50	11/06/97 LAW	added SMC37N769 support
;R49	11/06/97 LAW	rename all superio file use superio.sio
;R48	10/28/97 LAW	added "W83877ATF"
;R47	10/21/97 LAW	added code for ITE8661 init gpio pin
;R46	10/15/97 LAW	added "ITE8681" and "ITE8671"
;R45	10/13/97 LAW	added "NS317" for NS pc97317VLJ
;R44	09/22/97 ADS	Added "SMC37C93XPM" to Support SMC37C931PM.
;R43	09/17/97 LAW	added SMC37C669_ITE8661
;R42	09/04/97 LAW	added ALi513x_5113 
;R41	09/04/97 LAW	fix W83977TF Power Led flash bug. 
;R40	08/27/97 LAW	added "superio_early_init" for some superio cann't Init
;			at Earlyio.asm
;R39	08/04/97 LAW	added "W83977ATF" and make a W977TF.SIO for 9773 W83977TF
;R38	07/03/97 LAW	Added "NS309" for NS PC87309VLJ
;R37	06/15/97 LAW	Added support SMC37M60x ,SMC37M61x
;R36	05/29/97 LAW	Added W83977TF SUPPORT
;R35	05/26/97 RAX	Add "Support_1_FDD" define for notebook
;R34	05/02/97 LAW	added W9775119.sio (Winbond W83977AF + ALi5119 com4)
;R33	04/23/97 LAW	Added "No_USE_KB" for some MB use extension KB
;R32	04/17/97 DRS	Added SMC68X.SIO for SMC37C68X
;R31	04/17/97 LAW	Added S93X8669.SIO (SMC37C93X I/O & UMC8669 com3 + com4
;			lpt2)
;R30	04/16/97 LAW	support "NO_DMA_ROUTING_CHIPSET" for ALi152x chipset
;R29	03/20/97 LAW	Added SMC37C93XAPM, SMC37C93XFR
;R28	03/06/97 LAW	Added W83877AF + W83877TF
;R27	03/06/97 LAW	Added SMC67x.SIO for SMC37C67x
;R26	01/21/97 LAW	Added ITE8661.SIO (ITE8661F/ITE8661RF)
;R25	01/29/97 DNL	Added codes for notebook power management support
;R24	01/09/97 LAW	Added I8680663.SIO (ITE8680 I/O & UMC8663 com3 + com4)
;R23	12/16/96 LAW	Added "SMC37C669FR" "SMC37C67X" "SMC37C68X" "ITE8679"
;			SMC37C669FR --> SMC37C669 + SUPPORT_FAST_IR
;			SMC37C67X  ---> SMC93X
;			SMC37C68X  ---> SMC93X
;			ITE8679    ---> ITE8680
;R22	12/09/96 LAW	Modify superio define
;			ALi513x + ALi5123 -- > ALi513X
;			ALi514x + ALi5123 -- > ALi514X
;			W86967AF + W83977AF -- > W83977AF
;			NS307 + NS308 -- > NS308
;R21	12/04/96 LAW	Added DUAL5113.SIO (Use two ALi5113 I/O master - 3f1h
;			slave - 398h : com3,com4)
;R20	11/21/96 LAW	Added S6658663.SIO (SMC37C665 I/O & UMC8663 com3 + com4)
;R19	11/14/96 LAW    Added HMC83755.SIO (HMC HM83755 I/O Chipset)
;R18	10/17/96 LAW    Added W967.SIO (W83967AF I/O, RTC, KBC, PS2 mouse)
;R17	09/18/96 LAW    Added NS307.SIO (NS307 I/O, RTC, KBC, PS2 mouse)
;R16	08/27/96 LAW	Added ITE8680.SIO (ITE 8680 I/O, RTC, KBC, PS2 mouse)
;R15	08/19/96 RAY	Add switch to support MASM 6.X
;R14	08/14/96 KVN	Fixed swap floppy drive program IO chip error
;R13	08/14/96 LAW	Added DUAL669.SIO (UMC 8669 & SMC37C669 I/O Chipset)
;R12	08/09/96 RAY	Public Prg_Super_IO_Chip
;R11	06/26/96 RIC	Added I82091.SIO (Intel 82091AA I/O Chipset)
;R10	06/14/96 KGN	Added SMC932 , Ali5123 Support
;R09	04/24/96 KGN	Added NS 338 I/O Support
;R08	03/01/96 KGN	Added PRIME 3C I/O Support
;R07	01/19/96 KGN	Added Ali5123 I/O
;R06A	12/11/95 RCH	Both SMC93X & SMC92X need to set to PS2 mode, other-
;			wise keyboard can not work.
;R06	11/24/95 AVN	Added SMC92X I/O.
;R05	11/02/95 RCH	Added early IDE prgramming for IDE chip(ie. CMD/646)
;R04	10/26/95 RAY	Support UMC 8669
;R03	10/23/95 AVN	Move ES1788.SIO To AUDIO.ASM
;Rnn	10/12/95 RAY	Move all the extrn def. from here to individual
;			.SIO files
;R02	08/22/95 DNL	Kill duplicate codes
;R01	08/15/95 RCH	Added MIRQ & MDMA routing support for W787
;R00	08/12/95 RAY	For easy ebugging:
;			1. Save the old SUPERIO.ASM as SIOASM.812
;			2. Individual superio chip related codes will be
;			   moved to a different include files

;[]=========================================================================[]
;SUPERIO_NAME	USE_FILE	SUPPORT FUNCTION
;[]=========================================================================[]
;W83967AF	W967.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs
;				1 Support IrDA version 1.0(SIR) /1.1(FIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				General Purpose I/O Ports and support power led
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;W83977AF	W967.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs
;				1 Support IrDA version 1.0(SIR) /1.1(FIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				General Purpose I/O Ports and support power led
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;W83977TF	W977TF.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				General Purpose I/O Ports and support power led
;				% KBC Password On Now Function (only AW Version)
;[]=========================================================================[]
;W83977ATF	W967.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs
;				1 Support IrDA version 1.0(SIR) /1.1(FIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				General Purpose I/O Ports and support power led
;				OnNow Function
;[]=========================================================================[]
;W83877F	W877.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				1 ISA IDE
;				1 GAME PORT
;[]=========================================================================[]
;W83877AF	W877.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;				1 Parallel Port	(ECP support)
;				1 ISA IDE
;				1 GAME PORT
;[]=========================================================================[]
;W83877TF	W877.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				1 ISA IDE
;				1 GAME PORT
;				Serial IRQ , ISA IRQ selectable
;[]=========================================================================[]
;ITE8661	ITE8661.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs
;				1 Support IrDA version 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				General Purpose I/O Ports and support LED Blinking(after C Ver.)
;[]=========================================================================[]
;ITE8680	ITE8680.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;ITE8679	ITE8680.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;ITE8681	ITE8680.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				General Purpose I/O Ports and support LED Blinking
;				KBC Password On Now Function
;[]=========================================================================[]
;ITE8671	ITE8680.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				General Purpose I/O Ports and support LED Blinking
;				KBC Password On Now Function
;--------------------------------------------
;ITE8693        ITE8680.SIO     1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;                               2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;                               1 Parallel Port (ECP support)
;                               1 Keyboard Controller
;                               General Purpose I/O Ports and support LED Blinking
;                               KBC Password On Now Function
;                               Advanced Power Managment Controlling
;[]=========================================================================[]
;ITE8673        ITE8680.SIO     1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;                               2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;                               1 Parallel Port (ECP support)
;                               1 Keyboard Controller
;                               General Purpose I/O Ports and support LED Blinking
;                               KBC Password On Now Function
;[]=========================================================================[]
;ALi5123	ALi5123.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				Common I/O Ports 
;[]=========================================================================[]
;ALi513x	ALi5123.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(ALi5135)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;(ALi5133)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				Common I/O Ports 
;				Serial IRQ Support (Only)
;[]=========================================================================[]
;ALi514x	ALi5123.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(ALi5145)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;(ALi5143)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				Common I/O Ports and Power LED Flash
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;SMC37C67X	SMC67x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37C672)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;(SMC37C675)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				Serial IRQ (default), ISA IRQ selectable
;[]=========================================================================[]
;SMC37C68X	SMC68x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37C682)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;(SMC37C685)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				Serial IRQ Support (Only)
;				General Purpose I/O Ports
;[]=========================================================================[]
;SMC37M60X	SMC67x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37M602)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;(SMC37M605)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				Serial IRQ Support (Only)
;[]=========================================================================[]
;SMC37M61X	SMC67x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37M612)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;(SMC37M615)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				Serial IRQ Support (Only)
;[]=========================================================================[]
;SMC37C93X	SMC93x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37C932)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;(SMC37C935)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				1 ISA IDE
;				1 GAME PORT
;				General Purpose I/O Ports
;[]=========================================================================[]
;SMC37C93XFR	SMC93x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37C932FR)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;(SMC37C935FR)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				1 ISA IDE
;				1 GAME PORT
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;SMC37C93XAMP	SMC93x.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;(SMC37C932AMP)			2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;(SMC37C935AMP)			1 Parallel Port (ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				1 ISA IDE
;				1 GAME PORT
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;SMC37C669	SMC669.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				1 ISA IDE
;				1 GAME PORT
;[]=========================================================================[]
;SMC37C669FR	SMC669.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;				1 Parallel Port	(ECP support)
;				1 ISA IDE
;				1 GAME PORT
;[]=========================================================================[]
;NS307		NS307.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;NS308		NS307.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.1(FIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				1 Real Time Clock
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling
;[]=========================================================================[]
;NS309		NS309.SIO	1 compatible IBM PC AT disk drive, and Support 3-mode FDD
;				2 high-speed 16550 compatible UARTs or 1 IrDA 1.0(SIR)
;				1 Parallel Port	(ECP support)
;				1 Keyboard Controller
;				General Purpose I/O Ports
;				Advanced Power Managment Controlling

ifdef	MASM611			;R15
.MODEL  SMALL,BASIC             ;R15    
OPTION	PROC: PRIVATE
endif	;MASM611		;R15

.386p
		PAGE	56,132
		TITLE	SUPERIO.ASM
.XLIST
		INCLUDE	BIOS.CFG
		INCLUDE	COMMON.MAC
		INCLUDE	COMMON.EQU  		;R53
						
		INCLUDE POST.EQU

		include	PnP.equ		;R04

		extrn	Out_8042:near
		extrn	Buffer_8042_Full:near

		extrn	F000_call_proc:near

;R02		extrn	GetItem_Value:near
		extrn	F000_GetItem_Value:near		;R02
		extrn	F000_VECT:near			;R02
		extrn	RET_E_SEG:near		 	;R02
		extrn	F000_Buffer_8042_Full:near	;R02
		extrn	F000_Out_8042:near		;R02

ifdef	NEW_SUPERIDE_KERNEL				;R05
		extrn	Get_CfgSpace_Byte:near		;R05
		extrn	Set_CfgSpace_Byte:near		;R05
endif	;NEW_SUPERIDE_KERNEL				;R05

ifdef	NEW_SUPERIO_KERNEL

		Public	Prg_Super_IO_Chip		;R12
ifndef	Support_1_FDD					;R35
		extrn	SwapFloppy_Item:near		;R14
endif	;Support_1_FDD					;R35

	ifdef	FDD_3_Mode
		extrn	DRIVE_MODE_ITEM:near
	endif	;FDD_3_Mode
;R52 - start
		Extrn	F000_VNormal:Near
		Extrn	Read_Item_Value:Near
		Extrn	Self_Dis:Near
		Extrn	Re_Enable:Near
		extrn	Next_Item_Value:Near
		extrn	Prev_Item_Value:Near
		extrn	Write_Item_Value:Near
;R52 - end

;Rnn - starts
;	Kill extrnal definitions
;Rnn - Ends

;R03 ;----------------------------------------
;R03 ;Sound ES1788F external definitions
;R03 ;----------------------------------------
;R03 ifdef	ES1788F
;R03 		extrn	Audio_Item:near
;R03 		extrn	Audio_IO_Item:near
;R03 		extrn	Audio_IRQ_Item:near
;R03 		extrn	Audio_DMA_Item:near
;R03 		extrn	MPU401_Item:near
;R03 		extrn	MPU401_IO_Item:near
;R03 		extrn	JOYSTICK_Item:near
;R03 endif	;ES1788F

;R02 - start
	ECP_DMA_ROUTING	= 0
ifdef	ECP_DMA2
	ECP_DMA_ROUTING	= 1
endif	;ECP_DMA2
ifdef	ECP_DMA3
	ECP_DMA_ROUTING	= 1
endif	;ECP_DMA3
IF	ECP_DMA_ROUTING
ifndef	NO_DMA_ROUTING_CHIPSET		;R30
		extrn	Ct_Set_Ecp_DMA_Routing:near
	IFNDEF	ECP_DMA0
                extrn	EcpDma_Item:near
	ENDIF	;ECP_DMA0
endif;	NO_DMA_ROUTING_CHIPSET		;R30
endif;	ECP_DMA_ROUTING
ifdef	LPT_IRQ_ROUTING
		extrn	Ct_Set_LPT_IRQ_Routing:near
endif;	LPT_IRQ_ROUTING
;R02 - end

;Rnn - starts
;-----------
;SMC 651/665
;-----------
SMC_CHIP		=	0
ifdef	SMC37C651
SMC_CHIP		=	1
endif	;SMC37C651
ifdef	SMC37C665
SMC_CHIP		=	1
endif	;SMC37C665

;--------------
;NS 332/306/336
;--------------
NS_CHIP 		=	0
ifdef	PC87332
NS_CHIP 		=	1
endif	;PC87332
ifdef	PC87306
NS_CHIP 		=	1
endif	;PC87306
ifdef	PC87336
NS_CHIP 		=	1
endif	;PC87336

;R22 - start
;------------------
; ALi5123/513x/514x
;------------------
;R57ifdef	ALi513X
;R57ALi5123			EQU	1
;R57endif;	ALi513X
;R59 - start
;R59Aifdef	ALi5113D
ifdef	ALi5113B				;R59A
ALi5123			EQU	1
endif	;ALi5113B				;R59A
;R59Aendif	;ALi5113D
;R59 - end
;R57A - start
ifdef	ALi513X
ALi5123			EQU	1
endif;	ALi513X
;R57A - end
ifdef	ALi514X
ALi5123			EQU	1
endif;	ALi514X

;------------------
; W83967/977
;------------------
ifdef	W83967AF
W83977AF		EQU	1
endif;	W83967AF
ifdef	W83977ATF				;R39
W83977AF		EQU	1		;R39
endif;	W83977ATF				;R39
;R39ifdef	W83877TF
;R39W83877F				EQU	1
;R39endif;	W83877TF

;------------------
; NS307/308
;------------------
ifdef	NS308
NS307			EQU	1
endif;	NS308
ifdef	NS317					;R45
NS307			EQU	1		;R45
endif;	NS317					;R45

;R22 - end
;R23 - start
;------------------
; SMC37C669/669FR
;------------------
ifdef	SMC37C669FR
SMC37C669			EQU	1
endif;	SMC37C669FR
ifdef	SMC37N769				;R50
SMC37C669			EQU	1	;R50
endif;	SMC37N769				;R50

;R27ifndef	SMC37C93X
;R27ifdef	SMC37C67X
;R27SMC37C93X			EQU	1
;R27endif;	SMC37C67X
;R27endif;	SMC37C93X

;R32 ifndef	SMC37C93X
;R32 ifdef	SMC37C68X
;R32 SMC37C93X			EQU	1
;R32 endif;	SMC37C68X
;R32 endif;	SMC37C93X

ifdef	ITE8679
ITE8680				EQU	1
endif;	ITE8679
;R23 - end
ifdef	ITE8681					;R46
ITE8680				EQU	1	;R46
endif;	ITE8681					;R46
ifdef	ITE8671					;R46
ITE8680				EQU	1	;R46
endif;	ITE8671					;R46

;R26 - start
ifdef	ITE8661RF
ITE8661				EQU	1
endif;	ITE8661RF
;R26 - end

;R56
ifdef   ITE8693
ITE8680                         EQU     1
endif;  ITE8693
ifdef   ITE8673
ITE8680                         EQU     1
endif;  ITE8673
;R56

;R28 - start
ifdef	W83877AF
W83877F				EQU	1
endif;	W83877AF
ifdef	W83877TF
W83877F				EQU	1
endif;	W83877TF
;R28 - end
ifdef	W83877ATF				;R48
W83877F				EQU	1	;R48
endif;	W83877ATF				;R48

;R29 - start
ifdef	SMC37C93XAPM
SMC37C93X			EQU	1
endif;	SMC37C93XAPM
ifdef	SMC37C93XFR
SMC37C93X			EQU	1
endif;	SMC37C93XFR
;R29 - end
ifdef	SMC37M60x				;R37
SMC37C67X			EQU	1	;R37
endif;	SMC37M60x				;R37
ifdef	SMC37M61x				;R37
SMC37C67X			EQU	1	;R37
endif;	SMC37M61x				;R37

ifdef	SMC37C93XPM			;R44
SMC37C93X	EQU	1		;R44
endif;	SMC37C93XPM			;R44


		COMPILE_FOR_SUPERIO_ASM	= 1

		include Superio.SIO		;R49
	ifdef	Secondary_IO_Use		;R51
		include secondIO.SIO		;R51
	endif;	Secondary_IO_Use		;R51

endif	;NEW_SUPERIO_KERNEL

ifdef	NEW_SUPERIDE_KERNEL

		COMPILE_FOR_SUPERIDE_ASM = 1

	ifdef	ONBOARD_CMD_IDSEL
		include	cmdide.SIO
	endif	;ONBOARD_CMD_IDSEL

endif	;NEW_SUPERIDE_KERNEL

G_RAM		SEGMENT	USE16 AT 0

		ORG	04H*4
		INCLUDE	SEG_0.INC

		ORG	400H
		INCLUDE	G_RAM.INC

		ORG	2000h		;R04
		INCLUDE PNPDATA.INC	;R04

G_RAM		ENDS

;R25 - start
;R53ifdef	Notebook_Power_Management
if	STD_Function	EQ	1      	;R53
SM_RAM		SEGMENT	USE16 AT 0
		INCLUDE	SM_RAM.INC
SM_RAM		ENDS
endif	;STD_Function			;R53
;R53endif	;Notebook_Power_Management
;R25 - end

.LIST

;R15 - starts
ifdef	MASM611
DGROUP		GROUP	FCODE
FCODE           SEGMENT PUBLIC 'CODE'
                ASSUME  CS:DGROUP
FCODE           ENDS
else	;MASM611
;R15 - ends

DGROUP		GROUP	FCODE
FCODE           SEGMENT PARA PUBLIC 'CODE'
                ASSUME  CS:DGROUP
FCODE           ENDS
endif	;MASM611				;R15

EGROUP		GROUP	ECODE
ECODE		SEGMENT	USE16 PARA PUBLIC 'ECODE'
		ASSUME	CS:EGROUP,DS:G_RAM,ES:EGROUP

;R04 - starts
;[]======================================================================[]
;[]======================================================================[]
		Public	Kill_Onboard_PnP_IO
Kill_Onboard_PnP_IO	Proc	Near

	ifdef	UMC_8669
		call	Kill_8669_PnP_ISA
	endif	;UMC_8669

	ifdef	SMC669_N_UMC8669
		call	Kill_8669_PnP_ISA
	endif	;SMC669_N_UMC8669

	ifdef	S93X8669 			;R31
		call	Kill_8669_PnP_ISA	;R31
	endif	;S93X8669			;R31

		ret

Kill_Onboard_PnP_IO	Endp
;R04 - ends

;R40 - starts
ifdef	NEW_SUPERIO_KERNEL
;[]======================================================================[]
;[]======================================================================[]
		Public	Superio_Early_init
Superio_Early_init Proc	Near

;R49	ifdef	ITE8679
;R49		call	Superio_Early_Prg
;R49	endif;	ITE8679
;R49	ifdef	W83977TF			;R41
;R49		call	Superio_Early_Prg	;R41
;R49	endif;	W83977TF			;R41
;R49	ifdef	ITE8661				;R47
		call	Superio_Early_Prg	;R47
;R49	endif;	ITE8661				;R47
	ifdef	Secondary_IO_Use				;R51
;R55		call	Disable_Secondary_SuperIO_ComLptPort	;R51
		call	Secondio_Early_Prg	;R55
	endif;	Secondary_IO_Use				;R51

		ret

Superio_Early_init	Endp
endif	;NEW_SUPERIO_KERNEL
;R40 - ends

;[]======================================================================[]
;[]======================================================================[]
		Public	Init_Onboard_Super_IO
Init_Onboard_Super_IO	Proc	Near

;R05 ifdef	NEW_SUPERIO_KERNEL

		pushad
		push	ds
		push	es
		pushf
		cli

ifdef	NEW_SUPERIDE_KERNEL				;R05
		call	Early_IdeChip_Init		;R05
endif;	NEW_SUPERIDE_KERNEL				;R05

ifdef	NEW_SUPERIO_KERNEL				;R05
		call	Prg_Super_IO_Chip
endif	;NEW_SUPERIO_KERNEL				;R05

ifdef	W83977ATF					;R54TEMP Code
	multi_Node_move_to_E000		EQU	1	;R54TEMP Code
endif;	W83977ATF					;R54TEMP Code
ifdef	W83977AF					;R54TEMP Code
	multi_Node_move_to_E000		EQU	1	;R54TEMP Code
endif;	W83977AF					;R54TEMP Code
ifdef	W83967AF					;R54TEMP Code
	multi_Node_move_to_E000		EQU	1	;R54TEMP Code
endif;	W83967AF					;R54TEMP Code
;R57- start
;R57Aifdef	ALi513x
;R57AALi513xF		EQU	1
;R57Aendif	;ALi513x
;R57Aifdef	ALi513xB
;R57AALi513xF		EQU	1
;R57Aendif	;ALi513xB
;R57 - end
ifdef	ALi513xF					;R54TEMP Code
	multi_Node_move_to_E000		EQU	1	;R54TEMP Code
endif;	ALi513xF					;R54TEMP Code
ifdef	multi_Node_move_to_E000				;R54TEMP Code
		call	Move_E000_Node_to_F000		;R54
endif;	multi_Node_move_to_E000				;R54TEMP Code

		popf
		pop	es
		pop	ds
		popad

;R05 endif	;NEW_SUPERIO_KERNEL

		ret

Init_Onboard_Super_IO	Endp

ifdef	NEW_SUPERIO_KERNEL

;Rnn		COMPILE_FOR_SUPERIO_ASM	EQU	1
		COMPILE_FOR_SUPERIO_ASM	=	2	;Rnn

		include Superio.SIO		;R49
	ifdef	Secondary_IO_Use		;R51
		include secondIO.SIO		;R51
	endif;	Secondary_IO_Use		;R51

endif	;NEW_SUPERIO_KERNEL

ifdef	NEW_SUPERIDE_KERNEL

		COMPILE_FOR_SUPERIDE_ASM = 2

	ifdef	ONBOARD_CMD_IDSEL
		include	cmdide.SIO
	endif	;ONBOARD_CMD_IDSEL

endif	;NEW_SUPERIDE_KERNEL

ifndef	NO_USE_KB				;R33
ifdef	SMC37C93X
SPECIAL_INIT_KBC	EQU	1
endif;	SMC37C93X

ifdef	SMC_92X				;R06A
SPECIAL_INIT_KBC	EQU	1      	;R06A
endif;	SMC_92X				;R06A

ifdef	PC87306
SPECIAL_INIT_KBC	EQU	1
endif;	PC87306

ifdef	Ali5123				;R07
SPECIAL_INIT_KBC	EQU	1	;R07
endif;	Ali5123				;R07

ifdef	S93X_A5123			;R10
SPECIAL_INIT_KBC	EQU	1	;R10
endif;	S93X_A5123			;R10

ifdef	ITE8680				;R16
SPECIAL_INIT_KBC	EQU	1	;R16
endif	;ITE8680			;R16

;R60 - start
ifdef	ITE8712
ITE8712			EQU	1
endif	;ITE8712

ifdef	ITE8702
SPECIAL_INIT_KBC	EQU	1	
endif	;ITE8702
;R60 - end

;R61 - start
ifdef	PC87366
PC87364		EQU	1
endif;	PC87366

ifdef	PC87364
SPECIAL_INIT_KBC	EQU	1
endif;	PC87364
;R61 - end

ifdef	NS307				;R17
SPECIAL_INIT_KBC	EQU	1	;R17
endif	;NS307				;R17

ifdef	NS309				;R38
SPECIAL_INIT_KBC	EQU	1	;R38
endif;	NS309				;R38

ifdef	W83977AF 			;R18
SPECIAL_INIT_KBC	EQU	1	;R18
endif	;W83977AF			;R18

ifdef	I8680663			;R24
SPECIAL_INIT_KBC	EQU	1	;R24
endif	;I8680663			;R24

ifdef	SMC37C67X			;R27
SPECIAL_INIT_KBC	EQU	1	;R27
endif	;SMC37C67X			;R27

ifdef	SMC37C68X			;R32
SPECIAL_INIT_KBC	EQU	1	;R32
endif	;SMC37C68X			;R32

ifdef	S93X8669			;R31
SPECIAL_INIT_KBC	EQU	1	;R31
endif	;S93X8669			;R31

ifdef	W83977_N_ALi5119		;R34
SPECIAL_INIT_KBC	EQU	1	;R34
endif;	W83977_N_ALi5119		;R34

ifdef	W83977TF			;R39
SPECIAL_INIT_KBC	EQU	1	;R39
endif;	W83977TF			;R39

;R58 - start
ifdef	W83627F
SPECIAL_INIT_KBC	EQU	1
endif;	W83627F		 

ifdef	W83627HF
SPECIAL_INIT_KBC	EQU	1
endif;	W83627HF		 
;R58 - end

ifdef	ALi513x_5113			;R42
SPECIAL_INIT_KBC	EQU	1	;R42
endif;	ALi513x_5113			;R42
endif;	NO_USE_KB				;R33

		public	Special_KBC_Init
Special_KBC_Init	proc	near
ifdef	SPECIAL_INIT_KBC
	;enable PS2 mode
		mov	al,0cbh
;R02		f000_call	Out_8042
		call	F000_Out_8042		;R02
		mov	al,1			;enable PS2 mode
		out	60H,al
		NEWIODELAY
;R02		f000_call	Buffer_8042_Full
		call	F000_Buffer_8042_Full	;R02
endif;	SPECIAL_INIT_KBC
		ret
Special_KBC_Init	endp

;[]----------------------------------------------------------------[]
;[]----------------------------------------------------------------[]
		Public	E_GetItem_Value
E_GetItem_Value	Proc	Near
;R02		F000_Call GetItem_Value
		jmp	F000_GetItem_Value	;R02
		ret
E_GetItem_Value	Endp

ECODE		ENDS
		END
