;	[]===========================================================[]
;
;	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.
;
; 	[]===========================================================[]
;

;		PAGE	60,132
;		TITLE	POST  -- 386 ROM/BIOS POST
;----------------------------------------------------------------------------
;Rev	Date	 Name	Description
;---------------------------------------------------------------------------
;R43	04/23/99 KVN	Fixed system hang when IDE HDD size over 65GB
;R42	04/09/99 RIC	Add "SPECIAL_SHARE_MEMORY_SHOW" definition for special
;			customer.
;R41	03/23/99 JDN	Support other vga wake up in S4
;R40	03/01/99 KVN	Changed "UDMA 2" string to "UDMA 33" for customer request
;R39	02/26/99 RIC	Fixed that "NO_CPU_CLOCK_DISPLAY" definition is not
;			available.
;R38	02/08/99 ATY	Move Line of position for Post Screen overflow.
;R37	12/02/98 KVN	Support IDE DMA transfer function
;R36	12/01/98 RAX	Added "Show_No_P6_Ucode_msg" define to show warning
;			message of missing P6 u-code
;R35	11/27/98 JKY	Mobile Pentium II CPU(Id=66A) 300MHz not show 300AMHz
;R34A	11/13/98 TNY	Moved to CPUPOST.ASM
;R34	11/09/98 TNY	Move measure cpu speed hook for old 586 CPU to xfile.asm
;			, because this area is cacheable.
;R33	10/19/98 TNY	Add "MoreConfigTblLineIfNo4IDE" option.
;R32	10/01/98 JDN	Added code for Wake up VGA in S4
;R31A	09/23/98 RIC	Fix that the IRQ of ACPI show IRQ0 when assign NA to 
;			the IRQ of ACPI .
;R31	09/19/98 TNY	Add show ACPI resource (IRQ).
;R30	08/28/98 RAY	Fixed:
;
;			The show pci device listing routine(Show_PCI_Device)
;			will skip showing PCI devices which Revision ID 
;			(reg.08h) is equal to 0FFh.
;			
;R29	08/20/98 KEN	Add declaration of "NO_ISA_PNP" to unsupport ISA/PNP
;			cards for the system doesn't contain ISA bus.
;R28	08/06/98 RCH	Added a switch to have no "L2 cache size" display
;R27	07/15/98 KVN	Added a error message for 0E000h code exceed 64K
;			during make BIOS when not define "AVIDEO_AT_F000"
;R26	07/07/98 RAY	Add Public routine: X_Display_String
;R25	06/30/98 RCH	Display "300A MHz" instead of "300MHz" if Mendocino
;			CPU is installed. It is requested by Intel to 
;			distinguish 300Mhz for Covington & Mendocino.
;R24	06/24/98 KVN	Remove all BFEATURE help string to XGROUP(xfile.asm)
;R23	06/18/98 RAY	Add switch "AGP_Device_List" which will show 
;			"PCI/AGP device listing ..." instead of
;			"PCI device listing ..."
;R22	05/21/98 LAW	add "SPECIAL_SHOW_IDE_DEVICE_IRQ" for show onboard IDE
;			IRQ 14/15
;R21	05/07/98 DRS	This function depends on New_Swap_Fdd_Method
;			The new method is Drive A exists or Drive B exists , 
;			the Floppy Swap function is available.
;R20	04/23/98 ADS	Fixed to define "Skip_Cache_Size_If_None" still show
;			cache string.
;R19	04/21/98 RAY	Dynamic decide the colon position of the CPU type
;			field in the system configuration table in case
;			some CPUs have a very long name.
;R18	04/21/98 BAR	Fixed show UDMA string & mode error.
;			When CDROM connected in second channel.
;R17	04/16/98 RCH	Added switch "BLANK_FOR_NON_L2_CACHE" to show blank
;			string instead of "none" if no L2 cache or L2 is
;			disabled
;R16	03/25/98 MIL	Added "S2D_SUPPORT" define, for support Save TO Disk
;			function, (Cyrix MediaGx Project Only).
;R01A	03/19/98 KVN	If define 'NO_SYSTEM_CONFIG' then dont make binary
;			code for BIOS
;R15	03/11/98 PAL	Modify NoteBook_Power_Management definition to STD_Function
;R14	02/20/98 CLF	Fix margin line problem for No_Support_4_IDE .
;R13	02/16/98 RAY	Fix problem in CMOS Setup
;			-------------------------
;
;			Fix mess up of "Available Option" Help when handling
;			new format ?feature.asm but some how not every
;			MENUITEM's [ITEM].HelpOffset has been changed to point
;			to a string offset in XGROUP
;
;			i.e. Allow you to still point to STD_HELP_STR in
;			     [ITEM].HelpOffset even though that file has
;			     already been claimed to be a new format file.
;			     To allow this, we have to move the STD_HELP_STR
;			     label to the very beginning of XGROUP
;
;R12	01/22/98 JKY	Added a new segment (YGROUP).
;R11B	01/19/98 KVN	Fixed link error during making BIOS stage when no
;			defined PNP_BIOS
;R11A	01/07/98 KEN	Show comma between two DMA or IRQ.
;R11	01/07/98 KEN	Added codes to show ISA/PNP devices.
;R10	01/07/98 KEN	Modified some codes to use the display interface
;			of "USERINT.ASM" to save codes space.
;R09	10/23/97 KVN	Show all IDE device on system config table if define
;			support LS120/ZIP/CDROM in BIOS.CFG
;R08	10/08/97 RIC	Add "ONCHIP_2ND_ALWAYS_DISABL" define.
;R07	08/21/97 BAR	Added S.M.A.R.T. function
;R06	07/05/97 RAY	Add X_GetItem_Value
;R05	07/01/97 JSN	Add Config_Tbl_Lines define.
;R04	06/12/97 KVN	Definition all GROUP of BIOS before all source file
;			that you can create any GROUP in every ASM file and
;			move source code into any GROUP to save another GROUP
;			code space
;R03	06/11/97 RCH	Fixed compiler error for without "NEW_IDE_MODE_3"
;			switch.
;R02A	06/10/97 KVN	Fixed compiler error in MP system
;R02	06/10/97 JKY	Fixed compiler error in NoteBook
;R01	06/06/97 KVN	Move 'Show_system_cfg' subroutine from E8POST.ASM to
;			save E8 code space


.386P
		INCLUDE BIOS.CFG
		INCLUDE COMMON.EQU
		INCLUDE COMMON.MAC
		INCLUDE	PNP.EQU				;R11

;R01 start
ifndef	No_Support_4_IDE
Support_4_IDE		EQU	1
endif	;No_Support_4_IDE

		include	post.equ

		public	XCALL_PROC
ifndef	NO_SYSTEM_CONFIG			;R01A
		public	SHOW_SYSTEM_CFG
		public	RIGHT_SIDE
		public	CDROM_STR
		public	ARMD_STR
		public	IOMEGA_ZIP_STR
		public	NONE_STR
		public	MB_STR
		public	HDD_MODE_STR
endif	;NO_SYSTEM_CONFIG			;R01A

		extrn	Cal_HDD_Size:near		;R43
ifdef	NEW_IDE_MODE_3					;R03
		extrn	IdeA_Mode_Item:near
		extrn	IdeB_Mode_Item:near
 ifdef	Support_4_IDE					;R03
  ifndef  ONCHIP_2ND_ALWAYS_DISABLE			;R08
		extrn	IdeC_Mode_Item:near
		extrn	IdeD_Mode_Item:near
  endif;  ONCHIP_2ND_ALWAYS_DISABLE			;R08
 endif;	Support_4_IDE					;R03
endif;	NEW_IDE_MODE_3					;R03

;R11 - start
ifdef	PNP_BIOS	;R11B
ifndef	NO_ISA_PNP					;R29
		extrn	Get_LogicDev_String:near	;PNPPOST.ASM
		extrn	Wait_For_Key:near		;PNPPOST.ASM
		extrn	Wake_All_Cards:near		;PNPPOST.ASM
		extrn	Get_PnP_Reg:near		;PNPPOST.ASM
		extrn	Set_PnP_Reg:near		;PNPPOST.ASM
endif	;NO_ISA_PNP					;R29
endif	;PNP_BIOS	;R11B
;R11 - end
;R10 - start
		extrn	Set_Clip:near			;USERINT.ASM
		extrn	Vlf:near			;USERINT.ASM
		extrn	Vcr:near			;USERINT.ASM
		extrn	Cursor_On:near			;USERINT.ASM
;R10 - end
		extrn	Display_String:near
		extrn	HDISK_PARMS:near
		extrn	Disp_Access_mode:near
		extrn	Get_HDD_CMOS_Info:near
		extrn	SHOW_SIX_DIGIT:near
		extrn	Disp_Dword_Int6:near
		extrn	SHOW_SIX_DIGIT:near
		extrn	AX_TO_HEX3:near
		extrn	AX_TO_DEC3:near
		extrn	AX_TO_DEC2:near
		extrn	Read_Item_Value:near
		extrn	Get_VarString_Offset:near
		extrn	post_call_proc:near
		extrn	MONO_STYLE:near
		extrn	DISP_STR_IN_BIOS:near
		extrn	CPU_DISPLAY:near
		extrn	DISP_STR_IN_POST:near
		extrn	DISP_EXTRA_CPU_INFO:near
		extrn	TRY_SHOW_PRATING:near
ifndef	Support_1_FDD					;R02
		extrn	SWAPFLOPPY_ITEM:near
endif	;Support_1_FDD					;R02
		extrn	F000_GETITEM_VALUE:near
		extrn	GETITEM_VALUE:near		;R06
		extrn	DRIVE_A_ITEM:near
ifndef	Support_1_FDD					;R02
		extrn	DRIVE_B_ITEM:near
endif	;Support_1_FDD					;R02
		extrn	TRAN_HDD_USER_TYPE:near
		extrn	F000_CALL_PROC:near
		extrn	GET_CACHE_SIZE:near
		extrn	F000_CALL_PROC:near
		extrn	EXTCACHE_ITEM:near
		extrn	CONVERT_P6L2_CACHE:near
		extrn	GET_CACHE_SIZE:near
		extrn	F000_CALL_PROC:near
		extrn	DISP_WORD_INT5:near
		extrn	F000_CALL_PROC:near
		extrn	F000_DISPLAY_CHAR:near
		extrn	Display_Char:near		;R11A
		extrn	VIDEO_ITEM:near
		extrn	CT_SHOW_CONFIG:near
		extrn	F000_CALL_PROC:near
		extrn	SYSTEM1_BYTE:near
		extrn	VCRLF:near
		extrn	DISP_WORD_HEX4:near
		extrn	F000_CALL_PROC:near
		extrn	DISP_WORD_HEX4:near
		extrn	F000_CALL_PROC:near
ifdef	PCI_BUS
	ifdef	CONFIG_MECHANISM_1
		extrn	FPROC_QUALIFY_PCIBUS:far
	endif	;CONFIG_MECHANISM_1
endif	;PCI_BUS
		extrn	DISP_BYTE_INT2:near
		extrn	F000_CALL_PROC:near

		extrn	HDDC_ITEM:near
		extrn	HDDD_ITEM:near
ifdef	Support_4_IDE
		extrn	HDDE_ITEM:near
		extrn	HDDF_ITEM:near
endif	;Support_4_IDE
;R01 end

ifdef	MP_SUPPORT				;R02A
		extrn	If_MP_PLUGGED:near	;R02A
endif	;MP_SUPPORT				;R02A

;R02 start
;R15IFDEF	NoteBook_Power_Management
IF	STD_Function	EQ	1		;R15
;R32 - start
ifdef	ACPI_Support							
ifdef	S4_support					
		extrn	E000_Open_PM_RAM:near		
		extrn	E000_close_PM_RAM:near
endif	;S4_support				
endif	;ACPI_Support	
;R32 - end				
		Extrn	Show_PM_Config:near		
ENDIF;	STD_Function				;R15
;R15endif	;NoteBook_Power_Management
;R02 end
						
;R16 - starts
ifdef	VSA_VGA
ifdef	S2D_SUPPORT
		Extrn	Show_PM_Config:near
endif	;S2D_SUPPORT
endif	;VSA_VGA
;R16 - ends
;R22 - start
ifdef	SPECIAL_SHOW_IDE_DEVICE_IRQ
		extrn	SPECIAL_SHOW_IDE_IRQ:near
endif;	SPECIAL_SHOW_IDE_DEVICE_IRQ
;R22 - end

ifdef	SPECIAL_SHARE_MEMORY_SHOW					;R42
		extrn	Ct_Share_Memory_Size:near			;R42
endif	;SPECIAL_SHARE_MEMORY_SHOW					;R42

;R32 - start
ifdef	ACPI_Support
ifdef	S4_Support		
PM_RAM          SEGMENT USE16 AT 0

                ORG     0

PM_RAM_START    LABEL   BYTE

                include PM_RAM.INC
                include Ct_PMRAM.INC

PM_RAM_LEN      EQU     $-Offset PM_RAM:PM_RAM_START

PM_RAM          ENDS
endif	;S4_Support		
endif	;ACPI_Support
;R32 - end				

G_RAM		SEGMENT USE16 AT 0

		ORG	04H*4
		INCLUDE SEG_0.INC

		ORG	400H
		INCLUDE G_RAM.INC

		ORG	2000h				;R11
		INCLUDE PNPDATA.INC			;R11

G_RAM		ENDS

		PAGE

;R04 start
EGROUP		GROUP	ECODE
ECODE		SEGMENT USE16 PARA PUBLIC 'ECODE'
		ASSUME	CS:EGROUP
		db	'BsG'				;R12
		db	Group_Number			;R12
Group_start:						;R12
		dw	seg EGROUP			;R12
		dw	seg DGROUP			;R12
		dw	seg XGROUP			;R12
		dw	seg YGROUP			;R12
Group_Number	equ	($-offset Group_start)/2	;R12
ifndef	AVIDEO_AT_F000					;R27
		extrn	E000_code_end:near		;R27
		dw	offset E000_code_end		;R27
endif	;AVIDEO_AT_F000					;R27
ECODE		ENDS

;R27 start
EGROUP		GROUP	EFCODE
EFCODE		SEGMENT	USE16 DWORD COMMON 'EFCODE'
		ASSUME	CS:EGROUP
EFCODE		ENDS
;R27 end

DGROUP		GROUP	FCODE
FCODE		SEGMENT PARA PUBLIC 'CODE'
		ASSUME	CS:DGROUP
FCODE		ENDS

DGROUP		GROUP	@DATAC
@DATAC		SEGMENT	USE16 DWORD COMMON 'DATAC'
		ASSUME	CS:DGROUP
@DATAC		ENDS
;R04 end

XGROUP		GROUP	XCODE
XCODE		SEGMENT USE16 PARA PUBLIC 'XCODE'
		ASSUME	CS:XGROUP,ES:XGROUP

X_call_VECT:
		retn
X_call_end:
		retf

		public	Xcall_proc
Xcall_proc:
		push	offset X_call_end
		push	ax
		pushf
		cli
		xchg	bp,sp
		mov	ax,[bp+4]
		xchg	ax,[bp+6]
		mov	[bp+4],ax
		xchg	bp,sp
		popf
		pop	ax
		jmp	short X_call_VECT

		Public	Std_Help_Str		;R13
Std_Help_Str:					;R13
		db	'STD_HELP'		;R13

;R24 start
		public	Help_Virus
Help_Virus:
ifndef	VIRUS_HELP_NEEDED
		db	0
else	;No_Virus_Help
		db	'VIRUS WARNING:',NEWLINE,NEWLINE
		db	'Allows you to choose the VIRUS warning',NEWLINE
		db	'feature for HARD Disk boot sector',NEWLINE
		db	'protection.',NEWLINE
		db	'If this function is enabled and',NEWLINE
		db	'someone attempt to write data into',NEWLINE
		db	'this area, BIOS will show a warning',NEWLINE
		db	'message on screen and alarm beep',0
endif	;No_Virus_Help

		public	DMI_Event_Log_Help
DMI_Event_Log_Help:
		db	'Description :',NEWLINE,NEWLINE
		db	'    There are two choices to decide',NEWLINE
		db	'  whether or not to store POST error',NEWLINE
		db	'  messages to the DMI Event log when',NEWLINE
		db	'  POST error occur.',NEWLINE
		db	NEWLINE
		db	'Option :',NEWLINE
		db	'  Enabled : Store POST error message',NEWLINE
		db	'            to the DMI Event log',NEWLINE
		db	'  Disabled: Don',39,'t store POST error',NEWLINE
		db	'            message to the DMI Event',NEWLINE
		db	'            log.',0
		public	Clear_DMI_Event_Log_Help
Clear_DMI_Event_Log_Help:
		db	'Description :',NEWLINE,NEWLINE
		db	'    When this item is selected to',NEWLINE
		db	'  [Yes],the DMI event log will be',NEWLINE
		db	'  clear on POST stage after reboot',NEWLINE
		db	'  and then this item value will be',NEWLINE
		db	'  automatic set to [No].',0
		public	View_DMI_Event_Log_Help
View_DMI_Event_Log_Help:
		db	'Description :',NEWLINE,NEWLINE
		db	'    Press [Enter] to show all DMI',NEWLINE
		db	'  event logs.',0
		public	Mark_DMI_Events_Log_Help
Mark_DMI_Events_Log_Help:
		db	'Description :',NEWLINE,NEWLINE
		db	'    Clear all DMI event logs',NEWLINE
		db	'  immediately.',NEWLINE,NEWLINE
		db	'    Press [Enter] will pop up a',NEWLINE
		db	'  confirm screen.Hit [Y] and [enter],',NEWLINE
		db	'  then clear all DMI event logs',NEWLINE
		db	'  right now.',0
;R24 end

ifndef	NO_SYSTEM_CONFIG			;R01A
;R01 start
Show_System_Cfg Proc	Near
		push	ds
		push	es
		mov	ax,G_RAM
		mov	es,ax
		assume	es:G_RAM

		push	cs
		pop	ds
;R10 - start
		xor	cx, cx
		mov	dx, 184Fh
		F000_CALL	Set_Clip
;R10 - end

;--------------- Show Border ----------------------------------

		mov	word ptr Color_Offset[bp],offset Mono_Style
		mov	si,offset SYSTEM_CONFIG_MSG
		post_func_call	Disp_Str_In_BIOS

;--------------- Show CPU_Type ---------------------

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+1) shl 8) + (LEFT_SIDE+20)
		push	0F000h
		pop	ds
		post_func_call	CPU_Display
;R19 - starts
		call	Decide_CPU_Field_Colon
		call	Show_CPU_Field_Colon
;R19 - ends
		post_func_call	Disp_Str_In_POST
		post_func_call	Disp_Extra_CPU_Info
IF	BIOS_SUPPORT_586
ifdef	DISP_MHZ_FOR_AMD_CYRIX
		mov	di, 1				;show '-'
		post_func_call	Try_Show_PRating
	_11OLK:
endif	;DISP_MHZ_FOR_AMD_CYRIX
ENDIF	;BIOS_SUPPORT_586

;-------------- Show Math Coprocessor --------------

		push	cs
		pop	ds
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+2) shl 8) + (LEFT_SIDE+20)
		call	Show_CPU_Field_Colon			;R19
		mov	si,offset Not_Install_Str
		test	byte ptr FIXED_DISK_STEP[bp],01h
		jz	short @F
		mov	si,offset Install_Str
	@@:
		post_func_call	Disp_Str_In_BIOS

;---------------- Show CPU Clock ----------------------
ifndef	NO_CPU_CLOCK_DISPLAY					;R39
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+3) shl 8) + (LEFT_SIDE+20)
		call	Show_CPU_Field_Colon			;R19

IF	BIOS_SUPPORT_586
ifndef	DISP_MHZ_FOR_AMD_CYRIX
		xor	di, di			;do not show '-'
 		post_func_call	Try_Show_PRating	;show p-rating for K5 & M1
		jnc	short End_Sys_Clk	;show p-rating successfully
	No_Show_P_Rating:
endif	;DISP_MHZ_FOR_AMD_CYRIX
ENDIF	;BIOS_SUPPORT_586

		call	SysCfg_CPU_Clock1

	End_Sys_Clk:
endif;	NO_CPU_CLOCK_DISPLAY					;R39
;---------------- Show Floppy Drive A ----------------------
ifndef	Support_1_FDD
ifndef	SWAP_FDD_SHOW
ifNdef	New_Swap_Fdd_Method					;R21
		test	byte ptr FLOPPY_TYPE[bp],00001111b
		jz	short @F
		mov	si,offset SwapFloppy_Item
;R06		post_func_call	F000_GetItem_Value
		call	X_GetItem_Value				;R06
		or	al,al
		jz	short @F
		rol	byte ptr FLOPPY_TYPE[bp],4
@@:
endif	;New_Swap_Fdd_Method					;R21
endif;	SWAP_FDD_SHOW
endif	;Support_1_FDD

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+5) shl 8) + (LEFT_SIDE+20)
		mov	bx,offset DRIVE_A_ITEM
		call	Show_CMOS_Str

;---------------- Floppy Drive B ----------------------

ifndef	Support_1_FDD
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+6) shl 8) + (LEFT_SIDE+20)
		mov	bx,offset DRIVE_B_ITEM
		call	Show_CMOS_Str
endif	;Support_1_FDD

;---------------- Show Hard Drive C ----------------------

		F000_call	Tran_HDD_User_Type

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+7) shl 8) + (LEFT_SIDE+20)
		test	byte ptr CDROM_Exist_Flag[bp],PM_CDROM
		jz	short @F
		xor	di,di
;R09		call	Display_CDROM
		call	Display_ATAPI		;R09
		jmp	short Show_DriveD
@@:
		test	byte ptr FIXED_ERROR[bp],HDD_Drive0_Err
		jz	short @F
		call	Display_None
		jmp	short Show_DriveD
@@:
		mov	bx,offset HDDC_ITEM
		mov	al,CMOS12[bp]
		and	al,0f0h
		cmp	al,0f0h
		je	short @F
		shr	al,4
		mov	CMOS19[bp],al
	@@:
ifdef	NEW_IDE_MODE_3
		xor	di,di
endif	;NEW_IDE_MODE_3
		mov	al,es:[HDD_MODE_FLAG]
		and	al,3			; get drive C mode (LBA or Normal ...)
		call	SYSCFG_HDD

;---------------- Show Hard Drive D ----------------------
Show_DriveD:

ifndef	IDE_PRIMARY_ONLY
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+8) shl 8) + (LEFT_SIDE+20)
		test	byte ptr CDROM_Exist_Flag[bp],PS_CDROM
		jz	short @F
		mov	di,1
;R09		call	Display_CDROM
		call	Display_ATAPI		;R09
		jmp	short Show_DriveE
@@:
		test	byte ptr FIXED_ERROR[bp],HDD_Drive1_Err
		jz	short @F
		call	Display_None
		jmp	short Show_DriveE
