📄 post.asm
字号:
; bit-2 = 1 -> standard ;
; bit-1 = 1 -> unknown ;
; bit-0 = 1 -> reserved (must be 0) ;
; BL installed memory size ;
; bit-7 = 1 -> double bank, 0 -> single bank ;
; bit-6..0 = n where memory module size = 2^n MB ;
; example: for 16MB memory module, bit-6..0 = 4 ;
; bit-6..0 = 7Dh -> size unknown ;
; = 7Eh -> reserved (do not use) ;
; = 7Fh -> not installed ;
; register usage : do not destroy any register except AX, BL, CX ;
;-----------------------------------------------------------------------;
public dmi_mem_module_info
public get_mem_module_info
get_mem_module_info:
dmi_mem_module_info:
push dx
;; set no RAS connect
mov bl,al ; save memory module #
dec al ; which bank in base 0
jnz not_bank_0
mov ax,0001h ; Bank 0 connection
jmp @f
not_bank_0:
test al,1
jz not_bank_1
mov ax,0023h ; Bank 1 connection
jmp @f
not_bank_1:
mov ax,00ffh ; Bank 2 connection
@@:
push ax
mov al,bl ; restore memory module #
mov cl,al
mov bl,al ; make a memory module copy in bl
dec bl
mov dl,bl
;; for some transfer
cmp cl,3
jnz not_dimm_3
inc cl
not_dimm_3:
;; detect dimm is install memory
mov ah,63h
call read_pci_byte
test al,cl
jz dimm_empty
mov cx,0500h ; SDRAM, DIMM
;; detect memory size in bank
mov al,bl
call get_bank_size
mov bl,-1
not_zero_yet:
inc bl
shr ax,1
cmp ax,0
jnz short not_zero_yet
;; detect single side memory or double side
add dl,60h
mov ah,dl
call read_pci_byte
and al,20h
shl al,2
or bl,al
jmp short check_memory_module_done
dimm_empty:
mov ax,000fh ; speed unknown, no RAS connect
mov bl,7fh ; memory not install
mov cx,0002h ; memory unknown
check_memory_module_done:
pop ax
pop dx
clc
ret
;-----------------------------------------------------------------------;
; GET_SMBIOS_STRUCTURES_INFO ;
;-----------------------------------------------------------------------;
public get_smbios_structures_info
get_smbios_structures_info:
ret
;-----------------------------------------------------------------------;
; GET_BIOS_DETAILS ;
; this routine returns the BIOS information details. ;
; input : ;
; none ;
; output: ;
; ESI offset:segment of BIOS Version string (not NULL terminated
; EDI offset:segment of BIOS Date string (not NULL terminated);
; CX BIOS Size in unit of 32k ;
; EDX:EAX BIOS Characteristics ;
; BL BIOS Characteristics Extension ;
;-----------------------------------------------------------------------;
extrn _bios_version:byte
extrn _bios_release_date:byte
extrn _bios_characteristics:byte
; extrn rom_size:byte ; (CORE0072-) Not for 627
public get_bios_details
get_bios_details:
COMMENT ~
push offset cgroup:_bios_version
push cs
pop esi ; ESI = offset:segment of BIOS version string
push offset cgroup:_bios_release_date
push cs
pop edi ; EDI = offset:segment of BIOS date string
; mov cx,cgroup:word ptr rom_size
mov cx,2 ; size in 64K Bytes
shl cx,1 ; CX = BIOS Size in unit of 32k
mov eax,cgroup:dword ptr _bios_characteristics
mov edx,cgroup:dword ptr _bios_characteristics+4
mov bl,00h
~
ret
;-----------------------------------------------------------------------;
; GET_CPU_CLOCK_DETAILS ;
; this routine returns the CPU Clock details. ;
; input : ;
; none ;
; output: ;
; AX CPU internal clock in MHz ;
; BX external clock in MHz ;
;-----------------------------------------------------------------------;
extrn cpu_freq:word
public get_cpu_clock_details
get_cpu_clock_details:
mov bx,66 ; external clock in MHz
call check_100mhz_cpu_bus
jnz short @f
mov bl,100
@@:
mov ax,cgroup:cpu_freq ; internal clock in MHz
ret
;-----------------------------------------------------------------------;
; GET_BIOS_LANGUAGE_INFO ;
; this routine returns the currently selected language details. ;
; input : ;
; none ;
; output: ;
; ES:DI ptr to ASCIIZ string of currently selected language ;
; register usage : do not destroy any register except ES, DI ;
;-----------------------------------------------------------------------;
public get_bios_language_info
%OUT Modify this routine for Multi-Language Support
language_string db 'English',0
get_bios_language_info:
push cs
pop es
mov di,offset cgroup:language_string
ret
; (CORE0210+)>
ifdef MKF_CNVRAM
if MKF_CNVRAM
extrn go_to_flat_mode_stack :near
extrn comeback_from_flat_mode_stack:near
extrn rth_nvram_base :dword
extrn rth_nvram_size :word
extrn scratch_segment :word
;-----------------------------------------------------------------------;
; CNVRAM_TO_CMOS ;
;-----------------------------------------------------------------------;
; Input: ;
; None ;
; Output: ;
; CMOS get updated by cnvram ;
; CY update failed ;
; NC successful ;
; Registers destroyed: ;
; All except for EBP,DS,ES,FS,GS ;
;-----------------------------------------------------------------------;
extrn read_whole_escd:near
cnvram_to_cmos:
push ds
mov di,cgroup:scratch_segment
call read_whole_escd ; edi = 32-bit buffer start address
mov ds,cgroup:scratch_segment
mov si,cgroup:rth_nvram_size
sub si,90h ; DS:SI = pointed to header
cmp dword ptr ds:[si],'SOMC'; signature match ?
jne ctc_error ; no.. error
add si,10h ; DS:SI = cnvram buffer start address
mov al,10h ; start from CMOS register #10h
ctc_loop:
mov ah,ds:[si] ; get cmos in buffer
call cmos_data_out_x
inc si ; next in buffer
inc al ; next register#
cmp al,80h
jb ctc_loop
; clear error status for cmos
and bp,not (cmos_bat_err_bit+cmos_csum_err_bit+cmos_opt_err_bit)
mov ax,008eh
call cmos_data_out_x
clc ; NC - ok
ctc_exit:
pop ds
ret
ctc_error:
stc ; CY - error
jmp short ctc_exit
endif; if MKF_CNVRAM
endif; ifdef MKF_CNVRAM
; <(CORE0210+)
;-----------------------------------------------------------------------;
; USB_BUS_MASTERING ;
;-----------------------------------------------------------------------;
; Input: ;
; None ;
; Output: ;
; EBX = Bus Mastering asddress ;
; Register destroyed: ;
; Can destroy any registers except for ES, DS, EBP, FS, GS ;
;-----------------------------------------------------------------------;
public usb_bus_mastering
usb_bus_mastering proc near
push es
mov dx,0dc00h
mov ax,0ffffh
next_segment:
push dx
pop es
xor di,di
mov cx,2000h
repz scasw
jcxz find_usb_segment
sub dh,04h
cmp dh,0c4h
jz usb_01
jmp short next_segment
find_usb_segment:
xchg dh,dl
shr dx,2
sub dl,030h
;; Make shadow segment readable
shr dl,1
mov dh,0ah
jc short usb_00
mov dh,0a0h
usb_00:
mov ah,70h
add ah,dl
call read_pci_byte
or al,dh
call write_pci_byte
xor ebx,ebx
mov bx,es
shl ebx,4
usb_01:
pop es
ret
usb_bus_mastering endp
;-----------------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------------;
public _POST_ENDS
_POST_ENDS label byte ; marks end of module
;---------------------------------------;
_text ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -