2 * Copyright (c) 2024 Jiri Svoboda
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 /** @addtogroup pci-ide
32 /** @file PCI IDE hardware protocol (registers, data structures).
34 * Based on Intel 82371AB PCI-TO-ISA / IDE XCELERATOR (PIIX4) document.
43 /** PCI Bus Master IDE I/O Registers */
45 /** Bus Master IDE Command (primary) */
48 /** Bus Master IDE Command (secondary) */
51 /** Bus Master IDE Descriptor Table Pointer (primary) */
53 /** Bus Master IDE Status (secondary) */
56 /** Bus Master IDE Status (secondary) */
59 /** Bus Master IDE Descriptor Table Pointer (secondary) */
63 enum pci_ide_bmicx_bits
{
64 /** Bus Master Read/Write Control */
66 /** Start/Stop Bus Master */
70 enum pci_ide_bmisx_bits
{
71 /** Drive 1 DMA Capable */
73 /** Drive 0 DMA Capable */
75 /** IDE Interrupte Status */
78 bmisx_idedmaerr
= 0x02,
79 /** Bus Master IDR Active */
83 #define PCI_IDE_CFG_IDETIM 0x40
84 #define PCI_IDE_CFG_SIDETIM 0x44
85 #define PCI_IDE_CFG_UDMACTL 0x48
86 #define PCI_IDE_CFG_UDMATIM 0x4a
89 * For PIIX we need to use ATA ports at fixed legacy ISA addresses.
90 * There are no corresponding PCI I/O ranges and these adresses are
91 * fixed and cannot be reconfigured.
94 pci_ide_ata_cmd_p
= 0x01f0,
95 pci_ide_ata_ctl_p
= 0x03f4,
96 pci_ide_ata_cmd_s
= 0x0170,
97 pci_ide_ata_ctl_s
= 0x0374
101 pci_ide_prd_eot
= 0x8000
104 /** PIIX physical region descriptor */
106 /** Physical base address */
110 /** EOT / reserved */