Changeset 365 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h


Ignore:
Timestamp:
Mar 27, 2012, 5:01:57 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Errors from AH=9h are stored to DPTs again.
  • XT build fits in 8k again.
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
Files:
2 edited

Legend:

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

    r294 r365  
    4040;       CF:     0 if successful, 1 if error
    4141;   Corrupts registers:
    42 ;       AL, BX, CX, DX
     42;       AL, CX, DX
    4343;--------------------------------------------------------------------
    4444AH24h_SetBlockSize:
     45    push    bx
     46
    4547    push    ax
    46     xchg    dx, ax          ; DL = Block size (Sector Count Register)
    47     or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED ; Assume success
     48    xchg    dx, ax      ; DL = Block size (Sector Count Register)
    4849    mov     al, COMMAND_SET_MULTIPLE_MODE
    4950    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
    5051    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    5152    pop     bx
    52     jnc     .StoreBlockSize
    53     mov     bl, 1   ; Disable block mode
    54     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_BLOCK_MODE_SUPPORTED
    55 .StoreBlockSize:    ; Store new block size to DPT and return
    56     mov     [di+DPT_ATA.bSetBlock], bl
     53    jnc     SHORT .StoreBlockSize
     54    mov     bl, 1       ; Block size 1 will always work
     55.StoreBlockSize:        ; Store new block size to DPT and return
     56    mov     [di+DPT_ATA.bBlockSize], bl
     57
     58    pop     bx
    5759    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r364 r365  
    4343    push    es
    4444    push    si
    45     call    ClearErrorFlagFromBootMenuInfo  ; Do this for serial devices as well
    4645
    4746%ifdef MODULE_SERIAL
     
    5251
    5352%else
    54     ; Clear Initialization Error flag from DPT
    55     and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_INITERROR
     53    ; Clear Initialization Error flags from DPT
     54    mov     BYTE [di+DPT_ATA.bInitError], 0
    5655%endif
    5756
     
    6059    mov     [bp+IDEPACK.bDrvAndHead], al
    6160    call    Device_SelectDrive
    62     mov     al, FLG_INIT_FAILED_TO_SELECT_DRIVE
    63     call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     61    mov     al, FLG_INITERROR_FAILED_TO_SELECT_DRIVE
     62    call    SetErrorFlagFromALwithErrorCodeInAH
    6463    jc      SHORT .ReturnWithErrorCodeInAH
    6564
    6665    ; Initialize CHS parameters if LBA is not used
    6766    call    InitializeDeviceParameters
    68     mov     al, FLG_INIT_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    69     call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     67    mov     al, FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
     68    call    SetErrorFlagFromALwithErrorCodeInAH
    7069
    7170    ; Enable or Disable Write Cache
    7271    call    SetWriteCache
    73     mov     al, FLG_INIT_FAILED_TO_SET_WRITE_CACHE
    74     call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     72    mov     al, FLG_INITERROR_FAILED_TO_SET_WRITE_CACHE
     73    call    SetErrorFlagFromALwithErrorCodeInAH
    7574
    7675    ; Recalibrate drive by seeking to cylinder 0
    7776.RecalibrateDrive:
    7877    call    AH11h_RecalibrateDrive
    79     mov     al, FLG_INIT_FAILED_TO_RECALIBRATE_DRIVE
    80     call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     78    mov     al, FLG_INITERROR_FAILED_TO_RECALIBRATE_DRIVE
     79    call    SetErrorFlagFromALwithErrorCodeInAH
    8180
    8281    ; Initialize block mode transfers
    8382.InitializeBlockMode:
    8483    call    InitializeBlockMode
    85     mov     al, FLG_INIT_FAILED_TO_SET_BLOCK_MODE
    86     call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     84    mov     al, FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE
     85    call    SetErrorFlagFromALwithErrorCodeInAH
    8786
    8887%ifdef MODULE_ADVANCED_ATA
     
    9089.InitializePioMode:
    9190    call    InitializePioMode
    92     mov     al, FLG_INIT_FAILED_TO_SET_PIO_MODE
    93     call    SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     91    mov     al, FLG_INITERROR_FAILED_TO_SET_PIO_MODE
     92    call    SetErrorFlagFromALwithErrorCodeInAH
    9493%endif
    9594
    9695    ; There might have been several errors so just return
    9796    ; one error code for them all
    98     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INITERROR
    99     jz      SHORT .ReturnWithErrorCodeInAH
     97    cmp     BYTE [di+DPT_ATA.bInitError], 0
     98    je      SHORT .ReturnWithErrorCodeInAH
    10099    mov     ah, RET_HD_RESETFAIL
    101100    stc
     
    198197InitializeBlockMode:
    199198    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED ; Clear CF
    200     jz      SHORT ReturnSuccessSinceInitializationNotNeeded
    201 
     199    jz      SHORT .BlockModeNotSupportedOrDisabled
    202200    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    203     mov     al, 1                       ; Disable block mode
    204201    test    BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_BLOCKMODE
    205     eCMOVNZ al, [di+DPT_ATA.bMaxBlock]  ; Load max block size
    206     jmp     AH24h_SetBlockSize
    207 
    208 
    209 ;--------------------------------------------------------------------
    210 ; ClearErrorFlagFromBootMenuInfo
    211 ;   Parameters:
    212 ;       DS:DI:  Ptr to DPT
    213 ;   Returns:
    214 ;       Nothing
    215 ;   Corrupts registers:
    216 ;       BX, ES
    217 ;--------------------------------------------------------------------
    218 ClearErrorFlagFromBootMenuInfo:
    219     call    BootMenuInfo_IsAvailable    ; Load BOOTMENUINFO segment to ES
    220     jne     SHORT .DoNotStoreErrorFlags
    221     call    BootMenuInfo_ConvertDPTtoBX
    222     mov     WORD [es:bx+BOOTMENUINFO.wInitErrorFlags], 0    ; Must clear whole WORD!
    223 .DoNotStoreErrorFlags:
    224     ret
    225 
    226 
    227 ;--------------------------------------------------------------------
    228 ; SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo
     202    jz      SHORT .BlockModeNotSupportedOrDisabled
     203
     204    ; Try block sizes until we find largest possible supported by drive
     205    mov     bl, 128
     206.TryNextBlockSize:
     207    mov     al, bl
     208    call    AH24h_SetBlockSize
     209    jnc     SHORT .SupportedBlockSizeFound
     210    shr     bl, 1                       ; Try next size
     211    jmp     SHORT .TryNextBlockSize
     212.SupportedBlockSizeFound:
     213    mov     [di+DPT_ATA.bBlockSize], bl
     214.BlockModeNotSupportedOrDisabled:
     215ReturnSuccessSinceInitializationNotNeeded:
     216    ret
     217
     218
     219;--------------------------------------------------------------------
     220; SetErrorFlagFromALwithErrorCodeInAH
    229221;   Parameters:
    230222;       AH:     BIOS Error Code
     
    237229;       BX, ES
    238230;--------------------------------------------------------------------
    239 SetErrorFlagFromALwithErrorCodeInAHtoBootMenuInfo:
    240     jnc     SHORT NoErrorFlagToSet
     231SetErrorFlagFromALwithErrorCodeInAH:
     232    jnc     SHORT .NoErrorFlagToSet
    241233    cmp     ah, RET_HD_INVALID
    242234    jbe     SHORT .IgnoreInvalidCommandError
    243235
    244     call    BootMenuInfo_IsAvailable
    245     jne     SHORT .BootvarsNotAvailableSoDoNotSetErrorFlag
    246 
    247     call    BootMenuInfo_ConvertDPTtoBX
    248     or      [es:bx+BOOTMENUINFO.wInitErrorFlags], al
    249 .BootvarsNotAvailableSoDoNotSetErrorFlag:
    250     or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_INITERROR
     236    or      [di+DPT_ATA.bInitError], al
    251237    stc
    252238    ret
    253239.IgnoreInvalidCommandError:
    254 ReturnSuccessSinceInitializationNotNeeded:
    255240    xor     ah, ah
    256 NoErrorFlagToSet:
    257     ret
     241.NoErrorFlagToSet:
     242    ret
Note: See TracChangeset for help on using the changeset viewer.