Changeset 542 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm


Ignore:
Timestamp:
Apr 15, 2013, 4:03:33 PM (11 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Fixed a bug that allowed EBIOS functions for user defined CHS.
  • Simplified user defined CHS and LBA setup a little.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.asm

    r526 r542  
    9595
    9696
     97;--------------------------------------------------------------------
     98; Writes user defined limits from ROMVARS to ATA ID read from the drive.
     99; Modifying the ATA ID reduces code and possibilites for bugs since
     100; only little furher checks are needed elsewhere.
     101;
     102; AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX
     103;   Parameters:
     104;       DS:DI:  Ptr to incomplete Disk Parameter Table
     105;       ES:SI:  Ptr to 512-byte ATA information read from the drive
     106;       CS:BP:  Ptr to IDEVARS for the controller
     107;   Returns:
     108;       DX:     User defined P-CHS to L-CHS translate mode
     109;   Corrupts registers:
     110;       AX, BX, CX
     111;--------------------------------------------------------------------
     112AtaID_ModifyESSIforUserDefinedLimitsAndReturnTranslateModeInDX:
     113    call    AccessDPT_GetPointerToDRVPARAMStoCSBX
     114    push    ds
     115    push    es
     116    pop     ds      ; DS:SI now points to ATA information
     117
     118    ; Load User Defined CHS or LBA to CX:AX
     119    mov     dx, [cs:bx+DRVPARAMS.wFlags]
     120    mov     ax, [cs:bx+DRVPARAMS.wCylinders]        ; Or .dwMaximumLBA
     121    mov     cx, [cs:bx+DRVPARAMS.wHeadsAndSectors]  ; Or .dwMaximumLBA+2
     122
     123    ; * User defined CHS *
     124    test    dl, FLG_DRVPARAMS_USERCHS
     125    jz      SHORT .NoUserDefinedCHS
     126
     127    ; Apply new CHS and disable LBA (we also want to set CHS addressing)
     128    mov     [si+ATA1.wCylCnt], ax
     129    eMOVZX  ax, cl
     130    mov     [si+ATA1.wHeadCnt], ax
     131    mov     al, ch
     132    mov     [si+ATA1.wSPT], ax
     133    and     BYTE [si+ATA1.wCaps+1], ~(A1_wCaps_LBA>>8)
     134    and     BYTE [si+ATA6.wSetSup83+1], ~(A6_wSetSup83_LBA48>>8)
     135.NoUserDefinedCHS:
     136
     137    ; * User defined LBA *
     138    test    dl, FLG_DRVPARAMS_USERLBA
     139    jz      SHORT .NoUserDefinedLBA
     140
     141    ; Apply new LBA and disable LBA48
     142    cmp     cx, [si+ATA1.dwLBACnt+2]
     143    ja      SHORT .NoUserDefinedLBA     ; Do not set larger than drive
     144    jb      SHORT .StoreNewLBA
     145    cmp     ax, [si+ATA1.dwLBACnt]
     146    ja      SHORT .NoUserDefinedLBA     ; Allow same size to disable LBA48
     147.StoreNewLBA:
     148    mov     [si+ATA1.dwLBACnt], ax
     149    mov     [si+ATA1.dwLBACnt+2], cx
     150    and     BYTE [si+ATA6.wSetSup83+1], ~(A6_wSetSup83_LBA48>>8)
     151.NoUserDefinedLBA:
     152
     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
     159    ; * Load P-CHS to L-CHS translate mode to DX *
     160    and     dx, BYTE MASK_DRVPARAMS_TRANSLATEMODE
     161    eSHR_IM dx, TRANSLATEMODE_FIELD_POSITION
     162
     163    pop     ds
     164    ret
     165
     166
    97167%ifdef MODULE_ADVANCED_ATA
    98168;--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.