ATA PIO Mode: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
[unchecked revision][unchecked revision]
(Added code tags.)
mNo edit summary
Line 18:
==Primary/Secondary Bus==
 
Current disk controller chips almost always support two ATA bussesbuses per chip. There is a standardized set of IO ports to control the disks on the bussesbuses. The first two bussesbuses are called the Primary and Secondary ATA bus, and are almost always controlled by IO ports 0x1F0 through 0x1F7, and 0x170 through 0x177, respectively (unless you change it). The associated Device Control Registers/Alternate Status ports are IO ports 0x3F6, and 0x376, respectively. The standard IRQ for the Primary bus is IRQ14, and IRQ15 for the Secondary bus.
 
If the next two bussesbuses exist, they are normally controlled by IO ports 0x1E8 through 0x1EF, and 0x168 through 0x16F, respectively. The associated Device Control Registers/Alternate Status ports are IO ports 0x3E6, and 0x366.
 
The actual control registers and IRQs for each bus can often be determined by enumerating the PCI bus, finding all the disk controllers, and reading the information from each controller's PCI Configuration Space. So, technically, PCI enumeration should be done before ATA device detection. However, this method is not exactly reliable.
Line 56:
===Floating Bus===
 
The disk that was selected last (by the BIOS, during boot) is supposed to maintain control of the electrical values on each IDE bus. If there is no disk connected to the bus at all, then the electrical values on the bus will all go "high" (to +5 volts). A computer will read this as an 0xFF byte -- this is a condition called a "floating" bus. This is an excellent way to find out if there are no drives on a bus. <b>Before sending any data to the IO ports,</b> read the Regular Status byte. The value 0xFF is an illegal status value, and indicates that the bus has no drives. The reason to read the port before writing anything is that the act of writing can easily cause the voltages of the wires to go screweyscrewy for a millisecond (since there may be nothing attached to the wires to control the voltages!), and mess up any attempt to measure "float".
 
===Detecting Controller IO Ports===
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu