Changeset 364 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvAtaInit.asm
- Timestamp:
- Mar 27, 2012, 4:21:58 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvAtaInit.asm
r363 r364 7 7 8 8 ;-------------------------------------------------------------------- 9 ; AdvAtaInit_DetectControllerForIdeBaseIn DX9 ; AdvAtaInit_DetectControllerForIdeBaseInBX 10 10 ; Parameters: 11 ; DX: IDE Controller base port11 ; BX: IDE Controller base port 12 12 ; Returns: 13 13 ; AX: ID WORD specific for detected controller 14 14 ; Zero if no controller detected 15 ; CX: Controller base port (not IDE)15 ; DX: Controller base port (not IDE) 16 16 ; CF: Set if controller detected 17 17 ; Cleared if no controller … … 19 19 ; BX 20 20 ;-------------------------------------------------------------------- 21 AdvAtaInit_DetectControllerForIdeBaseIn DX:22 call Vision_DetectAndReturnIDinAXandPortIn CXifControllerPresent23 jne SHORT .NoAdvancedControllerForPort DX24 call Vision_DoesIdePortIn DXbelongToControllerWithIDinAX25 jne SHORT .NoAdvancedControllerForPort DX21 AdvAtaInit_DetectControllerForIdeBaseInBX: 22 call Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent 23 jne SHORT .NoAdvancedControllerForPortBX 24 call Vision_DoesIdePortInBXbelongToControllerWithIDinAX 25 jne SHORT .NoAdvancedControllerForPortBX 26 26 27 stc ; Advanced Controller found for port DX27 stc ; Advanced Controller found for port BX 28 28 ret 29 29 30 .NoAdvancedControllerForPort DX:30 .NoAdvancedControllerForPortBX: 31 31 xor ax, ax 32 32 ret … … 38 38 ; AX: ID WORD specific for detected controller 39 39 ; 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 41 42 ; CF: Set if PIO limit necessary 42 43 ; Cleared if no need to limit timings 43 44 ; Corrupts registers: 44 ; Nothing45 ; (AX if CF cleared) 45 46 ;-------------------------------------------------------------------- 46 47 AdvAtaInit_GetControllerMaxPioModeToAL equ Vision_GetMaxPioModeToAL … … 58 59 ;-------------------------------------------------------------------- 59 60 AdvAtaInit_InitializeControllerForDPTinDSDI: 60 push ds61 push bp 61 62 push si 62 push di63 64 ; PIO and Advanced Controller variables are stored to BOOTMENUINFO65 ; to keep the DPTs as small as possible.66 call GetMasterAndSlaveBootMenuInfosToSIandDI67 cmp WORD [BOOTVARS.wMagicWord], BOOTVARS_MAGIC_WORD68 clc69 jne SHORT .BootMenuInfosAreNoLongerAvailable70 63 71 64 ; Call Controller Specific initialization function 72 mov ax, [ si+BOOTMENUINFO.wControllerID]65 mov ax, [di+DPT_ADVANCED_ATA.wControllerID] 73 66 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 76 68 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 78 73 .NoAdvancedController: 79 pop di80 74 pop si 81 pop ds75 pop bp 82 76 ret 83 77 84 78 85 79 ;-------------------------------------------------------------------- 86 ; AdvAtaInit_ GetMasterAndSlaveBootMenuInfosToSIandDI80 ; AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI 87 81 ; Parameters: 88 82 ; DS:DI: Ptr to DPT for Single or Slave Drive 89 83 ; Returns: 90 ; DS: SI: Ptr to Single or Master Drive BOOTMENUINFO91 ; DI: Offset to Slave Drive BOOTMENUINFO84 ; DS:DI: Ptr to DPT for Single or Slave Drive 85 ; SI: Offset to Master DPT if Slave Drive present 92 86 ; Zero if Slave Drive not present 93 87 ; Corrupts registers: 94 ; BX, DX, (DS will change!)88 ; AX 95 89 ;-------------------------------------------------------------------- 96 GetMasterAndSlaveBootMenuInfosToSIandDI: 97 call BootMenuInfo_ConvertDPTtoBX 98 LOAD_BDA_SEGMENT_TO ds, di, ! ; Zero DI to assume no Slave Drive present 90 AdvAtaInit_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 99 96 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: 108 100 ret 109 101 110 102 111 103 ;-------------------------------------------------------------------- 112 ; AdvAtaInit_SelectSlowest TimingsToBXandCX104 ; AdvAtaInit_SelectSlowestCommonPioTimingsToBXandCXfromDSSIandDSDI 113 105 ; Parameters: 114 ; DS: SI: Ptr to BOOTMENUINFO for Master or Single Drive115 ; DI: Offset to BOOTMENUINFO for Slave Drive106 ; DS:DI: Ptr to DPT for Single or Slave Drive 107 ; SI: Offset to Master DPT if Slave Drive present 116 108 ; Zero if Slave Drive not present 117 109 ; Returns: 118 ; BX: Min Active Time in nanosecs119 ; CX: Min RecoveryTime in nanosecs110 ; BX: Best common PIO mode 111 ; CX: Slowest common PIO Cycle Time in nanosecs 120 112 ; Corrupts registers: 121 113 ; Nothing 122 114 ;-------------------------------------------------------------------- 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: 115 AdvAtaInit_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: 135 123 ret
Note:
See TracChangeset
for help on using the changeset viewer.