- Timestamp:
- Apr 22, 2013, 10:32:25 AM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm
r547 r549 65 65 66 66 ;-------------------------------------------------------------------- 67 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI andTranslateModeInDX67 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX 68 68 ; Parameters: 69 69 ; DX: Wanted translate mode or TRANSLATEMODE_AUTO to autodetect … … 78 78 ; DH 79 79 ;-------------------------------------------------------------------- 80 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI andTranslateModeInDX:80 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX: 81 81 call AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI 82 82 … … 92 92 ; TRANSLATEMODE_AUTO set 93 93 94 %ifndef MODULE_EBIOS 95 ; Since we do not have EBIOS functions, we might as well use the faster 96 ; LARGE mode for small drives. Assisted LBA provides more capacity for 97 ; larger drives. 94 98 ; Generate L-CHS using simple bit shift algorithm (ECHS) if 95 99 ; 8192 or less cylinders. 96 100 cmp ax, 8192 97 101 jbe SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 98 99 ; We have 8193 or more cylinders so two algorithms are available: 100 ; Revised ECHS or Assisted LBA. The Assisted LBA provides larger 101 ; capacity but requires LBA support from drive (drives this large 102 ; always support LBA but user might have unintentionally set LBA). 103 .UseAssistedLBA: 102 %endif 103 104 ; If we have EBIOS functions, we should always use Assisted LBA 105 ; for drives with LBA support. Otherwise the EBIOS functions are 106 ; useless since we never do LBA to P-CHS translation. 107 ; Even if we do not have EBIOS functions, we must do this check 108 ; since user might have forced LBA mode even though the drive does 109 ; not support LBA addressing. 104 110 test BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8 105 111 jz SHORT ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL 106 112 107 ; Drive supports LBA 113 ; Assisted LBA provides most capacity but translation algorithm is 114 ; slower. The speed difference doesn't matter on AT systems. 115 .UseAssistedLBA: 108 116 call GetSectorCountToDXAXfromCHSinAXBLBH 109 117 call ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH … … 183 191 ; Generate L-CHS using simple bit shift algorithm (ECHS) if 184 192 ; 8192 or less cylinders 185 cmp ax, 8192 186 jbe SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 187 cmp bl, 16 ; Drives with 8193 or more cylinders can report 15 heads 188 jb SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 193 call AtaGeometry_IsDriveSmallEnoughForECHS 194 jc SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL 189 195 190 196 eMOVZX cx, bl ; CX = 16 … … 239 245 mov dl, TRANSLATEMODE_LARGE 240 246 jmp SHORT .ShiftIfMoreThan1024Cylinder 247 248 249 ;-------------------------------------------------------------------- 250 ; Checks should LARGE mode L-CHS be calculated with ECHS or Revised ECHS 251 ; algorithm. Revised ECHS is needed for drives with 8193 or more cylinders 252 ; AND 16 heads. 253 ; 254 ; AtaGeometry_IsDriveSmallEnoughForECHS: 255 ; Parameters: 256 ; AX: Number of P-Cylinders 257 ; BL: Number of P-Heads 258 ; Returns: 259 ; CF: Clear if Reviced ECHS is necessary 260 ; Set if ECHS is enough 261 ; Corrupts registers: 262 ; Nothing 263 ;-------------------------------------------------------------------- 264 AtaGeometry_IsDriveSmallEnoughForECHS: 265 ; Generate L-CHS using simple bit shift algorithm (ECHS) if 266 ; 8192 or less cylinders. Use Revised ECHS if 8193 or more cylinders 267 ; AND 16 heads. 268 cmp ax, 8193 269 jb SHORT .RevisedECHSisNotNeeded 270 cmp bl, 16 ; Drives with 8193 or more cylinders can report 15 heads 271 .RevisedECHSisNotNeeded: 272 ret 241 273 242 274 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r547 r549 100 100 101 101 ; Translate P-CHS to L-CHS 102 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI andTranslateModeInDX102 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX 103 103 mov [di+DPT.wLchsCylinders], ax 104 104 mov [di+DPT.wLchsHeadsAndSectors], bx … … 113 113 jz SHORT .LimitHeadsForLargeAddressingMode 114 114 115 or cl, FLGL_DPT_LBA ; Set LBA bit for Assisted LBA 115 ; Set LBA bit for Assisted LBA 116 or cl, FLGL_DPT_LBA 116 117 jmp SHORT .NothingToChange 118 117 119 .LimitHeadsForLargeAddressingMode: 118 MIN_U bl, 15 ; Cannot have 16 P-Heads in LARGE addressing mode 120 ; We cannot have 16 P-Heads heads in Revised ECHS mode (8193 or more cylinders) 121 ; but 16 heads are allowed when there are 8192 or less cylinders (ECHS). 122 ; Both of these are LARGE modes so do not confuse with NORMAL mode. 123 call AtaGeometry_IsDriveSmallEnoughForECHS 124 jc SHORT .NothingToChange 125 dec bx ; Adjust 16 P-Heads to 15 126 119 127 .NothingToChange: 120 128 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode
Note:
See TracChangeset
for help on using the changeset viewer.