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

📄 hci.asm

📁 惠普公司bios完整源代码大机密!
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;	[]===========================================================[]
;
;	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.
;
;	[]===========================================================[]
;

;************************************************************************
;*	This file will be included in PMUPOST.ASM, and compiled		*
;*	with 3 stages. All codes occupied at E000 segment, and		*
;*	some codes will be remove to SMI RAM for run-time execution.	*
;************************************************************************

;----------------------------------------------------------------------------
;Rev	Date	 Name	Description
;----------------------------------------------------------------------------
;R83B	03/20/00 KEN	Fixed bug that the modifier keys (i.e. Ctrl,Alt,Shift)
;			aren't generated key codes independently (need to be
;			combined with the other keys).
;R83A	03/17/00 KEN	Fixed bug that the USB mouse can't work with the new
;			timer architecture on i810 platform. The causation is
;			the same as R57.
;R83	03/16/00 KEN	Modified the timer task architecture.
;			The periodic timer won't be always enabled if USB
;			keyboard is plugged, instead it is just enabled while
;			key code buffers aren't empty or the key codes
;			generation procedure is necessary.
;R81	03/14/00 STV	Fixed USB RAM use Base Mem Size Error.
;R80	03/02/00 KEN	Fixed bug that the 60h/64h port trapping routines get
;			invalid AL register value if Cyrix CPU is installed.
;R79	01/26/00 KEN	Reply system with 0FEh for unknown keyboard command.
;			Patch that the Win95 OSR2 Japanese version use unknown
;			command to detect keyboard.
;R65A	01/20/00 KEN	Fixed bug that the second host registers isn't set
;			properly in "Usb_Suspend" and "Usb_Resume" routines.
;R78	01/20/00 KEN	Support the password commands of keyboard controller
;			to solve that the keyboard power-on function is failed,
;			if IOTRAP_SUPPORT is enabled.
;R77	01/14/00 STV	Added Support USB-ZIP.
;R76	01/05/00 WHE	Added Restore2ndUsb to restore 2nd usb controller
;			status because OS did not do it properly
;R75	01/03/00 STV	Added Support USB Floppy when Define "USB_STORAGE_SUPPORT".
;R74	12/04/99 L_W	Corrected "slow" mouse problem. Changed USB Timer to
;			run in 6 millisecond increments if USB_MOUSE_SUPPORT
;			is enabled.
;R73	11/16/99 KEN	Supplemented some codes to support both declarations
;			of USB_MOUSE_SUPPORT and TWO_USB_HOST coexisting.
;R67A	11/16/99 KEN	Coordinated the modification for YGROUP codes.
;R55A	11/16/99 KEN	Coordinated the modification for YGROUP codes.
;R72	11/10/99 RAY	All "ABS" external reference to PCIPOST.ASM
;			"extrn ????:ABS" are moved to a new file: STACK.DEF
;			which is included by COMMON.EQU
;R71	11/10/99 RCH	Fixed USB keyboard legacy failure while the system
;			is at very low temperature and keyboard is connected
;			behind USB hub.
;R70	11/08/99 RCH	Fixed system POST become very slow while some specific
;			USB mice is plugged.
;R69A	11/03/99 RCH	Force switch "BYPASS_D1_COMMAND" enabled for ICH
;			platform if USB mouse legacy support is enabled.
;R69	11/02/99 KEN	Added a declaration "BYPASS_D1_COMMAND" to skip the
;			process of keyboard controller's command D1h to patch
;			that the USB keyboard can't work while running QAPLUSFE
;			v5.50 on i810 platform.
;R68	10/18/99 RCH	Added legacy USB keyboard support for platform without
;			"Keyboard Controller" implemented.
;R67	10/06/99 DNL	Added "Force_Disable_USB" routine to auto detect 
;			legacy PS2 mouse is install or not
;R66	10/04/99 KEN	Fixed bug that the system hang-up while removing USB
;			keyboard from some USB hub.
;R64A	09/29/99 TNY	Add "Redo_UsbSmi" option for K7 to fix i810 STR fail.
;R65	09/29/99 KEN	Add declaration "TWO_USB_HOST" to support two USB host
;			controllers.
;			But, IOTRAP_SUPPORT(USB_MOUSE_SUPPORT) for this feature
;			still have some problem.
;R64	09/29/99 KEN	Fixed bug that the USB keyboard can't work on 751/686A
;			chipset.
;R63	09/28/99 JKY	Fixed compile error for "NEW_SUPERKBC_KERNEL"
;R47B	09/23/99 RCH	Always enable switch ZERO_SET_IDLE to fix some USB
;			keyboards failure which use NEC's USB chip.
;R61	09/07/99 JKY	Add USB_MOUSE_SUPPORT in YGROUP
;R60	08/30/99 KEN	Incease USB_RAM size to 16 KB.
;R59	07/29/99 KEN	Fixed bug that the system hang-up at POST while
;			enumerating the KCT hub compound device. This hub 
;			implement a long descriptor with 168H length and the
;			BIOS only reserved 100H buffer for descriptor parsing.
;R58	07/28/99 RCH	Fixed system becoming very slow during POST memory
;			testing if the CPU front side bus frequency is 133Mhz.
;
;R50A	07/27/99 KEN	Fixed bug that updating ESCD is failed caused by R50
;			modification.
;R57	05/31/99 KEN	Fixed bug that the I/O trapping SMI is abnormal on i810
;			chipset.
;R56	05/15/99 TNY	Fix UsbRam's "55AA" flag always occupied if 
;			"SHADOW_NIT_64K" defined.
;R55	05/12/99 RCH	Fixed compile error if USB mouse legacy support is
;			enabled.
; 
;R54	04/16/99 KEN	Fixed bug that the system is abnormal when the BIOS is
;			defined with "IOTRAP_SUPPORT" on VIA chipset.
;R53	03/22/99 KEN	Patch that the USB keyboard doesn't work after "restart
;			to MS-DOS mode" from Win98 on WHITNEY chipset.
;R52	03/05/99 KEN	Patch the Fujitsu keyboard hang-up while running its
;			testing utility.
;R51	02/10/99 RAY	SHADOW_NIT_64K Only
;			- Fixed coding mistake which caused the whole C000
;			  to be shadowed when ISA VGA is plugged. This shadow
;			  action will cause system hang up
;
;R50	01/18/99 KEN	Patch system hang up while the Japanese Keyobard DOS
;			driver is installed and the USB mouse legacy support
;			is on.
;R21A	01/14/99 RAY	R21 tried to set the rest of the shadow RAM (8k byte)
;			to 0FFh so that it passed the SCT memory test. However
;			there was a coding mistake to set 16K byte. It may 
;			corrupt some legacy devices which decodes their reg.
;			or memory on-card in that area.
;
;R49	01/05/99 KEN	Added SET_PROTOCOL request for some newest HID devices
;			need to set boot protocol. This is used to patch
;			USB keyboard failure with legacy support like
;			Microsoft new USB keyboard.
;R48	12/28/98 RAY	Support switch: SHADOW_UNIT_64K
;R47A	12/24/98 KEN	Fixed coding mistake.
;R47	12/22/98 KEN	Added declaration "ZERO_SET_IDLE" to patch that the
;			SET_IDLE rate of some USB keyboard isn't correct and
;			causes the BIOS simulated typematic rate is wrong.
;			If the BIOS is defined with the declaration, the
;			SET_IDLE value will be null that is the USB keyboard
;			just respond while keys pressing and de-pressing(not
;			periodic report), and the simulation of typematic rate
;			of USB keyboard will be done with a timer task of 16ms
;			interval. For the original method, the simulation is
;			done with the USB keyboard periodic response according
;			to the SET_IDLE rate.
;R46	12/11/98 KEN	Fixed bug that the mouse cursor is displayed abnormal
;			while using Microsoft IntelliMouse (socalled scroll
;			function or wheel control mouse) in Win98 safe mode,
;			when usb mouse support is enabled and no usb mouse
;			is installed.
;			Changed codes include:
;			1. No longer support switching activated mouse between
;			   USB and PS/2 when USB mouse plugged/unplugged.
;			   (USB mouse hot-plugged is still supported.)
;			2. Support Microsoft IntelliMouse setting extended mode
;			   sequence.
;R45	11/13/98 KEN	For USB_MOUSE_SUPPORT.
;			Fixed bug that if the setup item of USB mouse is
;			selected as disabled and no PS/2 mouse is plugged,
;			the BIOS still reports PS/2 mouse installed.
;R44	11/03/98 KEN	Fixed bug for USB_MOUSE_SUPPORT.
;			The system hang-up when shutdown from WinNT5.Beta2,
;			and both USB keyboard and mouse setup items are
;			disabled.
;R43	10/19/98 KEN	Fixed bug that the I/O 0CF8h of PCI configuration
;			space index is destroyed by SMI routine when execute
;			open/close PM_RAM, and cause that the APM kernal
;			cannot write PM_RAM correctly.
;R41D	10/14/98 KEN	Fixed bug that the system hang-up at Usb_Final_Init
;			when one device's setup item (USB keyboard or mouse)
;			is selected as disabled and another is enabled and
;			the corresponding device is installed.
;R41C	10/14/98 KEN	Fixed bug that the PS/2 keyboard should be inactive
;			when hold-down any key in POST stage and no USB
;			keyboard is plugged-in.
;R42	10/14/98 KEN	Added the declaration of "PATCH_AMIDIAG" to patch the
;			error of "BIOS ROM Test" of AMIDIAG.
;R41B	09/28/98 KEN	Added the disable/enable PS/2 mouse process when the
;			USB mouse is inserted/removed.
;R41A	09/28/98 KEN	Fixed coding mistake, and caused that USB mouse is also
;			disabled if USB keyboard is disabled.
;R41	09/21/98 KEN	Added USB_MOUSE_SUPPORT to support USB mouse to emulate
;			as PS/2 mouse for legacy OS(no USB supported).
;R40	09/21/98 KEN	Updated the bit manipulation of bUsbFlag with symbolic
;			variable.
;R39	09/17/98 KEN	Replace all I/O trapping code with the newest.
;R38	08/27/98 KEN	Turn on bus master and io/memory space decoding of USB
;			host controller, avoid that these two bits are not
;			turn-on by PCI kernel.
;R37	06/11/98 KEN	Set the default value of USB_STATUS to be USB disabled,
;			avoid abnormal action in SMI routine between the SMI
;			initialization and USB initialization.
;R36A	06/03/98 KEN	Fixed bug that the system hang-up when shut down from
;			Win98 after S4 suspend/resume process.
;R36    05/29/98 TNY	Fix system hang resume from S4 state if USB Legacy
;			support enabled.
;R35    02/25/98 JKY	Added usb ygroup support.  
;			code for (COMPILE_FOR_USBBIOS EQ 2) include in E-seg ,
;			code for (COMPILE_FOR_USBBIOS EQ 3) replace at YGROUP
;			and copy to smbase.
;R34	02/18/98 KEN	Added declaration of USB_PM_SUPPORT and codes to process
;			USB suspend and resume.
;R33	02/05/98 KEN	Patch that the system hang-up at Usb_Wait_Refresh of
;			Usb_Init while some combination of PCI card plugging
;			in Mitac M/B(2a69jm3c).
;R29A	12/16/97 KEN	Fixed coding mistake and cause some USB keyboard with
;			acceptable error at initialization stage can't work.
;			But it was working properbly with older BIOS.
;R32	12/16/97 KEN	Clear the bit-map flag of USB_RAM in LMEM_RESOURCE and
;			LMEM_RESERVED to release the UMB space when USB legacy
;			supporting is disabled. To correspond with the earlier
;			Usb_Final_Init before POST_82s.
;R31	12/16/97 KEN	Restore original method to allocate shadow RAM for
;			USB_RAM. That is, searching the available shadow RAM
;			upward from C800h to DC00h.
;			To fix that there are no sufficient UMB space for some
;			PCI devices that the size of option ROM is more than
;			48KB.
;R08A	12/15/97 KEN	Fixed bug for UHCI, the USB keyboard won't work after
;			seven times of hot-plugging. The causation is that
;			the flag of control buffer map is never cleared after
;			keyboard initailization.
;R30	11/28/97 JKY	When PMI_HANDLER move to XGROUP , need using F000_call
;R29	11/20/97 KEN	Added codes in Usb_Smi routine to process the error
;			recovery of USB host controller to patch some unstable
;			M/B.(e.g. GemLight 440LX+SMC672 M/B)
;R28	11/13/97 KEN	Fixed bug that there is incorrect handshaking when the
;			USB ownership is changed from the Windows98 to the
;			system BIOS.(e.g. select "Restart in MS-DOS mode" item
;			in Windows98 "Shut Down" menu)
;R27	11/11/97 KEN	Fixed bug that the SET_IDLE and SET_REPORT request
;			have no function with the newest USB keyboard(spec.
;			V1.0 final).
;R26	11/10/97 KEN	Added five keys' codes to support Japanese USB K/B.
;			Key codes translation:
;				USB Key Code	Translated Key Code
;				87h		73h
;				88h		70h
;				89h		7Dh
;				8Ah		79h
;				8Bh		7Bh
;R25	10/06/97 KEN	Get hub descriptor with the value 29h of descriptor
;			type byte to match the newest spec.
;R24	09/18/97 KEN	Get USB keyboard endpoint descriptor with more flexible
;			method to match the old and newest(V1.0 final) USB HID
;			specification.
;			To solve some new USB keyboards can't work with USB
;			BIOS legacy supporting.
;R23	08/28/97 KEN	Added codes to clear enabled status change of hub port
;			after device is disconnected and disabled, otherwise
;			the Intel Hub will always respond with hub port status
;			change.
;R22A	07/30/97 KEN	Modified I/O trapping codes to suit the current BIOS.
;			1. Added definition "IOTRAP_SUPPORT" to enable this
;			   module.
;			2. Got the device ID of host controller with wHostID
;			   that originally got with PIIX3_USB definition.
;			3. Call Ct_DisableUsbLegacySmi/Ct_EnableUsbLegacySmi
;			   to instead that direct setting registers according
;			   to PIIX_ID definition originally.
;			4. Four chipset hook routines added:
;				Ct_CheckUsbLegacySmi
;				Ct_ClearUsbLegacySmi
;				Ct_DisableUsbLegacySmi
;				Ct_EnableUsbLegacySmi
;R22	07/30/97 KEN	Added 60h/64h I/O trapping codes got from Award U.S.
;			Original files were backup and zipped as usb0730.zip
;			in oldfile directory.
;			Only one difference with original files in this
;			revision:
;			  Added pseudo code 'short' to some conditional or
;			  unconditional jumpping instructions.
;R21	06/25/97 RCH	Fixed SCT sometimes testing failure if "USB keyboard"
;			is enabled.
;R20	06/24/97 KEN	Fixed bugs:
;			 1. The system hang up while running the diagnostic
;			    program of Adaptec SCSI ROM.
;			 2. The system hang up when the boot-ROM of 3Com 3C900
;			    is executed.
;			The causation is that the USB kernal uses the base
;			memory at POST stage, and the base memory is conflicted
;			with these programs. To solve these problems, the USB
;			kernal will use the shadow RAM at whole time.
;R19A	06/16/97 KEN	Don't send any key code if over-run, otherwise the
;			system will hang-up when many keys are struke
;			simultaneously and the KEYB driver is installed.
;R19	06/16/97 KEN	Fixed bug for incorrect key code 00h of over-run, the
;			correct key code is 0FFh, and this will cause the KEYB
;			driver to translate key code 00h to 53h("S").
;R18	06/12/97 KEN	Added the definition "NO_UPDATE_USBKB_LED" to patch
;			that the SEJIN USB keyboard is inactive after updating
;			LED.
;R17	06/12/97 KEN	Added "GET_REPORT_DESCRIPTOR" to patch that the SEJIN
;			USB keyboard can't be activated.
;R16	06/11/97 KEN	Fixed bug for the CMD USB keyboard can't repeat and
;			abnormal keystroke. The causation seems to be that
;			the "SET_IDLE" request isn't set correctly.
;R15	06/10/97 KEN	Added 102-key supporting.
;			USB key number 32h, 64h are corresponding to AT key
;			number 42, 45.
;R14A	05/30/97 RCH	Fixed compiation error
;R14	05/27/97 KEN	Fixed bug that the testing program of CATC USB tester
;			report error at first time testing with 430VX M/B and
;			the SETUP item of "USB Keyboard Support" is disabled.
;R13	05/23/97 KEN	Fixed bug that the system hang-up at POST 31h in 430VX
;			system with CATC USB tester.
;R12	05/08/97 KEN	Fixed bug that the screen display abnormal in Win95
;			(no USB supporting) when press USB keyboard and move
;			PS/2 mouse at the same time.
;R11	04/28/97 KEN	Support USB always enabled at POST stage, and
;			initialize USB before memory testing.
;R10	04/16/97 KEN	Fixed bug that the system hang-up when cancel the
;			detection of PCI USB Controller at Win95(no USB
;			supporting). This condition occured when the USB Host
;			Controller shared IRQ with another PCI bus master card
;			and the BIOS USB legacy supporting is enabled.
;R09	04/09/97 KEN	Patched the abnormal keystroke of TATUNG USB keyboard.
;R08	04/09/97 KEN	Fixed bug for supporting multiple hub.
;R07	04/09/97 KEN	Saving all registers is done by Usb_Smi, it's done
;			by PMUPOST originally.
;R06	04/07/97 KEN	Changed the method of processing keystroke, to solve
;			the CMD keyboard problem.
;R05	04/01/97 KEN	Patch that some USB keyboards don't support the
;			SET_IDLE request.(e.g. BTC USB Keyboard)
;R04	03/26/97 KEN	Rename this file as UHCI.ASM, and is included by new
;			USBBIOS.ASM. Some host controller independent codes in
;			this file will be moved to new USBBIOS.ASM in future.
;R03	02/19/97 RCH	Fixed SCT 5.3 "unreport memory" error if USB legacy
;			support is enabled.
;R02	01/22/97 KEN	Updated the interval of system control task to 1024,
;			avoid to enter SMI frequently.
;R01	01/21/97 KEN	Fixed coding mistake.
;R00	01/16/97 KEN	New USBBIOS structure to support HUB and multiple
;			keyboard. The old files is backup as USB0116.zip.

