📄 npostdim.asm
字号:
page ,132
title . Device Initializer Hooks
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends, Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F Northbelt Pkwy, Norcross, GA 30071 **;
;** **;
;** Phone (770)-246-8600 **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------;
include dim.equ
include devnode.equ
include rt.equ
include escd.equ
include pci.equ
include pnp.equ
include makeflag.equ
include setupequ.ext
include sis530.equ
;---------------------------------------;
public dih_sys_func_0
public dih_sys_func_1
public dih_sys_func_2
public dih_sys_func_3
public dih_sys_func_4
public dih_sys_func_5
public dih_sys_mem_shadowable
public dih_sys_config_done
ifdef ISA
public dih_isa_func_0
public dih_isa_func_1
public dih_isa_func_2
public dih_isa_func_3
public dih_isa_func_4
public dih_isa_func_5
public dih_isa_reserve_irq_mem
endif
ifdef EISA
public dih_eisa_handle_cfg_mem
public program_cachability_sram
public program_cachability_sram_final
endif
ifdef PNP
public dih_pnp_func_0
public dih_pnp_func_1
public dih_pnp_func_2
public dih_pnp_func_3
public dih_pnp_func_4
endif
ifdef PCI
public dih_pci_func_0
public dih_pci_check_ide
public dih_pci_func_1
public dih_pci_func_2
public dih_pci_func_3
public dih_pci_func_4
public dih_pci_func_5
public dih_pci_get_info
public dih_pci_prot_dev
public dih_pci_ignore_escd_irq
extrn dih_pci_prot_dev_table:byte
extrn dih_pci_prot_dev_table_end:byte
endif
;---------------------------------------;
;---------------------------------------;
; dih_scratch_data ;
;---------------------------------------;--------------------------------------;
; This is a 128 byte scratch data area which can be used by any of the hook ;
; functions in this file. This scratch area is in the _dimdata segment which ;
; is an input (DS, ES) to all of the functions in this file. ;
; ;
; NOTE: Do not assume that this scratch area is initialized or zeroed out. ;
; You must initialize this scratch area according your needs. A good ;
; place to do any initialization is in dih_sys_func_0 since it is the ;
; first hook to be called. ;
; This data area is not used by any of the core routines. ;
; ;
;------------------------------------------------------------------------------;
extrn dih_scratch_data: byte
extrn dih_manual_ide_id: byte
;---------------------------------------;
extrn SysStatus: dword
extrn IsaStatus: dword
extrn EisaStatus: dword
extrn PnPStatus: dword
extrn PciStatus: dword
extrn OwnerWork: byte
extrn FindDevID: dword
extrn FindDevSerial: dword
extrn FindDevLogID: dword
extrn FindDevType: dword
extrn FindDevTypeMask: dword
extrn FindDevInitAll: byte
extrn FindDevInitAllBoot: byte
extrn PnPFoundDevCSN: byte
extrn PnPFoundDevID: dword
extrn PnPFoundDevSer: dword
extrn PnPFoundDevLID: dword
extrn FindDevIncDev: byte
extrn FindDevIncBus: byte
extrn PCICommandValue: word
extrn PCIFoundDevID: dword
extrn PCIFoundDevFunc: dword
extrn PCIFoundDevBus: dword
extrn EscdFuncNum: byte
extrn EscdSlotNum: byte
extrn PCIROMMinBase: dword
extrn PCIROMMaxBase: dword
extrn MaxPCIBusNumber:byte
extrn ResMapStart: word
extrn ResMapEnd: word
;---------------------------------------;
cgroup group _text
_text segment byte public 'CODE'
assume cs:cgroup
.386
;---------------------------------------;
; Protected IO Ports for Legacy Devices ;
;---------------------------------------;
public dih_sys_legacy_port_table_start
public dih_sys_legacy_port_table_end
dih_sys_legacy_port_table_start:
LegacyPort < 170h, 8 > ;170 - 17F: Secondary HDC
LegacyPort < 1F0h, 8 > ;1F0 - 1FF: Primary HDC
LegacyPort < 200h, 8 > ;200 - 207: Game port
LegacyPort < 250h, 2 > ;250 - 251: Bestlink suggestion
LegacyPort < 278h, 4 > ;278 - 27B: Parallel port
LegacyPort < 2E8h, 8 > ;2E8 - 2EF: Serial port
LegacyPort < 2F8h, 8 > ;2F8 - 2FF: Serial port
LegacyPort < 370h, 8 > ;370 - 377: Secondary FDC
LegacyPort < 378h, 4 > ;378 - 37B: Parallel port
LegacyPort < 3B0h, 12> ;3B0 - 3BC: Monochrome adapter
LegacyPort < 3BCh, 4 > ;3BC - 3BF: Parallel port
LegacyPort < 3C0h, 32> ;3C0 - 3DF: Various CGA/EGA/VGA
LegacyPort < 3E8h, 8 > ;3E8 - 3EF: Serial port
LegacyPort < 3F8h, 8 > ;3F8 - 3FF: Serial port
;Remove these comments to protect the EISA ID ports
if MKF_INC_EISA
LegacyPort < 00C80h, 4 > ;EISA ID Ports - Slot 0
LegacyPort < 01C80h, 4 > ;EISA ID Ports - Slot 1
LegacyPort < 02C80h, 4 > ;EISA ID Ports - Slot 2
LegacyPort < 03C80h, 4 > ;EISA ID Ports - Slot 3
LegacyPort < 04C80h, 4 > ;EISA ID Ports - Slot 4
LegacyPort < 05C80h, 4 > ;EISA ID Ports - Slot 5
LegacyPort < 06C80h, 4 > ;EISA ID Ports - Slot 6
LegacyPort < 07C80h, 4 > ;EISA ID Ports - Slot 7
LegacyPort < 08C80h, 4 > ;EISA ID Ports - Slot 8
LegacyPort < 09C80h, 4 > ;EISA ID Ports - Slot 9
LegacyPort < 0AC80h, 4 > ;EISA ID Ports - Slot A
LegacyPort < 0BC80h, 4 > ;EISA ID Ports - Slot B
LegacyPort < 0CC80h, 4 > ;EISA ID Ports - Slot C
LegacyPort < 0DC80h, 4 > ;EISA ID Ports - Slot D
LegacyPort < 0EC80h, 4 > ;EISA ID Ports - Slot E
LegacyPort < 0FC80h, 4 > ;EISA ID Ports - Slot F
endif
dih_sys_legacy_port_table_end:
;==============================================================================;
; ;
; System Board Device Initializer Hooks ;
; ;
;==============================================================================;
;---------------------------------------;
; dih_sys_func_0 (Reset,Detect,Disable) ;
;---------------------------------------;--------------------------------------;
; This function is called by the System Board Device Initializer (DI-SYS.ASM) ;
; during function 0 (Reset, Detect, and Disable). The following things should ;
; be done here if needed: ;
; ;
; - Reset and disable any on board devices such as serial ports, parallel ;
; ports, HDD / FDD controllers, etc. that are not disabled by the peripheral ;
; code. ;
; ;
; 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_0 proc near
clc
ret
dih_sys_func_0 endp
;---------------------------------------;
; dih_sys_func_1 (Static Device Init) ;
;---------------------------------------;--------------------------------------;
; This function is called by the System Board Device Initializer (DI-SYS.ASM) ;
; during function 1 (Static Device Init). The following steps should be done ;
; here: ;
; ;
; - Allocate a block of memory just below the very top of address space (4GB). ;
; The block should have a size large enough to protect the any BIOS image ;
; or other memory that is visible there from being allocated by the resource ;
; manager. This memory region will be "off limits" for any device to use. ;
; ;
; 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_1 proc near
mov di, offset OwnerWork ;Use this global as workspace
mov (owner_sys ptr [di]).own_sys_sig, OWNTYPE_SYS
mov (owner_sys ptr [di]).own_sys_nodenum, 0FFh
mov (owner_sys ptr [di]).own_sys_rsvd, 0
mov (owner_sys ptr [di]).own_sys_devid, 0FFFFFFFFh
mov dword ptr (owner_sys ptr [di]).own_sys_rsvd2, 0
; Reserve the memory spaces at F0000000/FFFFFFFF
mov ebx, 0f0000000h ;Min and Max base addresses are
mov ecx, ebx
mov edx, 0fffffffh
mov esi, 1 ;Alignment is byte
xor al, al ;All flags are 0
mov ah, RM_ALLOC_MEM
CALL_RESMGR ;Call Resource Manager to allocate
clc
ret
dih_sys_func_1 endp
;---------------------------------------;
; dih_sys_func_2 (Output Device Init) ;
;---------------------------------------;--------------------------------------;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -