Changeset 422 in xtideuniversalbios
- Timestamp:
- May 12, 2012, 1:58:25 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/BootVars.inc
r421 r422 63 63 64 64 struc DRVDETECTINFO 65 .StartOfDrvDetectInfo: 65 66 .szDrvName resb MAX_HARD_DISK_NAME_LENGTH 66 67 resb 2 ; Zero word (ensures string terminates) 67 68 .wInitErrorFlags resb 2 ; Errors during initialization 68 69 69 %if LARGEST_DPT_SIZE == 28 70 resb 22 ; padding to make DRVDETECTINFO size an even multiple of DPT size 71 %elif LARGEST_DPT_SIZE == 20 72 resb 6 73 %elif LARGEST_DPT_SIZE == 18 74 resb 2 75 %else ; LARGEST_DPT_SIZE == 10 76 resb 6 77 %endif 70 ; DRVDETECTINFO's size must be an even multiple of DPT's size 71 .EndOfDriveDetectInfo: resb LARGEST_DPT_SIZE - (.EndOfDriveDetectInfo % LARGEST_DPT_SIZE) 78 72 endstruc 79 73 -
trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
r421 r422 23 23 24 24 ; Base DPT for all device types 25 struc DPT ; 8or 18 bytes25 struc DPT ; 10 or 18 bytes 26 26 ; General Disk Parameter Table related 27 27 .wFlags: … … 29 29 .bFlagsHigh resb 1 30 30 .bIdevarsOffset resb 1 ; Offset to IDEVARS for this drive 31 .bInitError resb 1 ; Flags for AH=09h initialization errors 31 32 32 .bPchsHeads resb 1 ; (1...16)33 ; CHS variables 33 34 .wLchsCylinders resb 2 ; (1...1027, yes 1027) 34 35 .wLchsHeadsAndSectors: 35 36 .bLchsHeads resb 1 ; (1...255) 36 37 .bLchsSectorsPerTrack resb 1 ; (1...63) 38 .bPchsHeads resb 1 ; (1...16) 37 39 40 ; LBA and remaining P-CHS variables 38 41 %ifdef MODULE_EBIOS 42 .bPchsSectorsPerTrack resb 1 43 .wPchsCylinders resb 2 39 44 .twLbaSectors resb 6 ; 48-bit sector count for LBA addressing 40 .wPchsCylinders resb 2 41 .bPchsSectorsPerTrack resb 1 42 resb 1 45 %else 46 resb 1 ; Alignment 43 47 %endif 44 48 endstruc … … 46 50 ; Bit definitions for DPT.bFlagsLow 47 51 MASKL_DPT_CHS_SHIFT_COUNT EQU (3<<0) ; Bits 0...1, P-CHS to L-CHS bit shift count (0...3) 48 MASKL_DPT_ ADDRESSING_MODE EQU (3<<ADDRESSING_MODE_FIELD_POSITION); Bits 2...3, NORMAL, LARGE or Assisted LBA addressing mode49 FLGL_DPT_ASSISTED_LBA EQU (1<<( ADDRESSING_MODE_FIELD_POSITION+1))52 MASKL_DPT_TRANSLATEMODE EQU MASK_DRVPARAMS_TRANSLATEMODE ; Bits 2...3, NORMAL, LARGE or Assisted LBA addressing mode 53 FLGL_DPT_ASSISTED_LBA EQU (1<<(TRANSLATEMODE_FIELD_POSITION+1)) 50 54 FLGL_DPT_SLAVE EQU FLG_DRVNHEAD_DRV ; Bit 4, Drive is a Slave Drive 51 55 %ifdef MODULE_IRQ … … 56 60 FLGL_DPT_LBA48 EQU (1<<7) ; Bit 7, Drive supports 48-bit LBA (Must be bit 7!) 57 61 %endif 58 59 ; Addressing modes for DPT.bFlagsLow60 ADDRESSING_MODE_FIELD_POSITION EQU 261 ADDRESSING_MODE_NORMAL EQU 062 ADDRESSING_MODE_LARGE EQU 163 ADDRESSING_MODE_ASSISTED_LBA EQU 2 ; 28-bit or 48-bit LBA64 62 65 63 … … 87 85 88 86 87 ; Flags for DPT_ADVANCED_ATA.bInitError 88 FLG_INITERROR_FAILED_TO_SELECT_DRIVE EQU (1<<0) 89 FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS EQU (1<<1) 90 FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE EQU (1<<2) 91 FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE EQU (1<<3) 92 FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE EQU (1<<4) 93 FLG_INITERROR_FAILED_TO_SET_PIO_MODE EQU (1<<5) 94 FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER EQU (1<<6) 95 96 89 97 90 98 ; DPT for ATA devices 91 struc DPT_ATA ; 8/18 bytes + 2 bytes = 10/20 bytes99 struc DPT_ATA ; 10/18 bytes + 2 bytes = 12/20 bytes 92 100 .dpt resb DPT_size 93 101 .bBlockSize resb 1 ; Current block size in sectors (do not set to zero!) … … 100 108 ; EBDA must be reserved for DPTs when using these! 101 109 %ifdef MODULE_ADVANCED_ATA 102 struc DPT_ADVANCED_ATA ; 1 0/20 bytes + 8 bytes = 18/28 bytes110 struc DPT_ADVANCED_ATA ; 12/20 bytes + 8 bytes = 20/28 bytes 103 111 .dpt_ata resb DPT_ATA_size 104 112 .wControllerID resb 2 ; Controller specific ID WORD (from Advanced Controller detection) … … 106 114 .wMinPioCycleTime resb 2 ; Minimum PIO Cycle Time in ns 107 115 .bPioMode resb 1 ; Best supported PIO mode 108 .bInitError resb 1 ; Flags for initialization errors116 resb 1 109 117 endstruc 110 111 ; Flags for DPT_ADVANCED_ATA.bInitError112 FLG_INITERROR_FAILED_TO_SELECT_DRIVE EQU (1<<0)113 FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS EQU (1<<1)114 FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE EQU (1<<2)115 FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE EQU (1<<3)116 FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE EQU (1<<4)117 FLG_INITERROR_FAILED_TO_SET_PIO_MODE EQU (1<<5)118 FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER EQU (1<<6)119 118 %endif 120 119 -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r408 r422 164 164 165 165 ; Bit defines for DRVPARAMS.wFlags 166 MASK_DRVPARAMS_WRITECACHE EQU (3<<0) ; Drive internal write cache settings (must start at bit 0) 167 FLG_DRVPARAMS_BLOCKMODE EQU (1<<2) ; Enable Block mode transfers 168 FLG_DRVPARAMS_USERCHS EQU (1<<3) ; User specified P-CHS values 169 FLG_DRVPARAMS_USERLBA EQU (1<<4) ; User specified LBA values 166 MASK_DRVPARAMS_WRITECACHE EQU (3<<0) ; Bits 0...1, Drive internal write cache settings (must start at bit 0) 167 DEFAULT_WRITE_CACHE EQU 0 ; Must be 0 168 DISABLE_WRITE_CACHE EQU 1 169 ENABLE_WRITE_CACHE EQU 2 170 MASK_DRVPARAMS_TRANSLATEMODE EQU (3<<TRANSLATEMODE_FIELD_POSITION) ; Bits 2...3, Position shared with DPT 171 TRANSLATEMODE_FIELD_POSITION EQU 2 172 TRANSLATEMODE_NORMAL EQU 0 173 TRANSLATEMODE_LARGE EQU 1 174 TRANSLATEMODE_ASSISTED_LBA EQU 2 ; 28-bit or 48-bit LBA 175 TRANSLATEMODE_AUTO EQU 3 ; Only available in ROMVARS, not in DPTs 176 FLG_DRVPARAMS_BLOCKMODE EQU (1<<4) ; Enable Block mode transfers 177 FLG_DRVPARAMS_USERCHS EQU (1<<5) ; User specified P-CHS values 178 MAX_USER_CYLINDERS EQU 16383 179 MAX_USER_HEADS EQU 16 180 MAX_USER_SECTORS_PER_TRACK EQU 63 181 FLG_DRVPARAMS_USERLBA EQU (1<<6) ; User specified LBA value 182 MIN_USER_LBA_COUNT EQU ((MAX_USER_CYLINDERS*MAX_USER_HEADS*MAX_USER_SECTORS_PER_TRACK)+1) 183 MAX_USER_LBA_COUNT EQU ((2^28)-1) 170 184 171 ; Drive Write Cache values for DRVPARAMS.wFlags.MASK_DRVPARAMS_WRITECACHE172 DEFAULT_WRITE_CACHE EQU 0 ; Must be 0173 DISABLE_WRITE_CACHE EQU 1174 ENABLE_WRITE_CACHE EQU 2175 185 176 186 %endif ; ROMVARS_INC -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r421 r422 35 35 ;-------------------------------------------------------------------- 36 36 %macro STORE_ERROR_FLAG_TO_DPT 1 37 %ifdef MODULE_ADVANCED_ATA38 37 mov al, %1 39 38 call SetErrorFlagFromALwithErrorCodeInAH 40 %endif41 39 %endmacro 42 40 … … 82 80 %ifdef MODULE_ADVANCED_ATA 83 81 ; Clear Initialization Error flags from DPT 84 mov [di+DPT _ADVANCED_ATA.bInitError], al82 mov [di+DPT.bInitError], al 85 83 %endif 86 84 … … 205 203 .ReturnWithErrorCodeInAH: 206 204 %ifdef MODULE_ADVANCED_ATA 207 mov ah, [di+DPT _ADVANCED_ATA.bInitError]205 mov ah, [di+DPT.bInitError] 208 206 test ah, ah ; Clears CF 209 207 jz SHORT .ReturnWithSuccess … … 225 223 226 224 227 %ifdef MODULE_ADVANCED_ATA228 225 ;-------------------------------------------------------------------- 229 226 ; SetErrorFlagFromALwithErrorCodeInAH … … 247 244 jbe SHORT IgnoreInvalidCommandError 248 245 249 or [di+DPT _ADVANCED_ATA.bInitError], al246 or [di+DPT.bInitError], al 250 247 stc 251 248 .NoErrorFlagToSet: 252 249 ret 253 254 %endif -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Address.asm
r421 r422 103 103 Address_OldInt13hAddressToIdeAddress: 104 104 call Address_ExtractLCHSparametersFromOldInt13hAddress 105 ACCESSDPT__GET_UNSHIFTED_ ADDRESS_MODE_TO_AXZF105 ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 106 106 107 107 ;;; 0: ADDRESSING_MODE_NORMAL -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r421 r422 92 92 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_16BIT_ATA 93 93 at ROMVARS.ideVars0+IDEVARS.bIRQ, db 0 94 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE95 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE94 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 95 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 96 96 97 97 at ROMVARS.ideVars1+IDEVARS.wPort, dw DEVICE_ATA_SECONDARY_PORT … … 99 99 at ROMVARS.ideVars1+IDEVARS.bDevice, db DEVICE_16BIT_ATA 100 100 at ROMVARS.ideVars1+IDEVARS.bIRQ, db 0 101 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE102 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE101 at ROMVARS.ideVars1+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 102 at ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 103 103 104 104 at ROMVARS.ideVars2+IDEVARS.wPort, dw DEVICE_ATA_TERTIARY_PORT … … 106 106 at ROMVARS.ideVars2+IDEVARS.bDevice, db DEVICE_16BIT_ATA 107 107 at ROMVARS.ideVars2+IDEVARS.bIRQ, db 0 108 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE109 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE108 at ROMVARS.ideVars2+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 109 at ROMVARS.ideVars2+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 110 110 111 111 at ROMVARS.ideVars3+IDEVARS.wPort, dw DEVICE_ATA_QUATERNARY_PORT … … 113 113 at ROMVARS.ideVars3+IDEVARS.bDevice, db DEVICE_16BIT_ATA 114 114 at ROMVARS.ideVars3+IDEVARS.bIRQ, db 0 115 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE116 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, d b DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE115 at ROMVARS.ideVars3+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 116 at ROMVARS.ideVars3+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, dw DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE | (TRANSLATEMODE_AUTO<<TRANSLATEMODE_FIELD_POSITION) 117 117 118 118 %ifdef MODULE_SERIAL -
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm
r421 r422 56 56 ;-------------------------------------------------------------------- 57 57 .PushAddressingMode: 58 ACCESSDPT__GET_UNSHIFTED_ ADDRESS_MODE_TO_AXZF58 ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 59 59 ;; 60 60 ;; This multiply both shifts the addressing mode bits down to low order bits, and … … 62 62 ;; with AL clear, and so we exchange AL and AH after the multiply for the final result. 63 63 ;; 64 mov cx, g_szAddressingModes_Displacement << (8- ADDRESSING_MODE_FIELD_POSITION)64 mov cx, g_szAddressingModes_Displacement << (8-TRANSLATEMODE_FIELD_POSITION) 65 65 mul cx 66 66 xchg al, ah ; AL = always zero after above multiplication … … 132 132 ;-------------------------------------------------------------------- 133 133 .PushResetStatus: 134 %ifdef MODULE_ADVANCED_ATA 135 mov al, [di+DPT_ADVANCED_ATA.bInitError] 134 mov al, [di+DPT.bInitError] 136 135 push ax 137 %else138 ePUSH_T ax, 0139 %endif140 136 141 137 ;;; fall-out to BootMenuPrint_HardDiskRefreshInformation. -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r421 r422 144 144 ALIGN JUMP_ALIGN 145 145 AccessDPT_GetPointerToDRVPARAMStoCSBX: 146 eMOVZX bx, [di+DPT.bIdevarsOffset]; CS:BX points to IDEVARS146 eMOVZX bx, BYTE [di+DPT.bIdevarsOffset] ; CS:BX points to IDEVARS 147 147 add bx, BYTE IDEVARS.drvParamsMaster ; CS:BX points to Master Drive DRVPARAMS 148 148 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE … … 154 154 155 155 ;-------------------------------------------------------------------- 156 ; ACCESSDPT__GET_UNSHIFTED_ ADDRESS_MODE_TO_AXZF156 ; ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 157 157 ; Parameters: 158 158 ; DS:DI: Ptr to Disk Parameter Table 159 159 ; Returns: 160 ; AX: Addressing Mode (ADDRESSING_MODE_NORMAL, ADDRESSING_MODE_LARGE or ADDRESSING_MODE_ASSISTED_LBA)160 ; AX: Translate Mode (TRANSLATEMODE_NORMAL, TRANSLATEMODE_LARGE or TRANSLATEMODE_ASSISTED_LBA) 161 161 ; unshifted (still shifted where it is in bFlagsLow) 162 162 ; ZF: Set based on value in AL … … 168 168 ; is not worth it for these two instructions (4 bytes total) 169 169 ; 170 %macro ACCESSDPT__GET_UNSHIFTED_ ADDRESS_MODE_TO_AXZF 0170 %macro ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 0 171 171 mov al, [di+DPT.bFlagsLow] 172 and ax, BYTE MASKL_DPT_ ADDRESSING_MODE172 and ax, BYTE MASKL_DPT_TRANSLATEMODE 173 173 %endmacro -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm
r421 r422 34 34 ; Returns: 35 35 ; BX:DX:AX: 48-bit sector count 36 ; CL: FLGL_DPT_LBA48 if LBA48 supported, zero otherwise 36 ; CL: FLGL_DPT_LBA48 if LBA48 supported 37 ; Zero if only LBA28 is supported 37 38 ; Corrupts registers: 38 39 ; Nothing … … 64 65 65 66 ;-------------------------------------------------------------------- 66 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI: 67 ; Parameters: 67 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 68 ; AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX 69 ; Parameters: 70 ; DX: Wanted translate mode or TRANSLATEMODE_AUTO to autodetect 68 71 ; ES:SI: Ptr to 512-byte ATA information read from the drive 69 72 ; Returns: … … 72 75 ; BH: Number of L-CHS sectors per track (1...63) 73 76 ; CX: Number of bits shifted (0...3) 74 ; DL: Addressing mode77 ; DL: CHS Translate Mode 75 78 ; Corrupts registers: 76 79 ; DH 77 80 ;-------------------------------------------------------------------- 78 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI :81 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX: 79 82 call AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI 80 83 ; Fall to AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH 81 84 82 AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH: 85 AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX: 86 ; Check if user defined translate mode 87 test dx, dx 88 jnz SHORT .CheckIfLargeTranslationWanted 89 MIN_U ax, MAX_LCHS_CYLINDERS ; TRANSLATEMODE_NORMAL maximum cylinders 90 inc dx 91 .CheckIfLargeTranslationWanted: 92 dec dx ; Set ZF if TRANSLATEMODE_LARGE 93 jz SHORT ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL 94 dec dx ; Set ZF if TRANSLATEMODE_ASSISTED_LBA 95 jz SHORT .UseAssistedLBA 96 ; TRANSLATEMODE_AUTO set 97 83 98 ; Generate L-CHS using simple bit shift algorithm (ECHS) if 84 99 ; 8192 or less cylinders. 85 100 cmp ax, 8192 86 jbe SHORT ConvertPCHfromAXB XtoEnhancedCHinAXBX101 jbe SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 87 102 88 103 ; We have 8193 or more cylinders so two algorithms are available: 89 104 ; Revised ECHS or Assisted LBA. The Assisted LBA provides larger 90 105 ; capacity but requires LBA support from drive (drives this large 91 ; always support LBA but we may have intentionally cleared the LBA92 ; bit to force CHS addressing). 106 ; always support LBA but user might have unintentionally set LBA). 107 .UseAssistedLBA: 93 108 test BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8 94 jz SHORT ConvertPCHfromAXB XtoRevisedEnhancedCHinAXBX109 jz SHORT ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL 95 110 96 111 ; Drive supports LBA 97 call AtaGeometry_GetSectorCountToDXAXfromCHSinAXBLBH112 call GetSectorCountToDXAXfromCHSinAXBLBH 98 113 call ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH 99 114 xor cx, cx ; No bits to shift 100 mov dl, ADDRESSING_MODE_ASSISTED_LBA115 mov dl, TRANSLATEMODE_ASSISTED_LBA 101 116 ret 102 117 … … 121 136 122 137 ;-------------------------------------------------------------------- 123 ; AtaGeometry_GetSectorCountToDXAXfromCHSinAXBLBH138 ; GetSectorCountToDXAXfromCHSinAXBLBH 124 139 ; Parameters: 125 140 ; ES:SI: Ptr to 512-byte ATA information read from the drive … … 132 147 ; BX 133 148 ;-------------------------------------------------------------------- 134 AtaGeometry_GetSectorCountToDXAXfromCHSinAXBLBH:149 GetSectorCountToDXAXfromCHSinAXBLBH: 135 150 xchg ax, bx 136 151 mul ah ; AX = Heads * Sectors per track … … 157 172 ; Do a standard ECHS translation 158 173 ; 159 ; ConvertPCHfromAXB XtoRevisedEnhancedCHinAXBX:174 ; ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL: 160 175 ; Parameters: 161 176 ; AX: Number of P-CHS cylinders (8193...16383) … … 169 184 ; Nothing 170 185 ;-------------------------------------------------------------------- 171 ConvertPCHfromAXBXtoRevisedEnhancedCHinAXBX: 186 ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL: 187 ; Generate L-CHS using simple bit shift algorithm (ECHS) if 188 ; 8192 or less cylinders 189 cmp ax, 8192 190 jbe SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 172 191 cmp bl, 16 ; Drives with 8193 or more cylinders can report 15 heads 173 jb SHORT ConvertPCHfromAXB XtoEnhancedCHinAXBX192 jb SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 174 193 175 194 eMOVZX cx, bl ; CX = 16 … … 201 220 ; Use the multiplier on the Cylinder and Head values to obtain the translated values. 202 221 ; 203 ; ConvertPCHfromAXB XtoEnhancedCHinAXBX:222 ; ConvertPCHfromAXBLtoEnhancedCHinAXBL: 204 223 ; Parameters: 205 224 ; AX: Number of P-CHS cylinders (1...8192) … … 209 228 ; BL: Number of L-CHS heads (?...128) 210 229 ; CX: Number of bits shifted (0...3) 211 ; DL: ADDRESSING_MODE_NORMAL or ADDRESSING_MODE_LARGE230 ; DL: TRANSLATEMODE_NORMAL or TRANSLATEMODE_LARGE 212 231 ; Corrupts registers: 213 232 ; Nothing 214 233 ;-------------------------------------------------------------------- 215 ConvertPCHfromAXB XtoEnhancedCHinAXBX:234 ConvertPCHfromAXBLtoEnhancedCHinAXBL: 216 235 xor cx, cx ; No bits to shift initially 217 xor dl, dl ; Assume ADDRESSING_MODE_NORMAL236 xor dl, dl ; Assume TRANSLATEMODE_NORMAL 218 237 .ShiftIfMoreThan1024Cylinder: 219 238 cmp ax, MAX_LCHS_CYLINDERS 220 239 jbe SHORT ReturnLCHSinAXBLBH 221 shr ax, 1 222 shl bl, 1 240 shr ax, 1 ; Halve cylinders 241 shl bl, 1 ; Double heads 223 242 inc cx ; Increment bit shift count 224 mov dl, ADDRESSING_MODE_LARGE243 mov dl, TRANSLATEMODE_LARGE 225 244 jmp SHORT .ShiftIfMoreThan1024Cylinder 226 245 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r421 r422 55 55 ;-------------------------------------------------------------------- 56 56 .InitializeDPT: 57 mov [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM57 mov [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM 58 58 ; Fall to .StoreDriveSelectAndDriveControlByte 59 59 … … 95 95 .StoreCHSparametersAndAddressingMode: 96 96 ; Check if CHS defined in ROMVARS 97 call AccessDPT_GetPointerToDRVPARAMStoCSBX98 test byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS ; User specified P-CHS?97 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 98 test cl, FLG_DRVPARAMS_USERCHS 99 99 jz SHORT .AutodetectPCHSvalues 100 100 101 ; Use DRVPARAMS P-CHS values instead of autodetected 102 mov ax, [cs:bx+DRVPARAMS.wCylinders] 103 mov bx, [cs:bx+DRVPARAMS.wHeadsAndSectors] 104 call AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH 101 ; Translate P-CHS to L-CHS 102 call AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX 105 103 jmp SHORT .StoreLCHStoDPT 106 107 ; Get L-CHS parameters and addressing mode108 104 .AutodetectPCHSvalues: 109 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI 105 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 110 106 111 107 .StoreLCHStoDPT: 112 eSHL_IM dl, ADDRESSING_MODE_FIELD_POSITION108 eSHL_IM dl, TRANSLATEMODE_FIELD_POSITION 113 109 or cl, dl 114 110 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode … … 144 140 145 141 ; Load user defined LBA 146 call AccessDPT_GetPointerToDRVPARAMStoCSBX147 test BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA142 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 143 test cl, FLG_DRVPARAMS_USERLBA 148 144 jz SHORT .KeepTotalSectorsFromAtaID 149 mov ax, [cs:bx+DRVPARAMS.dwMaximumLBA]150 mov dx, [cs:bx+DRVPARAMS.dwMaximumLBA+2]151 xor bx, bx152 145 153 146 ; Compare user defined and ATA-ID sector count and select smaller 147 xor dx, dx 148 xchg bx, dx ; User defined LBA now in BX:DX:AX 154 149 cmp bx, [di+DPT.twLbaSectors+4] 155 150 jb SHORT .StoreUserDefinedSectorCountToDPT … … 160 155 jae SHORT .KeepTotalSectorsFromAtaID 161 156 .StoreUserDefinedSectorCountToDPT: 162 xor cx, cx ; Always LBA28 for user defined values157 ; CL bit FLGL_DPT_LBA48 is clear at this point 163 158 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 164 159 … … 234 229 235 230 231 ;-------------------------------------------------------------------- 232 ; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 233 ; Parameters: 234 ; DS:DI: Ptr to Disk Parameter Table 235 ; Returns: 236 ; AX: User defined P-CHS Cylinders or LBA low word 237 ; BX: User defined P-CHS Heads and Sectors or LBA high word 238 ; DX: Translate mode or TRANSLATEMODE_AUTO 239 ; CX: FLG_DRVPARAMS_USERCHS if user defined CHS in BX:AX 240 ; FLG_DRVPARAMS_USERLBA if user defined LBA in BX:AX 241 ; Zero if user has not defined capacity 242 ; Corrupts registers: 243 ; Nothing 244 ;-------------------------------------------------------------------- 245 GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS: 246 call AccessDPT_GetPointerToDRVPARAMStoCSBX 247 248 ; Get settings 249 mov cx, [cs:bx+DRVPARAMS.wFlags] 250 mov dx, cx 251 and cx, BYTE FLG_DRVPARAMS_USERCHS | FLG_DRVPARAMS_USERLBA 252 and dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE 253 eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION 254 255 ; Get capacity 256 mov ax, [cs:bx+DRVPARAMS.wCylinders] ; Or .dwMaximumLBA 257 mov bx, [cs:bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2 258 ret 259 260 236 261 %ifdef MODULE_EBIOS 237 262 ;--------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.