Changeset 545 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE
- Timestamp:
- Apr 19, 2013, 11:44:35 AM (12 years ago)
- google:author:
- aitotat@gmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device/IDE
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r540 r545 80 80 test bh, FLG_DRVNHEAD_DRV ; Wait already done for Master 81 81 jnz SHORT .SkipLongWaitSinceDriveIsNotPrimaryMaster 82 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_ DRDY)82 mov bx, TIMEOUT_AND_STATUS_TO_WAIT(TIMEOUT_MOTOR_STARTUP, FLG_STATUS_BSY) 83 83 call IdeWait_PollStatusFlagInBLwithTimeoutInBH 84 84 .SkipLongWaitSinceDriveIsNotPrimaryMaster: … … 88 88 call Idepack_FakeToSSBP 89 89 90 %ifdef MODULE_8BIT_IDE _ADVANCED90 %ifdef MODULE_8BIT_IDE 91 91 ; Enable 8-bit PIO mode for 8-bit ATA and XT-CF 92 92 push si 93 93 call AH9h_Enable8bitModeForDevice8bitAta 94 xor al, al ; XTCF_8BIT_PIO_MODE 94 %ifdef MODULE_8BIT_IDE_ADVANCED 95 mov al, XTCF_8BIT_PIO_MODE ; initialise with most basic transfer mode 95 96 call AH9h_SetModeFromALtoXTCF 97 %endif ; MODULE_8BIT_IDE_ADVANCED 96 98 pop si 97 %endif ; MODULE_8BIT_IDE _ADVANCED99 %endif ; MODULE_8BIT_IDE 98 100 99 101 ; Prepare to output Identify Device command … … 173 175 jne SHORT .WaitUntilNonTransferCommandCompletes 174 176 %ifdef MODULE_8BIT_IDE_ADVANCED 175 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_ XTCF_MEMMAP176 jae SHORT JrIdeTransfer_StartWithCommandInAL ; DEVICE_8BIT_ XTCF_MEMMAP, DEVICE_8BIT_JRIDE_ISA or DEVICE_8BIT_ADP50L177 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA 178 jae SHORT JrIdeTransfer_StartWithCommandInAL ; DEVICE_8BIT_JRIDE_ISA or DEVICE_8BIT_ADP50L 177 179 %endif 178 180 jmp IdeTransfer_StartWithCommandInAL -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm
r526 r545 78 78 ; so we never need to separate transfer to more than 2 separate DMA operations. 79 79 80 ; Load XT-CF Control Register port to DX80 ; Load XT-CFv3 Control Register port to DX 81 81 add dl, XTCF_CONTROL_REGISTER 82 82 … … 90 90 shl cx, 1 91 91 %endif 92 cmp cx, ax 93 jbe SHORT .TransferLastDmaPageWithSizeInCX 92 cmp cx, ax ; if we won't cross a physical page boundary... 93 jbe SHORT .TransferLastDmaPageWithSizeInCX ; ...perform the transfer in one operation 94 94 95 ; Push size for second DMA page95 ; Calculate how much we can transfer on first and second rounds 96 96 xchg cx, ax ; CX = BYTEs for first page 97 97 sub ax, cx ; AX = BYTEs for second page 98 push ax 98 push ax ; Save bytes for second transfer on stack 99 99 100 100 ; Transfer first DMA page … … 108 108 ;-------------------------------------------------------------------- 109 109 ; StartDMAtransferForXTCFwithDmaModeInBL 110 ; Updated for XT-CFv3, 11-Apr-13 110 111 ; Parameters: 111 112 ; BL: Byte for DMA Mode Register 112 ; CX: Number of BYTEs to transfer (1...32768 since max block size is limited to 64) 113 ; DX: XTCF Control Register 113 ; CX: Number of BYTEs to transfer (512...32768 since max block size is limited to 64) 114 ; DX: XT-CFv3 Control Register 115 ; ES: Bits 3..0 have physical address bits 19..16 116 ; DI: Physical address bits 15..0 114 117 ; Returns: 115 ; Nothing118 ; ES:DI updated (CX is added) 116 119 ; Corrupts registers: 117 120 ; AX … … 122 125 ; Disable Interrupts and DMA Channel 3 during DMA setup 123 126 mov al, SET_CH3_MASK_BIT 124 cli ; Disable interrupts125 out MASK_REGISTER_DMA8_out, al 127 cli ; Disable interrupts - programming must be atomic 128 out MASK_REGISTER_DMA8_out, al ; Disable DMA Channel 3 126 129 127 130 ; Set DMA Mode (read or write using channel 3) … … 129 132 out MODE_REGISTER_DMA8_out, al 130 133 131 ; Set address to DMA controller 132 out CLEAR_FLIPFLOP_DMA8_out, al ; Reset flip-flop to low byte 134 ; Send start address to DMA controller 133 135 mov ax, es 134 136 out PAGE_DMA8_CH_3, al 135 137 mov ax, di 138 out CLEAR_FLIPFLOP_DMA8_out, al ; Reset flip-flop to low byte 136 139 out BASE_AND_CURRENT_ADDRESS_REGISTER_DMA8_CH3_out, al ; Low byte 137 140 mov al, ah … … 140 143 ; Set number of bytes to transfer (DMA controller must be programmed number of bytes - 1) 141 144 mov ax, cx 142 dec ax ; DMA controller is programmed for one byte less145 dec ax ; DMA controller is programmed for one byte less 143 146 out BASE_AND_CURRENT_COUNT_REGISTER_DMA8_CH3_out, al ; Low byte 144 147 mov al, ah … … 147 150 ; Enable DMA Channel 3 148 151 mov al, CLEAR_CH3_MASK_BIT 149 out MASK_REGISTER_DMA8_out, al ; Enable DMA Channel 3150 sti ; Enable interrupts152 out MASK_REGISTER_DMA8_out, al ; Enable DMA Channel 3 153 sti ; Enable interrupts 151 154 155 ; XT-CF transfers 16 bytes at a time. We need to manually start transfer for every block by writing (anything) 156 ; to the XT-CFv3 Control Register, which raises DRQ thereby passing system control to the 8237 DMA controller. 157 ; The XT-CFv3 logic releases DRQ after 16 transfers, thereby handing control back to the CPU and allowing any other IRQs or 158 ; DRQs to be serviced (which, on the PC and PC/XT will include DRAM refresh via DMA channel 0). The 16-byte transfers can 159 ; also be interrupted by the DMA controller raising TC (i.e. when done). Each transfer cannot be otherwise interrupted 160 ; and is therefore atomic (and hence fast). 152 161 153 %if 0 ; Slow DMA code 154 ; XT-CF transfers 16 bytes at a time. We need to manually 155 ; start transfer for every block. 156 ALIGN JUMP_ALIGN 157 .TransferNextBlock: 158 mov al, RAISE_DRQ_AND_CLEAR_XTCF_XFER_COUNTER 159 cli ; We want no ISR to read DMA Status Register before we do 160 out dx, al ; Transfer up to 16 bytes to/from XT-CF card 161 ; * Here XT-CF sets CPU to wait states during transfer * 162 in al, STATUS_REGISTER_DMA8_in 163 sti 164 test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT 165 jz SHORT .TransferNextBlock ; All bytes transferred? 162 %if 0 ; Slow DMA code - works by checking 8237 status register after each 16-byte transfer, until it reports TC has been raised. 163 ;ALIGN JUMP_ALIGN 164 ;.TransferNextBlock: 165 ; cli ; We want no ISR to read DMA Status Register before we do 166 ; out dx, al ; Transfer up to 16 bytes to/from XT-CF card 167 ; in al, STATUS_REGISTER_DMA8_in 168 ; sti 169 ; test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT 170 ; jz SHORT .TransferNextBlock ; All bytes transferred? 166 171 %endif ; Slow DMA code 167 172 168 169 %if 1 ; Fast DMA code 170 push cx 171 add cx, BYTE 15 ; Include any partial DMA block (since we had to divide transfer to 64k physical pages) 172 eSHR_IM cx, 4 ; Drive Block size to 16 Byte DMA Block Size 173 174 .JustOneMoreDmaBlock: 175 mov al, RAISE_DRQ_AND_CLEAR_XTCF_XFER_COUNTER 176 ALIGN JUMP_ALIGN 173 %if 1 ; Fast DMA code - perform computed number of transfers, then check DMA status register to be sure 174 push cx ; need byte count to update pointer at the end 175 add cx, BYTE 15 ; We'll divide transfers in 16-byte atomic transfers, 176 eSHR_IM cx, 4 ; so include any partial block, which will be terminated 177 ALIGN JUMP_ALIGN ; by the DMA controller raising T/C 177 178 .TransferNextDmaBlock: 178 out dx, al ; Transfer 16 bytes to/from XT-CF card 179 loop .TransferNextDmaBlock 180 179 out dx, al ; Transfer up to 16 bytes to/from XT-CF card 180 loop .TransferNextDmaBlock ; dec CX and loop if CX > 0, also adds required wait-state 181 181 inc cx ; set up CX, in case we need to do an extra iteration 182 in al, STATUS_REGISTER_DMA8_in 183 test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT 184 jz SHORT . JustOneMoreDmaBlock ; it wasn't set soget more bytes185 pop cx 182 in al, STATUS_REGISTER_DMA8_in ; check 8237 DMA controller status flags... 183 test al, FLG_CH3_HAS_REACHED_TERMINAL_COUNT ; ... for channel 3 terminal count 184 jz SHORT .TransferNextDmaBlock ; If not set, get more bytes 185 pop cx ; get back requested bytes 186 186 %endif ; Fast DMA code 187 187 188 ; Update physical address in ES:DI - since IO might need several calls through this function either from here 189 ; if crossing a physical page boundary, and from IdeTransfer.asm if requested sectors was > PIOVARS.wSectorsInBlock 190 mov ax, es ; copy physical page address to ax 191 add di, cx ; add requested bytes to di 192 adc al, 0 ; and increment physical page address, if required 193 mov es, ax ; and save it back in es 188 194 189 ; Restore XT-CF to normal operation190 mov al, XTCF_DMA_MODE191 out dx, al192 193 ; Increment physical address in ES:DI194 mov ax, es195 add di, cx196 adc al, ah197 mov es, ax198 195 ret -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeIO.asm
r536 r545 52 52 ;-------------------------------------------------------------------- 53 53 IdeIO_InputToALfromIdeRegisterInDL: 54 xor dh, dh ; IDE Register index now in DX 55 mov bx, dx ; and BX 54 xor dh, dh ; IDE Register index now in DX... 56 55 mov al, [di+DPT_ATA.bDevice] 57 56 cmp al, DEVICE_8BIT_XTIDE_REV2 58 57 jb SHORT .InputToALfromRegisterInDX ; Standard IDE controllers and XTIDE rev 1 58 mov bx, dx ; ...and BX for A0<->A3 swap and for memory mapped I/O 59 59 60 60 %ifdef MODULE_8BIT_IDE_ADVANCED … … 109 109 ; At this point remaining controllers (JRIDE, XTCF and ADP50L) all have a control 110 110 ; block offset of 8 or (8<<1) so we add 8 here and do the SHL 1 later if needed. 111 add dx, 8111 add dx, BYTE 8 112 112 cmp bl, DEVICE_8BIT_JRIDE_ISA 113 113 jb SHORT IdeIO_OutputALtoIdeRegisterInDL.ShlRegisterIndexInDXandOutputAL ; All XT-CF modes … … 127 127 ; a small trick since we only access Device Control Register at 128 128 ; offset 6h: Always clear A3 and set A0. 129 mov bh, dh ; Zero BH129 call AccessDPT_GetIdevarsToCSBX 130 130 add dx, [cs:bx+IDEVARS.wControlBlockPort] 131 131 xor dl, 1001b ; Clear A3, Set A0 … … 134 134 135 135 .OutputALtoControlBlockRegisterInDX: 136 call AccessDPT_GetIdevarsToCSBX ; *FIXME* Why is this call here but not in the above block?136 call AccessDPT_GetIdevarsToCSBX 137 137 add dx, [cs:bx+IDEVARS.wControlBlockPort] 138 138 out dx, al -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
r526 r545 20 20 ; 21 21 22 ; Modified by JJP for XT-CFv3 support, Mar-13 23 22 24 ; Section containing code 23 25 SECTION .text 26 27 28 ; -------------------------------------------------------------------------------------------------- 29 ; 30 ; READ routines follow 31 ; 32 ; -------------------------------------------------------------------------------------------------- 33 24 34 25 35 %ifdef MODULE_8BIT_IDE … … 50 60 51 61 ;-------------------------------------------------------------------- 52 ; IdePioBlock_ReadFromXtideRev2 or rev 1 with swapped A0 and A3 (chuck-mod) 53 ; Parameters: 54 ; CX: Block size in 512 byte sectors 55 ; DX: IDE Data port address 62 ; IdePioBlock_ReadFrom8bitDataPort 63 ; 64 ; 8-bit PIO from a single data port. 65 ; 66 ; Parameters: 67 ; CX: Block size in 512 byte sectors 68 ; DX: IDE Data port address 56 69 ; ES:DI: Normalized ptr to buffer to receive data 57 70 ; Returns: … … 60 73 ; AX, BX, CX 61 74 ;-------------------------------------------------------------------- 62 %ifndef USE_186 ; 8086/8088 compatible WORD read 63 64 ALIGN JUMP_ALIGN 65 IdePioBlock_ReadFromXtideRev2: 75 ALIGN JUMP_ALIGN 76 IdePioBlock_ReadFrom8bitDataPort: 77 %ifdef USE_186 78 shl cx, 9 ; Sectors to BYTEs 79 rep insb 80 ret 81 %else ; If 8088/8086 82 UNROLL_SECTORS_IN_CX_TO_OWORDS 83 ALIGN JUMP_ALIGN 84 .ReadNextOword: 85 %rep 16 ; BYTEs 86 in al, dx ; Read BYTE 87 stosb ; Store BYTE to [ES:DI] 88 %endrep 89 loop .ReadNextOword 90 ret 91 %endif 92 93 %endif ; MODULE_8BIT_IDE 94 95 96 ;-------------------------------------------------------------------- 97 ; IdePioBlock_ReadFrom16bitDataPort 98 ; 99 ; 16-bit PIO from a single data port. 100 ; 101 ; Parameters: 102 ; CX: Block size in 512 byte sectors 103 ; DX: IDE Data port address 104 ; ES:DI: Normalized ptr to buffer to receive data 105 ; Returns: 106 ; Nothing 107 ; Corrupts registers: 108 ; AX, BX, CX 109 ;-------------------------------------------------------------------- 110 ALIGN JUMP_ALIGN 111 IdePioBlock_ReadFrom16bitDataPort: 112 %ifdef USE_186 113 xchg cl, ch ; Sectors to WORDs 114 rep insw 115 ret 116 117 %else ; If 8088/8086 66 118 UNROLL_SECTORS_IN_CX_TO_OWORDS 67 119 ALIGN JUMP_ALIGN 68 120 .ReadNextOword: 69 121 %rep 8 ; WORDs 70 in ax, dx ; Read WORD 71 stosw ; Store WORD to [ES:DI] 72 %endrep 73 loop .ReadNextOword 74 ret 75 122 in ax, dx ; Read BYTE 123 stosw ; Store BYTE to [ES:DI] 124 %endrep 125 loop .ReadNextOword 126 ret 76 127 %endif 77 128 78 79 ;--------------------------------------------------------------------80 ; IdePioBlock_ReadFrom8bitDataPort CF-XT when using 8-bit PIO81 ; Parameters:82 ; CX: Block size in 512 byte sectors83 ; DX: IDE Data port address84 ; ES:DI: Normalized ptr to buffer to receive data85 ; Returns:86 ; Nothing87 ; Corrupts registers:88 ; AX, BX, CX89 ;--------------------------------------------------------------------90 ALIGN JUMP_ALIGN91 IdePioBlock_ReadFrom8bitDataPort:92 %ifdef USE_18693 shl cx, 9 ; Sectors to BYTEs94 rep insb95 ret96 97 %else ; If 8088/808698 UNROLL_SECTORS_IN_CX_TO_OWORDS99 ALIGN JUMP_ALIGN100 .ReadNextOword:101 %rep 16 ; BYTEs102 in al, dx ; Read BYTE103 stosb ; Store BYTE to [ES:DI]104 %endrep105 loop .ReadNextOword106 ret107 %endif108 109 110 ;--------------------------------------------------------------------111 ; IdePioBlock_WriteToXtideRev1112 ; Parameters:113 ; CX: Block size in 512-byte sectors114 ; DX: IDE Data port address115 ; ES:SI: Normalized ptr to buffer containing data116 ; Returns:117 ; Nothing118 ; Corrupts registers:119 ; AX, BX, CX, DX120 ;--------------------------------------------------------------------121 ALIGN JUMP_ALIGN122 IdePioBlock_WriteToXtideRev1:123 push ds124 UNROLL_SECTORS_IN_CX_TO_QWORDS125 mov bl, 8 ; Bit mask for toggling data low/high reg126 push es ; Copy ES...127 pop ds ; ...to DS128 ALIGN JUMP_ALIGN129 .OutswLoop:130 %rep 4 ; WORDs131 XTIDE_OUTSW132 %endrep133 loop .OutswLoop134 pop ds135 ret136 137 138 ;--------------------------------------------------------------------139 ; IdePioBlock_WriteToXtideRev2 or rev 1 with swapped A0 and A3 (chuck-mod)140 ; Parameters:141 ; CX: Block size in 512-byte sectors142 ; DX: IDE Data port address143 ; ES:SI: Normalized ptr to buffer containing data144 ; Returns:145 ; Nothing146 ; Corrupts registers:147 ; AX, BX, CX, DX148 ;--------------------------------------------------------------------149 ALIGN JUMP_ALIGN150 IdePioBlock_WriteToXtideRev2:151 UNROLL_SECTORS_IN_CX_TO_QWORDS152 push ds153 push es ; Copy ES...154 pop ds ; ...to DS155 ALIGN JUMP_ALIGN156 .WriteNextQword:157 %rep 4 ; WORDs158 XTIDE_MOD_OUTSW159 %endrep160 loop .WriteNextQword161 pop ds162 ret163 164 165 ;--------------------------------------------------------------------166 ; IdePioBlock_WriteTo8bitDataPort XT-CF when using 8-bit PIO167 ; Parameters:168 ; CX: Block size in 512-byte sectors169 ; DX: IDE Data port address170 ; ES:SI: Normalized ptr to buffer containing data171 ; Returns:172 ; Nothing173 ; Corrupts registers:174 ; AX, BX, CX, DX175 ;--------------------------------------------------------------------176 ALIGN JUMP_ALIGN177 IdePioBlock_WriteTo8bitDataPort:178 179 %ifdef USE_186180 shl cx, 9 ; Sectors to BYTEs181 es ; Source is ES segment182 rep outsb183 ret184 185 %else ; If 8088/8086186 UNROLL_SECTORS_IN_CX_TO_DWORDS187 push ds188 push es189 pop ds190 ALIGN JUMP_ALIGN191 .WriteNextDword:192 %rep 4 ; BYTEs193 lodsb ; Load BYTE from [DS:SI]194 out dx, al ; Write BYTE195 %endrep196 loop .WriteNextDword197 pop ds198 ret199 %endif200 201 %endif ; MODULE_8BIT_IDE202 203 204 ;--------------------------------------------------------------------205 ; IdePioBlock_ReadFromXtideRev2 (when 80186/80188 instructions are available)206 ; IdePioBlock_ReadFrom16bitDataPort Normal 16-bit IDE207 ; IdePioBlock_ReadFrom32bitDataPort VLB/PCI 32-bit IDE208 ; Parameters:209 ; CX: Block size in 512 byte sectors210 ; DX: IDE Data port address211 ; ES:DI: Normalized ptr to buffer to receive data212 ; Returns:213 ; Nothing214 ; Corrupts registers:215 ; AX, BX, CX216 ;--------------------------------------------------------------------217 ALIGN JUMP_ALIGN218 %ifdef USE_186219 %ifdef MODULE_8BIT_IDE220 IdePioBlock_ReadFromXtideRev2:221 %endif222 %endif223 IdePioBlock_ReadFrom16bitDataPort:224 xchg cl, ch ; Sectors to WORDs225 rep226 db 6Dh ; INSW227 ret228 129 229 130 ;-------------------------------------------------------------------- … … 239 140 240 141 241 ;-------------------------------------------------------------------- 242 ; IdePioBlock_WriteTo16bitDataPort Normal 16-bit IDE 142 143 ; -------------------------------------------------------------------------------------------------- 144 ; 145 ; WRITE routines follow 146 ; 147 ; -------------------------------------------------------------------------------------------------- 148 149 %ifdef MODULE_8BIT_IDE 150 151 ;-------------------------------------------------------------------- 152 ; IdePioBlock_WriteToXtideRev1 153 ; Parameters: 154 ; CX: Block size in 512-byte sectors 155 ; DX: IDE Data port address 156 ; ES:SI: Normalized ptr to buffer containing data 157 ; Returns: 158 ; Nothing 159 ; Corrupts registers: 160 ; AX, BX, CX, DX 161 ;-------------------------------------------------------------------- 162 ALIGN JUMP_ALIGN 163 IdePioBlock_WriteToXtideRev1: 164 push ds 165 UNROLL_SECTORS_IN_CX_TO_QWORDS 166 mov bl, 8 ; Bit mask for toggling data low/high reg 167 push es ; Copy ES... 168 pop ds ; ...to DS 169 ALIGN JUMP_ALIGN 170 .OutswLoop: 171 %rep 4 ; WORDs 172 XTIDE_OUTSW 173 %endrep 174 loop .OutswLoop 175 pop ds 176 ret 177 178 179 ;-------------------------------------------------------------------- 180 ; IdePioBlock_WriteToXtideRev2 or rev 1 with swapped A0 and A3 (chuck-mod) 181 ; Parameters: 182 ; CX: Block size in 512-byte sectors 183 ; DX: IDE Data port address 184 ; ES:SI: Normalized ptr to buffer containing data 185 ; Returns: 186 ; Nothing 187 ; Corrupts registers: 188 ; AX, BX, CX, DX 189 ;-------------------------------------------------------------------- 190 ALIGN JUMP_ALIGN 191 IdePioBlock_WriteToXtideRev2: 192 UNROLL_SECTORS_IN_CX_TO_QWORDS 193 push ds 194 push es ; Copy ES... 195 pop ds ; ...to DS 196 ALIGN JUMP_ALIGN 197 .WriteNextQword: 198 %rep 4 ; WORDs 199 XTIDE_MOD_OUTSW ; special macro 200 %endrep 201 loop .WriteNextQword 202 pop ds 203 ret 204 205 206 ;-------------------------------------------------------------------- 207 ; IdePioBlock_WriteTo8bitDataPort 208 ; Parameters: 209 ; CX: Block size in 512-byte sectors 210 ; DX: IDE Data port address 211 ; ES:SI: Normalized ptr to buffer containing data 212 ; Returns: 213 ; Nothing 214 ; Corrupts registers: 215 ; AX, BX, CX, DX 216 ;-------------------------------------------------------------------- 217 ALIGN JUMP_ALIGN 218 IdePioBlock_WriteTo8bitDataPort: 219 %ifdef USE_186 220 shl cx, 9 ; Sectors to BYTEs 221 es ; Source is ES segment 222 rep outsb 223 ret 224 225 %else ; If 8088/8086 226 UNROLL_SECTORS_IN_CX_TO_QWORDS 227 push ds 228 ;mov ax, es 229 ;mov ds, ax ; move es to ds via ax (does this run faster on 8088?) 230 push es 231 pop ds 232 ALIGN JUMP_ALIGN 233 .WriteNextQword: 234 %rep 8 ; BYTEs 235 lodsb ; Load BYTE from [DS:SI] 236 out dx, al ; Write BYTE 237 %endrep 238 loop .WriteNextQword 239 pop ds 240 ret 241 %endif 242 243 %endif ; MODULE_8BIT_IDE 244 245 246 ;-------------------------------------------------------------------- 247 ; IdePioBlock_WriteTo16bitDataPort Normal 16-bit IDE, XT-CFv3 in BIU Mode 243 248 ; IdePioBlock_WriteTo32bitDataPort VLB/PCI 32-bit IDE 244 249 ; Parameters: 245 ; CX: 246 ; DX: 250 ; CX: Block size in 512-byte sectors 251 ; DX: IDE Data port address 247 252 ; ES:SI: Normalized ptr to buffer containing data 248 253 ; Returns: … … 253 258 ALIGN JUMP_ALIGN 254 259 IdePioBlock_WriteTo16bitDataPort: 260 %ifdef USE_186 255 261 xchg cl, ch ; Sectors to WORDs 256 262 es ; Source is ES segment 257 rep 258 db 6Fh ; OUTSW 259 ret 263 rep outsw 264 ret 265 266 %else ; If 8088/8086 267 UNROLL_SECTORS_IN_CX_TO_QWORDS 268 push ds 269 ;mov ax, es 270 ;mov ds, ax ; move es to ds via ax (does this run faster on 8088?) 271 push es 272 pop ds 273 ALIGN JUMP_ALIGN 274 .WriteNextQword: 275 %rep 4 ; WORDs 276 lodsw ; Load BYTE from [DS:SI] 277 out dx, ax ; Write BYTE 278 %endrep 279 loop .WriteNextQword 280 pop ds 281 ret 282 %endif ; if/else USE_186 260 283 261 284 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r539 r545 346 346 dw IdePioBlock_ReadFrom8bitDataPort ; 2, DEVICE_8BIT_ATA 347 347 dw IdePioBlock_ReadFromXtideRev1 ; 3, DEVICE_8BIT_XTIDE_REV1 348 dw IdePioBlock_ReadFromXtideRev2 ; 4, DEVICE_8BIT_XTIDE_REV2 348 dw IdePioBlock_ReadFrom16bitDataPort ; 4, DEVICE_8BIT_XTIDE_REV2 349 dw IdePioBlock_ReadFrom8bitDataPort ; 5, DEVICE_8BIT_XTCF_PIO8 350 dw IdePioBlock_ReadFrom16bitDataPort ; 6, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 349 351 %ifdef MODULE_8BIT_IDE_ADVANCED 350 dw IdePioBlock_ReadFrom8bitDataPort ; 5, DEVICE_8BIT_XTCF_PIO8 351 dw IdeDmaBlock_ReadFromXTCF ; 6, DEVICE_8BIT_XTCF_DMA 352 %endif 353 %endif 352 dw IdeDmaBlock_ReadFromXTCF ; 7, DEVICE_8BIT_XTCF_DMA 353 %endif ; MODULE_8BIT_IDE_ADVANCED 354 %endif ; MODULE_8BIT_IDE 354 355 355 356 … … 361 362 dw IdePioBlock_WriteToXtideRev1 ; 3, DEVICE_8BIT_XTIDE_REV1 362 363 dw IdePioBlock_WriteToXtideRev2 ; 4, DEVICE_8BIT_XTIDE_REV2 364 dw IdePioBlock_WriteTo8bitDataPort ; 5, DEVICE_8BIT_XTCF_PIO8 365 dw IdePioBlock_WriteTo16bitDataPort ; 6, DEVICE_8BIT_XTCF_PIO8_WITH_BIU_OFFLOAD 363 366 %ifdef MODULE_8BIT_IDE_ADVANCED 364 dw IdePioBlock_WriteTo8bitDataPort ; 5, DEVICE_8BIT_XTCF_PIO8 365 dw IdeDmaBlock_WriteToXTCF ; 6, DEVICE_8BIT_XTCF_DMA 366 %endif 367 %endif 367 dw IdeDmaBlock_WriteToXTCF ; 7, DEVICE_8BIT_XTCF_DMA 368 %endif ; MODULE_8BIT_IDE_ADVANCED 369 %endif ; MODULE_8BIT_IDE -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm
r538 r545 67 67 68 68 ; Get far pointer to Sector Access Window 69 mov dx, [di+DPT.wBasePort]70 69 cmp BYTE [di+DPT_ATA.bDevice], DEVICE_8BIT_JRIDE_ISA 71 jb SHORT .GetSectorAccessWindowForXTCF 72 73 ; Get Sector Access Window for JR-IDE/ISA and ADP50L 74 mov ds, dx ; Segment for JR-IDE/ISA and ADP50L 75 mov di, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET 76 je SHORT .SectorAccessWindowLoadedToDSDI 70 mov ds, [di+DPT.wBasePort] ; Segment for JR-IDE/ISA and ADP50L 77 71 mov di, ADP50L_SECTOR_ACCESS_WINDOW_OFFSET 78 jmp SHORT .SectorAccessWindowLoadedToDSDI 79 80 .GetSectorAccessWindowForXTCF: 81 xor di, di 82 add dl, XTCF_CONTROL_REGISTER 83 in al, dx ; Read high byte for Sector Access Window segment 84 xchg ah, al 85 mov ds, ax 72 eCMOVE di, JRIDE_SECTOR_ACCESS_WINDOW_OFFSET 86 73 87 74 ; Are we reading or writing?
Note:
See TracChangeset
for help on using the changeset viewer.