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


Ignore:
Timestamp:
Oct 10, 2012, 6:22:23 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Large changes to prepare full XT-CF support (DMA not yet implemented and memory mapped transfers are not working).
Location:
trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h
Files:
5 edited

Legend:

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

    r472 r473  
    3838;--------------------------------------------------------------------
    3939AH1Eh_HandlerForXTCFfeatures:
    40     xor     ah, ah      ; Subcommand now in AX
    4140%ifndef USE_186
    42     call    AH1Eh_ProcessXTCFsubcommandFromAX
     41    call    AH1Eh_ProcessXTCFsubcommandFromAL
    4342    jmp     Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    4443%else
    4544    push    Int13h_ReturnFromHandlerAfterStoringErrorCodeFromAH
    46     ; Fall to AH1Eh_ProcessXTCFsubcommandFromAX
     45    ; Fall to AH1Eh_ProcessXTCFsubcommandFromAL
    4746%endif
    4847
    4948
    5049;--------------------------------------------------------------------
    51 ; AH1Eh_ProcessXTCFsubcommandFromAX
     50; AH1Eh_ProcessXTCFsubcommandFromAL
    5251;   Parameters:
    53 ;       AX:     XT-CF subcommand (see XTCF.inc for more info)
     52;       AL:     XT-CF subcommand (see XTCF.inc for more info)
    5453;       DS:DI:  Ptr to DPT (in RAMVARS segment)
    5554;       SS:BP:  Ptr to IDEPACK
     
    5857;       CF:     0 if successful, 1 if error
    5958;   Corrupts registers:
    60 ;       AL, BX, CX, DX
     59;       AL, BX, CX, DX, SI
    6160;--------------------------------------------------------------------
    62 AH1Eh_ProcessXTCFsubcommandFromAX:
     61AH1Eh_ProcessXTCFsubcommandFromAL:
    6362    ; IS_THIS_DRIVE_XTCF. We check this for all commands.
    64     dec     ax      ; Subcommand
    65     mov     dx, [di+DPT.wXTCFport]
    66     test    dx, dx  ; Never zero for XT-CF, Always zero for other devices
    67     jz      SHORT XTCFnotFound
     63    call    AccessDPT_IsThisDeviceXTCF
     64    jne     SHORT XTCFnotFound
     65    and     ax, BYTE 7Fh                ; Subcommand now in AX
     66    jz      SHORT .ReturnWithSuccess    ; IS_THIS_DRIVE_XTCF
    6867
    6968    ; READ_XTCF_CONTROL_REGISTER_TO_DH
    70     add     dl, XTCF_CONTROL_REGISTER   ; DX to Control Register
    71     dec     ax      ; Subcommand
     69    dec     ax                          ; Subcommand
    7270    jnz     SHORT .SkipReadXtcfControlRegisterToDH
     71    mov     dx, [di+DPT.wBasePort]
     72    add     dl, XTCF_CONTROL_REGISTER
    7373    in      al, dx
    7474    mov     [bp+IDEPACK.intpack+INTPACK.dh], al
    75     jmp     SHORT .ReturnWithSuccess
     75.ReturnWithSuccess:
     76    xor     ah, ah
     77    ret
    7678.SkipReadXtcfControlRegisterToDH:
    7779
    7880    ; WRITE_DH_TO_XTCF_CONTROL_REGISTER
    79     dec     ax      ; Subcommand
     81    dec     ax                          ; Subcommand
    8082    jnz     SHORT XTCFnotFound          ; Invalid subcommand
    8183    mov     al, [bp+IDEPACK.intpack+INTPACK.dh]
     84    ; Fall to AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     85
     86
     87;--------------------------------------------------------------------
     88; AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     89;   Parameters:
     90;       AL:     XT-CF Control Register
     91;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     92;       SS:BP:  Ptr to IDEPACK
     93;   Returns:
     94;       AH:     Int 13h return status
     95;       CF:     0 if successful, 1 if error
     96;   Corrupts registers:
     97;       AL, BX, CX, DX, SI
     98;--------------------------------------------------------------------
     99AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL:
     100    ; Output Control Register
     101    mov     dx, [di+DPT.wBasePort]
     102    add     dl, XTCF_CONTROL_REGISTER
    82103    out     dx, al
    83 .ReturnWithSuccess:
    84     xor     ah, ah
    85     ret
     104
     105    ; Convert Control Register Contents to device code
     106    test    al, al
     107    jz      SHORT .Set8bitPioMode
     108    cmp     al, XTCF_MEMORY_MAPPED_MODE
     109    jae     SHORT .SetMemoryMappedMode
     110
     111    ; Set DMA Mode
     112    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
     113    jmp     AH23h_Disable8bitPioMode
     114
     115.SetMemoryMappedMode:
     116    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_MEMMAP
     117    jmp     AH23h_Disable8bitPioMode
     118
     119.Set8bitPioMode:
     120    mov     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_PIO8
     121    jmp     AH23h_Enable8bitPioMode
    86122
    87123
     
    96132;               Set if XT-CF not found
    97133;   Corrupts registers:
    98 ;       AL, DX
     134;       AL
    99135;--------------------------------------------------------------------
    100136AH1Eh_DetectXTCFwithBasePortInDX:
     137    push    dx
    101138    add     dl, XTCT_CONTROL_REGISTER_INVERTED_in   ; set DX to XT-CF config register (inverted)
    102139    in      al, dx      ; get value
     
    104141    inc     dx          ; set DX to XT-CF config register (non-inverted)
    105142    in      al, dx      ; get value
    106     not     al          ; invert it
     143    not     al          ; invert value
     144    pop     dx
    107145    sub     ah, al      ; do they match? (clear AH if they do)
    108146    jz      SHORT XTCFfound
    109147
    110148XTCFnotFound:
     149AH1Eh_LoadInvalidCommandToAHandSetCF:
    111150    stc                 ; set carry flag since XT-CF not found
    112151    mov     ah, RET_HD_INVALID
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH23h_HFeatures.asm

    r376 r473  
    7474    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_BSY, FLG_STATUS_BSY)
    7575    jmp     Idepack_StoreNonExtParametersAndIssueCommandFromAL
     76
     77
     78%ifdef MODULE_8BIT_IDE
     79;--------------------------------------------------------------------
     80; AH23h_Enable8bitPioMode
     81; AH23h_Disable8bitPioMode
     82;   Parameters:
     83;       DS:DI:  Ptr to DPT (in RAMVARS segment)
     84;       SS:BP:  Ptr to IDEPACK
     85;   Returns:
     86;       AH:     Int 13h return status
     87;       CF:     0 if successful, 1 if error
     88;   Corrupts registers:
     89;       AL, BX, CX, DX, SI
     90;--------------------------------------------------------------------
     91AH23h_Enable8bitPioMode:
     92    mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
     93    jmp     SHORT AH23h_SetControllerFeatures
     94AH23h_Disable8bitPioMode:
     95    mov     si, FEATURE_DISABLE_8BIT_PIO_TRANSFER_MODE
     96    jmp     SHORT AH23h_SetControllerFeatures
     97%endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH24h_HSetBlocks.asm

    r376 r473  
    5959;--------------------------------------------------------------------
    6060AH24h_SetBlockSize:
     61    ; XT-CF does not support largest block size in DMA mode.
     62%ifdef MODULE_8BIT_IDE
     63    call    AccessDPT_IsThisDeviceXTCF
     64    cmp     ah, DEVICE_8BIT_XTCF_DMA
     65    jne     SHORT .NoNeedToLimitBlockSize
     66    cmp     al, XTCF_DMA_MODE_MAX_BLOCK_SIZE
     67    ja      SHORT AH1Eh_LoadInvalidCommandToAHandSetCF
     68.NoNeedToLimitBlockSize:
     69%endif ; MODULE_8BIT_IDE
     70
    6171    push    bx
    6272
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r445 r473  
    104104    jmp     .ReturnWithErrorCodeInAH
    105105.ContinueInitializationSinceDriveSelectedSuccesfully:
     106
     107
     108;;; Set XT-CF mode
     109%ifdef MODULE_8BIT_IDE
     110    call    AccessDPT_IsThisDeviceXTCF
     111    jne     SHORT .DoNotSetXTCFmode
     112
     113    call    AccessDPT_GetIdevarsToCSBX
     114    mov     al, [cs:bx+IDEVARS.bXTCFcontrolRegister]
     115    call    AH1Eh_ChangeXTCFmodeBasedOnControlRegisterInAL
     116    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_XTCF_MODE
     117.DoNotSetXTCFmode:
     118%endif
    106119
    107120
     
    125138    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_INITIALIZE_CHS_PARAMETERS
    126139.SkipInitializeDeviceParameters:
    127 
    128 
    129 %ifdef MODULE_8BIT_IDE
    130 ;;; Enable 8-bit PIO Transfer Mode for Lo-tech XT-CF (CF and Microdrives only)
    131     call    AH9h_Enable8bitPioModeForXTCF
    132     STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_ENABLE_8BIT_PIO_MODE
    133 %endif
    134140
    135141
     
    244250;       Nothing
    245251;--------------------------------------------------------------------
    246 DoNotEnable8bitMode:
    247252IgnoreInvalidCommandError:
    248253    xor     ah, ah  ; Clears CF
     
    256261.NoErrorFlagToSet:
    257262    ret
    258 
    259 
    260 %ifdef MODULE_8BIT_IDE
    261 ;--------------------------------------------------------------------
    262 ; AH9h_Enable8bitPioModeForXTCF
    263 ;   Parameters:
    264 ;       DS:DI:  Ptr to DPT
    265 ;       SS:BP:  Ptr to IDEPACK
    266 ;   Returns:
    267 ;       AH:     Int 13h return status
    268 ;       CF:     0 if successful, 1 if error
    269 ;   Corrupts registers:
    270 ;       AL, BX, CX, DX, SI
    271 ;--------------------------------------------------------------------
    272 AH9h_Enable8bitPioModeForXTCF:
    273     eMOVZX  bx, [di+DPT.bIdevarsOffset]
    274     cmp     BYTE [cs:bx+IDEVARS.bDevice], DEVICE_8BIT_XTCF
    275     jne     SHORT DoNotEnable8bitMode
    276 
    277     mov     si, FEATURE_ENABLE_8BIT_PIO_TRANSFER_MODE
    278     jmp     AH23h_SetControllerFeatures
    279 %endif ; MODULE_8BIT_IDE
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AHDh_HReset.asm

    r445 r473  
    7070
    7171    ; Initialize Master and Slave drives
    72     eMOVZX  ax, [di+DPT.bIdevarsOffset]         ; (AL) pointer to controller we are looking to reset
     72    call    AccessDPT_GetIdevarsToCSBX
     73    xchg    ax, bx                              ; (AL) pointer to controller we are looking to reset
    7374                                                ; (AH) initialize error code, assume success
    7475
Note: See TracChangeset for help on using the changeset viewer.