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

📄 npostdim.asm

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASM
📖 第 1 页 / 共 5 页
字号:
; This function is called by the System Board Device Initializer (DI-SYS.ASM)  ;
; during function 2 (Output Device Init).  This function should examine the    ;
; device ID of the currently selected boot output device in NVRam.  If this    ;
; device ID matches the device ID of a system device node that is capable of   ;
; being an output device, then the device should be enabled and its resources  ;
; should be allocated.  If the current boot output device (in NVRam) is set to ;
; DEVTYPE_DEFAULT, then any onboard device capable of functioning as an        ;
; output device should be enabled and its resources should be allocated.  If   ;
; the BD_FLAG_NO_DEV_CHECK bit is not set in the nvrhd_output.bd_flags word in ;
; NVRam, then this function should (if possible) only enable the output device ;
; if there is (for example) a monitor connected.                               ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Cleared if boot output device was found, set if not found.      ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_sys_func_2  proc near
        stc                             ;Indicate no device found
        ret
dih_sys_func_2  endp


;---------------------------------------;
; dih_sys_func_3 (Input Device Init)    ;
;---------------------------------------;--------------------------------------;
; This function is called by the System Board Device Initializer (DI-SYS.ASM)  ;
; during function 3 (Input Device Init).  Normally there will be nothing to do ;
; here, because DI-SYS.ASM will use the keyboard controller as the boot input  ;
; device.                                                                      ;
;                                                                              ;
; This function can be used to implement a non-standard boot input device (one ;
; example of this would be redirecting console I/O to a serial port).  When    ;
; implementing a non-standard input device this function should examine the    ;
; device ID of the currently selected boot input device in NVRam.  If this     ;
; device ID matches the device ID of the non-standard input device, this       ;
; function should enable the device and allocate the device's resources.  If   ;
; a non-standard boot input device is found and successfully initialized, this ;
; function should return with CF clear.  Note: A non-standard boot input       ;
; device must provide an Int 09h interface.                                    ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Cleared if a boot input device was found, set if not found.     ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_sys_func_3  proc near
        stc                             ;Indicate no device found
        ret
dih_sys_func_3  endp


;---------------------------------------;
; dih_sys_func_4 (IPL Device Init)      ;
;---------------------------------------;--------------------------------------;
; This function is called by the System Board Device Initializer (DI-SYS.ASM)  ;
; during function 4 (IPL Device Init).  This function should examine the       ;
; device ID of the currently selected IPL device in NVRam.  If this            ;
; device ID matches the device ID of a system device node that is capable of   ;
; being an IPL device, then the device should be enabled and its resources     ;
; should be allocated.  If the current IPL device (in NVRam) is set to         ;
; DEVTYPE_DEFAULT, then any onboard device capable of functioning as an        ;
; IPL device should be enabled and its resources should be allocated.  If      ;
; the BD_FLAG_NO_DEV_CHECK bit is not set in the nvrhd_ipl.bd_flags word in    ;
; NVRam, then this function should (if possible) only enable the IPL device    ;
; if there is (for example) a monitor connected.                               ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Cleared if boot output device was found, set if not found.      ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_sys_func_4  proc near
        stc                             ;Indicate no device found
        ret
dih_sys_func_4  endp


;---------------------------------------;
; dih_sys_func_5 (General Device Init)  ;
;---------------------------------------;--------------------------------------;
; This function is called by the System Board Device Initializer (DI-SYS.ASM)  ;
; during function 5 (General Device Init).  If there are any configurable      ;
; system device nodes that need to be enabled before boot, this function       ;
; should enable them and allocate their resources.                             ;
;                                                                              ;
; Input: SI = Offset of the NVRam workspace (in _dimdata seg)                  ;
;        DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: CF = Set if error, cleared otherwise                                 ;
;                                                                              ;
; Preserves: DS, ES, BP (all other registers are destroyed)                    ;
;------------------------------------------------------------------------------;
dih_sys_func_5  proc near
        clc                             ;Indicate success
        ret
dih_sys_func_5  endp


;---------------------------------------;
; dih_sys_config_done                   ;
;---------------------------------------;--------------------------------------;
; This function is called after all devices of all types have been configured. ;
;                                                                              ;
; Input: DS = ES = _dimdata Segment                                            ;
;                                                                              ;
; Output: Nothing                                                              ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
dih_sys_config_done     proc near

; The following code is included when the debug switch is set in the makefile.
; This code will copy the entire resource map (which is built during POST) into
; shadow memory at DC00:0.  You can then run the utility RESMAP.EXE to display
; the resource map in a readable form.  NOTE: This code will destroy any option
; ROM that is shadowed at DC00:0 so don't enable it if you are using a board
; which needs DC00:0.

