Changeset 542 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Timestamp:
- Apr 15, 2013, 4:03:33 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AccessDPT.asm
r526 r542 22 22 23 23 ;-------------------------------------------------------------------- 24 ; AccessDPT_GetDriveSelectByteForOldInt13hToAL 25 ; AccessDPT_GetDriveSelectByteForEbiosToAL 24 ; AccessDPT_GetDriveSelectByteToAL 26 25 ; Parameters: 27 26 ; DS:DI: Ptr to Disk Parameter Table … … 32 31 ;-------------------------------------------------------------------- 33 32 ALIGN JUMP_ALIGN 34 AccessDPT_GetDriveSelectByte ForOldInt13hToAL:33 AccessDPT_GetDriveSelectByteToAL: 35 34 mov al, [di+DPT.bFlagsLow] 36 test al, FLGL_DPT_ASSISTED_LBA 37 jnz SHORT GetDriveSelectByteForAssistedLBAtoAL 38 39 and al, FLG_DRVNHEAD_DRV ; Clear all but drive select bit 35 and al, FLGL_DPT_SLAVE | FLGL_DPT_LBA 40 36 or al, MASK_DRVNHEAD_SET ; Bits set to 1 for old drives 41 ret42 43 %ifdef MODULE_EBIOS44 ALIGN JUMP_ALIGN45 AccessDPT_GetDriveSelectByteForEbiosToAL:46 mov al, [di+DPT.bFlagsLow]47 ; Fall to GetDriveSelectByteForAssistedLBAtoAL48 %endif ; MODULE_EBIOS49 50 ALIGN JUMP_ALIGN51 GetDriveSelectByteForAssistedLBAtoAL:52 and al, FLG_DRVNHEAD_DRV ; Master / Slave select53 or al, FLG_DRVNHEAD_LBA | MASK_DRVNHEAD_SET54 37 ret 55 38 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm
r526 r542 66 66 ;-------------------------------------------------------------------- 67 67 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 68 ; AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX69 68 ; Parameters: 70 69 ; DX: Wanted translate mode or TRANSLATEMODE_AUTO to autodetect … … 81 80 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX: 82 81 call AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI 83 ; Fall to AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX 84 85 AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX: 82 86 83 ; Check if user defined translate mode 87 84 dec dx ; Set ZF if TRANSLATEMODE_LARGE, SF if TRANSLATEMODE_NORMAL -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm
r541 r542 107 107 xor dx, dx ; Clear for checksum 108 108 mov ax, [si+DPT.wLchsCylinders] 109 MIN_U ax, MAX_LCHS_CYLINDERS ; Our DPT can have up to 1027109 ;MIN_U ax, MAX_LCHS_CYLINDERS ; Our DPT can have up to 1027 110 110 call StoswThenAddALandAHtoDL ; Bytes 0 and 1 (Logical number of cylinders) 111 111 … … 201 201 ; DPTE.bDrvnhead and DPTE.bBiosVendor 202 202 xchg di, si 203 call AccessDPT_GetDriveSelectByte ForEbiosToAL203 call AccessDPT_GetDriveSelectByteToAL 204 204 xchg si, di 205 205 call StoswThenAddALandAHtoDL ; Bytes 4 and 5 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r535 r542 38 38 ; Set if any error 39 39 ; Corrupts registers: 40 ; AX, BX, CX, D H40 ; AX, BX, CX, DX 41 41 ;-------------------------------------------------------------------- 42 42 CreateDPT_FromAtaInformation: … … 96 96 ;-------------------------------------------------------------------- 97 97 .StoreCHSparametersAndAddressingMode: 98 ; Check if CHS defined in ROMVARS 99 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 100 test cl, FLG_DRVPARAMS_USERCHS 101 jz SHORT .AutodetectPCHSvalues 98 ; Apply any user limited values to ATA ID 99 call AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX 102 100 103 101 ; Translate P-CHS to L-CHS 104 call AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX105 jmp SHORT .StoreLCHStoDPT106 .AutodetectPCHSvalues:107 102 call AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX 108 109 .StoreLCHStoDPT:110 eSHL_IM dl, TRANSLATEMODE_FIELD_POSITION111 or cl, dl112 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode113 103 mov [di+DPT.wLchsCylinders], ax 114 104 mov [di+DPT.wLchsHeadsAndSectors], bx 115 116 ; Store P-CHS to DPT 105 mov al, dl 106 eSHL_IM al, TRANSLATEMODE_FIELD_POSITION 107 or cl, al 108 109 ; Store P-CHS and flags 117 110 call AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI 118 mov [di+DPT.bPchsHeads], bl 111 dec dx ; Set ZF if TRANSLATEMODE_LARGE, SF if TRANSLATEMODE_NORMAL 112 js SHORT .NothingToChange 113 jz SHORT .LimitHeadsForLargeAddressingMode 114 115 or cl, FLGL_DPT_LBA ; Set LBA bit for Assisted LBA 116 jmp SHORT .NothingToChange 117 .LimitHeadsForLargeAddressingMode: 118 MIN_U bl, 15 ; Cannot have 16 P-Heads in LARGE addressing mode 119 .NothingToChange: 120 or [di+DPT.bFlagsLow], cl ; Shift count and addressing mode 121 mov [di+DPT.wPchsHeadsAndSectors], bx 122 119 123 %ifdef MODULE_EBIOS 120 mov [di+DPT.bPchsSectorsPerTrack], bh 121 122 ; This is what Award BIOS from 1997 Pentium motherboard does. I can't think 123 ; of any good reason to do the same but let's keep this here just in case, 124 ; at least for a while. 125 %if 0 126 %ifdef RESERVE_DIAGNOSTIC_CYLINDER 127 ; Do not store P-Cylinders, instead calculate it from L-CHS total sector count. 128 ; Read AH=48h_GetExtendedDriveParameters.asm for more info. 129 xchg ax, bx 130 mul ah 131 push ax ; P-Heads * P-Sectors per track 132 call AH15h_GetSectorCountToBXDXAX 133 pop bx 134 div bx ; AX = Calculated cylinders 135 %endif ; RESERVE_DIAGNOSTIC_CYLINDER 136 %endif ; 0 137 124 test cl, FLGL_DPT_LBA 125 jz SHORT .NoLbaSoNoEBIOS 126 127 ; Store P-Cylinders but only if we have 15,482,880 or less sectors since 128 ; we only need P-Cylinders so we can return it from AH=48h 129 call AtaGeometry_GetLbaSectorCountToBXDXAXfromAtaInfoInESSI 130 sub ax, MAX_SECTOR_COUNT_TO_RETURN_PCHS & 0FFFFh 131 sbb dx, MAX_SECTOR_COUNT_TO_RETURN_PCHS >> 16 132 sbb bx, BYTE 0 133 ja SHORT .StoreNumberOfLbaSectors 134 135 ; Since we might have altered the default P-CHS parameters to be 136 ; presented to the drive (AH=09h), we need to calculate new 137 ; P-Cylinders. It could be read from the ATA ID after 138 ; COMMAND_INITIALIZE_DEVICE_PARAMETERS but that is too much trouble. 139 ; P-Cyls = MIN(16383*16*63, LBA sector count) / (P-Heads * P-Sectors per track) 140 call AtaGeometry_GetLbaSectorCountToBXDXAXfromAtaInfoInESSI 141 xchg cx, ax ; Sector count to DX:CX 142 mov al, [di+DPT.bPchsHeads] 143 mul BYTE [di+DPT.bPchsSectorsPerTrack] 144 xchg cx, ax 145 div cx ; AX = new P-Cylinders 138 146 mov [di+DPT.wPchsCylinders], ax 147 148 ; Store CHS sector count as total sector count 149 mul cx 150 xor bx, bx 151 xor cx, cx ; Clear LBA48 flag 152 jmp SHORT .StoreTotalSectorsFromBXDXAXandLBA48flagFromCL 139 153 ; Fall to .StoreNumberOfLbaSectors 140 154 … … 150 164 ; AX, BX, CX, DX 151 165 ;-------------------------------------------------------------------- 152 ; Check if LBA supported 153 test BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8 154 jz SHORT .NoLbaSupportedSoNoEBIOS 155 166 .StoreNumberOfLbaSectors: 156 167 ; Store LBA 28/48 total sector count 157 168 call AtaGeometry_GetLbaSectorCountToBXDXAXfromAtaInfoInESSI 158 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 159 160 ; If we have 15,482,880 or less sectors, we multiply P-CHS values 161 ; and use that as total sector count. 162 ; Read AH=48h_GetExtendedDriveParameters.asm for more info. 163 sub ax, 4001h 164 sbb dx, 0ECh 165 sbb bx, BYTE 0 166 jnc SHORT .NoNeedToUseCHSsectorCount ; More than EC4000h 167 168 mov al, [di+DPT.bPchsHeads] 169 mul BYTE [di+DPT.bPchsSectorsPerTrack] 170 mul WORD [di+DPT.wPchsCylinders] 171 xor bx, bx 172 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 173 174 ; Load user defined LBA 175 .NoNeedToUseCHSsectorCount: 176 call GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS 177 test cl, FLG_DRVPARAMS_USERLBA 178 jz SHORT .KeepTotalSectorsFromAtaID 179 180 ; Compare user defined and ATA-ID sector count and select smaller 181 mov dx, bx 182 xor bx, bx ; User defined LBA now in BX:DX:AX 183 cmp bx, [di+DPT.twLbaSectors+4] 184 jb SHORT .StoreUserDefinedSectorCountToDPT 185 cmp dx, [di+DPT.twLbaSectors+2] 186 jb SHORT .StoreUserDefinedSectorCountToDPT 187 ja SHORT .KeepTotalSectorsFromAtaID 188 cmp ax, [di+DPT.twLbaSectors] 189 jae SHORT .KeepTotalSectorsFromAtaID 190 .StoreUserDefinedSectorCountToDPT: 191 ; CL bit FLGL_DPT_LBA48 is clear at this point 192 call StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX 193 194 .KeepTotalSectorsFromAtaID: 195 .NoLbaSupportedSoNoEBIOS: 169 .StoreTotalSectorsFromBXDXAXandLBA48flagFromCL: 170 or [di+DPT.bFlagsLow], cl 171 mov [di+DPT.twLbaSectors], ax 172 mov [di+DPT.twLbaSectors+2], dx 173 mov [di+DPT.twLbaSectors+4], bx 174 .NoLbaSoNoEBIOS: 196 175 %endif ; MODULE_EBIOS 197 176 ; Fall to .StoreBlockMode … … 288 267 mov [di+DPT.wBasePort], ax 289 268 ret 290 291 292 ;--------------------------------------------------------------------293 ; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS294 ; Parameters:295 ; DS:DI: Ptr to Disk Parameter Table296 ; Returns:297 ; AX: User defined P-CHS Cylinders or LBA low word298 ; BX: User defined P-CHS Heads and Sectors or LBA high word299 ; DX: Translate mode or TRANSLATEMODE_AUTO300 ; CX: FLG_DRVPARAMS_USERCHS if user defined CHS in BX:AX301 ; FLG_DRVPARAMS_USERLBA if user defined LBA in BX:AX302 ; Zero if user has not defined capacity303 ; Corrupts registers:304 ; Nothing305 ;--------------------------------------------------------------------306 GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS:307 call AccessDPT_GetPointerToDRVPARAMStoCSBX308 309 ; Get settings310 mov cx, [cs:bx+DRVPARAMS.wFlags]311 mov dx, cx312 and cx, BYTE FLG_DRVPARAMS_USERCHS | FLG_DRVPARAMS_USERLBA313 and dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE314 eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION315 316 ; Get capacity317 mov ax, [cs:bx+DRVPARAMS.wCylinders] ; Or .dwMaximumLBA318 mov bx, [cs:bx+DRVPARAMS.wHeadsAndSectors] ; Or .dwMaximumLBA+2319 ret320 321 322 %ifdef MODULE_EBIOS323 ;--------------------------------------------------------------------324 ; StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX325 ; Parameters:326 ; BX:DX:AX: Total Sector Count327 ; CL: FLGL_DPT_LBA48 if LBA48 supported328 ; DS:DI: Ptr to Disk Parameter Table329 ; Returns:330 ; Nothing331 ; Corrupts registers:332 ; CL333 ;--------------------------------------------------------------------334 StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX:335 or cl, FLGL_DPT_LBA_AND_EBIOS_SUPPORTED336 and BYTE [di+DPT.bFlagsLow], ~FLGL_DPT_LBA48337 or [di+DPT.bFlagsLow], cl338 mov [di+DPT.twLbaSectors], ax339 mov [di+DPT.twLbaSectors+2], dx340 mov [di+DPT.twLbaSectors+4], bx341 ret342 %endif ; MODULE_EBIOS
Note:
See TracChangeset
for help on using the changeset viewer.