- Timestamp:
- Apr 8, 2013, 5:09:44 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/EBIOS.inc
r526 r535 22 22 23 23 ; EBIOS specification returned by INT 13h, AH=41h 24 EBIOS_VERSION EQU 21h ; 21h = EDD version 1.1 24 25 EDD_V1_1 EQU 21h ; 21h = EDD version 1.1 26 EBIOS_VERSION EQU EDD_V1_1 25 27 26 28 ; Support bits returned by INT 13h, AH=41h … … 39 41 .qwTotalSectors resb 8 ; 16, Total number of addressable sectors 40 42 .wSectorSize resb 2 ; 24, Number of bytes per sector 41 .fp EDDparams resb 8 ; 26, Optional pointer to Enhanced Disk Drive (EDD) configuration parameters43 .fpDPTE resb 4 ; 26, Optional pointer to Device Parameter Table Extension 42 44 endstruc 43 45 44 46 MINIMUM_EDRIVEINFO_SIZE EQU 26 ; 26 bytes does not include EDD pointer 47 EDRIVEINFO_SIZE_WITH_DPTE EQU EDRIVE_INFO_size 45 48 46 49 ; Flags for EDRIVE_INFO.wFlags … … 52 55 FLG_LOCKABLE EQU (1<<5) ; Removable media only 53 56 FLG_NO_MEDIA_PRESENT_AND_CHS_SET_TO_MAX EQU (1<<6) ; Removable media only 57 58 59 ; Device Parameter Table Extension 60 struc DPTE 61 .wBasePort resb 2 ; 0, Command Block Base Port Address 62 .wControlBlockPort resb 2 ; 2, Control Block Base Port Address 63 .bDrvnhead resb 1 ; 4, Drive and Head Select Register upper nibble 64 .bBiosVendor resb 1 ; 5, BIOS Vendor Specific 65 .bIRQ resb 1 ; 6, IRQ for this device 66 .bBlockSize resb 1 ; 7, Current block size in sectors 67 .bDmaChannelAndType resb 1 ; 8, DMA information 68 .bPioMode resb 1 ; 9, PIO mode 69 .wFlags resb 2 ; 10, BIOS selected hardware specific option flags 70 .wReserved resb 2 ; 12, Reserved. Must be zero. 71 .bRevision resb 1 ; 14, Revision level of this table (11h) 72 .bChecksum resb 1 ; 15, Checksum, 2's complement of the sum of bytes 0-14 73 endstruc 74 75 ; Flags for DPTE.wFlags 76 FLG_FAST_PIO_ENABLED EQU (1<<0) ; Set is using PIO mode 1 or above (DPTE.bPioMode is valid when set) 77 FLG_DMA_ENABLED EQU (1<<1) ; Set if DMA enabled (DPTE.bDmaChannelAndType is valid when set) 78 FLG_BLOCK_MODE_ENABLED EQU (1<<2) ; Set if Block Mode transfers are enabled (DPTE.bBlockSize is valid when set) 79 FLG_CHS_TRANSLATION_ENABLED EQU (1<<3) ; Set for drives with more than 1024 cylinders 80 FLG_LBA_TRANSLATION_ENABLED EQU (1<<4) ; Set when LBA addersses from DAP are passed directly to the drive 81 FLG_REMOVABLE_MEDIA EQU (1<<5) 82 FLG_ATAPI_DEVICE EQU (1<<6) 83 FLG_32BIT_XFER_MODE EQU (1<<7) ; Set when using 32-bit data transfers 84 FLG_ATAPI_USES_IRQ EQU (1<<8) ; ATAPI Device uses IRQ for data transfers 85 ; L-CHS translation type for old INT 13h (when FLG_CHS_TRANSLATION_ENABLED is set) 86 MASK_CHS_TRANSLATION_TYPE EQU (3<<TRANSLATION_TYPE_FIELD_POSITION) 87 TRANSLATION_TYPE_FIELD_POSITION EQU 9 88 BIT_SHIFT_TRANSLATION EQU 0 ; LARGE 89 LBA_ASSISTED_TRANSLATION EQU 1 ; Assisted LBA 90 ; 2 = reserved 91 VENDOR_SPECIFIC_TRANSLATION EQU 3 92 93 94 DPTE_REVISION EQU 11h 54 95 55 96 -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r526 r535 183 183 MASK_DRVPARAMS_TRANSLATEMODE EQU (3<<TRANSLATEMODE_FIELD_POSITION) ; Bits 2...3, Position shared with DPT 184 184 TRANSLATEMODE_FIELD_POSITION EQU 2 185 TRANSLATEMODE_NORMAL EQU 0 185 TRANSLATEMODE_NORMAL EQU 0 ; Must be zero 186 186 TRANSLATEMODE_LARGE EQU 1 187 187 TRANSLATEMODE_ASSISTED_LBA EQU 2 ; 28-bit or 48-bit LBA -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
r526 r535 26 26 ; DS:DI: Ptr to DPT (in RAMVARS segment) 27 27 ; Returns: 28 ; CF: Set if wait done by operating system 29 ; Cleared if BIOS must perform task flag polling 28 ; Nothing 30 29 ; Corrupts registers: 31 30 ; AX … … 33 32 ALIGN JUMP_ALIGN 34 33 IdeIrq_WaitForIRQ: 35 36 ;--------------------------------------------------------------------37 ; .NotifyOperatingSystemAboutWaitingForIRQ38 ; Parameters:39 ; Nothing40 ; Returns:41 ; CF: Set if wait done by operating system42 ; Cleared if BIOS must perform task flag polling43 ; Corrupts registers:44 ; AX45 ;--------------------------------------------------------------------46 .NotifyOperatingSystemAboutWaitingForIRQ:47 34 push ds 48 35 … … 53 40 jc SHORT .ReturnFromWaitNotify ; If so, skip OS notification 54 41 int BIOS_SYSTEM_INTERRUPT_15h ; OS hook, device busy 55 jnc SHORT .ReturnFromWaitNotify ; CF cleared, BIOS handles waiting56 42 57 ; Make sure that OS hooks are supported, otherwise the CF means unsupported function58 test ah, ah ; OS hook supported? (clears CF)59 jnz SHORT .ReturnFromWaitNotify ; AH has error, BIOS must do the wait60 stc ; Set CF since wait done by OS61 43 .ReturnFromWaitNotify: 62 44 sti ; Enable interrupts … … 99 81 100 82 ; Issue Int 15h, function AX=9100h (Interrupt ready) 83 clc ; Must be called with CF clear 101 84 mov ax, OS_HOOK_DEVICE_POST<<8 ; Interrupt ready, device 0 (HD) 102 85 int BIOS_SYSTEM_INTERRUPT_15h -
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 -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm
r533 r535 120 120 mov [di+DPT.bPchsSectorsPerTrack], bh 121 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 122 126 %ifdef RESERVE_DIAGNOSTIC_CYLINDER 123 127 ; Do not store P-Cylinders, instead calculate it from L-CHS total sector count. … … 130 134 div bx ; AX = Calculated cylinders 131 135 %endif ; RESERVE_DIAGNOSTIC_CYLINDER 136 %endif ; 0 132 137 133 138 mov [di+DPT.wPchsCylinders], ax -
trunk/XTIDE_Universal_BIOS/makefile
r530 r535 32 32 # RELOCATE_INT13H_STACK ** Relocates INT 13h stack to beginning of stolen conventional memory # 33 33 # RESERVE_DIAGNOSTIC_CYLINDER Reserve one L-CHS cylinder for compatibility with old BIOSes # 34 # RETURN_DPTE_ON_AH48H Returns extra hardware related information on AH=48h for OS drivers # 34 35 # USE_186 Use instructions supported by 80188/80186 and V20/V30 and later # 35 36 # USE_286 Use instructions supported by 286 and later (defines USE_UNDOC_INTEL)# … … 110 111 111 112 DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE 112 DEFINES_386_8K = $(DEFINES_AT) USE_386 113 DEFINES_386_8K = $(DEFINES_AT) USE_386 RETURN_DPTE_ON_AH48H 113 114 114 115 DEFINES_ALL_FEATURES = MODULE_8BIT_IDE MODULE_8BIT_IDE_ADVANCED MODULE_ADVANCED_ATA MODULE_EBIOS MODULE_BOOT_MENU MODULE_HOTKEYS MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_STRINGS_COMPRESSED MODULE_FEATURE_SETS
Note:
See TracChangeset
for help on using the changeset viewer.