Changeset 589 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device
- Timestamp:
- May 22, 2016, 12:26:57 PM (9 years ago)
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device/IDE
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeCommand.asm
r584 r589 33 33 IdeCommand_ResetMasterAndSlaveController: 34 34 ; HSR0: Set_SRST 35 call AccessDPT_GetDeviceControlByteToAL 36 or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 35 ; Used to be: 36 ; call AccessDPT_GetDeviceControlByteToAL 37 ; or al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN ; Set Reset bit 38 ; Is now: 39 mov al, FLG_DEVCONTROL_SRST | FLG_DEVCONTROL_nIEN 40 ; --- 37 41 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 38 42 mov ax, HSR0_RESET_WAIT_US … … 40 44 41 45 ; HSR1: Clear_wait 42 call AccessDPT_GetDeviceControlByteToAL 43 or al, FLG_DEVCONTROL_nIEN 44 and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 46 ; Used to be: 47 ; call AccessDPT_GetDeviceControlByteToAL 48 ; or al, FLG_DEVCONTROL_nIEN 49 ; and al, ~FLG_DEVCONTROL_SRST ; Clear reset bit 50 ; Is now: 51 mov al, FLG_DEVCONTROL_nIEN 52 ; --- 45 53 OUTPUT_AL_TO_IDE_CONTROL_BLOCK_REGISTER DEVICE_CONTROL_REGISTER_out 46 54 mov ax, HSR1_RESET_WAIT_US … … 51 59 jmp IdeWait_PollStatusFlagInBLwithTimeoutInBH 52 60 61 ; *FIXME* AccessDPT_GetDeviceControlByteToAL currently always returns with 62 ; AL cleared (0) or with only bit 1 set (FLG_DEVCONTROL_nIEN = 2). 63 ; The commented away instructions above sets FLG_DEVCONTROL_nIEN anyway 64 ; making the call to AccessDPT_GetDeviceControlByteToAL redundant. 65 ; I have left this code as is since I don't know if it's a mistake 66 ; (from all the way back to r150) or if it's coded this way in anticipation 67 ; of some future changes to AccessDPT_GetDeviceControlByteToAL. 53 68 54 69 ;-------------------------------------------------------------------- -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeDmaBlock.asm
r567 r589 94 94 ; When DI is zero only one transfer is required since we've limited the 95 95 ; XT-CFv3 block size to 32k 96 jnc SHORT .TransferLastDmaPageWithSizeInCX96 jnc SHORT StartDMAtransferForXTCFwithDmaModeInBL 97 97 98 98 ; CF was set, so DI != 0 and we might need one or two transfers 99 cmp cx, ax ; if we won't cross a physical page boundary...100 jbe SHORT .TransferLastDmaPageWithSizeInCX; ...perform the transfer in one operation99 cmp cx, ax ; if we won't cross a physical page boundary... 100 jbe SHORT StartDMAtransferForXTCFwithDmaModeInBL ; ...perform the transfer in one operation 101 101 102 102 ; Calculate how much we can transfer on first and second rounds … … 108 108 call StartDMAtransferForXTCFwithDmaModeInBL 109 109 pop cx ; Pop size for second DMA page 110 111 .TransferLastDmaPageWithSizeInCX:112 110 ; Fall to StartDMAtransferForXTCFwithDmaModeInBL 113 111 … … 115 113 ;-------------------------------------------------------------------- 116 114 ; StartDMAtransferForXTCFwithDmaModeInBL 117 ; Updated for XT-CFv3, 11-Apr-13118 115 ; Parameters: 119 116 ; BL: Byte for DMA Mode Register -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdePioBlock.asm
r580 r589 29 29 ; -------------------------------------------------------------------------------------------------- 30 30 31 32 31 %ifdef MODULE_8BIT_IDE 33 34 32 ;-------------------------------------------------------------------- 35 33 ; IdePioBlock_ReadFromXtideRev1 … … 57 55 58 56 ;-------------------------------------------------------------------- 57 ; 8-bit PIO from a single data port. 58 ; 59 59 ; IdePioBlock_ReadFrom8bitDataPort 60 ;61 ; 8-bit PIO from a single data port.62 ;63 60 ; Parameters: 64 61 ; CX: Block size in 512 byte sectors … … 68 65 ; Nothing 69 66 ; Corrupts registers: 70 ; AX, BX,CX67 ; AX, CX 71 68 ;-------------------------------------------------------------------- 72 69 ALIGN JUMP_ALIGN … … 87 84 ret 88 85 %endif 89 90 %endif ; MODULE_8BIT_IDE 91 92 93 ;-------------------------------------------------------------------- 86 %endif ; MODULE_8BIT_IDE 87 88 89 ;-------------------------------------------------------------------- 90 ; 16-bit and 32-bit PIO from a single data port. 91 ; 94 92 ; IdePioBlock_ReadFrom16bitDataPort 95 ; 96 ; 16-bit PIO from a single data port. 97 ; 93 ; IdePioBlock_ReadFrom32bitDataPort 98 94 ; Parameters: 99 95 ; CX: Block size in 512 byte sectors … … 103 99 ; Nothing 104 100 ; Corrupts registers: 105 ; AX, BX,CX101 ; AX, CX 106 102 ;-------------------------------------------------------------------- 107 103 ALIGN JUMP_ALIGN 108 104 IdePioBlock_ReadFrom16bitDataPort: 109 105 %ifdef USE_186 110 xchg cl, ch ; Sectors to WORDs106 xchg cl, ch ; Sectors to WORDs 111 107 rep insw 112 108 ret … … 126 122 127 123 ;-------------------------------------------------------------------- 124 %ifdef MODULE_ADVANCED_ATA 128 125 ALIGN JUMP_ALIGN 129 126 IdePioBlock_ReadFrom32bitDataPort: 130 db 0C1h ; SHL 131 db 0E1h ; CX 132 db 7 ; 7 (Sectors to DWORDs) 133 rep 134 db 66h ; Override operand size to 32-bit 135 db 6Dh ; INSW/INSD 136 ret 137 127 shl cx, 7 ; Sectors to DWORDs 128 rep insd 129 ret 130 %endif ; MODULE_ADVANCED_ATA 138 131 139 132 … … 145 138 146 139 %ifdef MODULE_8BIT_IDE 147 148 140 ;-------------------------------------------------------------------- 149 141 ; IdePioBlock_WriteToXtideRev1 … … 151 143 ; CX: Block size in 512-byte sectors 152 144 ; DX: IDE Data port address 153 ; ES:SI: Normalized ptr to buffer containing data145 ; DS:SI: Normalized ptr to buffer containing data 154 146 ; Returns: 155 147 ; Nothing … … 159 151 ALIGN JUMP_ALIGN 160 152 IdePioBlock_WriteToXtideRev1: 161 push ds162 153 UNROLL_SECTORS_IN_CX_TO_QWORDS 163 154 mov bl, 8 ; Bit mask for toggling data low/high reg 164 push es165 pop ds166 155 ALIGN JUMP_ALIGN 167 156 .OutswLoop: … … 170 159 %endrep 171 160 loop .OutswLoop 172 pop ds173 161 ret 174 162 … … 179 167 ; CX: Block size in 512-byte sectors 180 168 ; DX: IDE Data port address 181 ; ES:SI: Normalized ptr to buffer containing data182 ; Returns: 183 ; Nothing 184 ; Corrupts registers: 185 ; AX, BX,CX169 ; DS:SI: Normalized ptr to buffer containing data 170 ; Returns: 171 ; Nothing 172 ; Corrupts registers: 173 ; AX, CX 186 174 ;-------------------------------------------------------------------- 187 175 ALIGN JUMP_ALIGN 188 176 IdePioBlock_WriteToXtideRev2: 189 177 UNROLL_SECTORS_IN_CX_TO_QWORDS 190 push ds191 push es192 pop ds193 178 ALIGN JUMP_ALIGN 194 179 .WriteNextQword: … … 197 182 %endrep 198 183 loop .WriteNextQword 199 pop ds200 184 ret 201 185 … … 206 190 ; CX: Block size in 512-byte sectors 207 191 ; DX: IDE Data port address 208 ; ES:SI: Normalized ptr to buffer containing data209 ; Returns: 210 ; Nothing 211 ; Corrupts registers: 212 ; AX, BX,CX192 ; DS:SI: Normalized ptr to buffer containing data 193 ; Returns: 194 ; Nothing 195 ; Corrupts registers: 196 ; AX, CX 213 197 ;-------------------------------------------------------------------- 214 198 ALIGN JUMP_ALIGN … … 216 200 %ifdef USE_186 217 201 shl cx, 9 ; Sectors to BYTEs 218 es ; Source is ES segment219 202 rep outsb 220 203 ret … … 222 205 %else ; 808x 223 206 UNROLL_SECTORS_IN_CX_TO_QWORDS 224 push ds225 push es226 pop ds227 207 ALIGN JUMP_ALIGN 228 208 .WriteNextQword: … … 232 212 %endrep 233 213 loop .WriteNextQword 234 pop ds 235 ret 236 %endif 237 214 ret 215 %endif 238 216 %endif ; MODULE_8BIT_IDE 239 217 … … 245 223 ; CX: Block size in 512-byte sectors 246 224 ; DX: IDE Data port address 247 ; ES:SI: Normalized ptr to buffer containing data248 ; Returns: 249 ; Nothing 250 ; Corrupts registers: 251 ; AX, BX,CX225 ; DS:SI: Normalized ptr to buffer containing data 226 ; Returns: 227 ; Nothing 228 ; Corrupts registers: 229 ; AX, CX 252 230 ;-------------------------------------------------------------------- 253 231 ALIGN JUMP_ALIGN … … 255 233 %ifdef USE_186 256 234 xchg cl, ch ; Sectors to WORDs 257 es ; Source is ES segment258 235 rep outsw 259 236 ret … … 261 238 %else ; 808x 262 239 UNROLL_SECTORS_IN_CX_TO_QWORDS 263 push ds264 push es265 pop ds266 240 ALIGN JUMP_ALIGN 267 241 .WriteNextQword: … … 271 245 %endrep 272 246 loop .WriteNextQword 273 pop ds274 ret 275 %endif 276 277 ;-------------------------------------------------------------------- 247 ret 248 %endif 249 250 ;-------------------------------------------------------------------- 251 %ifdef MODULE_ADVANCED_ATA 278 252 ALIGN JUMP_ALIGN 279 253 IdePioBlock_WriteTo32bitDataPort: 280 db 0C1h ; SHL 281 db 0E1h ; CX 282 db 7 ; 7 (Sectors to DWORDs) 283 es ; Source is ES segment 284 rep 285 db 66h ; Override operand size to 32-bit 286 db 6Fh ; OUTSW/OUTSD 287 ret 254 shl cx, 7 ; Sectors to DWORDs 255 rep outsd 256 ret 257 %endif ; MODULE_ADVANCED_ATA -
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r584 r589 173 173 cmp [bp+PIOVARS.bSectorsLeft], cl 174 174 jbe SHORT .WriteLastBlockToDrive 175 push ds 176 push es 177 pop ds 175 178 call [bp+PIOVARS.fnXfer] 176 179 pop ds 177 180 ; Wait until ready for next block and check for errors 178 181 call IdeWait_IRQorDRQ ; Wait until ready to transfer … … 189 192 mov cl, [bp+PIOVARS.bSectorsLeft] ; CH is already zero 190 193 push cx 194 push ds 195 push es 196 pop ds 191 197 call [bp+PIOVARS.fnXfer] ; Transfer possibly partial block 198 pop ds 192 199 jmp SHORT CheckErrorsAfterTransferringLastBlock 193 200 … … 237 244 ; Convert ES:SI to physical address 238 245 %ifdef USE_386 239 240 246 mov dx, es 241 247 xor ax, ax … … 247 253 248 254 %elifdef USE_186 249 ; Bytes EU Cycles(286) 250 mov ax, es ; 2 2 251 rol ax, 4 ; 3 9 252 mov dx, ax ; 2 2 253 and ax, BYTE 0Fh; 3 3 254 xor dx, ax ; 2 2 255 add si, dx ; 2 2 256 adc al, ah ; 2 2 257 mov es, ax ; 2 2 258 ;------------------------------------ 259 ; 18 24 255 mov ax, es 256 rol ax, 4 257 mov dx, ax 258 and ax, 0Fh 259 xor dx, ax 260 add si, dx 261 adc al, ah 262 mov es, ax 263 260 264 %else ; 808x 261 ; Bytes EU Cycles(808x) 262 mov al, 4 ; 2 4 263 mov dx, es ; 2 2 264 xchg cx, ax ; 1 3 265 rol dx, cl ; 2 24 266 mov cx, dx ; 2 2 267 xchg cx, ax ; 1 3 268 and ax, BYTE 0Fh; 3 4 269 xor dx, ax ; 2 3 270 add si, dx ; 2 3 271 adc al, ah ; 2 3 272 mov es, ax ; 2 2 273 ;------------------------------------ 274 ; 21 53 275 ; 276 ; Judging by the Execution Unit cycle count the above block of code is 277 ; apparently slower. However, the shifts and rotates in the block below 278 ; execute faster than the Bus Interface Unit on an 8088 can fetch them, 279 ; thus causing the EU to starve. The difference in true execution speed 280 ; (if any) might not be worth the extra 5 bytes. 281 ; In other words, we could use a real world test here. 282 ; 283 %if 0 284 ; Bytes EU Cycles(808x/286) 285 xor dx, dx ; 2 3/2 286 mov ax, es ; 2 2/2 287 %rep 4 288 shl ax, 1 ; 8 8/8 289 rcl dx, 1 ; 8 8/8 290 %endrep 291 add si, ax ; 2 3/2 292 adc dl, dh ; 2 3/2 293 mov es, dx ; 2 2/2 294 ;------------------------------------ 295 ; 26 29/26 296 %endif ; 0 265 mov al, 4 266 mov dx, es 267 xchg cx, ax 268 rol dx, cl 269 mov cx, dx 270 xchg cx, ax 271 and ax, 0Fh 272 xor dx, ax 273 add si, dx 274 adc al, ah 275 mov es, ax 276 297 277 %endif 298 278 … … 334 314 %ifdef USE_AT ; CF is always clear for XT builds 335 315 ; AH = RET_HD_INVALID (01) if CF set, RET_HD_SUCCESS (00) if not. CF unchanged. 316 %ifdef USE_386 317 setc ah 318 %else 336 319 sbb ah, ah 337 320 neg ah 338 321 %endif 322 %endif ; USE_AT 339 323 ret 340 324 … … 345 329 g_rgfnPioRead: 346 330 dw IdePioBlock_ReadFrom16bitDataPort ; 0, DEVICE_16BIT_ATA 331 %ifdef MODULE_ADVANCED_ATA 347 332 dw IdePioBlock_ReadFrom32bitDataPort ; 1, DEVICE_32BIT_ATA 333 %elifdef MODULE_8BIT_IDE 334 dw NULL 335 %endif ; MODULE_ADVANCED_ATA 348 336 %ifdef MODULE_8BIT_IDE 349 337 dw IdePioBlock_ReadFrom8bitDataPort ; 2, DEVICE_8BIT_ATA … … 361 349 g_rgfnPioWrite: 362 350 dw IdePioBlock_WriteTo16bitDataPort ; 0, DEVICE_16BIT_ATA 351 %ifdef MODULE_ADVANCED_ATA 363 352 dw IdePioBlock_WriteTo32bitDataPort ; 1, DEVICE_32BIT_ATA 353 %elifdef MODULE_8BIT_IDE 354 dw NULL 355 %endif ; MODULE_ADVANCED_ATA 364 356 %ifdef MODULE_8BIT_IDE 365 357 dw IdePioBlock_WriteTo8bitDataPort ; 2, DEVICE_8BIT_ATA
Note:
See TracChangeset
for help on using the changeset viewer.