Changeset 238 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS
- Timestamp:
- Feb 5, 2012, 12:59:20 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc
r237 r238 14 14 15 15 ; IDE Drive related 16 ; .twLbaSectors is used for LBA addressing only. 17 ; .wPchsCylinders and .bPchsSectors are used for CHS addressing only. 16 ; .bLbaHeads and .twLbaSectors are used for LBA addressing only. 18 17 .bLbaHeads: resb 1 ; Number of LBA assisted heads (1...255) 19 18 .twLbaSectors resb 2 ; 48-bit sector count for LBA addressing 19 20 ; .wPchsCylinders and .bPchsSectors are used for CHS addressing only. 20 21 .wPchsCylinders resb 2 ; Number of P-CHS Cylinders (1...16383) 21 22 .wPchsHeadsAndSectors: -
trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc
r233 r238 90 90 DEVICE_32BIT_ATA EQU (4<<1) 91 91 DEVICE_SERIAL_PORT EQU (5<<1) ; must be last entry, or remove optimization in DetectPrint 92 DEVICE_JRIDE_ISA EQU (6<<1) 92 93 93 94 -
trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm
r218 r238 4 4 ; Section containing code 5 5 SECTION .text 6 7 8 %macro TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE 1 9 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 10 jnz SHORT %1 11 %endmacro 12 13 %macro CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE 1 14 eMOVZX bx, [di+DPT.bIdevarsOffset] 15 cmp BYTE [cs:bx+IDEVARS.bDevice], DEVICE_JRIDE_ISA 16 je SHORT %1 17 %endmacro 18 19 %macro CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF 2 20 cmp BYTE [cs:bp+IDEVARS.bDevice], %1 21 je SHORT %2 22 %endmacro 23 24 6 25 7 26 ;-------------------------------------------------------------------- … … 18 37 %ifdef MODULE_SERIAL 19 38 Device_FinalizeDPT: 20 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 21 jnz SHORT .FinalizeDptForSerialPortDevice 39 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .FinalizeDptForSerialPortDevice 22 40 jmp IdeDPT_Finalize 23 24 41 .FinalizeDptForSerialPortDevice: 25 42 jmp SerialDPT_Finalize 26 %else 43 44 %else ; IDE or JR-IDE/ISA 27 45 Device_FinalizeDPT EQU IdeDPT_Finalize 28 46 %endif … … 39 57 ; AL, BX, CX, DX 40 58 ;-------------------------------------------------------------------- 41 %ifdef MODULE_SERIAL 59 %ifdef MODULE_JRIDE 60 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 61 Device_ResetMasterAndSlaveController: 62 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 63 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE 64 jmp IdeCommand_ResetMasterAndSlaveController 65 66 %else ; IDE + JR-IDE/ISA 67 Device_ResetMasterAndSlaveController: 68 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .ResetJrIDE 69 jmp IdeCommand_ResetMasterAndSlaveController 70 %endif 71 72 %elifdef MODULE_SERIAL ; IDE + Serial 42 73 Device_ResetMasterAndSlaveController: 43 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 44 jnz SHORT ReturnSuccessForSerialPort 74 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 45 75 jmp IdeCommand_ResetMasterAndSlaveController 46 %else 76 77 %else ; IDE 47 78 Device_ResetMasterAndSlaveController EQU IdeCommand_ResetMasterAndSlaveController 79 %endif 80 81 %ifdef MODULE_JRIDE 82 .ResetJrIDE: 83 jmp MemIdeCommand_ResetMasterAndSlaveController 48 84 %endif 49 85 … … 62 98 ; AL, BL, CX, DX, SI, DI, ES 63 99 ;-------------------------------------------------------------------- 64 %ifdef MODULE_SERIAL 100 %ifdef MODULE_JRIDE 101 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 102 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH: 103 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort 104 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde 105 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 106 107 %else ; IDE + JR-IDE/ISA 108 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH: 109 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_JRIDE_ISA, .IdentifyDriveFromJrIde 110 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 111 %endif 112 113 %elifdef MODULE_SERIAL ; IDE + Serial 65 114 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH: 66 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT 67 je SHORT .IdentifyDriveFromSerialPort 115 CMP_USING_IDEVARS_IN_CSBP_AND_JUMP_IF DEVICE_SERIAL_PORT, .IdentifyDriveFromSerialPort 68 116 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 69 117 118 %else ; IDE 119 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 120 %endif 121 122 %ifdef MODULE_JRIDE 123 .IdentifyDriveFromJrIde: 124 jmp MemIdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 125 %endif 126 127 %ifdef MODULE_SERIAL 70 128 .IdentifyDriveFromSerialPort: 71 129 jmp SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH 72 %else73 Device_IdentifyToBufferInESSIwithDriveSelectByteInBH EQU IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH74 130 %endif 75 131 … … 89 145 ; AL, BX, CX, DX, (ES:SI for data transfer commands) 90 146 ;-------------------------------------------------------------------- 91 %ifdef MODULE_SERIAL 92 ALIGN JUMP_ALIGN 147 %ifdef MODULE_JRIDE 148 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 149 Device_OutputCommandWithParameters: 150 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort 151 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE 152 jmp IdeCommand_OutputWithParameters 153 154 %else ; IDE + JR-IDE/ISA 155 Device_OutputCommandWithParameters: 156 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .OutputCommandToJrIDE 157 jmp IdeCommand_OutputWithParameters 158 %endif 159 160 %elifdef MODULE_SERIAL ; IDE + Serial 93 161 Device_OutputCommandWithParameters: 94 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 95 jnz SHORT .OutputCommandToSerialPort 162 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE .OutputCommandToSerialPort 96 163 jmp IdeCommand_OutputWithParameters 97 164 165 %else ; IDE 166 Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters 167 %endif 168 169 %ifdef MODULE_JRIDE 170 ALIGN JUMP_ALIGN 171 .OutputCommandToJrIDE: 172 jmp MemIdeCommand_OutputWithParameters 173 %endif 174 175 %ifdef MODULE_SERIAL 98 176 ALIGN JUMP_ALIGN 99 177 .OutputCommandToSerialPort: 100 178 jmp SerialCommand_OutputWithParameters 101 %else102 Device_OutputCommandWithParameters EQU IdeCommand_OutputWithParameters103 179 %endif 104 180 … … 115 191 ; AL, BX, CX, DX 116 192 ;-------------------------------------------------------------------- 117 %ifdef MODULE_SERIAL 118 ALIGN JUMP_ALIGN 193 %ifdef MODULE_JRIDE 194 %ifdef MODULE_SERIAL ; IDE + JR-IDE/ISA + Serial 195 Device_SelectDrive: 196 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 197 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive 198 jmp IdeCommand_SelectDrive 199 200 %else ; IDE + JR-IDE/ISA 201 Device_SelectDrive: 202 CMP_USING_DPT_AND_JUMP_IF_JRIDE_DEVICE .SelectJrIdeDrive 203 jmp IdeCommand_SelectDrive 204 %endif 205 206 %elifdef MODULE_SERIAL ; IDE + Serial 119 207 Device_SelectDrive: 120 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 121 jnz SHORT ReturnSuccessForSerialPort 208 TEST_USIGN_DPT_AND_JUMP_IF_SERIAL_DEVICE ReturnSuccessForSerialPort 122 209 jmp IdeCommand_SelectDrive 123 210 211 %else ; IDE 212 Device_SelectDrive EQU IdeCommand_SelectDrive 213 %endif 214 215 %ifdef MODULE_JRIDE 216 ALIGN JUMP_ALIGN 217 .SelectJrIdeDrive: 218 jmp MemIdeCommand_SelectDrive 219 %endif 220 221 %ifdef MODULE_SERIAL 222 ALIGN JUMP_ALIGN 124 223 ReturnSuccessForSerialPort: 125 224 xor ax, ax 126 225 ret 127 %else 128 Device_SelectDrive EQU IdeCommand_SelectDrive 129 %endif 130 226 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r218 r238 15 15 ; AL, BX, CX, DX 16 16 ;-------------------------------------------------------------------- 17 I deCommand_ResetMasterAndSlaveController:17 IDEDEVICE%+Command_ResetMasterAndSlaveController: 18 18 ; HSR0: Set_SRST 19 19 call AccessDPT_GetDeviceControlByteToAL 20 20 or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 21 mov dl, DEVICE_CONTROL_REGISTER_out 22 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 21 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 23 22 mov ax, HSR0_RESET_WAIT_US 24 23 call Timer_DelayMicrosecondsFromAX … … 28 27 or al, FLG_DEVCONTROL_nIEN 29 28 and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 30 mov dl, DEVICE_CONTROL_REGISTER_out 31 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 29 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 32 30 mov ax, HSR1_RESET_WAIT_US 33 31 call Timer_DelayMicrosecondsFromAX … … 35 33 ; HSR2: Check_status 36 34 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) 37 jmp I deWait_PollStatusFlagInBLwithTimeoutInBH35 jmp IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 38 36 39 37 … … 51 49 ; AL, BL, CX, DX, SI, DI, ES 52 50 ;-------------------------------------------------------------------- 53 I deCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:51 IDEDEVICE%+Command_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH: 54 52 ; Create fake DPT to be able to use Device.asm functions 55 53 call FindDPT_ForNewDriveToDSDI … … 66 64 jnz SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 67 65 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) 68 call I deWait_PollStatusFlagInBLwithTimeoutInBH66 call IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 69 67 .SkipLongWaitSinceDriveIsNotPrimaryMaster: 70 68 … … 100 98 ;-------------------------------------------------------------------- 101 99 ALIGN JUMP_ALIGN 102 I deCommand_OutputWithParameters:100 IDEDEVICE%+Command_OutputWithParameters: 103 101 push bx ; Store status register bits to poll 104 102 105 103 ; Select Master or Slave drive and output head number or LBA28 top bits 106 call I deCommand_SelectDrive104 call IDEDEVICE%+Command_SelectDrive 107 105 jc SHORT .DriveNotReady 108 106 … … 119 117 pop ds 120 118 .DoNotSetInterruptInServiceFlag: 121 mov dl, DEVICE_CONTROL_REGISTER_out 122 call IdeIO_OutputALtoIdeControlBlockRegisterInDL 119 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 123 120 124 121 ; Output Feature Number 125 mov dl, FEATURES_REGISTER_out126 122 mov al, [bp+IDEPACK.bFeatures] 127 call IdeIO_OutputALtoIdeRegisterInDL123 OUTPUT_AL_TO_IDE_REGISTER FEATURES_REGISTER_out 128 124 129 125 ; Output Sector Address High (only used by LBA48) … … 138 134 139 135 ; Output command 140 mov dl, COMMAND_REGISTER_out141 136 mov al, [bp+IDEPACK.bCommand] 142 call IdeIO_OutputALtoIdeRegisterInDL137 OUTPUT_AL_TO_IDE_REGISTER COMMAND_REGISTER_out 143 138 144 139 ; Wait until command completed 145 140 pop bx ; Pop status and timeout for polling 146 141 cmp bl, FLG_STATUS_DRQ ; Data transfer started? 147 je SHORT I deTransfer_StartWithCommandInAL142 je SHORT IDEDEVICE%+Transfer_StartWithCommandInAL 148 143 test BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN 149 144 jz SHORT .WaitForIrqOrRdy 150 jmp I deWait_PollStatusFlagInBLwithTimeoutInBH145 jmp IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 151 146 152 147 ALIGN JUMP_ALIGN 153 148 .WaitForIrqOrRdy: 154 jmp I deWait_IRQorStatusFlagInBLwithTimeoutInBH149 jmp IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH 155 150 156 151 .DriveNotReady: 157 152 pop bx ; Clean stack 158 ReturnSinceTimeoutWhenPollingBusy:153 IDEDEVICE%+ReturnSinceTimeoutWhenPollingBusy: 159 154 ret 160 155 … … 172 167 ;-------------------------------------------------------------------- 173 168 ALIGN JUMP_ALIGN 174 I deCommand_SelectDrive:169 IDEDEVICE%+Command_SelectDrive: 175 170 ; Wait until neither Master or Slave Drive is busy 176 171 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY) 177 172 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 178 173 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 179 call I deWait_PollStatusFlagInBLwithTimeoutInBH180 jc SHORT ReturnSinceTimeoutWhenPollingBusy174 call IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 175 jc SHORT IDEDEVICE%+ReturnSinceTimeoutWhenPollingBusy 181 176 182 177 ; Select Master or Slave Drive 183 mov dl, DRIVE_AND_HEAD_SELECT_REGISTER184 178 mov al, [bp+IDEPACK.bDrvAndHead] 185 call IdeIO_OutputALtoIdeRegisterInDL179 OUTPUT_AL_TO_IDE_REGISTER DRIVE_AND_HEAD_SELECT_REGISTER 186 180 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY) 187 181 cmp BYTE [bp+IDEPACK.bCommand], COMMAND_IDENTIFY_DEVICE 188 182 eCMOVE bh, TIMEOUT_IDENTIFY_DEVICE 189 jmp I deWait_PollStatusFlagInBLwithTimeoutInBH183 jmp IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH 190 184 191 185 … … 203 197 ; AL, BX, DX 204 198 ;-------------------------------------------------------------------- 199 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS 205 200 ALIGN JUMP_ALIGN 206 201 OutputSectorCountAndAddress: 207 mov dl, SECTOR_COUNT_REGISTER 208 call IdeIO_OutputALtoIdeRegisterInDL 202 OUTPUT_AL_TO_IDE_REGISTER SECTOR_COUNT_REGISTER 209 203 210 204 mov al, ah 211 mov dl, LBA_LOW_REGISTER 212 call IdeIO_OutputALtoIdeRegisterInDL 205 OUTPUT_AL_TO_IDE_REGISTER LBA_LOW_REGISTER 213 206 214 207 mov al, cl 215 mov dl, LBA_MIDDLE_REGISTER 216 call IdeIO_OutputALtoIdeRegisterInDL 208 OUTPUT_AL_TO_IDE_REGISTER LBA_MIDDLE_REGISTER 217 209 218 210 mov al, ch 219 mov dl,LBA_HIGH_REGISTER220 jmp IdeIO_OutputALtoIdeRegisterInDL 211 JUMP_TO_OUTPUT_AL_TO_IDE_REGISTER LBA_HIGH_REGISTER 212 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeError.asm
r160 r238 18 18 ;-------------------------------------------------------------------- 19 19 ALIGN JUMP_ALIGN 20 I deError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL:20 IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL: 21 21 mov ah, al ; IDE Status Register to AH 22 mov dl, ERROR_REGISTER_in 23 call IdeIO_InputToALfromIdeRegisterInDL 22 INPUT_TO_AL_FROM_IDE_REGISTER ERROR_REGISTER_in 24 23 xchg al, ah ; Status Register now in AL, Error Register now in AH 25 24 … … 45 44 ; BX 46 45 ;-------------------------------------------------------------------- 46 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS 47 47 ALIGN JUMP_ALIGN 48 48 GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX: … … 92 92 db RET_HD_BADSECTOR ; Bit7=BBK, Bad Block Detected 93 93 db RET_HD_STATUSERR ; When Error Register is zero 94 %endif -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIrq.asm
r233 r238 111 111 mov bl, FLGH_DPT_INTERRUPT_IN_SERVICE 112 112 call FindDPT_ToDSDIforFlagsHighInBL 113 mov dl, STATUS_REGISTER_in 114 call IdeIO_InputToALfromIdeRegisterInDL 113 INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in 115 114 116 115 ; Clear Interrupt In-Service Flag from DPT -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r223 r238 97 97 .WriteLastBlockToDrive: 98 98 mov cx, [bp+PIOVARS.wWordsLeft] 99 %ifdef USE_186 100 push CheckErrorsAfterTransferringLastBlock 101 jmp [bp+PIOVARS.fnXfer] ; Transfer possibly partial block 102 %else 99 103 call [bp+PIOVARS.fnXfer] ; Transfer possibly partial block 100 101 ; Check for errors in last block 102 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY) 103 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 104 jmp SHORT ReturnWithTransferErrorInAH 104 jmp SHORT CheckErrorsAfterTransferringLastBlock 105 %endif 105 106 106 107 … … 155 156 ; Check for errors in last block 156 157 mov di, si ; DS:DI now points DPT 158 CheckErrorsAfterTransferringLastBlock: 157 159 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRDY) 158 160 call IdeWait_PollStatusFlagInBLwithTimeoutInBH -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeWait.asm
r160 r238 16 16 ; AL, BX, CX, DX 17 17 ;-------------------------------------------------------------------- 18 I deWait_IRQorDRQ:18 IDEDEVICE%+Wait_IRQorDRQ: 19 19 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRQ, FLG_STATUS_DRQ) 20 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA does not support IRQ 20 21 test BYTE [bp+IDEPACK.bDeviceControl], FLG_DEVCONTROL_nIEN 21 jnz SHORT IdeWait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled 22 jnz SHORT IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH ; Interrupt disabled 23 %endif 22 24 ; Fall to IdeWait_IRQorStatusFlagInBLwithTimeoutInBH 23 25 … … 35 37 ; AL, BX, CX, DX 36 38 ;-------------------------------------------------------------------- 37 IdeWait_IRQorStatusFlagInBLwithTimeoutInBH: 39 IDEDEVICE%+Wait_IRQorStatusFlagInBLwithTimeoutInBH: 40 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS ; JR-IDE/ISA does not support IRQ 38 41 call IdeIrq_WaitForIRQ 42 %endif 39 43 ; Always fall to IdeWait_PollStatusFlagInBLwithTimeoutInBH for error processing 40 44 … … 52 56 ; AL, BX, CX, DX 53 57 ;-------------------------------------------------------------------- 54 I deWait_PollStatusFlagInBLwithTimeoutInBH:58 IDEDEVICE%+Wait_PollStatusFlagInBLwithTimeoutInBH: 55 59 mov ah, bl 56 60 mov cl, bh 57 61 call Timer_InitializeTimeoutWithTicksInCL 58 62 and ah, ~FLG_STATUS_BSY 59 jz SHORT PollBsyOnly63 jz SHORT IDEDEVICE%+PollBsyOnly 60 64 ; Fall to PollBsyAndFlgInAH 61 65 … … 72 76 ; AL, BX, CX, DX 73 77 ;-------------------------------------------------------------------- 78 %ifdef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS 74 79 PollBsyAndFlgInAH: 75 call ReadIdeStatusRegisterToAL; Discard contents for first read80 call IDEDEVICE%+ReadIdeStatusRegisterToAL; Discard contents for first read 76 81 ALIGN JUMP_ALIGN 77 82 .PollLoop: 78 call ReadIdeStatusRegisterToAL83 call IDEDEVICE%+ReadIdeStatusRegisterToAL 79 84 test al, FLG_STATUS_BSY ; Controller busy? 80 85 jnz SHORT .UpdateTimeout ; If so, jump to timeout update 81 86 test al, ah ; Test secondary flag 82 jnz SHORT I deError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL87 jnz SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 83 88 .UpdateTimeout: 84 89 call Timer_SetCFifTimeout 85 90 jnc SHORT .PollLoop ; Loop if time left 86 call I deError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL91 call IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 87 92 jc SHORT .ReturnErrorCodeInAH 88 93 mov ah, RET_HD_TIMEOUT ; Expected bit never got set … … 90 95 .ReturnErrorCodeInAH: 91 96 ret 97 %endif 92 98 93 99 … … 103 109 ; AL, BX, CX, DX 104 110 ;-------------------------------------------------------------------- 105 PollBsyOnly:106 call ReadIdeStatusRegisterToAL; Discard contents for first read111 IDEDEVICE%+PollBsyOnly: 112 call IDEDEVICE%+ReadIdeStatusRegisterToAL; Discard contents for first read 107 113 ALIGN JUMP_ALIGN 108 114 .PollLoop: 109 call ReadIdeStatusRegisterToAL115 call IDEDEVICE%+ReadIdeStatusRegisterToAL 110 116 test al, FLG_STATUS_BSY ; Controller busy? 111 jz SHORT I deError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL117 jz SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 112 118 call Timer_SetCFifTimeout ; Update timeout counter 113 119 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 114 jmp SHORT I deError_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL120 jmp SHORT IDEDEVICE%+Error_GetBiosErrorCodeToAHfromPolledStatusRegisterInAL 115 121 116 122 … … 125 131 ;-------------------------------------------------------------------- 126 132 ALIGN JUMP_ALIGN 127 ReadIdeStatusRegisterToAL: 128 mov dl, STATUS_REGISTER_in 129 jmp IdeIO_InputToALfromIdeRegisterInDL 133 IDEDEVICE%+ReadIdeStatusRegisterToAL: 134 JUMP_TO_INPUT_TO_AL_FROM_IDE_REGISTER STATUS_REGISTER_in -
trunk/XTIDE_Universal_BIOS/Src/Main.asm
r233 r238 186 186 187 187 ; IDE Device support 188 %define IDEDEVICE Ide 189 %define ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS 190 %include "IOMappedIDE.inc" ; Assembly IDE support for normal I/O mapped controllers 188 191 %include "IdeCommand.asm" 189 192 %include "IdeTransfer.asm" ; Must be included after IdeCommand.asm … … 193 196 %include "IdeIO.asm" 194 197 %include "IdeIrq.asm" 198 %undef IDEDEVICE 199 %undef ASSEMBLE_SHARED_IDE_DEVICE_FUNCTIONS 200 201 ; JR-IDE support 202 %ifdef MODULE_JRIDE 203 %define IDEDEVICE MemIde 204 %include "MemMappedIDE.inc" ; Assembly IDE support for memory mapped controllers 205 %include "IdeCommand.asm" 206 %include "MemIdeTransfer.asm" ; Must be included after IdeCommand.asm 207 %include "IdeWait.asm" 208 %include "IdeError.asm" ; Must be included after IdeWait.asm 209 %undef IDEDEVICE 210 %endif 211 195 212 196 213 %ifdef MODULE_SERIAL ; Serial Port Device support -
trunk/XTIDE_Universal_BIOS/makefile
r203 r238 42 42 HEADERS += Src/Device/ 43 43 HEADERS += Src/Device/IDE/ 44 HEADERS += Src/Device/MemoryMappedIDE/ 44 45 HEADERS += Src/Device/Serial/ 45 46 HEADERS += Src/Initialization/ … … 69 70 DEFINES_XTPLUS = ELIMINATE_CGA_SNOW USE_186 70 71 DEFINES_AT = USE_186 USE_286 USE_AT 72 DEFINES_XT_LARGE = $(DEFINES_XT) MODULE_JRIDE 73 DEFINES_XTPLUS_LARGE = $(DEFINES_XTPLUS) MODULE_JRIDE 74 DEFINES_AT_LARGE = $(DEFINES_AT) MODULE_JRIDE 71 75 72 76 … … 80 84 DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%) 81 85 DEFS_AT = $(DEFINES_AT:%=-D%) 86 DEFS_XT_LARGE = $(DEFINES_XT_LARGE:%=-D%) 87 DEFS_XTPLUS_LARGE = $(DEFINES_XTPLUS_LARGE:%=-D%) 88 DEFS_AT_LARGE = $(DEFINES_AT_LARGE:%=-D%) 82 89 83 90 # Add -I in front of all header directories … … 120 127 ############################################ 121 128 122 .PHONY: all at xtplus xtclean129 .PHONY: all at at_large xtplus xtplus_large xt xt_large clean 123 130 124 131 # Make clean debug and release versions 125 all: clean at xtplus xt132 all: clean at at_large xtplus xtplus_large xt xt_large 126 133 @echo All done! 127 134 … … 130 137 @echo AT version "$(TARGET)_at.bin" built. 131 138 139 at_large: 140 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT_LARGE) -l"$(TARGET)_atl.lst" -o"$(TARGET)_atl.bin" 141 @echo Large AT version "$(TARGET)_atl.bin" built. 142 132 143 xtplus: 133 144 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.bin" 134 145 @echo XT plus version "$(TARGET)_xtp.bin" built. 135 146 147 xtplus_large: 148 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS_LARGE) -l"$(TARGET)_xtpl.lst" -o"$(TARGET)_xtpl.bin" 149 @echo Large XT plus version "$(TARGET)_xtpl.bin" built. 150 136 151 xt: 137 152 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET)_xt.bin" 138 153 @echo XT version "$(TARGET)_xt.bin" built. 154 155 xt_large: 156 @$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT_LARGE) -l"$(TARGET)_xtl.lst" -o"$(TARGET)_xtl.bin" 157 @echo Large XT version "$(TARGET)_xtl.bin" built. 139 158 140 159 clean:
Note:
See TracChangeset
for help on using the changeset viewer.