ATA PIO Mode: Difference between revisions

Jump to navigation Jump to search
Added clarification on "magic bits"
[unchecked revision][unchecked revision]
mNo edit summary
(Added clarification on "magic bits")
Line 219:
# Transfer 256 words, a word at a time, into your buffer from I/O port 0x1F0. (In assembler, REP INSW works well for this.)
# Then loop back to waiting for the next IRQ (or poll again -- see next note) for <i>each successive sector</i>.
 
Note on the "magic bits" sent to port 0x1f6: Bit 6 (value = 0x40) is the LBA bit. This must be set for either LBA28 or LBA48 transfers. It must be clear for CHS transfers. Bits 7 and 5 are obsolete for <b>current</b> ATA drives, but must be set for backwards compatibility with very old (ATA1) drives.
 
Note for polling PIO drivers:
Line 245 ⟶ 247:
# outb (0x1F5, LBA3)
# Send the "READ SECTORS EXT" command (0x24) to port 0x1F7: outb(0x1F7, 0x24)
 
Note on the "magic bits" sent to port 0x1f6: Bit 6 (value = 0x40) is the LBA bit. This must be set for either LBA28 or LBA48 transfers. It must be clear for CHS transfers. Any drive that can support LBA48 will ignore these bits. You can set them if it will make your code cleaner (to use the same interface as LBA28).
 
To write sectors in 48 bit PIO mode, send command "WRITE SECTORS EXT" (0x34), instead. (As before, do not use REP OUTSW when writing.) And remember to do a Cache Flush after each write command completes.
Line 277 ⟶ 281:
 
To write, send command "WRITE SECTORS" (0x30).
 
Note on the "magic bits" sent to port 0x1f6: Bit 6 (value = 0x40) is the LBA bit. This must be clear for CHS transfers, as said above. Bits 7 and 5 are obsolete for <b>current</b> ATA drives, but must be set for backwards compatibility with very old (ATA1) drives.
 
==x86 Code Examples==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu