Changeset 400 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
- Timestamp:
- Apr 20, 2012, 2:30:16 PM (12 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.