Changeset 535 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS
- Timestamp:
- Apr 8, 2013, 5:09:44 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm
r526 r535 43 43 mov BYTE [bp+IDEPACK.intpack+INTPACK.ah], EBIOS_VERSION 44 44 mov WORD [bp+IDEPACK.intpack+INTPACK.bx], 0AA55h 45 46 %ifdef RETURN_DPTE_ON_AH48H 47 call AH41h_GetSupportBitsToCX 48 mov [bp+IDEPACK.intpack+INTPACK.cx], cx 49 %else 45 50 mov WORD [bp+IDEPACK.intpack+INTPACK.cx], ENHANCED_DRIVE_ACCESS_SUPPORT 51 %endif 52 46 53 and BYTE [bp+IDEPACK.intpack+INTPACK.flags], ~FLG_FLAGS_CF ; Return with CF cleared 47 54 jmp Int13h_ReturnFromHandlerWithoutStoringErrorCode 48 55 .EbiosNotSupported: 49 56 jmp Int13h_DirectCallToAnotherBios 57 58 59 %ifdef RETURN_DPTE_ON_AH48H 60 ;-------------------------------------------------------------------- 61 ; AH41h_GetSupportBitsToCX 62 ; Parameters: 63 ; DS:DI: Ptr to DPT (in RAMVARS segment) 64 ; Returns: 65 ; CX: Support bits returned by AH=41h 66 ; Corrupts registers: 67 ; Nothing 68 ;-------------------------------------------------------------------- 69 AH41h_GetSupportBitsToCX: 70 mov cx, ENHANCED_DRIVE_ACCESS_SUPPORT 71 72 ; DPTE needs buffer from RAM so do not return it in lite mode 73 %ifndef USE_AT 74 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 75 jz SHORT .DoNotSetEDDflag 76 %endif 77 78 %ifdef MODULE_8BIT_IDE OR MODULE_SERIAL 79 ; DPTE contains information for device drivers. We should not return 80 ; DPTE for 8-bit devices since software would think they are 16-bit devices. 81 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ATA 82 jae SHORT .DoNotSetEDDflag 83 %endif 84 85 or cl, ENHANCED_DISK_DRIVE_SUPPORT ; AH=48h returns DPTE 86 .DoNotSetEDDflag: 87 ret 88 89 %endif ; RETURN_DPTE_ON_AH48H -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm
r533 r535 59 59 ; BIOS that does just that. 60 60 ; 61 ; Since I don't have any better knowledge, I decided that when RESERVE_DIAGNOSTIC_CYLINDER 62 ; is defined, we do what the Award BIOS does. When it is not defined, we multiply 63 ; P-CHS values together and use that as total sector count. 61 ; I decided that we multiply P-CHS values and do not waste space like the 62 ; Award BIOS does. 64 63 ; 65 64 ; … … 78 77 ;-------------------------------------------------------------------- 79 78 AH48h_HandlerForGetExtendedDriveParameters: 79 mov si, di 80 push ds 81 pop es ; ES = RAMVARS segment 82 xor bx, bx 83 dec bx ; Set to FFFFh to assume we do not return DPTE 84 85 ; Create DPTE (hardware information for device drivers) 86 %ifdef RETURN_DPTE_ON_AH48H 87 call AH41h_GetSupportBitsToCX 88 test cl, ENHANCED_DISK_DRIVE_SUPPORT 89 jz SHORT .DoNotCreateDPTE 90 call CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI 91 .DoNotCreateDPTE: 92 %endif 93 94 ; Point DS:DI to Extended Drive Information Table to fill 95 mov di, [bp+IDEPACK.intpack+INTPACK.si] 96 mov ds, [bp+IDEPACK.intpack+INTPACK.ds] 97 98 ; Check and adjust Extended Drive Information Table size 99 ; to MINIMUM_EDRIVEINFO_SIZE or EDRIVEINFO_SIZE_WITH_DPTE 100 mov ax, MINIMUM_EDRIVEINFO_SIZE 101 mov cx, [di+EDRIVE_INFO.wSize] 102 cmp cx, ax 103 jb Prepare_ReturnFromInt13hWithInvalidFunctionError 104 mov [di+EDRIVE_INFO.wSize], ax 105 add al, EDRIVEINFO_SIZE_WITH_DPTE - MINIMUM_EDRIVEINFO_SIZE 106 cmp cx, ax 107 jb SHORT .SkipEddConfigurationParameters 108 mov [di+EDRIVE_INFO.wSize], ax 109 110 ; Store DPTE for standard controllers only, 111 ; FFFF:FFFF for non standard controllers 112 %ifdef RETURN_DPTE_ON_AH48H 113 mov [di+EDRIVE_INFO.fpDPTE], bx 114 mov [di+EDRIVE_INFO.fpDPTE+2], es 115 inc bx 116 jnz SHORT .SkipEddConfigurationParameters ; Already stored 117 dec bx 118 mov [di+EDRIVE_INFO.fpDPTE+2], bx ; Segment = FFFFh 119 %else 120 mov [di+EDRIVE_INFO.fpDPTE], bx 121 mov [di+EDRIVE_INFO.fpDPTE+2], bx 122 %endif 123 124 ; Fill Extended Drive Information Table in DS:DI from DPT in ES:SI 125 .SkipEddConfigurationParameters: 126 mov WORD [di+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS 127 128 ; Store total sector count 129 call Registers_ExchangeDSSIwithESDI 80 130 call AccessDPT_GetLbaSectorCountToBXDXAX 81 82 ; Point DS:SI to Extended Drive Information Table to fill 83 push ds 84 pop es ; DPT now in ES:DI 85 mov ds, [bp+IDEPACK.intpack+INTPACK.ds] 86 mov cx, MINIMUM_EDRIVEINFO_SIZE 87 cmp [si+EDRIVE_INFO.wSize], cx 88 jb Prepare_ReturnFromInt13hWithInvalidFunctionError 89 je SHORT .SkipEddConfigurationParameters 90 91 ; We do not support EDD Configuration Parameters so set to FFFF:FFFFh 92 sub cx, BYTE MINIMUM_EDRIVEINFO_SIZE+1 ; CX => FFFFh 93 mov [si+EDRIVE_INFO.fpEDDparams], cx 94 mov [si+EDRIVE_INFO.fpEDDparams+2], cx 95 mov cx, EDRIVE_INFO_size 96 97 ; Fill Extended Drive Information Table in DS:SI 98 .SkipEddConfigurationParameters: 99 mov [si+EDRIVE_INFO.wSize], cx 100 mov WORD [si+EDRIVE_INFO.wFlags], FLG_DMA_BOUNDARY_ERRORS_HANDLED_BY_BIOS 101 102 ; Store total sector count 103 mov [si+EDRIVE_INFO.qwTotalSectors], ax 104 mov [si+EDRIVE_INFO.qwTotalSectors+2], dx 105 mov [si+EDRIVE_INFO.qwTotalSectors+4], bx 131 call Registers_ExchangeDSSIwithESDI 132 mov [di+EDRIVE_INFO.qwTotalSectors], ax 133 mov [di+EDRIVE_INFO.qwTotalSectors+2], dx 134 mov [di+EDRIVE_INFO.qwTotalSectors+4], bx 106 135 xor cx, cx 107 mov [ si+EDRIVE_INFO.qwTotalSectors+6], cx ; Always zero108 mov WORD [ si+EDRIVE_INFO.wSectorSize], 512136 mov [di+EDRIVE_INFO.qwTotalSectors+6], cx ; Always zero 137 mov WORD [di+EDRIVE_INFO.wSectorSize], 512 109 138 110 139 ; Store P-CHS. Based on phoenix specification this is returned only if … … 114 143 sbb bx, cx ; Zero 115 144 jnc SHORT .ReturnWithSuccess ; More than EC4000h 116 or WORD [ si+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID117 118 eMOVZX dx, BYTE [es: di+DPT.bPchsHeads]119 mov [ si+EDRIVE_INFO.dwHeads], dx120 mov [ si+EDRIVE_INFO.dwHeads+2], cx121 122 mov dl, [es: di+DPT.bPchsSectorsPerTrack]123 mov [ si+EDRIVE_INFO.dwSectorsPerTrack], dx124 mov [ si+EDRIVE_INFO.dwSectorsPerTrack+2], cx125 126 mov dx, [es: di+DPT.wPchsCylinders]127 mov [ si+EDRIVE_INFO.dwCylinders], dx128 mov [ si+EDRIVE_INFO.dwCylinders+2], cx145 or WORD [di+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID 146 147 eMOVZX dx, BYTE [es:si+DPT.bPchsHeads] 148 mov [di+EDRIVE_INFO.dwHeads], dx 149 mov [di+EDRIVE_INFO.dwHeads+2], cx 150 151 mov dl, [es:si+DPT.bPchsSectorsPerTrack] 152 mov [di+EDRIVE_INFO.dwSectorsPerTrack], dx 153 mov [di+EDRIVE_INFO.dwSectorsPerTrack+2], cx 154 155 mov dx, [es:si+DPT.wPchsCylinders] 156 mov [di+EDRIVE_INFO.dwCylinders], dx 157 mov [di+EDRIVE_INFO.dwCylinders+2], cx 129 158 130 159 .ReturnWithSuccess: … … 132 161 .ReturnWithError: 133 162 jmp Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH 163 164 165 %ifdef RETURN_DPTE_ON_AH48H 166 ;-------------------------------------------------------------------- 167 ; CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI 168 ; Parameters: 169 ; DS:SI: Ptr to DPT (in RAMVARS segment) 170 ; ES: RAMVARS segment 171 ; Returns: 172 ; ES:BX: Ptr to Device Parameter Table Extension (DPTE) 173 ; Corrupts registers: 174 ; AX, CX, DX, DI 175 ;-------------------------------------------------------------------- 176 CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI: 177 ; Point ES:DI to DPTE buffer (valid until next AH=48h call) 178 mov di, [cs:ROMVARS.bStealSize] 179 eSHL_IM di, 10 ; DI = RAMVARS size in bytes 180 sub di, BYTE DPTE_size ; DI = Offset to DPTE 181 xor dx, dx ; Clear for checksum 182 183 ; Set 32-bit flag for 32-bit controllers 184 mov cx, FLG_LBA_TRANSLATION_ENABLED ; DPTE.wFlags 185 cmp BYTE [si+DPT_ATA.bDevice], DEVICE_32BIT_ATA 186 eCMOVE cl, FLG_LBA_TRANSLATION_ENABLED | FLG_32BIT_XFER_MODE 187 188 ; DPTE.wBasePort 189 mov ax, [si+DPT.wBasePort] 190 call StoswThenAddALandAHtoDL ; Bytes 0 and 1 191 192 ; DPTE.wControlBlockPort 193 eMOVZX bx, BYTE [si+DPT.bIdevarsOffset] 194 mov ax, [cs:bx+IDEVARS.wControlBlockPort] 195 call StoswThenAddALandAHtoDL ; Bytes 2 and 3 196 197 ; DPTE.bDrvnhead and DPTE.bBiosVendor 198 xchg di, si 199 call AccessDPT_GetDriveSelectByteForEbiosToAL 200 xchg si, di 201 call StoswThenAddALandAHtoDL ; Bytes 4 and 5 202 203 ; DPTE.bIRQ and DPTE.bBlockSize 204 mov al, [cs:bx+IDEVARS.bIRQ] ; No way to define that we might not use IRQ 205 mov ah, [si+DPT_ATA.bBlockSize] 206 cmp ah, 1 207 jbe SHORT .DoNotSetBlockModeFlag 208 or cl, FLG_BLOCK_MODE_ENABLED 209 .DoNotSetBlockModeFlag: 210 call StoswThenAddALandAHtoDL ; Bytes 6 and 7 211 212 ; DPTE.bDmaChannelAndType and DPTE.bPioMode 213 xor ax, ax 214 %ifdef MODULE_ADVANCED_ATA 215 or ah, [si+DPT_ADVANCED_ATA.bPioMode] 216 jz SHORT .NoDotSetFastPioFlag 217 cmp WORD [si+DPT_ADVANCED_ATA.wControllerID], BYTE 0 218 je SHORT .NoDotSetFastPioFlag 219 inc cx ; FLG_FAST_PIO_ENABLED 220 .NoDotSetFastPioFlag: 221 %endif 222 call StoswThenAddALandAHtoDL ; Bytes 8 and 9 223 224 ; Set CHS translation flags and store DPTE.wFlags 225 mov al, [si+DPT.bFlagsLow] 226 and al, MASKL_DPT_TRANSLATEMODE 227 jz SHORT .NoChsTranslationOrBitShiftTranslationSet 228 or cl, FLG_CHS_TRANSLATION_ENABLED 229 test al, FLGL_DPT_ASSISTED_LBA 230 jz SHORT .NoChsTranslationOrBitShiftTranslationSet 231 or cx, LBA_ASSISTED_TRANSLATION << TRANSLATION_TYPE_FIELD_POSITION 232 .NoChsTranslationOrBitShiftTranslationSet: 233 xchg ax, cx 234 call StoswThenAddALandAHtoDL ; Bytes 10 and 11 235 236 ; DPTE.wReserved (must be zero) 237 xor ax, ax 238 call StoswThenAddALandAHtoDL ; Bytes 12 and 13 239 240 ; DPTE.bRevision and DPTE.bChecksum 241 mov ax, DPTE_REVISION | (DPTE_REVISION<<8) 242 add ah, dl 243 neg ah 244 stosw 245 lea bx, [di-DPTE_size] 246 ret 247 248 249 ;-------------------------------------------------------------------- 250 ; StoswThenAddALandAHtoDL 251 ; Parameters: 252 ; AX: WORD to store 253 ; ES:DI: Ptr to where to store AX 254 ; DL: Checksum byte 255 ; Returns: 256 ; DL: Checksum byte 257 ; DI: Incremented by 2 258 ; Corrupts registers: 259 ; Nothing 260 ;-------------------------------------------------------------------- 261 StoswThenAddALandAHtoDL: 262 stosw 263 add dl, al 264 add dl, ah 265 ret 266 267 %endif ; RETURN_DPTE_ON_AH48H
Note:
See TracChangeset
for help on using the changeset viewer.