Changeset 364 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AtaID.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/AtaID.asm
r363 r364 76 76 %ifdef MODULE_ADVANCED_ATA 77 77 ;-------------------------------------------------------------------- 78 ; AtaID_GetMaxPioModeToAXandMinCycleTimeTo DX78 ; AtaID_GetMaxPioModeToAXandMinCycleTimeToCX 79 79 ; Parameters: 80 80 ; ES:SI: Ptr to 512-byte ATA information read from the drive 81 81 ; 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 84 85 ; Corrupts registers: 85 86 ; BX 86 87 ;-------------------------------------------------------------------- 87 AtaID_GetMaxPioModeToAXandMinCycleTimeTo DX:88 AtaID_GetMaxPioModeToAXandMinCycleTimeToCX: 88 89 ; Get PIO mode and cycle time for PIO 0...2 89 90 mov bx, [es:si+ATA1.bPioMode] 90 91 shl bx, 1 ; Shift for WORD lookup 91 mov dx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs]92 mov cx, [cs:bx+.rgwPio0to2CycleTimeInNanosecs] 92 93 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 94 100 95 101 ; Check if Advanced PIO modes are supported (3 and above) … … 98 104 99 105 ; 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) 101 107 mov bx, [es:si+ATA2.bPIOSupp] 102 108 .CheckNextFlag: … … 104 110 shr bx, 1 105 111 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 107 114 .ReturnPioTimings: 108 115 ret 109 110 116 111 117 .rgwPio0to2CycleTimeInNanosecs: … … 116 122 117 123 ;-------------------------------------------------------------------- 118 ; AtaID_ ConvertPioModeFromAXandMinCycleTimeFromDXtoActiveAndRecoveryTime124 ; AtaID_GetRecoveryTimeToAXfromPioModeInBXandCycleTimeInCX 119 125 ; Parameters: 120 ; AX: Max supported PIO mode121 ; DX: MinimumPIO Cycle Time in nanosecs126 ; BX: PIO Mode 127 ; CX: PIO Cycle Time in nanosecs 122 128 ; Returns: 123 ; CX: Minimum Active time in nanosecs 124 ; DX: Minimum Recovery time in nanosecs 129 ; AX: Active Time in nanosecs 125 130 ; Corrupts registers: 126 ; BX 131 ; BX, CX 127 132 ;-------------------------------------------------------------------- 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 133 AtaID_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) 138 139 ret 139 140 140 141 141 .rgbPioModeToAddressValidTimeNs: … … 145 145 db PIO_3_MIN_ADDRESS_VALID_NS 146 146 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 ;-------------------------------------------------------------------- 160 AtaID_GetActiveTimeToAXfromPioModeInBX: 161 shl bx, 1 162 mov ax, [cs:bx+.rgwPioModeToActiveTimeNs] 163 shr bx, 1 164 ret 147 165 148 166 .rgwPioModeToActiveTimeNs: … … 152 170 dw PIO_3_MIN_ACTIVE_TIME_NS 153 171 dw PIO_4_MIN_ACTIVE_TIME_NS 172 dw PIO_5_MIN_ACTIVE_TIME_NS 173 dw PIO_6_MIN_ACTIVE_TIME_NS 154 174 155 175 %endif ; MODULE_ADVANCED_ATA
Note:
See TracChangeset
for help on using the changeset viewer.