1 1.11 matt /* $NetBSD: dwlpxreg.h,v 1.11 2012/02/06 02:14:14 matt Exp $ */ 2 1.1 cgd 3 1.1 cgd /* 4 1.2 cgd * Copyright (c) 1997 by Matthew Jacob 5 1.1 cgd * NASA AMES Research Center. 6 1.1 cgd * All rights reserved. 7 1.1 cgd * 8 1.1 cgd * Redistribution and use in source and binary forms, with or without 9 1.1 cgd * modification, are permitted provided that the following conditions 10 1.1 cgd * are met: 11 1.1 cgd * 1. Redistributions of source code must retain the above copyright 12 1.1 cgd * notice immediately at the beginning of the file, without modification, 13 1.1 cgd * this list of conditions, and the following disclaimer. 14 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright 15 1.1 cgd * notice, this list of conditions and the following disclaimer in the 16 1.1 cgd * documentation and/or other materials provided with the distribution. 17 1.1 cgd * 3. The name of the author may not be used to endorse or promote products 18 1.1 cgd * derived from this software without specific prior written permission. 19 1.1 cgd * 20 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 21 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 24 1.1 cgd * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 1.1 cgd * SUCH DAMAGE. 31 1.1 cgd */ 32 1.1 cgd 33 1.1 cgd /* 34 1.1 cgd * Taken from combinations of: 35 1.1 cgd * 36 1.1 cgd * ``DWLPA and DWLPB PCI Adapter Technical Manual, 37 1.1 cgd * Order Number: EK-DWLPX-TM.A01'' 38 1.1 cgd * 39 1.1 cgd * and 40 1.1 cgd * 41 1.1 cgd * ``AlphaServer 8200/8400 System Technical Manual, 42 1.1 cgd * Order Number EK-T8030-TM. A01'' 43 1.1 cgd */ 44 1.1 cgd 45 1.5 cgd #define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) 46 1.1 cgd 47 1.1 cgd /* 48 1.1 cgd * There are (potentially) 4 I/O hoses, and there are three 49 1.4 mjacob * (electrically distinct) PCI busses per DWLPX (which appear 50 1.4 mjacob * as one logical PCI bus). 51 1.1 cgd * 52 1.1 cgd * A CPU to PCI Address Mapping looks (roughly) like this: 53 1.1 cgd * 54 1.1 cgd * 39 38........36 35.34 33.....32 31....................5 4.........3 2...0 55 1.1 cgd * -------------------------------------------------------------------------- 56 1.1 cgd * |1| I/O NodeID |Hose#|PCI Space|Byte Aligned I/O <26:0>|Byte Length|0 0 0| 57 1.1 cgd * -------------------------------------------------------------------------- 58 1.1 cgd * 59 1.1 cgd * I/O Node is the TLSB Node ID minus 4. Don't ask. 60 1.1 cgd */ 61 1.1 cgd 62 1.1 cgd #define NHPC 3 63 1.1 cgd 64 1.1 cgd /* 65 1.1 cgd * Address Space Cookies 66 1.1 cgd * 67 1.1 cgd * (lacking I/O Node ID and Hose Numbers) 68 1.1 cgd */ 69 1.1 cgd 70 1.10 drochner #define DWLPX_PCI_DENSE 0x000000000UL 71 1.10 drochner #define DWLPX_PCI_SPARSE 0x100000000UL 72 1.10 drochner #define DWLPX_PCI_IOSPACE 0x200000000UL 73 1.10 drochner #define DWLPX_PCI_CONF 0x300000000UL 74 1.1 cgd 75 1.1 cgd /* 76 1.1 cgd * PCIA Interface Adapter Register Addresses (Offsets from Node Address) 77 1.1 cgd * 78 1.1 cgd * 79 1.1 cgd * Addresses are for Hose #0, PCI bus #0. Macros below will offset 80 1.1 cgd * per bus. I/O Hose and TLSB Node I/D offsets must be added separately. 81 1.1 cgd */ 82 1.1 cgd 83 1.10 drochner #define _PCIA_CTL 0x380000000UL /* PCI 0 Bus Control */ 84 1.10 drochner #define _PCIA_MRETRY 0x380000080UL /* PCI 0 Master Retry Limit */ 85 1.10 drochner #define _PCIA_GPR 0x380000100UL /* PCI 0 General Purpose */ 86 1.10 drochner #define _PCIA_ERR 0x380000180UL /* PCI 0 Error Summary */ 87 1.10 drochner #define _PCIA_FADR 0x380000200UL /* PCI 0 Failing Address */ 88 1.10 drochner #define _PCIA_IMASK 0x380000280UL /* PCI 0 Interrupt Mask */ 89 1.10 drochner #define _PCIA_DIAG 0x380000300UL /* PCI 0 Diagnostic */ 90 1.10 drochner #define _PCIA_IPEND 0x380000380UL /* PCI 0 Interrupt Pending */ 91 1.10 drochner #define _PCIA_IPROG 0x380000400UL /* PCI 0 Interrupt in Progress */ 92 1.10 drochner #define _PCIA_WMASK_A 0x380000480UL /* PCI 0 Window Mask A */ 93 1.10 drochner #define _PCIA_WBASE_A 0x380000500UL /* PCI 0 Window Base A */ 94 1.10 drochner #define _PCIA_TBASE_A 0x380000580UL /* PCI 0 Window Translated Base A */ 95 1.10 drochner #define _PCIA_WMASK_B 0x380000600UL /* PCI 0 Window Mask B */ 96 1.10 drochner #define _PCIA_WBASE_B 0x380000680UL /* PCI 0 Window Base B */ 97 1.10 drochner #define _PCIA_TBASE_B 0x380000700UL /* PCI 0 Window Translated Base B */ 98 1.10 drochner #define _PCIA_WMASK_C 0x380000780UL /* PCI 0 Window Mask C */ 99 1.10 drochner #define _PCIA_WBASE_C 0x380000800UL /* PCI 0 Window Base C */ 100 1.10 drochner #define _PCIA_TBASE_C 0x380000880UL /* PCI 0 Window Translated Base C */ 101 1.10 drochner #define _PCIA_ERRVEC 0x380000900UL /* PCI 0 Error Interrupt Vector */ 102 1.10 drochner #define _PCIA_DEVVEC 0x380001000UL /* PCI 0 Device Interrupt Vector */ 103 1.1 cgd 104 1.1 cgd 105 1.1 cgd #define PCIA_CTL(hpc) (_PCIA_CTL + (0x200000 * (hpc))) 106 1.1 cgd #define PCIA_MRETRY(hpc) (_PCIA_MRETRY + (0x200000 * (hpc))) 107 1.1 cgd #define PCIA_GPR(hpc) (_PCIA_GPR + (0x200000 * (hpc))) 108 1.1 cgd #define PCIA_ERR(hpc) (_PCIA_ERR + (0x200000 * (hpc))) 109 1.1 cgd #define PCIA_FADR(hpc) (_PCIA_FADR + (0x200000 * (hpc))) 110 1.1 cgd #define PCIA_IMASK(hpc) (_PCIA_IMASK + (0x200000 * (hpc))) 111 1.1 cgd #define PCIA_DIAG(hpc) (_PCIA_DIAG + (0x200000 * (hpc))) 112 1.1 cgd #define PCIA_IPEND(hpc) (_PCIA_IPEND + (0x200000 * (hpc))) 113 1.1 cgd #define PCIA_IPROG(hpc) (_PCIA_IPROG + (0x200000 * (hpc))) 114 1.1 cgd #define PCIA_WMASK_A(hpc) (_PCIA_WMASK_A + (0x200000 * (hpc))) 115 1.1 cgd #define PCIA_WBASE_A(hpc) (_PCIA_WBASE_A + (0x200000 * (hpc))) 116 1.1 cgd #define PCIA_TBASE_A(hpc) (_PCIA_TBASE_A + (0x200000 * (hpc))) 117 1.1 cgd #define PCIA_WMASK_B(hpc) (_PCIA_WMASK_B + (0x200000 * (hpc))) 118 1.1 cgd #define PCIA_WBASE_B(hpc) (_PCIA_WBASE_B + (0x200000 * (hpc))) 119 1.1 cgd #define PCIA_TBASE_B(hpc) (_PCIA_TBASE_B + (0x200000 * (hpc))) 120 1.1 cgd #define PCIA_WMASK_C(hpc) (_PCIA_WMASK_C + (0x200000 * (hpc))) 121 1.1 cgd #define PCIA_WBASE_C(hpc) (_PCIA_WBASE_C + (0x200000 * (hpc))) 122 1.1 cgd #define PCIA_TBASE_C(hpc) (_PCIA_TBASE_C + (0x200000 * (hpc))) 123 1.1 cgd #define PCIA_ERRVEC(hpc) (_PCIA_ERRVEC + (0x200000 * (hpc))) 124 1.1 cgd 125 1.1 cgd #define PCIA_DEVVEC(hpc, subslot, ipin) \ 126 1.1 cgd (_PCIA_DEVVEC + (0x200000 * (hpc)) + ((subslot) * 0x200) + ((ipin-1) * 0x80)) 127 1.1 cgd 128 1.10 drochner #define PCIA_SCYCLE 0x380002000UL /* PCI Special Cycle */ 129 1.10 drochner #define PCIA_IACK 0x380002080UL /* PCI Interrupt Acknowledge */ 130 1.1 cgd 131 1.10 drochner #define PCIA_PRESENT 0x380800000UL /* PCI Slot Present */ 132 1.10 drochner #define PCIA_TBIT 0x380A00000UL /* PCI TBIT */ 133 1.10 drochner #define PCIA_MCTL 0x380C00000UL /* PCI Module Control */ 134 1.10 drochner #define PCIA_IBR 0x380E00000UL /* PCI Information Base Repair */ 135 1.8 mjacob 136 1.8 mjacob /* 137 1.8 mjacob * Bits in PCIA_CTL register 138 1.8 mjacob */ 139 1.8 mjacob #define PCIA_CTL_SG32K (0<<25) /* 32K SGMAP entries */ 140 1.8 mjacob #define PCIA_CTL_SG64K (1<<25) /* 64K SGMAP entries */ 141 1.8 mjacob #define PCIA_CTL_SG128K (3<<25) /* 128K SGMAP entries */ 142 1.8 mjacob #define PCIA_CTL_SG0K (2<<25) /* disable SGMAP in HPC */ 143 1.8 mjacob #define PCIA_CTL_4UP (0<<23) /* 4 Up Hose buffers */ 144 1.8 mjacob #define PCIA_CTL_1UP (1<<23) /* 1 "" */ 145 1.8 mjacob #define PCIA_CTL_2UP (2<<23) /* 2 "" */ 146 1.8 mjacob #define PCIA_CTL_3UP (3<<23) /* 3 "" (normal) */ 147 1.8 mjacob #define PCIA_CTL_RMM4X (1<<22) /* Read Multiple 2X -> 4X */ 148 1.8 mjacob #define PCIA_CTL_RMMENA (1<<21) /* Read Multiple Enable */ 149 1.8 mjacob #define PCIA_CTL_RMMARB (1<<20) /* RMM Multiple Arb */ 150 1.8 mjacob #define PCIA_CTL_HAEDIS (1<<19) /* Hardware Address Ext. Disable */ 151 1.8 mjacob #define PCIA_CTL_MHAE(x) ((x&0x1f)<<14) /* Memory Hardware Address Extension */ 152 1.8 mjacob #define PCIA_CTL_IHAE(x) ((x&0x1f)<<9) /* I/O Hardware Address Extension */ 153 1.8 mjacob #define PCIA_CTL_CUTENA (1<<8) /* PCI Cut Through */ 154 1.8 mjacob #define PCIA_CTL_CUT(x) ((x&0x7)<<4) /* PCI Cut Through Size */ 155 1.8 mjacob #define PCIA_CTL_PRESET (1<<3) /* PCI Reset */ 156 1.8 mjacob #define PCIA_CTL_DTHROT (1<<2) /* DMA downthrottle */ 157 1.8 mjacob #define PCIA_CTL_T1CYC (1<<0) /* Type 1 Configuration Cycle */ 158 1.7 thorpej 159 1.7 thorpej /* 160 1.9 mjacob * Bits in PCIA_ERR. All are "Write 1 to clear". 161 1.9 mjacob */ 162 1.9 mjacob #define PCIA_ERR_SERR_L (1<<18) /* PCI device asserted SERR_L */ 163 1.9 mjacob #define PCIA_ERR_ILAT (1<<17) /* Incremental Latency Exceeded */ 164 1.9 mjacob #define PCIA_ERR_SGPRTY (1<<16) /* CPU access of SG RAM Parity Error */ 165 1.9 mjacob #define PCIA_ERR_ILLCSR (1<<15) /* Illegal CSR Address Error */ 166 1.9 mjacob #define PCIA_ERR_PCINXM (1<<14) /* Nonexistent PCI Address Error */ 167 1.9 mjacob #define PCIA_ERR_DSCERR (1<<13) /* PCI Target Disconnect Error */ 168 1.9 mjacob #define PCIA_ERR_ABRT (1<<12) /* PCI Target Abort Error */ 169 1.9 mjacob #define PCIA_ERR_WPRTY (1<<11) /* PCI Write Parity Error */ 170 1.9 mjacob #define PCIA_ERR_DPERR (1<<10) /* PCI Data Parity Error */ 171 1.9 mjacob #define PCIA_ERR_APERR (1<<9) /* PCI Address Parity Error */ 172 1.9 mjacob #define PCIA_ERR_DFLT (1<<8) /* SG Map RAM Invalid Entry Error */ 173 1.11 matt #define PCIA_ERR_DPRTY (1<<7) /* DMA access of SG RAM Parity Error */ 174 1.9 mjacob #define PCIA_ERR_DRPERR (1<<6) /* DMA Read Return Parity Error */ 175 1.9 mjacob #define PCIA_ERR_MABRT (1<<5) /* PCI Master Abort Error */ 176 1.9 mjacob #define PCIA_ERR_CPRTY (1<<4) /* CSR Parity Error */ 177 1.9 mjacob #define PCIA_ERR_COVR (1<<3) /* CSR Overrun Error */ 178 1.9 mjacob #define PCIA_ERR_MBPERR (1<<2) /* Mailbox Parity Error */ 179 1.9 mjacob #define PCIA_ERR_MBILI (1<<1) /* Mailbox Illegal Length Error */ 180 1.9 mjacob #define PCIA_ERR_ERROR (1<<0) /* Summary Error */ 181 1.9 mjacob #define PCIA_ERR_ALLERR ((1<<19) - 1) 182 1.9 mjacob 183 1.9 mjacob /* 184 1.7 thorpej * Bits in PCIA_PRESENT. 185 1.7 thorpej */ 186 1.7 thorpej #define PCIA_PRESENT_REVSHIFT 25 /* shift by this to get revision */ 187 1.7 thorpej #define PCIA_PRESENT_REVMASK 0xf 188 1.7 thorpej #define PCIA_PRESENT_STDIO 0x01000000 /* STD I/O bridge present */ 189 1.7 thorpej #define PCIA_PRESENT_SLOTSHIFT(hpc, slot) \ 190 1.7 thorpej (((hpc) << 3) + ((slot) << 1)) 191 1.7 thorpej #define PCIA_PRESENT_SLOT_MASK 0x3 192 1.7 thorpej #define PCIA_PRESENT_SLOT_NONE 0x0 193 1.7 thorpej #define PCIA_PRESENT_SLOT_25W 0x1 194 1.7 thorpej #define PCIA_PRESENT_SLOT_15W 0x2 195 1.7 thorpej #define PCIA_PRESENT_SLOW_7W 0x3 196 1.6 thorpej 197 1.6 thorpej /* 198 1.6 thorpej * Location of the DWLPx SGMAP page table SRAM. 199 1.6 thorpej */ 200 1.6 thorpej #define PCIA_SGMAP_PT 0x381000000UL 201 1.6 thorpej 202 1.6 thorpej /* 203 1.6 thorpej * Values for PCIA_WMASK_x 204 1.6 thorpej */ 205 1.6 thorpej #define PCIA_WMASK_MASK 0xffff0000 /* mask of valid bits */ 206 1.6 thorpej #define PCIA_WMASK_64K 0x00000000 207 1.6 thorpej #define PCIA_WMASK_128K 0x00010000 208 1.6 thorpej #define PCIA_WMASK_256K 0x00030000 209 1.6 thorpej #define PCIA_WMASK_512K 0x00070000 210 1.6 thorpej #define PCIA_WMASK_1M 0x000f0000 211 1.6 thorpej #define PCIA_WMASK_2M 0x001f0000 212 1.6 thorpej #define PCIA_WMASK_4M 0x003f0000 213 1.6 thorpej #define PCIA_WMASK_8M 0x007f0000 214 1.6 thorpej #define PCIA_WMASK_16M 0x00ff0000 215 1.6 thorpej #define PCIA_WMASK_32M 0x01ff0000 216 1.6 thorpej #define PCIA_WMASK_64M 0x03ff0000 217 1.6 thorpej #define PCIA_WMASK_128M 0x07ff0000 218 1.6 thorpej #define PCIA_WMASK_256M 0x0fff0000 219 1.6 thorpej #define PCIA_WMASK_512M 0x1fff0000 220 1.6 thorpej #define PCIA_WMASK_1G 0x3fff0000 221 1.6 thorpej #define PCIA_WMASK_2G 0x7fff0000 222 1.6 thorpej #define PCIA_WMASK_4G 0xffff0000 223 1.6 thorpej 224 1.6 thorpej /* 225 1.6 thorpej * Values for PCIA_WBASE_x 226 1.6 thorpej */ 227 1.6 thorpej #define PCIA_WBASE_MASK 0xffff0000 /* mask of valid bits in address */ 228 1.6 thorpej #define PCIA_WBASE_W_EN 0x00000002 /* window enable */ 229 1.6 thorpej #define PCIA_WBASE_SG_EN 0x00000001 /* SGMAP enable */ 230 1.6 thorpej 231 1.6 thorpej /* 232 1.6 thorpej * Values for PCIA_TBASE_x 233 1.6 thorpej * 234 1.9 mjacob * NOTE: Translated Base is only used on direct-mapped DMA on the DWLPx!! 235 1.6 thorpej */ 236 1.6 thorpej #define PCIA_TBASE_MASK 0x00fffffe 237 1.6 thorpej #define PCIA_TBASE_SHIFT 15 238