📄 gapm11.inc
字号:
; Input : (BH) device # ;
; (BL) unit # ;
; (DS) PM BIOS data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error & error code in (AH) updated ;
; in stack. ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
check_apm_dev proc near
test al,[ebp+off_bp_apm] ; is proper APM connection done ?
jz short check_apm_dev_00 ; no...
;---------------------------------------------------------------;
; CHECK_APM_DEV_FN0C ;
;---------------------------------------------------------------;
; Input : (BH) device # ;
; (BL) unit # ;
; (DS) PM BIOS data segment ;
; (AL) APM_CONNECTION_INFO ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error & (ah) has error code ;
; Register destroyed : (AH) for error ;
;---------------------------------------------------------------;
check_apm_dev_fn0c proc near
test al,apm_bios_power_management_disabled; APM BIOS power management disabled ?
jnz short check_apm_dev_01 ; yes...
test al,apm_bios_active_ver_above_v10; active APM v1.0 ?
jnz short check_apm_dev_10 ; no...v1.1
cmp bh,serial_port_device_id ; valid device ID ?
check_apm_dev_11:
ja short check_apm_dev_03 ; no...
check_apm_dev_02:
clc ; set (CY) = 00 for no error
ret
check_apm_dev_10:
cmp bh,pcmcia_socket_device_id ; valid device ID ?
jmp short check_apm_dev_11 ;
;-----------------------------------------------;
check_apm_dev_00::
jmp apm_err_code_03 ; interface not connected
check_apm_dev_fn0c endp
check_apm_dev endp
;---------------------------------------------------------------;
; UPDATE_APM_GLOBAL ;
;---------------------------------------------------------------;
; Input : (DI) pointer to info for the dev ;
; (DL) to be ANDed to dev state ;
; (DH) to be ORed to dev state ;
; (BH) device # ;
; (BL) unit #, 0ffh means all units ;
; (CL) # of units for each device ;
; (CH) APM fn# ;
; Output: NONE ;
; Register destroyed : NONE except (AL),(BX),(DI) ;
;---------------------------------------------------------------;
update_apm_global proc near
cmp bh,system_device_id ; system ?
jnz short update_apm_global_00 ; no...
mov al,no_of_total_dev_v11 ; total # of device supported
update_apm_global_01:
call cntrl_dev_class ; handle current device
add di,no_of_units_for_each_dev ; points to next device
dec al ;
jnz short update_apm_global_01 ;
ret
update_apm_global_00:
cmp bl,0ffh ; all units of the class ?
jz short update_apm_global_02 ; yes...
xor bh,bh ; (bx) = unit #
and [di+bx],dl ; clear the required bits
or [di+bx],dh ; update required bits
ret
update_apm_global_02:
call cntrl_dev_class ; handle all units for the device
ret
update_apm_global endp
;---------------------------------------------------------------;
; CNTRL_DEV_CLASS ;
;---------------------------------------------------------------;
; Input : (DI) pointer to info for the dev ;
; (DL) to be ANDed to dev state ;
; (DH) to be ORed to dev state ;
; (CL) # of units for each device ;
; (CH) APM fn# ;
; Output: NONE ;
; Register destroyed : NONE except (BX) ;
;---------------------------------------------------------------;
cntrl_dev_class proc near
push cx ;
xor bx,bx ; start with unit# 00
cntrl_dev_class_06:
test byte ptr [di+bx],apm_dev ; APM device ?
jz short cntrl_dev_class_04 ; no...
cmp ch,apm_func_08 ; enable/disable power mgt func ?
jz short cntrl_dev_class_11 ; yes...
cmp ch,apm_func_0d ; enable/disable dev power mgt func ?
jz short cntrl_dev_class_11 ; yes...
;-----------------------------------------------;
; FOR CHICAGO 'pm_enabled_by_apm' CHECK ;
; HAS BEEN REMOVED FOR FN# 0Fh ;
;-----------------------------------------------;
; ;
; cmp ch,apm_func_0f ; engage/disengage power mgt ?
; jz short cntrl_dev_class_05 ; yes...
; test byte ptr [di+bx],pm_enabled_by_apm; power mgt enabled by APM for this dev ?
; jz short cntrl_dev_class_04 ; no...
; ;
;-----------------------------------------------;
; 'pm_enabled_by_apm' CHECK IS BROUGHT ;
; BACK ON 122895 TO SUPPORT HCT TEST ;
; FOR APM v1.2 & APPARENTLY IT SEEMS ;
; WINDOWS 95 HAS CORRECTED THE BUG ;
;-----------------------------------------------;
test byte ptr [di+bx],pm_enabled_by_apm; power mgt enabled by APM for this dev ?
jz short cntrl_dev_class_04 ; no...
cmp ch,apm_func_0f ; engage/disengage power mgt ?
jz short cntrl_dev_class_05 ; yes...
;-----------------------------------------------;
cntrl_dev_class_11:
test byte ptr ds:apm_connection_info,apm_bios_active_ver_above_v10; APM v1.0 ?
jz short cntrl_dev_class_05 ; yes...
test byte ptr [di+bx],pm_engaged_by_apm; power mgt engaged ?
jz short cntrl_dev_class_04 ;
cntrl_dev_class_05:
and [di+bx],dl ; clear the required bits
or [di+bx],dh ; engage/disengage power management for the unit
cntrl_dev_class_04:
inc bx ; next unit#
dec cl ; decrement # of units
jnz short cntrl_dev_class_06 ;
pop cx ;
ret
cntrl_dev_class endp
;---------------------------------------------------------------;
; ADD_DEL_V11_APM_DEV ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
; Register destroyed : (AX),(CX),(DI) ;
;---------------------------------------------------------------;
add_del_v11_apm_dev proc near
mov di,apm_state ;
add di,apm_net_adapter_state ; (di) = pointer to network adapter state
mov cx,(no_of_total_dev_v11 - no_of_total_dev_v10) * no_of_units_for_each_dev
test byte ptr ds:apm_connection_info,apm_bios_active_ver_above_v10; APM v1.0 ?
jz short del_v11_apm_dev ; yes...
;-----------------------------------------------;
test byte ptr [di],apm_dev ; is network adapter & pcmcia socket already apm device ?
jnz short add_v11_apm_dev_00 ; yes...exit
mov al,notify_add_v11_apm_dev ; notify chipset specific module for new APM device
call css_entry_std ;
add_v11_apm_dev_01:
or byte ptr [di],apm_dev or pm_enabled_by_apm or pm_engaged_by_apm
inc di ; points to next device/unit
loop add_v11_apm_dev_01 ;
add_v11_apm_dev_00:
ret
;-----------------------------------------------;
del_v11_apm_dev:
test byte ptr [di],apm_dev ; is network adapter & pcmcia socket already apm device ?
jz short del_v11_apm_dev_00 ; no...exit
mov al,notify_del_v11_apm_dev ; notify chipset specific module for deleting v1.1 APM device
call css_entry_std ;
del_v11_apm_dev_01:
and byte ptr [di],not (apm_dev or pm_enabled_by_apm or pm_engaged_by_apm)
inc di ; points to next device/unit
loop del_v11_apm_dev_01 ;
del_v11_apm_dev_00:
ret
add_del_v11_apm_dev endp
;---------------------------------------------------------------;
; CSS_ENTRY_STD ;
;---------------------------------------------------------------;
; Input : (AL) func# to execute ;
; (DS) PM bios data segment ;
; (DI) pointer to dev state for some functions ;
; (DH) device# for some functions ;
; (DL) unit# for some functions,0ffh for all units;
; (CL) # of units for each device for some funcs ;
; (BX) PM event code posted for some function ;
; Output: (CY) 00 for no error ;
; (CY) 01 for error ;
; Register destroyed : NONE except (EAX) ;
;---------------------------------------------------------------;
css_entry_std proc near
pushad ;
mov ch,[ebp+off_bp_apm] ; (ch) = info about func called in real/16/32 mode
call apm_css_entry ; CHIPSET HOOK HOOK HOOK...execute in APM chipset specific module
call get_ebp_for_stack_usage ; (ebp) = current stack pointer
mov [ebp+28],eax ; put returned (eax) on stack
popad ;
ret
css_entry_std endp
;---------------------------------------------------------------;
; GET_APM_BIOS_PM_STATUS ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; STACK PRESENT ;
; Output: (CY) 00 for APM BIOS power management enabled ;
; (CY) 01 for APM BIOS power management disabled ;
; Register destroyed : NONE ;
;---------------------------------------------------------------;
get_apm_bios_pm_status proc near
;-----------------------------------------------;
; FOLLOWING PIECE OF CODE HAS BEEN REMOVED ;
; AND REPLACED BY 'CLC' & 'RET' AS WE ARE ;
; EXECUTING APM ONLY IF SMI/IRQ BASED POWER ;
; MANAGEMENT IS ACTIVE, WHICH MEANS IT WILL ;
; ALWAYS RETURN POWER MANAGEMENT ENABLED. ;
;-----------------------------------------------;
;; push ds ;
;; push ax ;
;; push bios_data_seg ;
;; pop ds ; (ds) = bios standard data segment (40H)
;; mov al,sys_info ;
;; and al,00110000b ; consider bits 5 & 4 only
;; jz short get_apm_bios_pm_status_01 ; power management disabled
;; cmp al,00100000b ; hardware auto power management ?
;;get_apm_bios_pm_status_01:
;; pop ax ;
;; pop ds ;
;; stc ; (CY) = 01 for APM BIOS power management disabled
;; jz short get_apm_bios_pm_status_00 ;
;; clc ; (CY) = 00 for APM BIOS power management enabled
;;get_apm_bios_pm_status_00:
;; ret
;-----------------------------------------------;
clc ; (CY) = 00 for APM BIOS power management enabled
ret
get_apm_bios_pm_status endp
;---------------------------------------------------------------;
; APM_POST ;
;---------------------------------------------------------------;
; Input : (DS) PM BIOS data segment ;
; Output: NONE ;
; Register destroyed : (AL),(DI) ;
;---------------------------------------------------------------;
apm_post proc near
mov word ptr ds:apm_bios_ver_no,0101h; set to v1.1
mov byte ptr ds:apm_connection_info,00000000b; no APM connection
; APM BIOS active version set to v1.0
mov word ptr ds:pending_apm_event,0000h
;---------------------------------------------------------------;
; SET_DEV_STATE ;
;---------------------------------------------------------------;
; Input : NONE ;
; Output: NONE ;
; Register destroyed : (AL),(DI) ;
;---------------------------------------------------------------;
set_dev_state proc near
push cx ;
mov cx,no_of_total_dev_v10 * no_of_units_for_each_dev; (cx) = total # of device info bytes
mov di,apm_state ; (di) = APM device state pointer
mov al,apm_dev or pm_engaged_by_apm or pm_enabled_by_apm
set_dev_state_00:
mov [di],al ; set the device/unit state
inc di ; points to next device/unit
loop set_dev_state_00 ;
mov cx,(no_of_total_dev_v11 - no_of_total_dev_v10) * no_of_units_for_each_dev
test byte ptr ds:apm_connection_info,apm_bios_active_ver_above_v10; APM v1.0 ?
jnz short set_dev_state_01 ; no...
xor al,al ; clear device state
set_dev_state_01:
mov [di],al ; set the device/unit state
inc di ; points to next device/unit
loop set_dev_state_01 ;
pop cx ;
ret
set_dev_state endp
apm_post endp
;---------------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1996, American Megatrends Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F, Northbelt Parkway, Norcross, **;
;** **;
;** Georgia - 30071, USA. Phone-(770)-246-8600. **;
;** **;
;*****************************************************************;
;*****************************************************************;
;---------------------------------------------------------------;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -