Ignore:
Timestamp:
Aug 1, 2010, 5:57:24 PM (14 years ago)
Author:
aitotat
google:author:
aitotat
Message:
  • v1.1.1 broke booting from foreign drives, it is now fixed.
  • Improved error handling a bit.
  • Longer DRQ and IRQ timeouts to minimize write timouts with some (bad) CF cards.
  • Default boot menu drive should now be properly selected.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm

    r27 r28  
    22; Project name  :   IDE BIOS
    33; Created date  :   15.12.2009
    4 ; Last update   :   28.7.2010
     4; Last update   :   1.8.2010
    55; Author        :   Tomi Tilli
    66; Description   :   IDE Status Register polling functions.
     
    2626HStatus_WaitIrqOrRdy:
    2727    test    BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN
    28     jnz     SHORT .PollRdySinceIrqsAreDisabled
     28    jnz     SHORT .PollRdySinceInterruptsAreDisabled
    2929    jmp     HIRQ_WaitIRQ
    30 ALIGN JUMP_ALIGN
    31 .PollRdySinceIrqsAreDisabled:
    32     call    HStatus_ReadAndIgnoreAlternateStatus
     30
     31ALIGN JUMP_ALIGN
     32.PollRdySinceInterruptsAreDisabled:
    3333    mov     cl, B_TIMEOUT_DRQ               ; Load DRQ (not RDY) timeout
    3434    jmp     SHORT HStatus_WaitRdy           ; Jump to poll RDY
     
    3636
    3737;--------------------------------------------------------------------
    38 ; Reads Alternate Status Register and ignores result.
    39 ; Alternate Status Register is read to prevent polling host from
    40 ; reading status before it is valid.
    41 ;
    42 ; HStatus_ReadAndIgnoreAlternateStatus
    43 ;   Parameters:
    44 ;       DS:BX:  Ptr to DPT
    45 ;   Returns:
    46 ;       Nothing
    47 ;   Corrupts registers:
    48 ;       AL, CX, DX
    49 ;--------------------------------------------------------------------
    50 ALIGN JUMP_ALIGN
    51 HStatus_ReadAndIgnoreAlternateStatus:
    52     mov     cx, bx                          ; Backup BX
    53     eMOVZX  bx, BYTE [bx+DPT.bIdeOff]       ; CS:BX now points to IDEVARS
    54     mov     dx, [cs:bx+IDEVARS.wPortCtrl]   ; DX = Control Block base port
    55     add     dx, BYTE REGR_IDEC_AST          ; DX = Alternate Status Register address
    56     in      al, dx                          ; Read Alternate Status Register
    57     mov     bx, cx                          ; Restore BX
    58     ret
    59 
    60 
    61 ;--------------------------------------------------------------------
    6238; Waits until Hard Disk is ready to transfer data.
    6339;
     
    7450ALIGN JUMP_ALIGN
    7551HStatus_WaitIrqOrDrq:
     52    test    BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN
     53    jnz     SHORT .PollDrqSinceInterruptsAreDisabled
     54    jmp     HIRQ_WaitIRQ
     55
     56ALIGN JUMP_ALIGN
     57.PollDrqSinceInterruptsAreDisabled:
    7658    push    dx
    7759    push    cx
    78 
    79     ; Check if interrupts are enabled
    80     test    BYTE [bx+DPT.bDrvCtrl], FLG_IDE_CTRL_nIEN
    81     jnz     SHORT .PollDRQ                  ; Poll DRQ if IRQ disabled
    82     call    HIRQ_WaitIRQ                    ; Wait for IRQ
    83     jmp     SHORT .Return
    84 
    85 ALIGN JUMP_ALIGN
    86 .PollDRQ:
    87     call    HStatus_ReadAndIgnoreAlternateStatus
    8860    call    HStatus_WaitDrqDefTime
    89 ALIGN JUMP_ALIGN
    90 .Return:
    9161    pop     cx
    9262    pop     dx
     
    207177HStatus_PollBsyAndFlg:
    208178    call    SoftDelay_InitTimeout               ; Initialize timeout counter
     179    in      al, dx                              ; Discard contents for first read
     180                                                ; (should read Alternate Status Register)
    209181ALIGN JUMP_ALIGN
    210182.PollLoop:
     
    218190    call    SoftDelay_UpdTimeout                ; Update timeout counter
    219191    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
    220     jmp     HError_GetErrorCodeToAHforBitPollingTimeout
     192    jmp     HError_ProcessTimeoutAfterPollingBSYandSomeOtherStatusBit
    221193
    222194;--------------------------------------------------------------------
     
    239211HStatus_PollBsy:
    240212    call    SoftDelay_InitTimeout               ; Initialize timeout counter
     213    in      al, dx                              ; Discard contents for first read
     214                                                ; (should read Alternate Status Register)
    241215ALIGN JUMP_ALIGN
    242216.PollLoop:
     
    248222ALIGN JUMP_ALIGN
    249223GetErrorCodeFromPollingToAH:
    250     jmp     HError_GetErrorCodeForStatusReg
     224    jmp     HError_ProcessErrorsAfterPollingBSY
Note: See TracChangeset for help on using the changeset viewer.