Changeset 365 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Timestamp:
- Mar 27, 2012, 5:01:57 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm
r294 r365 40 40 ; CF: 0 if successful, 1 if error 41 41 ; Corrupts registers: 42 ; AL, BX,CX, DX42 ; AL, CX, DX 43 43 ;-------------------------------------------------------------------- 44 44 AH24h_SetBlockSize: 45 push bx 46 45 47 push ax 46 xchg dx, ax ; DL = Block size (Sector Count Register) 47 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED ; Assume success 48 xchg dx, ax ; DL = Block size (Sector Count Register) 48 49 mov al, COMMAND_SET_MULTIPLE_MODE 49 50 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 50 51 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 51 52 pop bx 52 jnc .StoreBlockSize 53 mov bl, 1 ; Disable block mode 54 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_BLOCK_MODE_SUPPORTED 55 .StoreBlockSize: ; Store new block size to DPT and return 56 mov [di+DPT_ATA.bSetBlock], bl 53 jnc SHORT .StoreBlockSize 54 mov bl, 1 ; Block size 1 will always work 55 .StoreBlockSize: ; Store new block size to DPT and return 56 mov [di+DPT_ATA.bBlockSize], bl 57 58 pop bx 57 59 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r364 r365 43 43 push es 44 44 push si 45 call ClearErrorFlagFromBootMenuInfo ; Do this for serial devices as well46 45 47 46 %ifdef MODULE_SERIAL … … 52 51 53 52 %else 54 ; Clear Initialization Error flag from DPT55 and BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INITERROR53 ; Clear Initialization Error flags from DPT 54 mov BYTE [di+DPT_ATA.bInitError], 0 56 55 %endif 57 56 … … 60 59 mov [bp+IDEPACK.bDrvAndHead], al 61 60 call Device_SelectDrive 62 mov al, FLG_INIT _FAILED_TO_SELECT_DRIVE63 call SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo61 mov al, FLG_INITERROR_FAILED_TO_SELECT_DRIVE 62 call SetErrorFlagFromALwithErrorCodeInAH 64 63 jc SHORT .ReturnWithErrorCodeInAH 65 64 66 65 ; Initialize CHS parameters if LBA is not used 67 66 call InitializeDeviceParameters 68 mov al, FLG_INIT _FAILED_TO_INITIALIZE_CHS_PARAMETERS69 call SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo67 mov al, FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 68 call SetErrorFlagFromALwithErrorCodeInAH 70 69 71 70 ; Enable or Disable Write Cache 72 71 call SetWriteCache 73 mov al, FLG_INIT _FAILED_TO_SET_WRITE_CACHE74 call SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo72 mov al, FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE 73 call SetErrorFlagFromALwithErrorCodeInAH 75 74 76 75 ; Recalibrate drive by seeking to cylinder 0 77 76 .RecalibrateDrive: 78 77 call AH11h_RecalibrateDrive 79 mov al, FLG_INIT _FAILED_TO_RECALIBRATE_DRIVE80 call SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo78 mov al, FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE 79 call SetErrorFlagFromALwithErrorCodeInAH 81 80 82 81 ; Initialize block mode transfers 83 82 .InitializeBlockMode: 84 83 call InitializeBlockMode 85 mov al, FLG_INIT _FAILED_TO_SET_BLOCK_MODE86 call SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo84 mov al, FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE 85 call SetErrorFlagFromALwithErrorCodeInAH 87 86 88 87 %ifdef MODULE_ADVANCED_ATA … … 90 89 .InitializePioMode: 91 90 call InitializePioMode 92 mov al, FLG_INIT _FAILED_TO_SET_PIO_MODE93 call SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo91 mov al, FLG_INITERROR_FAILED_TO_SET_PIO_MODE 92 call SetErrorFlagFromALwithErrorCodeInAH 94 93 %endif 95 94 96 95 ; There might have been several errors so just return 97 96 ; one error code for them all 98 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INITERROR99 j zSHORT .ReturnWithErrorCodeInAH97 cmp BYTE [di+DPT_ATA.bInitError], 0 98 je SHORT .ReturnWithErrorCodeInAH 100 99 mov ah, RET_HD_RESETFAIL 101 100 stc … … 198 197 InitializeBlockMode: 199 198 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED ; Clear CF 200 jz SHORT ReturnSuccessSinceInitializationNotNeeded 201 199 jz SHORT .BlockModeNotSupportedOrDisabled 202 200 call AccessDPT_GetPointerToDRVPARAMStoCSBX 203 mov al, 1 ; Disable block mode204 201 test BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_BLOCKMODE 205 eCMOVNZ al, [di+DPT_ATA.bMaxBlock] ; Load max block size 206 jmp AH24h_SetBlockSize 207 208 209 ;-------------------------------------------------------------------- 210 ; ClearErrorFlagFromBootMenuInfo 211 ; Parameters: 212 ; DS:DI: Ptr to DPT 213 ; Returns: 214 ; Nothing 215 ; Corrupts registers: 216 ; BX, ES 217 ;-------------------------------------------------------------------- 218 ClearErrorFlagFromBootMenuInfo: 219 call BootMenuInfo_IsAvailable ; Load BOOTMENUINFO segment to ES 220 jne SHORT .DoNotStoreErrorFlags 221 call BootMenuInfo_ConvertDPTtoBX 222 mov WORD [es:bx+BOOTMENUINFO.wInitErrorFlags], 0 ; Must clear whole WORD! 223 .DoNotStoreErrorFlags: 224 ret 225 226 227 ;-------------------------------------------------------------------- 228 ; SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo 202 jz SHORT .BlockModeNotSupportedOrDisabled 203 204 ; Try block sizes until we find largest possible supported by drive 205 mov bl, 128 206 .TryNextBlockSize: 207 mov al, bl 208 call AH24h_SetBlockSize 209 jnc SHORT .SupportedBlockSizeFound 210 shr bl, 1 ; Try next size 211 jmp SHORT .TryNextBlockSize 212 .SupportedBlockSizeFound: 213 mov [di+DPT_ATA.bBlockSize], bl 214 .BlockModeNotSupportedOrDisabled: 215 ReturnSuccessSinceInitializationNotNeeded: 216 ret 217 218 219 ;-------------------------------------------------------------------- 220 ; SetErrorFlagFromALwithErrorCodeInAH 229 221 ; Parameters: 230 222 ; AH: BIOS Error Code … … 237 229 ; BX, ES 238 230 ;-------------------------------------------------------------------- 239 SetErrorFlagFromALwithErrorCodeInAH toBootMenuInfo:240 jnc SHORT NoErrorFlagToSet231 SetErrorFlagFromALwithErrorCodeInAH: 232 jnc SHORT .NoErrorFlagToSet 241 233 cmp ah, RET_HD_INVALID 242 234 jbe SHORT .IgnoreInvalidCommandError 243 235 244 call BootMenuInfo_IsAvailable 245 jne SHORT .BootvarsNotAvailableSoDoNotSetErrorFlag 246 247 call BootMenuInfo_ConvertDPTtoBX 248 or [es:bx+BOOTMENUINFO.wInitErrorFlags], al 249 .BootvarsNotAvailableSoDoNotSetErrorFlag: 250 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INITERROR 236 or [di+DPT_ATA.bInitError], al 251 237 stc 252 238 ret 253 239 .IgnoreInvalidCommandError: 254 ReturnSuccessSinceInitializationNotNeeded:255 240 xor ah, ah 256 NoErrorFlagToSet:257 ret 241 .NoErrorFlagToSet: 242 ret
Note:
See TracChangeset
for help on using the changeset viewer.