@@:
		mov	bx,offset HDDD_ITEM
		mov	al,CMOS12[bp]
		and	al,0fh
		cmp	al,0fh
		je	short @F
		mov	CMOS1A[bp],al
	@@:
		mov	di,1
		mov	al,es:[HDD_MODE_FLAG]
		shr	al,2
		and	al,3
		call	SYSCFG_HDD
endif	;IDE_PRIMARY_ONLY
Show_DriveE:
ifdef	Support_4_IDE

;---------------- Show Hard Drive E ----------------------
ifdef	IDE_PRIMARY_ONLY
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+8) shl 8) + (LEFT_SIDE+20)
else	;IDE_PRIMARY_ONLY
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+9) shl 8) + (LEFT_SIDE+20)
endif	;IDE_PRIMARY_ONLY
		test	byte ptr CDROM_Exist_Flag[bp],SM_CDROM
		jz	short @F
		mov	di,2
;R09		call	Display_CDROM
		call	Display_ATAPI		;R09
		jmp	short Show_DriveF
@@:
		test	byte ptr FIXED_ERROR[bp],HDD_Drive2_Err
		jz	short @F
		call	Display_None
		jmp	short Show_DriveF
@@:
		mov	bx,offset HDDE_ITEM
		mov	di,2
		mov	al,es:[HDD_MODE_FLAG]
		shr	al,4
		and	al,3			; get drive E mode (LBA or Normal ...)
		call	SYSCFG_HDD

;---------------- Show Hard Drive F ----------------------
Show_DriveF:

ifndef	IDE_PRIMARY_ONLY
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+10) shl 8) + (LEFT_SIDE+20)
		test	byte ptr CDROM_Exist_Flag[bp],SS_CDROM
		jz	short @F
		mov	di,3
;R09		call	Display_CDROM
		call	Display_ATAPI		;R09
		jmp	short Show_Drive_End
@@:
		test	byte ptr FIXED_ERROR[bp],HDD_Drive3_Err
		jz	short @F
		call	Display_None
		jmp	short Show_Drive_End
@@:
		mov	bx,offset HDDF_ITEM
		mov	di,3
		mov	al,es:[HDD_MODE_FLAG]
		shr	al,6
		and	al,3			; get drive F mode (LBA or Normal ...)
		call	SYSCFG_HDD
Show_Drive_End:

endif	;IDE_PRIMARY_ONLY
endif	;Support_4_IDE

;---------------- Show Base Memory --------------------

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+1) shl 8) + (RIGHT_SIDE+20)
		xor	eax,eax
		mov	ax,CMOS15[bp]	;BASE_MEMORY[bp]
		call	short SYSCFG_Mem

;---------------- Show Extended Memory --------------------

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+2) shl 8) + (RIGHT_SIDE+20)
		mov	eax,EXT_MEM_SIZE[bp]
ifdef	SPECIAL_SHARE_MEMORY_SHOW					;R42
		push	eax						;R42
		F000_call Ct_Share_Memory_Size	;get shared mem. size	;R42
		xor	ecx,ecx						;R42
		mov	cx, ax						;R42
		pop	eax						;R42
		add	eax, ecx					;R42
endif	;SPECIAL_SHARE_MEMORY_SHOW					;R42
		call	SYSCFG_Mem

;---------------- Show Cache Size --------------------------
ifndef	NO_L2_SIZE_DISPLAY				;R28

ifdef	Skip_Cache_Size_If_None
		F000_call	Get_Cache_Size
		or	al,al
		jz	SYSCFG_Cache_Mem_Exit
endif	;Skip_Cache_Size_If_None

		push	cs
		pop	ds
		mov	si, offset Cache_Mem_Size_Str
		post_func_call	Disp_Str_In_BIOS

		mov	si,offset ExtCache_Item
;R06		post_func_call	F000_GetItem_Value
		call	X_GetItem_Value				;R06
		or	al,al
		jz	short Disp_Cache_None

;Get L2 cache size by execute CPUID (0fh,0A2h) for P6
; bit 3-0 = 42H : 256k
;	    43H : 512k
		mov	al,byte ptr FIXED_DISK_STEP[bp]
		and	al,CPU_TYPE_MASK
		cmp	al,TYPE_P6	      	;P6 CPU ?
		jne	short Not_P6_CPU

		mov	eax,2			;read cache isze
		db	0Fh,0A2h		;OP code: CPUID

		post_func_call	Convert_P6L2_Cache	;convert cache size

	   	jmp	short Show_L2_Size
Not_P6_CPU:

		F000_call	Get_Cache_Size
  ifdef	 Skip_Cache_Size_If_None		;R20
		or	al,al			;R20
		jz	SYSCFG_Cache_Mem_Exit	;R20
  endif; Skip_Cache_Size_If_None		;R20
Show_L2_Size:
		or	al,al
		jnz	short @F
Disp_Cache_None:
 ifndef	BLANK_FOR_NON_L2_CACHE				;R17

		add	byte ptr CURSOR_X[bp],3
		call	Display_None
 endif;	BLANK_FOR_NON_L2_CACHE				;R17
		jmp	short SYSCFG_Cache_Mem_Exit
	@@:
		add	byte ptr CURSOR_X[bp],1
		mov	cl,al
		dec	cl
		mov	ax,16
		shl	ax,cl
		F000_call	Disp_Word_Int5
		mov	al,'K'
;R11A		post_func_call	F000_Display_Char
		call	X_Display_Char		;R11A

SYSCFG_Cache_Mem_Exit:
ifdef	MP_SUPPORT
ifdef	P6_BIOS_ONLY

;Display secondary CPU's L2 cache size if dual CPUs are plugged

;R02A		call	If_MP_PLUGGED 		;2 CPUs installed ?
		post_func_call	If_MP_PLUGGED 		;R02A 2 CPUs installed ?
		jc	short SYSCFG_Cache_Mem_Exit1;no, no display

		mov	al,'/'
;R11A		post_func_call	F000_Display_Char
		call	X_Display_Char		;R11A

		push	es
		xor	ax,ax
		mov	es,ax
		mov	dl,byte ptr es:[0502H]		;get cache size
		pop	es

;R02A		call	Convert_P6L2_Cache	;convert cache size
		post_func_call	Convert_P6L2_Cache	;R02A ;convert cache size

		or	al,al
		jnz	short @F

		call	Display_None
		jmp	short SYSCFG_Cache_Mem_Exit1
	@@:
		mov	cl,al
		dec	cl
		mov	ax,16
		shl	ax,cl
		F000_call	Disp_Word_Int5
		mov	al,'K'
;R11A		post_func_call	F000_Display_Char
		call	X_Display_Char		;R11A

SYSCFG_Cache_Mem_Exit1:

endif;	P6_BIOS_ONLY
endif;	MP_SUPPORT
endif;	NO_L2_SIZE_DISPLAY				;R28

;---------------- Show Display Type ----------------------

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+5) shl 8) + (RIGHT_SIDE+20)
		mov	bx,offset Video_Item
		call	Show_CMOS_Str

;---------------- Show Serial Ports -----------------------

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+6) shl 8) + (RIGHT_SIDE+20)
		mov	si,offset G_RAM:COMM_PORT_ADDRS
		mov	di,offset G_RAM:PRNTR_PORT_ADDRS
		call	SYSCFG_Ports

;---------------- Show Parallel Ports -----------------------

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+7) shl 8) + (RIGHT_SIDE+20)
		mov	si,offset G_RAM:PRNTR_PORT_ADDRS
		mov	di,offset G_RAM:EXT_SEGMENT
		call	SYSCFG_Ports

;-------------- Show OEM dependent message ----------------------

ifdef	Support_4_IDE
ifdef	IDE_PRIMARY_ONLY
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+11) shl 8) + (RIGHT_SIDE+20)
else	;IDE_PRIMARY_ONLY
		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+13) shl 8) + (RIGHT_SIDE+20)
endif	;IDE_PRIMARY_ONLY
else	;Support_4_IDE

		mov	word ptr CURSOR_X[bp],((SYSTEM_Y+11) shl 8) + (RIGHT_SIDE+20)

endif	;Support_4_IDE
;R35 start
ifdef	Show_No_P6_Ucode_msg
		call	ShowUCodemissing
		call	X_Vcrlf
endif	;Show_No_P6_Ucode_msg
;R35 end
;-------------- Show HDD S.M.A.R.T. Function message ------------
ifdef	HDD_SMART_Support
		call	show_HDD_smart			;R07
		call	X_Vcrlf				;R10
endif	;HDD_SMART_Support

;R15IFDEF	NoteBook_Power_Management
IF	STD_Function	EQ	1			;R15
;R02		call	Show_PM_Config
		POST_func_call	Show_PM_Config	    	;R02
		call	X_Vcrlf				;R10
ENDIF;	STD_Function					;R15
;R15ENDIF	;NoteBook_Power_Management

;R16 - starts
ifdef	VSA_VGA
ifdef	S2D_SUPPORT
		POST_func_call	Show_PM_Config	    	;
		call	X_Vcrlf				;
endif	;S2D_SUPPORT
endif	;VSA_VGA
;R16 - ends

		F000_CALL Ct_Show_Config

ifdef	ACPI_Support				;R32
ifdef	S4_Support				;R32
ifdef	No_Show_PCI_Device			;R32
		call	Check_Vga_ID		;R32
endif	;No_Show_PCI_Device			;R32
endif	;S4_Support				;R32
endif	;ACPI_Support				;R32
						
ifndef	No_Show_PCI_Device
ifdef	PCI_BUS
		push	0f000H
		pop	ds
		lea	si,SYSTEM1_BYTE
		test	byte ptr [si],02H		;display PCI dev.
		jnz	short No_PciDisplay

		call	Show_PCI_Device

ifdef	PNP_BIOS	;R11B
ifndef	NO_ISA_PNP					;R29
ifndef	NO_SHOW_ISAPNP					;R11
		call	Show_PNP_Device			;R11
endif	;NO_SHOW_ISAPNP					;R11
endif	;NO_ISA_PNP					;R29
endif	;PNP_BIOS	;R11B

No_PciDisplay:
endif	;PCI_BUS
endif	;No_Show_PCI_Device

;-------------- End of showing System Configuration ----------------------

;R10		F000_call	Vcrlf
		call	X_Vcrlf				;R10
		call	X_Cursor_On			;R10

		pop	es
		pop	ds
		ret
Show_System_Cfg Endp
;R35 start
ifdef	Show_No_P6_Ucode_msg
ShowUCodemissing	proc	near
		mov	ecx,08bh
		xor	eax,eax
		mov	edx,eax
		db	0fh,30h			;WRMSR

		mov	eax,1
		db	0fh,0a2h		;CPUID
		
		mov	ecx,08bh
		db	0fh,32h			;RDMSR

		or	edx,edx
		jnz	short Got_Ucode
	;Micro code not found show message
		call	X_Vcr
		mov	si, offset NoUcode_str
		call	Show_CS_String
		call	X_Vcrlf
Got_Ucode:

		ret
ShowUCodemissing	ENDP
NoUcode_str		db	V_HILITE,V_BLINK,'Unknow CPU ID, missing micro Code',V_NORMAL,0
endif	;Show_No_P6_Ucode_msg
;R35 end

;R19 - starts
Decide_CPU_Field_Colon	Proc	Near

		push	si
		push	ds

		mov	ch, CURSOR_X[bp]
		pusha
		post_func_call	Disp_Extra_CPU_Info
		popa
		mov	cl, CURSOR_X[bp]
		sub	cl, ch
		dec	cl

		push	SEG EGROUP
		pop	ds
	@@:
		inc	cl
		lodsb
		or	al, al
		jnz	short @B

		pop	ds
		pop	si

		mov	ch, LEFT_SIDE+18
		sub	cl, 19
		jb	short Not_Over_19
		sub	ch, cl

	Not_Over_19:

		mov	byte ptr KERNAL_CONTROL[bp], ch
		ret

