Changeset 28 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Timestamp:
- Aug 1, 2010, 5:57:24 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HError.asm
r27 r28 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 30.11.2007 4 ; Last update : 28.7.20104 ; Last update : 1.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Error checking functions for BIOS Hard disk functions. … … 10 10 11 11 ;-------------------------------------------------------------------- 12 ; HError_ GetErrorCodeToAHforBitPollingTimeout12 ; HError_ProcessErrorsAfterPollingTaskFlag 13 13 ; Parameters: 14 ; AL: IDE Status Register contents 15 ; DX: IDE Status Register Address 14 ; DS: RAMVARS segment 15 ; ES: BDA segment (zero) 16 ; CF: Set if timeout 17 ; Cleared if task flag was properly set 16 18 ; Returns: 17 ; AH: Hard disk BIOS error code 18 ; CF: Set since error 19 ; Corrupts registers: 20 ; AL, CX 21 ;-------------------------------------------------------------------- 22 ALIGN JUMP_ALIGN 23 HError_GetErrorCodeToAHforBitPollingTimeout: 24 test al, FLG_IDE_ST_BSY ; Other bits undefined when BSY set 25 jnz SHORT HError_GetErrorCodeForStatusReg ; Busy, normal timeout 26 test al, FLG_IDE_ST_DF | FLG_IDE_ST_CORR | FLG_IDE_ST_ERR 27 jnz SHORT HError_GetErrorCodeForStatusReg ; Not busy but some error 28 or al, FLG_IDE_ST_BSY ; Polled bit got never set, force timeout 29 ; Fall to HError_GetErrorCodeForStatusReg 30 31 ;-------------------------------------------------------------------- 32 ; Converts Status Register error to BIOS error code. 33 ; 34 ; HError_GetErrorCodeForStatusReg 35 ; Parameters: 36 ; AL: IDE Status Register contents 37 ; DX: IDE Status Register Address 38 ; Returns: 39 ; AH: Hard disk BIOS error code 40 ; CF: 0 if no errors (AH=RET_HD_SUCCESS) 41 ; 1 if some error 42 ; Corrupts registers: 43 ; AL, CX 44 ;-------------------------------------------------------------------- 45 ALIGN JUMP_ALIGN 46 HError_GetErrorCodeForStatusReg: 47 ; Get Error Register contents to AH 48 mov ah, al ; Backup Status Reg to AH 49 sub dx, BYTE REGR_IDE_ST-REGR_IDE_ERROR ; Status Reg to Error Reg 50 in al, dx ; Read Error Register to AL 51 xchg al, ah ; Swap status and error 52 add dx, BYTE REGR_IDE_ST-REGR_IDE_ERROR ; Restore DX 53 54 ; Store Register contents to BDA 55 push ds 56 LOAD_BDA_SEGMENT_TO ds, cx 57 mov [HDBDA.wHDStAndErr], ax ; Store Status and Error to BDA 58 pop ds 59 ; Fall to HError_ConvertIdeErrorToBiosRet 60 61 ;-------------------------------------------------------------------- 62 ; Converts error flags from IDE status and error register contents 63 ; to BIOS Int 13h return value. 64 ; 65 ; HError_ConvertIdeErrorToBiosRet 66 ; Parameters: 67 ; AL: Status Register Contents 68 ; AH: Error Register Contents 69 ; Returns: 70 ; AH: Hard disk BIOS error code 71 ; CF: 0 if no errors (AH=RET_HD_SUCCESS) 72 ; 1 if any error 19 ; AH: BIOS error code 20 ; CF: Set if error 21 ; Cleared if no error 73 22 ; Corrupts registers: 74 23 ; AL 75 24 ;-------------------------------------------------------------------- 76 25 ALIGN JUMP_ALIGN 77 HError_ConvertIdeErrorToBiosRet: 26 HError_ProcessErrorsAfterPollingTaskFlag: 27 jc SHORT HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit 28 mov ax, [es:HDBDA.wHDStAndErr] 29 call GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX 30 mov [es:BDA.bHDLastSt], ah 31 mov BYTE [es:BDA.bHDTaskFlg], 0 32 ret 33 34 ;-------------------------------------------------------------------- 35 ; HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit 36 ; HError_ProcessErrorsAfterPollingBSY 37 ; Parameters: 38 ; DS: RAMVARS segment 39 ; Returns: 40 ; AH: BIOS error code 41 ; CF: Set if error 42 ; Cleared if no error 43 ; Corrupts registers: 44 ; AL 45 ;-------------------------------------------------------------------- 46 ALIGN JUMP_ALIGN 47 HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit: 48 push ds 49 push dx 50 51 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 52 call GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX 53 jc SHORT StoreErrorCodeFromAHtoBDA 54 mov ah, RET_HD_TIMEOUT ; Force timeout since no actual error... 55 stc ; ...but wanted bit was never set 56 jmp SHORT StoreErrorCodeFromAHtoBDA 57 58 59 ALIGN JUMP_ALIGN 60 HError_ProcessErrorsAfterPollingBSY: 61 push ds 62 push dx 63 64 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 65 call GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX 66 StoreErrorCodeFromAHtoBDA: 67 mov [BDA.bHDLastSt], ah ; Store BIOS error code to BDA 68 69 pop dx 70 pop ds 71 ret 72 73 74 ;-------------------------------------------------------------------- 75 ; HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 76 ; Parameters: 77 ; DS: RAMVARS segment 78 ; Returns: 79 ; AL: IDE Status Register contents 80 ; AH: IDE Error Register contents 81 ; DS: BDA segment 82 ; Corrupts registers: 83 ; DX 84 ;-------------------------------------------------------------------- 85 ALIGN JUMP_ALIGN 86 HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA: 87 mov dx, [RAMVARS.wIdeBase] ; Load IDE base port address 88 inc dx ; Increment to Error Register 89 in al, dx ; Read Error Register... 90 mov ah, al ; ...and copy it to AH 91 add dx, BYTE REGR_IDE_ST - REGR_IDE_ERROR 92 in al, dx ; Read Status Register to AL 93 ; Fall to .StoreStatusAndErrorRegistersFromAXtoBDA 94 95 ;-------------------------------------------------------------------- 96 ; .StoreStatusAndErrorRegistersFromAXtoBDA 97 ; Parameters: 98 ; AL: IDE Status Register contents 99 ; AH: IDE Error Register contents 100 ; Returns: 101 ; DS: BDA segment (zero) 102 ; Corrupts registers: 103 ; DX 104 ;-------------------------------------------------------------------- 105 .StoreStatusAndErrorRegistersFromAXtoBDA: 106 LOAD_BDA_SEGMENT_TO ds, dx 107 mov [HDBDA.wHDStAndErr], ax 108 ret 109 110 111 ;-------------------------------------------------------------------- 112 ; GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX 113 ; Parameters: 114 ; AL: IDE Status Register contents 115 ; AH: IDE Error Register contents 116 ; Returns: 117 ; AH: BIOS INT 13h error code 118 ; CF: Set if error 119 ; Cleared if no error 120 ; Corrupts registers: 121 ; Nothing 122 ;-------------------------------------------------------------------- 123 ALIGN JUMP_ALIGN 124 GetBiosErrorCodeToAHfromStatusAndErrorRegistersInAX: 78 125 test al, FLG_IDE_ST_BSY 79 jnz SHORT .TimeoutError 126 jz SHORT .CheckErrorBitsFromStatusRegisterInAL 127 mov ah, RET_HD_TIMEOUT 128 jmp SHORT .ReturnBiosErrorCodeInAH 129 130 ALIGN JUMP_ALIGN 131 .CheckErrorBitsFromStatusRegisterInAL: 80 132 test al, FLG_IDE_ST_DF | FLG_IDE_ST_CORR | FLG_IDE_ST_ERR 81 jnz SHORT . ReadErrorFromStatusReg133 jnz SHORT .ProcessErrorFromStatusRegisterInAL 82 134 xor ah, ah ; No errors, zero AH and CF 83 135 ret 84 136 85 .TimeoutError: 86 mov ah, RET_HD_TIMEOUT 87 stc 88 ret 89 90 ; Convert error code based on status or error register 91 .ReadErrorFromStatusReg: 137 .ProcessErrorFromStatusRegisterInAL: 92 138 test al, FLG_IDE_ST_ERR ; Error specified in Error register? 93 jnz SHORT . ReadErrorFromErrorReg139 jnz SHORT .ConvertBiosErrorToAHfromErrorRegisterInAH 94 140 mov ah, RET_HD_ECC ; Assume ECC corrected error 95 141 test al, FLG_IDE_ST_CORR ; ECC corrected error? 96 jnz SHORT .Return 142 jnz SHORT .ReturnBiosErrorCodeInAH 97 143 mov ah, RET_HD_CONTROLLER ; Must be Device Fault 98 jmp SHORT .Return 144 jmp SHORT .ReturnBiosErrorCodeInAH 99 145 100 ; Convert error register to bios error code 101 .ReadErrorFromErrorReg: 146 .ConvertBiosErrorToAHfromErrorRegisterInAH: 102 147 push bx 103 mov al, ah ; Copy error reg to AL... 104 xor ah, ah ; ...and zero extend to AX 105 eBSF bx, ax ; Get bit index to BX 106 mov ah, RET_HD_STATUSERR ; Error code if Error Reg is zero 107 jz SHORT .SkipLookup ; Return if error register is zero 148 mov bx, .rgbRetCodeLookup 149 .ErrorBitLoop: 150 rcr ah, 1 ; Set CF if error bit set 151 jc SHORT .LookupErrorCode 152 inc bx 153 cmp bx, .rgbRetCodeLookup + 8 154 jb SHORT .ErrorBitLoop ; Loop until all bits checked 155 .LookupErrorCode: 108 156 mov ah, [cs:bx+.rgbRetCodeLookup] 109 .SkipLookup:110 157 pop bx 111 .Return: 158 159 .ReturnBiosErrorCodeInAH: 112 160 stc ; Set CF since error 113 161 ret … … 122 170 db RET_HD_UNCORRECC ; Bit6=UNC, Uncorrectable Data Error 123 171 db RET_HD_BADSECTOR ; Bit7=BBK, Bad Block Detected 172 db RET_HD_STATUSERR ; When Error Register is zero 173 174 175 ;-------------------------------------------------------------------- 176 ; HError_StoreBiosErrorCodeFromAHtoBDA 177 ; Parameters: 178 ; AH: BIOS error code 179 ; Returns: 180 ; Nothing 181 ; Corrupts registers: 182 ; DI 183 ;-------------------------------------------------------------------- 184 ALIGN JUMP_ALIGN 185 HError_StoreBiosErrorCodeFromAHtoBDA: 186 push ds 187 mov di, 0 ; Zero DI and preserve FLAGS 188 mov ds, di ; Copy BDA segment to DS 189 mov [BDA.bHDLastSt], ah 190 pop ds 191 ret -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HIRQ.asm
r3 r28 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 11.12.2009 4 ; Last update : 28.3.20104 ; Last update : 1.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Interrupt handling related functions. … … 20 20 ; Set if any error 21 21 ; Corrupts registers: 22 ; AL , CX22 ; AL 23 23 ;-------------------------------------------------------------------- 24 24 ALIGN JUMP_ALIGN 25 25 HIRQ_WaitIRQ: 26 ; Load BDA segment to ES27 26 push es 28 xor ax, ax ; Zero AX and clear CF29 mov es, ax ; Copy BDA segment (zero) to ES30 27 31 ; Check if interrupt has already occurred 28 LOAD_BDA_SEGMENT_TO es, ax 29 %ifdef USE_AT ; OS hook only available on AT+ machines 30 call .NotifyOperatingSystemAboutWaitingForIRQ 31 cmc 32 jnc SHORT .TaskFlagPollingComplete 33 %endif 34 call .WaitUntilTaskFlagIsSet ; Process errors 35 36 ALIGN JUMP_ALIGN 37 .TaskFlagPollingComplete: 38 call HError_ProcessErrorsAfterPollingTaskFlag 39 pop es 40 ret 41 42 ;-------------------------------------------------------------------- 43 ; .NotifyOperatingSystemAboutWaitingForIRQ 44 ; Parameters: 45 ; ES: BDA segment (zero) 46 ; Returns: 47 ; CF: Set if wait done by operating system 48 ; Cleared if BIOS must perform task flag polling 49 ; Corrupts registers: 50 ; AX 51 ;-------------------------------------------------------------------- 52 %ifdef USE_AT 53 ALIGN JUMP_ALIGN 54 .NotifyOperatingSystemAboutWaitingForIRQ: 32 55 cli ; Disable interrupts 33 cmp [es:BDA.bHDTaskFlg], al ; Interrupt ready? 34 jne SHORT .CheckIdeErrors ; If so, return 56 xor ax, ax 57 cmp al, [es:BDA.bHDTaskFlg] ; Task flag already set? 58 jc SHORT .ReturnFromWaitNotify ; If so, skip OS notification 35 59 36 %ifdef USE_AT ; OS hook only available on AT+ machines37 ; OS device busy notification38 60 mov ah, 90h ; Hard disk busy (AX=9000h) 39 61 int INTV_SYSTEM_SERVICES ; OS hook, device busy 40 jnc SHORT .WaitUntilTaskFlagSet ; CF cleared, BIOS handles waiting 41 test ah, ah ; OS hook supported? (clear CF) 42 jz SHORT .CheckIdeErrors ; If so, waiting completed 43 ALIGN JUMP_ALIGN 44 .WaitUntilTaskFlagSet: 45 %endif 62 jnc SHORT .ReturnFromWaitNotify ; CF cleared, BIOS handles waiting 46 63 47 ; Poll task flag until it has been set by interrupt service routine 48 call HIRQ_WaitUntilTaskFlagIsSet 49 jc SHORT .ReturnTimeout ; Return if timeout 50 51 ALIGN JUMP_ALIGN 52 .CheckIdeErrors: 53 mov ax, [es:HDBDA.wHDStAndErr] ; Load Status and Error regs stored by ISR 54 call HError_ConvertIdeErrorToBiosRet 55 .ReturnTimeout: 56 mov BYTE [es:BDA.bHDTaskFlg], 0 ; Clear Task Flag 57 pop es 64 ; Make sure that OS hooks are supported, otherwise the CF means unsupported function 65 test ah, ah ; OS hook supported? (clears CF) 66 jnz SHORT .ReturnFromWaitNotify ; AH has error, BIOS must do the wait 67 stc ; Set CF since wait done by OS 68 .ReturnFromWaitNotify: 58 69 sti ; Enable interrupts 59 70 ret 60 71 %endif 61 72 62 73 ;-------------------------------------------------------------------- 63 74 ; Polls IRQ Task Flag until it has been set or timeout. 64 75 ; 65 ; HIRQ_WaitUntilTaskFlagIsSet76 ; .WaitUntilTaskFlagIsSet 66 77 ; Parameters: 67 78 ; DS: RAMVARS segment 68 79 ; ES: BDA segment 69 80 ; Returns: 70 ; AH: BIOS Error code 71 ; CF: Cleared if wait succesfull 72 ; Set if timeout 81 ; CF: Set if timeout 82 ; Cleared if Task Flag set 73 83 ; Corrupts registers: 74 ; A L, CX84 ; AX 75 85 ;-------------------------------------------------------------------- 76 86 ALIGN JUMP_ALIGN 77 HIRQ_WaitUntilTaskFlagIsSet: 78 sti ; Enable interrupts 87 .WaitUntilTaskFlagIsSet: 88 push cx 89 79 90 mov cl, B_TIMEOUT_DRQ ; Load timeout ticks 80 91 call SoftDelay_InitTimeout ; Initialize timeout counter … … 82 93 ALIGN JUMP_ALIGN 83 94 .PollIrqFlag: 84 cli ; Disable interrupt s85 cmp [es:BDA.bHDTaskFlg], al ; Task flag set? 86 jne SHORT . TaskFlagIsSet ; If so, return95 cli ; Disable interrupt until next HLT 96 cmp [es:BDA.bHDTaskFlg], al ; Task flag set? (clears CF) 97 jne SHORT .Return 87 98 call SoftDelay_UpdTimeout ; Update timeout 88 jc SHORT . Timeout; Return if timeout89 sti ; Enable interrupts ( one instruction delay)99 jc SHORT .Return ; Return if timeout 100 sti ; Enable interrupts (STI has delay so HLT will catch all interrupts) 90 101 hlt ; Sleep until any interrupt 91 102 jmp SHORT .PollIrqFlag ; Jump to check if IDE interrupt 92 93 103 ALIGN JUMP_ALIGN 94 .TaskFlagIsSet: 95 xor ah, ah ; Zero AH, clear CF 96 ret 97 .Timeout: 98 mov ah, RET_HD_TIMEOUT ; Load error code for timeout 104 .Return: 105 pop cx 106 sti 99 107 ret 100 108 … … 134 142 ALIGN JUMP_ALIGN 135 143 HIRQ_InterruptServiceRoutineForIrqs2to7: 136 ; Acknowledge IDE interrupt by reading status register137 144 push ax 138 call ISR_IDE_AcknowledgeIdeAndStoreStatusToBDA 145 call AcknowledgeIdeInterruptAndStoreStatusAndErrorRegistersToBDA 146 139 147 mov al, CMD_END_OF_INTERRUPT 140 jmp SHORT HIRQ_AcknowledgeMasterController148 jmp SHORT AcknowledgeMasterInterruptController 141 149 142 150 ALIGN JUMP_ALIGN 143 151 HIRQ_InterruptServiceRoutineForIrqs8to15: 144 152 push ax 145 call ISR_IDE_AcknowledgeIdeAndStoreStatusToBDA153 call AcknowledgeIdeInterruptAndStoreStatusAndErrorRegistersToBDA 146 154 147 155 mov al, CMD_END_OF_INTERRUPT ; Load EOI command to AL 148 156 out WPORT_8259SL_COMMAND, al ; Acknowledge Slave 8259 149 HIRQ_AcknowledgeMasterController:157 AcknowledgeMasterInterruptController: 150 158 out WPORT_8259MA_COMMAND, al ; Acknowledge Master 8259 151 159 … … 156 164 %endif 157 165 158 ; Restore registers and return from interrupt159 166 pop ax ; Restore AX 160 167 iret 161 162 168 163 169 ;-------------------------------------------------------------------- … … 166 172 ; also be set. 167 173 ; 168 ; ISR_IDE_AcknowledgeIdeAndStoreStatusToBDA174 ; AcknowledgeIdeInterruptAndStoreStatusAndErrorRegistersToBDA 169 175 ; Parameters: 170 176 ; Nothing … … 175 181 ;-------------------------------------------------------------------- 176 182 ALIGN JUMP_ALIGN 177 ISR_IDE_AcknowledgeIdeAndStoreStatusToBDA:183 AcknowledgeIdeInterruptAndStoreStatusAndErrorRegistersToBDA: 178 184 push ds 179 185 push di 180 186 push dx 181 187 182 ; Read Status and Error registers.183 188 ; Reading Status Register acknowledges IDE interrupt 184 189 call RamVars_GetSegmentToDS 185 mov dx, [RAMVARS.wIdeBase] ; Load IDE base port address 186 inc dx ; Increment to Error Register 187 in al, dx ; Read Error Register... 188 mov ah, al ; ...and copy it to AH 189 add dx, REGR_IDE_ST-REGR_IDE_ERROR 190 in al, dx ; Read Status Register to AL 191 192 ; Store Status and Error register to BDA and set task flag 193 LOAD_BDA_SEGMENT_TO ds, dx 194 mov [HDBDA.wHDStAndErr], ax ; Store Status and Error Registers 195 mov BYTE [BDA.bHDTaskFlg], 0FFh ; Set task flag 190 call HError_GetStatusAndErrorRegistersToAXandStoreThemToBDA 191 mov BYTE [BDA.bHDTaskFlg], 0FFh ; Set task flag 196 192 197 193 pop dx -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HPIO.asm
r26 r28 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 14.12.2007 4 ; Last update : 1 4.4.20104 ; Last update : 1.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : PIO transfer functions. … … 168 168 add cx, [bp+PIOVARS.wWordsLeft] ; CX to partial block size 169 169 call [bp+PIOVARS.fnXfer] ; Transfer possibly partial block 170 call HStatus_ReadAndIgnoreAlternateStatus171 170 jmp HStatus_WaitBsyDefTime ; Check for errors 172 171 .RetError: … … 232 231 HPIO_WriteToDrive: 233 232 cld ; OUTS to increment SI 234 call HStatus_WaitDrqDefTime ; Always poll DRQ for first block, get data portto DX233 call HStatus_WaitDrqDefTime ; Always poll DRQ for first block, get status reg to DX 235 234 jc SHORT .RetError ; Return if error (code in AH) 236 235 sub dx, BYTE REGR_IDE_ST ; DX to Data Port address -
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
r27 r28 2 2 ; Project name : IDE BIOS 3 3 ; Created date : 15.12.2009 4 ; Last update : 28.7.20104 ; Last update : 1.8.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : IDE Status Register polling functions. … … 26 26 HStatus_WaitIrqOrRdy: 27 27 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN 28 jnz SHORT .PollRdySinceI rqsAreDisabled28 jnz SHORT .PollRdySinceInterruptsAreDisabled 29 29 jmp HIRQ_WaitIRQ 30 ALIGN JUMP_ALIGN 31 .PollRdySinceIrqsAreDisabled: 32 call HStatus_ReadAndIgnoreAlternateStatus 30 31 ALIGN JUMP_ALIGN 32 .PollRdySinceInterruptsAreDisabled: 33 33 mov cl, B_TIMEOUT_DRQ ; Load DRQ (not RDY) timeout 34 34 jmp SHORT HStatus_WaitRdy ; Jump to poll RDY … … 36 36 37 37 ;-------------------------------------------------------------------- 38 ; Reads Alternate Status Register and ignores result.39 ; Alternate Status Register is read to prevent polling host from40 ; reading status before it is valid.41 ;42 ; HStatus_ReadAndIgnoreAlternateStatus43 ; Parameters:44 ; DS:BX: Ptr to DPT45 ; Returns:46 ; Nothing47 ; Corrupts registers:48 ; AL, CX, DX49 ;--------------------------------------------------------------------50 ALIGN JUMP_ALIGN51 HStatus_ReadAndIgnoreAlternateStatus:52 mov cx, bx ; Backup BX53 eMOVZX bx, BYTE [bx+DPT.bIdeOff] ; CS:BX now points to IDEVARS54 mov dx, [cs:bx+IDEVARS.wPortCtrl] ; DX = Control Block base port55 add dx, BYTE REGR_IDEC_AST ; DX = Alternate Status Register address56 in al, dx ; Read Alternate Status Register57 mov bx, cx ; Restore BX58 ret59 60 61 ;--------------------------------------------------------------------62 38 ; Waits until Hard Disk is ready to transfer data. 63 39 ; … … 74 50 ALIGN JUMP_ALIGN 75 51 HStatus_WaitIrqOrDrq: 52 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN 53 jnz SHORT .PollDrqSinceInterruptsAreDisabled 54 jmp HIRQ_WaitIRQ 55 56 ALIGN JUMP_ALIGN 57 .PollDrqSinceInterruptsAreDisabled: 76 58 push dx 77 59 push cx 78 79 ; Check if interrupts are enabled80 test BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN81 jnz SHORT .PollDRQ ; Poll DRQ if IRQ disabled82 call HIRQ_WaitIRQ ; Wait for IRQ83 jmp SHORT .Return84 85 ALIGN JUMP_ALIGN86 .PollDRQ:87 call HStatus_ReadAndIgnoreAlternateStatus88 60 call HStatus_WaitDrqDefTime 89 ALIGN JUMP_ALIGN90 .Return:91 61 pop cx 92 62 pop dx … … 207 177 HStatus_PollBsyAndFlg: 208 178 call SoftDelay_InitTimeout ; Initialize timeout counter 179 in al, dx ; Discard contents for first read 180 ; (should read Alternate Status Register) 209 181 ALIGN JUMP_ALIGN 210 182 .PollLoop: … … 218 190 call SoftDelay_UpdTimeout ; Update timeout counter 219 191 jnc SHORT .PollLoop ; Loop if time left (sets CF on timeout) 220 jmp HError_ GetErrorCodeToAHforBitPollingTimeout192 jmp HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit 221 193 222 194 ;-------------------------------------------------------------------- … … 239 211 HStatus_PollBsy: 240 212 call SoftDelay_InitTimeout ; Initialize timeout counter 213 in al, dx ; Discard contents for first read 214 ; (should read Alternate Status Register) 241 215 ALIGN JUMP_ALIGN 242 216 .PollLoop: … … 248 222 ALIGN JUMP_ALIGN 249 223 GetErrorCodeFromPollingToAH: 250 jmp HError_ GetErrorCodeForStatusReg224 jmp HError_ProcessErrorsAfterPollingBSY
Note:
See TracChangeset
for help on using the changeset viewer.