?? nruntime.asm
字號:
test ds:byte ptr [bx+84*2],al; bit-x of word 84 = 0 ?
jz short sync_dma_00 ; drive does not support Sync DMA mode
mov ch,cl
or ch,40h ; bit-6 = 1..Sync DMA
sync_dma_00:
END OF COMMENT ~
; this code is according to ATA Ultra-DMA spec Oct 26, 1996
test ds:byte ptr [bx+53*2],04h; bit-2 of word 53 = 1 ?
jz short sync_dma_00 ; word 88 are NOT valid, Sync DMA not supported
; bit7-0 of word 88 is bit map definition..
; bit-0 = 1..Sync DMA mode 0 supported
; bit-1 = 1..Sync DMA mode 1 supported
; bit-2 = 1..Sync DMA mode 2 supported
mov al,ds:byte ptr [bx+88*2]; get bit7-0 of word 88
and ax,01fh ; keep bit0-4 for mode 0-4
jz sync_dma_00 ; not supported..
push bx
bsr bx,ax ; bx = index from ultra dma mode
mov ch,bl
or ch,40h ; bit-6 = 1..Ultra DMA
pop bx
sync_dma_00:
;----------------------------------------;
rol ecx,16
pop ax
mov cl,al ; restore CL
pop ax
pop si
ret
get_dma_mode_value endp
;---------------------------------------;
get_dma_mode_from_capibility:
; input : AL = bit mapped capibility
; output: CL = mode
; register destroyed..CX
mov cx,0200h ; CH = bit to test, CL = mode
test al,01h ; bit-0 set ?
jz gdmfc_01 ; no, assume mode 0
gdmfc_00:
test al,ch ; bit set ?
jz gdmfc_01 ; no
inc cl
shl ch,01h ; next bit
jnz gdmfc_00
gdmfc_01:
ret
;---------------------------------------;
get_dma_mode_from_cycle_time:
; input : AX = cycle time
; CS:SI = ptr to table of cycle time
; output: CL = mode
; register destroyed..CX
xor cx,cx
or ax,ax ; cycle time = 00 => mode 0
jz gdmfct_00
cmp ax,cs:word ptr [si]
ja gdmfct_00 ; mode 0
inc cx
cmp ax,cs:word ptr [si+2]
ja gdmfct_00 ; mode 1
inc cx ; mode 2
gdmfct_00:
ret
;-----------------------------------------------------------------------;
non_sync_dma_mode_time_table label byte
dw 150 ; > 150ns -> Non-Sync DMA Mode 0
dw 120 ; > 120ns -> Non-Sync DMA Mode 1
; <= 120ns -> Non-Sync DMA Mode 2
non_sync_dma_mode_time_table_end label byte
;-----------------------------------------------------------------------;
sync_dma_mode_time_table label byte
dw 75 ; > 75ns -> Sync DMA Mode 0
dw 55 ; > 55ns -> Sync DMA Mode 1
; <= 55ns -> Sync DMA Mode 2
sync_dma_mode_time_table_end label byte
;-----------------------------------------------------------------------;
; INT-15 Function E820 ;
;-----------------------------------------------------------------------;
; input : ;
; EBX continuation value ;
; ES:DI ptr to buffer to be filled in by BIOS ;
; ECX buffer size in bytes ;
; EDX signature 'SMAP' ;
; output: ;
; CY error ;
; NC ok ;
; EAX 'SMAP' ;
; ES:DI ptr to buffer ;
; ECX length of information in bytes as filled in ;
; by BIOS ;
; EBX continuation value ;
;-----------------------------------------------------------------------;
; BU SPECIFIC DATA AREA ;
;-----------------------------------------------------------------------;
; UPDATE_BLOCKS DW #of update blocks (each of 2KBytes length) available
; for storage in NVRAM to initialized during POST
public update_blocks
update_blocks dw 0000h ; needed in P6 BIOS Upgrade functions
public micro_code_start_addr
micro_code_start_addr dd ?
;-----------------------------------------------------------------------;
public e820_max_cont_value
public e820_info_table
e820_max_cont_value dd 0ffffffffh; max continuation value
e820_info_table db 12*size e820_info_struc dup (00)
;-----------------------------------------------------------------------;
public int_15_e820
int_15_e820: ; INT15, E820
cmp edx,'SMAP' ; 534d4150h..signature string 'SMAP'
jnz i15e820_err ; invalid call
cmp ebx,cgroup:e820_max_cont_value; valid continuation value ?
jbe i15e820_00 ; valid continuation value
; illegal continuation call..return error..
i15e820_err:
stc ; set carry to indicate an error
jmp short i15e820_exit
i15e820_00:
cmp ecx,00000014h ; min buffer size is 20 bytes
jb i15e820_err ; invalid buffer size
cld ; clear direction flag
push edx ; save EDX i.e. 'SMAP'
; initialize caller's buffer..
mov ecx,00000014h ; #of bytes to be initialized
push ecx
push edi
xor al,al
rep stosb
pop edi
pop ecx ; returned buffer size in bytes
mov al,size e820_info_struc ; size of memory info structure
mul bl ; AX = pointer to table
add ax,offset cgroup:e820_info_table
push si
mov si,ax
; lower 32-bit base address from above table to caller's buffer..
lods cs:dword ptr [si]
mov dword ptr es:[di],eax ; low 32 bits of base address
; lower 32-bit length from above table to caller's buffer..
lods cs:dword ptr [si]
mov dword ptr es:[di+8h],eax; low 32 bits of length in bytes
; memory type from above table to caller's buffer..
lods cs:byte ptr [si]
mov byte ptr es:[di+10h],al ; memory type
pop si
; restore continuation value from stack and calculate next continuation value
inc bx ; next continuation value
cmp bx,cgroup:word ptr e820_max_cont_value
jbe i15e820_01 ; more descriptor available
mov bx,0000h ; last descriptor returned this time
i15e820_01:
pop eax ; EAX = 'SMAP'
clc ; OK
i15e820_exit:
retf 0002
;-----------------------------------------------------------------------;
; following routine is needed for resolving externals which can be used;
; for power management. ;
;-----------------------------------------------------------------------;
; SET_INT_40_FLAG ; Moved to RUNTIME.ASM
; CLEAR_INT_40_FLAG ; Moved to RUNTIME.ASM
; SET_INT_13_FLAG ; Moved to RUNTIME.ASM
; CLEAR_INT_13_FLAG ; Moved to RUNTIME.ASM
;-----------------------------------------------------------------------;
public set_int_9_flag
public clear_int_9_flag
public set_int_14_flag
public clear_int_14_flag
public set_int_17_flag
public clear_int_17_flag
public set_int_74_flag
public clear_int_74_flag
set_int_9_flag:
clear_int_9_flag:
set_int_14_flag:
clear_int_14_flag:
set_int_17_flag:
clear_int_17_flag:
set_int_74_flag:
clear_int_74_flag:
ret
;---------------------------------------;
public int_77
int_77:
iret
;-----------------------------------------------------------------------;
; DISPLAY_IO_VERSION ;
;-----------------------------------------------------------------------;
; this routine displays the I/O module version number. ;
; input : ;
; ds = cs ;
; output: ;
; none ;
; register usage : can destroy any register execpt EBP, DS, ES ;
;-----------------------------------------------------------------------;
extrn _io_version:byte
extrn display_message:near
public display_io_version
display_io_version:
mov si,offset cgroup:_io_version
call display_message
ret
;-----------------------------------------------------------------------;
; CHECK_P6 ;
;-----------------------------------------------------------------------;
; this routine checks for presence of P6. ;
; input : ;
; none ;
; output: ;
; zr P6 present ;
; nz P6 absent ;
; register destroyed : None ;
;-----------------------------------------------------------------------;
extrn get_processor_info:near
public check_p6
check_p6:
or sp,sp ; ZF=0
ret
COMMENT ~
IF MKF_BUP6
pushad
call get_processor_info
; BH, BL = CPU#, vendor#
; AX = bit11-9 generation Code (011 = P6)
cmp bl,00h ; Intel ?
jnz cp6_00 ; no
and ah,0eh ; keep bit11-9 of AX
cmp ah,06h ; bit11-9 = 011 ?
cp6_00:
; ZR/NZ = P6 present/absent
popad
ret
ELSE
or sp,sp ; NZ, P6 absent
ret
ENDIF
~
;-----------------------------------------------------------------------;
; DETECT_FLASH_NVRAM ;
;-----------------------------------------------------------------------;
; this routine detects the Flash part presence. ;
; input : ;
; CS writeable ;
; output: ;
;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -