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

📄 pcipost.asm

📁 <B>Award BIOS(Basic Input/Output System)(电脑启动时所必需)的源码</B>
💻 ASM
📖 第 1 页 / 共 5 页
字号:
		jc	@F			;CF = Already shadow

		call	Shadow_C8_To_DF
		call	Dis_Shadow_Not_Avail
	@@:

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

		call	Init_ISA_roms_addr

	;special for NCR's SCSI devices


	;init Compliance ROMs on all Buses
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

		call	PCI_Compliance_ROM
NoLanRomScan:

		call	Init_NCR810_ROM

	ifdef	COMBINE_ISA_ROM
		call	Init_Other_ROMs
	endif;	COMBINE_ISA_ROM

		call	init_isa_roms

;R21B		call	Shadow_C8_To_DF
		call	Shadow_C8_To_DF			;R68

;R82	ifndef	CT_SHADOW_RW_HOOK_SUPPORT
;R82		F000_CALL Ct_C8_To_DF_R
;R82	else	;CT_SHADOW_RW_HOOK_SUPPORT
		call	Shadow_C8_To_DF_R
;R82	endif	;CT_SHADOW_RW_HOOK_SUPPORT

		call	Invalidate_Shadow_Seg		;invalidate whole shadow seg
							;i.e. shadow unit = 16K(32K)
							;     ==> invalidate whole
							;	  16k(32k) even if it
							;	  is not totally used!
		mov	si, 1
		call	EDisable_UnUsed_Shadow

;R82 - starts
ifdef	SHADOW_UNIT_64K
ifdef	USB_SUPPORT
;R92B;R92		cmp	byte ptr LMEM_RESERVED[bp],0	;C8-CF reserved by USB?
;R92B;R92		jne	@F				;yes!
;R92B;R92 - start
;R92B		test	byte ptr LMEM_RESERVED[bp],0f0h	;C8-CF reserved by USB?
;R92B		jnz	short @F 			;yes!	;R92A
;R92B;R92A		jz	@F				;yes!
;R92B;R92 - end
;R92B	;Set shadow write-protected, if no USB legacy occupied C-segment.
;R92B		call	F_C000_Shadow_R
;R92B	@@:
;R92B - start
		cmp	byte ptr PCI_VGA_FOUND[bp], VGA_DEVICE_EXIST ;PCI VGA existed
		jne	short @F
;R92C		test	byte ptr LMEM_RESERVED[bp],0fh	;C8-CF reserved by USB?
		test	byte ptr LMEM_RESERVED[bp],0ffh	;C8-CF reserved by USB?	;R92C
		jnz	short @F 			;yes!
	;Set shadow write-protected, if no USB legacy occupied C-segment.
		call	F_C000_Shadow_R
	@@:
;R92B - end
endif	;USB_SUPPORT
endif	;SHADOW_UNIT_64K
;R82 - endif

;Enable/Disable VGA Palette snoop according to setup

		cmp	byte ptr PCI_VGA_FOUND[bp], VGA_DEVICE_EXIST ;PCI VGA existed
		jne	No_PciVga_Found

		mov	si, offset Vga_Snoop_Item
		call	F000_GetItem_Value
		or	al, al
		jz	No_VgaSnoop

		mov	cx, PCI_VGA_INFO[bp]	;ah = bus no. al=dev+fun no
		mov	bh, ch			;bus no.
		xchg	ch, cl
		mov	cl, 04H			;command register
		F000_CALL Aget_CfgSpace_Word
		or	al, 20H			;enable VGA snoop
		F000_CALL ASet_CfgSpace_Word
No_VgaSnoop:
No_PciVga_Found:

IF	RELEASE_E000_FOR_PCI
;--------------------------------------------------------------
;clear the un-used E0000-E7FFF shadow RAM to FFh for EMM386 UMB
;--------------------------------------------------------------

		mov	al, LMEM_RESOURCE[bp+3]	;save for atbase.asm
						;to check if E000 shadow RAM
						; occupied by PCI ROM
		mov	si, offset E000_USED_BY_PCI
		mov	cs:[si], al

		mov	cx, 08000h		;32k to clear
		mov	di, 0E000h		;starting from E000h
	@@:
		or	al, al
		jz	@F
		shr	al, 1
		add	di, 100h		;update starting addr. to clr
		sub	cx, 1000h		;add 4k more to clear
		jmp	@B
	@@:
		or	ch, ch
		jz	No_Need_Clear_E0
		mov	es, di			;Clear shadow with 0FFh
		xor	di, di			;Clear shadow with 0FFh
		cld				;Clear shadow with 0FFh
		mov	al, -1			;Clear shadow with 0FFh
		rep	stosb			;Clear shadow with 0FFh

	No_Need_Clear_E0:

		F000_CALL E000_64k_Shadow_R

