📄 gapm10.inc
字号:
;-----------------------------------------------;
apm_connect_common_02:
mov ah,real_mode_connect_present ; real mode interface connection already established
jmp short apm_connect_common_exit ;
apm_connect_common_04:
mov ah,prot_mode_16bit_connect_present; 16 bit protected mode interface already established
jmp short apm_connect_common_exit ;
apm_connect_common_05:
mov ah,prot_mode_32bit_connect_present; 32 bit protected mode interface already established
apm_connect_common_exit:
jmp apm_error_exit ;
apm_connect_common endp
;---------------------------------------------------------------;
; CHECK_REAL_MODE_CALL ;
;---------------------------------------------------------------;
; Input : (DS) PM bios data segment ;
; (BX) device ID ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error...invalid function ;
; ...unrecognized device ID ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
check_real_mode_call proc near
test byte ptr [ebp+off_bp_apm],00000001b; called in real mode ?
jz short check_real_mode_call_00 ; no...invalid function
cmp bx,system_bios_device_id ; power device ID for APM BIOS ?
jnz short check_real_mode_call_01 ; no...error
ret
;-----------------------------------------------;
check_real_mode_call_00::
mov ah,unsupported_func ; function not supported
jmp apm_error_exit ;
check_real_mode_call_01:
int_15_ah53_al04_01::
jmp apm_err_code_09 ; unrecognized device ID
check_real_mode_call endp
;---------------------------------------------------------------;
; FN# 04H ... APM INTERFACE DISCONNECT ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al04 proc near
test al,(apm_real_mode_connect_est or apm_16bit_mode_connect_est or apm_32bit_mode_connect_est); is proper APM connection done ?
jz short int_15_ah53_al04_00 ; no...
cmp bx,system_bios_device_id ; power device ID for APM BIOS ?
jnz short int_15_ah53_al04_01 ; no...error
and al,not (apm_real_mode_connect_est or apm_16bit_mode_connect_est or apm_32bit_mode_connect_est); set APM is disconnected
mov ds:apm_connection_info,al ; set APM_CONNECTION_INFO
call set_rom_apm_connection_info ; set ROM_APM_CONNECTION_INFO
mov al,process_apm_disconnect ;
call css_entry_std ; call chipset specific module
clc ; (CY) = 00 for no error
ret
;-----------------------------------------------;
int_15_ah53_al04_00:
check_apm_connection_00::
mov ah,interface_not_connected ; APM driver interface not connected
jmp apm_error_exit ;
int_15_ah53_al04 endp
;---------------------------------------------------------------;
; CHECK_APM_CONNECTION ;
;---------------------------------------------------------------;
; Input : (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error...APM not connected ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
check_apm_connection proc near
test al,[ebp+off_bp_apm] ; is proper APM connection done ?
jz short check_apm_connection_00 ; no...(cy) = 00 for no error
ret
check_apm_connection endp
;---------------------------------------------------------------;
; FN# 05H ... CPU IDLE ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al05 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al05_00 ; no...
mov al,set_pre_cpu_idle_environment ; setup before going for cpu slow/stop clock
call css_entry_std ;
mov al,apm_cpu_idle_call ; set stop clock/slow clock
call css_entry_std ;
mov al,set_post_cpu_idle_environment; setup after coming out of stop clock
call css_entry_std ;
clc ; set (CY) = 00 for no error
int_15_ah53_al05_00:
ret
int_15_ah53_al05 endp
;---------------------------------------------------------------;
; FN# 06H ... APM CPU BUSY ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al06 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al06_00 ; no...
mov al,apm_cpu_busy_call ; set to full processor clock speed
call css_entry_std ;
clc ; set (CY) = 00 for no error
int_15_ah53_al06_00:
ret
int_15_ah53_al06 endp
;---------------------------------------------------------------;
; FN# 07H ... SET POWER STATE ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al07 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al07_00 ; no...
test al,apm_bios_power_management_disabled; APM BIOS power management disabled ?
jnz short int_15_ah53_al07_01 ; yes...
cmp bh,serial_port_device_id ; valid device ID ?
ja short int_15_ah53_al07_03 ; no...
mov dl,not apm_on_state ; clear APM state
cmp cx,apm_suspend ; set APM suspend state ?
jz short int_15_ah53_al07_02 ; yes...
mov dh,apm_standby_state ;
mov al,off_set_apm_standby_fn ; set APM standby state
cmp cx,apm_standby ; set APM standby state ?
jz short int_15_ah53_al07_08 ; yes...
mov dh,apm_enabled_state ;
mov al,off_set_apm_enabled_fn ; set APM enabled state
cmp cx,apm_enabled ; set APM enabled state ?
jz short int_15_ah53_al07_04 ; yes...
mov dh,apm_off_state ;
mov al,off_set_apm_off_fn ; set APM off state
cmp cx,apm_off ; set APM off state ?
jnz short int_15_ah53_al07_05 ; no...error
int_15_ah53_al07_04:
cmp bx,all_power_managed_device_id ; all devices power managed by APM BIOS ?
jz short int_15_ah53_al07_10 ; yes...unable to enter requested state
jmp short int_15_ah53_al07_08 ;
int_15_ah53_al07_02:
;-----------------------------------------------;
; AS FOR SYSTEM SUSPEND CALL, WHILE ;
; IT RETURNS TO CALLER, THE SYSTEM ;
; SHOULD RESUME FROM SUSPEND, SO ;
; THE SYSTEM STATE SHOULD BE PLACED ;
; IN 'apm_enabled' STATE ;
;-----------------------------------------------;
mov dh,apm_enabled_state ;
mov al,off_set_apm_suspend_fn ; set APM suspend state
cmp bh,system_device_id ; is request for system ?
jz short int_15_ah53_al07_08 ; yes...
mov dh,apm_suspend_state ;
int_15_ah53_al07_08:
jmp exec_apm_common ; execute the function
int_15_ah53_al07_00:
int_15_ah53_al08_00::
ret
;-----------------------------------------------;
int_15_ah53_al07_03:
jmp apm_err_code_09 ; unrecognized device ID
int_15_ah53_al07_01:
jmp apm_err_code_01 ; power management functionality disabled
int_15_ah53_al07_10:
mov ah,unable_to_enter_req_state ; unable to enter requested state
jmp short int_15_ah53_al07_50 ;
int_15_ah53_al07_05:
int_15_ah53_al08_05::
mov ah,parameter_out_of_range ; parameter value out of range
int_15_ah53_al07_50:
jmp apm_error_exit ;
int_15_ah53_al07 endp
;---------------------------------------------------------------;
; FN# 08H ... ENABLE/DISABLE POWER MANAGEMENT ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al08 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al08_00 ; no...
test al,apm_bios_power_management_disabled; APM BIOS power management disabled ?
jnz short int_15_ah53_al08_01 ; yes...
cmp bx,all_pm_device_id_v10 ; all power managed device ID for v1.0 ?
jnz short int_15_ah53_al08_03 ; no...invalid device ID
mov bx,all_power_managed_device_id ; convert it to v1.1 ID
mov dl,not pm_enabled_by_apm ; clear pm enabled by APM bit
mov dh,pm_enabled_by_apm ; set pm enabled by APM bit
mov al,off_enable_dev_pm_fn ; execute enable power management
cmp cx,enable_power_management ; enable power management ?
jz short int_15_ah53_al08_08 ; yes...
cmp cx,disable_power_management ; disable power management ?
jnz short int_15_ah53_al08_05 ; no...error
;-----------------------------------------------;
; FOLLOWING CODE IN BLOCK IS ADDED TO ;
; PASS INTEL APM TEST SUITE ;
;-----------------------------------------------;
test byte ptr ds:apm_state,pm_enabled_by_apm ; power management enabled by APM ?
jz short int_15_ah53_al08_01 ; no...
;-----------------------------------------------;
mov dh,00000000b ; disable power management
mov al,off_disable_dev_pm_fn ; execute disable power management
int_15_ah53_al08_08:
jmp short exec_apm_common ; execute the function
;-----------------------------------------------;
int_15_ah53_al08_03:
int_15_ah53_al09_03::
int_15_ah53_al0a_03::
jmp short apm_err_code_09 ; unrecognized device ID
int_15_ah53_al08_01:
jmp short apm_err_code_01 ; power management functionality disabled
int_15_ah53_al08 endp
;---------------------------------------------------------------;
; FN# 09H ... RESTORE POWER ON DEFAULTS ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al09 proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al09_00 ; no...
cmp bx,all_pm_device_id_v10 ; all power managed device ID for v1.0 ?
jnz short int_15_ah53_al09_03 ; no...invalid device ID
mov al,set_power_on_defaults ; set power on defaults for power management
call css_entry_std ; execute in chipset specific module
call set_dev_state ; set device states to power on default
mov al,ds:apm_state ;
call set_rom_apm_state ; update ROM_APM_STATE
clc ; set (cy) = 00 for no error
int_15_ah53_al09_00:
ret
int_15_ah53_al09 endp
;---------------------------------------------------------------;
; FN# 0AH ... GET POWER STATUS ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al0a proc near
cmp bx,all_power_managed_device_id ; valid device ID ?
jnz short int_15_ah53_al0a_03 ; no...
call get_ac_battery_status ; CHIPSET HOOK HOOK HOOK...returns AC line status & battery status in (bx),(cx) & (dx)
cmp bh,02h ; AC line status is 'On backup power' ?
jnz short int_15_ah53_al0a_00 ; no...
mov bh,00h ; set AC line status as 'Off-line'
int_15_ah53_al0a_00:
mov [ebp+off_bx_apm],bx ; return (bx)
mov [ebp+off_cl_apm],cl ; return (cl)
clc ; (CY) = 00 for no error
ret
int_15_ah53_al0a endp
;---------------------------------------------------------------;
; FN# 0BH ... GET PM EVENT ;
;---------------------------------------------------------------;
; Input : As specified in function ;
; (DS) PM bios data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Required returned registers are updated in stack;
; Register destroyed : ALL GENERAL PURPOSE except (EBP) ;
;---------------------------------------------------------------;
int_15_ah53_al0b proc near
call check_apm_connection ; is proper APM connection done ?
jc short int_15_ah53_al0b_00 ; no...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -