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

📄 pcipost.asm

📁 AWARD BIOS源代码,支持的CHIPSET请看文件,有同型号的板子烧上去就可以跑
💻 ASM
📖 第 1 页 / 共 5 页
字号:
fProc_Get_Vendor_ID	Endp
		ALIGN	4
		ASSUME	DS:NOTHING
		public	Get_Vendor_ID
Get_Vendor_ID	Proc	Near

		push	cx
		xor	cl, cl			;Vendor ID
		call	Get_CfgSpace_Word

		cmp	ax, -1			;valid vendor ID
		stc
		je	Yes_Invalid
		clc
Yes_Invalid:
		pop	cx
		ret

Get_Vendor_ID	Endp

;[]============================================================[]
;Input	:	CH - Slot identification Number
;Output :	AX - DEVICE ID
;Destroy:	AX
;[]============================================================[]
		Public	fProc_Get_Device_ID
fProc_Get_Device_ID	Proc	Far
		call	Get_Device_ID
		retf
fProc_Get_Device_ID	Endp
		ALIGN	4
		ASSUME	DS:NOTHING
		Public	Get_Device_ID
Get_Device_ID	Proc	Near

		push	cx
		mov	cl, 02			;Device ID
		call	Get_CfgSpace_Word
		pop	cx
		ret

Get_Device_ID	Endp

;[]==============================================================[]
;PciRom_After_Init:
;	Force shadow RAM readonly after option ROM initialization
;Saves: all
;Input : none
;Output: None
;[]==============================================================[]
		ALIGN	4
		public	PciRom_After_Init
PciRom_After_Init	proc	near

		POST_FUNC_CALL EPciRom_After_Init
		ret

PciRom_After_Init	endp

;[]==============================================================[]
;PciRom_Before_Init:
;	special treatment before option initialization
;Saves: all
;Input : none
;Output: None
;[]==============================================================[]
		ALIGN	4
		public	PciRom_Before_Init
PciRom_Before_Init	proc	near

		call	fProc_PciRom_Before_Init

;R13 start
;R13A	ifdef	lan_boot_support
;R13A			mov	dword ptr LAN_CARD_ID[bp],0		;clear LAN device&vendor ID
;R13A
;R13A			mov	di,(8+1)*4
;R13A			post_func_call	post_decompress			;combined lan rom ?
;R13A			jc	short No_LAN_ROM			;yes!
;R13A			push	es
;R13A			push	4000h
;R13A			pop	es
;R13A			mov	bx,es:[18h]
;R13A			mov	ax,es:[bx+4]				;get vendor id
;R13A			shl	eax,16
;R13A			mov	ax,es:[bx+6]				;get device id
;R13A			pop	es
;R13A			mov	LAN_CARD_ID[bp], eax			;save vendor&device id
;R13A	No_LAN_ROM:
;R13A	endif	;lan_boot_support
;R13 end

		ret

PciRom_Before_Init	endp

;R05 - starts
ifdef	SUPPORT_PCISLOT_IDE
		Public	Open_8673
Open_8673	proc	near

		mov	dx, 108h
		mov	al, 04Ah
		out	dx, al
		NEWIODELAY
		mov	al, 06Ch
		out	dx, al
		NEWIODELAY

		mov	al, cl
		out	dx, al
		NEWIODELAY
		inc	dl
		in	al, dx
		NEWIODELAY

		ret

Open_8673	endp

		Public	Set_8673
Set_8673	proc	near

		xchg	al, cl
		mov	dx, 108h
		out	dx, al
		NEWIODELAY
		inc	dl
		xchg	al, cl
		out	dx, al
		NEWIODELAY
		mov	dx, 108h
		mov	al, 034h
		out	dx, al
		NEWIODELAY

		ret

Set_8673	endp
endif;	SUPPORT_PCISLOT_IDE
;R05 - ends

endif	;PCI_BUS

FCODE		ENDS

;--------------------------------------------------------------
;--------------------------------------------------------------
;----- The following codes will be located at E000 ! ----------
;----- The following codes will be located at E000 ! ----------
;----- The following codes will be located at E000 ! ----------
;----- The following codes will be located at E000 ! ----------
;--------------------------------------------------------------
;--------------------------------------------------------------
EGROUP		GROUP	ECODE
ECODE		SEGMENT USE16 PARA PUBLIC 'ECODE'
		ASSUME	CS:EGROUP, DS:G_RAM, ES:EGROUP

