Logical view of IDE, ATA, and Bus Master DMA
Posted: Mon Jan 06, 2014 12:12 am
Since this is my first post, I'll give a quick run down of where I'm at in my project. I am in the process of writing a 32-bit, protected mode, kernel for the x86 architecture. The kernel is monolithic and so far I have implemented exception handling, IRQ handling, PIT, physical memory frame allocator, virtual memory (still in the works, lower-half kernel), kernel heap manager, basic console driver, PCI bus scanning, and basic ATA support (IDENTIFY DEVICE, SET FEATURES). I have written the ATA part of DMA but not the Bus Master part or interrupt handling (or really any of the hard stuff ) yet.
So I'm having trouble understanding how a few of the pieces fit together. I will try to describe things as I see them and see if it makes sense.
An ATA drive is a physical disk like a hard drive or CD-ROM. ATA drives are (always?) paired in a master-slave configuration. They both share the same IRQ and I/O ports. Each ATA drive has its own on-board controller. When we send commands to one of the drives, we select a drive using the DEVICE register as detailed in the ATA spec. My guess here is that the commands get sent to both drives but will be ignored by the not-selected drive. Can I refer these two ATA drives as being connected by an ATA bus?
So ATA buses also seem to come in pairs, and are referred to as primary and secondary. The primary and secondary buses do not (never?) share IRQs or I/O ports. Now when I do I a PCI scan, these two buses show up together as a single IDE Controller device (00:01.01 Intel 82371SB IDE Controller). This confuses my because I though IDE was just another name for "ATA-1"? What actually is this IDE controller? What does it do?
Last is Bus Master DMA. Who is actually doing the Bus Master DMA? Is it this IDE Controller? I know that I am reading the bus master base address out of BAR4 of my IDE PCI device configuration space (so it seems to be tied to the IDE controller), but is it unique to the IDE Controller? Is Bus Master DMA a property of IDE or PCI or what (it doesn't seem to be a part of ATA because the ATA spec only provides a way to get a drive ready for a DMA transfer, but not actually do it)? My guess is IDE because there are primary and secondary bus master I/O registers which matches setup of the ATA buses.
I guess most of my confusion comes from the uses of the terms "IDE Controller", "ATA", "ATA Controller", etc. (Intel's http://www.srcf.ucam.org/piipkernel/git ... r_spec.pdf says that "ATA Controller" means "Bus Master IDE Controller" ... what?).
Thanks for your help .
So I'm having trouble understanding how a few of the pieces fit together. I will try to describe things as I see them and see if it makes sense.
An ATA drive is a physical disk like a hard drive or CD-ROM. ATA drives are (always?) paired in a master-slave configuration. They both share the same IRQ and I/O ports. Each ATA drive has its own on-board controller. When we send commands to one of the drives, we select a drive using the DEVICE register as detailed in the ATA spec. My guess here is that the commands get sent to both drives but will be ignored by the not-selected drive. Can I refer these two ATA drives as being connected by an ATA bus?
So ATA buses also seem to come in pairs, and are referred to as primary and secondary. The primary and secondary buses do not (never?) share IRQs or I/O ports. Now when I do I a PCI scan, these two buses show up together as a single IDE Controller device (00:01.01 Intel 82371SB IDE Controller). This confuses my because I though IDE was just another name for "ATA-1"? What actually is this IDE controller? What does it do?
Last is Bus Master DMA. Who is actually doing the Bus Master DMA? Is it this IDE Controller? I know that I am reading the bus master base address out of BAR4 of my IDE PCI device configuration space (so it seems to be tied to the IDE controller), but is it unique to the IDE Controller? Is Bus Master DMA a property of IDE or PCI or what (it doesn't seem to be a part of ATA because the ATA spec only provides a way to get a drive ready for a DMA transfer, but not actually do it)? My guess is IDE because there are primary and secondary bus master I/O registers which matches setup of the ATA buses.
I guess most of my confusion comes from the uses of the terms "IDE Controller", "ATA", "ATA Controller", etc. (Intel's http://www.srcf.ucam.org/piipkernel/git ... r_spec.pdf says that "ATA Controller" means "Bus Master IDE Controller" ... what?).
Thanks for your help .