ifdef INC_DEBUG
        pusha
        push    es

        mov     dl, 7
        mov     al, 1
        call    dih_sys_mem_shadow      ;Set DC00 - DFFF to R/W RAM

        mov     di, 0DC00h              ;ES:DI = DC00:0
        mov     es, di
        xor     di, di
        mov     cx, 4000h               ;16k
        xor     al, al
        cld
        rep     stosb                   ;Clear out DC00 - DFFF

        xor     di, di
        mov     si, ds:ResMapStart      ;DS:SI = Resource Map
        mov     cx, ds:ResMapEnd
        sub     cx, si                  ;CX = Number od bytes in Resource Map
        rep     movsb

        mov     dl, 7
        mov     al, 2
        call    dih_sys_mem_shadow      ;Set DC00 - DFFF to WP RAM

        pop     es
        popa
endif
if MKF_ACPI_SUPPORT
	pusha
	mov	al,Q_ACPI_OS
	call	check_cmos_data_far
	jz	get_acpi_irq_done
        mov     di, offset OwnerWork
        mov     (owner_pci ptr [di]).own_pci_sig, OWNTYPE_PCI
        mov     (owner_pci ptr [di]).own_pci_bus, 00h
        mov     (owner_pci ptr [di]).own_pci_devfunc, 09h
        mov     dword ptr (owner_pci ptr [di]).own_pci_vendid, 00091039h
        mov     (owner_pci ptr [di]).own_pci_rsvd, 0
;; Get available IRQs from PCI IRQ map
        mov     si, 3612h
	sub	bx,bx
	mov	ax,bx
get_acpi_irq_map:
	lodsb
	or	al,al
	jz	short get_acpi_irq_map_done
	bts	bx,ax
	jmp	short get_acpi_irq_map
get_acpi_irq_map_done:
	push	bx
        mov     ax, RM_ALLOC_IRQ * 100h + RESFLAG_NO_ALLOC
        CALL_RESMGR
	pop	bx
	jnc	got_acpi_irq

        mov     ax, RM_ALLOC_IRQ * 100h + RESFLAG_SHARE
        CALL_RESMGR
	jc	get_acpi_irq_done
got_acpi_irq:
	bsf	cx,ax
	or	cl,80h				; Enable by SMI route
	mov	bx,S5595_BUS_NUM + S5595_PCI2ISA_DEV_FUNC_NUM
	mov	di,6ah
        mov     ah,RT_PCI_WRITE_CFG_BYTE
        CALL_RT_FUNCTION
get_acpi_irq_done:
	popa
endif
        ret
dih_sys_config_done     endp


;---------------------------------------;
; dih_sys_mem_shadowable                ;
;---------------------------------------;--------------------------------------;
; This function reports whether or not a given memory block is set to shadow   ;
; enabled in CMOS.                                                             ;
;                                                                              ;
; Input:  DL = Block to check: 0=C000, 1=C400, 2=C800, 3=CC00                  ;
;                              4=D000, 5=D400, 6=D800, 7=DC00                  ;
;                                                                              ;
; Output: CF = Set if shadow is disabled for this block in CMOS                ;
;              Clear if shadow is enabled for this block in CMOS               ;
;                                                                              ;
; Destroys: Nothing                                                            ;
;------------------------------------------------------------------------------;
shadow_ques_table       label   byte
        db      q_c0000_shadow
        db      q_c0000_shadow
        db      q_c8000_shadow
        db      q_cc000_shadow
        db      q_d0000_shadow
        db      q_d4000_shadow
        db      q_d8000_shadow
        db      q_dc000_shadow

dih_sys_mem_shadowable  proc near
        pusha
        mov     bx,offset cgroup:shadow_ques_table
        mov     al,dl
        xlat    cgroup:shadow_ques_table
        call    check_cmos_data_far     ; AL = 00 disabled, <>00 enabled
        cmp     al,1                    ; CY = disabled, NC = enabled
        popa
        ret
dih_sys_mem_shadowable  endp

;---------------------------------------;
; check_cmos_data_far                   ;
;---------------------------------------;--------------------------------------;
; This function returns the value of the given setup item.                     ;
;                                                                              ;
; Input:  AL = setup question structure#                                       ;
;                                                                              ;
; Output: ZF = Set if it is disabled in CMOS setup                             ;
;              Clear if it is enabled in CMOS setup                            ;
;         AL = right justified value of the given setup item                   ;
;                                                                              ;
; Destroys: AX                                                                 ;
;------------------------------------------------------------------------------;
        public  check_cmos_data_far
check_cmos_data_far     proc    near
        db      9ah                     ; CALL FAR F000:EED5
        dw      0eed5h
        dw      0f000h
        ret
check_cmos_data_far     endp
COMMENT ~
;---------------------------------------;
; get_processor_info_far                ;
;---------------------------------------;--------------------------------------;
; This function returns the processor information                              ;
;                                                                              ;
; Input:  none                                                                 ;
;                                                                              ;

⌨️ 快捷键说明

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