On Thu, 12 Nov 2015 11:56:23 -0500, Isaac D. Cohen <
8switch...@gmail.com> wrote:
> I'm trying to find out how to read from a drive using PCI Bus Mastering DMA.
Is this specification of interest to you?
"PCI-ATA-DMA" v1.0, Phoenix, May 24,1995
http://rbsfm.org/Downloads/APPNOTE/IDE/PCICAG.PDF
> I've come across some pages on the OS Dev wiki, this specification
>
http://www.bswd.com/idems100.pdf
> and the Brokenthorn tutorial on DMA
> (
http://www.brokenthorn.com/Resources/OSDev21.html).
> Now I a bit confused. The Brokenthorn tutorial is about ISA DMA,
> not PCI Bus Mastering DMA, so is any of it applicable?
>
> Also, that specification I referred to above, talks about the
> Physical Region Descriptor (PRD) table and two registers:
> A command register and a status register both of which, it
> says, are in port I/O space. But it does not say how to find
> out where in in port I/O space they are. Also, in that whole
> specification, the letters "LBA" are not mentioned once;
> which means the specification left out a very important detail:
> How to tell the controller which sectors to load from the disk.
LBA is described in the later ATA/ATAPI specifications, of
which there are 7 or 8 or more versions.
> One of the pages that I came across on the OS Dev wiki has
> example code showing how to load from a disk. Here is a
> link to the page:
http://wiki.osdev.org/ATA_read/write_sectors
>
> One of the things the example code does is send the drive number
> to port 0x1F6. What it does not say, is how to find out the number
> of the drive we are reading from.
This is the port I/O method for IDE drives (ATA devices). ATAPI is
for packet devices like CD-ROMs. The various early ATA and later
ATA/ATAPI combination specifications support PIO (port I/O),
DMAs (singleword), DMAm (multiword), and UDMA (ultra). 28-bit LBA
was introduced with ATA-2, 48-bit LBA with ATA/ATAPI-6, and SATA
drives with ATA/ATAPI-7.
(start info from old post of mine, slightly updated for you)
You'll want to obtain copies of the ATA/ATAPI standards. The last draft
prior to standardization is usually available. The standard version could
have some changes made after the draft version... The titles I have for the
final drafts which you can search for. They should be available as .pdf's.
I'd recommend at least version 3,5, and either 6 or 7. That would cover the
older, middle, and newest command sets without needing to locate all of
them.
"Information technology - AT Attachment Interface for Disk Drives"
"Information technology - AT Attachment Interface with Extensions (ATA-2)"
"Information technology - AT Attachment-3 Interface (ATA-3)"
"Information Technology - AT Attachment with Packet Interface Extension
(ATA/ATAPI-4)"
"Information Technology - AT Attachment with Packet Interface - 5
(ATA/ATAPI-5)"
"Information technology - AT Attachment Interface with Packet Interface - 6
(ATA/ATAPI 6)"
"Information technology - AT Attachment Interface with Packet Interface - 7"
"Information technology - AT Attachment 8 - ATA/ATAPI Command Set (ATA8-ACS)"
That's a partial title for ATAPI 7 since it has multiple volumes.
I posted an ATAPI 1,2,3,6,7 command summary. Unfortunately, I didn't have
the ATAPI 4,5,8 commands at the time. Link:
http://groups.google.com/group/alt.os.development/msg/d0da8699eb4d33bf?hl=en
Usenet MSG-ID <ea37kp$hs3$
1...@nntp.aioe.org>
I missed command E7h:
E7h FLUSH CACHE ----, ----, ----,
ATA6, ATA7
(end old post info)
I've looked at the other standards since. There are a few minor changes
inbetween for the other standards, e.g., new commands, end-of-life for
some commands. I've not posted the updated info. I haven't followed
the ATA/ATAPI specifications since version 7. I know there is at least
a version 8, and probably some more now.
Also, IIRC, the ATA and ATA/ATAPI specifications don't tell you which
ports to program for IDE drives. Hence, your question. So, ...
(from another old post of mine)
My understanding is that these are the historical IDE ports
and interrupts:
IDE 0x1f0 thru 0x1f7, 0x3f6, 0x3f7, IRQ 14
IDE 0x170 thru 0x177, 0x376, 0x377, IRQ 15 (or alt. IRQ 10)
IDE 0x1e8 thru 0x1ef, 0x3ee, 0x3ef, IRQ 11 (or alt. IRQ 12)
IDE 0x168 thru 0x16f, 0x36e, 0x36f, IRQ 10 (or alt. IRQ 9)
The alternate (alt.) IRQs conflict with standard IRQs, but
might've been used on some machines or add-on cards.
Some versions of Linux support these also:
IDE 0x1e0 thru 0x1e7, 0x3e6, 0x3e7, IRQ 8
IDE 0x160 thru 0x167, 0x366, 0x367, IRQ 12
(/end old post info)
Note that SATA drives are not programmable in this way, unless the
machine is emulating the boot drive as an IDE device.
HTH,
Rod Pemberton
--
When El Chapo is the most beloved man in Mexico and Trump is the most hated,
it shows that Mexico is truly fouled up.