Changeset 422 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Timestamp:
- May 12, 2012, 1:58:25 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.