Changeset 400 in xtideuniversalbios
- Timestamp:
- Apr 20, 2012, 2:30:16 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 2 added
- 3 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
r399 r400 49 49 50 50 ; Bit definitions for DPT.bFlagsHigh 51 FLGH_DPT_REVERSED_A0_AND_A3 EQU (1<<0) ; XTIDE mod, Address lines 0 and 3 reversed52 51 FLGH_DPT_BLOCK_MODE_SUPPORTED EQU (1<<1) ; Use block transfer commands (must be bit 1!) 53 52 FLGH_DPT_SERIAL_DEVICE EQU (1<<2) ; Serial Port Device … … 75 74 .dpt resb DPT_size 76 75 .bBlockSize resb 1 ; Current block size in sectors (do not set to zero!) 77 .b InitError resb 176 .bDevice resb 1 ; Device Type from IDEVARS (overrided when 32-bit controller detected) 78 77 endstruc 79 78 80 81 ; Flags for DPT_ATA.bInitError82 FLG_INITERROR_FAILED_TO_SELECT_DRIVE EQU (1<<0)83 FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS EQU (1<<1)84 FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE EQU (1<<2)85 FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE EQU (1<<3)86 FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE EQU (1<<4)87 FLG_INITERROR_FAILED_TO_SET_PIO_MODE EQU (1<<5)88 FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER EQU (1<<6)89 79 90 80 ; Additional variables needed to initialize and reset Advanced IDE Controllers. … … 97 87 .wMinPioCycleTime resb 2 ; Minimum PIO Cycle Time in ns 98 88 .bPioMode resb 1 ; Best supported PIO mode 99 .b Device resb 1 ; Device Type from IDEVARS (overrided when 32-bit controller detected)89 .bInitError resb 1 ; Flags for initialization errors 100 90 endstruc 101 91 %endif 92 93 ; Flags for DPT_ADVANCED_ATA.bInitError 94 FLG_INITERROR_FAILED_TO_SELECT_DRIVE EQU (1<<0) 95 FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS EQU (1<<1) 96 FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE EQU (1<<2) 97 FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE EQU (1<<3) 98 FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE EQU (1<<4) 99 FLG_INITERROR_FAILED_TO_SET_PIO_MODE EQU (1<<5) 100 FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER EQU (1<<6) 102 101 103 102 -
trunk/XTIDE_Universal_BIOS/Inc/DeviceIDE.inc
r376 r400 26 26 27 27 ; Polling timeout delays (system timer ticks, 1 tick = 54.9 ms) 28 TIMEOUT_BSY EQU (2000/55) ; 2000 ms29 TIMEOUT_DRDY EQU (2000/55) ; 2000 ms30 28 TIMEOUT_DRQ EQU 255 ; 14 s (some CF cards occasionally have long write delays) 31 29 TIMEOUT_IDENTIFY_DEVICE EQU (500/55) ; 500 ms 32 30 TIMEOUT_MOTOR_STARTUP EQU (10000/55) ; 10 s 33 31 32 %ifdef MODULE_FEATURE_SETS 33 TIMEOUT_BSY EQU TIMEOUT_MOTOR_STARTUP 34 TIMEOUT_DRDY EQU TIMEOUT_MOTOR_STARTUP 35 %else 36 TIMEOUT_BSY EQU (2000/55) ; 2000 ms 37 TIMEOUT_DRDY EQU (2000/55) ; 2000 ms 38 %endif 34 39 35 40 %endif ; DEVICEIDE_INC -
trunk/XTIDE_Universal_BIOS/Inc/ModuleDependency.inc
r398 r400 32 32 %endif 33 33 34 %ifdef MODULE_JRIDE 35 %ifndef MODULE_8BIT_IDE 36 %define MODULE_8BIT_IDE 37 %endif 38 %endif 39 34 40 35 41 36 42 ; Include module specific .INC files 43 %ifdef MODULE_8BIT_IDE 44 %include "IDE_8bit.inc" ; For IDE 8-bit data port macros 45 %endif 46 37 47 %ifdef MODULE_ADVANCED_ATA 38 48 %include "Vision.inc" ; For QDI Vision QD65xx VLB IDE Controllers … … 57 67 58 68 ; Included modules for ROMVARS.wFlags 69 %ifdef MODULE_8BIT_IDE 70 MAIN_FLG_MODULE_8BIT_IDE EQU FLG_ROMVARS_MODULE_8BIT_IDE 71 %else 72 MAIN_FLG_MODULE_8BIT_IDE EQU 0 73 %endif 74 59 75 %ifdef MODULE_ADVANCED_ATA 60 76 MAIN_FLG_MODULE_ADVANCED_ATA EQU FLG_ROMVARS_MODULE_ADVANCED_ATA … … 111 127 %endif 112 128 113 MASK_ROMVARS_INCLUDED_MODULES EQU MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED 129 %ifdef MODULE_FEATURE_SETS 130 MAIN_FLG_MODULE_FEATURE_SETS EQU FLG_ROMVARS_MODULE_FEATURE_SETS 131 %else 132 MAIN_FLG_MODULE_FEATURE_SETS EQU 0 133 %endif 134 135 MASK_ROMVARS_INCLUDED_MODULES EQU MAIN_FLG_MODULE_8BIT_IDE | MAIN_FLG_MODULE_ADVANCED_ATA | MAIN_FLG_MODULE_BOOT_MENU | MAIN_FLG_MODULE_EBIOS | MAIN_FLG_MODULE_HOTKEYS | MAIN_FLG_MODULE_IRQ | MAIN_FLG_MODULE_JRIDE | MAIN_FLG_MODULE_SERIAL | MAIN_FLG_MODULE_SERIAL_FLOPPY | MAIN_FLG_MODULE_STRINGS_COMPRESSED | MAIN_FLG_MODULE_FEATURE_SETS -
trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc
r376 r400 22 22 23 23 ; Segment when RAMVARS is stored to top of interrupt vectors. 24 %ifndef USE_AT 24 25 LITE_MODE_RAMVARS_SEGMENT EQU 30h 26 %endif 25 27 26 28 -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r398 r400 70 70 ; (Conveniently, this is 8, a fact we exploit when testing the bit) 71 71 72 FLG_ROMVARS_MODULE_ADVANCED_ATA EQU (1<<7) ; Here in case the configuration needs to know functionality is present 73 FLG_ROMVARS_MODULE_BOOT_MENU EQU (1<<8) ; Here in case the configuration needs to know functionality is present 74 FLG_ROMVARS_MODULE_EBIOS EQU (1<<9) ; Here in case the configuration needs to know functionality is present 75 FLG_ROMVARS_MODULE_HOTKEYS EQU (1<<10) ; Here in case the configuration needs to know functionality is present 76 FLG_ROMVARS_MODULE_IRQ EQU (1<<11) ; Here in case the configuration needs to know functionality is present 77 FLG_ROMVARS_MODULE_JRIDE EQU (1<<12) ; Here in case the configuration needs to know functionality is present 78 FLG_ROMVARS_MODULE_SERIAL EQU (1<<13) ; Here in case the configuration needs to know functionality is present 79 FLG_ROMVARS_MODULE_SERIAL_FLOPPY EQU (1<<14) ; Here in case the configuration needs to know functionality is present 80 FLG_ROMVARS_MODULE_STRINGS_COMPRESSED EQU (1<<15) ; Here in case the configuration needs to know functionality is present 72 ; Here in case the configuration needs to know functionality is present 73 FLG_ROMVARS_MODULE_FEATURE_SETS EQU (1<<5) 74 FLG_ROMVARS_MODULE_8BIT_IDE EQU (1<<6) 75 FLG_ROMVARS_MODULE_JRIDE EQU (1<<7) 76 FLG_ROMVARS_MODULE_ADVANCED_ATA EQU (1<<8) 77 FLG_ROMVARS_MODULE_BOOT_MENU EQU (1<<9) 78 FLG_ROMVARS_MODULE_EBIOS EQU (1<<10) 79 FLG_ROMVARS_MODULE_HOTKEYS EQU (1<<11) 80 FLG_ROMVARS_MODULE_IRQ EQU (1<<12) 81 FLG_ROMVARS_MODULE_SERIAL EQU (1<<13) 82 FLG_ROMVARS_MODULE_SERIAL_FLOPPY EQU (1<<14) 83 FLG_ROMVARS_MODULE_STRINGS_COMPRESSED EQU (1<<15) 81 84 82 85 … … 119 122 ; 120 123 DEVICE_XTIDE_DEFAULT_PORT EQU 300h 121 DEVICE_XTIDE_DEFAULT_PORTCTRL EQU DEVICE_XTIDE_DEFAULT_PORT + 8h124 DEVICE_XTIDE_DEFAULT_PORTCTRL EQU (DEVICE_XTIDE_DEFAULT_PORT + 8h) 122 125 123 126 DEVICE_ATA_PRIMARY_PORT EQU 1F0h 124 DEVICE_ATA_PRIMARY_PORTCTRL EQU DEVICE_ATA_PRIMARY_PORT + 200h127 DEVICE_ATA_PRIMARY_PORTCTRL EQU (DEVICE_ATA_PRIMARY_PORT + 200h) 125 128 126 129 DEVICE_ATA_SECONDARY_PORT EQU 170h 127 DEVICE_ATA_SECONDARY_PORTCTRL EQU DEVICE_ATA_SECONDARY_PORT + 200h130 DEVICE_ATA_SECONDARY_PORTCTRL EQU (DEVICE_ATA_SECONDARY_PORT + 200h) 128 131 129 132 DEVICE_ATA_TERTIARY_PORT EQU 1E8h 130 DEVICE_ATA_TERTIARY_PORTCTRL EQU DEVICE_ATA_TERTIARY_PORT + 200h133 DEVICE_ATA_TERTIARY_PORTCTRL EQU (DEVICE_ATA_TERTIARY_PORT + 200h) 131 134 132 135 DEVICE_ATA_QUATERNARY_PORT EQU 168h 133 DEVICE_ATA_QUATERNARY_PORTCTRL EQU DEVICE_ATA_QUATERNARY_PORT + 200h136 DEVICE_ATA_QUATERNARY_PORTCTRL EQU (DEVICE_ATA_QUATERNARY_PORT + 200h) 134 137 135 138 136 139 ; Device types for IDEVARS.bDevice 137 140 ; 138 DEVICE_XTIDE_REV1 EQU (0<<1) 139 DEVICE_XTIDE_REV2 EQU (1<<1) ; Or rev 1 with swapped A0 and A3 (chuck mod) 140 DEVICE_FAST_XTIDE EQU (2<<1) ; (CPLD v2 project) 141 DEVICE_16BIT_ATA EQU (3<<1) 142 DEVICE_32BIT_ATA EQU (4<<1) 143 DEVICE_SERIAL_PORT EQU (5<<1) 144 DEVICE_JRIDE_ISA EQU (6<<1) 141 DEVICE_8BIT_JRIDE_ISA EQU (0<<1) ; JR-IDE/ISA (must be 0) 142 DEVICE_8BIT_FAST_XTIDE EQU (1<<1) ; CPLD v2 project (must be 1 or 2) 143 DEVICE_8BIT_XTIDE_REV2 EQU (2<<1) ; Or rev 1 with swapped A0 and A3 (must be 1 or 2) 144 DEVICE_8BIT_XTIDE_REV1 EQU (3<<1) ; Must be 4 145 COUNT_OF_8BIT_IDE_DEVICES EQU 4 146 147 DEVICE_16BIT_ATA EQU (COUNT_OF_8BIT_IDE_DEVICES<<1) 148 DEVICE_32BIT_ATA EQU ((COUNT_OF_8BIT_IDE_DEVICES+1)<<1) 149 COUNT_OF_16BIT_IDE_DEVICES EQU 2 150 COUNT_OF_ALL_IDE_DEVICES EQU (COUNT_OF_8BIT_IDE_DEVICES + COUNT_OF_16BIT_IDE_DEVICES) 151 152 DEVICE_SERIAL_PORT EQU (COUNT_OF_ALL_IDE_DEVICES<<1) 153 145 154 146 155 -
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r376 r400 27 27 %endmacro 28 28 29 %macro CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE 130 xchg ax, bx31 eMOVZX bx, [di+DPT.bIdevarsOffset]32 cmp BYTE [cs:bx+IDEVARS.bDevice], DEVICE_JRIDE_ISA33 xchg bx, ax ; Restore BX34 je SHORT %135 %endmacro36 37 29 %macro CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF 2 38 30 cmp BYTE [cs:bp+IDEVARS.bDevice], %1 … … 53 45 ; AX, BX, CX, DX 54 46 ;-------------------------------------------------------------------- 55 %ifdef MODULE_SERIAL 47 %ifdef MODULE_SERIAL ; IDE + Serial 56 48 Device_FinalizeDPT: 57 49 ; needs to check IDEVARS vs. checking the DPT as the serial bit in the DPT is set in the Finalize routine 58 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF 50 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .FinalizeDptForSerialPortDevice 59 51 jmp IdeDPT_Finalize 60 52 .FinalizeDptForSerialPortDevice: 61 53 jmp SerialDPT_Finalize 62 54 63 %else ; IDE or JR-IDE/ISA64 Device_FinalizeDPT EQUIdeDPT_Finalize55 %else ; IDE 56 Device_FinalizeDPT EQU IdeDPT_Finalize 65 57 %endif 66 58 … … 76 68 ; AL, BX, CX, DX 77 69 ;-------------------------------------------------------------------- 78 %ifdef MODULE_JRIDE 79 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 80 Device_ResetMasterAndSlaveController: 81 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 82 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE 83 jmp IdeCommand_ResetMasterAndSlaveController 84 85 %else ; IDE + JR-IDE/ISA 86 Device_ResetMasterAndSlaveController: 87 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE 88 jmp IdeCommand_ResetMasterAndSlaveController 89 %endif 90 91 %elifdef MODULE_SERIAL ; IDE + Serial 70 %ifdef MODULE_SERIAL ; IDE + Serial 92 71 Device_ResetMasterAndSlaveController: 93 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE 72 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 94 73 jmp IdeCommand_ResetMasterAndSlaveController 95 74 96 %else ; IDE 97 Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController 98 %endif 99 100 %ifdef MODULE_JRIDE 101 .ResetJrIDE: 102 jmp MemIdeCommand_ResetMasterAndSlaveController 75 %else ; IDE 76 Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController 103 77 %endif 104 78 … … 117 91 ; AL, BL, CX, DX, SI, DI, ES 118 92 ;-------------------------------------------------------------------- 119 %ifdef MODULE_JRIDE 120 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 121 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH: 122 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort 123 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde 124 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 125 126 %else ; IDE + JR-IDE/ISA 127 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH: 128 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde 129 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 130 %endif 131 132 %elifdef MODULE_SERIAL ; IDE + Serial 93 %ifdef MODULE_SERIAL ; IDE + Serial 133 94 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH: 134 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF 95 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort 135 96 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 136 137 %else ; IDE138 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH139 %endif140 141 %ifdef MODULE_JRIDE142 .IdentifyDriveFromJrIde:143 jmp MemIdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH144 %endif145 146 %ifdef MODULE_SERIAL147 97 .IdentifyDriveFromSerialPort: 148 98 jmp SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 99 100 %else ; IDE 101 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 149 102 %endif 150 103 … … 165 118 ; AL, BX, (CX), DX, (ES:SI for data transfer commands) 166 119 ;-------------------------------------------------------------------- 167 %ifdef MODULE_JRIDE 168 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 169 Device_OutputCommandWithParameters: 170 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort 171 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE 172 jmp IdeCommand_OutputWithParameters 173 174 %else ; IDE + JR-IDE/ISA 175 Device_OutputCommandWithParameters: 176 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE 177 jmp IdeCommand_OutputWithParameters 178 %endif 179 180 %elifdef MODULE_SERIAL ; IDE + Serial 120 %ifdef MODULE_SERIAL ; IDE + Serial 121 ALIGN JUMP_ALIGN 181 122 Device_OutputCommandWithParameters: 182 123 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort 183 124 jmp IdeCommand_OutputWithParameters 184 125 185 %else ; IDE186 Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters187 %endif188 189 %ifdef MODULE_JRIDE190 ALIGN JUMP_ALIGN191 .OutputCommandToJrIDE:192 jmp MemIdeCommand_OutputWithParameters193 %endif194 195 %ifdef MODULE_SERIAL196 126 ALIGN JUMP_ALIGN 197 127 .OutputCommandToSerialPort: 198 128 jmp SerialCommand_OutputWithParameters 129 130 %else ; IDE 131 Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters 199 132 %endif 200 133 … … 211 144 ; AL, BX, CX, DX 212 145 ;-------------------------------------------------------------------- 213 %ifdef MODULE_JRIDE 214 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 215 Device_SelectDrive: 216 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 217 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive 218 jmp IdeCommand_SelectDrive 219 220 %else ; IDE + JR-IDE/ISA 221 Device_SelectDrive: 222 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive 223 jmp IdeCommand_SelectDrive 224 %endif 225 226 %elifdef MODULE_SERIAL ; IDE + Serial 146 %ifdef MODULE_SERIAL ; IDE + Serial 227 147 Device_SelectDrive: 228 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE 148 TEST_USING_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 229 149 jmp IdeCommand_SelectDrive 230 150 231 %else 232 Device_SelectDrive EQUIdeCommand_SelectDrive151 %else ; IDE 152 Device_SelectDrive EQU IdeCommand_SelectDrive 233 153 %endif 234 154 235 %ifdef MODULE_JRIDE236 ALIGN JUMP_ALIGN237 .SelectJrIdeDrive:238 jmp MemIdeCommand_SelectDrive239 %endif240 155 241 156 %ifdef MODULE_SERIAL -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r376 r400 31 31 ; AL, BX, CX, DX 32 32 ;-------------------------------------------------------------------- 33 I DEDEVICE%+Command_ResetMasterAndSlaveController:33 IdeCommand_ResetMasterAndSlaveController: 34 34 ; HSR0: Set_SRST 35 35 call AccessDPT_GetDeviceControlByteToAL … … 49 49 ; HSR2: Check_status 50 50 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) 51 jmp I DEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH51 jmp IdeWait_PollStatusFlagInBLwithTimeoutInBH 52 52 53 53 … … 65 65 ; AL, BL, CX, DX, SI, DI, ES 66 66 ;-------------------------------------------------------------------- 67 I DEDEVICE%+Command_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:67 IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH: 68 68 ; Create fake DPT to be able to use Device.asm functions 69 69 call FindDPT_ForNewDriveToDSDI … … 72 72 mov [di+DPT.bIdevarsOffset], bp 73 73 mov BYTE [di+DPT_ATA.bBlockSize], 1 ; Block = 1 sector 74 %ifdef MODULE_ADVANCED_ATA75 74 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI 76 %endif77 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS78 call IdeDPT_StoreReversedAddressLinesFlagIfNecessary79 %endif80 75 81 76 ; Wait until drive motors have reached max speed 82 77 cmp bp, BYTE ROMVARS.ideVars0 83 78 jne SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 84 test al, FLG_DRVNHEAD_DRV79 test bh, FLG_DRVNHEAD_DRV 85 80 jnz SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 86 81 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) 87 call I DEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH82 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 88 83 .SkipLongWaitSinceDriveIsNotPrimaryMaster: 89 84 … … 120 115 ;-------------------------------------------------------------------- 121 116 ALIGN JUMP_ALIGN 122 I DEDEVICE%+Command_OutputWithParameters:117 IdeCommand_OutputWithParameters: 123 118 push bx ; Store status register bits to poll 124 119 125 120 ; Select Master or Slave drive and output head number or LBA28 top bits 126 call I DEDEVICE%+Command_SelectDrive121 call IdeCommand_SelectDrive 127 122 jc SHORT .DriveNotReady 128 123 129 124 ; Output Device Control Byte to enable or disable interrupts 130 125 mov al, [bp+IDEPACK.bDeviceControl] 131 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA126 %ifdef MODULE_IRQ 132 127 test al, FLG_DEVCONTROL_nIEN ; Interrupts disabled? 133 128 jnz SHORT .DoNotSetInterruptInServiceFlag … … 151 146 eMOVZX ax, [bp+IDEPACK.bLbaLowExt] ; Zero sector count 152 147 mov cx, [bp+IDEPACK.wLbaMiddleAndHighExt] 153 call IDEDEVICE%+OutputSectorCountAndAddress148 call OutputSectorCountAndAddress 154 149 %endif 155 150 … … 157 152 mov ax, [bp+IDEPACK.wSectorCountAndLbaLow] 158 153 mov cx, [bp+IDEPACK.wLbaMiddleAndHigh] 159 call IDEDEVICE%+OutputSectorCountAndAddress154 call OutputSectorCountAndAddress 160 155 161 156 ; Output command … … 164 159 165 160 ; Wait until command completed 166 pop bx ; Pop status and timeout for polling 167 cmp bl, FLG_STATUS_DRQ ; Data transfer started? 168 je SHORT IDEDEVICE%+Transfer_StartWithCommandInAL 161 pop bx ; Pop status and timeout for polling 162 cmp bl, FLG_STATUS_DRQ ; Data transfer started? 163 jne SHORT .WaitUntilNonTransferCommandCompletes 164 %ifdef MODULE_JRIDE 165 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA 166 je SHORT JrIdeTransfer_StartWithCommandInAL 167 %endif 168 jmp IdeTransfer_StartWithCommandInAL 169 170 .WaitUntilNonTransferCommandCompletes: 171 %ifdef MODULE_IRQ 169 172 test BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN 170 jz SHORT .WaitForIrqOrRdy 171 jmp IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 172 173 ALIGN JUMP_ALIGN 174 .WaitForIrqOrRdy: 175 jmp IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH 173 jz SHORT .PollStatusFlagInsteadOfWaitIrq 174 jmp IdeWait_IRQorStatusFlagInBLwithTimeoutInBH 175 .PollStatusFlagInsteadOfWaitIrq: 176 %endif 177 jmp IdeWait_PollStatusFlagInBLwithTimeoutInBH 176 178 177 179 .DriveNotReady: … … 192 194 ;-------------------------------------------------------------------- 193 195 ALIGN JUMP_ALIGN 194 IDEDEVICE%+Command_SelectDrive: 195 ; Wait until neither Master or Slave Drive is busy. 196 ; I don't think this wait is necessary. 197 ;mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 198 ;cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 199 ;eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 200 ;call IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 201 196 IdeCommand_SelectDrive: 202 197 ; Select Master or Slave Drive 203 198 mov al, [bp+IDEPACK.bDrvAndHead] … … 206 201 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 207 202 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 208 call I DEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH203 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 209 204 210 205 ; Ignore errors from IDE Error Register (set by previous command) … … 232 227 ;-------------------------------------------------------------------- 233 228 ALIGN JUMP_ALIGN 234 IDEDEVICE%+OutputSectorCountAndAddress:229 OutputSectorCountAndAddress: 235 230 OUTPUT_AL_TO_IDE_REGISTER SECTOR_COUNT_REGISTER 236 231 -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDPT.asm
r399 r400 66 66 %ifdef MODULE_ADVANCED_ATA 67 67 ;-------------------------------------------------------------------- 68 ; .StoreDeviceType69 ; Parameters:70 ; DS:DI: Ptr to Disk Parameter Table71 ; ES:SI: Ptr to 512-byte ATA information read from the drive72 ; CS:BP: Ptr to IDEVARS for the controller73 ; Returns:74 ; Nothing75 ; Corrupts registers:76 ; Nothing77 ;--------------------------------------------------------------------78 .StoreDeviceType:79 call IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI80 81 ;--------------------------------------------------------------------82 68 ; .StorePioModeAndTimings 83 69 ; Parameters: … … 124 110 ; it might have been set to 16-bit on IDEVARS 125 111 .ChangeTo32bitDevice: 126 mov BYTE [di+DPT_A DVANCED_ATA.bDevice], DEVICE_32BIT_ATA112 mov BYTE [di+DPT_ATA.bDevice], DEVICE_32BIT_ATA 127 113 128 114 .NoAdvancedControllerDetected: 115 ; Fall to IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI 129 116 130 %endif ; MODULE_ADVANCED_ATA 131 132 ;-------------------------------------------------------------------- 133 ; IdeDPT_StoreReversedAddressLinesFlagIfNecessary 134 ; Parameters: 135 ; DS:DI: Ptr to Disk Parameter Table 136 ; CS:BP: Ptr to IDEVARS for the controller 137 ; Returns: 138 ; CF: Always clear 139 ; Corrupts registers: 140 ; Nothing 141 ;-------------------------------------------------------------------- 142 IdeDPT_StoreReversedAddressLinesFlagIfNecessary: 143 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_XTIDE_REV2 144 je SHORT .SetFlagForSwappedA0andA3 145 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_FAST_XTIDE 146 jne SHORT .EndDPT 147 .SetFlagForSwappedA0andA3: 148 or BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 149 .EndDPT: 150 clc 151 ret 117 %endif ; MODULE_ADVANCED_ATA 152 118 153 119 154 %ifdef MODULE_ADVANCED_ATA155 120 ;-------------------------------------------------------------------- 156 121 ; IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI … … 165 130 IdeDPT_StoreDeviceTypeFromIdevarsInCSBPtoDPTinDSDI: 166 131 mov al, [cs:bp+IDEVARS.bDevice] 167 mov [di+DPT_ADVANCED_ATA.bDevice], al 132 mov [di+DPT_ATA.bDevice], al 133 ; End DPT 134 clc 168 135 ret 169 170 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
r376 r400 34 34 ;-------------------------------------------------------------------- 35 35 ALIGN JUMP_ALIGN 36 I DEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:36 IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL: 37 37 mov ah, al ; IDE Status Register to AH 38 38 INPUT_TO_AL_FROM_IDE_REGISTER ERROR_REGISTER_in 39 40 %ifndef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA41 jmp ContinueFromMemIdeError42 %else43 ContinueFromMemIdeError:44 39 xchg al, ah ; Status Register now in AL, Error Register now in AH 45 46 ; I don't think anything actually reads these from BDA47 ;push ds48 ;LOAD_BDA_SEGMENT_TO ds, dx49 ;mov [HDBDA.wHDStAndErr], ax50 ;pop ds51 52 40 ; Fall to GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX 53 41 … … 112 100 db RET_HD_BADSECTOR ; Bit7=BBK, Bad Block Detected 113 101 db RET_HD_STATUSERR ; When Error Register is zero 114 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
r376 r400 23 23 ;-------------------------------------------------------------------- 24 24 ; IdeIO_OutputALtoIdeControlBlockRegisterInDL 25 ; Parameters: 26 ; AL: Byte to output 27 ; DL: IDE Control Block Register 28 ; DS:DI: Ptr to DPT (in RAMVARS segment) 29 ; Returns: 30 ; Nothing 31 ; Corrupts registers: 32 ; BX, DX 33 ;-------------------------------------------------------------------- 34 IdeIO_OutputALtoIdeControlBlockRegisterInDL: 35 %ifdef MODULE_8BIT_IDE 36 mov dh, [di+DPT_ATA.bDevice] 37 %ifdef MODULE_JRIDE 38 test dh, dh 39 jnz SHORT .OutputToIoMappedIde 40 41 add dx, JRIDE_CONTROL_BLOCK_REGISTER_WINDOW_OFFSET 42 jmp SHORT OutputToJrIdeRegister 43 .OutputToIoMappedIde: 44 %endif 45 %endif 46 47 mov bl, IDEVARS.wPortCtrl 48 jmp SHORT OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL 49 50 51 ;-------------------------------------------------------------------- 25 52 ; IdeIO_OutputALtoIdeRegisterInDL 26 53 ; Parameters: 27 54 ; AL: Byte to output 28 ; DL: IDE Control Block Register (IdeIO_OutputALtoIdeControlBlockRegisterInDL) 29 ; IDE Register (IdeIO_OutputALtoIdeRegisterInDL) 55 ; DL: IDE Command Block Register 30 56 ; DS:DI: Ptr to DPT (in RAMVARS segment) 31 57 ; Returns: … … 35 61 ;-------------------------------------------------------------------- 36 62 ALIGN JUMP_ALIGN 37 IdeIO_OutputALtoIdeControlBlockRegisterInDL: 38 mov bl, IDEVARS.wPortCtrl 39 SKIP2B f ; cmp ax, <next instruction> 40 ; Fall to IdeIO_OutputALtoIdeRegisterInDL 63 IdeIO_OutputALtoIdeRegisterInDL: 64 %ifdef MODULE_8BIT_IDE 65 mov dh, [di+DPT_ATA.bDevice] 66 %ifdef MODULE_JRIDE 67 test dh, dh 68 jnz SHORT OutputALtoIOmappedIdeRegisterInDL 41 69 42 IdeIO_OutputALtoIdeRegisterInDL: 70 add dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET 71 OutputToJrIdeRegister: 72 mov bx, dx 73 mov [cs:bx], al 74 ret 75 ALIGN JUMP_ALIGN 76 OutputALtoIOmappedIdeRegisterInDL: 77 %endif 78 %endif 79 43 80 mov bl, IDEVARS.wPort 44 call GetPortToDXandTranslateA0andA3ifNecessary 81 OutputALtoIdeRegisterInDLwithIdevarsOffsetToBasePortInBL: 82 call GetIdePortToDX 45 83 out dx, al 46 84 ret 47 85 86 87 ;-------------------------------------------------------------------- 88 ; IdeIO_InputStatusRegisterToAL 89 ; Parameters: 90 ; DS:DI: Ptr to DPT (in RAMVARS segment) 91 ; Returns: 92 ; AL: IDE Status Register contents 93 ; Corrupts registers: 94 ; BX, DX 95 ;-------------------------------------------------------------------- 96 ALIGN JUMP_ALIGN 97 IdeIO_InputStatusRegisterToAL: 98 mov dl, STATUS_REGISTER_in 99 ; Fall to IdeIO_InputToALfromIdeRegisterInDL 48 100 49 101 ;-------------------------------------------------------------------- … … 57 109 ; BX, DX 58 110 ;-------------------------------------------------------------------- 59 ALIGN JUMP_ALIGN60 111 IdeIO_InputToALfromIdeRegisterInDL: 112 %ifdef MODULE_8BIT_IDE 113 mov dh, [di+DPT_ATA.bDevice] 114 %ifdef MODULE_JRIDE 115 test dh, dh 116 jnz SHORT .InputToALfromIOmappedIdeRegisterInDL 117 118 add dx, JRIDE_COMMAND_BLOCK_REGISTER_WINDOW_OFFSET 119 mov bx, dx 120 mov al, [cs:bx] 121 ret 122 .InputToALfromIOmappedIdeRegisterInDL: 123 %endif 124 %endif 61 125 mov bl, IDEVARS.wPort 62 call Get PortToDXandTranslateA0andA3ifNecessary126 call GetIdePortToDX 63 127 in al, dx 64 128 ret … … 66 130 67 131 ;-------------------------------------------------------------------- 68 ; Get PortToDXandTranslateA0andA3ifNecessary132 ; GetIdePortToDX 69 133 ; Parameters: 70 134 ; BL: Offset to port in IDEVARS (IDEVARS.wPort or IDEVARS.wPortCtrl) 135 ; DH: Device Type (IDEVARS.bDevice) 71 136 ; DL: IDE Register 72 137 ; DS:DI: Ptr to DPT (in RAMVARS segment) … … 77 142 ;-------------------------------------------------------------------- 78 143 ALIGN JUMP_ALIGN 79 GetPortToDXandTranslateA0andA3ifNecessary: 144 GetIdePortToDX: 145 %ifdef MODULE_8BIT_IDE 146 ; Point CS:BX to IDEVARS 80 147 xor bh, bh 81 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 82 xor dh, dh ; DX now has IDE register offset 83 add dx, [cs:bx] 84 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_REVERSED_A0_AND_A3 85 jz SHORT .ReturnPortInDX 148 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 149 150 ; Load port address and check if A0 and A3 address lines need to be reversed 151 cmp dh, DEVICE_8BIT_XTIDE_REV1 152 mov dh, bh ; DX now has IDE register offset 153 jae SHORT .ReturnUntranslatedPortInDX ; No need to swap address lines 86 154 87 155 ; Exchange address lines A0 and A3 from DL 156 add dx, [cs:bx] ; DX now has port address 88 157 mov bl, dl 89 158 mov bh, MASK_A3_AND_A0_ADDRESS_LINES 90 and bh, bl ; BH = 0, 1, 8 or 9, we can ignore 0 and 991 jz SHORT .Return PortInDX; Jump out since DH is 0159 and bh, bl ; BH = 0, 1, 8 or 9, we can ignore 0 and 9 160 jz SHORT .ReturnTranslatedPortInDX ; Jump out since DH is 0 92 161 xor bh, MASK_A3_AND_A0_ADDRESS_LINES 93 jz SHORT .Return PortInDX; Jump out since DH was 9162 jz SHORT .ReturnTranslatedPortInDX ; Jump out since DH was 9 94 163 and dl, ~MASK_A3_AND_A0_ADDRESS_LINES 95 or dl, bh ; Address lines now reversed96 .Return PortInDX:164 or dl, bh ; Address lines now reversed 165 .ReturnTranslatedPortInDX: 97 166 ret 167 168 .ReturnUntranslatedPortInDX: 169 add dx, [cs:bx] 170 ret 171 172 %else ; Only standard IDE devices 173 xor bh, bh 174 xor dh, dh 175 add bl, [di+DPT.bIdevarsOffset] ; CS:BX now points port address 176 add dx, [cs:bx] ; DX now has port address 177 ret 178 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r376 r400 208 208 mov bl, [di+DPT.bIdevarsOffset] ; CS:BX now points to IDEVARS 209 209 mov dx, [cs:bx+IDEVARS.wPort] ; Load IDE Data port address 210 %ifdef MODULE_ADVANCED_ATA 211 mov bl, [di+DPT_ADVANCED_ATA.bDevice] 212 %else 213 mov bl, [cs:bx+IDEVARS.bDevice] ; Load device type to BX 214 %endif 210 mov bl, [di+DPT_ATA.bDevice] 215 211 add bx, ax 216 212 … … 235 231 ; AX, BX, CX 236 232 ;-------------------------------------------------------------------- 233 %ifdef MODULE_8BIT_IDE 234 237 235 ALIGN JUMP_ALIGN 238 236 ReadBlockFromXtideRev1: … … 267 265 %endif 268 266 267 %endif ; MODULE_8BIT_IDE 268 269 269 ;-------------------------------------------------------------------- 270 270 ALIGN JUMP_ALIGN … … 302 302 ; AX, CX 303 303 ;-------------------------------------------------------------------- 304 %ifdef MODULE_8BIT_IDE 305 304 306 ALIGN JUMP_ALIGN 305 307 WriteBlockToXtideRev1: … … 361 363 %endif 362 364 365 %endif ; MODULE_8BIT_IDE 366 363 367 ;-------------------------------------------------------------------- 364 368 ALIGN JUMP_ALIGN … … 387 391 ALIGN WORD_ALIGN 388 392 g_rgfnPioRead: 389 dw ReadBlockFromXtideRev1 ; DEVICE_XTIDE_REV1 390 %ifdef USE_186 391 dw ReadBlockFrom16bitDataPort ; DEVICE_XTIDE_REV2 392 dw ReadBlockFrom16bitDataPort ; DEVICE_FAST_XTIDE 393 %ifdef MODULE_8BIT_IDE 394 dw ReadBlockFromXtideRev1 ; DEVICE_XTIDE_REV1 395 %ifdef USE_186 396 dw ReadBlockFrom16bitDataPort ; DEVICE_XTIDE_REV2 397 dw ReadBlockFrom16bitDataPort ; DEVICE_FAST_XTIDE 398 %else 399 dw ReadBlockFromXtideRev2 ; DEVICE_XTIDE_REV2 400 dw ReadBlockFromXtideRev2 ; DEVICE_FAST_XTIDE 401 %endif 402 393 403 %else 394 dw ReadBlockFromXtideRev2 ; DEVICE_XTIDE_REV2395 dw ReadBlockFromXtideRev2 ; DEVICE_FAST_XTIDE 396 %endif 397 dw ReadBlockFrom16bitDataPort ; DEVICE_16BIT_ATA398 dw ReadBlockFrom32bitDataPort ; DEVICE_32BIT_ATA 404 times COUNT_OF_8BIT_IDE_DEVICES dw 0 405 %endif 406 dw ReadBlockFrom16bitDataPort ; DEVICE_16BIT_ATA 407 dw ReadBlockFrom32bitDataPort ; DEVICE_32BIT_ATA 408 399 409 400 410 g_rgfnPioWrite: 401 dw WriteBlockToXtideRev1 ; DEVICE_XTIDE_REV1 402 dw WriteBlockToXtideRev2 ; DEVICE_XTIDE_REV2 403 %ifdef USE_186 404 dw WriteBlockTo16bitDataPort ; DEVICE_FAST_XTIDE 411 %ifdef MODULE_8BIT_IDE 412 dw WriteBlockToXtideRev1 ; DEVICE_XTIDE_REV1 413 dw WriteBlockToXtideRev2 ; DEVICE_XTIDE_REV2 414 %ifdef USE_186 415 dw WriteBlockTo16bitDataPort ; DEVICE_FAST_XTIDE 416 %else 417 dw WriteBlockToFastXtide ; DEVICE_FAST_XTIDE 418 %endif 419 405 420 %else 406 dw WriteBlockToFastXtide ; DEVICE_FAST_XTIDE407 %endif 408 dw WriteBlockTo16bitDataPort ; DEVICE_16BIT_ATA409 dw WriteBlockTo32bitDataPort ; DEVICE_32BIT_ATA421 times COUNT_OF_8BIT_IDE_DEVICES dw 0 422 %endif 423 dw WriteBlockTo16bitDataPort ; DEVICE_16BIT_ATA 424 dw WriteBlockTo32bitDataPort ; DEVICE_32BIT_ATA -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
r398 r400 32 32 ; AL, BX, CX, DX 33 33 ;-------------------------------------------------------------------- 34 I DEDEVICE%+Wait_IRQorDRQ:34 IdeWait_IRQorDRQ: 35 35 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) 36 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA does not support IRQ 36 37 %ifdef MODULE_IRQ 37 38 test BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN 38 jnz SHORT I DEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled39 jnz SHORT IdeWait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled 39 40 %endif 40 41 ; Fall to IdeWait_IRQorStatusFlagInBLwithTimeoutInBH … … 53 54 ; AL, BX, CX, DX 54 55 ;-------------------------------------------------------------------- 55 IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH: 56 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA does not support IRQ 57 %ifdef MODULE_IRQ 58 call IdeIrq_WaitForIRQ 59 %endif 56 IdeWait_IRQorStatusFlagInBLwithTimeoutInBH: 57 %ifdef MODULE_IRQ 58 call IdeIrq_WaitForIRQ 60 59 %endif 61 60 ; Always fall to IdeWait_PollStatusFlagInBLwithTimeoutInBH for error processing … … 74 73 ; AL, BX, CX, DX 75 74 ;-------------------------------------------------------------------- 76 I DEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH:75 IdeWait_PollStatusFlagInBLwithTimeoutInBH: 77 76 mov ah, bl 78 77 mov cl, bh 79 78 call Timer_InitializeTimeoutWithTicksInCL 80 79 and ah, ~FLG_STATUS_BSY 81 jz SHORT IDEDEVICE%+PollBsyOnly80 jz SHORT PollBsyOnly 82 81 ; Fall to PollBsyAndFlgInAH 83 82 … … 94 93 ; AL, BX, CX, DX 95 94 ;-------------------------------------------------------------------- 96 I DEDEVICE%+PollBsyAndFlgInAH:97 INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in ; Discard contents forfirst read98 ALIGN JUMP_ALIGN 95 IdePollBsyAndFlgInAH: 96 call IdeIO_InputStatusRegisterToAL ; Discard contents of first read 97 99 98 .PollLoop: 100 INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in99 call IdeIO_InputStatusRegisterToAL 101 100 test al, FLG_STATUS_BSY ; Controller busy? 102 101 jnz SHORT .UpdateTimeout ; If so, jump to timeout update 103 102 test al, ah ; Test secondary flag 104 jnz SHORT I DEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL103 jnz SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 105 104 .UpdateTimeout: 106 105 call Timer_SetCFifTimeout 107 106 jnc SHORT .PollLoop ; Loop if time left 108 call I DEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL107 call IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 109 108 jc SHORT .ReturnErrorCodeInAH 110 109 mov ah, RET_HD_TIMEOUT ; Expected bit never got set … … 125 124 ; AL, BX, CX, DX 126 125 ;-------------------------------------------------------------------- 127 IDEDEVICE%+PollBsyOnly:128 INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in ; Discard contents forfirst read129 ALIGN JUMP_ALIGN 126 PollBsyOnly: 127 call IdeIO_InputStatusRegisterToAL ; Discard contents of first read 128 130 129 .PollLoop: 131 INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in130 call IdeIO_InputStatusRegisterToAL 132 131 test al, FLG_STATUS_BSY ; Controller busy? 133 jz SHORT I DEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL132 jz SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 134 133 call Timer_SetCFifTimeout ; Update timeout counter 135 134 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 136 jmp SHORT I DEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL135 jmp SHORT IdeError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm
r399 r400 59 59 xor ax, ax 60 60 61 %ifdef MODULE_ADVANCED_ATA 61 62 ; Clear Initialization Error flags from DPT 62 mov [di+DPT_ATA.bInitError], al 63 mov [di+DPT_ADVANCED_ATA.bInitError], al 64 %endif 63 65 64 66 %ifdef MODULE_SERIAL … … 79 81 call Device_SelectDrive 80 82 83 %ifdef MODULE_ADVANCED_ATA 81 84 mov al, FLG_INITERROR_FAILED_TO_SELECT_DRIVE 82 85 call .SetErrorFlagFromALwithErrorCodeInAH 86 %endif 83 87 jc .ReturnWithErrorCodeInAH 84 88 … … 96 100 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 97 101 102 %ifdef MODULE_ADVANCED_ATA 98 103 mov al, FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS 99 104 call .SetErrorFlagFromALwithErrorCodeInAH 105 %endif 100 106 .SkipInitializeDeviceParameters: 101 107 … … 110 116 call AH23h_SetControllerFeatures 111 117 118 %ifdef MODULE_ADVANCED_ATA 112 119 mov al, FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE 113 120 call .SetErrorFlagFromALwithErrorCodeInAH 121 %endif 114 122 .SkipSetWriteCache: 115 123 … … 118 126 call AH11h_RecalibrateDrive 119 127 128 %ifdef MODULE_ADVANCED_ATA 120 129 mov al, FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE 121 130 call .SetErrorFlagFromALwithErrorCodeInAH 131 %endif 122 132 123 133 ;;; InitializeBlockMode … … 138 148 jnc SHORT .TryNextBlockSize 139 149 150 %ifdef MODULE_ADVANCED_ATA 140 151 mov al, FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE 141 152 call .SetErrorFlagFromALwithErrorCodeInAH 153 %endif 142 154 .BlockModeNotSupportedOrDisabled: 143 155 .SupportedBlockSizeFound: … … 173 185 call Idepack_StoreNonExtParametersAndIssueCommandFromAL 174 186 187 %ifdef MODULE_ADVANCED_ATA 175 188 mov al, FLG_INITERROR_FAILED_TO_INITIALIZE_STANDBY_TIMER 176 189 call .SetErrorFlagFromALwithErrorCodeInAH 190 %endif 177 191 .NoPowerManagementSupport: 178 192 %endif ; MODULE_FEATURE_SETS 179 193 180 194 ; There might have been several errors so just return one error code for them all 181 mov ah, [di+DPT_ATA.bInitError] 195 %ifdef MODULE_ADVANCED_ATA 196 mov ah, [di+DPT_ADVANCED_ATA.bInitError] 182 197 test ah, ah ; Clears CF 183 198 jz SHORT .ReturnWithErrorCodeInAH 184 199 mov ah, RET_HD_RESETFAIL 185 200 stc 201 %endif 186 202 187 203 .ReturnWithErrorCodeInAH: … … 191 207 192 208 209 %ifdef MODULE_ADVANCED_ATA 193 210 ;-------------------------------------------------------------------- 194 211 ; .SetErrorFlagFromALwithErrorCodeInAH … … 211 228 jbe SHORT .IgnoreInvalidCommandError 212 229 213 or [di+DPT_A TA.bInitError], al230 or [di+DPT_ADVANCED_ATA.bInitError], al 214 231 stc 215 232 .NoErrorFlagToSet: 216 233 ret 234 235 %endif 217 236 218 237 … … 221 240 db FEATURE_DISABLE_WRITE_CACHE ; DISABLE_WRITE_CACHE 222 241 db FEATURE_ENABLE_WRITE_CACHE ; ENABLE_WRITE_CACHE 223 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm
r397 r400 86 86 ; DL=COM number character, DH=.bDevice 87 87 %ifdef MODULE_JRIDE 88 cmp dh, DEVICE_ JRIDE_ISA88 cmp dh, DEVICE_8BIT_JRIDE_ISA 89 89 eCMOVE ax, cs ; Use segment address for JR-IDE/ISA 90 90 %endif -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r399 r400 55 55 %include "RamVars.inc" ; For RAMVARS struct 56 56 %include "BootVars.inc" ; For BOOTVARS struct 57 %include "I DE_8bit.inc" ; For IDE 8-bit data port macros57 %include "IdeIO.inc" ; Macros for IDE port I/O 58 58 %include "DeviceIDE.inc" ; For IDE device equates 59 59 … … 136 136 at ROMVARS.ideVars0+IDEVARS.wPort, dw DEVICE_XTIDE_DEFAULT_PORT ; Controller Command Block base port 137 137 at ROMVARS.ideVars0+IDEVARS.wPortCtrl, dw DEVICE_XTIDE_DEFAULT_PORTCTRL ; Controller Control Block base port 138 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_ XTIDE_REV1138 at ROMVARS.ideVars0+IDEVARS.bDevice, db DEVICE_8BIT_XTIDE_REV1 139 139 at ROMVARS.ideVars0+IDEVARS.drvParamsMaster+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE 140 140 at ROMVARS.ideVars0+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags, db DISABLE_WRITE_CACHE | FLG_DRVPARAMS_BLOCKMODE … … 222 222 %include "Vision.asm" ; QDI Vision QD6500 and QD6580 support 223 223 %endif 224 %define IDEDEVICE Ide225 %define ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS226 %include "IOMappedIDE.inc" ; Assembly IDE support for normal I/O mapped controllers227 224 %include "IdeCommand.asm" 228 %include "IdeTransfer.asm" ; Must be included after IdeCommand.asm 225 %ifdef MODULE_JRIDE 226 %include "JrIdeTransfer.asm" ; Must be included after IdeCommand.asm 227 %endif 228 %include "IdeTransfer.asm" 229 229 %include "IdeWait.asm" 230 230 %include "IdeError.asm" ; Must be included after IdeWait.asm … … 234 234 %include "IdeIrq.asm" 235 235 %endif 236 %undef IDEDEVICE 237 %undef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS 238 239 ; JR-IDE support 240 %ifdef MODULE_JRIDE 241 %define IDEDEVICE MemIde 242 %include "MemMappedIDE.inc" ; Assembly IDE support for memory mapped controllers 243 %include "IdeCommand.asm" 244 %include "MemIdeTransfer.asm" ; Must be included after IdeCommand.asm 245 %include "IdeWait.asm" 246 %include "IdeError.asm" ; Must be included after IdeWait.asm 247 %undef IDEDEVICE 248 %endif 249 250 236 237 ; Serial Device support 251 238 %ifdef MODULE_SERIAL ; Serial Port Device support 252 239 %include "SerialCommand.asm" -
trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm
r399 r400 131 131 ;-------------------------------------------------------------------- 132 132 .PushResetStatus: 133 mov al, [di+DPT_ATA.bInitError] 133 %ifdef MODULE_ADVANCED_ATA 134 mov al, [di+DPT_ADVANCED_ATA.bInitError] 134 135 push ax 136 %else 137 ePUSH_T ax, 0 138 %endif 135 139 136 140 ;;; fall-out to BootMenuPrint_HardDiskRefreshInformation. -
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/RamVars.asm
r395 r400 47 47 ;-------------------------------------------------------------------- 48 48 .StealMemoryForRAMVARS: 49 ; Always steal memory when using Advanced ATA module since it 50 ; uses larger DPTs 51 %ifndef MODULE_ADVANCED_ATA 49 %ifndef USE_AT 52 50 mov ax, LITE_MODE_RAMVARS_SEGMENT 53 51 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE … … 114 112 RamVars_GetSegmentToDS: 115 113 116 %ifndef MODULE_ADVANCED_ATA ; Always in Full Mode when using Advanced ATA Module114 %ifndef USE_AT ; Always in Full Mode for AT builds 117 115 test BYTE [cs:ROMVARS.wFlags], FLG_ROMVARS_FULLMODE 118 116 jnz SHORT .GetStolenSegmentToDS 119 %ifndef USE_186120 mov di, LITE_MODE_RAMVARS_SEGMENT121 mov ds, di122 %else123 push LITE_MODE_RAMVARS_SEGMENT124 pop ds125 %endif126 ret 127 %endif ; MODULE_ADVANCED_ATA117 %ifndef USE_186 118 mov di, LITE_MODE_RAMVARS_SEGMENT 119 mov ds, di 120 %else 121 push LITE_MODE_RAMVARS_SEGMENT 122 pop ds 123 %endif 124 ret 125 %endif 128 126 129 127 ALIGN JUMP_ALIGN -
trunk/XTIDE_Universal_BIOS/makefile
r399 r400 15 15 # # 16 16 # Following modules can be included or excluded: # 17 # MODULE_8BIT_IDE Support for 8-BIT IDE cards like XTIDE # 18 # MODULE_JRIDE Support for JR-IDE/ISA # 17 19 # MODULE_ADVANCED_ATA Native support for some VLB IDE controllers # 18 20 # MODULE_BOOT_MENU Boot Menu for selection of drive to boot from # … … 20 22 # MODULE_HOTKEYS Hotkey Bar to boot from any drive # 21 23 # MODULE_IRQ IDE IRQ support # 22 # MODULE_JRIDE Support for JR-IDE/ISA #23 24 # MODULE_SERIAL Virtual hard disks using serial port # 24 25 # MODULE_SERIAL_FLOPPY Virtual floppy drives using serial port (requires MODULE_SERIAL) # … … 93 94 ################################################################# 94 95 DEFINES_COMMON = MODULE_STRINGS_COMPRESSED MODULE_HOTKEYS MODULE_EBIOS MODULE_FEATURE_SETS 95 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_ JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY96 97 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_ JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY96 DEFINES_COMMON_LARGE = MODULE_BOOT_MENU MODULE_SERIAL MODULE_SERIAL_FLOPPY 97 98 DEFINES_XT = $(DEFINES_COMMON) ELIMINATE_CGA_SNOW MODULE_8BIT_IDE MODULE_JRIDE MODULE_SERIAL MODULE_SERIAL_FLOPPY 98 99 DEFINES_XTPLUS = $(DEFINES_COMMON) $(DEFINES_XT) USE_186 99 100 DEFINES_AT = $(DEFINES_COMMON) USE_AT USE_286 MODULE_IRQ MODULE_SERIAL MODULE_SERIAL_FLOPPY MODULE_ADVANCED_ATA … … 103 104 DEFINES_AT_LARGE = $(DEFINES_AT) $(DEFINES_COMMON_LARGE) 104 105 105 DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED 106 DEFINES_XT_TINY = MODULE_STRINGS_COMPRESSED MODULE_8BIT_IDE 106 107 DEFINES_386_8K = $(DEFINES_AT) USE_386 107 108
Note:
See TracChangeset
for help on using the changeset viewer.