Changeset 549 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Apr 22, 2013, 10:32:25 AM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Assited LBA is now the default geometry translation mode if MODULE_EBIOS is defined and drive supports LBA.
  • P-Heads are now limited to 15 only when LARGE mode requires Revised ECHS translation.


Location:
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm

    r547 r549  
    6565
    6666;--------------------------------------------------------------------
    67 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX
     67; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX
    6868;   Parameters:
    6969;       DX:     Wanted translate mode or TRANSLATEMODE_AUTO to autodetect
     
    7878;       DH
    7979;--------------------------------------------------------------------
    80 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX:
     80AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX:
    8181    call    AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI
    8282
     
    9292    ; TRANSLATEMODE_AUTO set
    9393
     94%ifndef MODULE_EBIOS
     95    ; Since we do not have EBIOS functions, we might as well use the faster
     96    ; LARGE mode for small drives. Assisted LBA provides more capacity for
     97    ; larger drives.
    9498    ; Generate L-CHS using simple bit shift algorithm (ECHS) if
    9599    ; 8192 or less cylinders.
    96100    cmp     ax, 8192
    97101    jbe     SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
    98 
    99     ; We have 8193 or more cylinders so two algorithms are available:
    100     ; Revised ECHS or Assisted LBA. The Assisted LBA provides larger
    101     ; capacity but requires LBA support from drive (drives this large
    102     ; always support LBA but user might have unintentionally set LBA).
    103 .UseAssistedLBA:
     102%endif
     103
     104    ; If we have EBIOS functions, we should always use Assisted LBA
     105    ; for drives with LBA support. Otherwise the EBIOS functions are
     106    ; useless since we never do LBA to P-CHS translation.
     107    ; Even if we do not have EBIOS functions, we must do this check
     108    ; since user might have forced LBA mode even though the drive does
     109    ; not support LBA addressing.
    104110    test    BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8
    105111    jz      SHORT ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL
    106112
    107     ; Drive supports LBA
     113    ; Assisted LBA provides most capacity but translation algorithm is
     114    ; slower. The speed difference doesn't matter on AT systems.
     115.UseAssistedLBA:
    108116    call    GetSectorCountToDXAXfromCHSinAXBLBH
    109117    call    ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH
     
    183191    ; Generate L-CHS using simple bit shift algorithm (ECHS) if
    184192    ; 8192 or less cylinders
    185     cmp     ax, 8192
    186     jbe     SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
    187     cmp     bl, 16  ; Drives with 8193 or more cylinders can report 15 heads
    188     jb      SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
     193    call    AtaGeometry_IsDriveSmallEnoughForECHS
     194    jc      SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
    189195
    190196    eMOVZX  cx, bl  ; CX = 16
     
    239245    mov     dl, TRANSLATEMODE_LARGE
    240246    jmp     SHORT .ShiftIfMoreThan1024Cylinder
     247
     248
     249;--------------------------------------------------------------------
     250; Checks should LARGE mode L-CHS be calculated with ECHS or Revised ECHS
     251; algorithm. Revised ECHS is needed for drives with 8193 or more cylinders
     252; AND 16 heads.
     253;
     254; AtaGeometry_IsDriveSmallEnoughForECHS:
     255;   Parameters:
     256;       AX:     Number of P-Cylinders
     257;       BL:     Number of P-Heads
     258;   Returns:
     259;       CF:     Clear if Reviced ECHS is necessary
     260;               Set if ECHS is enough
     261;   Corrupts registers:
     262;       Nothing
     263;--------------------------------------------------------------------
     264AtaGeometry_IsDriveSmallEnoughForECHS:
     265    ; Generate L-CHS using simple bit shift algorithm (ECHS) if
     266    ; 8192 or less cylinders. Use Revised ECHS if 8193 or more cylinders
     267    ; AND 16 heads.
     268    cmp     ax, 8193
     269    jb      SHORT .RevisedECHSisNotNeeded
     270    cmp     bl, 16  ; Drives with 8193 or more cylinders can report 15 heads
     271.RevisedECHSisNotNeeded:
     272    ret
    241273
    242274
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r547 r549  
    100100
    101101    ; Translate P-CHS to L-CHS
    102     call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX
     102    call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIwithTranslateModeInDX
    103103    mov     [di+DPT.wLchsCylinders], ax
    104104    mov     [di+DPT.wLchsHeadsAndSectors], bx
     
    113113    jz      SHORT .LimitHeadsForLargeAddressingMode
    114114
    115     or      cl, FLGL_DPT_LBA        ; Set LBA bit for Assisted LBA
     115    ; Set LBA bit for Assisted LBA
     116    or      cl, FLGL_DPT_LBA
    116117    jmp     SHORT .NothingToChange
     118
    117119.LimitHeadsForLargeAddressingMode:
    118     MIN_U   bl, 15                  ; Cannot have 16 P-Heads in LARGE addressing mode
     120    ; We cannot have 16 P-Heads heads in Revised ECHS mode (8193 or more cylinders)
     121    ; but 16 heads are allowed when there are 8192 or less cylinders (ECHS).
     122    ; Both of these are LARGE modes so do not confuse with NORMAL mode.
     123    call    AtaGeometry_IsDriveSmallEnoughForECHS
     124    jc      SHORT .NothingToChange
     125    dec     bx                      ; Adjust 16 P-Heads to 15
     126
    119127.NothingToChange:
    120128    or      [di+DPT.bFlagsLow], cl  ; Shift count and addressing mode
Note: See TracChangeset for help on using the changeset viewer.