ENDIF	;RELEASE_E000_FOR_PCI

		mov	byte ptr LMEM_FOR_ROM_FLG[bp], 1

		call	PatchRomAlignMent
;R78A		call	Set_IDE_DMA_Capable		;R78
;R91 - starts
	ifdef	PciLanROM_Control
		call	Restore_Onboard_PCI_Lan
	endif	;PciLanROM_Control
;R91 - ends
		POP_ALL

		ret

EPciRom_After_Init	endp

;R91 - starts
ifdef	PciLanROM_Control
		PUBLIC	Restore_Onboard_PCI_Lan
Restore_Onboard_PCI_Lan	PROC	near

		mov	byte ptr CURRENT_BUS_NO[bp], 0
		mov	ch, (Onboard_PCI_LAN) shl 3	;device/function number
		mov	cl, 04h				;register = 4 (command)
;R91A		mov	ax,Xgroup_Segment
;R91A		mov	ds,ax
;R91A		lea	si,LAN_COMMAND_WORD		;get offset
;R91A		mov	ax,[si]				;restore value in AX
		mov	ax,POST_Stack_Temp_Word[bp]	;R91A restore value in AX
		call	fProc_Set_CfgSpace_Word

		ret

Restore_Onboard_PCI_Lan	ENDP
endif	;PciLanROM_Control
;R91 - ends

;R78A;R78 start
;R78ASet_IDE_DMA_Capable	proc	far
;R78A
;R78A		xor	bh,bh			;bus 0
;R78A		xor	ch,ch			;start device 0,function 0
;R78ASIDC_Loop:
;R78A		mov	cl,0ah			;offset 0Ah (class code)
;R78A		F000_call	AGet_CfgSpace_Word
;R78A		cmp	ax,0ffffh		;invalid?
;R78A		je	short Next_Device	;Yes,skip
;R78A
;R78A		cmp	ax,101h			;IDE device?
;R78A		jne	short Next_Device	;Yes,skip
;R78A
;R78A		mov	cl,20h			;offset 20h (DMA base port)
;R78A		F000_call	AGet_CfgSpace_Word
;R78A		and	ax,0fff0h		;isolate useful bits
;R78A		jz	short Next_Device	;invalid then skip
;R78A
;R78A		mov	dx,ax			;DX = base port
;R78A		and	dx,0fff0h		;isolate useful bits
;R78A		add	dl,2			;set to status register of primary
;R78A		in	al,dx			;get original data
;R78A		or	al,60h			;set drive 0,1 DMA capable
;R78A		out	dx,al			;send to port
;R78A
;R78A		add	dl,8			;set to status register of secondary
;R78A		in	al,dx			;get original data
;R78A		or	al,60h			;set drive 0,1 DMA capable
;R78A		out	dx,al			;send to port
;R78ANext_Device:
;R78A		inc	ch			;next device and function
;R78A		jnz	short SIDC_Loop		;not exceed then continue
;R78A
;R78A		ret
;R78ASet_IDE_DMA_Capable	endp
;R78A;R78 end

;[]==============================================================[]
;INIT_ISA_ROMS_ADDR:
;Input : none
;Output: None
;NOTE:This func is CBROM /isa with assign address.(40A0h to 40A3h)
;[]==============================================================[]
		ALIGN	4
INIT_ISA_ROMS_ADDR	proc	near
		push	ds
		push	es
		push	bp

		mov	bx,Temp_EXP_Seg			;cbrom table segment
		mov	es,bx
		mov	di,(ISA_ADDR_Expand_Address+1)*4;;;;;(0a0h+1)*4			;cbrom /isa table offset
							;start
