Changeset 365 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS
- Timestamp:
- Mar 27, 2012, 5:01:57 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/BootMenu.inc
r364 r365 32 32 %else 33 33 resb 2 ; padding to make BOOTMENUINFO size an even multiple of DPT size 34 %endif 35 36 34 %endif 37 35 endstruc 38 36 39 ; Flags for BOOTMENUINFO.wInitErrorFlags40 FLG_INIT_FAILED_TO_SELECT_DRIVE EQU (1<<0)41 FLG_INIT_FAILED_TO_INITIALIZE_CHS_PARAMETERS EQU (1<<1)42 FLG_INIT_FAILED_TO_SET_WRITE_CACHE EQU (1<<2)43 FLG_INIT_FAILED_TO_RECALIBRATE_DRIVE EQU (1<<3)44 FLG_INIT_FAILED_TO_SET_BLOCK_MODE EQU (1<<4)45 FLG_INIT_FAILED_TO_SET_PIO_MODE EQU (1<<5)46 37 47 38 DPT_BOOTMENUINFO_SIZE_MULTIPLIER equ BOOTMENUINFO_size / LARGEST_DPT_SIZE -
trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
r364 r365 40 40 41 41 ; IDE device only 42 FLGH_DPT_INITERROR EQU (1<<7)43 42 %ifdef MODULE_ADVANCED_ATA 44 FLGH_DPT_IORDY EQU (1<< 6) ; Controller and Drive supports IORDY43 FLGH_DPT_IORDY EQU (1<<7) ; Controller and Drive supports IORDY 45 44 %endif 46 45 … … 61 60 struc DPT_ATA ; 10 + 2 bytes = 12 bytes 62 61 .dpt resb DPT_size 62 .bBlockSize resb 1 ; Current block size in sectors (do not set to zero!) 63 .bInitError resb 1 64 endstruc 63 65 64 ; Block size is specified in sectors (1, 2, 4, 8, 16, 32, 64 or 128) 65 .wSetAndMaxBlock: 66 .bSetBlock resb 1 ; Current block size (do not set to zero!) 67 .bMaxBlock resb 1 ; Maximum block size, 0 = block mode not supported 68 endstruc 66 ; Flags for BOOTMENUINFO.wInitErrorFlags 67 FLG_INITERROR_FAILED_TO_SELECT_DRIVE EQU (1<<0) 68 FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS EQU (1<<1) 69 FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE EQU (1<<2) 70 FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE EQU (1<<3) 71 FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE EQU (1<<4) 72 FLG_INITERROR_FAILED_TO_SET_PIO_MODE EQU (1<<5) 69 73 70 74 -
trunk/XTIDE_Universal_BIOS/Inc/IdeRegisters.inc
r363 r365 64 64 65 65 ; Commands for IDE Controller 66 COMMAND_RECALIBRATE EQU 10h 66 67 COMMAND_READ_SECTORS EQU 20h 67 68 COMMAND_READ_SECTORS_EXT EQU 24h ; LBA48 -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuInfo.asm
r364 r365 65 65 66 66 ;-------------------------------------------------------------------- 67 ; BootMenuInfo_IsAvailable68 ; Parameters:69 ; Nothing70 ; Returns:71 ; ES: Segment to BOOTVARS with BOOTMENUINFOs72 ; ZF: Set if BOOTVARS with BOOTMENUINFOs is available73 ; Cleared if not available (no longer initializing)74 ; Corrupts registers:75 ; BX76 ;--------------------------------------------------------------------77 BootMenuInfo_IsAvailable:78 LOAD_BDA_SEGMENT_TO es, bx79 cmp WORD [es:BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD80 ret81 82 83 ;--------------------------------------------------------------------84 67 ; Returns offset to BOOTMENUINFO based on DPT pointer. 85 68 ; … … 90 73 ; BX: Offset to BOOTMENUINFO struct 91 74 ; Corrupts registers: 92 ; Nothing75 ; AX 93 76 ;-------------------------------------------------------------------- 94 77 BootMenuInfo_ConvertDPTtoBX: 95 push ax96 78 mov ax, di 97 79 sub ax, BYTE RAMVARS_size ; subtract off base of DPTs … … 100 82 add ax, BOOTVARS.rgBootNfo ; add base of BOOTMENUINFO 101 83 xchg ax, bx 102 pop ax103 84 ret -
trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuPrintCfg.asm
r363 r365 65 65 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED 66 66 jz SHORT .PushBlockSizeFromAX 67 mov al, [di+DPT_ATA.b SetBlock]67 mov al, [di+DPT_ATA.bBlockSize] 68 68 .PushBlockSizeFromAX: 69 69 push ax … … 114 114 ;-------------------------------------------------------------------- 115 115 .PushResetStatus: 116 call BootMenuInfo_IsAvailable ; Load segment to ES 117 call BootMenuInfo_ConvertDPTtoBX 118 push WORD [es:bx+BOOTMENUINFO.wInitErrorFlags] 116 xor ax, ax 117 %ifdef MODULE_SERIAL 118 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 119 jnz SHORT .AlwaysSuccess 120 mov al, [di+DPT_ATA.bInitError] 121 .AlwaysSuccess: 122 %endif 123 push ax 119 124 120 125 ;;; fall-out to BootMenuPrint_HardDiskRefreshInformation. -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r363 r365 55 55 mov [di+DPT.wFlags], ax 56 56 mov [di+DPT.bIdevarsOffset], bp 57 mov BYTE [di+DPT_ATA.b SetBlock], 1 ; Block = 1 sector57 mov BYTE [di+DPT_ATA.bBlockSize], 1 ; Block = 1 sector 58 58 %ifdef MODULE_ADVANCED_ATA 59 59 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
r364 r365 30 30 ;-------------------------------------------------------------------- 31 31 .StoreBlockMode: 32 mov al, 1 ; Block mode will be enabled on AH=9h 33 mov ah, [es:si+ATA1.bBlckSize] ; Max block size in sectors 34 mov [di+DPT_ATA.wSetAndMaxBlock], ax 32 mov BYTE [di+DPT_ATA.bBlockSize], 1 35 33 36 34 %ifdef MODULE_ADVANCED_ATA -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r364 r365 180 180 ; Store sizes 181 181 mov [bp+PIOVARS.bSectorsLeft], ah 182 eMOVZX ax, BYTE [di+DPT_ATA.b SetBlock]182 eMOVZX ax, BYTE [di+DPT_ATA.bBlockSize] 183 183 mov [bp+PIOVARS.wSectorsInBlock], ax 184 184 mov [bp+PIOVARS.bSectorsDone], ah ; Zero -
trunk/XTIDE_Universal_BIOS/Src/Device/MemoryMappedIDE/MemIdeTransfer.asm
r294 r365 42 42 mov ch, [bp+IDEPACK.bSectorCount] 43 43 mov [bp+MEMPIOVARS.wWordsLeft], cx 44 mov ch, [di+DPT_ATA.b SetBlock]44 mov ch, [di+DPT_ATA.bBlockSize] 45 45 mov [bp+MEMPIOVARS.wWordsInBlock], cx 46 46 mov [bp+MEMPIOVARS.fpDPT], di -
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.