Changeset 473 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
- Timestamp:
- Oct 10, 2012, 6:22:23 PM (13 years ago)
- google:author:
- aitotat@gmail.com
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm
r445 r473 206 206 ALIGN JUMP_ALIGN 207 207 InitializePiovarsInSSBPwithSectorCountInAH: 208 ; Store sizes 208 ; Store sizes and Data Port 209 209 mov [bp+PIOVARS.bSectorsLeft], ah 210 mov ax, [di+DPT.wBasePort] 211 mov [bp+PIOVARS.wDataPort], ax 210 212 eMOVZX ax, [di+DPT_ATA.bBlockSize] 211 213 mov [bp+PIOVARS.wSectorsInBlock], ax … … 214 216 ; Get transfer function based on bus type 215 217 xchg ax, bx ; Lookup table offset to AX 216 mov bl, [di+DPT.bIdevarsOffset] ; CS:BX now points to IDEVARS217 mov dx, [cs:bx+IDEVARS.wPort] ; Load IDE Data port address218 218 mov bl, [di+DPT_ATA.bDevice] 219 219 add bx, ax 220 221 mov [bp+PIOVARS.wDataPort], dx222 220 mov ax, [cs:bx] ; Load offset to transfer function 223 221 mov [bp+PIOVARS.fnXfer], ax … … 225 223 226 224 227 ;--------------------------------------------------------------------228 ; ReadBlockFromXtideRev1 XTIDE rev 1229 ; ReadBlockFromXtideRev2 XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)230 ; ReadBlockFrom8bitDataPort CF-XT when using 8-bit PIO231 ; ReadBlockFrom16bitDataPort Normal 16-bit IDE232 ; ReadBlockFrom32bitDataPort VLB/PCI 32-bit IDE233 ; Parameters:234 ; CX: Block size in 512 byte sectors235 ; DX: IDE Data port address236 ; ES:DI: Normalized ptr to buffer to receive data237 ; Returns:238 ; Nothing239 ; Corrupts registers:240 ; AX, BX, CX241 ;--------------------------------------------------------------------242 %ifdef MODULE_8BIT_IDE243 244 ALIGN JUMP_ALIGN245 ReadBlockFromXtideRev1:246 UNROLL_SECTORS_IN_CX_TO_OWORDS247 mov bl, 8 ; Bit mask for toggling data low/high reg248 ALIGN JUMP_ALIGN249 .InswLoop:250 %rep 8 ; WORDs251 XTIDE_INSW252 %endrep253 loop .InswLoop254 ret255 256 ;--------------------------------------------------------------------257 %ifndef USE_186 ; 8086/8088 compatible WORD read258 ALIGN JUMP_ALIGN259 ReadBlockFromXtideRev2:260 UNROLL_SECTORS_IN_CX_TO_OWORDS261 ALIGN JUMP_ALIGN262 .ReadNextOword:263 %rep 8 ; WORDs264 in ax, dx ; Read WORD265 stosw ; Store WORD to [ES:DI]266 %endrep267 loop .ReadNextOword268 ret269 %endif270 271 ;--------------------------------------------------------------------272 %ifdef USE_186273 ALIGN JUMP_ALIGN274 ReadBlockFrom8bitDataPort:275 shl cx, 9 ; Sectors to BYTEs276 rep insb277 ret278 279 %else ; If 8088/8086280 ALIGN JUMP_ALIGN281 ReadBlockFrom8bitDataPort:282 UNROLL_SECTORS_IN_CX_TO_OWORDS283 ALIGN JUMP_ALIGN284 .ReadNextOword:285 %rep 16 ; BYTEs286 in al, dx ; Read BYTE287 stosb ; Store BYTE to [ES:DI]288 %endrep289 loop .ReadNextOword290 ret291 %endif292 %endif ; MODULE_8BIT_IDE293 294 ;--------------------------------------------------------------------295 %ifdef USE_186296 ALIGN JUMP_ALIGN297 ReadBlockFrom16bitDataPort:298 xchg cl, ch ; Sectors to WORDs299 rep insw300 ret301 %endif302 303 ;--------------------------------------------------------------------304 %ifdef USE_AT305 ALIGN JUMP_ALIGN306 ReadBlockFrom32bitDataPort:307 shl cx, 7 ; Sectors to DWORDs308 rep309 db 66h ; Override operand size to 32-bit310 db 6Dh ; INSW/INSD311 ret312 %endif313 314 315 ;--------------------------------------------------------------------316 ; WriteBlockToXtideRev1 XTIDE rev 1317 ; WriteBlockToXtideRev2 XTIDE rev 2 or rev 1 with swapped A0 and A3 (chuck-mod)318 ; WriteBlockTo8bitDataPort XT-CF when using 8-bit PIO319 ; WriteBlockTo16bitDataPort Normal 16-bit IDE320 ; WriteBlockTo32bitDataPort VLB/PCI 32-bit IDE321 ; Parameters:322 ; CX: Block size in 512-byte sectors323 ; DX: IDE Data port address324 ; ES:SI: Normalized ptr to buffer containing data325 ; Returns:326 ; Nothing327 ; Corrupts registers:328 ; AX, BX, CX, DX329 ;--------------------------------------------------------------------330 %ifdef MODULE_8BIT_IDE331 332 ALIGN JUMP_ALIGN333 WriteBlockToXtideRev1:334 push ds335 UNROLL_SECTORS_IN_CX_TO_QWORDS336 mov bl, 8 ; Bit mask for toggling data low/high reg337 push es ; Copy ES...338 pop ds ; ...to DS339 ALIGN JUMP_ALIGN340 .OutswLoop:341 %rep 4 ; WORDs342 XTIDE_OUTSW343 %endrep344 loop .OutswLoop345 pop ds346 ret347 348 ;--------------------------------------------------------------------349 ALIGN JUMP_ALIGN350 WriteBlockToXtideRev2:351 UNROLL_SECTORS_IN_CX_TO_QWORDS352 push ds353 push es ; Copy ES...354 pop ds ; ...to DS355 ALIGN JUMP_ALIGN356 .WriteNextQword:357 %rep 4 ; WORDs358 XTIDE_MOD_OUTSW359 %endrep360 loop .WriteNextQword361 pop ds362 ret363 364 ;--------------------------------------------------------------------365 %ifdef USE_186366 ALIGN JUMP_ALIGN367 WriteBlockTo8bitDataPort:368 shl cx, 9 ; Sectors to BYTEs369 es ; Source is ES segment370 rep outsb371 ret372 373 %else ; If 8088/8086374 ALIGN JUMP_ALIGN375 WriteBlockTo8bitDataPort:376 UNROLL_SECTORS_IN_CX_TO_DWORDS377 push ds378 push es379 pop ds380 ALIGN JUMP_ALIGN381 .WriteNextDword:382 %rep 4 ; BYTEs383 lodsb ; Load BYTE from [DS:SI]384 out dx, al ; Write BYTE385 %endrep386 loop .WriteNextDword387 pop ds388 ret389 %endif390 %endif ; MODULE_8BIT_IDE391 392 ;--------------------------------------------------------------------393 %ifdef USE_AT394 ALIGN JUMP_ALIGN395 WriteBlockTo16bitDataPort:396 xchg cl, ch ; Sectors to WORDs397 es ; Source is ES segment398 rep outsw399 ret400 401 ;--------------------------------------------------------------------402 ALIGN JUMP_ALIGN403 WriteBlockTo32bitDataPort:404 shl cx, 7 ; Sectors to DWORDs405 es ; Source is ES segment406 rep407 db 66h ; Override operand size to 32-bit408 db 6Fh ; OUTSW/OUTSD409 ret410 %endif ; USE_AT411 412 413 225 414 226 ; Lookup tables to get transfer function based on bus type 415 227 ALIGN WORD_ALIGN 416 228 g_rgfnPioRead: 229 %ifdef USE_AT 230 dw IdePioBlock_ReadFrom16bitDataPort ; 0, DEVICE_16BIT_ATA 231 dw IdePioBlock_ReadFrom32bitDataPort ; 1, DEVICE_32BIT_ATA 232 %else 233 dd 0 234 %endif 417 235 %ifdef MODULE_8BIT_IDE 418 dw 0 ; 0, DEVICE_8BIT_JRIDE_ISA 419 dw ReadBlockFrom8bitDataPort ; 1, DEVICE_8BIT_XTCF 420 %ifdef USE_186 421 dw ReadBlockFrom16bitDataPort ; 2, DEVICE_8BIT_XTIDE_REV2 422 %else 423 dw ReadBlockFromXtideRev2 ; 2, DEVICE_8BIT_XTIDE_REV2 236 dw IdePioBlock_ReadFromXtideRev1 ; 2, DEVICE_8BIT_XTIDE_REV1 237 %ifndef USE_AT 238 g_rgfnPioWrite: 424 239 %endif 425 dw ReadBlockFromXtideRev1 ; 3, DEVICE_XTIDE_REV1 426 427 %else 428 times COUNT_OF_8BIT_IDE_DEVICES dw 0 429 %endif 240 dw IdePioBlock_ReadFromXtideRev2 ; 3, DEVICE_8BIT_XTIDE_REV2 241 dw IdePioBlock_ReadFrom8bitDataPort ; 4, DEVICE_8BIT_XTCF_PIO8 242 %endif 243 430 244 %ifdef USE_AT 431 dw ReadBlockFrom16bitDataPort ; 4, DEVICE_16BIT_ATA432 dw ReadBlockFrom32bitDataPort ; 5, DEVICE_32BIT_ATA433 %endif434 435 436 245 g_rgfnPioWrite: 246 dw IdePioBlock_WriteTo16bitDataPort ; 0, DEVICE_16BIT_ATA 247 dw IdePioBlock_WriteTo32bitDataPort ; 1, DEVICE_32BIT_ATA 248 %endif 437 249 %ifdef MODULE_8BIT_IDE 438 dw 0 ; 0, DEVICE_8BIT_JRIDE_ISA 439 dw WriteBlockTo8bitDataPort ; 1, DEVICE_8BIT_XTCF 440 dw WriteBlockToXtideRev2 ; 2, DEVICE_XTIDE_REV2 441 dw WriteBlockToXtideRev1 ; 3, DEVICE_XTIDE_REV1 442 443 %else 444 times COUNT_OF_8BIT_IDE_DEVICES dw 0 445 %endif 446 %ifdef USE_AT 447 dw WriteBlockTo16bitDataPort ; 4, DEVICE_16BIT_ATA 448 dw WriteBlockTo32bitDataPort ; 5, DEVICE_32BIT_ATA 449 %endif 250 dw IdePioBlock_WriteToXtideRev1 ; 2, DEVICE_8BIT_XTIDE_REV1 251 dw IdePioBlock_WriteToXtideRev2 ; 3, DEVICE_8BIT_XTIDE_REV2 252 dw IdePioBlock_WriteTo8bitDataPort ; 4, DEVICE_8BIT_XTCF_PIO8 253 %endif
Note:
See TracChangeset
for help on using the changeset viewer.