ifdef	PCI_BUS

;--------------------------------------------------------
;Input	:	SI = C800 - DF80
;		CL =  number of 4K to mark
;--------------------------------------------------------
		ALIGN	4
		ASSUME	DS:NOTHING
		Public	Mark_Addr_Not_Available
Mark_Addr_Not_Available	Proc	Near

		mov	eax, 1
		shl	eax, cl
		dec	eax

		mov	cx, si
		mov	cl, ch
		sub	cl, 0C8h
		shl	eax, cl
		or	LMEM_RESOURCE[bp], eax

		ret

Mark_Addr_Not_Available	Endp

;---------------------------------------
;Input : SI - segment to check
;Output: zero set  - ROM existed
;	 not zero  - ROM no existed
;---------------------------------------
		Public	Check_ROM_Exist
Check_ROM_Exist	proc	near
		mov	ds, si
		mov	ax, ds:[0]
		iodelay
		cmp	ax, 0AA55h			;ROM signature?
		ret
Check_ROM_Exist	endp

		Public	Rom_In_Terms_of_4K
Rom_In_Terms_of_4K	Label	Near

		mov	cl, ds:[2]			;ROM size in 512K
		test	cl, 07h				;size < 4K
		jz	@F				;no, continue!
		add	cl, 08h				;  to 4K
	@@:
		shr	cl, 3				;in terms of 4K
		ret

;-------------------------------------------
;-------------------------------------------
		ALIGN	4
		Public	Invalidate_Shadow_Seg
Invalidate_Shadow_Seg	Proc	Near
;R82 - starts
ifdef	SHADOW_UNIT_64K

		mov	eax, LMEM_RESOURCE[bp]
;R90		xor	al, al			;Free C8 - CF
		test	eax, 00FFFF00h		;D0-DF contain legacy stuff?
		jz	No_Legacy_At_D
		or	eax, 00FFFF00h		;invalidate the whole D Segment

	No_Legacy_At_D:

		mov	LMEM_RESOURCE[bp], eax
		ret

else	;SHADOW_UNIT_64K
;R82 - ends
		F000_CALL Ct_Shadow_Unit
		mov	edi, 00Fh
		cmp	cx, 4000h
		mov	cl, 4
		je	@F
		mov	edi, 0FFh
		mov	cl, 8
	@@:

	;------------------------------------
	_A_A:
		test	LMEM_RESOURCE[bp], edi
		jz	_B_B
		or	LMEM_RESOURCE[bp], edi
	_B_B:

		shl	edi, cl
		test	edi, 0FF000000h
		jz	_A_A
	;------------------------------------

		ret

endif	;SHADOW_UNIT_64K				;R82

Invalidate_Shadow_Seg	Endp

;---------------------------------------
;---------------------------------------
E000_A20_On	Proc	Near
		push	ds
		F000_CALL A20_On
		pop	ds
		ret
E000_A20_On	Endp

;---------------------------------------
;---------------------------------------
		public	E000_A20_Off		;R30
E000_A20_Off	Proc	Near
		push	ds
		F000_CALL A20_Off
		pop	ds
		ret
E000_A20_Off	Endp

;[]================================================================[]
;Function : Far call to write PCI double word value
;Input  : CX - device + function number	, CURRENT_BUS_NO[bp] = bus No.
;Output : none
;[]================================================================[]
		Public	F000_Set_CfgSpace_Dword
F000_Set_CfgSpace_Dword	proc	near
		call	fProc_Set_CfgSpace_Dword
		ret
F000_Set_CfgSpace_Dword	endp

;[]================================================================[]
;Function : Far call to write PCI word value
;Input  : CX - device + function number	, CURRENT_BUS_NO[bp] = bus No.
;Output : none
;[]================================================================[]
		Public	F000_Set_CfgSpace_word
F000_Set_CfgSpace_word	proc	near
		call	fProc_Set_CfgSpace_word
		ret
F000_Set_CfgSpace_word	endp

;[]================================================================[]
;Function : Far call to write PCI byte value
;Input  : CX - device + function number	, CURRENT_BUS_NO[bp] = bus No.
;Output : none
;[]================================================================[]
		Public	F000_Set_CfgSpace_Byte
F000_Set_CfgSpace_Byte	proc	near
		call	fProc_Set_CfgSpace_Byte
		ret
F000_Set_CfgSpace_Byte	endp

