Changeset 28 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm
- Timestamp:
- Aug 1, 2010, 5:57:24 PM (15 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.