Changeset 615 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS
- Timestamp:
- Aug 7, 2021, 9:02:29 AM (3 years ago)
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/DeviceIDE.inc
r567 r615 31 31 TIMEOUT_MAXIMUM EQU 255 ; We would actually want 31 seconds here but I don't think there are so slow drives 32 32 33 34 ; ATA specs say that in standby mode time to respond could be as long as 30 seconds 35 ; Note that some low-power drives (like Toshiba 1,8" HDD) have power management enabled by default 36 ; TODO: It might be better to define timeouts in IDEVARS (in ROMVARS) or in DPT. Having even a single bit in DPT means 37 ; we could adjust timeouts on runtime when enabling or disabling power management. 33 38 %ifdef MODULE_POWER_MANAGEMENT 34 39 TIMEOUT_BSY EQU TIMEOUT_MOTOR_STARTUP -
trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc
r541 r615 97 97 COMMAND_IDENTIFY_DEVICE EQU 0ECh 98 98 COMMAND_SET_FEATURES EQU 0EFh 99 COMMAND_STAND_BY EQU 0E2h 99 100 COMMAND_IDLE EQU 0E3h 100 101 … … 103 104 FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE EQU 01h ; CFA feature set only 104 105 FEATURE_ENABLE_WRITE_CACHE EQU 02h 106 FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT EQU 05h 105 107 FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE EQU 81h ; CFA feature set only 106 108 FEATURE_DISABLE_WRITE_CACHE EQU 82h ; Can also be used to flush cache 109 FEATURE_DISABLE_ADVANCED_POWER_MANAGEMENT EQU 85h ; Might not be supported even if FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT is 107 110 FEATURE_SET_TRANSFER_MODE EQU 03h ; Transfer mode goes to the Sector Count Register 108 111 PIO_DEFAULT_MODE EQU 0h -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm
r589 r615 101 101 %endif ; MODULE_8BIT_IDE_ADVANCED 102 102 %endif ; MODULE_8BIT_IDE 103 104 105 ;-------------------------------------------------------------------- 106 ; Enable/disable advanced power management command can be used to scale 107 ; power consumption and performance. Drive supporting Enable APM might not 108 ; support Disable AMP so we set the drive to max performance if stand by 109 ; timer value is 0 (idle/standby disabled) 110 ; 111 ; 112 ; AH23h_EnableOrDisableAdvancedPowerManagement 113 ; Parameters: 114 ; DL: Stand By timer value (0=disable APM) 115 ; DS:DI: Ptr to DPT (in RAMVARS segment) 116 ; SS:BP: Ptr to IDEPACK 117 ; Returns: 118 ; AH: Int 13h return status 119 ; CF: 0 if successful, 1 if error 120 ; Corrupts registers: 121 ; AL, BX, CX, DX, SI 122 ;-------------------------------------------------------------------- 123 %ifdef MODULE_POWER_MANAGEMENT 124 AH23h_EnableOrDisableAdvancedPowerManagement: 125 mov si, FEATURE_ENABLE_ADVANCED_POWER_MANAGEMENT 126 test dl, dl 127 jnz SHORT .EnablePowerSave 128 dec dx 129 dec dx ; DL = FEh = Maximum performance 130 jmp AH23h_SetControllerFeatures 131 132 ; TODO: We should add power management level to IDEVARS to be adjustable with xtidecfg 133 .EnablePowerSave: 134 mov dl, 0BFh ; For Toshiba 1.8" HDD: 80h...BFh = Mode 1 135 jmp AH23h_SetControllerFeatures 136 %endif ; %ifdef MODULE_POWER_MANAGEMENT -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r589 r615 200 200 jz SHORT .NoPowerManagementSupport 201 201 202 ; Do we need to disable APM? 203 ;TODO: We should check APM feature set flag from ATA ID word 83. The above 204 ;FLGH_DPT_POWER_MANAGEMENT_SUPPORTED is from ATA ID word 82 205 mov dl, [cs:ROMVARS.bIdleTimeout] 206 push dx 207 push dx 208 call AH23h_EnableOrDisableAdvancedPowerManagement 209 210 ; COMMAND_IDLE is not enough for Toshiba 1,8" HDD since idle mode is the default mode 211 ; COMMAND_STAND_BY seemed to do the trick 212 pop dx 213 mov al, COMMAND_STAND_BY 214 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 215 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 216 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER 217 218 pop dx 202 219 mov al, COMMAND_IDLE 203 mov dl, [cs:ROMVARS.bIdleTimeout]204 220 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 205 221 call Idepack_StoreNonExtParametersAndIssueCommandFromAL
Note:
See TracChangeset
for help on using the changeset viewer.