;************************************************************************
;									*
; NOTES: If no special definition, DS and ES always point to USB_RAM	*
;									*
;************************************************************************

;R04IFDEF	USB_SUPPORT
IF	COMPILE_FOR_USBBIOS EQ 1

;****************************************************************
;*								*
;*	COMPILING STAGE 1					*
;*								*
;*	MISCELLANEOUS DEFINITION				*
;*								*
;****************************************************************

;R04	INCLUDE HCI.EQU
;R04	INCLUDE USB.EQU

	extrn	Get_Pci:near
	extrn	Set_Pci:near
	extrn	F000_Shadow_W:near
	extrn	F000_Shadow_R:near
	extrn	Ct_Shadow_RW:near
	extrn	C000_Shadow_RW:near		;R48
	extrn	Ct_Disable_Shadow:near		;R20
	extrn	USB_RAM_SEG:word
;R72	extrn	LMEM_RESOURCE:abs
;R72	extrn	LMEM_RESERVED:abs		;R20
	extrn	USB_STATUS:byte

;R04USB_RAM SEGMENT USE16	AT 0
;R04	INCLUDE HCDATA.INC
;R04USB_RAM ENDS

ENDIF	;COMPILE_FOR_USBBIOS EQ 1

IF	COMPILE_FOR_USBBIOS EQ 2

;R03 - start
ifdef	PNP_BIOS
	extrn	Build_UsbRamNode:near
endif;	PNP_BIOS
;R03 - start

;****************************************************************
;*								*
;*	COMPILING STAGE 2					*
;*								*
;*	POST INITIALIZATION CODES OCCUPIED AT E000 SEGMENT	*
;*								*
;****************************************************************

	assume	ds:USB_RAM

;************************************************************************
;*									*
;*	POST INTERFACE MODULE						*
;*									*
;************************************************************************

ifndef	SMIHANDLE_IN_YGROUP				;R35

;[]========================================================================[]
;Procedure:	Usb_Init
;Function:	USB initialization
;Input:		none
;Output:	none
;[]========================================================================[]

	public	Usb_Init
Usb_Init	proc	near
	push	ds
	push	es
	pushad

	call	Ct_USB_Init
;R37	jnc	short @f
;R37	call	Record_USB_Disabled
;R37	stc
;R37	jmp	short Usb_Init_Exit
;R37@@:
	jc	short Usb_Init_Exit		;R37
	call	Record_USB_Enabled		;R37

;R20	call	Allocate_Post_USBRAM
	call	Allocate_USBRAM			;R20
	call	Get_USBRAM
	mov	ds, ax
	mov	es, ax
	mov	bUsbFlag, USBKBSUPPORT		;R65
;R45 - start
ifdef	USB_MOUSE_SUPPORT
	call	Ct_Check_USB_Disabled
	and	al, USBMSSUPPORT
;R65	and	byte ptr bUsbFlag, not USBMSSUPPORT
	or	byte ptr bUsbFlag, al
endif	;USB_MOUSE_SUPPORT
;R45 - end
;R65 - start
	call	Init_Host_Data
ifdef	TWO_USB_HOST
	mov	al, 1
	call	Set_HostData
	call	Host_Init
	call	System_Control_Init
	call	Init_Timer			;R83
	mov	al, 2
	call	Set_HostData
	call	Host_Init
	call	System_Control_Init
else	;TWO_USB_HOST
;R65 - end

	call	Host_Init

	call	System_Control_Init
	call	Init_Timer			;R83
endif	;TWO_USB_HOST				;R65

	call	Resume_Tasks

	call	Host_Run

	clc

Usb_Init_Exit:
	popad
	pop	es
	pop	ds
	ret
Usb_Init	endp

;[]========================================================================[]
;Procedure:	Usb_Final_Init
;Function:	Re-initialize USB for reallocating USB_RAM to shadow
;Input:		none
;Output:	none
;[]========================================================================[]

	public	Usb_Final_Init
Usb_Final_Init	proc	near
	push	ds
	push	es
	pushad

	call	Check_USB_Disabled
;R14A	jnz	short Usb_Final_Init_Exit
	jnz	Usb_Final_Init_Exit			;R14A

⌨️ 快捷键说明

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