Changeset 622 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Initialization
- Timestamp:
- Dec 16, 2021, 5:46:51 PM (3 years ago)
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/AdvAtaInit.asm
r601 r622 182 182 .PioTimingsLoadedToBXandCX: 183 183 ret 184 185 186 ;-------------------------------------------------------------------- 187 ; Just a simple IN AL, DX instruction but the function call works 188 ; as I/O delay. 189 ; 190 ; AdvAtaInit_InWithDelay 191 ; Parameters: 192 ; DX: Port to read from 193 ; Returns: 194 ; AL: Byte read from port 195 ; Corrupts registers: 196 ; Nothing 197 ;-------------------------------------------------------------------- 198 AdvAtaInit_InputWithDelay: 199 in al, dx 200 ret -
trunk/XTIDE_Universal_BIOS/Src/Initialization/AdvancedAta/PDC20x30.asm
r592 r622 53 53 ;-------------------------------------------------------------------- 54 54 GetPdcIDtoAX: 55 ;Force ID_PDC20230 instead of PDC20630 detection 56 ;mov ax, ID_PDC20230<<8 57 ;jmp SHORT DisablePdcProgrammingMode 58 55 59 push dx 56 60 … … 87 91 ;-------------------------------------------------------------------- 88 92 DisablePdcProgrammingMode: 89 add dx, BYTE HIGH_CYLINDER_REGISTER 93 add dx, BYTE HIGH_CYLINDER_REGISTER ; 1F5h 90 94 in al, dx 91 95 add dx, -HIGH_CYLINDER_REGISTER ; Sets CF for PDC20x30_DetectControllerForIdeBaseInBX 96 %if 0 97 ; Disassembly of VG4.BIN shows that bit 7 (programming mode activated) 98 ; is cleared manually after reading from HIGH_CYLINDER_REGISTER 99 ; That does not seem to be necessary. 100 inc dx 101 inc dx 102 call AdvAtaInit_InputWithDelay 103 and al, 7Fh 104 out dx, al 105 dec dx 106 dec dx 107 stc 108 %endif 92 109 .Return: 93 110 ret … … 108 125 inc dx 109 126 inc dx 110 in al, dx; 1F2h (SECTOR_COUNT_REGISTER)127 call AdvAtaInit_InputWithDelay ; 1F2h (SECTOR_COUNT_REGISTER) 111 128 or al, 80h 112 129 out dx, al 113 130 114 ; PDC detection sequence (should delay be added between register reads?) 115 add dx, BYTE HIGH_CYLINDER_REGISTER - SECTOR_COUNT_REGISTER 116 in al, dx ; 1F5h 131 ; PDC detection sequence 132 add dx, BYTE HIGH_CYLINDER_REGISTER - SECTOR_COUNT_REGISTER ; 5 - 2 117 133 cli 134 call AdvAtaInit_InputWithDelay ; 1F5 135 118 136 sub dx, BYTE HIGH_CYLINDER_REGISTER - SECTOR_COUNT_REGISTER 119 in al, dx ; 1F2h 120 add dx, STANDARD_CONTROL_BLOCK_OFFSET + (ALTERNATE_STATUS_REGISTER_in - SECTOR_COUNT_REGISTER) 121 in al, dx ; 3F6h 122 in al, dx ; 3F6h 137 call AdvAtaInit_InputWithDelay ; 1F2h 138 139 add dx, STANDARD_CONTROL_BLOCK_OFFSET + (ALTERNATE_STATUS_REGISTER_in - SECTOR_COUNT_REGISTER) ; 200h+(6-2) 140 call AdvAtaInit_InputWithDelay ; 3F6h 141 142 call AdvAtaInit_InputWithDelay ; 3F6h 143 123 144 sub dx, STANDARD_CONTROL_BLOCK_OFFSET + (ALTERNATE_STATUS_REGISTER_in - SECTOR_COUNT_REGISTER) 124 in al, dx ; 1F2h 125 in al, dx ; 1F2h 145 call AdvAtaInit_InputWithDelay ; 1F2h 146 147 call AdvAtaInit_InputWithDelay ; 1F2h 126 148 sti 127 149 128 150 ; PDC20230C and PDC20630 clears the bit we set at the beginning 129 in al, dx; 1F2h151 call AdvAtaInit_InputWithDelay ; 1F2h 130 152 dec dx 131 153 dec dx ; Base port … … 186 208 jne SHORT .InitializationCompleted 187 209 call SetPdc20630SpeedForDriveInCX 210 211 ; TODO: Should we first call SetPdc20630SpeedForDriveInCX and then 212 ; force SetSpeedForDriveInCX to PIO 0 (maximum speed setting 8)? 213 ; Need to test with PCD20630. 214 188 215 .InitializationCompleted: 189 216 mov dx, [di+DPT.wBasePort] … … 200 227 ; DS:DI: Ptr to DPT 201 228 ; Returns: 202 ; DX: Sector Number Register 229 ; DX: Sector Number Register (1F3h) 203 230 ; Corrupts registers: 204 231 ; AX, BX … … 211 238 xchg bx, ax 212 239 213 add dx, BYTE SECTOR_NUMBER_REGISTER 214 mov bh, ~MASK_PDCS CR_DEV1SPEED; Assume slave240 add dx, BYTE SECTOR_NUMBER_REGISTER ; 1F3h 241 mov bh, ~MASK_PDCSNR_DEV1SPEED ; Assume slave 215 242 inc cx 243 mov ah, 7 ; Max speed value. Set unknown bit 7 if either of drives are set to this 216 244 loop .SetSpeed 217 eSHL_IM bl, POS_PDCSCR_DEV0SPEED 218 mov bh, ~MASK_PDCSCR_DEV0SPEED 245 mov ah, 7 << POS_PDCSNR_DEV0SPEED 246 eSHL_IM bl, POS_PDCSNR_DEV0SPEED 247 mov bh, ~MASK_PDCSNR_DEV0SPEED 219 248 .SetSpeed: 220 249 in al, dx 221 250 and al, bh 222 251 or al, bl 223 cmp bl, 7252 cmp bl, ah 224 253 jb SHORT .OutputNewValue 225 or al, FLG_PDCS CR_UNKNOWN_BIT7; Flag for PIO 2 and above?254 or al, FLG_PDCSNR_UNKNOWN_BIT7 ; Flag for PIO 2 and above? 226 255 .OutputNewValue: 227 256 out dx, al 257 258 ; The above speed set does not work with Octek VL-COMBO rev 3.2 with PDC20230C 259 ; Only thing to make it work is to set FLG_PDCSCR_BOTHMAX to 1F2h. Are all PDC20230C controllers 260 ; like that? If so, why the above speed is not set? Or does the VL-COMBO or other PDC20230C 261 ; controllers have a jumper to prevent speed setup by software? (PDC20230B can only be set 262 ; by hardware, for example), like pin-compatible operation with older PDC20230B, perhaps? 263 ; Datasheets would be very useful... 264 ; For now, we just set the FLG_PDCSCR_BOTHMAX bit if either of the drives are set to speed 7 265 ; 266 ; Code below is not perfect. It does not properly test if both drives support PIO 2 but 267 ; likely if slave does, so does master (and if slave does not, we clear the 268 ; FLG_PDCSCR_BOTHMAX set by master) 269 mov bl, 1 ; Set bit 0, see VG4.BIN comments below 270 test al, al 271 jns SHORT .DoNotSetMaxSpeedBit 272 or bl, FLG_PDCSCR_BOTHMAX 273 .DoNotSetMaxSpeedBit: 274 dec dx ; SECTOR_COUNT_REGISTER, 1F2h 275 call AdvAtaInit_InputWithDelay 276 and al, ~FLG_PDCSCR_BOTHMAX 277 or al, bl 278 out dx, al 279 280 ; VG4.BIN ("External BIOS") does the following after programming speed (1F3h) 281 ; (It never seems to set the speed bit we just set above). 282 ; The below code does not seem to have any effect, at least not for PDC20230C. 283 ; Why is bit 0 set to 1F2h? 284 ; Is it just to keep programming mode active if it has timeout, for example? 285 ; But after all that it just reads 1F5h to disable programming mode. 286 %if 0 287 ; Test code start 288 push cx 289 mov cx, 100 290 DELAY_WITH_LOOP_INSTRUCTION_NA 291 292 ; Does below tell the controller that new speed is set? 293 in al, dx 294 or al, 1 295 out dx, al 296 297 mov cx, 100 298 DELAY_WITH_LOOP_INSTRUCTION_NA 299 pop cx 300 ; Test code end 301 %endif 302 303 inc dx ; SECTOR_NUMBER_REGISTER, 1F3h 228 304 ret 229 305 … … 239 315 ; CX: 0 for master, 1 for slave drive 240 316 ; DS:DI: Ptr to DPT 241 ; DX: Sector Number Register 317 ; DX: Sector Number Register, 1F3h 242 318 ; Returns: 243 319 ; DX: Low Cylinder Register
Note:
See TracChangeset
for help on using the changeset viewer.