Decide_CPU_Field_Colon	Endp

Show_CPU_Field_Colon	Proc	Near

		mov	al, KERNAL_CONTROL[bp]
		mov	CURSOR_X[bp], al
		mov	al, ':'
		call	X_Display_Char
		mov	al, ' '
		call	X_Display_Char
		ret

Show_CPU_Field_Colon	Endp
;R19 - ends

Not_Install_Str db	'Not Installed',0
Install_Str	db	'Installed',0
None_Str	db	'None',0
CDROM_Str	db	'CDROM',0
ARMD_Str	db	'LS-120',0
IOMEGA_ZIP_Str	db	'ZIP-100',0
MB_Str		db	'MB',0
		public	GB_Str			;R43
GB_Str		db	'GB',0			;R43
HDD_Mode_Str	db	',Mode',0
ifdef	Ultra_DMA33_support
HDD_UDMA_Str	db	',UDMA',0
endif	;Ultra_DMA33_support
;R37 start
ifdef	IDE_DMA_Transfer
HDD_DMA_Str	db	',DMA',0
endif	;IDE_DMA_Transfer
;R37 end
;R07 start
ifdef	HDD_SMART_Support
HDD_SMART_TBL:
		dw	offset PriMast_Str
		dw	offset PriSlav_Str
		dw	offset SecMast_Str
		dw	offset SecSlav_Str
PriMast_Str:	db	'Primary Master   ',0
PriSlav_Str:	db	'Primary Slave    ',0
SecMast_Str:	db	'Secondary Master ',0
SecSlav_Str:	db	'Secondary Slave  ',0
HDD_SMART_Str:	db	'HDD S.M.A.R.T. capability .... ',0
Enable_Str:	db	'Enabled',0
Disable_Str:	db	'Disabled',0
endif	;Support_HDD_SMART
;R07 end

		LEFT_SIDE	EQU	2
		RIGHT_SIDE	EQU	42
		SYSTEM_Y	EQU	2
		PERI_Y		EQU	SYSTEM_Y+4
System_Config_Msg:
		POS	<,30,0>
		db	V_WARN,'Award Software, Inc.'
		POS	<,29,1>
		db	V_WARN,'System Configurations'

ifdef	Support_4_IDE
ifdef	IDE_PRIMARY_ONLY
ifndef	Move_Line_Down						     ;R38	
		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+9,1>
else	;Move_Line_Down						     ;R38	
		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+10,1>		     ;R38
endif	;Move_Line_Down						     ;R38
else	;IDE_PRIMARY_ONLY
 ifndef	Config_Tbl_Lines				             ;R05
		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+11,1>
 else	;Config_Tbl_Lines					     ;R05
		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+Config_Tbl_Lines,1> ;R05
 endif	;Config_Tbl_Lines					     ;R05
endif	;IDE_PRIMARY_ONLY
else	;Support_4_IDE
 ifdef	MoreConfigTblLineIfNo4IDE					;R33
		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+9+MoreConfigTblLineIfNo4IDE,1>	;R33
 else;	MoreConfigTblLineIfNo4IDE					;R33
		BORDER1 <,0,SYSTEM_Y,79,SYSTEM_Y+9,1>		     ;R14
 endif;	MoreConfigTblLineIfNo4IDE					;R33
endif	;Support_4_IDE

		BORDER1 <,1,PERI_Y,78,PERI_Y,0>
		POS	<,0,PERI_Y>
		db	'Ç'
		POS	<,79,PERI_Y>
		db	'¶'

		POS	<,LEFT_SIDE,SYSTEM_Y+1>
		db	'CPU Type'
;R19		ADDX	<,10>
;R19		db	':'

		POS	<,LEFT_SIDE,SYSTEM_Y+2>
		db	'Co-Processor'
;R19		ADDX	<,6>
;R19		db	':'

ifndef	NO_CPU_CLOCK_DISPLAY
		POS	<,LEFT_SIDE,SYSTEM_Y+3>
		db	'CPU Clock'
;R19		ADDX	<,9>
;R19		db	':'
endif;	NO_CPU_CLOCK_DISPLAY

		POS	<,RIGHT_SIDE,SYSTEM_Y+1>
		db	'Base Memory'
		ADDX	<,7>
		db	':'

		POS	<,RIGHT_SIDE,SYSTEM_Y+2>
		db	'Extended Memory'
		ADDX	<,3>
		db	':'

		POS	<,LEFT_SIDE,PERI_Y+1>
		db	'Diskette Drive  A :'

ifndef	Support_1_FDD
		POS	<,LEFT_SIDE,PERI_Y+2>
		db	'Diskette Drive  B :'
endif	;Support_1_FDD

ifdef	Support_4_IDE
		POS	<,LEFT_SIDE,PERI_Y+3>
		db	'Pri. Master  Disk :'

ifdef	IDE_PRIMARY_ONLY
		POS	<,LEFT_SIDE,PERI_Y+4>
		db	'Sec. Master  Disk :'
else	;IDE_PRIMARY_ONLY
		POS	<,LEFT_SIDE,PERI_Y+4>
		db	'Pri. Slave   Disk :'

		POS	<,LEFT_SIDE,PERI_Y+5>
		db	'Sec. Master  Disk :'

		POS	<,LEFT_SIDE,PERI_Y+6>
		db	'Sec. Slave   Disk :'
endif	;IDE_PRIMARY_ONLY

else;	Support_4_IDE
		POS	<,LEFT_SIDE,PERI_Y+3>
		db	'Hard Disk Drive C :'

ifndef	IDE_PRIMARY_ONLY
		POS	<,LEFT_SIDE,PERI_Y+4>
		db	'Hard Disk Drive D :'
endif	;IDE_PRIMARY_ONLY
endif;	Support_4_IDE

		POS	<,RIGHT_SIDE,PERI_Y+1>
		db	'Display Type'
		ADDX	<,6>
		db	':'

		POS	<,RIGHT_SIDE,PERI_Y+2>
		db	'Serial Port(s)'
		ADDX	<,4>
		db	':'

		POS	<,RIGHT_SIDE,PERI_Y+3>
		db	'Parallel Port(s)  :'
		db	0

ifndef	NO_L2_SIZE_DISPLAY				;R28
Cache_Mem_Size_Str:
		POS	<,RIGHT_SIDE,SYSTEM_Y+3>
		db	'Cache Memory'
		ADDX	<,6>
		db	':  '
		db	0
endif;	NO_L2_SIZE_DISPLAY				;R28

Show_CMOS_Str:
		push	0F000h
		pop	ds
		mov	byte ptr USE_ITEMSTAT_BUF[bp],1
		F000_call  Read_Item_Value
		F000_call  Get_VarString_Offset ;get string to show
		post_func_call	Disp_Str_In_BIOS
		ret
SYSCFG_Ports:
		mov	ax,es:[si]
		or	ax,ax
		jz	Display_None	;128k

SYSCFG_Ports_1:
		mov	ax,es:[si]
		inc	si
		inc	si
		or	ax,ax
		jz	short @F
		pusha
		F000_call AX_To_HEX3
		F000_call SHOW_Six_Digit
		inc	byte ptr CURSOR_X[bp]
		popa
		cmp	si,di
		jb	short SYSCFG_Ports_1
	@@:
		ret

SYSCFG_Mem:
		F000_call Disp_Dword_Int6
		mov	al,'K'
;R11A		post_func_call	F000_Display_Char
		call	X_Display_Char		;R11A
		ret
endif	;NO_SYSTEM_CONFIG			;R01A

  ifdef	KLAMATH_CPU_ONLY			;R25
	SuffixA_Str	db	'A ',0		;R25
  endif;	KLAMATH_CPU_ONLY		;R25

Str_Mhz 	db	'MHz',0			;R01A
		public	SysCfg_CPU_Clock1
SysCfg_CPU_Clock1:

ifndef	NO_CPU_CLOCK_DISPLAY
		push	ds
		push	cs
		pop	ds

		mov	ax,CPU_INT_CLOCK[bp]

;Show 133Mhz if 132Mhz detected
		cmp	al,132
		jne	short Not_132
		mov	al,133
Not_132:

		push	ax
		F000_call	AX_To_DEC3
		pop	ax
		cmp	ax,100
		jae	short @F
		sub	byte ptr CURSOR_X[bp],1
	@@:
		F000_call	Show_SIX_DIGIT

;R25 - start
  ifdef	KLAMATH_CPU_ONLY
		cmp	word ptr CPU_INT_CLOCK[bp],300	;300Mhz ?
		jne	short Not300Mhz

		mov	eax,1			;read CPUID
		db	0Fh,0A2h		;OP code: CPUID
		cmp	al,06Ah			;R35
		je	short Not300Mhz		;R35
		and	al,0F0H
		cmp	al,060H			;Mendcino CPU ?
		jne	short Not300Mhz

	;Show 300A MHz for Mendicino CPU
		mov	si,offset SuffixA_Str		;strin "A "
		post_func_call	Disp_Str_In_BIOS
	Not300Mhz:
  endif;	KLAMATH_CPU_ONLY
;R25 - end

		mov	si,offset Str_Mhz
		post_func_call	Disp_Str_In_BIOS
		pop	ds
endif;	NO_CPU_CLOCK_DISPLAY
		ret

ifndef	NO_SYSTEM_CONFIG			;R01A
;R09Display_CDROM:
Display_ATAPI:					;R09
		push	ds
		push	cs
		pop	ds
		mov	si,offset CDROM_Str
;R09 start
		mov	cx,di			;R09
		shl	cl,2			;R09
		mov	ax,IDE_device_item[bp]	;R09
		shr	ax,cl			;R09
		and	al,0fh			;R09
		cmp	al,2			;R09
		je	short @F		;R09
;R09 end
;R09		movzx	ax,byte ptr es:[ATAPI_Byte]
;R09		test	al,00000100b		;test ARMD exist?
;R09		jz	short @F
;R09		test	al,00110000b		; have 2 LS120/ZIP100 drive?
;R09		jz	short Only_check_first
;R09		push	ax
;R09		shr	al,4
;R09		and	al,3
;R09		cmp	ax,di
;R09		pop	ax
;R09		mov	ah,80h
;R09		je	short Get_ARMD_Str
;R09Only_check_first:
;R09		and	al,3
;R09		xor	ah,ah
;R09		cmp	ax,di
;R09		jne	short @F
;R09		mov	ah,40h
;R09Get_ARMD_Str:
		mov	si,offset ARMD_Str
		cmp	al,3			;R09 Is LS120?
		je	short @F		;R09 Yes,jump
;R09		test	byte ptr es:[ATAPI_Byte],ah
;R09		jz	short @F
		lea	si,IOMEGA_ZIP_Str
;kevin-start on 05/08/98
		cmp	al,4			;Is ZIP?
		je	short @F		;Yes,jump
		pop	ds
		jmp	short Display_None
;kevin-end on 05/08/98
@@:
		post_func_call	Disp_Str_In_BIOS

		call	Show_PIO_UDMA
		pop	ds
		ret
Display_None:
		push	ds
		push	cs
		pop	ds
		mov	si,offset None_Str
		post_func_call	Disp_Str_In_BIOS
		pop	ds
		ret

SYSCFG_HDD:
		F000_call Read_Item_Value
		or	dl,dl
		jz	Display_None
		cmp	dl,46
		jb	short @F
		push	di
		push	dx
		F000_call	Get_HDD_CMOS_Info
		cmp	word ptr [bp+di+0],0		;CYLINDER
		pop	dx
		pop	di
		je	short Display_None
@@:

		push	cs
		pop	ds

		mov	ch,al
		F000_call	Disp_Access_mode
		dec	byte ptr CURSOR_X[bp]	;R40
		call	Show_PIO_UDMA

SHOW_HDD_SIZE:
		mov	al,','
;R11A		post_func_call	F000_Display_Char
		call	X_Display_Char		;R11A
;-------------------
;calculate HDD size
;-------------------
		F000_call	Get_HDD_CMOS_Info
		push	ds
		push	bx
		jnz	short Get_User_Type
		movzx	ax,byte ptr [bp+si]		;Hdd type no.
		dec	al
		shl	ax,4
		mov	bx,offset HDISK_PARMS
		add	bx,ax
		push	0f000h
		pop	ds
;R43		movzx	ax,byte ptr [bx+2]		;heads
;R43		movzx	cx,byte ptr [bx+14]		;sectors
;R43		mov	bx,[bx]				;cylinders
;R43 start
		mov	al,byte ptr [bx+2]		;heads
		mov	ah,byte ptr [bx+14]		;sectors
		mov	cx,[bx]				;cylinders
;R43 end
		jmp	short Disp_HDD_Size
Get_User_Type:
;R43		movzx	ax,byte ptr [bp+di+2]		;heads
;R43		movzx	cx,byte ptr [bp+di+7]		;sectors
;R43		mov	bx,[bp+di+0]			;cylinders
;R43 start
		mov	al,[bp+di+2]			;heads
		mov	ah,[bp+di+7]			;sectors
		mov	cx,[bp+di+0]			;cylinders
;R43 end
Disp_HDD_Size:
		call	Cal_HDD_Size			;R43
;R43		shl	cx,2
;R43		mul	cx
;R43		mul	bx
		pop	bx
		pop	ds
;R43		mov	cx,15625/2
;R43		div	cx
;R43		mov	HDDSIZE[bp],ax
		mov	ax,HDDSIZE[bp]			;R43
		F000_call Disp_Word_Int5
		mov	si,offset MB_Str
;R43 start
		cmp	byte ptr HDDSIZE_Unit[bp],HDDSIZE_MB
		jbe	short @F
		mov	si,offset GB_Str
@@:
;R43 end
		post_func_call	Disp_Str_In_BIOS
		ret

ifdef	NEW_IDE_MODE_3
IdeMode_Item:
		dw      offset IdeA_Mode_Item
		dw      offset IdeB_Mode_Item
 ifdef	Support_4_IDE					;R03
 ifndef  ONCHIP_2ND_ALWAYS_DISABLE			;R08
		dw      offset IdeC_Mode_Item
		dw      offset IdeD_Mode_Item
 endif;  ONCHIP_2ND_ALWAYS_DISABLE			;R08
 endif;	Support_4_IDE					;R03
endif	;NEW_IDE_MODE_3

Show_PIO_UDMA:
ifdef	NEW_IDE_MODE_3
ifdef	Ultra_DMA33_support
;R40		cmp	byte ptr HDD_0_UltraDMA[bp+di],0ffh
;R40		je	short @F
;R40 start
		mov	al,HDD_0_UltraDMA[bp+di]	;get ultra mode value
		cmp	al,0ffh				;not enabled?
		je	short @F			;Yes,skip
		mov	ah,al				;backup to AH
		shl	al,4				;mode 2 become to 32
							;mode 4 become to 64
		shr	ah,1				;mode 2 become to 1
							;mode 4 become to 2
		add	al,ah				;set mode value to exactly
		mov	HDD_0_UltraDMA[bp+di],al	;reset ultra mode value
;R40 end
		mov	si,offset HDD_UDMA_Str
		post_func_call	Disp_Str_In_BIOS
		inc	byte ptr CURSOR_X[bp]		;R40
		add	di,HDD_0_UltraDMA
		jmp	short Show_Mode
@@:
endif	;Ultra_DMA33_support
;R37 start
ifdef	IDE_DMA_Transfer
		cmp	byte ptr IDE_0_DMA_Mode[bp+di],0ffh
		je	short @F
		mov	si,offset HDD_DMA_Str
		post_func_call	Disp_Str_In_BIOS
		add	di,IDE_0_DMA_Mode
		jmp	short Show_Mode
@@:
endif	;IDE_DMA_Transfer
;R37 end
		mov	si,offset HDD_Mode_Str
		post_func_call	Disp_Str_In_BIOS
		mov     si,di
		shl	si,1
		add	si,offset cs:IdeMode_Item
		mov     si,cs:[si]
;R06		post_func_call	F000_GetItem_Value
		call	X_GetItem_Value				;R06
		sub	al,1				;auto ?
		jnc	short Mode_Not_Auto
		add	di,HDD_0_MODE
Show_Mode:
;R18		mov	al,[bp+di]
		movzx	ax,byte ptr [bp+di]		;R18
Mode_Not_Auto:
		F000_call	AX_To_DEC2
		F000_call	Show_SIX_DIGIT
endif	;NEW_IDE_MODE_3
		ret

;R01AStr_Mhz 	db	'MHz',0
;R07 Strat
ifdef	HDD_SMART_Support
Show_HDD_smart:
		push	ds
		pushad
		push	cs
		pop	ds
 		mov	cx,4
		xor	bx,bx
		mov	al,byte	ptr HDD_Smart_flag[bp]
Show_Smart_loop:
		push	ax
		and	al,03h
		jz	short Show_Smart_Next
		call	Show_Smart_Status		;Primary Master
Show_Smart_Next:
		pop	ax
		shr	al,2
		add	bx,2
		loop	short show_smart_loop
  		popad
		pop	ds
		ret
;[]==============================================================[]
;	Show Smart Status
;Input:	HDD_Smart_flag[bp]
;	bx=Which device
;	al=device status
;	   00=no install
;	   01=none capability
;	   10=disable S.M.A.R.T.
;	   11=enable S.M.A.R.T.
;[]==============================================================[]
Show_Smart_Status:
		push	ax
;R10		mov	byte ptr CURSOR_X[bp],0
		call	X_Vcr					;R10
		mov	si, word ptr cs:[HDD_SMART_TBL+BX]	;Show primary/secondary
		post_func_call	Disp_Str_In_BIOS
		mov	si,offset HDD_SMART_Str
	       	post_func_call	Disp_Str_In_BIOS
		pop	ax
		cmp	al,01
		mov	si,offset None_Str		;display "None"
		jbe	short @F
		mov	si,offset Disable_Str		;display "Disable"
		cmp	al,02
		jbe	short @F
		mov	si,offset Enable_Str		;display "Enable"
@@:
	       	post_func_call	Disp_Str_In_BIOS
;R10		inc	byte ptr CURSOR_Y[bp]
		call	X_Vlf				;R10
		ret
endif;	HDD_SMART_Support
;R07 end

;R32 - start
ifdef	ACPI_Support
ifdef	S4_Support
ifdef	No_Show_PCI_Device			
Check_VGA_ID	Proc	near
		push	ds
		pushad
					
		push	cs
		pop	ds
		and	Post_Temp_Byte[BP], NOT 80h;Init flag for VGA found
	 		
		xor	si, si			;First Device
		xor	bh, bh			;Start from Bus 0
Next_Bus1:	       	
		xor	bl, bl			;Start from Device 0
Disp_PCI_Device1:
		push	bx			;Save Bus&Slot No.
		shl	bl, 3			;Device Number in upper 5 bits
		  		
		mov	di, 0Ch			;Get PCI Device header type
		call	Get_PCI_CFG
		shr	eax, 16			;AL=add. 0E=Heater type
		xor	ch, ch			;Assume last func=0
		test	al, 80h
		jz	short Single_Func1
		  			
		mov	ch, 07			;Device is multi func.
Single_Func1:
		xor	cl, cl			;Start from Function 0
Next_Func1:
		cmp	cl, ch			;Last function encountered
		ja	Next_Dev1		;Yes, above last function
	     			
		push	cx
		and	bl, not 07h
		or	bl, cl

		mov	di, 4			;Get PCI Device command reg.
		call	Get_PCI_CFG
		test	al, 03h			;PCI Device disabled?
		jz	Skip_Show_PCI1
				 	
		mov	di, 8			;Get Clase Code
		call	Get_PCI_CFG
		ror	eax, 16
		cmp	ax, 0001h		;compatible VGA?
		je	short _uha41		;yes
		ror	eax, 16
		rol	eax, 8
		cmp	al, 06h			;Bridge Device?
		jne	short not_host_bridge1
		push	eax	    	
		rol	eax,8
		cmp	al,07h
		pop	eax
		jne	Skip_Show_PCI1
not_host_bridge1:

		cmp	al, 03h			;Display control?
		jne	short Not_Vga1
	_uha41:
		test	byte ptr Post_Temp_Byte[BP], 80h
		jnz	Skip_Show_PCI1
	       				
		or	byte ptr Post_Temp_Byte[BP], 80h;Display controlere
							;   found
;R41 - start
		;Save ATI VGA IO & Memory address for Wake up VGA in S4
																												
                push    ds  		 		
		push	ax				
		push	bx				
		mov	di,14h	  										
		call	Get_PCI_CFG		;Get Vendor&Device ID
		push	ax
                mov     ax, PM_RAM_SEGMENT
                mov     ds, ax 		
                ASSUME  DS:PM_RAM
		post_func_call	E000_Open_PM_RAM 	;open PM RAM for save data
		shr	bl,3																  		
		mov	byte ptr PM_RAM:[VGA_DEV_ID],bl	;Save VGA device ID
		mov	byte ptr PM_RAM:[VGA_SLOT_ID],bh;Save VGA Slot ID
		pop	ax																																					
		mov	byte ptr PM_RAM:[VGA_IO_ADD],ah	;Save VGA ID Address
ifdef	AGP_SLOTID 				
		cmp	byte ptr PM_RAM:[VGA_SLOT_ID],0	;test if in Slot0
		je	short Is_Slot0
		mov	bx,(AGP_SLOTID) +00h
		mov	di,1ch								 			
		call	Get_PCI_CFG			;Get Vendor&Device ID
		mov	PM_RAM:[AGP_IO_ADD],al		;Save AGP IO Address
		mov	bx,(AGP_SLOTID) +00h
		mov	di,1dh		 			
		call	Get_PCI_CFG		;Get Vendor&Device ID
		mov	PM_RAM:[AGP_IO_LIM],al		;Save AGP IO Limit
Is_Slot0:  								
endif	;AGP_SLOTID 				
		post_func_call	E000_Close_PM_RAM	;Close PM ram
		pop	bx
		pop	ax						    				
		pop	ds 
Not_ATI:   		 
;R41 - end
Not_Vga1:
	 						
		xor	di, di
		call	Get_PCI_CFG		;Get Vendor&Device ID
		cmp	ax, 0FFFFh		;No Device?
		je	Skip_Show_PCI1
							
