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

📄 runvuma.asm

📁 AMI 主板的BIOS源码。
💻 ASM
📖 第 1 页 / 共 2 页
字号:
	page	,132
	title .	VUMA Shared Frame Buffer Runtime Functions
;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**      (C)Copyright 1985-1995, American Megatrends, Inc.      **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
;**                                                             **;
;**                     Phone (770)-263-8181                    **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------;

	public	VumaInt15EntryPoint

;---------------------------------------;

	extrn FrameBufGetAllBanks: near
	extrn FrameBufGetAsymMemInfo: near
	extrn FrameBufGetBankAddress: near
	extrn FrameBufGetBankMemSize: near
	extrn FrameBufGetBankMemSpeed: near
	extrn FrameBufGetBankMemType: near
	extrn FrameBufGetBankTimingInfo: near
	extrn FrameBufGetBankVoltage: near
	extrn FrameBufGetChipsetInfo: near
	extrn FrameBufGetCmosData: near
	extrn FrameBufGetCurAddress: near
	extrn FrameBufGetCurBanks: near
	extrn FrameBufGetCurSize: near
	extrn FrameBufGetFbBanks: near
	extrn FrameBufGetMemCtrlSpeed: near
	extrn FrameBufGetMinMaxSize: near
	extrn FrameBufGetVisibility: near
	extrn FrameBufMakeInvisible: near
	extrn FrameBufMakeVisible: near
	extrn FrameBufSetCmosData: near
	extrn FIND_FREQUENCY:near
	extrn DRAM_CONTROL_CYCLE:near

	include	setupequ.ext
;---------------------------------------;

VUMA_BIOS_MAJOR_VERSION	equ 01h
VUMA_BIOS_MINOR_VERSION	equ 00h

;---------------------------------------;

cgroup	group	_text
_text 	segment word public 'CODE'
	assume	cs:cgroup
.386

;---------------------------------------;
; VumaInt15EntryPoint                   ;
;---------------------------------------;--------------------------------------;
; This is the entry point for all VUMA Int 15 runtime functions.               ;
;                                                                              ;
; Input: AX = F401h                                                            ;
;        BL = Subfunction number (valid values are 00h - 08h)                  ;
;        Other registers are subfunction dependant                             ;
;                                                                              ;
; Output: AL = F4h if subfunction is supported, any other value means function ;
;              is not supported.                                               ;
;         AH = 00h if subfunction was successful, any other value means that   ;
;              an error occurred.                                              ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
VumaInt15EntryPoint	proc near
	push	bp

	movzx	bp, bl			;BP = VUMA function number
	shl	bp, 1
	add	bp, offset cgroup:VumaFuncTableStart
	cmp	bp, offset cgroup:VumaFuncTableEnd
	mov	ax, 00FFh		;Return value for not supported
	jae	VumaInt15Done		;Br if func number is too high

	call	word ptr cgroup:[bp]	;Returns CF set if error
	mov	al, 0F4h		;AL = F4 (function supported)
	jc	VumaInt15Done		;Br if function returned with error
	mov	ah, 00h			;AH = 0 (no error)

VumaInt15Done:
	pop	bp
	add	sp, 02h			;Bypass BIOS's Special Int 15 caller
	retf	2			;Return directly to Int 15 caller
VumaInt15EntryPoint	endp



;------------------------------;
; VUMA Run Time Function Table ;
;------------------------------;
VumaFuncTableStart:
		dw	VumaGetChipsetInfo		;VUMA function 00h
		dw	VumaGetMemoryInfo		;VUMA function 01h
		dw	VumaSetNextBootMemSize		;VUMA function 02h
		dw	VumaGetNextBootDeviceMemSize	;VUMA function 03h
		dw	VumaGetNextBootAllMemSize	;VUMA function 04h
		dw	VumaGetCurrentMemSize		;VUMA function 05h
		dw	VumaGetMemorySpeedType		;VUMA function 06h
		dw	VumaMemoryEnableDisable		;VUMA function 07h
		;dw	VumaAuxMemRequestFree		;VUMA function 08h (not supported)
		;dw	VumaAuxMemGetSize		;VUMA function 09h (not supported)
VumaFuncTableEnd:



