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

📄 runfb.asm

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

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

	include	setupequ.ext
	include rt.equ
	include makeflag.equ

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

	public FrameBufSetSize
	public FrameBufGetCurSize
	public FrameBufGetCurAddress
	public FrameBufSetCmosData
	public FrameBufGetCmosData
	public FrameBufMakeInvisible
	public FrameBufMakeVisible
	public FrameBufGetFbBanks
	public FrameBufGetMinMaxSize
	public FrameBufGetBankMemSize
	public FrameBufGetBankMemSpeed
	public FrameBufGetBankMemType
	public FrameBufGetAsymMemInfo

if MKF_VUMA_SUPPORT
	public FrameBufGetAllBanks
	public FrameBufGetCurBanks
	public FrameBufGetVisibility
	public FrameBufGetChipsetInfo
	public FrameBufGetMemCtrlSpeed
	public FrameBufGetBankVoltage
	public FrameBufGetBankTimingInfo
	public FrameBufGetBankAddress
	public FIND_FREQUENCY
	public DRAM_CONTROL_CYCLE
endif

if MKF_SMBA_SUPPORT
	public FrameBufSetMemHoleOverlap
	public FrameBufGetMemHoleInfo
	public FrameBufGetHostBusSpeed
endif

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

	extrn	get_cmos_item: near
	extrn	set_cmos_item: near
        extrn	read_pci_byte: near

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

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


if MKF_SMBA_SUPPORT

;---------------------------------------------------------------------------
; SMBA Memory Bank
;---------------------------------------------------------------------------
	db	'$$CT'			; table signature for BCP
	db	01h			; version number of the table
	db	'SMBA Memory Bank', 0	; ASCIIZ string specifying the chipset
					; name or anything specific like
					; "table for 50MHz clock", etc. this
					; string will be displayed by BCP.
	dw	offset cgroup:SmbaBankNumberEnd ; ptr to end of table+1
	db	00h			; attribute
					; bit-0 = 0..byte register
					;	  1..word register
					; bit-1 = 0..byte data
					;	  1..word data
	db	'Bank #',0
	db	'Reserved',0

SmbaBankNumber	label	byte

;		Bank #		Reserved
;  this should tell BIOS which memory bank is used by SMBA Video
	db	03h,		00h	; bank3 used by SMBA Video
SmbaBankNumberEnd	label	byte

endif

;******************************************************************************;
;                                                                              ;
;                  Chipset Hooks Needed by Both VUMA and SMBA                  ;
;                                                                              ;
;******************************************************************************;

;---------------------------------------;
; FrameBufSetSize                       ;
;---------------------------------------;--------------------------------------;
; This function sets the size and bank usage of the VUMA/SMBA shared frame     ;
; buffer memory area.                                                          ;
;                                                                              ;
; NOTE: This function is needed in both VUMA and SMBA.                         ;
;                                                                              ;
; Input:  DX = Size of shared frame buffer memory area in units of 64k         ;
;         BX = Bitmap of memory banks that can be used (0000h if only the top  ;
;              memory bank may be used as in SMBA)                             ;
;                  Bit 0: If set, bank 0 can be used by VUMA/SMBA              ;
;                  Bit 1: If set, bank 1 can be used by VUMA/SMBA              ;
;                  ...                                                         ;
;                  Bit 15: If set, bank 15 can be used by VUMA/SMBA            ;
;                                                                              ;
; Output: CF = Clear if function was successful, set if error                  ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
FrameBufSetSize	proc near
	stc				;Indicate error
	ret
FrameBufSetSize	endp


;---------------------------------------;
; FrameBufGetCurSize                    ;
;---------------------------------------;--------------------------------------;
; This function gets the current size of the VUMA/SMBA shared frame buffer     ;
; memory area.                                                                 ;
;                                                                              ;
; NOTE: This function is needed in both VUMA and SMBA.                         ;
;                                                                              ;
; Input:  Nothing                                                              ;
;                                                                              ;
; Output: DX = Size of shared frame buffer memory area in units of 64k.  The   ;
;              value 0000h means shared frame buffer is disabled.              ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
FrameBufGetCurSize	proc near
	push	ax
	push	cx
	xor	dx, dx
        mov     ah, 063h		; DRAM Status Register
        call    read_pci_byte
	test	al,040h
	jz	short @f
	and	al,00110000b
	jz	short @f
	shr	al,4h
	mov     cl,al
	mov	dl,10h			; dx=10h= 16*64K = 1024k = 1M
	shl	dx,cl
@@:
	pop	cx
	pop	ax
	ret
FrameBufGetCurSize	endp


;---------------------------------------;
; FrameBufGetCurAddress                 ;
;---------------------------------------;--------------------------------------;
; This function returns the current physical address of VUMA/SMBA shared frame ;
; buffer.                                                                      ;
;                                                                              ;
; NOTE: This function is needed in both VUMA and SMBA.                         ;
;                                                                              ;
; Input: Nothing                                                               ;
;                                                                              ;
; Output: EAX = Physical address of VUMA/SMBA frame buffer                     ;
;	  CF  = Clear if function was successful, set if error                 ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
	extrn	get_bank_size:near
FrameBufGetCurAddress	proc near
	push	edx
	sub	ax,ax			; RAS 0
	call	get_bank_size
	push	ax
	mov	ah,60h
	call	read_pci_byte
	test	al,20h			; Check Single/Double Sides?
	pop	ax
	jz	short @f
	shr	ax,1
@@:
	shl	eax,20			; change from 1M to physical

	call	FrameBufGetCurSize
	shl	edx,16			; change from 64K to physical

	sub	eax,edx			; CF = 0
	pop	edx
	ret
FrameBufGetCurAddress	endp

;---------------------------------------;
; FrameBufSetCmosData                   ;
;---------------------------------------;--------------------------------------;
; This function writes the given VUMA/SMBA frame buffer size and flags into    ;
; CMOS.  For VUMA and SMBA there should be a setup question that looks like    ;
; the one below (add more size options if the chipset supports them).  Use     ;
; the set_cmos_item function to write to CMOS.                                 ;
;                                                                              ;
;       Question (Q_FRAME_BUF_SIZE)                                            ;
;               Text    = "Frame Buffer Size"                                  ;
;               Options = "Disabled",                                          ;
;                         "1MB":DEFAULT:POWERON,                               ;
;                         "2MB"                                                ;
;       EndQuestion                                                            ;
;                                                                              ;
; NOTE: This function is needed in both VUMA and SMBA.                         ;
;                                                                              ;
; Input: CH = Flags                                                            ;
;             Bit 0: If set, frame buffer overlaps memory hole                 ;
;                    If clear, frame buffer does not overlap memory hole       ;

⌨️ 快捷键说明

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