Changeset 589 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta
- Timestamp:
- May 22, 2016, 12:26:57 PM (9 years ago)
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm
r587 r589 37 37 AdvAtaInit_DetectControllerForIdeBaseInBX: 38 38 call Vision_DetectAndReturnIDinAXandPortInDXifControllerPresent 39 jne SHORT .NoAdvancedControllerForPortBX 39 jnz SHORT .NoVisionControllerFound 40 40 41 call Vision_DoesIdePortInBXbelongToControllerWithIDinAX 41 jne SHORT .NoAdvancedControllerForPortBX 42 jz SHORT .AdvancedControllerFoundForPortBX 43 44 .NoVisionControllerFound: 42 45 call PDC20x30_DetectControllerForIdeBaseInBX 43 46 jnc SHORT .NoAdvancedControllerForPortBX 44 47 45 stc ; Advanced Controller found for port BX 48 .AdvancedControllerFoundForPortBX: 49 stc 46 50 ret 47 51 48 52 .NoAdvancedControllerForPortBX: 49 xor ax, ax 53 xor ax, ax ; Clear ID in AX and CF 50 54 ret 51 55 … … 66 70 AdvAtaInit_GetControllerMaxPioModeToALandMinPioCycleTimeToBX: 67 71 cmp ah, ID_QD6580_ALTERNATE 72 %ifdef USE_386 73 jae Vision_GetMaxPioModeToALandMinCycleTimeToBX 74 jmp PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX 75 %else 68 76 jae SHORT .Vision 69 77 jmp PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX 70 78 .Vision: 71 79 jmp Vision_GetMaxPioModeToALandMinCycleTimeToBX 80 %endif 72 81 73 82 … … 88 97 test ax, ax 89 98 jz SHORT .NoAdvancedController ; Return with CF cleared 90 99 91 100 cmp ah, ID_QD6580_ALTERNATE 92 101 jae SHORT .Vision … … 98 107 99 108 call AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI 100 call Vision_InitializeWithIDinAH andConfigInAL109 call Vision_InitializeWithIDinAH 101 110 xor ax, ax ; Success 102 111 … … 116 125 ; Zero if Slave Drive not present 117 126 ; Corrupts registers: 118 ; A X127 ; AL 119 128 ;-------------------------------------------------------------------- 120 129 AdvAtaInit_LoadMasterDPTtoDSSIifSlaveInDSDI: -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/PDC20x30.asm
r588 r589 36 36 mov dx, bx 37 37 call EnablePdcProgrammingMode 38 jz .ControllerDetected 39 clc 40 ret 41 .ControllerDetected: 42 call GetPdcIDtoAX 38 jnz SHORT DisablePdcProgrammingMode.Return ; PDC controller not detected 39 ; ePUSH_T ax, DisablePdcProgrammingMode ; Uncomment this if GetPdcIDtoAX needs to be a real function 40 ; Fall to GetPdcIDtoAX 41 42 ;-------------------------------------------------------------------- 43 ; Programming mode must be enabled for this function. 44 ; This function also enables PDC 20630 extra registers. 45 ; 46 ; GetPdcIDtoAX 47 ; Parameters: 48 ; DX: IDE Base port 49 ; Returns: 50 ; AH: PDC ID 51 ; Corrupts registers: 52 ; AL, BX 53 ;-------------------------------------------------------------------- 54 GetPdcIDtoAX: 55 push dx 56 57 ; Try to enable PDC 20630 extra registers 58 add dx, BYTE LOW_CYLINDER_REGISTER 59 in al, dx 60 or al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS 61 out dx, al 62 63 ; Try to access PDC 20630 registers to see if they are available 64 ; Hopefully this does not cause problems for systems with PDC 20230 65 add dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER 66 mov al, PDCREG7_STATUS ; Try to access PDC 20630 status register 67 out dx, al 68 xchg bx, ax 69 in al, dx ; Does index register contain status register index? 70 cmp al, bl 71 mov ah, ID_PDC20630 72 eCMOVNE ah, ID_PDC20230 73 74 pop dx 75 ; ret ; Uncomment this to make GetPdcIDtoAX a real function 43 76 ; Fall to DisablePdcProgrammingMode 44 77 … … 49 82 ; DX: Base port 50 83 ; Returns: 51 ; Nothing84 ; CF: Set 52 85 ; Corrupts registers: 53 86 ; AL … … 56 89 add dx, BYTE HIGH_CYLINDER_REGISTER 57 90 in al, dx 58 sub dx, BYTE HIGH_CYLINDER_REGISTER59 stc ; Set for PDC20x30_DetectControllerForIdeBaseInBX 91 add dx, -HIGH_CYLINDER_REGISTER ; Sets CF for PDC20x30_DetectControllerForIdeBaseInBX 92 .Return: 60 93 ret 61 94 … … 66 99 ; DX: Base port 67 100 ; Returns: 101 ; CF: Cleared 68 102 ; ZF: Set if programming mode enabled 69 103 ; Corrupts registers: … … 72 106 EnablePdcProgrammingMode: 73 107 ; Set bit 7 to sector count register 74 add dx, BYTE SECTOR_COUNT_REGISTER 75 in al, dx 108 inc dx 109 inc dx 110 in al, dx ; 1F2h (SECTOR_COUNT_REGISTER) 76 111 or al, 80h 77 112 out dx, al … … 93 128 ; PDC20230C and PDC20630 clears the bit we set at the beginning 94 129 in al, dx 95 sub dx, BYTE SECTOR_COUNT_REGISTER 96 test al, 80h 97 ret 98 99 100 ;-------------------------------------------------------------------- 101 ; Programming mode must be enabled for this function. 102 ; This function also enables PDC 20630 extra registers. 103 ; 104 ; GetPdcIDtoAX 105 ; Parameters: 106 ; DX: IDE Base port 107 ; Returns: 108 ; AX: PDC ID word 109 ; Corrupts registers: 110 ; BX 111 ;-------------------------------------------------------------------- 112 GetPdcIDtoAX: 113 ; Try to enable PDC 20630 extra registers 114 add dx, BYTE LOW_CYLINDER_REGISTER 115 in al, dx 116 or al, FLG_PDCLCR_ENABLE_EXTRA_REGISTERS 117 out dx, al 118 119 ; Try to access PDC 20630 registers to see if they are available 120 ; Hopefully this does not cause problems for systems with PDC 20230 121 add dx, BYTE PDC20630_INDEX_REGISTER - LOW_CYLINDER_REGISTER 122 mov al, PDCREG7_STATUS ; Try to access PDC 20630 status register 123 out dx, al 124 xchg bx, ax 125 in al, dx ; Does index register contain status register index? 126 cmp al, bl 127 mov ah, ID_PDC20630 128 eCMOVNE ah, ID_PDC20230 130 dec dx 131 dec dx ; Base port 132 test al, 80h ; Clears CF 129 133 ret 130 134 … … 145 149 PDC20x30_GetMaxPioModeToALandMinPioCycleTimeToBX: 146 150 cmp ah, ID_PDC20630 147 je SHORT . return ; No need to limit anything151 je SHORT .Return ; No need to limit anything 148 152 mov ax, 2 ; Limit PIO to 2 for ID_PDC20230 149 153 mov bx, PIO_2_MIN_CYCLE_TIME_NS 150 154 stc 151 . return:155 .Return: 152 156 ret 153 157 … … 165 169 ;-------------------------------------------------------------------- 166 170 PDC20x30_InitializeForDPTinDSDI: 171 %ifdef USE_386 172 xor ch, ch 173 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 174 setnz cl 175 %else 167 176 xor cx, cx 168 177 test BYTE [di+DPT.bFlagsLow], FLGL_DPT_SLAVE 169 eCSETNZ cl 178 jz SHORT .NotSlave 179 inc cx 180 .NotSlave: 181 %endif 170 182 171 183 mov dx, [di+DPT.wBasePort] … … 173 185 call SetSpeedForDriveInCX 174 186 cmp BYTE [di+DPT_ADVANCED_ATA.wControllerID+1], ID_PDC20630 175 jne .initializationCompleted187 jne SHORT .InitializationCompleted 176 188 call SetPdc20630SpeedForDriveInCX 177 . initializationCompleted:189 .InitializationCompleted: 178 190 mov dx, [di+DPT.wBasePort] 179 191 call DisablePdcProgrammingMode … … 201 213 mov bh, ~MASK_PDCSCR_DEV1SPEED ; Assume slave 202 214 inc cx 203 loop . setSpeed215 loop .SetSpeed 204 216 eSHL_IM bl, POS_PDCSCR_DEV0SPEED 205 217 mov bh, ~MASK_PDCSCR_DEV0SPEED 206 . setSpeed:218 .SetSpeed: 207 219 in al, dx 208 220 and al, bh 209 221 or al, bl 210 222 cmp bl, 7 211 jb SHORT OutputNewValue223 jb SHORT .OutputNewValue 212 224 or al, FLG_PDCSCR_UNKNOWN_BIT7 ; Flag for PIO 2 and above? 213 jmp SHORT OutputNewValue 225 .OutputNewValue: 226 out dx, al 227 ret 214 228 215 229 .rgbPioModeToPDCspeedValue: … … 228 242 ; DX: Low Cylinder Register 229 243 ; Corrupts registers: 230 ; AX , CX244 ; AX 231 245 ;-------------------------------------------------------------------- 232 246 SetPdc20630SpeedForDriveInCX: 233 247 inc dx ; LOW_CYLINDER_REGISTER 234 mov ah, FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY 235 shr ah, cl 236 in al, dx 237 not ah 248 mov ah, ~(FLG_PDCLCR_DEV0SPEED_BIT4 | FLG_PDCLCR_DEV0IORDY) 249 ror ah, cl 250 in al, dx 238 251 and al, ah ; Clear drive specific bits 239 252 cmp BYTE [di+DPT_ADVANCED_ATA.bPioMode], 2 240 jbe . clearBitsOnly253 jbe .ClearBitsOnly 241 254 not ah 242 255 or al, ah 243 .clearBitsOnly: 244 OutputNewValue: 245 out dx, al 246 ret 247 256 .ClearBitsOnly: 257 out dx, al 258 ret 259 -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/Vision.asm
r582 r589 29 29 ; AX: ID WORD specific for QDI Vision Controllers 30 30 ; (AL = QD65xx Config Register contents) 31 ; (AH = QDI Vision Controller ID (bits 4...7))31 ; (AH = QDI Vision Controller ID) 32 32 ; DX: Controller port (not IDE port) 33 33 ; ZF: Set if controller found … … 46 46 ; from Axh to Bxh. 47 47 call IsConfigRegisterWithIDinAL 48 je SHORT VisionControllerDetected 48 je SHORT VisionControllerDetected.Return 49 49 50 50 ; Check QD65xx alternative base port 51 ordl, QD65XX_ALTERNATIVE_BASE_PORT51 mov dl, QD65XX_ALTERNATIVE_BASE_PORT 52 52 in al, QD65XX_ALTERNATIVE_BASE_PORT + QD65XX_CONFIG_REGISTER_in 53 53 %endif ; DANGEROUS_DETECTION … … 68 68 mov ah, al 69 69 and al, MASK_QDCONFIG_CONTROLLER_ID 70 cmp al, ID_QD6500 << 470 cmp al, ID_QD6500 71 71 je SHORT VisionControllerDetected 72 cmp al, ID_QD6580 << 472 cmp al, ID_QD6580 73 73 je SHORT VisionControllerDetected 74 cmp al, ID_QD6580_ALTERNATE << 474 cmp al, ID_QD6580_ALTERNATE 75 75 VisionControllerDetected: 76 76 xchg ah, al 77 .Return: 77 78 ret 78 79 … … 82 83 ; Parameters: 83 84 ; AL: QD65xx Config Register contents 84 ; AH: QDI Vision Controller ID (bits 4...7)85 ; AH: QDI Vision Controller ID 85 86 ; BX: IDE Base port to check 86 87 ; DX: Vision Controller port … … 92 93 ;-------------------------------------------------------------------- 93 94 Vision_DoesIdePortInBXbelongToControllerWithIDinAX: 94 cmp ah, ID_QD6500 << 495 cmp ah, ID_QD6500 95 96 je SHORT .DoesIdePortInDXbelongToQD6500 96 97 … … 128 129 ; Parameters: 129 130 ; AL: QD65xx Config Register contents 130 ; AH: QDI Vision Controller ID (bits 4...7)131 ; AH: QDI Vision Controller ID 131 132 ; Returns: 132 133 ; AL: Max supported PIO mode … … 139 140 ;-------------------------------------------------------------------- 140 141 Vision_GetMaxPioModeToALandMinCycleTimeToBX: 141 cmp ah, ID_QD6500 << 4142 cmp ah, ID_QD6500 142 143 jne SHORT .NoNeedToLimitForQD6580 143 144 … … 149 150 150 151 ;-------------------------------------------------------------------- 151 ; Vision_InitializeWithIDinAHandConfigInAL 152 ; Parameters: 153 ; AL: QD65xx Config Register contents 154 ; AH: QDI Vision Controller ID (bits 4...7) 152 ; Vision_InitializeWithIDinAH 153 ; Parameters: 154 ; AH: QDI Vision Controller ID 155 155 ; DS:DI: Ptr to DPT for Single or Slave Drive 156 156 ; SI: Offset to Master DPT if Slave Drive present … … 162 162 ; AX, BX, CX, DX, BP 163 163 ;-------------------------------------------------------------------- 164 Vision_InitializeWithIDinAH andConfigInAL:164 Vision_InitializeWithIDinAH: 165 165 ; QD6580 has a Control Register that needs to be programmed 166 cmp ah, ID_QD6500 << 4166 cmp ah, ID_QD6500 167 167 mov dx, [di+DPT_ADVANCED_ATA.wControllerBasePort] 168 168 mov bp, QD6500_MAX_ACTIVE_TIME_CLOCKS | (QD6500_MIN_ACTIVE_TIME_CLOCKS << 8) ; Assume QD6500
Note:
See TracChangeset
for help on using the changeset viewer.