next_isa_rom_addr:
		push	di
		mov	ebx,es:[di+Temp_EXP_Off]
		or	ebx,ebx
		jz	short No_rom_exit
		cmp	bx,0ffffh
		je	short No_rom_exit

		call	combined_isa_addr	;cbrom /isa compress address
		cli
		call	E000_A20_On
		call	E000_Enter_Prot_mode		;enter protected mode
		call	E000_Back_Real_Mode
		xor	edx,edx
		mov	dx, ds:[ebx+0fh]		;assign address(offset)
		shl	edx, 4
		mov	AVAIL_LMEM_ADDR[bp], edx
		mov	word ptr ds:[ebx+0fh], 0	;clear offset to decompress
		call	E000_A20_Off

		or	edx,edx				;have address?
		jz	short No_rom_exit

		call	post_decompress
		jc	short No_rom_exit		;R107
		call	get_rom_size
		call	lmem_flg_mask
		test	eax,LMEM_RESOURCE[bp]
		jnz	short No_rom_exit
		or	LMEM_RESOURCE[bp], eax
		call	copy_rom_shadow_init
No_rom_exit:
		pop	di
		add	di, 4
		cmp	di, (0a3h+1)*4		     ;cbrom /isa table offset
						     ;end
		jb	next_isa_rom_addr

		pop	bp
		pop	es
		pop	ds
		ret
INIT_ISA_ROMS_ADDR	endp
;[]==============================================================[]
;INIT_ISA_ROMS:
;Input : none
;Output: None
;NOTE:This func is CBROM /isa not assign address.(40A4h to 40A7h)
;[]==============================================================[]
		ALIGN	4
Init_ISA_ROMS	proc	near
		push	ds
		push	es
		push	bp

		mov	bx,Temp_EXP_Seg		     ;cbrom table segment
		mov	es,bx
		mov	di,(ISA_Expand_Address+1)*4;;;;;(0a4h+1)*4		     ;cbrom /isa table offset
						     ;start
next_isa_rom:
		push	di
		mov	ebx,es:[di+Temp_EXP_Off]
		or	ebx,ebx
		jz	short No_isa_rom_exit
		cmp	bx,0ffffh
		je	short No_isa_rom_exit

		call	post_decompress
		jc	short No_isa_rom_exit		;R107
		call	get_rom_size
		call	EGet_Available_LMEM 		;request low mem
		jc	No_isa_rom_exit			;no shadow available
		call	copy_rom_shadow_init
No_isa_rom_exit:
		pop	di
		add	di, 4
		cmp	di, (0a7h+1)*4		      ;cbrom /isa table offset
						      ;end
		jb	short next_isa_rom

		pop	bp
		pop	es
		pop	ds
		ret
Init_ISA_ROMS	endp
;[]==============================================================[]
;combined_isa_addr:
;Input : DI : cbrom number. e.g -> 40A0h , DI = (0A0h+1)*4
;Output: EBX : physical address
;[]==============================================================[]
		ALIGN	4
combined_isa_addr	proc	near
;R55ifdef	Flash_2M_support
;R55		mov	ebx, 160000h			;extra option ROM temp address
;R55;717;		cmp	es:[di+Temp_EXP_Off+2], 8000h	;first segment
;R55		cmp	es:[di+Temp_EXP_Off+2],POST_Cmprsed_Temp_Seg	;717 first segment
;R55		je	@F				;Yes, skip
;R55		add	ebx, 10000h			;set to next sgment (170000h)
;R55@@:
;R55		add	bx, es:[di+Temp_EXP_Off]	;set to physical address
;R55else	;Flash_2M_support
;R55		xor	ebx, ebx
;R55		mov	bx, es:[di+Temp_EXP_Off+2]
;R55		shl	ebx, 4
;R55		add	bx, es:[di+Temp_EXP_Off]	;set to physical address
;R55endif	;Flash_2M_support
;R55 start
		mov	ebx,es:[di+Temp_EXP_Off]
;R73A	ifdef	Flash_2M_support
;R73A	  ifndef linear_rom_support	;R73
;R73A			add	ebx,(160000h-POST_Cmprsed_Temp_Seg shl 4)	;set 80000h to 160000h
;R73A	  endif ;linear_rom_support	;R73
;R73A	endif	;Flash_2M_support
;R55 end
		ret
combined_isa_addr	endp
;[]==============================================================[]
;get_rom_size:
;Input : NONE
;Output: CL : ROM size (at 4k)
;[]==============================================================[]
		ALIGN	4