;[]================================================================[]
;Function : Far call to read PCI double word value
;Input  : CX - device + function number	, CURRENT_BUS_NO[bp] = bus No.
;Output : none
;[]================================================================[]
		Public	F000_Get_CfgSpace_Dword
F000_Get_CfgSpace_Dword	proc	near
		call	fProc_Get_CfgSpace_Dword
		ret
F000_Get_CfgSpace_Dword	endp

;[]================================================================[]
;Function : Far call to read PCI word value
;Input  : CX - device + function number	, CURRENT_BUS_NO[bp] = bus No.
;Output : none
;[]================================================================[]
		Public	F000_Get_CfgSpace_word
F000_Get_CfgSpace_word	proc	near
		call	fProc_Get_CfgSpace_word
		ret
F000_Get_CfgSpace_word	endp

;[]================================================================[]
;Function : Far call to read PCI Byte value
;Input  : CX - device + function number	, CURRENT_BUS_NO[bp] = bus No.
;Output : none
;[]================================================================[]
		Public	F000_Get_CfgSpace_Byte
F000_Get_CfgSpace_Byte	proc	near
		call	fProc_Get_CfgSpace_Byte
		ret
F000_Get_CfgSpace_Byte	endp

;[]============================================================[]
;Input	:	CH - Slot identification Number
;Output :	AX - VENDER ID
;Destroy:	AX
;[]============================================================[]
		ALIGN	4
		ASSUME	DS:NOTHING
		Public	F000_Get_Vendor_ID
F000_Get_Vendor_ID	Proc	Near

		call	fProc_Get_Vendor_ID
		ret

F000_Get_Vendor_ID	Endp

;[]==============================================================[]
;EPciRom_After_Init:
;	Force shadow RAM readonly after option ROM initialization
;Saves: all
;Input : none
;Output: None
;[]==============================================================[]
		ALIGN	4

EPciRom_After_Init	proc	near

		PUSH_ALL

IF	RELEASE_E000_FOR_PCI
	;Enable E0000-E7FFF shadow RAM read/write because we have
	;to release this area for PCI ROM

		F000_CALL E000_64k_Shadow_RW
ENDIF	;RELEASE_E000_FOR_PCI

;R21		push	dword ptr LMEM_BEFORE_ROM[bp]

;R21		mov	eax, LMEM_BEFORE_ROM[bp]
;R21		mov	edx, LMEM_RESOURCE[bp]
;R21		not	eax
;R21		and	edx, eax
;R21		mov	LMEM_BEFORE_ROM[bp], edx

;R21B - starts
;R68A		push	dword ptr LMEM_BEFORE_ROM[bp]
;R21C		mov	eax, LMEM_BEFORE_ROM[bp]
;R21C		mov	edx, LMEM_RESOURCE[bp]
;R21C		not	eax
;R21C		and	edx, eax
;R21C		mov	LMEM_BEFORE_ROM[bp], edx
;R21C - starts
		mov	eax, LMEM_BEFORE_ROM[bp]
		or	eax, LMEM_RESOURCE[bp]
		mov	LMEM_BEFORE_ROM[bp], eax
;R21C - ends
;R21B - ends

	;init NON-Compliance ROMs on all Buses

		call	Non_PCI_Compliance_ROM
		jc	@F			;CF = Already shadow

		call	Shadow_C8_To_DF
		call	Dis_Shadow_Not_Avail
	@@:

		ALIGN	4
;R21		pop	dword ptr LMEM_BEFORE_ROM[bp]
;R68A		pop	dword ptr LMEM_BEFORE_ROM[bp]	;R21B

		call	Init_ISA_roms_addr		;R23

	;special for NCR's SCSI devices


	;init Compliance ROMs on all Buses
;R35 - start
ifdef	LAST_INIT_FOR_LAN_ROM
	;scan non LAN devices
		mov	byte ptr DEVICE_CLASS_FLAG[bp],0
		call	PCI_Compliance_ROM

	;check if LAN card found
		test	byte ptr DEVICE_CLASS_FLAG[bp],LAN_FOUND
		jz	short NoLanRomScan
	;scan LAN devices
		or	byte ptr DEVICE_CLASS_FLAG[bp],LAN_NOW
endif;	LAST_INIT_FOR_LAN_ROM
;R35 - end

		call	PCI_Compliance_ROM
NoLanRomScan:						;R35

		call	Init_NCR810_ROM

	ifdef	COMBINE_ISA_ROM
		call	Init_Other_ROMs

⌨️ 快捷键说明

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