1/* 2 * Copyright 2010 Ben Herrenschmidt, IBM Corporation 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 */ 9 10#ifndef __WSP_PCI_H 11#define __WSP_PCI_H 12 13/* Architected registers */ 14#define PCIE_REG_DMA_CHAN_STATUS 0x110 15#define PCIE_REG_CPU_LOADSTORE_STATUS 0x120 16 17#define PCIE_REG_CONFIG_DATA 0x130 18#define PCIE_REG_LOCK0 0x138 19#define PCIE_REG_CONFIG_ADDRESS 0x140 20#define PCIE_REG_CA_ENABLE 0x8000000000000000ull 21#define PCIE_REG_CA_BUS_MASK 0x0ff0000000000000ull 22#define PCIE_REG_CA_BUS_SHIFT (20+32) 23#define PCIE_REG_CA_DEV_MASK 0x000f800000000000ull 24#define PCIE_REG_CA_DEV_SHIFT (15+32) 25#define PCIE_REG_CA_FUNC_MASK 0x0000700000000000ull 26#define PCIE_REG_CA_FUNC_SHIFT (12+32) 27#define PCIE_REG_CA_REG_MASK 0x00000fff00000000ull 28#define PCIE_REG_CA_REG_SHIFT ( 0+32) 29#define PCIE_REG_CA_BE_MASK 0x00000000f0000000ull 30#define PCIE_REG_CA_BE_SHIFT ( 28) 31#define PCIE_REG_LOCK1 0x148 32 33#define PCIE_REG_PHB_CONFIG 0x160 34#define PCIE_REG_PHBC_64B_TCE_EN 0x2000000000000000ull 35#define PCIE_REG_PHBC_MMIO_DMA_FREEZE_EN 0x1000000000000000ull 36#define PCIE_REG_PHBC_32BIT_MSI_EN 0x0080000000000000ull 37#define PCIE_REG_PHBC_M64_EN 0x0040000000000000ull 38#define PCIE_REG_PHBC_IO_EN 0x0008000000000000ull 39#define PCIE_REG_PHBC_64BIT_MSI_EN 0x0002000000000000ull 40#define PCIE_REG_PHBC_M32A_EN 0x0000800000000000ull 41#define PCIE_REG_PHBC_M32B_EN 0x0000400000000000ull 42#define PCIE_REG_PHBC_MSI_PE_VALIDATE 0x0000200000000000ull 43#define PCIE_REG_PHBC_DMA_XLATE_BYPASS 0x0000100000000000ull 44 45#define PCIE_REG_IO_BASE_ADDR 0x170 46#define PCIE_REG_IO_BASE_MASK 0x178 47#define PCIE_REG_IO_START_ADDR 0x180 48 49#define PCIE_REG_M32A_BASE_ADDR 0x190 50#define PCIE_REG_M32A_BASE_MASK 0x198 51#define PCIE_REG_M32A_START_ADDR 0x1a0 52 53#define PCIE_REG_M32B_BASE_ADDR 0x1b0 54#define PCIE_REG_M32B_BASE_MASK 0x1b8 55#define PCIE_REG_M32B_START_ADDR 0x1c0 56 57#define PCIE_REG_M64_BASE_ADDR 0x1e0 58#define PCIE_REG_M64_BASE_MASK 0x1e8 59#define PCIE_REG_M64_START_ADDR 0x1f0 60 61#define PCIE_REG_TCE_KILL 0x210 62#define PCIE_REG_TCEKILL_SINGLE 0x8000000000000000ull 63#define PCIE_REG_TCEKILL_ADDR_MASK 0x000003fffffffff8ull 64#define PCIE_REG_TCEKILL_PS_4K 0 65#define PCIE_REG_TCEKILL_PS_64K 1 66#define PCIE_REG_TCEKILL_PS_16M 2 67#define PCIE_REG_TCEKILL_PS_16G 3 68 69#define PCIE_REG_IODA_ADDR 0x220 70#define PCIE_REG_IODA_AD_AUTOINC 0x8000000000000000ull 71#define PCIE_REG_IODA_AD_TBL_MVT 0x0005000000000000ull 72#define PCIE_REG_IODA_AD_TBL_PELT 0x0006000000000000ull 73#define PCIE_REG_IODA_AD_TBL_PESTA 0x0007000000000000ull 74#define PCIE_REG_IODA_AD_TBL_PESTB 0x0008000000000000ull 75#define PCIE_REG_IODA_AD_TBL_TVT 0x0009000000000000ull 76#define PCIE_REG_IODA_AD_TBL_TCE 0x000a000000000000ull 77#define PCIE_REG_IODA_DATA0 0x228 78#define PCIE_REG_IODA_DATA1 0x230 79 80#define PCIE_REG_LOCK2 0x240 81 82#define PCIE_REG_PHB_GEN_CAP 0x250 83#define PCIE_REG_PHB_TCE_CAP 0x258 84#define PCIE_REG_PHB_IRQ_CAP 0x260 85#define PCIE_REG_PHB_EEH_CAP 0x268 86 87#define PCIE_REG_PAPR_ERR_INJ_CONTROL 0x2b0 88#define PCIE_REG_PAPR_ERR_INJ_ADDR 0x2b8 89#define PCIE_REG_PAPR_ERR_INJ_MASK 0x2c0 90 91 92#define PCIE_REG_SYS_CFG1 0x600 93#define PCIE_REG_SYS_CFG1_CLASS_CODE 0x0000000000ffffffull 94 95#define IODA_TVT0_TTA_MASK 0x000fffffffff0000ull 96#define IODA_TVT0_TTA_SHIFT 4 97#define IODA_TVT0_BUSNUM_VALID_MASK 0x000000000000e000ull 98#define IODA_TVT0_TCE_TABLE_SIZE_MASK 0x0000000000001f00ull 99#define IODA_TVT0_TCE_TABLE_SIZE_SHIFT 8 100#define IODA_TVT0_BUSNUM_VALUE_MASK 0x00000000000000ffull 101#define IODA_TVT0_BUSNUM_VALID_SHIFT 0 102#define IODA_TVT1_DEVNUM_VALID 0x2000000000000000ull 103#define IODA_TVT1_DEVNUM_VALUE_MASK 0x1f00000000000000ull 104#define IODA_TVT1_DEVNUM_VALUE_SHIFT 56 105#define IODA_TVT1_FUNCNUM_VALID 0x0008000000000000ull 106#define IODA_TVT1_FUNCNUM_VALUE_MASK 0x0007000000000000ull 107#define IODA_TVT1_FUNCNUM_VALUE_SHIFT 48 108#define IODA_TVT1_IO_PAGE_SIZE_MASK 0x00001f0000000000ull 109#define IODA_TVT1_IO_PAGE_SIZE_SHIFT 40 110#define IODA_TVT1_PE_NUMBER_MASK 0x000000000000003full 111#define IODA_TVT1_PE_NUMBER_SHIFT 0 112 113#define IODA_TVT_COUNT 64 114 115/* UTL Core registers */ 116#define PCIE_UTL_SYS_BUS_CONTROL 0x400 117#define PCIE_UTL_STATUS 0x408 118#define PCIE_UTL_SYS_BUS_AGENT_STATUS 0x410 119#define PCIE_UTL_SYS_BUS_AGENT_ERR_SEV 0x418 120#define PCIE_UTL_SYS_BUS_AGENT_IRQ_EN 0x420 121#define PCIE_UTL_SYS_BUS_BURST_SZ_CONF 0x440 122#define PCIE_UTL_REVISION_ID 0x448 123 124#define PCIE_UTL_OUT_POST_HDR_BUF_ALLOC 0x4c0 125#define PCIE_UTL_OUT_POST_DAT_BUF_ALLOC 0x4d0 126#define PCIE_UTL_IN_POST_HDR_BUF_ALLOC 0x4e0 127#define PCIE_UTL_IN_POST_DAT_BUF_ALLOC 0x4f0 128#define PCIE_UTL_OUT_NP_BUF_ALLOC 0x500 129#define PCIE_UTL_IN_NP_BUF_ALLOC 0x510 130#define PCIE_UTL_PCIE_TAGS_ALLOC 0x520 131#define PCIE_UTL_GBIF_READ_TAGS_ALLOC 0x530 132 133#define PCIE_UTL_PCIE_PORT_CONTROL 0x540 134#define PCIE_UTL_PCIE_PORT_STATUS 0x548 135#define PCIE_UTL_PCIE_PORT_ERROR_SEV 0x550 136#define PCIE_UTL_PCIE_PORT_IRQ_EN 0x558 137#define PCIE_UTL_RC_STATUS 0x560 138#define PCIE_UTL_RC_ERR_SEVERITY 0x568 139#define PCIE_UTL_RC_IRQ_EN 0x570 140#define PCIE_UTL_EP_STATUS 0x578 141#define PCIE_UTL_EP_ERR_SEVERITY 0x580 142#define PCIE_UTL_EP_ERR_IRQ_EN 0x588 143 144#define PCIE_UTL_PCI_PM_CTRL1 0x590 145#define PCIE_UTL_PCI_PM_CTRL2 0x598 146 147/* PCIe stack registers */ 148#define PCIE_REG_SYSTEM_CONFIG1 0x600 149#define PCIE_REG_SYSTEM_CONFIG2 0x608 150#define PCIE_REG_EP_SYSTEM_CONFIG 0x618 151#define PCIE_REG_EP_FLR 0x620 152#define PCIE_REG_EP_BAR_CONFIG 0x628 153#define PCIE_REG_LINK_CONFIG 0x630 154#define PCIE_REG_PM_CONFIG 0x640 155#define PCIE_REG_DLP_CONTROL 0x650 156#define PCIE_REG_DLP_STATUS 0x658 157#define PCIE_REG_ERR_REPORT_CONTROL 0x660 158#define PCIE_REG_SLOT_CONTROL1 0x670 159#define PCIE_REG_SLOT_CONTROL2 0x678 160#define PCIE_REG_UTL_CONFIG 0x680 161#define PCIE_REG_BUFFERS_CONFIG 0x690 162#define PCIE_REG_ERROR_INJECT 0x698 163#define PCIE_REG_SRIOV_CONFIG 0x6a0 164#define PCIE_REG_PF0_SRIOV_STATUS 0x6a8 165#define PCIE_REG_PF1_SRIOV_STATUS 0x6b0 166#define PCIE_REG_PORT_NUMBER 0x700 167#define PCIE_REG_POR_SYSTEM_CONFIG 0x708 168 169/* PHB internal logic registers */ 170#define PCIE_REG_PHB_VERSION 0x800 171#define PCIE_REG_RESET 0x808 172#define PCIE_REG_PHB_CONTROL 0x810 173#define PCIE_REG_PHB_TIMEOUT_CONTROL1 0x878 174#define PCIE_REG_PHB_QUIESCE_DMA 0x888 175#define PCIE_REG_PHB_DMA_READ_TAG_ACTV 0x900 176#define PCIE_REG_PHB_TCE_READ_TAG_ACTV 0x908 177 178/* FIR registers */ 179#define PCIE_REG_LEM_FIR_ACCUM 0xc00 180#define PCIE_REG_LEM_FIR_AND_MASK 0xc08 181#define PCIE_REG_LEM_FIR_OR_MASK 0xc10 182#define PCIE_REG_LEM_ACTION0 0xc18 183#define PCIE_REG_LEM_ACTION1 0xc20 184#define PCIE_REG_LEM_ERROR_MASK 0xc30 185#define PCIE_REG_LEM_ERROR_AND_MASK 0xc38 186#define PCIE_REG_LEM_ERROR_OR_MASK 0xc40 187 188/* PHB Error registers */ 189#define PCIE_REG_PHB_ERR_STATUS 0xc80 190#define PCIE_REG_PHB_ERR1_STATUS 0xc88 191#define PCIE_REG_PHB_ERR_INJECT 0xc90 192#define PCIE_REG_PHB_ERR_LEM_ENABLE 0xc98 193#define PCIE_REG_PHB_ERR_IRQ_ENABLE 0xca0 194#define PCIE_REG_PHB_ERR_FREEZE_ENABLE 0xca8 195#define PCIE_REG_PHB_ERR_SIDE_ENABLE 0xcb8 196#define PCIE_REG_PHB_ERR_LOG_0 0xcc0 197#define PCIE_REG_PHB_ERR_LOG_1 0xcc8 198#define PCIE_REG_PHB_ERR_STATUS_MASK 0xcd0 199#define PCIE_REG_PHB_ERR1_STATUS_MASK 0xcd8 200 201#define PCIE_REG_MMIO_ERR_STATUS 0xd00 202#define PCIE_REG_MMIO_ERR1_STATUS 0xd08 203#define PCIE_REG_MMIO_ERR_INJECT 0xd10 204#define PCIE_REG_MMIO_ERR_LEM_ENABLE 0xd18 205#define PCIE_REG_MMIO_ERR_IRQ_ENABLE 0xd20 206#define PCIE_REG_MMIO_ERR_FREEZE_ENABLE 0xd28 207#define PCIE_REG_MMIO_ERR_SIDE_ENABLE 0xd38 208#define PCIE_REG_MMIO_ERR_LOG_0 0xd40 209#define PCIE_REG_MMIO_ERR_LOG_1 0xd48 210#define PCIE_REG_MMIO_ERR_STATUS_MASK 0xd50 211#define PCIE_REG_MMIO_ERR1_STATUS_MASK 0xd58 212 213#define PCIE_REG_DMA_ERR_STATUS 0xd80 214#define PCIE_REG_DMA_ERR1_STATUS 0xd88 215#define PCIE_REG_DMA_ERR_INJECT 0xd90 216#define PCIE_REG_DMA_ERR_LEM_ENABLE 0xd98 217#define PCIE_REG_DMA_ERR_IRQ_ENABLE 0xda0 218#define PCIE_REG_DMA_ERR_FREEZE_ENABLE 0xda8 219#define PCIE_REG_DMA_ERR_SIDE_ENABLE 0xdb8 220#define PCIE_REG_DMA_ERR_LOG_0 0xdc0 221#define PCIE_REG_DMA_ERR_LOG_1 0xdc8 222#define PCIE_REG_DMA_ERR_STATUS_MASK 0xdd0 223#define PCIE_REG_DMA_ERR1_STATUS_MASK 0xdd8 224 225/* Shortcuts for access to the above using the PHB definitions 226 * with an offset 227 */ 228#define PCIE_REG_ERR_PHB_OFFSET 0x0 229#define PCIE_REG_ERR_MMIO_OFFSET 0x80 230#define PCIE_REG_ERR_DMA_OFFSET 0x100 231 232/* Debug and Trace registers */ 233#define PCIE_REG_PHB_DEBUG_CONTROL0 0xe00 234#define PCIE_REG_PHB_DEBUG_STATUS0 0xe08 235#define PCIE_REG_PHB_DEBUG_CONTROL1 0xe10 236#define PCIE_REG_PHB_DEBUG_STATUS1 0xe18 237#define PCIE_REG_PHB_DEBUG_CONTROL2 0xe20 238#define PCIE_REG_PHB_DEBUG_STATUS2 0xe28 239#define PCIE_REG_PHB_DEBUG_CONTROL3 0xe30 240#define PCIE_REG_PHB_DEBUG_STATUS3 0xe38 241#define PCIE_REG_PHB_DEBUG_CONTROL4 0xe40 242#define PCIE_REG_PHB_DEBUG_STATUS4 0xe48 243#define PCIE_REG_PHB_DEBUG_CONTROL5 0xe50 244#define PCIE_REG_PHB_DEBUG_STATUS5 0xe58 245#define PCIE_REG_PHB_DEBUG_CONTROL6 0xe60 246#define PCIE_REG_PHB_DEBUG_STATUS6 0xe68 247 248/* Definition for PCIe errors */ 249struct wsp_pcie_err_log_data { 250 __u64 phb_err; 251 __u64 phb_err1; 252 __u64 phb_log0; 253 __u64 phb_log1; 254 __u64 mmio_err; 255 __u64 mmio_err1; 256 __u64 mmio_log0; 257 __u64 mmio_log1; 258 __u64 dma_err; 259 __u64 dma_err1; 260 __u64 dma_log0; 261 __u64 dma_log1; 262 __u64 utl_sys_err; 263 __u64 utl_port_err; 264 __u64 utl_rc_err; 265 __u64 unused; 266}; 267 268#endif /* __WSP_PCI_H */ 269