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

📄 oempdim.asm

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASM
📖 第 1 页 / 共 2 页
字号:

endif ;PNP


;==============================================================================;
;                                                                              ;
;                      PCI Device Initializer Hooks                            ;
;                                                                              ;
;==============================================================================;

ifdef PCI
;---------------------------------------;
; dih_pci_prog_frame_buf                ;
;---------------------------------------;--------------------------------------;
; This function should program any chipset register needed for the PCI VGA     ;
; frame buffer.  This function will only be called if a PCI VGA card that      ;
; uses a frame buffer is detected.                                             ;
;                                                                              ;
; For example: In the Mercury PCMC (82434LX), register 7C must be programmed   ;
;              with the base address and size of the frame buffer.             ;
;                                                                              ;
; Input: ESI = Absolute base address of PCI VGA frame buffer                   ;
;        ECX = Size of PCI VGA frame buffer (in bytes)                         ;
;                                                                              ;
; Output: Nothing                                                              ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
	public	dih_pci_prog_frame_buf
dih_pci_prog_frame_buf	proc near
COMMENT ~
        pushad

        mov     al,PCI_FRAME_BUFFER_USWC
        call    check_cmos_data_far
        jz      dppfb_exit

	push	esi
	push	ecx
; ESI contains the base address of the PCI frame buffer.
; ECX contains the size in bytes of the memory region.
;
        and     si,0f000h               ; mask off lower 12 bits
        push    ecx
        mov     eax,esi
        mov     al,1                    ; Set USWC
        xor     edx,edx
        mov     ecx, MTRRphysBase5
.586p
        wrmsr
.486p
        pop     eax
;        shr     eax,1                   ; divide size by 2
        dec     eax
        not     eax
        and     ax,0f000h
        or      ah,08h
        mov     cx, MTRRphysMask5
.586p
        wrmsr
.486p
	pop	ecx
	pop	esi
	push	ecx

	shr	esi,10h
	mov	cx,si
	mov	di,088h
        mov     bx, (S530_BUS_NUM shl 8) + S530_DEV_FUNC_NUM
        mov     ah, RT_PCI_WRITE_CFG_WORD
        CALL_RT_FUNCTION                

	pop	ecx
	shr	ecx,10h
	dec	cx
	not	cx
	mov	di,08ah
        mov     ah, RT_PCI_WRITE_CFG_WORD
        CALL_RT_FUNCTION                
	
dppfb_exit:
        popad
~
	ret
dih_pci_prog_frame_buf	endp

;---------------------------------------;
; dih_pci_check_disabled                ;
;---------------------------------------;--------------------------------------;
; This function may be used to disable any PCI device in the system.  This is  ;
; useful if setup has a question which enables or disables an on-board PCI     ;
; device (for example an on-board SCSI controller).                            ;
;                                                                              ;
; Input: BL = Device/Function number of device                                 ;
;                Bits 7-3: PCI device number                                   ;
;                Bits 2-0: Function number within the device                   ;
;        BH = Bus number of device                                             ;
;                                                                              ;
; Output: CF = Set if device should be disabled                                ;
;              Clear if device is ok to enable/configure/etc.                  ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
	public	dih_pci_check_disabled
dih_pci_check_disabled	proc near
	cmp	bx,(S5595_BUS_NUM shl 8)+S5595_USB_DEV_FUNC_NUM
					; USB Device Number
        clc                             ; enable pci device
	jnz	not_usb
	push	ax
	mov   	al,Q_USB_FUNCTION_ENABLE  
        call    check_cmos_data_far
	pop	ax
        clc                             ; enable pci device
	jnz	not_usb

	pushad
	mov	di,10h
	mov	ecx,0f8000000h		; Assign any memories for USB.
        mov     ah, RT_PCI_WRITE_CFG_DWORD
        CALL_RT_FUNCTION

;	mov	di,3ch
;	mov	cl,0fh			; Assign IRQ 15 for USB.
;        mov     ah, RT_PCI_WRITE_CFG_BYTE
;        CALL_RT_FUNCTION
	
	mov	di,PCI_REG_COMMAND
	mov	cx,0007h			; Enabled USB
        mov     ah, RT_PCI_WRITE_CFG_WORD
        CALL_RT_FUNCTION

;	mov	bx,(S5595_BUS_NUM shl 8)+S5595_PCI2ISA_DEV_FUNC_NUM
;	mov	di,62h
;	mov	cl,4fh				; IRQ 15
;        mov     ah, RT_PCI_WRITE_CFG_BYTE
;        CALL_RT_FUNCTION
	popad
	stc
	ret
not_usb:
;; Added by Abel Wu at 11/05/98 for disable OnChip VGA when bank0 hasn't RAM.
;; Get A.G.P Bridge Secondary Bus Number
	pusha
	mov	ch,bh
	mov	bx, SIS_AGP_P2P_BUS_NUM * 100h + SIS_AGP_P2P_DEV_FUNC_NUM
	mov	di, PPB_REG_SEC_BUS_NUM
        mov     ah, RT_PCI_READ_CFG_BYTE
        CALL_RT_FUNCTION
	cmp	ch,cl
	popa
	clc	
	jnz	short not_onchip_vga
	pusha
	mov	bx, S530_BUS_NUM * 100h + S530_DEV_FUNC_NUM
        mov     di, 0afh
        mov     ah, RT_PCI_READ_CFG_BYTE
        CALL_RT_FUNCTION
	cmp	cl, 01h	      
	popa
	cmc
not_onchip_vga:
	ret				; exit
dih_pci_check_disabled	endp
;---------------------------------------;
; dih_pci_check_keep_enabled            ;
;---------------------------------------;--------------------------------------;
; This function is called just after each PCI device is configured and         ;
; enabled.  This function may inspect the device and decide to keep the device ;
; enabled or to disable the device.  One possible use of this function is to   ;
; make sure an IDE drive is connected to an IDE controller, and disable the    ;
; controller if no drive is present.                                           ;
;                                                                              ;
; Input: BL = Device/Function number of device                                 ;
;                Bits 7-3: PCI device number                                   ;
;                Bits 2-0: Function number within the device                   ;
;        BH = Bus number of device                                             ;
;                                                                              ;
; Output: CF = Set if device should be disabled                                ;
;              Clear if device is ok to keep enabled                           ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
	public	dih_pci_check_keep_enabled
dih_pci_check_keep_enabled	proc near
	clc
	ret
dih_pci_check_keep_enabled	endp
endif ;PCI

;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**      (C)Copyright 1985-1996, American Megatrends, Inc.      **;
;**                                                             **;
;**                     All Rights Reserved.                    **;
;**                                                             **;
;**           6145-F Northbelt Pkwy, Norcross, GA 30071         **;
;**                                                             **;
;**                     Phone (770)-246-8600                    **;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
_text	ends
	end

⌨️ 快捷键说明

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