get_rom_size	proc	near
;R107		push	4000h
;R107		pop	ds
;R107		mov	cl,ds:[2]			;ROM size
;R107		shr	cl,3
;R107		and	al, 07h
;R107		or	al, al
;R107		jz	short @f
;R107		inc	cl
;R107@@:
;R107 start
		push	4000h
		pop	ds
		call 	Rom_In_Terms_of_4K
;R107 end
		ret
get_rom_size	endp
;[]==============================================================[]
;copy_rom_shadow_init:Copy ROM at 4000:0 to shadow(AVAIL_LMEM_ADDR[bp])
;		      & initiation
;Input : NONE
;Output: NONE
;[]==============================================================[]
		ALIGN	4
copy_rom_shadow_init	proc	near
		mov	edi, AVAIL_LMEM_ADDR[bp]
		shr	edi, 4
		push	di

		mov	si, 4000h
		xor	al, al
		call	ECopy_ROM			;copy rom to shadow

		pop	bx
		mov	dx, bx
		push	bp
		F000_call	R_Mod_Ck		;init rom
		pop	bp
		ret
copy_rom_shadow_init	endp
;[]==============================================================[]
;lmem_flg_mask:
;Input : CL -> rom size (at 4k)
;Output: EAX -> need shadow address(e.g c800 at 0000000f)
;[]==============================================================[]
		ALIGN	4
lmem_flg_mask	proc	near
		mov	edi, AVAIL_LMEM_ADDR[bp]
		shr	edi, 4

		dec	cl
		mov	eax, 0FFFFFFFEh
		shl	eax, cl
		not	eax

		mov	cx, di
		shr	cx, 8
		sub	cl, 0C8h
		shl	eax, cl
		ret
lmem_flg_mask	endp
;Function : Report device node for the option ROM have smaller ROM size than
;	    shadow unit.
;Input    : none
;Output   : none
;Note     : This routine is used to patch mishandling device driver of Intel
;	    LAN chip 82558 while Win95 enter and exit suspend mode if there
;	    is option ROM and the size is not aligned with shadow unit.
PatchRomAlignMent	proc	near
ifdef	PNP_BIOS
		mov	esi,0E0000H - (2*1024)	;start from high UMB

Next2KbRomChk:
		ror	esi, 4			;get segment address
		mov	ds,si			;setup segment
		rol	esi, 4			;restore esi

		cmp	word ptr ds:[0],0AA55H	;option ROM
		je	short OptionRomYes

NoPatchAlignForISA:							;R22C

		sub	esi, 2*1024		;next 2Kb
		cmp	esi, 0C0000H		;lowest ROM address
		jb	short PatchRomExit
		jmp	short Next2KbRomChk

OptionRomYes:

;R80A - start
ifdef	USB_SUPPORT
		cmp	dword ptr ds:[4], 'BSU$';It's a USB RAM ?
		je	short PatchNodeSure
endif;	USB_SUPPORT
;R80A - end

;R22C - starts
ifndef	NO_ISA_BUS				;R80
	;Only build device node for PCI option ROM.
		mov	bx, ds:[18h]
		cmp	dword ptr ds:[bx], 'RICP';It's a PCI option ROM ?
		jne	NoPatchAlignForISA	;no, no patch needed
						;yes, patch it.
endif;	NO_ISA_BUS				;R80
;R22C - ends

	PatchNodeSure:				;R80A

	;ROM found, check it if align with shadow unit
		movzx	edi,byte ptr ds:[2]	;get ROM size
		shl	edi,9

		add	edi,esi			;start address
;R82 - starts
ifdef	SHADOW_UNIT_64K
		mov	ecx, 010000h
		mov	edx, 0FFFF0000h
else	;SHADOW_UNIT_64K
;R82 - ends
		xor	ecx,ecx
		F000_call Ct_Shadow_Unit 	;shadow unit in cx
		mov	ebx,esi			;ROM address

;R82;R80 - start
;R82		mov	edx,0FFFF0000H		;assume 64KB shadow unit
;R82		or	cx, cx			;64KB unit ?
;R82		jz	short Not16KUnit
;R82;R80 - end

		mov	dx, 08000h		;assume 32k unit
		cmp	ch,40h			;16k unit ?
		jne	short Not16KUnit

⌨️ 快捷键说明

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