Changeset 27 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common


Ignore:
Timestamp:
Jul 28, 2010, 6:53:32 PM (14 years ago)
Author:
Tomi Tilli
google:author:
aitotat
Message:
  • v1.1.1 broke booting from foreign drives, it is now fixed.
  • Fixed a bug where Disk Parameter Table was accessed with wrong pointer register after writing last block.
  • Cleaned AH=00h, Disk Controller Reset a bit.
  • Timeout errors might now get translated for better error codes on certain situations.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common
Files:
2 edited

Legend:

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

    r3 r27  
    22; Project name  :   IDE BIOS
    33; Created date  :   30.11.2007
    4 ; Last update   :   8.4.2010
     4; Last update   :   28.7.2010
    55; Author        :   Tomi Tilli
    66; Description   :   Error checking functions for BIOS Hard disk functions.
     
    88; Section containing code
    99SECTION .text
     10
     11;--------------------------------------------------------------------
     12; HError_GetErrorCodeToAHforBitPollingTimeout
     13;   Parameters:
     14;       AL:     IDE Status Register contents
     15;       DX:     IDE Status Register Address
     16;   Returns:
     17;       AH:     Hard disk BIOS error code
     18;       CF:     Set since error
     19;   Corrupts registers:
     20;       AL, CX
     21;--------------------------------------------------------------------
     22ALIGN JUMP_ALIGN
     23HError_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
    1030
    1131;--------------------------------------------------------------------
     
    3757    mov     [HDBDA.wHDStAndErr], ax         ; Store Status and Error to BDA
    3858    pop     ds
    39 
    40     ; Translate registers to BIOS error code
    4159    ; Fall to HError_ConvertIdeErrorToBiosRet
    4260
     
    5876ALIGN JUMP_ALIGN
    5977HError_ConvertIdeErrorToBiosRet:
    60     ; Any error?
     78    test    al, FLG_IDE_ST_BSY
     79    jnz     SHORT .TimeoutError
    6180    test    al, FLG_IDE_ST_DF | FLG_IDE_ST_CORR | FLG_IDE_ST_ERR
    6281    jnz     SHORT .ReadErrorFromStatusReg
    6382    xor     ah, ah                  ; No errors, zero AH and CF
     83    ret
     84
     85.TimeoutError:
     86    mov     ah, RET_HD_TIMEOUT
     87    stc
    6488    ret
    6589
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Common/HStatus.asm

    r26 r27  
    22; Project name  :   IDE BIOS
    33; Created date  :   15.12.2009
    4 ; Last update   :   26.6.2010
     4; Last update   :   28.7.2010
    55; Author        :   Tomi Tilli
    66; Description   :   IDE Status Register polling functions.
     
    189189; IDE Status register polling.
    190190; This function first waits until controller is not busy.
    191 ; When not busy, IDE Status Register is polled until wanted
    192 ; flag (HBIT_ST_DRDY or HBIT_ST_DRQ) is set.
     191; When not busy, IDE Status Register is polled until wanted flag is set.
    193192;
    194193; HStatus_PollBusyAndFlg
     
    207206ALIGN JUMP_ALIGN
    208207HStatus_PollBsyAndFlg:
    209     call    SoftDelay_InitTimeout       ; Initialize timeout counter
     208    call    SoftDelay_InitTimeout               ; Initialize timeout counter
    210209ALIGN JUMP_ALIGN
    211210.PollLoop:
    212     in      al, dx                      ; Load IDE Status Register
    213     test    al, FLG_IDE_ST_BSY          ; Controller busy?
    214     jnz     SHORT .UpdateTimeout        ;  If so, jump to timeout update
    215     test    al, ah                      ; Test secondary flag
    216     jnz     SHORT HStatus_PollCompleted ; If set, break loop
     211    in      al, dx                              ; Load IDE Status Register
     212    test    al, FLG_IDE_ST_BSY                  ; Controller busy?
     213    jnz     SHORT .UpdateTimeout                ;  If so, jump to timeout update
     214    test    al, ah                              ; Test secondary flag
     215    jnz     SHORT GetErrorCodeFromPollingToAH   ; If set, break loop
    217216ALIGN JUMP_ALIGN
    218217.UpdateTimeout:
    219     call    SoftDelay_UpdTimeout        ; Update timeout counter
    220     jnc     SHORT .PollLoop             ; Loop if time left (sets CF on timeout)
    221     mov     ah, RET_HD_TIMEOUT          ; Load error code for timeout
    222     ret
    223 
     218    call    SoftDelay_UpdTimeout                ; Update timeout counter
     219    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
     220    jmp     HError_GetErrorCodeToAHforBitPollingTimeout
    224221
    225222;--------------------------------------------------------------------
     
    241238ALIGN JUMP_ALIGN
    242239HStatus_PollBsy:
    243     call    SoftDelay_InitTimeout       ; Initialize timeout counter
     240    call    SoftDelay_InitTimeout               ; Initialize timeout counter
    244241ALIGN JUMP_ALIGN
    245242.PollLoop:
    246     in      al, dx                      ; Load IDE Status Reg
    247     test    al, FLG_IDE_ST_BSY          ; Controller busy? (clears CF)
    248     jz      SHORT HStatus_PollCompleted ;  If not, jump to check errors
    249     call    SoftDelay_UpdTimeout        ; Update timeout counter
    250     jnc     SHORT .PollLoop             ; Loop if time left (sets CF on timeout)
    251     mov     ah, RET_HD_TIMEOUT          ; Load error code for timeout
    252     ret
    253 
    254 ALIGN JUMP_ALIGN
    255 HStatus_PollCompleted:
    256     test    al, FLG_IDE_ST_DF | FLG_IDE_ST_ERR
    257     jnz     SHORT .GetErrorCode         ;  If errors, jump to get error code
    258     xor     ah, ah                      ; Zero AH and clear CF
    259     ret
    260 .GetErrorCode:
     243    in      al, dx                              ; Load IDE Status Reg
     244    test    al, FLG_IDE_ST_BSY                  ; Controller busy?
     245    jz      SHORT GetErrorCodeFromPollingToAH   ;  If not, jump to check errors
     246    call    SoftDelay_UpdTimeout                ; Update timeout counter
     247    jnc     SHORT .PollLoop                     ; Loop if time left (sets CF on timeout)
     248ALIGN JUMP_ALIGN
     249GetErrorCodeFromPollingToAH:
    261250    jmp     HError_GetErrorCodeForStatusReg
Note: See TracChangeset for help on using the changeset viewer.