;R41		;Save ATI VGA IO & Memory address for Wake up VGA in S4
;R41																												
;R41		cmp	ax,1002h		;test if ATI VGA
;R41		jne	short Not_ATI		
;R41                push    ds  		 		
;R41		push	ax				
;R41		push	bx				
;R41		mov	di,14h	  										
;R41		call	Get_PCI_CFG		;Get Vendor&Device ID
;R41		push	ax
;R41                mov     ax, PM_RAM_SEGMENT
;R41                mov     ds, ax 		
;R41                ASSUME  DS:PM_RAM
;R41		post_func_call	E000_Open_PM_RAM 	;open PM RAM for save data
;R41		shr	bl,3																  		
;R41		mov	byte ptr PM_RAM:[VGA_DEV_ID],bl	;Save VGA device ID
;R41		mov	byte ptr PM_RAM:[VGA_SLOT_ID],bh;Save VGA Slot ID
;R41		pop	ax																																					
;R41		mov	byte ptr PM_RAM:[VGA_IO_ADD],ah	;Save VGA ID Address
;R41ifdef	AGP_SLOTID 				
;R41		cmp	byte ptr PM_RAM:[VGA_SLOT_ID],0	;test if in Slot0
;R41		je	short Is_Slot0
;R41		mov	bx,(AGP_SLOTID) +00h
;R41		mov	di,1ch								 			
;R41		call	Get_PCI_CFG			;Get Vendor&Device ID
;R41		mov	PM_RAM:[AGP_IO_ADD],al		;Save AGP IO Address
;R41		mov	bx,(AGP_SLOTID) +00h
;R41		mov	di,1dh		 			
;R41		call	Get_PCI_CFG		;Get Vendor&Device ID
;R41		mov	PM_RAM:[AGP_IO_LIM],al		;Save AGP IO Limit
;R41Is_Slot0:  								
;R41endif	;AGP_SLOTID 				
;R41		post_func_call	E000_Close_PM_RAM	;Close PM ram
;R41		pop	bx
;R41		pop	ax						    				
;R41		pop	ds 
;R41Not_ATI:   		 
Skip_Show_PCI1:
													
		pop	cx
		inc	cl
		jmp	Next_Func1
	       			
Next_Dev1:
		pop	bx			;Restore Bus&Device
	 				
		inc	bl
		cmp	bl, 32
		jb	Disp_PCI_Device1

		inc	bh
		db	9ah		;-- far call fProc_Qualify_PciBus --
		dw	offset fProc_Qualify_PciBus
		dw	0f000h		;-------------------
		jnc	Next_Bus1
      				
Check_VGA_EXIT:
		popad
		pop	ds
									
		ret  		
Check_VGA_ID	endp		
Get_PCI_CFG:
		push	ecx
		push	bx
		push	di

		mov	ax, 0b10ah
		int	1ah

		mov	eax, ecx
		pop	di
		pop	bx
		pop	ecx
		ret

endif	;No_Show_PCI_Device	
endif	;S4_Support
endif	;ACPI_Support

;R32 - end	

ifndef	No_Show_PCI_Device
ifdef	PCI_BUS
Show_PCI_Device	proc	near
		push	ds
		pushad

		push	cs
		pop	ds

;R10		mov	byte ptr CURSOR_X[bp],0
;R10		inc	byte ptr CURSOR_Y[bp]
		call	X_Vcr				;R10

		mov	si,offset DEV
		call	F000_Display_String

;R10		mov	byte ptr CURSOR_X[bp],0
;R10		inc	byte ptr CURSOR_Y[bp]
		call	X_Vcrlf				;R10

		and	Post_Temp_Byte[BP], NOT 80h;Init flag for VGA found

		xor	si, si			;First Device
		xor	bh, bh			;Start from Bus 0
Next_Bus:

		xor	bl, bl			;Start from Device 0
Disp_PCI_Device:
		push	bx			;Save Bus&Slot No.
		shl	bl, 3			;Device Number in upper 5 bits

		mov	di, 0Ch			;Get PCI Device header type
		call	Get_PCI_CFG
		shr	eax, 16			;AL=add. 0E=Heater type
		xor	ch, ch			;Assume last func=0
		test	al, 80h
		jz	short Single_Func

		mov	ch, 07			;Device is multi func.
Single_Func:

		xor	cl, cl			;Start from Function 0
Next_Func:
		cmp	cl, ch			;Last function encountered
		ja	Next_Dev		;Yes, above last function

		push	cx
		and	bl, not 07h
		or	bl, cl

		mov	di, 4			;Get PCI Device command reg.
		call	Get_PCI_CFG
		test	al, 03h			;PCI Device disabled?
		jz	Skip_Show_PCI

		mov	di, 8			;Get Clase Code
		call	Get_PCI_CFG
		ror	eax, 16

		cmp	ax, 0FFFFh		;No Device?		;R30
		je	Skip_Show_PCI					;R30

		cmp	ax, 0001h		;compatible VGA?
		je	short _uha4		;yes

		ror	eax, 16
		rol	eax, 8
		cmp	al, 06h			;Bridge Device?
		jne	short not_host_bridge
		push	eax
		rol	eax,8
		cmp	al,07h
		pop	eax
		jne	Skip_Show_PCI
not_host_bridge:

		cmp	al, 03h			;Display control?
		jne	short Not_Vga
	_uha4:
		test	byte ptr Post_Temp_Byte[BP], 80h
		jnz	Skip_Show_PCI

		or	byte ptr Post_Temp_Byte[BP], 80h;Display controlere
							;   found
;R41 - start
ifdef	ACPI_Support
ifdef	S4_Support
		;Save ATI VGA IO&Memory Address for Wake up VGA in S4
                push    ds  		 		
		push	ax				
		push	bx				
		mov	di,14h	  										
		call	Get_PCI_CFG		;Get Vendor&Device ID
		push	ax
                mov     ax, PM_RAM_SEGMENT
                mov     ds, ax 		
                ASSUME  DS:PM_RAM   			
		post_func_call	E000_Open_PM_RAM  ;open PM RAM for save data
		shr	bl,3					  				
		mov	byte ptr PM_RAM:[VGA_DEV_ID],bl	;save VGA device ID
		mov	byte ptr PM_RAM:[VGA_SLOT_ID],bh;Save VGA Slot Number
		pop	ax																			
		mov	byte ptr PM_RAM:[VGA_IO_ADD],ah	;save VGA IO Address
ifdef	AGP_SLOTID 					
		cmp	byte ptr PM_RAM:[VGA_SLOT_ID],0	;test if in SLot 0
		je	short Is_Slot0		
		mov	bx,(AGP_SLOTID) +00h
		mov	di,1ch								 			
		call	Get_PCI_CFG		;Get Vendor&Device ID
		mov	PM_RAM:[AGP_IO_ADD],al	     	;Save AGP IO Address
		mov	bx,(AGP_SLOTID) +00h
		mov	di,1dh		 			
		call	Get_PCI_CFG		;Get Vendor&Device ID
		mov	PM_RAM:[AGP_IO_LIM],al		;Save AGP IO Limit
Is_Slot0:											
endif	;AGP_SLOTID 				
																						  									
		post_func_call	E000_Close_PM_RAM
		pop	bx
		pop	ax						    				
		pop	ds 
Not_ATI: 			  							
							
endif	;S4_Support
endif	;ACPI_Support	
;R41 - end
Not_Vga:

;R30		mov	di, 08h
;R30		call	Get_PCI_CFG		;Get Class Code
;R30		cmp	al, 0FFh		;No Device?
;R30		je	Skip_Show_PCI

		xor	di, di
		call	Get_PCI_CFG		;Get Vendor&Device ID
		cmp	ax, 0FFFFh		;No Device?
		je	Skip_Show_PCI
;R32 - start
;R41ifdef	ACPI_Support
;R41ifdef	S4_Support
;R41		;Save ATI VGA IO&Memory Address for Wake up VGA in S4
;R41		cmp	ax,1002h		;test if ATI VGA
;R41		jne	short Not_ATI		
;R41                push    ds  		 		
;R41		push	ax				
;R41		push	bx				
;R41		mov	di,14h	  										
;R41		call	Get_PCI_CFG		;Get Vendor&Device ID
;R41		push	ax
;R41                mov     ax, PM_RAM_SEGMENT
;R41                mov     ds, ax 		
;R41                ASSUME  DS:PM_RAM   			
;R41		post_func_call	E000_Open_PM_RAM  ;open PM RAM for save data
;R41		shr	bl,3					  				
;R41		mov	byte ptr PM_RAM:[VGA_DEV_ID],bl	;save VGA device ID
;R41		mov	byte ptr PM_RAM:[VGA_SLOT_ID],bh;Save VGA Slot Number
;R41		pop	ax																			
;R41		mov	byte ptr PM_RAM:[VGA_IO_ADD],ah	;save VGA IO Address
;R41ifdef	AGP_SLOTID 					
;R41		cmp	byte ptr PM_RAM:[VGA_SLOT_ID],0	;test if in SLot 0
;R41		je	short Is_Slot0		
;R41		mov	bx,(AGP_SLOTID) +00h
;R41		mov	di,1ch								 			
;R41		call	Get_PCI_CFG		;Get Vendor&Device ID
;R41		mov	PM_RAM:[AGP_IO_ADD],al	     	;Save AGP IO Address
;R41		mov	bx,(AGP_SLOTID) +00h
;R41		mov	di,1dh		 			
;R41		call	Get_PCI_CFG		;Get Vendor&Device ID
;R41		mov	PM_RAM:[AGP_IO_LIM],al		;Save AGP IO Limit
;R41Is_Slot0:											
;R41endif	;AGP_SLOTID 				
;R41																						  									
;R41		post_func_call	E000_Close_PM_RAM
;R41		pop	bx
;R41		pop	ax						    				
;R41		pop	ds 
;R41Not_ATI: 			  							
;R41							
;R41endif	;S4_Support
;R41endif	;ACPI_Support	
;R32 - end	

		or	si, si			;First Device be showed
		jnz	short No_Show_PCI_Field	;No

		pushad

		mov	si,offset PCI_Field	;Show table head at first
		pusha				;   PCI device
		call	F000_Display_String
		popa

;R10		mov	byte ptr CURSOR_X[bp],0
;R10		inc	byte ptr CURSOR_Y[bp]
		call	X_Vcrlf			;R10
;R10		mov	al,196
;R10		mov	cx,80
;R10	@@:
;R10		post_func_call	F000_Display_Char
;R10		loop	short @B
		call	Show_Division		;R10

;R10		call	Get_Cursor_Pos
;R10		inc	dh
;R10		xor	dl, dl
;R10		call	Set_Cursor_Pos
		call	X_Vcrlf			;R10

		popad
No_Show_PCI_Field:

		pop	si			;Get Func No
		pop	di			;Get current Bus No and
		push	di			;  Device No
		push	si			;Save Func No

		push	eax			;Save Vendor&Device ID

		mov	byte ptr CURSOR_X[bp],2

		mov	ax, di
		xchg	ah, al
		call	F000_DISP_BYTE_INT2	;Display Bus No

		mov	byte ptr CURSOR_X[bp], 11

		xchg	ah, al
		call	F000_DISP_BYTE_INT2	;Display Device No

		mov	byte ptr CURSOR_X[bp], 21
		mov	al, bl
		and	al, 07
		call	F000_DISP_BYTE_INT2	;Function No

		pop	eax 			;Restore Vendor&Device ID

		pusha
		mov	byte ptr CURSOR_X[bp], 31
		F000_call	DISP_WORD_HEX4	;Display Vendor ID
		popa

		shr	eax, 16
		pusha
		mov	byte ptr CURSOR_X[bp], 43
		F000_call	DISP_WORD_HEX4	;Display Device ID
		popa

		mov	di, 8
		call	Get_PCI_CFG		;Get Class Code
		shr	eax, 16
		cmp	ax, 0001h		;compatible VGA ?
		jne	short _uy7a		;no !
		mov	ax, 0300h
_uy7a:
		mov	si, ax
		mov	al, ah

		cmp	al,MAX_CLS_NO		;check if valid class code
		jbe	short Good_ClsCode	;yes, show it
		xor	al,al			;no, set unknown device
Good_ClsCode:

		cmp	si, 0101h
		mov	si, offset IDE_DEV
		je	short Show_Dev

		xor	ah, ah
		shl	ax, 1
		push	bx
		mov	bx, ax
		mov	si, word ptr cs:[DEV_TBL+BX]
		pop	bx
Show_Dev:

		cmp	si, offset DEV0C
		jne	short Not_DEV0C
		pusha
		mov	di, 08h
		call	Get_PCI_CFG		;Get Class Code
		shr	eax,16			;Get Sub-Class Code
		cmp	al,05h			;Is ACPI?
		popa
		jne	short Not_DEV0C		;No, skip
		mov	si, offset DEV0C05
Not_DEV0C:
		cmp	si, offset DEV06
		jne	short Not_DEV06
		pusha
		mov	di, 08h
		call	Get_PCI_CFG		;Get Class Code
		shr	eax,16			;Get Sub-Class Code
		cmp	al,07h			;Is Cardbus?
		popa
		jne	short Not_DEV06		;No, skip
		mov	si, offset DEV0607
Not_DEV06:
		pusha
		mov	byte ptr CURSOR_X[bp], 52
		call	F000_Display_String
		popa

		pusha
		mov	byte ptr CURSOR_X[bp], 76
		cmp	si, offset IDE_DEV
;R22 - start
ifdef	SPECIAL_SHOW_IDE_DEVICE_IRQ
		jne	short SHOW_OTHER_DEVICE_IRQ	;not IDE device
		mov	byte ptr CURSOR_X[bp], 73	;for show IRQ14/15
		call	SPECIAL_SHOW_IDE_IRQ		;call chippost.asm
		jmp	short End_IRQ_Show		;specisl show final
	SHOW_OTHER_DEVICE_IRQ:
else;	SPECIAL_SHOW_IDE_DEVICE_IRQ
;R22 - end
		mov	al, 14
		je	short Show_IRQ
endif;	SPECIAL_SHOW_IDE_DEVICE_IRQ			;R22

		mov	di, 3ch
		call	Get_PCI_CFG		;Get Interrupt Line
		or	al, al
		jz	short IRQ_NA

		cmp	al, 0fh
		ja	short IRQ_NA

Show_IRQ:

		call	F000_DISP_BYTE_INT2	;Display Slot No

		jmp	short End_IRQ_Show
IRQ_NA:
		mov	si, offset NA_Str
		call	F000_Display_String
End_IRQ_Show:
;R10		call	Get_Cursor_Pos

ifdef	NO_SHOW_IDE_DEVICE
		cmp	si, offset IDE_DEV
		je	short NO_SHOW_IDE_DEV
endif;	NO_SHOW_IDE_DEVICE

;R10		inc	dh
		call	X_Vlf			;R10
NO_SHOW_IDE_DEV:
;R10		xor	dl,dl
;R10		call	Set_Cursor_Pos
		call	X_Vcr			;R10

		popa

Skip_Show_PCI:
		pop	cx
		inc	cl
		jmp	Next_Func

Next_Dev:
		pop	bx			;Restore Bus&Device

		inc	bl
		cmp	bl, 32
		jb	Disp_PCI_Device

ifndef	NO_MULTI_PCI_SUPPORT
endif	;NO_MULTI_PCI_SUPPORT

ifdef	PCI_BUS
ifndef	NO_MULTI_PCI_SUPPORT
	ifdef	CONFIG_MECHANISM_1
		inc	bh
		db	9ah		;-- far call fProc_Qualify_PciBus --
		dw	offset fProc_Qualify_PciBus
		dw	0f000h		;-------------------
		jnc	Next_Bus
	endif	;CONFIG_MECHANISM_1
endif	;NO_MULTI_PCI_SUPPORT
endif	;PCI_BUS

;R10		call	Get_Cursor_Pos
;R10		inc	dh
;R10		xor	dl,dl
;R10		call	Set_Cursor_Pos

;R31 - start
ifdef	ACPI_SUPPORT					
		call	Show_ACPI_Dev
endif;	ACPI_SUPPORT					
;R31 - end

		popad
		pop	ds

		ret
Show_PCI_Device	endp

;R31 - start
ifdef	ACPI_SUPPORT					
Show_ACPI_Dev	proc	near

		extrn	SetRealModeLimit:near	
		include	acpi.inc		
		extrn	FACP_Pointer:near	

		extrn	ACPI_option_Item:near
		mov	si,offset DGROUP:ACPI_option_Item
		call	X_GetItem_Value
		or	al,al
		jnz	short ACPI_OFF

		mov	al,1
		post_func_call	EGROUP:SetRealModeLimit	;Enter big real mode
		mov	esi, ACPISeg
		add	esi, offset DGROUP:FACP_Pointer	;FACP
		mov	edi, dword ptr ds:[esi]
		mov     ax,word ptr es:[edi]+46 	; Get SCI IRQ from FACP
		push	ax
		xor	al, al
		post_func_call	EGROUP:SetRealModelimit	;Leave big real mode
		push	cs
		pop	ds

		mov	byte ptr CURSOR_X[bp], 52
		mov	si, offset ACPI_Str
		call	F000_Display_String		;Display device

		mov	byte ptr CURSOR_X[bp], 76
		pop	ax
		or	al,al				;R31A
		jnz	short IRQ_Not_NA_		;R31A
		mov	si, offset NA_Str		;R31A
		call	F000_Display_String		;R31A
		jmp	short	ACPI_OFF		;R31A
	IRQ_Not_NA_:					;R31A
		call	F000_DISP_BYTE_INT2		;Display IRQ
		call	X_Vlf	

	ACPI_OFF:

		ret
Show_ACPI_Dev	endp
ACPI_Str	db	"ACPI Controller",0
endif	;ACPI_SUPPORT
;R31 - end

;R10 - start
Show_Division	proc	near
		pusha
		mov	al,196
		mov	cx,80
	@@:
;R11A		post_func_call	F000_Display_Char
		call	X_Display_Char		;R11A
		loop	short @B
		popa
		ret
Show_Division	endp
;R10 - end
;R10;Input:	DH - Row
;R10;	DL - Column
;R10;Output:None
;R10;Description:Set the cursor position, if Row=23 then scroll up screen and
;R10;	     Row=22
;R10Set_Cursor_Pos:
;R10		pusha
;R10		cmp	dh, 23
;R10		jb	short No_Scroll
;R10
;R10		push	dx
;R10
;R10		mov	ax, 0601h	;Screen scroll up
;R10		mov	bh, ATTRIBUTE[bp]
;R10		mov	cx, (0 shl 8)  + 0
;R10		mov	dx, (24 shl 8) + 79
;R10		int	10h
;R10
;R10		pop	dx
;R10		dec	dh
;R10No_Scroll:
;R10		mov	word ptr CURSOR_X[bp], dx
;R10
;R10		mov	ah, 02h		;Set Crusor position
;R10		xor	bh, bh
;R10		int	10h
;R10
;R10		popa
;R10		ret
;R10
;R10;Input :Nnone
;R10;Output:DH - Row
;R10;	DL - Column
;R10;Description:Get the cursor position
;R10Get_Cursor_Pos:
;R10		pusha
;R10
;R10		mov	ah, 03h
;R10		xor	bh, bh
;R10		int	10h
;R10
;R10		ror	edx, 16
;R10
;R10		popa
;R10
;R10		ror	edx, 16
;R10		ret

F000_Disp_Byte_INT2:
		pusha
		F000_CALL	Disp_Byte_INT2
		popa
		ret

F000_Display_String:
		F000_call	Display_String
		ret

Get_PCI_CFG:
		push	ecx
		push	bx
		push	di

		mov	ax, 0b10ah
		int	1ah

		mov	eax, ecx
		pop	di
		pop	bx
		pop	ecx
		ret

PCI_Field:
db "Bus No. Device No. Func No. Vendor ID   Device ID   Device Class           IRQ", 0
;R301E PCI_Border:	BORDER1 <,0,16,79,16,0>

DEV_TBL:
		dw	offset DEV00
		dw	offset DEV01
		dw	offset DEV02
		dw	offset DEV03
		dw	offset DEV04
		dw	offset DEV05
		dw	offset DEV06
		dw	offset DEV07
		dw	offset DEV08
		dw	offset DEV09
		dw	offset DEV0A
		dw	offset DEV0B
		dw	offset DEV0C
MAX_CLS_NO	EQU	($ - offset DEV_TBL)/2 - 1

;R10DEV:		db	"PCI device listing.....", 0
;R23 ;R14-start
;R23 ifdef 	 No_Support_4_IDE
;R23 
;R23 DEV:		db	NEWLINE
;R23 		db	"PCI device listing ...", 0
;R23 else	;No_Support_4_IDE
;R23 
;R23 DEV:		db	"PCI device listing ...", 0		;R10
;R23 
;R23 endif  	;No_Support_4_IDE
;R23 ;R14-END
;R23 - starts
DEV:
	ifdef 	 No_Support_4_IDE
		db	NEWLINE
	endif  	;No_Support_4_IDE
		db	"PCI"
	ifdef	AGP_Device_List
		db	"/AGP"
	endif	;AGP_Device_List
		db	" device listing ...", 0
;R23 - ends
DEV00:		db	"Unknown PCI Device",0
DEV01:		db	"Mass Storage Controller",0
DEV02:		db	"Network Controller",0
DEV03:		db	"Display Controller",0
DEV04:		db	"Multimedia Device",0
DEV05:		db	"Memory Controller",0
DEV06:		db	"Bridge Device",0
DEV07:		db	"Simple COMM. Controller",0
DEV08:		db	"Base System Peripherals", 0
DEV09:		db	"Input Device",0
DEV0A:		db	"Docking Stations",0
DEV0B:		db	"Processors", 0
DEV0C:		db	"Serial Bus Controller",0
IDE_DEV		db	"IDE Controller",0
NA_Str		db	"NA",0
DEV0C05		db	"SMBus Controller",0
DEV0607		db	"PCI/CardBus bridge",0

ifdef	PNP_BIOS	;R11B
ifndef	NO_ISA_PNP					;R29
;R11 - start
ifndef	NO_SHOW_ISAPNP

ifdef	SHOW_ALL_ISAPNP
DMA_POS		EQU	27
IRQ_POS		EQU	33
STR_POS		EQU	39
else	;SHOW_ALL_ISAPNP
DMA_POS		EQU	20
IRQ_POS		EQU	26
STR_POS		EQU	32
endif	;SHOW_ALL_ISAPNP

Show_PNP_Device	proc	near
		push	ds
		push	es
		pushad

		mov	ax, G_RAM
		mov	es, ax
		mov	ds, ax
		assume	ds:G_RAM

		cmp	byte ptr ds:TEMP_LAST_CSN, 0	;ISA/PNP card exist?
		je	Show_PNP_Exit

		POST_FUNC_CALL	Wake_All_Cards

		mov	byte ptr ds:INIT_FLAG, 0	;flag to show title

		mov	dx, ds:TEMP_PNP_RD		;RD_DATA port address
		movzx	cx, byte ptr ds:TEMP_LAST_CSN	;total ISA/PNP cards
		mov	byte ptr ds:CSN_CNT, 1		;CSN start

; all PnP cards loop
; CX = ISA/PnP card numbers
; DX = READ_DATA port address

Show_Card_Loop:
		mov	byte ptr ds:LOGIC_DEV_CNT, 0
		push	cx

Show_LogicDev_Loop:
		mov	al, ds:CSN_CNT
		mov	ah, ds:LOGIC_DEV_CNT
		POST_FUNC_CALL	Get_LogicDev_String
		jc	Show_Card_Next

		mov	ah, ds:LOGIC_DEV_CNT
		mov	al, LOGIC_DEV
		call	X_Set_PnP_Reg

