Changeset 550 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src


Ignore:
Timestamp:
Apr 27, 2013, 5:30:50 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • CREATE_COMPATIBLE_DPT is now MODULE_COMPATIBLE_TABLES.
  • DPTs pointed by INT 41h and INT 46h are now swapped when swapping drives 81h and 80h.
  • Block mode commands are no longer used when block size is set to 1 with AH=24h.
Location:
trunk/XTIDE_Universal_BIOS/Src
Files:
12 edited

Legend:

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

    r545 r550  
    6868    ; must know what the actual block size is.
    6969    cmp     BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_XTCF_DMA
    70     je      SHORT ProcessXTCFsubcommandFromAL.AH1Eh_LoadInvalidCommandToAHandSetCF
     70    je      SHORT .DisableBlockMode
    7171.NoNeedToLimitBlockSize:
    7272%endif ; MODULE_8BIT_IDE_ADVANCED
     
    7474    push    bx
    7575
    76     push    ax
     76    push    ax          ; Store block size for later use
    7777    xchg    dx, ax      ; DL = Block size (Sector Count Register)
    7878    mov     al, COMMAND_SET_MULTIPLE_MODE
    7979    mov     bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_DRDY, FLG_STATUS_DRDY)
    8080    call    Idepack_StoreNonExtParametersAndIssueCommandFromAL
    81     pop     bx
    82     jnc     SHORT .StoreBlockSize
    8381
    84     ; Drive disabled block mode since we tried unsupported block size.
    85     ; We must adjust DPT accordingly.
    86     mov     bl, 1       ; Block size 1 will always work (=Block mode disabled)
    87 .StoreBlockSize:        ; Store new block size to DPT and return
     82    ; Disable block mode if failure or if called with block size of 1 sector.
     83    ; Some drives allow block mode commands for 1 sector blocks and some do not.
     84    pop     bx          ; Pop block size to BL
     85    jc      SHORT .DisableBlockMode
     86    mov     bh, bl      ; BL and BH both have block size we tried to set
     87    dec     bh
     88    jz      SHORT .DisableBlockMode
     89
     90    ; Enable block mode and store block size
     91    or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_USE_BLOCK_MODE_COMMANDS
     92    jmp     SHORT .StoreBlockSizeFromBLandReturn
     93
     94.DisableBlockMode:
     95    and     BYTE [di+DPT.bFlagsHigh], ~FLGH_DPT_USE_BLOCK_MODE_COMMANDS
     96    mov     bl, 1
     97    stc
     98.StoreBlockSizeFromBLandReturn:
    8899    mov     [di+DPT_ATA.bBlockSize], bl
    89 
    90100    pop     bx
    91101    ret
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH9h_HInit.asm

    r545 r550  
    163163    ; Initialize block mode transfers
    164164    pop     ax  ; Restore .wFlags saved in SetWriteCache
    165     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
    166     jz      SHORT .BlockModeNotSupportedOrDisabled
    167     test    al, FLG_DRVPARAMS_BLOCKMODE
    168     jz      SHORT .BlockModeNotSupportedOrDisabled
     165    test    al, FLG_DRVPARAMS_BLOCKMODE ; Tested here so block mode can be enabled with AH=24h
     166    jz      SHORT .BlockModeDisabled
    169167
    170168    ; Try block sizes until we find largest possible supported by drive
     
    177175    jnc     SHORT .TryNextBlockSize
    178176    STORE_ERROR_FLAG_TO_DPT     FLG_INITERROR_FAILED_TO_SET_BLOCK_MODE
    179 .BlockModeNotSupportedOrDisabled:
     177.BlockModeDisabled:
    180178.SupportedBlockSizeFound:
    181179
     
    286284%endif ; MODULE_8BIT_IDE_ADVANCED
    287285
     286
    288287%ifdef MODULE_8BIT_IDE
    289288;--------------------------------------------------------------------
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH41h_CheckIfExtensionsPresent.asm

    r541 r550  
    4444    mov     WORD [bp+IDEPACK.intpack+INTPACK.bx], 0AA55h
    4545
    46 %ifdef CREATE_COMPATIBLE_DPT
     46%ifdef MODULE_COMPATIBLE_TABLES
    4747    call    AH41h_GetSupportBitsToCX
    4848    mov     [bp+IDEPACK.intpack+INTPACK.cx], cx
    4949%else
    5050    mov     WORD [bp+IDEPACK.intpack+INTPACK.cx], ENHANCED_DRIVE_ACCESS_SUPPORT
    51 %endif
     51%endif ; MODULE_COMPATIBLE_TABLES
    5252
    5353    and     BYTE [bp+IDEPACK.intpack+INTPACK.flags], ~FLG_FLAGS_CF  ; Return with CF cleared
     
    5757
    5858
    59 %ifdef CREATE_COMPATIBLE_DPT
     59%ifdef MODULE_COMPATIBLE_TABLES
    6060;--------------------------------------------------------------------
    6161; AH41h_GetSupportBitsToCX
     
    8787    ret
    8888
    89 %endif ; CREATE_COMPATIBLE_DPT
     89%endif ; MODULE_COMPATIBLE_TABLES
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/EBIOS/AH48h_GetExtendedDriveParameters.asm

    r545 r550  
    8181
    8282    ; Create DPTE (hardware information for device drivers)
    83 %ifdef CREATE_COMPATIBLE_DPT
     83%ifdef MODULE_COMPATIBLE_TABLES
    8484    call    AH41h_GetSupportBitsToCX
    8585    test    cl, ENHANCED_DISK_DRIVE_SUPPORT
     
    8787    call    CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI
    8888.DoNotCreateDPTE:
    89 %endif
     89%endif ; MODULE_COMPATIBLE_TABLES
    9090
    9191    ; Point DS:DI to Extended Drive Information Table to fill
     
    107107    ; Store DPTE for standard controllers only,
    108108    ; FFFF:FFFF for non standard controllers
    109 %ifdef CREATE_COMPATIBLE_DPT
     109%ifdef MODULE_COMPATIBLE_TABLES
    110110    mov     [di+EDRIVE_INFO.fpDPTE], bx
    111111    mov     [di+EDRIVE_INFO.fpDPTE+2], es
     
    117117    mov     [di+EDRIVE_INFO.fpDPTE], bx
    118118    mov     [di+EDRIVE_INFO.fpDPTE+2], bx
    119 %endif
     119%endif ; MODULE_COMPATIBLE_TABLES
    120120
    121121    ; Fill Extended Drive Information Table in DS:DI from DPT in ES:SI
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/Tools/Prepare.asm

    r547 r550  
    8181    ; Block mode or single sector
    8282    mov     bl, [di+DPT.bFlagsHigh]
    83     and     bx, BYTE FLGH_DPT_BLOCK_MODE_SUPPORTED  ; Bit 1
     83    and     bx, BYTE FLGH_DPT_USE_BLOCK_MODE_COMMANDS   ; Bit 1
    8484    ret
    8585
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r542 r550  
    151151.NoUserDefinedLBA:
    152152
    153     ; * Disable Block Mode transfers *
    154     test    dl, FLG_DRVPARAMS_BLOCKMODE
    155     jnz     SHORT .NoNeedToDisableBlockMode
    156     mov     BYTE [si+ATA1.bBlckSize], 1 ; sectors
    157 .NoNeedToDisableBlockMode:
    158 
    159153    ; * Load P-CHS to L-CHS translate mode to DX *
    160154    and     dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/Initialize.asm

    r542 r550  
    8383
    8484
    85 %ifdef CREATE_COMPATIBLE_DPT
     85%ifdef MODULE_COMPATIBLE_TABLES
    8686;--------------------------------------------------------------------
    8787; .StoreDptPointersToIntVectors
     
    118118.CompatibleDPTsCreated:
    119119    ; Fall to .ResetDetectedDrives
    120 %endif ; CREATE_COMPATIBLE_DPT
     120%endif ; MODULE_COMPATIBLE_TABLES
    121121
    122122
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r545 r550  
    199199    %include "DetectDrives.asm"     ; For detecting IDE drives
    200200    %include "DetectPrint.asm"      ; For printing drive detection strings
     201%ifdef MODULE_COMPATIBLE_TABLES
     202    %include "CompatibleDPT.asm"
     203%endif
    201204
    202205    ; Hotkey Bar
     
    281284    %include "AH48h_GetExtendedDriveParameters.asm"
    282285    %include "AH41h_CheckIfExtensionsPresent.asm"
    283 %ifdef CREATE_COMPATIBLE_DPT
    284     %include "CompatibleDPT.asm"
    285 %endif
    286 %endif
     286%endif
  • trunk/XTIDE_Universal_BIOS/Src/Menus/BootMenu/BootMenuPrintCfg.asm

    r526 r550  
    8181.PushBlockMode:
    8282    mov     ax, 1
    83     test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
     83    test    BYTE [di+DPT.bFlagsHigh], FLGH_DPT_USE_BLOCK_MODE_COMMANDS
    8484    jz      SHORT .PushBlockSizeFromAX
    8585    mov     al, [di+DPT_ATA.bBlockSize]
  • trunk/XTIDE_Universal_BIOS/Src/Menus/DriveXlate.asm

    r547 r550  
    9696    test    dl, ah                  ; Hard disk?
    9797    jnz     SHORT .SwapDrive        ; If so, jump to swap
     98
    9899    mov     al, [RAMVARS.xlateVars+XLATEVARS.bFDSwap]
    99100    cbw
     
    106107    jne     SHORT .RestoreAXandReturn
    107108    mov     al, ah
     109
    108110ALIGN JUMP_ALIGN
    109111.SwapToXXhInAL:
    110112    mov     dl, al
     113
     114%ifdef MODULE_COMPATIBLE_TABLES
     115    cmp     al, 81h
     116    jne     SHORT .RestoreAXandReturn
     117
     118    ; Since swapping drive 80h <=> 81h, we need to swap
     119    ; DPT pointers in interrupt vectors 41h and 46h.
     120    push    ds
     121    LOAD_BDA_SEGMENT_TO ds, ax
     122    mov     ax, [HD0_DPT_POINTER_41h*4]
     123    xchg    [HD1_DPT_POINTER_46h*4], ax
     124    mov     [HD0_DPT_POINTER_41h*4], ax
     125    mov     ax, [HD0_DPT_POINTER_41h*4+2]
     126    xchg    [HD1_DPT_POINTER_46h*4+2], ax
     127    mov     [HD0_DPT_POINTER_41h*4+2], ax
     128    pop     ds
     129%endif ; MODULE_COMPATIBLE_TABLES
     130
    111131ALIGN JUMP_ALIGN
    112132.RestoreAXandReturn:
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CompatibleDPT.asm

    r543 r550  
    6363;       Nothing
    6464;--------------------------------------------------------------------
     65%ifdef MODULE_EBIOS
    6566GetTemporaryBufferForDPTEtoESDI:
    6667    call    GetBufferForDrive80hToESDI
    6768    add     di, BYTE TRANSLATED_DPT_size * 2
    6869    ret
     70%endif
    6971
    7072GetBufferForDrive80hToESDI:
     
    7375    mov     di, [cs:ROMVARS.bStealSize] ; No harm to read WORD
    7476    eSHL_IM di, 10                      ; DI = RAMVARS size in bytes
     77%ifdef MODULE_EBIOS
    7578    sub     di, BYTE (TRANSLATED_DPT_size * 2) + DPTE_size
     79%else
     80    sub     di, BYTE TRANSLATED_DPT_size * 2
     81%endif
    7682    ret
    7783
     
    174180
    175181
     182%ifdef MODULE_EBIOS
    176183;--------------------------------------------------------------------
    177184; CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI
     
    248255    lea     bx, [di-DPTE_size]
    249256    ret
     257%endif ; MODULE_EBIOS
    250258
    251259
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r549 r550  
    128128    or      [di+DPT.bFlagsLow], cl  ; Shift count and addressing mode
    129129    mov     [di+DPT.wPchsHeadsAndSectors], bx
    130 
    131 %ifdef MODULE_EBIOS
     130%ifdef MODULE_COMPATIBLE_TABLES OR MODULE_EBIOS
    132131    ; Store P-Cylinders here for Compatible DPTs when FLGL_DPT_LBA is not set
    133132    ; or when drive has over 15,482,880 sectors
    134133    mov     [di+DPT.wPchsCylinders], ax
     134%endif
     135
     136%ifdef MODULE_EBIOS
    135137    test    cl, FLGL_DPT_LBA
    136138    jz      SHORT .NoLbaSoNoEBIOS
     
    188190.NoLbaSoNoEBIOS:
    189191%endif ; MODULE_EBIOS
    190     ; Fall to .StoreBlockMode
    191 
    192 ;--------------------------------------------------------------------
    193 ; .StoreBlockMode
    194 ;   Parameters:
    195 ;       DS:DI:  Ptr to Disk Parameter Table
    196 ;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    197 ;       CS:BP:  Ptr to IDEVARS for the controller
    198 ;   Returns:
    199 ;       Nothing
    200 ;   Corrupts registers:
    201 ;       Nothing
    202 ;--------------------------------------------------------------------
    203 .StoreBlockMode:
    204     cmp     BYTE [es:si+ATA1.bBlckSize], 1  ; Max block size in sectors
    205     jbe     SHORT .BlockModeTransfersNotSupported
    206     or      BYTE [di+DPT.bFlagsHigh], FLGH_DPT_BLOCK_MODE_SUPPORTED
    207 .BlockModeTransfersNotSupported:
    208192    ; Fall to .StoreDeviceSpecificParameters
    209193
Note: See TracChangeset for help on using the changeset viewer.