?? smbpost.inc
字號:
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1997, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------------;
; DIFFERENT STRUCTURE INIT ROUTINE DURING POST ;
;-----------------------------------------------------------------------;
; POST_BIOS_INIT ;
;-----------------------------------------------------------------------;
; this routine is called from SMBPOST INIT code to initialize/build ;
; the BIOS INFORMATION data structure. ;
; input : ;
; DS:SI ptr to start of SMBIOS data structure ;
; DS:DI ptr to end of SMBIOS data structure ;
; CS = ES ;
; stack available ;
; output: ;
; SMBIOS data structure initialized ;
; register usage : can destroy any register except DS, ES ;
;-----------------------------------------------------------------------;
post_bios_init:
ret
;-----------------------------------------------------------------------;
; POST_PROCESSOR_INIT ;
;-----------------------------------------------------------------------;
; this routine is called from SMBPOST INIT code to initialize/build ;
; the PROCESSOR data structure. ;
; input : ;
; DS:SI ptr to start of SMBIOS data structure ;
; DS:DI ptr to end of all structures ;
; CS = ES ;
; stack available ;
; output: ;
; SMBIOS data structure initialized ;
; register usage : can destroy any register except DS, ES ;
;-----------------------------------------------------------------------;
post_processor_init:
; find the start of 1st PROCESSOR_INFORMATION_TYPE structure
mov bp,0ffffh ; BP = 0 for BSP
; n for APn
ppi_01:
; DS:SI = ptr to next available structure
; DS:DI = ptr to end of all structures
mov al,PROCESSOR_INFORMATION_TYPE
call get_ptr_to_structure ; DS:SI = ptr to first occurence of the concerned structure
; DS:BX = ptr to immediate next structure
jnc short ppi_14 ; ok
jmp ppi_00 ; no structure found
ppi_14:
inc bp ; next processor#, 0 = BSP, n = APn
cld
push di
push bx
push si
push bp
mov bp,PROCESSOR_INFO_FUNC ; func#
call cgroup:dword ptr post_interface_routine; Get processor information (BIOS)
; ESI = offset:segment BSP structure
; EDI = offset:segment AP structure
; CL = #of processor installed
pop bp
push esi
pop es
pop bx ; ES:BX = ptr to BSP information array
pop si ; DS:SI = ptr to start of Processor structure
or bp,bp ; BSP ?
jz short ppi_02 ; yes
; this is an AP, find the ptr to this AP information array
; CL = #of processor installed
movzx cx,cl ; CX = #of processor installed (1-based)
cmp bp,cx ; valid processor# ?
jae short ppi_16 ; invalid processor#
push bp
push edi
pop es
pop bx ; ES:BX = ptr to next AP information array
ppi_04:
dec bp ; BP = AP# (0-based)
jz short ppi_03 ; NC, ES:BX = ptr to concerned AP information array
cmp bx,0ffffh ; end of AP information array ?
jnz short ppi_05 ; not yet
mov ax,es
cmp ax,0ffffh ; end of AP information array ?
stc ; indicate error
jz short ppi_03 ; yes
ppi_05:
les bx,es:dword ptr (APPLCPUHEADERSTRUC ptr [bx]).wNextPtr; ES:BX = ptr to next AP information array
jmp short ppi_04
ppi_03:
pop bp
jnc short ppi_13 ; ok
ppi_16:
pop bx ; DS:BX = ptr to start of next structure
pop di ; DS:DI = ptr to end of all atructures
; DS:SI = ptr to the processor structure which and other processor structures
; if present needs to be initialized with default values
ppi_15:
push di
push bx
%OUT May need to be updated properly
mov al,CPU_UNKNOWN
mov ds:byte ptr (PROC_STRUC ptr [si]).bProcType,al
mov ds:byte ptr (PROC_STRUC ptr [si]).bProcFamily,al
xor eax,eax
mov ds:byte ptr (PROC_STRUC ptr [si]).bProcStatus,00h
mov ds:dword ptr[si].PROC_STRUC.qProcID,eax
mov ds:dword ptr[si+4].PROC_STRUC.qProcID,eax
; clear manufacturer string, version string
movzx cx,ds:byte ptr [si].PROC_STRUC.bProcManufacturer; CX = string# for CPU manufacturer
jcxz short ppi_17 ; no string for CPU manufacturer
push si
call get_string_details ; DS:SI = ptr to concerned string in the structure
; CX = length of concerned string in the structure
push es
push ds
pop es
mov di,si ; ES:DI = ptr to manufacturer string
mov al,20h ; clear string with blank
rep stosb
pop es
pop si ; restore pointer to start of Struct
ppi_17:
; fill Processor Version
movzx cx,cs:byte ptr [si].PROC_STRUC.bProcVersion; CX = string# for Processor Version
jcxz short ppi_18 ; no string for CPU version
push si
call get_string_details ; DS:SI = ptr to concerned string in the structure
; CX = length of concerned string in the structure
push es
push ds
pop es
mov di,si ; ES:DI = ptr to manufacturer string
mov al,20h ; clear string with blank
rep stosb
pop es
pop si
ppi_18:
pop si ; DS:SI = ptr to next available structure
pop di ; DS:DI = ptr to end of all structures
mov al,PROCESSOR_INFORMATION_TYPE
call get_ptr_to_structure ; DS:SI = ptr to first occurence of the concerned structure
; DS:BX = ptr to immediate next structure
jnc short ppi_15 ; init next processor stucture
jmp ppi_00 ; exit
ppi_13:
; ES:BX = ptr to AP information structure
add bx,size APPLCPUHEADERSTRUC
ppi_02:
; ES:BX = ptr to CPU information structure
; DS:SI = ptr to start of Processor structure
; fill Processor manufacturer string
movzx cx,ds:byte ptr [si].PROC_STRUC.bProcManufacturer; CX = string# for CPU manufacturer
jcxz short ppi_06 ; no string for CPU manufacturer
push si
call get_string_details ; DS:SI = ptr to concerned string in the structure
; CX = length of concerned string in the structure
push es
push ds
mov di,si
mov si,es:word ptr[bx].CPUINFOSTRUC.dVndr$Ptr
mov ax,es:word ptr[bx+2].CPUINFOSTRUC.dVndr$Ptr; AX:SI = BIOS vendor str
push ds
pop es ; ES:DI = ptr to destn string
mov ds,ax ; DS:SI = ptr to source string
call copy_string
pop ds
pop es ; ES:BX = CPU Info struc ptr
pop si ; restore pointer to start of Struct
ppi_06:
; ES:BX = ptr to CPU information structure
; DS:SI = ptr to start of Processor structure
; fill Processor Version
movzx cx,ds:byte ptr [si].PROC_STRUC.bProcVersion; CX = string# for Processor Version
jcxz short ppi_07 ; no string for CPU version
push si
call get_string_details ; DS:SI = ptr to concerned string in the structure
; CX = length of concerned string in the structure
push es
push ds
mov di,si
mov si,es:word ptr[bx].CPUINFOSTRUC.d$Ptr
mov ax,es:word ptr[bx+2].CPUINFOSTRUC.d$Ptr
push ds
pop es
mov ds,ax
call copy_string
pop ds
pop es
pop si
ppi_07:
; ES:BX = ptr to CPU information structure
; DS:SI = ptr to start of Processor structure
; fill Processor ID
mov eax,es:dword ptr [bx].CPUINFOSTRUC.dResetID
mov ds:dword ptr[si].PROC_STRUC.qProcID,eax
mov eax,es:dword ptr [bx].CPUINFOSTRUC.dFeature
mov ds:dword ptr[si+4].PROC_STRUC.qProcID,eax
; ES:BX = ptr to CPU information structure
; DS:SI = ptr to start of Processor structure
; fill Processor Family
mov ax,CPU_UNKNOWN*256+CPU_UNKNOWN ; value for Unknown
mov cl,es:byte ptr (CPUINFOSTRUC ptr [bx]).bVndrNum; Vendor#
cmp cl,0ffh ; unknown vendor# ?
jz short ppi_08 ; unknown vendor
cmp es:byte ptr (CPUINFOSTRUC ptr [bx]).bNum,0ffh; unknown CPU# ?
jz short ppi_08 ; unknown vendor and unknown CPU
; vendor and CPU is known
movzx di,cl ; DI = Vendor#
shl di,1 ; DI = offset in the Generation Map Table
mov di,cs:[_Generation_Map+di]; DI = ptr to genaration table for the concerned Vendor
mov ax,es:word ptr (CPUINFOSTRUC ptr [bx]).wFuncField; Function Field
and ax,0e00h ; Seperate Generation code
shr ax,9 ; AX = Generation Code = offset in the Generation Map Table
add di,ax ; DI = offset in Generation map table
mov ah,cs:byte ptr [di] ; get processor family
mov al,CPU_CENTRAL_PROCESSOR; processor type
ppi_08:
mov ds:[si].PROC_STRUC.bProcFamily,ah
mov ds:[si].PROC_STRUC.bProcType,al
; Fill Clock information details
push bp
mov bp,CPU_CLOCK_DETAILS_FUNC ; func#
call cgroup:dword ptr post_interface_routine; AX = CPU clock, BX = External Clock
pop bp
mov ds:[si].PROC_STRUC.wCurrentSpeed,ax
mov ds:[si].PROC_STRUC.wExternalClock,bx
; Fill Processor Status
mov ds:byte ptr (PROC_STRUC ptr [si]).bProcStatus,41h
; Bit-6 = 1....socket populated
; Bit2-0= 001..CPU Enabled
pop si ; DS:SI = ptr to start of next structure
pop di ; DS:DI = ptr to end of all atructures
jmp ppi_01 ; continue for next Processor structure
ppi_00:
ret
;-----------------------------------------------------------------------;
; POST_MEMORY_CONTROLLER_INIT ;
;-----------------------------------------------------------------------;
; this routine is called from SMBPOST INIT code to initialize/build ;
; the MEMORY CONTROLLER data structure. ;
; input : ;
; DS:SI ptr to start of SMBIOS data structure ;
; DS:DI ptr to end of all structures ;
; CS = ES ;
; stack available ;
; output: ;
; DMI data structure initialized ;
; register usage : can destroy any register except DS, ES ;
;-----------------------------------------------------------------------;
post_memory_controller_init:
ret
;-----------------------------------------------------------------------;
; POST_MEMORY_MODULE_INIT ;
;-----------------------------------------------------------------------;
; this routine is called from SMBPOST INIT code to initialize/build ;
; the MEMORY MODULE data structure. ;
; input : ;
; DS:SI ptr to start of SMBIOS data structure ;
; DS:DI ptr to end of all structures ;
; CS = ES ;
; stack available ;
; output: ;
; SMBIOS data structure initialized ;
; register usage : can destroy any register except DS, ES ;
;-----------------------------------------------------------------------;
post_memory_module_init:
xor bp,bp ; BP = memory module# (1-based)
; find the start of MEMORY_MODULE_INFORMATION_TYPE structure
pmmi_02:
; DS:SI = ptr to next available structure
; DS:DI = ptr to end of all structures
inc bp ; next memory module#
mov al,MEMORY_MODULE_INFORMATION_TYPE
call get_ptr_to_structure ; DS:SI = ptr to first occurence of the concerned structure
; DS:BX = ptr to immediate next structure
jc short pmmi_00 ; no (more) structure found
push di
push bx
push bp
mov ax,bp ; AX = AL = memory module# (1 based)
mov bp,MEMORY_MODULE_INFO_FUNC ; BP = function#
call cgroup:dword ptr post_interface_routine
pop bp
jc short pmmi_01 ; error
; AL : Bank Connection
; AH : Current Speed
; CX : Current Memory Type
; BL : Installed Size
; mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bBankCon,al
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bCurrentSpd,ah
mov ds:word ptr (MEMMOD_INFO_STRUC ptr [si]).wCurrentMemType,cx
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bInstSize,bl
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bEnabledSize,bl
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bErrStatus,00h
pop si ; DS:SI = ptr to next structure
pop di ; DS:DI = ptr to end of all structures
jmp short pmmi_02 ; go to check next structure
pmmi_01:
pop bx ; DS:BX = ptr to next structure
pop di ; DS:DI = ptr to end of all structures
pmmi_03:
; CS:SI = ptr to current memory module structure which and other memory module
; stuctures (if present) need to be initialized with default values
push di
push bx
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bBankCon,MM_NO_BANK_CONNECTION
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bCurrentSpd,MM_SPEED_UNKNOWN
mov ds:word ptr (MEMMOD_INFO_STRUC ptr [si]).wCurrentMemType,MM_TYPE_UNKNOWN
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bInstSize,MM_NOT_INSTALLED
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bEnabledSize,MM_NOT_ENABLED
mov ds:byte ptr (MEMMOD_INFO_STRUC ptr [si]).bErrStatus,00h
pop si ; DS:SI = ptr to next structure
pop di ; DS:DI = ptr to end of all structures
mov al,MEMORY_MODULE_INFORMATION_TYPE
call get_ptr_to_structure ; DS:SI = ptr to first occurence of the concerned structure
; DS:BX = ptr to immediate next structure
jnc short pmmi_03 ; init next structure
pmmi_00:
ret
;-----------------------------------------------------------------------;
; POST_EXTERNAL_CACHE_INIT ;
;-----------------------------------------------------------------------;
; this routine is called from SMBPOST INIT code to initialize/build ;
; the external CACHE data structure. ;
; input : ;
; DS:SI ptr to start of SMBIOS data structure ;
; DS:DI ptr to end of all structures ;
; CS = ES ;
; stack available ;
; output: ;
; SMBIOS data structure initialized ;
; register usage : can destroy any register except DS, ES ;
;-----------------------------------------------------------------------;
post_external_cache_init:
peci_02:
; DS:SI = ptr to nest available structure
; DS:DI = ptr to end of all structures
mov al,CACHE_INFORMATION_TYPE
call get_ptr_to_structure ; DS:SI = ptr to the concerned structure
; DS:BX = ptr to immediate next structure
jc short peci_00 ; no more structure found
push di
push bx
mov al,ds:byte ptr (CACHE_INFO_STRUC ptr [si]).wCacheConfig; get config
shr al,05h ; bit6-5 -> bit1-0
and al,03h
cmp al,01h ; external cache ?
; jnz short peci_03 ; no, so no need to init this structure
jz short peci_05
mov eax,cr0
test eax,40000000h ; is cache enabled?
jz short peci_03 ; Yes, Skip
; Set Cache Disable
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -