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/AdvAtaInit.asm

    r363 r364  
    77
    88;--------------------------------------------------------------------
    9 ; AdvAtaInit_DetectControllerForIdeBaseInDX
     9; AdvAtaInit_DetectControllerForIdeBaseInBX
    1010;   Parameters:
    11 ;       DX:     IDE Controller base port
     11;       BX:     IDE Controller base port
    1212;   Returns:
    1313;       AX:     ID WORD specific for detected controller
    1414;               Zero if no controller detected
    15 ;       CX:     Controller base port (not IDE)
     15;       DX:     Controller base port (not IDE)
    1616;       CF:     Set if controller detected
    1717;               Cleared if no controller
     
    1919;       BX
    2020;--------------------------------------------------------------------
    21 AdvAtaInit_DetectControllerForIdeBaseInDX:
    22     call    Vision_DetectAndReturnIDinAXandPortInCXifControllerPresent
    23     jne     SHORT .NoAdvancedControllerForPortDX
    24     call    Vision_DoesIdePortInDXbelongToControllerWithIDinAX
    25     jne     SHORT .NoAdvancedControllerForPortDX
     21AdvAtaInit_DetectControllerForIdeBaseInBX:
     22    call    Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent
     23    jne     SHORT .NoAdvancedControllerForPortBX
     24    call    Vision_DoesIdePortInBXbelongToControllerWithIDinAX
     25    jne     SHORT .NoAdvancedControllerForPortBX
    2626
    27     stc     ; Advanced Controller found for port DX
     27    stc     ; Advanced Controller found for port BX
    2828    ret
    2929
    30 .NoAdvancedControllerForPortDX:
     30.NoAdvancedControllerForPortBX:
    3131    xor     ax, ax
    3232    ret
     
    3838;       AX:     ID WORD specific for detected controller
    3939;   Returns:
    40 ;       AL:     Max supported PIO mode (if CF set)
     40;       AL:     Max supported PIO mode
     41;       AH:     FLGH_DPT_IORDY if IORDY supported, zero otherwise
    4142;       CF:     Set if PIO limit necessary
    4243;               Cleared if no need to limit timings
    4344;   Corrupts registers:
    44 ;       Nothing
     45;       (AX if CF cleared)
    4546;--------------------------------------------------------------------
    4647AdvAtaInit_GetControllerMaxPioModeToAL  equ Vision_GetMaxPioModeToAL
     
    5859;--------------------------------------------------------------------
    5960AdvAtaInit_InitializeControllerForDPTinDSDI:
    60     push    ds
     61    push    bp
    6162    push    si
    62     push    di
    63 
    64     ; PIO and Advanced Controller variables are stored to BOOTMENUINFO
    65     ; to keep the DPTs as small as possible.
    66     call    GetMasterAndSlaveBootMenuInfosToSIandDI
    67     cmp     WORD [BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD
    68     clc
    69     jne     SHORT .BootMenuInfosAreNoLongerAvailable
    7063
    7164    ; Call Controller Specific initialization function
    72     mov     ax, [si+BOOTMENUINFO.wControllerID]
     65    mov     ax, [di+DPT_ADVANCED_ATA.wControllerID]
    7366    test    ax, ax
    74     jz      SHORT .NoAdvancedController
    75     call    Vision_InitializeWithIDinAHandConfigInAL    ; The only we support at the moment
     67    jz      SHORT .NoAdvancedController ; Return with CF cleared
    7668
    77 .BootMenuInfosAreNoLongerAvailable:
     69    ; We only support Vision at the moment so no need to identify ID
     70    call    AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI
     71    call    Vision_InitializeWithIDinAHandConfigInAL
     72
    7873.NoAdvancedController:
    79     pop     di
    8074    pop     si
    81     pop     ds
     75    pop     bp
    8276    ret
    8377
    8478
    8579;--------------------------------------------------------------------
    86 ; AdvAtaInit_GetMasterAndSlaveBootMenuInfosToSIandDI
     80; AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI
    8781;   Parameters:
    8882;       DS:DI:  Ptr to DPT for Single or Slave Drive
    8983;   Returns:
    90 ;       DS:SI:  Ptr to Single or Master Drive BOOTMENUINFO
    91 ;       DI:     Offset to Slave Drive BOOTMENUINFO
     84;       DS:DI:  Ptr to DPT for Single or Slave Drive
     85;       SI:     Offset to Master DPT if Slave Drive present
    9286;               Zero if Slave Drive not present
    9387;   Corrupts registers:
    94 ;       BX, DX, (DS will change!)
     88;       AX
    9589;--------------------------------------------------------------------
    96 GetMasterAndSlaveBootMenuInfosToSIandDI:
    97     call    BootMenuInfo_ConvertDPTtoBX
    98     LOAD_BDA_SEGMENT_TO ds, di, !               ; Zero DI to assume no Slave Drive present
     90AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI:
     91    ; Must be Slave Drive if previous DPT has same IDEVARS offset
     92    lea     si, [di-LARGEST_DPT_SIZE]   ; DS:SI points to previous DPT
     93    mov     al, [di+DPT.bIdevarsOffset]
     94    cmp     al, [si+DPT.bIdevarsOffset]
     95    je      SHORT .MasterAndSlaveDrivePresent
    9996
    100     mov     dx, [bx+BOOTMENUINFO.wIdeBasePort]  ; Load IDE Port from Single or Slave Drive
    101     lea     si, [bx+BOOTMENUINFO_size]          ; SI points to Slave Drive if present
    102     cmp     dx, [si+BOOTMENUINFO.wIdeBasePort]
    103     jne     SHORT .BootMenuInfoForSingleDriveInDSBX
    104 
    105     mov     di, si                              ; Slave Drive detected, copy pointer to DS:DI
    106 .BootMenuInfoForSingleDriveInDSBX:
    107     mov     si, bx
     97    ; We only have single drive so zero SI
     98    xor     si, si
     99.MasterAndSlaveDrivePresent:
    108100    ret
    109101
    110102
    111103;--------------------------------------------------------------------
    112 ; AdvAtaInit_SelectSlowestTimingsToBXandCX
     104; AdvAtaInit_SelectSlowestCommonPioTimingsToBXandCXfromDSSIandDSDI
    113105;   Parameters:
    114 ;       DS:SI:  Ptr to BOOTMENUINFO for Master or Single Drive
    115 ;       DI:     Offset to BOOTMENUINFO for Slave Drive
     106;       DS:DI:  Ptr to DPT for Single or Slave Drive
     107;       SI:     Offset to Master DPT if Slave Drive present
    116108;               Zero if Slave Drive not present
    117109;   Returns:
    118 ;       BX:     Min Active Time in nanosecs
    119 ;       CX:     Min Recovery Time in nanosecs
     110;       BX:     Best common PIO mode
     111;       CX:     Slowest common PIO Cycle Time in nanosecs
    120112;   Corrupts registers:
    121113;       Nothing
    122114;--------------------------------------------------------------------
    123 AdvAtaInit_SelectSlowestTimingsToBXandCX:
    124     mov     bx, [si+BOOTMENUINFO.wMinPioActiveTimeNs]
    125     mov     cx, [si+BOOTMENUINFO.wMinPioRecoveryTimeNs]
    126     test    di, di
    127     jz      SHORT .ReturnSlowestTimingInBXandCX ; No Slave Drive
    128 
    129     ; If Active Time is greater, then must be the Recovery Time as well
    130     cmp     bx, [di+BOOTMENUINFO.wMinPioActiveTimeNs]
    131     jbe     SHORT .ReturnSlowestTimingInBXandCX
    132     mov     bx, [di+BOOTMENUINFO.wMinPioActiveTimeNs]
    133     mov     cx, [di+BOOTMENUINFO.wMinPioRecoveryTimeNs]
    134 .ReturnSlowestTimingInBXandCX:
     115AdvAtaInit_SelectSlowestCommonPioTimingsToBXandCXfromDSSIandDSDI:
     116    eMOVZX  bx, BYTE [di+DPT_ADVANCED_ATA.bPioMode]
     117    mov     cx, [di+DPT_ADVANCED_ATA.wMinPioCycleTime]
     118    test    si, si
     119    jz      SHORT .PioTimingsLoadedToAXandCX
     120    MIN_U   bl, [si+DPT_ADVANCED_ATA.bPioMode]
     121    MAX_U   cx, [si+DPT_ADVANCED_ATA.wMinPioCycleTime]
     122.PioTimingsLoadedToAXandCX:
    135123    ret
Note: See TracChangeset for help on using the changeset viewer.