Changeset 410 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers
- Timestamp:
- Apr 26, 2012, 1:46:54 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r400 r410 20 20 ; Section containing code 21 21 SECTION .text 22 23 ;-------------------------------------------------------------------- 24 ; STORE_ERROR_FLAG_TO_DPT 25 ; Parameters: 26 ; %1: Error flag to set 27 ; AH: BIOS Error Code 28 ; DS:DI: Ptr to DPT 29 ; CF: Set if error code in AH 30 ; Returns: 31 ; CF: Clear if no error 32 ; Set if error flag was set 33 ; Corrupts registers: 34 ; Nothing 35 ;-------------------------------------------------------------------- 36 %macro STORE_ERROR_FLAG_TO_DPT 1 37 %ifdef MODULE_ADVANCED_ATA 38 mov al, %1 39 call SetErrorFlagFromALwithErrorCodeInAH 40 %endif 41 %endmacro 42 22 43 23 44 ;-------------------------------------------------------------------- … … 57 78 ;-------------------------------------------------------------------- 58 79 AH9h_InitializeDriveForUse: 59 xor ax, ax 80 xor ax, ax ; Clear AH to assume no errors 60 81 61 82 %ifdef MODULE_ADVANCED_ATA … … 69 90 jz SHORT .ContinueInitialization 70 91 ret ; With AH and CF cleared 71 92 .ContinueInitialization: 72 93 %endif 73 94 74 95 push es 75 96 push si 97 76 98 77 99 ;;; SelectDrive … … 80 102 mov [bp+IDEPACK.bDrvAndHead], al 81 103 call Device_SelectDrive 82 83 %ifdef MODULE_ADVANCED_ATA 84 mov al, FLG_INITERROR_FAILED_TO_SELECT_DRIVE 85 call .SetErrorFlagFromALwithErrorCodeInAH 86 %endif 87 jc .ReturnWithErrorCodeInAH 104 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SELECT_DRIVE 105 jnc SHORT .ContinueInitializationSinceDriveSelectedSuccesfully 106 jmp .ReturnWithErrorCodeInAH 107 .ContinueInitializationSinceDriveSelectedSuccesfully: 108 88 109 89 110 ;;; InitializeDeviceParameters … … 99 120 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 100 121 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 101 102 %ifdef MODULE_ADVANCED_ATA 103 mov al, FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 104 call .SetErrorFlagFromALwithErrorCodeInAH 105 %endif 122 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 106 123 .SkipInitializeDeviceParameters: 124 107 125 108 126 ;;; SetWriteCache … … 115 133 mov si, [cs:bx+.rgbWriteCacheCommands] 116 134 call AH23h_SetControllerFeatures 117 118 %ifdef MODULE_ADVANCED_ATA 119 mov al, FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE 120 call .SetErrorFlagFromALwithErrorCodeInAH 121 %endif 135 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE 122 136 .SkipSetWriteCache: 137 123 138 124 139 ;;; RecalibrateDrive 125 140 ; Recalibrate drive by seeking to cylinder 0 126 141 call AH11h_RecalibrateDrive 127 128 %ifdef MODULE_ADVANCED_ATA 129 mov al, FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE 130 call .SetErrorFlagFromALwithErrorCodeInAH 131 %endif 142 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE 143 132 144 133 145 ;;; InitializeBlockMode … … 147 159 shr bl, 1 148 160 jnc SHORT .TryNextBlockSize 149 150 %ifdef MODULE_ADVANCED_ATA 151 mov al, FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE 152 call .SetErrorFlagFromALwithErrorCodeInAH 153 %endif 161 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE 154 162 .BlockModeNotSupportedOrDisabled: 155 163 .SupportedBlockSizeFound: 164 156 165 157 166 %ifdef MODULE_ADVANCED_ATA … … 169 178 mov si, FEATURE_SET_TRANSFER_MODE 170 179 call AH23h_SetControllerFeatures 171 172 mov al, FLG_INITERROR_FAILED_TO_SET_PIO_MODE 173 call .SetErrorFlagFromALwithErrorCodeInAH 180 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_SET_PIO_MODE 174 181 %endif ; MODULE_ADVANCED_ATA 182 175 183 176 184 %ifdef MODULE_FEATURE_SETS … … 178 186 ; Initialize the standby timer (if supported) 179 187 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_POWER_MANAGEMENT_SUPPORTED 180 jz .NoPowerManagementSupport188 jz SHORT .NoPowerManagementSupport 181 189 182 190 mov al, COMMAND_IDLE … … 184 192 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 185 193 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 186 187 %ifdef MODULE_ADVANCED_ATA 188 mov al, FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER 189 call .SetErrorFlagFromALwithErrorCodeInAH 190 %endif 194 STORE_ERROR_FLAG_TO_DPT FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER 191 195 .NoPowerManagementSupport: 192 196 %endif ; MODULE_FEATURE_SETS 193 197 198 194 199 ; There might have been several errors so just return one error code for them all 200 .ReturnWithErrorCodeInAH: 195 201 %ifdef MODULE_ADVANCED_ATA 196 202 mov ah, [di+DPT_ADVANCED_ATA.bInitError] 197 203 test ah, ah ; Clears CF 198 jz SHORT .ReturnWith ErrorCodeInAH204 jz SHORT .ReturnWithSuccess 199 205 mov ah, RET_HD_RESETFAIL 200 206 stc 201 %endif 202 203 .ReturnWithErrorCodeInAH: 207 .ReturnWithSuccess: 208 %endif 209 204 210 pop si 205 211 pop es … … 207 213 208 214 209 %ifdef MODULE_ADVANCED_ATA 210 ;-------------------------------------------------------------------- 211 ; .SetErrorFlagFromALwithErrorCodeInAH 215 .rgbWriteCacheCommands: 216 db 0 ; DEFAULT_WRITE_CACHE 217 db FEATURE_DISABLE_WRITE_CACHE ; DISABLE_WRITE_CACHE 218 db FEATURE_ENABLE_WRITE_CACHE ; ENABLE_WRITE_CACHE 219 220 221 222 %ifdef MODULE_ADVANCED_ATA 223 ;-------------------------------------------------------------------- 224 ; SetErrorFlagFromALwithErrorCodeInAH 212 225 ; Parameters: 213 226 ; AH: BIOS Error Code 214 227 ; AL: Error flag to set 215 228 ; DS:DI: Ptr to DPT 229 ; CF: Set if error code in AH 230 ; Clear if AH = 0 216 231 ; Returns: 217 232 ; CF: Clear if no error … … 220 235 ; Nothing 221 236 ;-------------------------------------------------------------------- 222 .IgnoreInvalidCommandError:237 IgnoreInvalidCommandError: 223 238 xor ah, ah ; Clears CF 224 225 .SetErrorFlagFromALwithErrorCodeInAH: 239 SetErrorFlagFromALwithErrorCodeInAH: 226 240 jnc SHORT .NoErrorFlagToSet 227 241 cmp ah, RET_HD_INVALID 228 jbe SHORT .IgnoreInvalidCommandError242 jbe SHORT IgnoreInvalidCommandError 229 243 230 244 or [di+DPT_ADVANCED_ATA.bInitError], al … … 234 248 235 249 %endif 236 237 238 .rgbWriteCacheCommands:239 db 0 ; DEFAULT_WRITE_CACHE240 db FEATURE_DISABLE_WRITE_CACHE ; DISABLE_WRITE_CACHE241 db FEATURE_ENABLE_WRITE_CACHE ; ENABLE_WRITE_CACHE
Note:
See TracChangeset
for help on using the changeset viewer.