Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
The ATA PACKET command works in three phases, in PIO mode.
Phase 1) Set up the standard ATA IO port registers with ATAPI specific values. Then Send the ATA PACKET command to the device exactly as you would with any other ATA command: outb (ATA Command Register, 0xA0)
Phase 2) Prepare to do a PIO data transfer, the normal way, to the device. When the device is ready (BSY clear, DRQ set) you send the ATAPI command string (like the one above) as a 6 word PIO transfer to the device.
Phase 3) Wait for an IRQ. When it arrives, you must read the LBA Mid and LBA High IO port registers. They tell you the packet byte count that the ATAPI drive will send to you, or must receive from you. In a loop, you transmit that number of bytes, then wait for the next IRQ.
In DMA mode, only the first two phases happen. The device handles the details of phase 3 itself, with the PCI drive controller.
Questions:
Phase 1) How could I know what ATA IO port registers to use? Are they standized?
Phase 2) What is "a PIO data transfer"? How to do it?
Phase 3) How to wait for an IRQ? Do I have to implement and register some kind of interrupt handler? Does this mean I have to manipulate the IDT table in protected mode?
Could someone explain it a little? Some sample code in assembly language would be better...
I think this qualifies for a RTFM and a lack of effort. Its even linked from the mentioned page.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
You should know by now that we try to not give out sample code in forum posts as much as possible. As combuster pointed out, all the information you've asked about is on the very wiki page you mentioned. And the included C code on that page is very easily translated to asm.
For those reasons and more, I hereby declare this thread locked.