Changeset 422 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs


Ignore:
Timestamp:
May 12, 2012, 1:58:25 PM (13 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Modified ROMVARS for user defined CHS translation mode.
  • Base DPT struct now includes initialization error flags again.
Location:
trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs
Files:
3 edited

Legend:

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

    r421 r422  
    144144ALIGN JUMP_ALIGN
    145145AccessDPT_GetPointerToDRVPARAMStoCSBX:
    146     eMOVZX  bx, [di+DPT.bIdevarsOffset]         ; CS:BX points to IDEVARS
     146    eMOVZX  bx, BYTE [di+DPT.bIdevarsOffset]    ; CS:BX points to IDEVARS
    147147    add     bx, BYTE IDEVARS.drvParamsMaster    ; CS:BX points to Master Drive DRVPARAMS
    148148    test    BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE
     
    154154
    155155;--------------------------------------------------------------------
    156 ; ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF
     156; ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF
    157157;   Parameters:
    158158;       DS:DI:  Ptr to Disk Parameter Table
    159159;   Returns:
    160 ;       AX:     Addressing Mode (ADDRESSING_MODE_NORMAL, ADDRESSING_MODE_LARGE or ADDRESSING_MODE_ASSISTED_LBA)
     160;       AX:     Translate Mode (TRANSLATEMODE_NORMAL, TRANSLATEMODE_LARGE or TRANSLATEMODE_ASSISTED_LBA)
    161161;               unshifted (still shifted where it is in bFlagsLow)
    162162;       ZF:     Set based on value in AL
     
    168168; is not worth it for these two instructions (4 bytes total)
    169169;
    170 %macro ACCESSDPT__GET_UNSHIFTED_ADDRESS_MODE_TO_AXZF 0
     170%macro ACCESSDPT__GET_UNSHIFTED_TRANSLATE_MODE_TO_AXZF 0
    171171    mov     al, [di+DPT.bFlagsLow]
    172     and     ax, BYTE MASKL_DPT_ADDRESSING_MODE
     172    and     ax, BYTE MASKL_DPT_TRANSLATEMODE
    173173%endmacro
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/AtaGeometry.asm

    r421 r422  
    3434;   Returns:
    3535;       BX:DX:AX:   48-bit sector count
    36 ;       CL:         FLGL_DPT_LBA48 if LBA48 supported, zero otherwise
     36;       CL:         FLGL_DPT_LBA48 if LBA48 supported
     37;                   Zero if only LBA28 is supported
    3738;   Corrupts registers:
    3839;       Nothing
     
    6465
    6566;--------------------------------------------------------------------
    66 ; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI:
    67 ;   Parameters:
     67; AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX
     68; AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX
     69;   Parameters:
     70;       DX:     Wanted translate mode or TRANSLATEMODE_AUTO to autodetect
    6871;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    6972;   Returns:
     
    7275;       BH:     Number of L-CHS sectors per track (1...63)
    7376;       CX:     Number of bits shifted (0...3)
    74 ;       DL:     Addressing mode
     77;       DL:     CHS Translate Mode
    7578;   Corrupts registers:
    7679;       DH
    7780;--------------------------------------------------------------------
    78 AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI:
     81AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX:
    7982    call    AtaGeometry_GetPCHStoAXBLBHfromAtaInfoInESSI
    8083    ; Fall to AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH
    8184
    82 AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH:
     85AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX:
     86    ; Check if user defined translate mode
     87    test    dx, dx
     88    jnz     SHORT .CheckIfLargeTranslationWanted
     89    MIN_U   ax, MAX_LCHS_CYLINDERS  ; TRANSLATEMODE_NORMAL maximum cylinders
     90    inc     dx
     91.CheckIfLargeTranslationWanted:
     92    dec     dx                      ; Set ZF if TRANSLATEMODE_LARGE
     93    jz      SHORT ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL
     94    dec     dx                      ; Set ZF if TRANSLATEMODE_ASSISTED_LBA
     95    jz      SHORT .UseAssistedLBA
     96    ; TRANSLATEMODE_AUTO set
     97
    8398    ; Generate L-CHS using simple bit shift algorithm (ECHS) if
    8499    ; 8192 or less cylinders.
    85100    cmp     ax, 8192
    86     jbe     SHORT ConvertPCHfromAXBXtoEnhancedCHinAXBX
     101    jbe     SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
    87102
    88103    ; We have 8193 or more cylinders so two algorithms are available:
    89104    ; Revised ECHS or Assisted LBA. The Assisted LBA provides larger
    90105    ; capacity but requires LBA support from drive (drives this large
    91     ; always support LBA but we may have intentionally cleared the LBA
    92     ; bit to force CHS addressing).
     106    ; always support LBA but user might have unintentionally set LBA).
     107.UseAssistedLBA:
    93108    test    BYTE [es:si+ATA1.wCaps+1], A1_wCaps_LBA>>8
    94     jz      SHORT ConvertPCHfromAXBXtoRevisedEnhancedCHinAXBX
     109    jz      SHORT ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL
    95110
    96111    ; Drive supports LBA
    97     call    AtaGeometry_GetSectorCountToDXAXfromCHSinAXBLBH
     112    call    GetSectorCountToDXAXfromCHSinAXBLBH
    98113    call    ConvertChsSectorCountFromDXAXtoLbaAssistedLCHSinAXBLBH
    99114    xor     cx, cx      ; No bits to shift
    100     mov     dl, ADDRESSING_MODE_ASSISTED_LBA
     115    mov     dl, TRANSLATEMODE_ASSISTED_LBA
    101116    ret
    102117
     
    121136
    122137;--------------------------------------------------------------------
    123 ; AtaGeometry_GetSectorCountToDXAXfromCHSinAXBLBH
     138; GetSectorCountToDXAXfromCHSinAXBLBH
    124139;   Parameters:
    125140;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     
    132147;       BX
    133148;--------------------------------------------------------------------
    134 AtaGeometry_GetSectorCountToDXAXfromCHSinAXBLBH:
     149GetSectorCountToDXAXfromCHSinAXBLBH:
    135150    xchg    ax, bx
    136151    mul     ah          ; AX = Heads * Sectors per track
     
    157172;  Do a standard ECHS translation
    158173;
    159 ; ConvertPCHfromAXBXtoRevisedEnhancedCHinAXBX:
     174; ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL:
    160175;   Parameters:
    161176;       AX:     Number of P-CHS cylinders (8193...16383)
     
    169184;       Nothing
    170185;--------------------------------------------------------------------
    171 ConvertPCHfromAXBXtoRevisedEnhancedCHinAXBX:
     186ConvertPCHfromAXBLtoRevisedEnhancedCHinAXBL:
     187    ; Generate L-CHS using simple bit shift algorithm (ECHS) if
     188    ; 8192 or less cylinders
     189    cmp     ax, 8192
     190    jbe     SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
    172191    cmp     bl, 16  ; Drives with 8193 or more cylinders can report 15 heads
    173     jb      SHORT ConvertPCHfromAXBXtoEnhancedCHinAXBX
     192    jb      SHORT ConvertPCHfromAXBLtoEnhancedCHinAXBL
    174193
    175194    eMOVZX  cx, bl  ; CX = 16
     
    201220;  Use the multiplier on the Cylinder and Head values to obtain the translated values.
    202221;
    203 ; ConvertPCHfromAXBXtoEnhancedCHinAXBX:
     222; ConvertPCHfromAXBLtoEnhancedCHinAXBL:
    204223;   Parameters:
    205224;       AX:     Number of P-CHS cylinders (1...8192)
     
    209228;       BL:     Number of L-CHS heads (?...128)
    210229;       CX:     Number of bits shifted (0...3)
    211 ;       DL:     ADDRESSING_MODE_NORMAL or ADDRESSING_MODE_LARGE
     230;       DL:     TRANSLATEMODE_NORMAL or TRANSLATEMODE_LARGE
    212231;   Corrupts registers:
    213232;       Nothing
    214233;--------------------------------------------------------------------
    215 ConvertPCHfromAXBXtoEnhancedCHinAXBX:
     234ConvertPCHfromAXBLtoEnhancedCHinAXBL:
    216235    xor     cx, cx      ; No bits to shift initially
    217     xor     dl, dl      ; Assume ADDRESSING_MODE_NORMAL
     236    xor     dl, dl      ; Assume TRANSLATEMODE_NORMAL
    218237.ShiftIfMoreThan1024Cylinder:
    219238    cmp     ax, MAX_LCHS_CYLINDERS
    220239    jbe     SHORT ReturnLCHSinAXBLBH
    221     shr     ax, 1
    222     shl     bl, 1
     240    shr     ax, 1       ; Halve cylinders
     241    shl     bl, 1       ; Double heads
    223242    inc     cx          ; Increment bit shift count
    224     mov     dl, ADDRESSING_MODE_LARGE
     243    mov     dl, TRANSLATEMODE_LARGE
    225244    jmp     SHORT .ShiftIfMoreThan1024Cylinder
    226245
  • trunk/XTIDE_Universal_BIOS/Src/VariablesAndDPTs/CreateDPT.asm

    r421 r422  
    5555;--------------------------------------------------------------------
    5656.InitializeDPT:
    57     mov     [di+DPT.bIdevarsOffset], bp ; IDEVARS must start in first 256 bytes of ROM
     57    mov     [di+DPT.bIdevarsOffset], bp     ; IDEVARS must start in first 256 bytes of ROM
    5858    ; Fall to .StoreDriveSelectAndDriveControlByte
    5959
     
    9595.StoreCHSparametersAndAddressingMode:
    9696    ; Check if CHS defined in ROMVARS
    97     call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    98     test    byte [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERCHS    ; User specified P-CHS?
     97    call    GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
     98    test    cl, FLG_DRVPARAMS_USERCHS
    9999    jz      SHORT .AutodetectPCHSvalues
    100100
    101     ; Use DRVPARAMS P-CHS values instead of autodetected
    102     mov     ax, [cs:bx+DRVPARAMS.wCylinders]
    103     mov     bx, [cs:bx+DRVPARAMS.wHeadsAndSectors]
    104     call    AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBH
     101    ; Translate P-CHS to L-CHS
     102    call    AtaGeometry_GetLCHStoAXBLBHfromPCHSinAXBLBHandTranslateModeInDX
    105103    jmp     SHORT .StoreLCHStoDPT
    106 
    107     ; Get L-CHS parameters and addressing mode
    108104.AutodetectPCHSvalues:
    109     call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSI
     105    call    AtaGeometry_GetLCHStoAXBLBHfromAtaInfoInESSIandTranslateModeInDX
    110106
    111107.StoreLCHStoDPT:
    112     eSHL_IM dl, ADDRESSING_MODE_FIELD_POSITION
     108    eSHL_IM dl, TRANSLATEMODE_FIELD_POSITION
    113109    or      cl, dl
    114110    or      [di+DPT.bFlagsLow], cl      ; Shift count and addressing mode
     
    144140
    145141    ; Load user defined LBA
    146     call    AccessDPT_GetPointerToDRVPARAMStoCSBX
    147     test    BYTE [cs:bx+DRVPARAMS.wFlags], FLG_DRVPARAMS_USERLBA
     142    call    GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
     143    test    cl, FLG_DRVPARAMS_USERLBA
    148144    jz      SHORT .KeepTotalSectorsFromAtaID
    149     mov     ax, [cs:bx+DRVPARAMS.dwMaximumLBA]
    150     mov     dx, [cs:bx+DRVPARAMS.dwMaximumLBA+2]
    151     xor     bx, bx
    152145
    153146    ; Compare user defined and ATA-ID sector count and select smaller
     147    xor     dx, dx
     148    xchg    bx, dx      ; User defined LBA now in BX:DX:AX
    154149    cmp     bx, [di+DPT.twLbaSectors+4]
    155150    jb      SHORT .StoreUserDefinedSectorCountToDPT
     
    160155    jae     SHORT .KeepTotalSectorsFromAtaID
    161156.StoreUserDefinedSectorCountToDPT:
    162     xor     cx, cx      ; Always LBA28 for user defined values
     157    ; CL bit FLGL_DPT_LBA48 is clear at this point
    163158    call    StoreLba48AddressingFromCLandTotalSectorCountFromBXDXAX
    164159
     
    234229
    235230
     231;--------------------------------------------------------------------
     232; GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS
     233;   Parameters:
     234;       DS:DI:      Ptr to Disk Parameter Table
     235;   Returns:
     236;       AX:         User defined P-CHS Cylinders or LBA low word
     237;       BX:         User defined P-CHS Heads and Sectors or LBA high word
     238;       DX:         Translate mode or TRANSLATEMODE_AUTO
     239;       CX:         FLG_DRVPARAMS_USERCHS if user defined CHS in BX:AX
     240;                   FLG_DRVPARAMS_USERLBA if user defined LBA in BX:AX
     241;                   Zero if user has not defined capacity
     242;   Corrupts registers:
     243;       Nothing
     244;--------------------------------------------------------------------
     245GetUserDefinedCapacityToBXAXandFlagsToCXandModeToDXfromROMVARS:
     246    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
     247
     248    ; Get settings
     249    mov     cx, [cs:bx+DRVPARAMS.wFlags]
     250    mov     dx, cx
     251    and     cx, BYTE FLG_DRVPARAMS_USERCHS | FLG_DRVPARAMS_USERLBA
     252    and     dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE
     253    eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION
     254
     255    ; Get capacity
     256    mov     ax, [cs:bx+DRVPARAMS.wCylinders]        ; Or .dwMaximumLBA
     257    mov     bx, [cs:bx+DRVPARAMS.wHeadsAndSectors]  ; Or .dwMaximumLBA+2
     258    ret
     259
     260
    236261%ifdef MODULE_EBIOS
    237262;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.