📄 gapmnsmi.asm
字号:
current_apm_func_in_rom_10:
push ax ;
push bx ;
call get_rom_apm_connection_info ; (al) = current ROM_APM_CONNECTION_INFO
mov bx,valid_v10_event_mask ; consider APM v1.0 APM events only
test al,apm_bios_active_ver_above_v10; APM BIOS v1.0 ?
jz short current_apm_func_in_rom_11; yes
mov bx,valid_v11_event_mask ; consider APM v1.1 APM events only
test al,apm_bios_active_ver_v12 ; active APM v1.2 ?
jz short current_apm_func_in_rom_11; yes
mov bx,valid_v12_event_mask ; consider APM v1.2 APM events only
current_apm_func_in_rom_11:
call get_rom_pending_apm_event ; (ax) = current PENDING_APM_EVENT
and ax,bx ; consider valid APM events
pop bx ;
pop ax ;
jnz short current_apm_func_in_rom_01; some event(s) pending...execute in SMI code
ret ; (cy) = 00 for executing in ROM
current_apm_func_in_rom endp
;---------------------------------------------------------------;
; EXEC_APM_FUNC_IN_ROM ;
;---------------------------------------------------------------;
; Input : (BP) bit 8 1 called in real mode ;
; bit 9 1 called in 16 bit protected mode ;
; bit 10 1 called in 32 bit protected mode ;
; (AL) APM function no. ;
; Registers as defined by the APM document;
; for related function. ;
; Output: (CY) 01 for error & (AH) has error code ;
; (CY) 00 for no error ;
; Registers as defined by the APM document;
; for related func. ;
; Register destroyed : As defined by the related function ;
;---------------------------------------------------------------;
exec_apm_func_in_rom proc near
cmp al,apm_func_05 ; APM CPU IDLE call ?
jz short exec_apm_func_in_rom_10 ; yes...
cmp al,apm_func_06 ; APM CPU BUSY call ?
jz short exec_apm_func_in_rom_20 ; yes...
cmp al,apm_func_0a ; APM get power status call ?
jz short exec_apm_func_in_rom_30 ; yes...
cmp al,apm_func_0b ; APM get PM event call ?
jz short exec_apm_func_in_rom_40 ; yes...
clc ; (cy) = 00 for no error
ret
;---------------------------------------------------------------;
; FN# 05H ... CPU IDLE ;
;---------------------------------------------------------------;
; EXECUTED IN ROM ;
;---------------------------------------------------------------;
; Input : (BP) bit 8 1 called in real mode ;
; bit 9 1 called in 16 bit protected mode ;
; bit 10 1 called in 32 bit protected mode ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error & ;
; (AH) has error code ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
exec_apm_func_in_rom_10:
push edx ;
push eax ;
call rom_check_apm_connection ; is proper APM connection done ?
jc short exec_apm_func_in_rom_11 ; no...
call rom_set_pre_cpu_idle_environment; CHIPSET HOOK HOOK HOOK...setup before going for cpu slow/stop clock
call rom_apm_cpu_idle_call ; CHIPSET HOOK HOOK HOOK...set stop clock/slow clock
call rom_set_post_cpu_idle_environment; CHIPSET HOOK HOOK HOOK...setup after coming out of stop clock
clc ; set (CY) = 00 for no error
pop eax ;
pop edx ;
ret
exec_apm_func_in_rom_11:
exec_apm_func_in_rom_21:
exec_apm_func_in_rom_41:
mov dh,ah ; save (ah) in (dh)
pop eax ;
mov ah,dh ; restore (ah) from (dh)
pop edx ;
ret
;---------------------------------------------------------------;
; FN# 06H ... CPU BUSY ;
;---------------------------------------------------------------;
; EXECUTED IN ROM ;
;---------------------------------------------------------------;
; Input : (BP) bit 8 1 called in real mode ;
; bit 9 1 called in 16 bit protected mode ;
; bit 10 1 called in 32 bit protected mode ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error & ;
; (AH) has error code ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
exec_apm_func_in_rom_20:
push edx ;
push eax ;
call rom_check_apm_connection ; is proper APM connection done ?
jc short exec_apm_func_in_rom_21 ; no...
call rom_apm_cpu_busy_call ; CHIPSET HOOK HOOK HOOK...set to full processor clock speed
clc ; set (CY) = 00 for no error
pop eax ;
pop edx ;
ret
;---------------------------------------------------------------;
; FN# 0BH ... GET PM EVENT ;
;---------------------------------------------------------------;
; EXECUTED IN ROM ;
;---------------------------------------------------------------;
; Input : (BP) bit 8 1 called in real mode ;
; bit 9 1 called in 16 bit protected mode ;
; bit 10 1 called in 32 bit protected mode ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error & ;
; (AH) has error code ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
exec_apm_func_in_rom_40:
push edx ;
push eax ;
call rom_check_apm_connection ; is proper APM connection done ?
jc short exec_apm_func_in_rom_41 ; no...
mov ah,no_pm_event_pending ; no power management event pending
stc ; (cy) = 01 for error
jmp short exec_apm_func_in_rom_41 ;
;---------------------------------------------------------------;
; FN# 0AH ... GET POWER STATUS ;
;---------------------------------------------------------------;
; EXECUTED IN ROM ;
;---------------------------------------------------------------;
; Input : (BP) bit 8 1 called in real mode ;
; bit 9 1 called in 16 bit protected mode ;
; bit 10 1 called in 32 bit protected mode ;
; (BX) power device ID ;
; Output: (CY) 00 for no error & ;
; (BH) AC line status ;
; (BL) battery status ;
; (CH) battery flag (v1.1 only) ;
; (CL) remaining battery flag (percentage ;
; of charge) ;
; (DX) remaining battery life (time units);
; (v1.1 only) ;
; (CY) 01 for error & ;
; (AH) has error code ;
; Register destroyed : (AH) for error otherwise ;
; for v1.0 (BX),(CL) ;
; for v1.1 (BX),(CX),(DX) ;
;---------------------------------------------------------------;
exec_apm_func_in_rom_30:
cmp bx,all_power_managed_device_id ; valid device ID ?
jnz short exec_apm_func_in_rom_31 ; no...
push eax ;
push ecx ;
push edx ;
call rom_get_ac_battery_status ; CHIPSET HOOK HOOK HOOK...returns AC line status &
; battery status in (bx),(cx) & (dx)
call get_rom_apm_connection_info ; (al) = current ROM_APM_CONNECTION_INFO
test al,apm_bios_active_ver_above_v10; acive APM v1.0 ?
jnz short exec_apm_func_in_rom_32 ; no...v1.1
cmp bh,02h ; AC line status is 'On backup power' ?
jnz short exec_apm_func_in_rom_33 ; no...
mov bh,00h ; set AC line status as 'Off-line'
exec_apm_func_in_rom_33:
pop edx ; restore original (edx)
mov al,cl ; save (cl) in (al)
pop ecx ; restore original (ecx)
mov cl,al ; restore (cl) from (al)
jmp short exec_apm_func_in_rom_34 ;
exec_apm_func_in_rom_32:
mov ax,dx ; save (dx) in (ax)
pop edx ; restore original (edx)
mov dx,ax ; restore (dx) from (ax)
mov ax,cx ; save (cx) in (ax)
pop ecx ; restore original (ecx)
mov cx,ax ; restore (cx) from (ax)
exec_apm_func_in_rom_34:
pop eax ; balance stack
clc ; (cy) = 00 for no error
ret
;-----------------------------------------------;
exec_apm_func_in_rom_31:
mov ah,invalid_device_id ; unrecognized device ID
stc ; (cy) = 01 for error
ret
exec_apm_func_in_rom endp
;---------------------------------------------------------------;
; ROM_CHECK_APM_CONNECTION ;
;---------------------------------------------------------------;
; Input : (BP) bit 8 1 called in real mode ;
; bit 9 1 called in 16 bit protected mode ;
; bit 10 1 called in 32 bit protected mode ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error...APM not connected ;
; ...APM not engaged ;
; (AH) error code for error ;
; Register destroyed : (AX) ;
;---------------------------------------------------------------;
rom_check_apm_connection proc near
mov ax,bp ; (ah) bit 0/1/2 called in real/16/32 bit mode
call get_rom_apm_connection_info ; (al) = current ROM_APM_CONNECTION_INFO
test al,ah ; is proper APM connection done ?
jz short rom_check_apm_connection_00; no...
test al,apm_bios_active_ver_above_v10; APM v1.0 ?
jz short rom_check_apm_connection_01; yes...(CY) = 00
call get_rom_apm_state ; (al) = current ROM_APM_STATE
test al,pm_engaged_by_apm ; power management engaged by APM ?
jz short rom_check_apm_connection_06; no...(CY) = 00
rom_check_apm_connection_01:
ret
;-----------------------------------------------;
rom_check_apm_connection_06:
mov ah,interface_not_engaged ; APM interface not engaged
stc ; (CY) = 01 for error
ret
;-----------------------------------------------;
; DUMMY PROCEDURE TO SUBSTITUTE '::' ;
;-----------------------------------------------;
rom_check_apm_connection_00 proc near
mov ah,interface_not_connected ; APM driver interface not connected
stc ; (CY) = 01 for error
ret
rom_check_apm_connection_00 endp
rom_check_apm_connection endp
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
; ROM_ENQUIRE_INTR_PENDING_SYSTEM ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: (ZF) set means no interrupt pending. ;
; (ZF) clear means interrupt pending & ;
; (AL) has master pending interrupts info ;
; (AH) has slave pending interrupts info ;
; Register destroyed : (AX),(DX) ;
;---------------------------------------------------------------;
rom_enquire_intr_pending_system proc near
mov dx,control_8259_slave ;
call rom_read_8259_irr_reg ; (al) = interrupt pending status for slave
mov ah,al ; (ah) = interrupt pending status for slave
mov dx,control_8259_master ;
call rom_read_8259_irr_reg ; (al) = interrupt pending status for master
mov dx,ax ; (dl) = (al) = interrupt pending status for master
; (dh) = (ah) = interrupt pending status for slave
or dl,dh ; set/clear (ZF)
ret
rom_enquire_intr_pending_system endp
;---------------------------------------------------------------;
; ROM_READ_8259_IRR_REG ;
;---------------------------------------------------------------;
; Input : (DX) 8259 master/slave control reg i/o port ;
; Output: (AL) IRR read value ;
; Register destroyed : (AL) ;
;---------------------------------------------------------------;
rom_read_8259_irr_reg proc near
pushf ; save current interrupt status
cli ; disable interrupts
mov al,irr_reg_read_cmd ;
out dx, al ; send IRR read command to 8259
jcxz short $+2 ; i/o delay
jcxz short $+2 ; i/o delay
in al, dx ; (al) = read current IRR status
popf ; restore original interrupt status
ret
rom_read_8259_irr_reg endp
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
; INCLUDE FILES FOR CODE USAGE ;
;---------------------------------------------------------------;
include gapmnsmi.css ; runtime ROM APM code (chipset part)
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
.286p
_text ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -