1*27Sjchu /* 2*27Sjchu * CDDL HEADER START 3*27Sjchu * 4*27Sjchu * The contents of this file are subject to the terms of the 5*27Sjchu * Common Development and Distribution License, Version 1.0 only 6*27Sjchu * (the "License"). You may not use this file except in compliance 7*27Sjchu * with the License. 8*27Sjchu * 9*27Sjchu * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*27Sjchu * or http://www.opensolaris.org/os/licensing. 11*27Sjchu * See the License for the specific language governing permissions 12*27Sjchu * and limitations under the License. 13*27Sjchu * 14*27Sjchu * When distributing Covered Code, include this CDDL HEADER in each 15*27Sjchu * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*27Sjchu * If applicable, add the following below this CDDL HEADER, with the 17*27Sjchu * fields enclosed by brackets "[]" replaced with your own identifying 18*27Sjchu * information: Portions Copyright [yyyy] [name of copyright owner] 19*27Sjchu * 20*27Sjchu * CDDL HEADER END 21*27Sjchu */ 22*27Sjchu /* 23*27Sjchu * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*27Sjchu * Use is subject to license terms. 25*27Sjchu */ 26*27Sjchu 27*27Sjchu #ifndef _SYS_PCIE_H 28*27Sjchu #define _SYS_PCIE_H 29*27Sjchu 30*27Sjchu #pragma ident "%Z%%M% %I% %E% SMI" 31*27Sjchu 32*27Sjchu #ifdef __cplusplus 33*27Sjchu extern "C" { 34*27Sjchu #endif 35*27Sjchu 36*27Sjchu #include <sys/pci.h> 37*27Sjchu 38*27Sjchu /* 39*27Sjchu * PCI-Express Capability Registers Offsets 40*27Sjchu */ 41*27Sjchu #define PCIE_CAP_ID PCI_CAP_ID 42*27Sjchu #define PCIE_CAP_NEXT_PTR PCI_CAP_NEXT_PTR 43*27Sjchu #define PCIE_PCIECAP 0x02 /* PCI-e Capability Reg */ 44*27Sjchu #define PCIE_DEVCAP 0x04 /* Device Capability */ 45*27Sjchu #define PCIE_DEVCTL 0x08 /* Device Control */ 46*27Sjchu #define PCIE_DEVSTS 0x0A /* Device Status */ 47*27Sjchu #define PCIE_LINKCAP 0x04 /* Link Capability */ 48*27Sjchu #define PCIE_LINKCTL 0x0C /* Link Control */ 49*27Sjchu #define PCIE_LINKSTS 0x10 /* Link Status */ 50*27Sjchu #define PCIE_SLOTCAP 0x14 /* Slot Capability */ 51*27Sjchu #define PCIE_SLOTCTL 0x18 /* Slot Control */ 52*27Sjchu #define PCIE_SLOTSTS 0x1A /* Slot Status */ 53*27Sjchu #define PCIE_ROOTCTL 0x1C /* Root Control */ 54*27Sjchu #define PCIE_ROOTSTS 0x20 /* Root Status */ 55*27Sjchu 56*27Sjchu /* 57*27Sjchu * PCI-Express Capabilities Register 58*27Sjchu */ 59*27Sjchu #define PCIE_PCIECAP_VER_1_0 0x1 /* PCI-E spec 1.0 */ 60*27Sjchu #define PCIE_PCIECAP_VER_MASK 0xF /* Version Mask */ 61*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCIE_DEV 0x00 /* PCI-E Endpont Device */ 62*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCI_DEV 0x10 /* Leg PCI Endpont Device */ 63*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_ROOT 0x40 /* Root Port of Root Complex */ 64*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_UP 0x50 /* Upstream Port of Switch */ 65*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_DOWN 0x60 /* Downstream Port of Switch */ 66*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCIE2PCI 0x70 /* PCI-E to PCI Bridge */ 67*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCI2PCIE 0x80 /* PCI to PCI-E Bridge */ 68*27Sjchu #define PCIE_PCIECAP_DEV_TYPE_MASK 0xF0 /* Device/Port Type Mask */ 69*27Sjchu #define PCIE_PCIECAP_SLOT_IMPL 0x100 /* Slot Impl vs Integrated */ 70*27Sjchu #define PCIE_PCIECAP_INT_MSG_NUM 0x3700 /* Interrupt Message Number */ 71*27Sjchu 72*27Sjchu /* 73*27Sjchu * Device Capabilities Register 74*27Sjchu */ 75*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_128 0x0 76*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_256 0x1 77*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_512 0x2 78*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_1024 0x3 79*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_2048 0x4 80*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_4096 0x5 81*27Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_MASK 0x7 /* Max Payload Size Supported */ 82*27Sjchu 83*27Sjchu #define PCIE_DEVCAP_PHTM_FUNC_NONE 0x00 /* No Function # bits used */ 84*27Sjchu #define PCIE_DEVCAP_PHTM_FUNC_ONE 0x08 /* First most sig. bit used */ 85*27Sjchu #define PCIE_DEVCAP_PHTM_FUNC_TWO 0x10 /* First 2 most sig bit used */ 86*27Sjchu #define PCIE_DEVCAP_PHTM_FUNC_THREE 0x18 /* All 3 bits used */ 87*27Sjchu #define PCIE_DEVCAP_PHTM_FUNC_MASK 0x18 /* Phantom Func Supported */ 88*27Sjchu 89*27Sjchu #define PCIE_DEVCAP_EXT_TAG_5BIT 0x00 /* 5-Bit Tag Field Supported */ 90*27Sjchu #define PCIE_DEVCAP_EXT_TAG_8BIT 0x20 /* 8-Bit Tag Field Supported */ 91*27Sjchu #define PCIE_DEVCAP_EXT_TAG_MASK 0x20 /* Ext. Tag Field Supported */ 92*27Sjchu 93*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_MIN 0x000 /* < 64 ns */ 94*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_64ns 0x040 /* 64 ns - 128 ns */ 95*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_128ns 0x080 /* 128 ns - 256 ns */ 96*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_256ns 0x0C0 /* 256 ns - 512 ns */ 97*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_512ns 0x100 /* 512 ns - 1 us */ 98*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_1us 0x140 /* 1 us - 2 us */ 99*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_2us 0x180 /* 2 us - 4 us */ 100*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_MAX 0x1C0 /* > 4 us */ 101*27Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_MASK 0x1C0 /* EP L0s Accetable Latency */ 102*27Sjchu 103*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_MIN 0x000 /* < 1 us */ 104*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_1us 0x140 /* 1 us - 2 us */ 105*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_2us 0x180 /* 2 us - 4 us */ 106*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_4us 0x140 /* 4 us - 8 us */ 107*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_8us 0x180 /* 8 us - 16 us */ 108*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_16us 0x140 /* 16 us - 32 us */ 109*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_32us 0x180 /* 32 us - 64 us */ 110*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_MAX 0x1C0 /* > 64 us */ 111*27Sjchu #define PCIE_DEVCAP_EP_L1_LAT_MASK 0x700 /* EP L1 Accetable Latency */ 112*27Sjchu 113*27Sjchu #define PCIE_DEVCAP_ATTN_BUTTON 0x1000 /* Attention Button Present */ 114*27Sjchu #define PCIE_DEVCAP_ATTN_INDICATOR 0x2000 /* Attn Indicator Present */ 115*27Sjchu #define PCIE_DEVCAP_PWR_INDICATOR 0x4000 /* Power Indicator Present */ 116*27Sjchu 117*27Sjchu #define PCIE_DEVCAP_PLMT_VAL_SHIFT 18 /* Power Limit Value Shift */ 118*27Sjchu #define PCIE_DEVCAP_PLMT_VAL_MASK 0xFF /* Power Limit Value Mask */ 119*27Sjchu 120*27Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_1 0x0000000 /* 1x Scale */ 121*27Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_10 0x4000000 /* 0.1x Scale */ 122*27Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_100 0x8000000 /* 0.01x Scale */ 123*27Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_1000 0xC000000 /* 0.001x Scale */ 124*27Sjchu #define PCIE_DEVCAP_PLMT_SCL_MASK 0xC000000 /* Power Limit Scale */ 125*27Sjchu 126*27Sjchu /* 127*27Sjchu * Device Control Register 128*27Sjchu */ 129*27Sjchu #define PCIE_DEVCTL_CE_REPORTING_EN 0x1 /* Correctable Error Enable */ 130*27Sjchu #define PCIE_DEVCTL_NFE_REPORTING_EN 0x2 /* Non-Fatal Error Enable */ 131*27Sjchu #define PCIE_DEVCTL_FE_REPORTING_EN 0x4 /* Fatal Error Enable */ 132*27Sjchu #define PCIE_DEVCTL_UR_REPORTING_EN 0x8 /* Unsupported Request Enable */ 133*27Sjchu #define PCIE_DEVCTL_RO_EN 0x10 /* Enable Relaxed Ordering */ 134*27Sjchu 135*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_128 0x00 136*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_256 0x20 137*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_512 0x40 138*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_1024 0x60 139*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_2048 0x80 140*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_4096 0xA0 141*27Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_MASK 0xE0 /* Max_Payload_Size */ 142*27Sjchu 143*27Sjchu #define PCIE_DEVCTL_EXT_TAG_FIELD_EN 0x100 /* Extended Tag Field Enable */ 144*27Sjchu #define PCIE_DEVCTL_PHTM_FUNC_EN 0x200 /* Phantom Functions Enable */ 145*27Sjchu #define PCIE_DEVCTL_AUX_POWER_PM_EN 0x400 /* Auxiliary Power PM Enable */ 146*27Sjchu #define PCIE_DEVCTL_ENABLE_NO_SNOOP 0x800 /* Enable No Snoop */ 147*27Sjchu 148*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_128 0x00 149*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_256 0x10 150*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_512 0x20 151*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_1024 0x30 152*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_2048 0x40 153*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_4096 0x50 154*27Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_MASK 0x7000 /* Max_Read_Request_Size */ 155*27Sjchu 156*27Sjchu /* 157*27Sjchu * Device Status Register 158*27Sjchu */ 159*27Sjchu #define PCIE_DEVSTS_CE_DETECTED 0x1 /* Correctable Error Detected */ 160*27Sjchu #define PCIE_DEVSTS_NFE_DETECTED 0x2 /* Non Fatal Error Detected */ 161*27Sjchu #define PCIE_DEVSTS_FE_DETECTED 0x4 /* Fatal Error Detected */ 162*27Sjchu #define PCIE_DEVSTS_UR_DETECTED 0x8 /* Unsupported Req Detected */ 163*27Sjchu #define PCIE_DEVSTS_AUX_POWER 0x10 /* AUX Power Detected */ 164*27Sjchu #define PCIE_DEVSTS_TRANS_PENDING 0x20 /* Transactions Pending */ 165*27Sjchu 166*27Sjchu /* 167*27Sjchu * Link Capability Register 168*27Sjchu */ 169*27Sjchu #define PCIE_LINKCAP_MAX_SPEED_2_5 0x1 /* 2.5 Gb/s Speed */ 170*27Sjchu #define PCIE_LINKCAP_MAX_SPEED_MASK 0xF /* Maximum Link Speed */ 171*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X1 0x010 172*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X2 0x020 173*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X4 0x040 174*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X8 0x080 175*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X12 0x0C0 176*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X16 0x100 177*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X32 0x200 178*27Sjchu #define PCIE_LINKCAP_MAX_WIDTH_MASK 0x3f0 /* Maximum Link Width */ 179*27Sjchu 180*27Sjchu #define PCIE_LINKCAP_ASPM_SUP_L0S 0x400 /* L0s Entry Supported */ 181*27Sjchu #define PCIE_LINKCAP_ASPM_SUP_L0S_L1 0xC00 /* L0s abd L1 Supported */ 182*27Sjchu #define PCIE_LINKCAP_ASPM_SUP_MASK 0xC00 /* ASPM Support */ 183*27Sjchu 184*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_MIN 0x0000 /* < 64 ns */ 185*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_64ns 0x1000 /* 64 ns - 128 ns */ 186*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_128ns 0x2000 /* 128 ns - 256 ns */ 187*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_256ns 0x3000 /* 256 ns - 512 ns */ 188*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_512ns 0x4000 /* 512 ns - 1 us */ 189*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_1us 0x5000 /* 1 us - 2 us */ 190*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_2us 0x6000 /* 2 us - 4 us */ 191*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_MAX 0x7000 /* > 4 us */ 192*27Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_MASK 0x7000 /* L0s Exit Latency */ 193*27Sjchu 194*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_MIN 0x00000 /* < 1 us */ 195*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_1us 0x08000 /* 1 us - 2 us */ 196*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_2us 0x10000 /* 2 us - 4 us */ 197*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_4us 0x18000 /* 4 us - 8 us */ 198*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_8us 0x20000 /* 8 us - 16 us */ 199*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_16us 0x28000 /* 16 us - 32 us */ 200*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_32us 0x30000 /* 32 us - 64 us */ 201*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_MAX 0x38000 /* > 64 us */ 202*27Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_MASK 0x38000 /* L1 Exit Latency */ 203*27Sjchu 204*27Sjchu #define PCIE_LINKCAP_PORT_NUMBER 0xF0000000 /* Port Number */ 205*27Sjchu 206*27Sjchu /* 207*27Sjchu * Link Control Register 208*27Sjchu */ 209*27Sjchu #define PCIE_LINKCTL_ASPM_CTL_DIS 0x0 /* ASPM Disable */ 210*27Sjchu #define PCIE_LINKCTL_ASPM_CTL_L0S 0x1 /* ASPM L0s only */ 211*27Sjchu #define PCIE_LINKCTL_ASPM_CTL_L1 0x2 /* ASPM L1 only */ 212*27Sjchu #define PCIE_LINKCTL_ASPM_CTL_L0S_L1 0x3 /* ASPM L0s and L1 only */ 213*27Sjchu #define PCIE_LINKCTL_ASPM_CTL_MASK 0x3 /* ASPM Control */ 214*27Sjchu 215*27Sjchu #define PCIE_LINKCTL_RCB_64_BYTE 0x0 /* 64 Byte */ 216*27Sjchu #define PCIE_LINKCTL_RCB_128_BYTE 0x8 /* 128 Byte */ 217*27Sjchu #define PCIE_LINKCTL_RCB_MASK 0x8 /* Read Completion Boundary */ 218*27Sjchu 219*27Sjchu #define PCIE_LINKCTL_LINK_DISABLE 0x10 /* Link Disable */ 220*27Sjchu #define PCIE_LINKCTL_RETRAIN_LINK 0x20 /* Retrain Link */ 221*27Sjchu #define PCIE_LINKCTL_COMMON_CLK_CFG 0x40 /* Common Clock Configuration */ 222*27Sjchu #define PCIE_LINKCTL_EXT_SYNCH 0x80 /* Extended Synch */ 223*27Sjchu 224*27Sjchu /* 225*27Sjchu * Link Status Register 226*27Sjchu */ 227*27Sjchu #define PCIE_LINKSTS_SPEED_2_5 0x1 /* Link Speed */ 228*27Sjchu #define PCIE_LINKSTS_SPEED_MASK 0xF /* Link Speed */ 229*27Sjchu 230*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X1 0x010 231*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X2 0x020 232*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X4 0x040 233*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X8 0x080 234*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X12 0x0C0 235*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X16 0x100 236*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X32 0x200 237*27Sjchu #define PCIE_LINKSTS_NEG_WIDTH_MASK 0x3F0 /* Negotiated Link Width */ 238*27Sjchu 239*27Sjchu #define PCIE_LINKSTS_TRAINING_ERROR 0x400 /* Training Error */ 240*27Sjchu #define PCIE_LINKSTS_LINK_TRAINING 0x800 /* Link Training */ 241*27Sjchu #define PCIE_LINKSTS_SLOT_CLK_CFG 0x1000 /* Slot Clock Configuration */ 242*27Sjchu 243*27Sjchu /* 244*27Sjchu * Slot Capability Register 245*27Sjchu */ 246*27Sjchu #define PCIE_SLOTCAP_ATTN_BUTTON 0x1 /* Attention Button Present */ 247*27Sjchu #define PCIE_SLOTCAP_POWER_CONTROLLER 0x2 /* Power Controller Present */ 248*27Sjchu #define PCIE_SLOTCAP_MRL_SENSOR 0x4 /* MRL Sensor Present */ 249*27Sjchu #define PCIE_SLOTCAP_ATTN_INDICATOR 0x8 /* Attn Indicator Present */ 250*27Sjchu #define PCIE_SLOTCAP_PWR_INDICATOR 0x10 /* Power Indicator Present */ 251*27Sjchu #define PCIE_SLOTCAP_HP_SURPRISE 0x20 /* Hot-Plug Surprise */ 252*27Sjchu #define PCIE_SLOTCAP_HP_CAPABLE 0x40 /* Hot-Plug Capable */ 253*27Sjchu 254*27Sjchu #define PCIE_SLOTCAP_PLMT_VAL_SHIFT 7 /* Slot Pwr Limit Value Shift */ 255*27Sjchu #define PCIE_SLOTCAP_PLMT_VAL_MASK 0xFF /* Slot Pwr Limit Value */ 256*27Sjchu 257*27Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_1 0x00000 /* 1x Scale */ 258*27Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_10 0x08000 /* 0.1x Scale */ 259*27Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_100 0x10000 /* 0.01x Scale */ 260*27Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_1000 0x18000 /* 0.001x Scale */ 261*27Sjchu #define PCIE_SLOTCAP_PLMT_SCL_MASK 0x18000 /* Slot Power Limit Scale */ 262*27Sjchu 263*27Sjchu #define PCIE_SLOTCAP_PHY_SLOT_NUM_SHIFT 19 /* Physical Slot Num Shift */ 264*27Sjchu #define PCIE_SLOTCAP_PHY_SLOT_NUM_MASK 0x1FFF /* Physical Slot Num Mask */ 265*27Sjchu 266*27Sjchu /* 267*27Sjchu * Slot Control Register 268*27Sjchu */ 269*27Sjchu #define PCIE_SLOTCTL_ATTN_BTN_EN 0x1 /* Attn Button Pressed Enable */ 270*27Sjchu #define PCIE_SLOTCTL_PWR_FAULT_EN 0x2 /* Pwr Fault Detected Enable */ 271*27Sjchu #define PCIE_SLOTCTL_MRL_SENSOR_EN 0x4 /* MRL Sensor Changed Enable */ 272*27Sjchu #define PCIE_SLOTCTL_PRESENCE_CHANGE_EN 0x8 /* Presence Detect Changed En */ 273*27Sjchu #define PCIE_SLOTCTL_CMD_INTR_EN 0x10 /* CMD Completed Interrupt En */ 274*27Sjchu #define PCIE_SLOTCTL_HP_INTR_EN 0x20 /* Hot-Plug Interrupt Enable */ 275*27Sjchu 276*27Sjchu #define PCIE_SLOTCTL_ATTN_CTL_ON 0x40 /* On */ 277*27Sjchu #define PCIE_SLOTCTL_ATTN_CTL_BLINK 0x80 /* Blink */ 278*27Sjchu #define PCIE_SLOTCTL_ATTN_CTL_OFF 0xC0 /* Off */ 279*27Sjchu #define PCIE_SLOTCTL_ATTN_CTL_MASK 0xC0 /* Attn Indicator Control */ 280*27Sjchu 281*27Sjchu #define PCIE_SLOTCTL_PWR_CTL_ON 0x100 /* On */ 282*27Sjchu #define PCIE_SLOTCTL_PWR_CTL_BLINK 0x200 /* Blink */ 283*27Sjchu #define PCIE_SLOTCTL_PWR_CTL_OFF 0x300 /* Off */ 284*27Sjchu #define PCIE_SLOTCTL_PWR_CTL_MASK 0x300 /* Power Indicator Control */ 285*27Sjchu 286*27Sjchu #define PCIE_SLOTCTL_PWR_CONTROLLER_CTL 0x400 /* Power Controller Control */ 287*27Sjchu 288*27Sjchu /* 289*27Sjchu * Slot Status Register 290*27Sjchu */ 291*27Sjchu #define PCIE_SLOTSTS_ATTN_BTN_PRESSED 0x1 /* Attention Button Pressed */ 292*27Sjchu #define PCIE_SLOTSTS_PWR_FAULT_DETECTED 0x2 /* Power Fault Detected */ 293*27Sjchu #define PCIE_SLOTSTS_MRL_SENSOR_CHANGED 0x4 /* MRL Sensor Changed */ 294*27Sjchu #define PCIE_SLOTSTS_PRESENCE_CHANGED 0x8 /* Presence Detect Changed */ 295*27Sjchu #define PCIE_SLOTSTS_COMMAND_COMPLETED 0x10 /* Command Completed */ 296*27Sjchu #define PCIE_SLOTSTS_MRL_SENSOR_OPEN 0x20 /* MRL Open */ 297*27Sjchu #define PCIE_SLOTSTS_PRESENCE_DETECTED 0x40 /* Card Present in slot */ 298*27Sjchu 299*27Sjchu /* 300*27Sjchu * Root Control Register 301*27Sjchu */ 302*27Sjchu #define PCIE_ROOTCTL_SYS_ERR_ON_CE_EN 0x1 /* Sys Err on Cor Err Enable */ 303*27Sjchu #define PCIE_ROOTCTL_SYS_ERR_ON_NFE_EN 0x2 /* Sys Err on NF Err Enable */ 304*27Sjchu #define PCIE_ROOTCTL_SYS_ERR_ON_FE_EN 0x3 /* Sys Err on Fatal Err En */ 305*27Sjchu #define PCIE_ROOTCTL_PME_INTERRUPT_EN 0x4 /* PME Interrupt Enable */ 306*27Sjchu 307*27Sjchu /* 308*27Sjchu * Root Status Register 309*27Sjchu */ 310*27Sjchu #define PCIE_ROOTSTS_PME_REQ_ID_SHIFT 0 /* PME Requestor ID */ 311*27Sjchu #define PCIE_ROOTSTS_PME_REQ_ID_MASK 0xFFFF /* PME Requestor ID */ 312*27Sjchu 313*27Sjchu #define PCIE_ROOTSTS_PME_STATUS 0x10000 /* PME Status */ 314*27Sjchu #define PCIE_ROOTSTS_PME_PENDING 0x20000 /* PME Pending */ 315*27Sjchu 316*27Sjchu 317*27Sjchu /* 318*27Sjchu * PCI-Express Enhanced Capabilities Link Entry Bit Offsets 319*27Sjchu */ 320*27Sjchu #define PCIE_EXT_CAP 0x100 /* Base Address of Ext Cap */ 321*27Sjchu 322*27Sjchu #define PCIE_EXT_CAP_ID_SHIFT 0 /* PCI-e Ext Cap ID */ 323*27Sjchu #define PCIE_EXT_CAP_ID_MASK 0xFFFF 324*27Sjchu #define PCIE_EXT_CAP_VER_SHIFT 16 /* PCI-e Ext Cap Ver */ 325*27Sjchu #define PCIE_EXT_CAP_VER_MASK 0xF 326*27Sjchu #define PCIE_EXT_CAP_NEXT_PTR_SHIFT 20 /* PCI-e Ext Cap Next Ptr */ 327*27Sjchu #define PCIE_EXT_CAP_NEXT_PTR_MASK 0xFFF 328*27Sjchu 329*27Sjchu #define PCIE_EXT_CAP_NEXT_PTR_NULL 0x0 330*27Sjchu 331*27Sjchu /* 332*27Sjchu * PCI-Express Enhanced Capability Identifier Values 333*27Sjchu */ 334*27Sjchu #define PCIE_EXT_CAP_ID_AER 0x1 /* Advanced Error Handling */ 335*27Sjchu #define PCIE_EXT_CAP_ID_VC 0x2 /* Virtual Channel */ 336*27Sjchu #define PCIE_EXT_CAP_ID_SER 0x3 /* Serial Number */ 337*27Sjchu #define PCIE_EXT_CAP_ID_PWR_BUDGET 0x4 /* Power Budgeting */ 338*27Sjchu 339*27Sjchu /* 340*27Sjchu * PCI-Express Advanced Error Reporting Extended Capability Offsets 341*27Sjchu */ 342*27Sjchu #define PCIE_AER_CAP 0x0 /* Enhanced Capability Header */ 343*27Sjchu #define PCIE_AER_UCE_STS 0x4 /* Uncorrectable Error Status */ 344*27Sjchu #define PCIE_AER_UCE_MASK 0x8 /* Uncorrectable Error Mask */ 345*27Sjchu #define PCIE_AER_UCE_SERV 0xc /* Uncor Error Severity */ 346*27Sjchu #define PCIE_AER_CE_STS 0x10 /* Correctable Error Status */ 347*27Sjchu #define PCIE_AER_CE_MASK 0x14 /* Correctable Error Mask */ 348*27Sjchu #define PCIE_AER_CTL 0x18 /* AER Capability & Control */ 349*27Sjchu #define PCIE_AER_HDR_LOG 0x1c /* Header Log */ 350*27Sjchu 351*27Sjchu /* Root Ports Only */ 352*27Sjchu #define PCIE_AER_RE_CMD 0x2c /* Root Error Command */ 353*27Sjchu #define PCIE_AER_RE_STS 0x30 /* Root Error Status */ 354*27Sjchu #define PCIE_AER_CE_SRC_ID 0x34 /* Error Source ID */ 355*27Sjchu #define PCIE_AER_ERR_SRC_ID 0x36 /* Error Source ID */ 356*27Sjchu 357*27Sjchu /* Bridges Only */ 358*27Sjchu #define PCIE_AER_SUCE_STS 0x2c /* Secondary UCE Status */ 359*27Sjchu #define PCIE_AER_SUCE_MASK 0x30 /* Secondary UCE Mask */ 360*27Sjchu #define PCIE_AER_SUCE_SERV 0x34 /* Secondary UCE Severity */ 361*27Sjchu #define PCIE_AER_SCTL 0x38 /* Secondary Cap & Ctl */ 362*27Sjchu #define PCIE_AER_SHDR_LOG 0x3c /* Secondary Header Log */ 363*27Sjchu 364*27Sjchu /* 365*27Sjchu * AER Uncorrectable Error Status/Mask/Severity Register 366*27Sjchu */ 367*27Sjchu #define PCIE_AER_UCE_TRAINING 0x0 /* Training Error Status */ 368*27Sjchu #define PCIE_AER_UCE_DLP 0x10 /* Data Link Protocol Error */ 369*27Sjchu #define PCIE_AER_UCE_PTLP 0x1000 /* Poisoned TLP Status */ 370*27Sjchu #define PCIE_AER_UCE_FCP 0x2000 /* Flow Control Protocol Sts */ 371*27Sjchu #define PCIE_AER_UCE_TO 0x4000 /* Completion Timeout Status */ 372*27Sjchu #define PCIE_AER_UCE_CA 0x8000 /* Completer Abort Status */ 373*27Sjchu #define PCIE_AER_UCE_UC 0x10000 /* Unexpected Completion Sts */ 374*27Sjchu #define PCIE_AER_UCE_RO 0x20000 /* Receiver Overflow Status */ 375*27Sjchu #define PCIE_AER_UCE_MTLP 0x40000 /* Malformed TLP Status */ 376*27Sjchu #define PCIE_AER_UCE_ECRC 0x80000 /* ECRC Error Status */ 377*27Sjchu #define PCIE_AER_UCE_UR 0x100000 /* Unsupported Req */ 378*27Sjchu #define PCIE_AER_UCE_BITS (PCIE_AER_UCE_TRAINING | \ 379*27Sjchu PCIE_AER_UCE_DLP | PCIE_AER_UCE_PTLP | PCIE_AER_UCE_FCP | \ 380*27Sjchu PCIE_AER_UCE_TO | PCIE_AER_UCE_CA | PCIE_AER_UCE_UC | PCIE_AER_UCE_RO | \ 381*27Sjchu PCIE_AER_UCE_MTLP | PCIE_AER_UCE_ECRC | PCIE_AER_UCE_UR) 382*27Sjchu 383*27Sjchu /* 384*27Sjchu * AER Correctable Error Status/Mask Register 385*27Sjchu */ 386*27Sjchu #define PCIE_AER_CE_RECEIVER_ERR 0x1 /* Receiver Error Status */ 387*27Sjchu #define PCIE_AER_CE_BAD_TLP 0x40 /* Bad TLP Status */ 388*27Sjchu #define PCIE_AER_CE_BAD_DLLP 0x80 /* Bad DLLP Status */ 389*27Sjchu #define PCIE_AER_CE_REPLAY_ROLLOVER 0x100 /* REPLAY_NUM Rollover Status */ 390*27Sjchu #define PCIE_AER_CE_REPLAY_TO 0x1000 /* Replay Timer Timeout Sts */ 391*27Sjchu #define PCIE_AER_CE_BITS (PCIE_AER_CE_RECEIVER_ERR | \ 392*27Sjchu PCIE_AER_CE_BAD_TLP | PCIE_AER_CE_BAD_DLLP | PCIE_AER_CE_REPLAY_ROLLOVER | \ 393*27Sjchu PCIE_AER_CE_REPLAY_TO) 394*27Sjchu 395*27Sjchu /* 396*27Sjchu * AER Capability & Control 397*27Sjchu */ 398*27Sjchu #define PCIE_AER_CTL_FST_ERR_PTR_MASK 0x1F /* First Error Pointer */ 399*27Sjchu #define PCIE_AER_CTL_ECRC_GEN_CAP 0x20 /* ECRC Generation Capable */ 400*27Sjchu #define PCIE_AER_CTL_ECRC_GEN_ENA 0x40 /* ECRC Generation Enable */ 401*27Sjchu #define PCIE_AER_CTL_ECRC_CHECK_CAP 0x80 /* ECRC Check Capable */ 402*27Sjchu #define PCIE_AER_CTL_ECRC_CHECK_ENA 0x100 /* ECRC Check Enable */ 403*27Sjchu 404*27Sjchu /* 405*27Sjchu * AER Root Command Register 406*27Sjchu */ 407*27Sjchu #define PCIE_AER_RE_CMD_CE_REP_EN 0x1 /* Correctable Error Enable */ 408*27Sjchu #define PCIE_AER_RE_CMD_NFE_REP_EN 0x2 /* Non-Fatal Error Enable */ 409*27Sjchu #define PCIE_AER_RE_CMD_FE_REP_EN 0x4 /* Fatal Error Enable */ 410*27Sjchu 411*27Sjchu /* 412*27Sjchu * AER Root Error Status Register 413*27Sjchu */ 414*27Sjchu #define PCIE_AER_RE_STS_CE_RCVD 0x1 /* ERR_COR Received */ 415*27Sjchu #define PCIE_AER_RE_STS_MUL_CE_RCVD 0x2 /* Multiple ERR_COR Received */ 416*27Sjchu #define PCIE_AER_RE_STS_FE_NFE_RCVD 0x4 /* FATAL/NON-FATAL Received */ 417*27Sjchu #define PCIE_AER_RE_STS_MUL_FE_NFE_RCVD 0x8 /* Multiple ERR_F/NF Received */ 418*27Sjchu #define PCIE_AER_RE_STS_FIRST_UC_FATAL 0x10 /* First Uncorrectable Fatal */ 419*27Sjchu #define PCIE_AER_RE_STS_NFE_MSGS_RCVD 0x20 /* Non-Fatal Error Msgs Rcvd */ 420*27Sjchu #define PCIE_AER_RE_STS_FE_MSGS_RCVD 0x40 /* Fatal Error Messages Rcvd */ 421*27Sjchu 422*27Sjchu #define PCIE_AER_RE_STS_MSG_NUM_SHIFT 27 /* Offset of Intr Msg Number */ 423*27Sjchu #define PCIE_AER_RE_STS_MSG_NUM_MASK 0x1F /* Intr Msg Number Mask */ 424*27Sjchu 425*27Sjchu /* 426*27Sjchu * AER Error Source Identification Register 427*27Sjchu */ 428*27Sjchu #define PCIE_AER_ERR_SRC_ID_CE_SHIFT 0 /* ERR_COR Source ID */ 429*27Sjchu #define PCIE_AER_ERR_SRC_ID_CE_MASK 0xFFFF 430*27Sjchu #define PCIE_AER_ERR_SRC_ID_UE_SHIFT 16 /* ERR_FATAL/NONFATAL Src ID */ 431*27Sjchu #define PCIE_AER_ERR_SRC_ID_UE_MASK 0xFFF 432*27Sjchu 433*27Sjchu /* 434*27Sjchu * AER Secondary Uncorrectable Error Register 435*27Sjchu */ 436*27Sjchu #define PCIE_AER_SUCE_TA_ON_SC 0x1 /* Target Abort on Split Comp */ 437*27Sjchu #define PCIE_AER_SUCE_MA_ON_SC 0x2 /* Master Abort on Split Comp */ 438*27Sjchu #define PCIE_AER_SUCE_RCVD_TA 0x4 /* Received Target Abort */ 439*27Sjchu #define PCIE_AER_SUCE_RCVD_MA 0x8 /* Received Master Abort */ 440*27Sjchu #define PCIE_AER_SUCE_USC_ERR 0x20 /* Unexpected Split Comp Err */ 441*27Sjchu #define PCIE_AER_SUCE_USC_MSG_DATA_ERR 0x40 /* USC Message Data Error */ 442*27Sjchu #define PCIE_AER_SUCE_UC_DATA_ERR 0x80 /* Uncorrectable Data Error */ 443*27Sjchu #define PCIE_AER_SUCE_UC_ATTR_ERR 0x100 /* UC Attribute Err */ 444*27Sjchu #define PCIE_AER_SUCE_UC_ADDR_ERR 0x200 /* Uncorrectable Address Err */ 445*27Sjchu #define PCIE_AER_SUCE_TIMER_EXPIRED 0x400 /* Delayed xtion discard */ 446*27Sjchu #define PCIE_AER_SUCE_PERR_ASSERT 0x800 /* PERR Assertion Detected */ 447*27Sjchu #define PCIE_AER_SUCE_SERR_ASSERT 0x1000 /* SERR Assertion Detected */ 448*27Sjchu #define PCIE_AER_SUCE_INTERNAL_ERR 0x2000 /* Internal Bridge Err Detect */ 449*27Sjchu #define PCIE_AER_SUCE_BITS (PCIE_AER_SUCE_TA_ON_SC | \ 450*27Sjchu PCIE_AER_SUCE_MA_ON_SC | PCIE_AER_SUCE_RCVD_TA | PCIE_AER_SUCE_RCVD_MA | \ 451*27Sjchu PCIE_AER_SUCE_USC_ERR | PCIE_AER_SUCE_USC_MSG_DATA_ERR | \ 452*27Sjchu PCIE_AER_SUCE_UC_DATA_ERR | PCIE_AER_SUCE_UC_ATTR_ERR | \ 453*27Sjchu PCIE_AER_SUCE_UC_ADDR_ERR | PCIE_AER_SUCE_TIMER_EXPIRED | \ 454*27Sjchu PCIE_AER_SUCE_PERR_ASSERT | PCIE_AER_SUCE_SERR_ASSERT | \ 455*27Sjchu PCIE_AER_SUCE_INTERNAL_ERR) 456*27Sjchu 457*27Sjchu /* 458*27Sjchu * AER Secondary Capability & Control 459*27Sjchu */ 460*27Sjchu #define PCIE_AER_SCTL_FST_ERR_PTR_MASK 0x1F /* First Error Pointer */ 461*27Sjchu 462*27Sjchu /* 463*27Sjchu * AER Secondary Headers 464*27Sjchu * The Secondary Header Logs is 4 DW long. 465*27Sjchu * The first 2 DW are split into 3 sections 466*27Sjchu * o Transaction Attribute 467*27Sjchu * o Transaction Command Lower 468*27Sjchu * o Transaction Command Higher 469*27Sjchu * The last 2 DW is the Transaction Address 470*27Sjchu */ 471*27Sjchu #define PCIE_AER_SHDR_LOG_ATTR_MASK 0xFFFFFFFFF 472*27Sjchu #define PCIE_AER_SHDR_LOG_CMD_LOW_MASK 0xF000000000 473*27Sjchu #define PCIE_AER_SHDR_LOG_CMD_HIGH_MASK 0xF0000000000 474*27Sjchu #define PCIE_AER_SHDR_LOG_ADDR_MASK 0xFFFFFFFFFFFFFFFF 475*27Sjchu 476*27Sjchu /* 477*27Sjchu * PCI-E Common TLP Header Fields 478*27Sjchu */ 479*27Sjchu #define PCIE_TLP_FMT_3DW 0x00 480*27Sjchu #define PCIE_TLP_FMT_4DW 0x20 481*27Sjchu #define PCIE_TLP_FMT_3DW_DATA 0x40 482*27Sjchu #define PCIE_TLP_FMT_4DW_DATA 0x60 483*27Sjchu 484*27Sjchu #define PCIE_TLP_TYPE_MEM 0x0 485*27Sjchu #define PCIE_TLP_TYPE_MEMLK 0x1 486*27Sjchu #define PCIE_TLP_TYPE_IO 0x2 487*27Sjchu #define PCIE_TLP_TYPE_CFG0 0x4 488*27Sjchu #define PCIE_TLP_TYPE_CFG1 0x5 489*27Sjchu #define PCIE_TLP_TYPE_MSG 0x10 490*27Sjchu #define PCIE_TLP_TYPE_CPL 0xA 491*27Sjchu #define PCIE_TLP_TYPE_CPLLK 0xB 492*27Sjchu #define PCIE_TLP_TYPE_MSI 0x18 493*27Sjchu 494*27Sjchu #define PCIE_TLP_MRD3 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_MEM) 495*27Sjchu #define PCIE_TLP_MRD4 (PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MEM) 496*27Sjchu #define PCIE_TLP_MRDLK3 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_MEMLK) 497*27Sjchu #define PCIE_TLP_MRDLK4 (PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MEMLK) 498*27Sjchu #define PCIE_TLP_MRDWR3 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_MEM) 499*27Sjchu #define PCIE_TLP_MRDWR4 (PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MEM) 500*27Sjchu #define PCIE_TLP_IORD (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_IO) 501*27Sjchu #define PCIE_TLP_IOWR (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_IO) 502*27Sjchu #define PCIE_TLP_CFGRD0 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CFG0) 503*27Sjchu #define PCIE_TLP_CFGWR0 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CFG0) 504*27Sjchu #define PCIE_TLP_CFGRD1 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CFG1) 505*27Sjchu #define PCIE_TLP_CFGWR1 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CFG1) 506*27Sjchu #define PCIE_TLP_MSG (PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MSG) 507*27Sjchu #define PCIE_TLP_MSGD (PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MSG) 508*27Sjchu #define PCIE_TLP_CPL (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CPL) 509*27Sjchu #define PCIE_TLP_CPLD (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CPL) 510*27Sjchu #define PCIE_TLP_CPLLK (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CPLLK) 511*27Sjchu #define PCIE_TLP_CPLDLK (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CPLLK) 512*27Sjchu #define PCIE_TLP_MSI32 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_MSI) 513*27Sjchu #define PCIE_TLP_MSI64 (PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MSI) 514*27Sjchu 515*27Sjchu typedef uint16_t pcie_req_id_t; 516*27Sjchu 517*27Sjchu #define PCIE_REQ_ID_BUS_SHIFT 8 518*27Sjchu #define PCIE_REQ_ID_BUS_MASK 0xFF00 519*27Sjchu #define PCIE_REQ_ID_DEV_SHIFT 3 520*27Sjchu #define PCIE_REQ_ID_DEV_MASK 0x00F1 521*27Sjchu #define PCIE_REQ_ID_FUNC_SHIFT 0 522*27Sjchu #define PCIE_REQ_ID_FUNC_MASK 0x0007 523*27Sjchu 524*27Sjchu /* 525*27Sjchu * PCI-Express Message Request Header 526*27Sjchu */ 527*27Sjchu typedef struct pcie_msg { 528*27Sjchu uint32_t rsvd1 :16, /* DW0 */ 529*27Sjchu td :1, 530*27Sjchu ep :1, 531*27Sjchu attr :2, 532*27Sjchu rsvd2 :2, 533*27Sjchu len :10; 534*27Sjchu uint32_t rid :16, /* DW1 */ 535*27Sjchu tag :8, 536*27Sjchu msg_code:8; 537*27Sjchu uint32_t unused[2]; /* DW 2 & 3 */ 538*27Sjchu } pcie_msg_t; 539*27Sjchu 540*27Sjchu #define PCIE_MSG_CODE_ERR_COR 0x30 541*27Sjchu #define PCIE_MSG_CODE_ERR_NONFATAL 0x31 542*27Sjchu #define PCIE_MSG_CODE_ERR_FATAL 0x33 543*27Sjchu 544*27Sjchu #ifdef __cplusplus 545*27Sjchu } 546*27Sjchu #endif 547*27Sjchu 548*27Sjchu #endif /* _SYS_PCIE_H */ 549