ifndef	SHOW_ALL_ISAPNP
		mov	al, ACT_REG
		call	X_Get_PnP_Reg
		test	al, 01
		jz	Show_LogicDev_Cont
endif	;SHOW_ALL_ISAPNP

		mov	al, DMA0
		call	X_Get_PnP_Reg
		mov	cl, al
		mov	al, DMA1
		call	X_Get_PnP_Reg
		mov	ch, al
		mov	al, IRQ0
		call	X_Get_PnP_Reg
		mov	bl, al
		mov	al, IRQ1
		call	X_Get_PnP_Reg
		mov	bh, al

ifndef	SHOW_ALL_ISAPNP
		cmp	cl, 04				;no DMA?
		jne	short @f
		or	bl, bl				;no IRQ
		jz	Show_LogicDev_Cont
@@:
endif	;SHOW_ALL_ISAPNP

		test	byte ptr ds:INIT_FLAG, 1
		jnz	short @f
		call	X_Vcrlf
		mov	si, offset PNPDEV
		call	Show_CS_String
		call	X_Vcrlf
		mov	si, offset PNP_FIELD
		call	Show_CS_String
		call	X_Vcrlf
		call	Show_Division
		inc	byte ptr ds:INIT_FLAG
@@:

		call	X_Vcrlf

		mov	byte ptr CURSOR_X[bp],2
		mov	al, ds:CSN_CNT
		call	F000_DISP_BYTE_INT2		;Display card No

		mov	byte ptr CURSOR_X[bp], 11
		mov	al, ds:LOGIC_DEV_CNT
		call	F000_DISP_BYTE_INT2		;Display Device No

ifdef	SHOW_ALL_ISAPNP
		mov	byte ptr CURSOR_X[bp], 20
		mov	si, offset Yes_String
		mov	al, ACT_REG
		call	X_Get_PnP_Reg
		test	al, 01
		jnz	short @f
		mov	si, offset No_String
@@:
		call	Show_CS_String
endif	;SHOW_ALL_ISAPNP

		mov	byte ptr CURSOR_X[bp], DMA_POS
		mov	al, cl
		cmp	al, 04				;no DMA?
		jne	short @f
		mov	si, offset NA_Str
		call	Show_CS_String
		jmp	short Show_PNP_IRQ
@@:
		dec	byte ptr CURSOR_X[bp]
		call	F000_DISP_BYTE_INT2		;Display DMA 0

		mov	al, ch
		cmp	al, 04				;no DMA?
		je	short Show_PnP_IRQ
		mov	byte ptr CURSOR_X[bp], DMA_POS+1
		call	F000_DISP_BYTE_INT2		;Display DMA 1
		mov	byte ptr CURSOR_X[bp], DMA_POS+1	;R11A
		mov	al, ','					;R11A
		call	X_Display_Char				;R11A

Show_PNP_IRQ:
		mov	byte ptr CURSOR_X[bp], IRQ_POS
		mov	al, bl
		or	al, al				;no IRQ?
		jnz	short @f
		mov	si, offset NA_Str
		call	Show_CS_String
		jmp	short Show_PNP_String
@@:
		call	F000_DISP_BYTE_INT2		;Display IRQ 0

		mov	al, bh
		or	al, al				;no IRQ?
		jz	short Show_PnP_String
		mov	byte ptr CURSOR_X[bp], IRQ_POS+3
		call	F000_DISP_BYTE_INT2		;Display IRQ 1
		mov	byte ptr CURSOR_X[bp], IRQ_POS+2	;R11A
		mov	al, ','					;R11A
		call	X_Display_Char				;R11A

Show_PNP_String:
		mov	byte ptr CURSOR_X[bp], STR_POS
		mov	si, offset STR_BUFFER
		cmp	byte ptr ds:[si], 0
		jne	short @f

		mov	si, offset Unknown_Dev
		call	Show_CS_String
		jmp	short Show_LogicDev_Cont

@@:
		call	F000_Display_String

Show_LogicDev_Cont:

		inc	byte ptr ds:LOGIC_DEV_CNT	;next logical device
		jmp	Show_LogicDev_Loop
@@:
		jmp	Show_Card_Loop

Show_Card_Next:
		pop	cx
		inc	byte ptr ds:CSN_CNT	;next CSN
		loop	short @b

		POST_FUNC_CALL	Wait_For_Key

		call	X_Vcrlf

Show_PNP_Exit:
		popad
		pop	es
		pop	ds
		ret
Show_PNP_Device	endp

Show_CS_String	proc	near
		push	ds
		push	cs
		pop	ds
		call	F000_Display_String
		pop	ds
		ret
Show_CS_String	endp

X_Get_PnP_Reg	proc	near
		POST_FUNC_CALL	Get_PnP_Reg
		ret
X_Get_PnP_Reg	endp

X_Set_PnP_Reg	proc	near
		POST_FUNC_CALL	Set_PnP_Reg
		ret
X_Set_PnP_Reg	endp

PNPDEV		db	"ISA/PNP device listing ...", 0
PNP_FIELD:
	ifdef	SHOW_ALL_ISAPNP
		db	"Card No. Device No. Active DMA   IRQ   Device Name"
	else	;SHOW_ALL_ISAPNP
		db	"Card No. Device No. DMA   IRQ   Device Name"
	endif	;SHOW_ALL_ISAPNP
		db	0
Unknown_Dev	db	"Unknown ISA/PNP Device", 0
ifdef	SHOW_ALL_ISAPNP
Yes_String	db	"Yes", 0
No_String	db	"No", 0
endif	;SHOW_ALL_ISAPNP

endif	;NO_SHOW_ISAPNP
;R11 - end
endif	;NO_ISA_PNP					;R29
endif	;PNP_BIOS	;R11B

endif	;PCI_BUS
endif	;No_Show_PCI_Device
;R01 end
endif	;NO_SYSTEM_CONFIG			;R01A

;R06 - starts
		Public	X_GetItem_Value
X_GetItem_Value	Proc	Near
		F000_Call GetItem_Value
		ret
X_GetItem_Value	Endp
;R06 - ends

;R10 - start
		public	X_Vcrlf
X_Vcrlf		proc	near
		F000_CALL	Vcrlf
		ret
X_Vcrlf		endp

		public	X_Vlf
X_Vlf		proc	near
		F000_CALL	Vlf
		ret
X_Vlf		endp

		public	X_Vcr
X_Vcr		proc	near
		F000_CALL	Vcr
		ret
X_Vcr		endp

		public	X_Cursor_On
X_Cursor_On	proc	near
		F000_CALL	Cursor_On
		ret
X_Cursor_On	endp
;R10 - end
;R11A - start
		public	X_Display_Char
X_Display_Char	proc	near
		F000_CALL	Display_Char
		ret
X_Display_Char	endp
;R11A - end

;R26 - start
		public	X_Display_String
X_Display_String	proc	near
		F000_CALL	Display_String
		ret
X_Display_String	endp
;R26 - end

;R34A;R34 - start
;R34ADIVID		MACRO
;R34A		mov	ax,di
;R34A		div	bx
;R34A		endm
;R34APORT61		EQU	61H
;R34APORT8254	EQU	42H
;R34ADATA8254	EQU	43H
;R34ACOUNT		EQU	3EH
;R34A
;R34A		align	16
;R34A;Function : Measure CPU clock without RDTSC instruction
;R34A;Input    : none
;R34A;Output   : CX - duration time of one CPU clock
;R34A;Note     : This routine will be executed in base memory.
;R34A;
;R34A		public	XMeasureNoRDTSCCpuClck
;R34AXMeasureNoRDTSCCpuClck	proc	far
;R34A
;R34A		cli
;R34A		mov	al,0fch 	;disable counter 2
;R34A		out	PORT61,al
;R34A		SIODELAY
;R34A		mov	al,0b4h 	;program counter 2
;R34A		out	DATA8254,al
;R34A		IODELAY
;R34A		xor	al,al
;R34A		out	PORT8254,al
;R34A		IODELAY
;R34A		out	PORT8254,al
;R34A		IODELAY
;R34A
;R34A		mov	di,7aaah	;dividend
;R34A		mov	bx,5555h	;divisor
;R34A		xor	dx,dx
;R34A		mov	cx,COUNT	;count
;R34A		mov	al,0fdh 	;enable counter
;R34A		out	PORT61,al
;R34A		SIODELAY
;R34A		ALIGN	16
;R34ADivid_33:
;R34A		DIVID			;divide 1
;R34A		DIVID			;divide 2
;R34A		DIVID			;divide 3
;R34A		DIVID			;divide 4
;R34A		DIVID			;divide 5
;R34A		DIVID			;divide 6
;R34A		DIVID			;divide 7
;R34A		DIVID			;divide 8
;R34A		DIVID			;divide 9
;R34A		DIVID			;divide 10
;R34A		DIVID			;divide 11
;R34A		DIVID			;divide 12
;R34A		DIVID			;divide 13
;R34A		DIVID			;divide 14
;R34A		DIVID			;divide 15
;R34A		DIVID			;divide 16
;R34A		DIVID			;divide 17
;R34A		DIVID			;divide 18
;R34A		DIVID			;divide 19
;R34A		DIVID			;divide 20
;R34A		DIVID			;divide 21
;R34A		DIVID			;divide 22
;R34A		DIVID			;divide 23
;R34A		DIVID			;divide 24
;R34A		DIVID			;divide 25
;R34A		DIVID			;divide 26
;R34A		DIVID			;divide 27
;R34A		DIVID			;divide 28
;R34A		DIVID			;divide 29
;R34A		DIVID			;divide 30
;R34A		DIVID			;divide 31
;R34A		DIVID			;divide 32
;R34A		DIVID			;divide 33
;R34A		dec	cx
;R34A		jz	Finish
;R34A		jmp	Divid_33
;R34AFinish:
;R34A		mov	al,0fch 	;stop counter 2
;R34A		out	61h,al
;R34A		SIODELAY
;R34A		in	al,PORT8254	;read counter 2 low byte
;R34A		IODELAY
;R34A		mov	ah,al
;R34A		in	al,PORT8254	;read counter 2 high byte
;R34A		IODELAY
;R34A		xchg	ah,al
;R34A		mov	si,ax		;store result
;R34A
;R34A		xor	dx,dx
;R34A		mov	cx,COUNT	;count
;R34A		mov	al,0fdh 	;enable counter
;R34A		out	PORT61,al
;R34A		SIODELAY
;R34A		ALIGN	16
;R34ADivid_1:
;R34A		DIVID			;divide 1
;R34A		dec	cx
;R34A		jz	short Finish1
;R34A		jmp	short Divid_1
;R34AFinish1:
;R34A		mov	al,0fch 	;stop counter 2
;R34A		out	61h,al
;R34A		SIODELAY
;R34A		in	al,PORT8254	;read counter 2 low byte
;R34A		IODELAY
;R34A		mov	ah,al
;R34A		in	al,PORT8254	;read counter 2 high byte
;R34A		IODELAY
;R34A		xchg	ah,al
;R34A		mov	cx,ax
;R34A		sub	cx,si		;result 2 - result 1
;R34A
;R34A		ret
;R34AXMeasureNoRDTSCCpuClck	endp
;R34A;R34 - end

XCODE		ENDS

;R12 - start
YGROUP		GROUP	YCODE
YCODE		SEGMENT USE16 PARA PUBLIC 'YCODE'
		ASSUME	CS:YGROUP,ES:YGROUP
YCODE		ENDS
;R12 - end

		END