;---------------------------------------;
; VumaGetChipsetInfo (00)               ;
;---------------------------------------;--------------------------------------;
; This function returns general information about the chipset's capabilities.  ;
;                                                                              ;
; Input: Nothing                                                               ;
;                                                                              ;
; Output: CF = Set if error, clear if successful                               ;
;         AH = Nonzero return code if function was not successful              ;
;              (value is "don't care" if function is successful)               ;
;         BL = Major VUMA BIOS revision (01h) (yes these two return values are ;
;         BH = Minor VUMA BIOS revision (00h)  defined backwards in the spec)  ;
;         CX = Bank numbers that are supported by chipset (may or may not      ;
;              contain memory)                                                 ;
;              Bit 0: Set if bank 0 is supported by chipset                    ;
;              Bit 1: Set if bank 1 is supported by chipset                    ;
;              ...                                                             ;
;              Bit 15: Set if bank 15 is supported by chipset                  ;
;         DL = Flags                                                           ;
;              Bit 0: Set if chipset supports non-cachable regions             ;
;              Bit 1: Set if chipset supports write-thru cache regions         ;
;              Bit 2: Set if chipset supports enable/disable cache at runtime  ;
;              Bit 3: Set if chipset supports enable/disable write-thru cache  ;
;                     at runtime                                               ;
;              Bit 4: Set if chipset supports snooping (this bit is relevant   ;
;                     only if synchronous DRAM is installed)                   ;
;              Bit 5-7: Reserved                                               ;
;         DH = Speed in nanoseconds of memory controller (00 = unknown)        ;
;         SI = Bitmap of banks that contain memory                             ;
;               Bit 0: Set if bank 0 contains memory                           ;
;               Bit 1: Set if bank 1 contains memory                           ;
;               ...                                                            ;
;               Bit 15: Set if bank 15 contains memory                         ;
;         DI = Memory banks that may be used for VUMA frame buffer and         ;
;              contain memory                                                  ;
;               Bit 0: Set if bank 0 will be used                              ;
;               Bit 1: Set if bank 1 will be used                              ;
;               ...                                                            ;
;               Bit 15: Set if bank 15 will be used                            ;
;                                                                              ;
; Destroys: AL, AH (if successful)                                             ;
;------------------------------------------------------------------------------;
VumaGetChipsetInfo	proc near

	call	FrameBufGetChipsetInfo	;Returns DL = flags, SI = non cache gran
	call	FrameBufGetMemCtrlSpeed	;Returns DH = speed of memory controller in ns

	mov	cx, 0Fh			;Start with highest possible bank
	xor	si, si			;Init result bitmap to zeros
GetCsInfoNextBank:
	call	FrameBufGetBankMemSize	;Returns AX = size of mem in bank CL in 64k
	or	ax, ax
	jz	@f			;Br if bank is empty
	bts	si, cx			;Set bit in result bitmap
@@:	loop	GetCsInfoNextBank

	call	FrameBufGetFbBanks	;Returns AX = frame buf banks bitmap
	mov	di, ax
	and	di, si			;Zero any banks that don't have memory

	call	FrameBufGetAllBanks	;Returns AX = all banks bitmap
	mov	cx, ax

	mov	bl, VUMA_BIOS_MAJOR_VERSION
	mov	bh, VUMA_BIOS_MINOR_VERSION

	clc
	ret
VumaGetChipsetInfo	endp


;---------------------------------------;
; VumaGetMemoryInfo (01)                ;
;---------------------------------------;--------------------------------------;
; This function reports information on the chipset's VUMA memory capabilities. ;
;                                                                              ;
; Input: Nothing                                                               ;
;                                                                              ;
; Output: CF = Set if error, clear if successful                               ;
;         AH = Nonzero return code if function was not successful              ;
;              (value is "don't care" if function is successful)               ;
;         BX = Minimum amount of memory that can be allocated to VUMA frame    ;
;              buffer in units of 64K                                          ;
;         CX = Maximum amount of memory that can be allocated to VUMA frame    ;
;              buffer in units of 64K                                          ;
;         SI = Chipset's non-cache region granularity in units of 64K          ;
;         DI = Granularity of memory that can be allocated to VUMA frame       ;
;              buffer in units of 64K                                          ;
;                                                                              ;
; Destroys: AL, AH (if successful)                                             ;
;------------------------------------------------------------------------------;
VumaGetMemoryInfo	proc near
	push	dx

	call	FrameBufGetChipsetInfo	;Returns DL=flags, SI=non cache gran
	call	FrameBufGetMinMaxSize	;Returns BX=min, CX=max, DI=gran

	pop	dx
	clc
	ret
