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


Ignore:
Timestamp:
Mar 27, 2012, 4:21:58 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Advanced ATA Module variables are now kept in DPTs.
  • Forced full mode when using Advanced ATA Module.
File:
1 edited

Legend:

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

    r363 r364  
    7676%ifdef MODULE_ADVANCED_ATA
    7777;--------------------------------------------------------------------
    78 ; AtaID_GetMaxPioModeToAXandMinCycleTimeToDX
     78; AtaID_GetMaxPioModeToAXandMinCycleTimeToCX
    7979;   Parameters:
    8080;       ES:SI:  Ptr to 512-byte ATA information read from the drive
    8181;   Returns:
    82 ;       AX:     Max supported PIO mode
    83 ;       DX:     Minimum Cycle Time in nanosecs
     82;       AL:     Max supported PIO mode
     83;       AH:     FLGH_DPT_IORDY if IORDY supported, zero otherwise
     84;       CX:     Minimum Cycle Time in nanosecs
    8485;   Corrupts registers:
    8586;       BX
    8687;--------------------------------------------------------------------
    87 AtaID_GetMaxPioModeToAXandMinCycleTimeToDX:
     88AtaID_GetMaxPioModeToAXandMinCycleTimeToCX:
    8889    ; Get PIO mode and cycle time for PIO 0...2
    8990    mov     bx, [es:si+ATA1.bPioMode]
    9091    shl     bx, 1                   ; Shift for WORD lookup
    91     mov     dx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs]
     92    mov     cx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs]
    9293    shr     bx, 1
    93     xchg    ax, bx                  ; AL = PIO mode 0, 1 or 2
     94    xchg    ax, bx                  ; AH = 0, AL = PIO mode 0, 1 or 2
     95
     96    ; Check if IORDY is supported
     97    test    BYTE [es:si+ATA2.wCaps+1], A2_wCaps_IORDY >> 8
     98    jz      SHORT .ReturnPioTimings ; No PIO 3 or higher if no IORDY
     99    mov     ah, FLGH_DPT_IORDY
    94100
    95101    ; Check if Advanced PIO modes are supported (3 and above)
     
    98104
    99105    ; Get Advanced PIO mode
    100     ; (Hard Disks supports up to 4 but CF cards might support 5)
     106    ; (Hard Disks supports up to 4 but CF cards can support 5 and 6)
    101107    mov     bx, [es:si+ATA2.bPIOSupp]
    102108.CheckNextFlag:
     
    104110    shr     bx, 1
    105111    jnz     SHORT .CheckNextFlag
    106     mov     dx, [es:si+ATA2.wPIOMinCyF] ; Advanced modes use IORDY
     112    MIN_U   al, 6                       ; Make sure not above lookup tables
     113    mov     cx, [es:si+ATA2.wPIOMinCyF] ; Advanced modes use IORDY
    107114.ReturnPioTimings:
    108115    ret
    109 
    110116
    111117.rgwPio0to2CycleTimeInNanosecs:
     
    116122
    117123;--------------------------------------------------------------------
    118 ; AtaID_ConvertPioModeFromAXandMinCycleTimeFromDXtoActiveAndRecoveryTime
     124; AtaID_GetRecoveryTimeToAXfromPioModeInBXandCycleTimeInCX
    119125;   Parameters:
    120 ;       AX:     Max supported PIO mode
    121 ;       DX:     Minimum PIO Cycle Time in nanosecs
     126;       BX:     PIO Mode
     127;       CX:     PIO Cycle Time in nanosecs
    122128;   Returns:
    123 ;       CX:     Minimum Active time in nanosecs
    124 ;       DX:     Minimum Recovery time in nanosecs
     129;       AX:     Active Time in nanosecs
    125130;   Corrupts registers:
    126 ;       BX
     131;       BX, CX
    127132;--------------------------------------------------------------------
    128 AtaID_ConvertPioModeFromAXandMinCycleTimeFromDXtoActiveAndRecoveryTime:
    129     ; Subtract Address Valid Time (t1) from Cycle Time (t0)
    130     mov     bx, ax
    131     eMOVZX  cx, BYTE [cs:bx+.rgbPioModeToAddressValidTimeNs]
    132     sub     dx, cx
    133 
    134     ; Subtract Active Time (t2) from previous result to get Recovery Time (t2i)
    135     shl     bx, 1           ; Shift PIO Mode for WORD lookup
    136     mov     cx, [cs:bx+.rgwPioModeToActiveTimeNs]
    137     sub     dx, cx
     133AtaID_GetRecoveryTimeToAXfromPioModeInBXandCycleTimeInCX:
     134    call    AtaID_GetActiveTimeToAXfromPioModeInBX
     135    mov     bl, [cs:bx+.rgbPioModeToAddressValidTimeNs]
     136    sub     cx, bx  ; Cycle Time (t0) - Address Valid Time (t1)
     137    sub     cx, ax  ; - Active Time (t2)
     138    xchg    ax, cx  ; AX = Recovery Time (t2i)
    138139    ret
    139 
    140140
    141141.rgbPioModeToAddressValidTimeNs:
     
    145145    db      PIO_3_MIN_ADDRESS_VALID_NS
    146146    db      PIO_4_MIN_ADDRESS_VALID_NS
     147    db      PIO_5_MIN_ADDRESS_VALID_NS
     148    db      PIO_6_MIN_ADDRESS_VALID_NS
     149
     150
     151;--------------------------------------------------------------------
     152; AtaID_GetActiveTimeToAXfromPioModeInBX
     153;   Parameters:
     154;       BX:     PIO Mode
     155;   Returns:
     156;       AX:     Active Time in nanosecs
     157;   Corrupts registers:
     158;       Nothing
     159;--------------------------------------------------------------------
     160AtaID_GetActiveTimeToAXfromPioModeInBX:
     161    shl     bx, 1
     162    mov     ax, [cs:bx+.rgwPioModeToActiveTimeNs]
     163    shr     bx, 1
     164    ret
    147165
    148166.rgwPioModeToActiveTimeNs:
     
    152170    dw      PIO_3_MIN_ACTIVE_TIME_NS
    153171    dw      PIO_4_MIN_ACTIVE_TIME_NS
     172    dw      PIO_5_MIN_ACTIVE_TIME_NS
     173    dw      PIO_6_MIN_ACTIVE_TIME_NS
    154174
    155175%endif ; MODULE_ADVANCED_ATA
Note: See TracChangeset for help on using the changeset viewer.