VumaGetMemoryInfo	endp


;---------------------------------------;
; VumaSetNextBootMemSize (02)           ;
;---------------------------------------;--------------------------------------;
; This function sets the size of the VUMA frame buffer for one device for the  ;
; next boot.                                                                   ;
;                                                                              ;
; Input: CL = PCI Device/Function number of VUMA device                        ;
;                Bits 7-3: PCI device number                                   ;
;                Bits 2-0: Function number within the device                   ;
;        CH = PCI Bus number of VUMA device                                    ;
;        DX = Memory banks supported by VUMA device                            ;
;              Bit 0: Set if bank 0 is supported                               ;
;              Bit 1: Set if bank 1 is supported                               ;
;              ...                                                             ;
;              Bit 15: Set if bank 15 is supported                             ;
;        SI = VUMA frame buffer memory size requested in units of 64KB         ;
;                                                                              ;
; Output: CF = Set if error, clear if successful                               ;
;         AH = Nonzero return code if function was not successful              ;
;              (value is "don't care" if function is successful)               ;
;         DX = Actual size of VUMA frame buffer memory that will be used       ;
;              (The BIOS may round the requested amount up if needed)          ;
;                                                                              ;
; Destroys: AL, AH (if successful)                                             ;
;------------------------------------------------------------------------------;
VumaSetNextBootMemSize	proc near
	push	bx
	push	cx
	push	di
	push	si

	call	FrameBufGetMinMaxSize	;Returns BX=min, CX=max, DI=gran

	dec	di			;DI = chipset's mem gran - 1 (...0001111...)
	add	si, di			;Round up request
	not	di			;DI = 10000h - mem gran (...111000...)
	and	di, si			;DI = rounded up mem request

	call	FrameBufGetCmosData	;DX=Mem Size, CH=Flags
	mov	dx, di
	call	FrameBufSetCmosData	;Save DX=Mem Size, CH=Flags in CMOS

	pop	si
	pop	di
	pop	cx
	pop	bx
	clc
	ret
VumaSetNextBootMemSize	endp


;---------------------------------------;
; VumaGetNextBootDeviceMemSize (03)     ;
;---------------------------------------;--------------------------------------;
; This function returns the amount of memory that will be allocated to a given ;
; VUMA device on the next boot.                                                ;
;                                                                              ;
; Input: CL = PCI Device/Function number of VUMA device                        ;
;                Bits 7-3: PCI device number                                   ;
;                Bits 2-0: Function number within the device                   ;
;        CH = PCI Bus number of VUMA device                                    ;
;                                                                              ;
; Output: CF = Set if error, clear if successful                               ;
;         AH = Nonzero return code if function was not successful              ;
;              (value is "don't care" if function is successful)               ;
;         DX = Size of VUMA frame buffer memory that will be allocated on next ;
;              boot for the given VUMA device in units of 64KB                 ;
;                                                                              ;
; Destroys: AL, AH (if successful)                                             ;
;------------------------------------------------------------------------------;
VumaGetNextBootDeviceMemSize	proc near
	push	cx

	call	FrameBufGetCmosData	;DX=Mem Size, CH=Flags

	pop	cx
	clc
	ret
VumaGetNextBootDeviceMemSize	endp


;---------------------------------------;
; VumaGetNextBootAllMemSize (04)        ;
;---------------------------------------;--------------------------------------;
; This function returns the amount of memory that will be allocated to all     ;
; VUMA devices on the next boot.                                               ;
;                                                                              ;
; Input: Nothing                                                               ;
;                                                                              ;
; Output: CF = Set if error, clear if successful                               ;
;         AH = Nonzero return code if function was not successful              ;
;              (value is "don't care" if function is successful)               ;
;         DX = Size of VUMA frame buffer memory that will be allocated on next ;

⌨️ 快捷键说明

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