127Sjchu /* 227Sjchu * CDDL HEADER START 327Sjchu * 427Sjchu * The contents of this file are subject to the terms of the 51786Sjj156685 * Common Development and Distribution License (the "License"). 61786Sjj156685 * You may not use this file except in compliance with the License. 727Sjchu * 827Sjchu * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 927Sjchu * or http://www.opensolaris.org/os/licensing. 1027Sjchu * See the License for the specific language governing permissions 1127Sjchu * and limitations under the License. 1227Sjchu * 1327Sjchu * When distributing Covered Code, include this CDDL HEADER in each 1427Sjchu * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1527Sjchu * If applicable, add the following below this CDDL HEADER, with the 1627Sjchu * fields enclosed by brackets "[]" replaced with your own identifying 1727Sjchu * information: Portions Copyright [yyyy] [name of copyright owner] 1827Sjchu * 1927Sjchu * CDDL HEADER END 2027Sjchu */ 2127Sjchu /* 229921SKrishna.Elango@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 2327Sjchu * Use is subject to license terms. 2427Sjchu */ 2527Sjchu 2627Sjchu #ifndef _SYS_PCIE_H 2727Sjchu #define _SYS_PCIE_H 2827Sjchu 2927Sjchu #ifdef __cplusplus 3027Sjchu extern "C" { 3127Sjchu #endif 3227Sjchu 3327Sjchu #include <sys/pci.h> 3427Sjchu 3527Sjchu /* 36881Sjohnny * PCI Express capability registers in PCI configuration space relative to 37881Sjohnny * the PCI Express Capability structure. 3827Sjchu */ 3927Sjchu #define PCIE_CAP_ID PCI_CAP_ID 4027Sjchu #define PCIE_CAP_NEXT_PTR PCI_CAP_NEXT_PTR 4127Sjchu #define PCIE_PCIECAP 0x02 /* PCI-e Capability Reg */ 4227Sjchu #define PCIE_DEVCAP 0x04 /* Device Capability */ 4327Sjchu #define PCIE_DEVCTL 0x08 /* Device Control */ 4427Sjchu #define PCIE_DEVSTS 0x0A /* Device Status */ 451850Sjj156685 #define PCIE_LINKCAP 0x0C /* Link Capability */ 461850Sjj156685 #define PCIE_LINKCTL 0x10 /* Link Control */ 471850Sjj156685 #define PCIE_LINKSTS 0x12 /* Link Status */ 4827Sjchu #define PCIE_SLOTCAP 0x14 /* Slot Capability */ 4927Sjchu #define PCIE_SLOTCTL 0x18 /* Slot Control */ 5027Sjchu #define PCIE_SLOTSTS 0x1A /* Slot Status */ 5127Sjchu #define PCIE_ROOTCTL 0x1C /* Root Control */ 5227Sjchu #define PCIE_ROOTSTS 0x20 /* Root Status */ 53*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2 0x24 /* Device Capability 2 */ 54*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2 0x28 /* Device Control 2 */ 55*10923SEvan.Yan@Sun.COM #define PCIE_DEVSTS2 0x2A /* Device Status 2 */ 56*10923SEvan.Yan@Sun.COM #define PCIE_LINKCAP2 0x2C /* Link Capability 2 */ 57*10923SEvan.Yan@Sun.COM #define PCIE_LINKCTL2 0x30 /* Link Control 2 */ 58*10923SEvan.Yan@Sun.COM #define PCIE_LINKSTS2 0x32 /* Link Status 2 */ 59*10923SEvan.Yan@Sun.COM #define PCIE_SLOTCAP2 0x34 /* Slot Capability 2 */ 60*10923SEvan.Yan@Sun.COM #define PCIE_SLOTCTL2 0x38 /* Slot Control 2 */ 61*10923SEvan.Yan@Sun.COM #define PCIE_SLOTSTS2 0x3A /* Slot Status 2 */ 6227Sjchu 6327Sjchu /* 64881Sjohnny * PCI-Express Config Space size 65881Sjohnny */ 66881Sjohnny #define PCIE_CONF_HDR_SIZE 4096 /* PCIe configuration header size */ 67881Sjohnny 68881Sjohnny /* 69881Sjohnny * PCI-Express Capabilities Register (2 bytes) 7027Sjchu */ 7127Sjchu #define PCIE_PCIECAP_VER_1_0 0x1 /* PCI-E spec 1.0 */ 72*10923SEvan.Yan@Sun.COM #define PCIE_PCIECAP_VER_2_0 0x2 /* PCI-E spec 2.0 */ 7327Sjchu #define PCIE_PCIECAP_VER_MASK 0xF /* Version Mask */ 7427Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCIE_DEV 0x00 /* PCI-E Endpont Device */ 759921SKrishna.Elango@Sun.COM #define PCIE_PCIECAP_DEV_TYPE_PCI_DEV 0x10 /* "Leg PCI" Endpont Device */ 7627Sjchu #define PCIE_PCIECAP_DEV_TYPE_ROOT 0x40 /* Root Port of Root Complex */ 7727Sjchu #define PCIE_PCIECAP_DEV_TYPE_UP 0x50 /* Upstream Port of Switch */ 7827Sjchu #define PCIE_PCIECAP_DEV_TYPE_DOWN 0x60 /* Downstream Port of Switch */ 7927Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCIE2PCI 0x70 /* PCI-E to PCI Bridge */ 8027Sjchu #define PCIE_PCIECAP_DEV_TYPE_PCI2PCIE 0x80 /* PCI to PCI-E Bridge */ 816313Skrishnae #define PCIE_PCIECAP_DEV_TYPE_RC_IEP 0x90 /* RootComplex Integrated Dev */ 826313Skrishnae #define PCIE_PCIECAP_DEV_TYPE_RC_EC 0xA0 /* RootComplex Evt Collector */ 8327Sjchu #define PCIE_PCIECAP_DEV_TYPE_MASK 0xF0 /* Device/Port Type Mask */ 8427Sjchu #define PCIE_PCIECAP_SLOT_IMPL 0x100 /* Slot Impl vs Integrated */ 857848SKrishna.Elango@Sun.COM #define PCIE_PCIECAP_INT_MSG_NUM 0x3E00 /* Interrupt Message Number */ 8627Sjchu 8727Sjchu /* 88881Sjohnny * Device Capabilities Register (4 bytes) 8927Sjchu */ 9027Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_128 0x0 9127Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_256 0x1 9227Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_512 0x2 9327Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_1024 0x3 9427Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_2048 0x4 9527Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_4096 0x5 9627Sjchu #define PCIE_DEVCAP_MAX_PAYLOAD_MASK 0x7 /* Max Payload Size Supported */ 9727Sjchu 9827Sjchu #define PCIE_DEVCAP_PHTM_FUNC_NONE 0x00 /* No Function # bits used */ 9927Sjchu #define PCIE_DEVCAP_PHTM_FUNC_ONE 0x08 /* First most sig. bit used */ 10027Sjchu #define PCIE_DEVCAP_PHTM_FUNC_TWO 0x10 /* First 2 most sig bit used */ 10127Sjchu #define PCIE_DEVCAP_PHTM_FUNC_THREE 0x18 /* All 3 bits used */ 10227Sjchu #define PCIE_DEVCAP_PHTM_FUNC_MASK 0x18 /* Phantom Func Supported */ 10327Sjchu 10427Sjchu #define PCIE_DEVCAP_EXT_TAG_5BIT 0x00 /* 5-Bit Tag Field Supported */ 10527Sjchu #define PCIE_DEVCAP_EXT_TAG_8BIT 0x20 /* 8-Bit Tag Field Supported */ 10627Sjchu #define PCIE_DEVCAP_EXT_TAG_MASK 0x20 /* Ext. Tag Field Supported */ 10727Sjchu 10827Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_MIN 0x000 /* < 64 ns */ 10927Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_64ns 0x040 /* 64 ns - 128 ns */ 11027Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_128ns 0x080 /* 128 ns - 256 ns */ 11127Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_256ns 0x0C0 /* 256 ns - 512 ns */ 11227Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_512ns 0x100 /* 512 ns - 1 us */ 11327Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_1us 0x140 /* 1 us - 2 us */ 11427Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_2us 0x180 /* 2 us - 4 us */ 11527Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_MAX 0x1C0 /* > 4 us */ 11627Sjchu #define PCIE_DEVCAP_EP_L0S_LAT_MASK 0x1C0 /* EP L0s Accetable Latency */ 11727Sjchu 11827Sjchu #define PCIE_DEVCAP_EP_L1_LAT_MIN 0x000 /* < 1 us */ 11927Sjchu #define PCIE_DEVCAP_EP_L1_LAT_1us 0x140 /* 1 us - 2 us */ 12027Sjchu #define PCIE_DEVCAP_EP_L1_LAT_2us 0x180 /* 2 us - 4 us */ 12127Sjchu #define PCIE_DEVCAP_EP_L1_LAT_4us 0x140 /* 4 us - 8 us */ 12227Sjchu #define PCIE_DEVCAP_EP_L1_LAT_8us 0x180 /* 8 us - 16 us */ 12327Sjchu #define PCIE_DEVCAP_EP_L1_LAT_16us 0x140 /* 16 us - 32 us */ 12427Sjchu #define PCIE_DEVCAP_EP_L1_LAT_32us 0x180 /* 32 us - 64 us */ 12527Sjchu #define PCIE_DEVCAP_EP_L1_LAT_MAX 0x1C0 /* > 64 us */ 12627Sjchu #define PCIE_DEVCAP_EP_L1_LAT_MASK 0x700 /* EP L1 Accetable Latency */ 12727Sjchu 12827Sjchu #define PCIE_DEVCAP_ATTN_BUTTON 0x1000 /* Attention Button Present */ 12927Sjchu #define PCIE_DEVCAP_ATTN_INDICATOR 0x2000 /* Attn Indicator Present */ 13027Sjchu #define PCIE_DEVCAP_PWR_INDICATOR 0x4000 /* Power Indicator Present */ 13127Sjchu 1323070Sanish #define PCIE_DEVCAP_ROLE_BASED_ERR_REP 0x8000 /* Role Based Error Reporting */ 1333070Sanish 13427Sjchu #define PCIE_DEVCAP_PLMT_VAL_SHIFT 18 /* Power Limit Value Shift */ 13527Sjchu #define PCIE_DEVCAP_PLMT_VAL_MASK 0xFF /* Power Limit Value Mask */ 13627Sjchu 13727Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_1 0x0000000 /* 1x Scale */ 13827Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_10 0x4000000 /* 0.1x Scale */ 13927Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_100 0x8000000 /* 0.01x Scale */ 14027Sjchu #define PCIE_DEVCAP_PLMT_SCL_1_BY_1000 0xC000000 /* 0.001x Scale */ 14127Sjchu #define PCIE_DEVCAP_PLMT_SCL_MASK 0xC000000 /* Power Limit Scale */ 14227Sjchu 14327Sjchu /* 144881Sjohnny * Device Control Register (2 bytes) 14527Sjchu */ 14627Sjchu #define PCIE_DEVCTL_CE_REPORTING_EN 0x1 /* Correctable Error Enable */ 14727Sjchu #define PCIE_DEVCTL_NFE_REPORTING_EN 0x2 /* Non-Fatal Error Enable */ 14827Sjchu #define PCIE_DEVCTL_FE_REPORTING_EN 0x4 /* Fatal Error Enable */ 14927Sjchu #define PCIE_DEVCTL_UR_REPORTING_EN 0x8 /* Unsupported Request Enable */ 1503143Sraghuram #define PCIE_DEVCTL_ERR_MASK 0xF /* All of the above bits */ 1513143Sraghuram 15227Sjchu #define PCIE_DEVCTL_RO_EN 0x10 /* Enable Relaxed Ordering */ 15327Sjchu 15427Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_128 0x00 15527Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_256 0x20 15627Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_512 0x40 15727Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_1024 0x60 15827Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_2048 0x80 15927Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_4096 0xA0 16027Sjchu #define PCIE_DEVCTL_MAX_PAYLOAD_MASK 0xE0 /* Max_Payload_Size */ 1617596SAlan.Adamson@Sun.COM #define PCIE_DEVCTL_MAX_PAYLOAD_SHIFT 0x5 16227Sjchu 16327Sjchu #define PCIE_DEVCTL_EXT_TAG_FIELD_EN 0x100 /* Extended Tag Field Enable */ 16427Sjchu #define PCIE_DEVCTL_PHTM_FUNC_EN 0x200 /* Phantom Functions Enable */ 16527Sjchu #define PCIE_DEVCTL_AUX_POWER_PM_EN 0x400 /* Auxiliary Power PM Enable */ 16627Sjchu #define PCIE_DEVCTL_ENABLE_NO_SNOOP 0x800 /* Enable No Snoop */ 16727Sjchu 1683143Sraghuram #define PCIE_DEVCTL_MAX_READ_REQ_128 0x0000 1693143Sraghuram #define PCIE_DEVCTL_MAX_READ_REQ_256 0x1000 1703143Sraghuram #define PCIE_DEVCTL_MAX_READ_REQ_512 0x2000 1713143Sraghuram #define PCIE_DEVCTL_MAX_READ_REQ_1024 0x3000 1723143Sraghuram #define PCIE_DEVCTL_MAX_READ_REQ_2048 0x4000 1733143Sraghuram #define PCIE_DEVCTL_MAX_READ_REQ_4096 0x5000 17427Sjchu #define PCIE_DEVCTL_MAX_READ_REQ_MASK 0x7000 /* Max_Read_Request_Size */ 1757596SAlan.Adamson@Sun.COM #define PCIE_DEVCTL_MAX_READ_REQ_SHIFT 0xC 17627Sjchu 17727Sjchu /* 178881Sjohnny * Device Status Register (2 bytes) 17927Sjchu */ 18027Sjchu #define PCIE_DEVSTS_CE_DETECTED 0x1 /* Correctable Error Detected */ 18127Sjchu #define PCIE_DEVSTS_NFE_DETECTED 0x2 /* Non Fatal Error Detected */ 18227Sjchu #define PCIE_DEVSTS_FE_DETECTED 0x4 /* Fatal Error Detected */ 18327Sjchu #define PCIE_DEVSTS_UR_DETECTED 0x8 /* Unsupported Req Detected */ 18427Sjchu #define PCIE_DEVSTS_AUX_POWER 0x10 /* AUX Power Detected */ 18527Sjchu #define PCIE_DEVSTS_TRANS_PENDING 0x20 /* Transactions Pending */ 18627Sjchu 18727Sjchu /* 188881Sjohnny * Link Capability Register (4 bytes) 18927Sjchu */ 19027Sjchu #define PCIE_LINKCAP_MAX_SPEED_2_5 0x1 /* 2.5 Gb/s Speed */ 19127Sjchu #define PCIE_LINKCAP_MAX_SPEED_MASK 0xF /* Maximum Link Speed */ 19227Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X1 0x010 19327Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X2 0x020 19427Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X4 0x040 19527Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X8 0x080 19627Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X12 0x0C0 19727Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X16 0x100 19827Sjchu #define PCIE_LINKCAP_MAX_WIDTH_X32 0x200 19927Sjchu #define PCIE_LINKCAP_MAX_WIDTH_MASK 0x3f0 /* Maximum Link Width */ 20027Sjchu 20127Sjchu #define PCIE_LINKCAP_ASPM_SUP_L0S 0x400 /* L0s Entry Supported */ 20227Sjchu #define PCIE_LINKCAP_ASPM_SUP_L0S_L1 0xC00 /* L0s abd L1 Supported */ 20327Sjchu #define PCIE_LINKCAP_ASPM_SUP_MASK 0xC00 /* ASPM Support */ 20427Sjchu 20527Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_MIN 0x0000 /* < 64 ns */ 20627Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_64ns 0x1000 /* 64 ns - 128 ns */ 20727Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_128ns 0x2000 /* 128 ns - 256 ns */ 20827Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_256ns 0x3000 /* 256 ns - 512 ns */ 20927Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_512ns 0x4000 /* 512 ns - 1 us */ 21027Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_1us 0x5000 /* 1 us - 2 us */ 21127Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_2us 0x6000 /* 2 us - 4 us */ 21227Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_MAX 0x7000 /* > 4 us */ 21327Sjchu #define PCIE_LINKCAP_L0S_EXIT_LAT_MASK 0x7000 /* L0s Exit Latency */ 21427Sjchu 21527Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_MIN 0x00000 /* < 1 us */ 21627Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_1us 0x08000 /* 1 us - 2 us */ 21727Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_2us 0x10000 /* 2 us - 4 us */ 21827Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_4us 0x18000 /* 4 us - 8 us */ 21927Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_8us 0x20000 /* 8 us - 16 us */ 22027Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_16us 0x28000 /* 16 us - 32 us */ 22127Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_32us 0x30000 /* 32 us - 64 us */ 22227Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_MAX 0x38000 /* > 64 us */ 22327Sjchu #define PCIE_LINKCAP_L1_EXIT_LAT_MASK 0x38000 /* L1 Exit Latency */ 22427Sjchu 225881Sjohnny /* PCIe v1.1 spec based */ 226881Sjohnny #define PCIE_LINKCAP_DLL_ACTIVE_REP_CAPABLE 0x100000 /* DLL Active */ 227881Sjohnny /* Capable bit */ 228881Sjohnny 2299921SKrishna.Elango@Sun.COM #define PCIE_LINKCAP_PORT_NUMBER 0xFF000000 /* Port Number */ 2309921SKrishna.Elango@Sun.COM #define PCIE_LINKCAP_PORT_NUMBER_SHIFT 24 /* Port Number Shift */ 2319921SKrishna.Elango@Sun.COM #define PCIE_LINKCAP_PORT_NUMBER_MASK 0xFF /* Port Number Mask */ 23227Sjchu 23327Sjchu /* 234881Sjohnny * Link Control Register (2 bytes) 23527Sjchu */ 23627Sjchu #define PCIE_LINKCTL_ASPM_CTL_DIS 0x0 /* ASPM Disable */ 23727Sjchu #define PCIE_LINKCTL_ASPM_CTL_L0S 0x1 /* ASPM L0s only */ 23827Sjchu #define PCIE_LINKCTL_ASPM_CTL_L1 0x2 /* ASPM L1 only */ 23927Sjchu #define PCIE_LINKCTL_ASPM_CTL_L0S_L1 0x3 /* ASPM L0s and L1 only */ 24027Sjchu #define PCIE_LINKCTL_ASPM_CTL_MASK 0x3 /* ASPM Control */ 24127Sjchu 24227Sjchu #define PCIE_LINKCTL_RCB_64_BYTE 0x0 /* 64 Byte */ 24327Sjchu #define PCIE_LINKCTL_RCB_128_BYTE 0x8 /* 128 Byte */ 24427Sjchu #define PCIE_LINKCTL_RCB_MASK 0x8 /* Read Completion Boundary */ 24527Sjchu 24627Sjchu #define PCIE_LINKCTL_LINK_DISABLE 0x10 /* Link Disable */ 24727Sjchu #define PCIE_LINKCTL_RETRAIN_LINK 0x20 /* Retrain Link */ 24827Sjchu #define PCIE_LINKCTL_COMMON_CLK_CFG 0x40 /* Common Clock Configuration */ 24927Sjchu #define PCIE_LINKCTL_EXT_SYNCH 0x80 /* Extended Synch */ 25027Sjchu 25127Sjchu /* 252881Sjohnny * Link Status Register (2 bytes) 25327Sjchu */ 25427Sjchu #define PCIE_LINKSTS_SPEED_2_5 0x1 /* Link Speed */ 25527Sjchu #define PCIE_LINKSTS_SPEED_MASK 0xF /* Link Speed */ 25627Sjchu 25727Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X1 0x010 25827Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X2 0x020 25927Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X4 0x040 26027Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X8 0x080 26127Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X12 0x0C0 26227Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X16 0x100 26327Sjchu #define PCIE_LINKSTS_NEG_WIDTH_X32 0x200 26427Sjchu #define PCIE_LINKSTS_NEG_WIDTH_MASK 0x3F0 /* Negotiated Link Width */ 26527Sjchu 26627Sjchu #define PCIE_LINKSTS_TRAINING_ERROR 0x400 /* Training Error */ 26727Sjchu #define PCIE_LINKSTS_LINK_TRAINING 0x800 /* Link Training */ 26827Sjchu #define PCIE_LINKSTS_SLOT_CLK_CFG 0x1000 /* Slot Clock Configuration */ 26927Sjchu 2701786Sjj156685 /* PCIe v1.1 spec based */ 2711786Sjj156685 #define PCIE_LINKSTS_DLL_LINK_ACTIVE 0x2000 /* DLL Link Active */ 2721786Sjj156685 27327Sjchu /* 274881Sjohnny * Slot Capability Register (4 bytes) 27527Sjchu */ 27627Sjchu #define PCIE_SLOTCAP_ATTN_BUTTON 0x1 /* Attention Button Present */ 27727Sjchu #define PCIE_SLOTCAP_POWER_CONTROLLER 0x2 /* Power Controller Present */ 27827Sjchu #define PCIE_SLOTCAP_MRL_SENSOR 0x4 /* MRL Sensor Present */ 27927Sjchu #define PCIE_SLOTCAP_ATTN_INDICATOR 0x8 /* Attn Indicator Present */ 28027Sjchu #define PCIE_SLOTCAP_PWR_INDICATOR 0x10 /* Power Indicator Present */ 28127Sjchu #define PCIE_SLOTCAP_HP_SURPRISE 0x20 /* Hot-Plug Surprise */ 28227Sjchu #define PCIE_SLOTCAP_HP_CAPABLE 0x40 /* Hot-Plug Capable */ 28327Sjchu 28427Sjchu #define PCIE_SLOTCAP_PLMT_VAL_SHIFT 7 /* Slot Pwr Limit Value Shift */ 28527Sjchu #define PCIE_SLOTCAP_PLMT_VAL_MASK 0xFF /* Slot Pwr Limit Value */ 28627Sjchu 28727Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_1 0x00000 /* 1x Scale */ 28827Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_10 0x08000 /* 0.1x Scale */ 28927Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_100 0x10000 /* 0.01x Scale */ 29027Sjchu #define PCIE_SLOTCAP_PLMT_SCL_1_BY_1000 0x18000 /* 0.001x Scale */ 29127Sjchu #define PCIE_SLOTCAP_PLMT_SCL_MASK 0x18000 /* Slot Power Limit Scale */ 292881Sjohnny #define PCIE_SLOTCAP_EMI_LOCK_PRESENT 0x20000 /* EMI Lock Present */ 293881Sjohnny #define PCIE_SLOTCAP_NO_CMD_COMP_SUPP 0x40000 /* No Command Comp. Supported */ 29427Sjchu 29527Sjchu #define PCIE_SLOTCAP_PHY_SLOT_NUM_SHIFT 19 /* Physical Slot Num Shift */ 29627Sjchu #define PCIE_SLOTCAP_PHY_SLOT_NUM_MASK 0x1FFF /* Physical Slot Num Mask */ 29727Sjchu 298881Sjohnny #define PCIE_SLOTCAP_PHY_SLOT_NUM(reg) \ 299881Sjohnny (((reg) >> PCIE_SLOTCAP_PHY_SLOT_NUM_SHIFT) & \ 300881Sjohnny PCIE_SLOTCAP_PHY_SLOT_NUM_MASK) 301881Sjohnny 30227Sjchu /* 303881Sjohnny * Slot Control Register (2 bytes) 30427Sjchu */ 30527Sjchu #define PCIE_SLOTCTL_ATTN_BTN_EN 0x1 /* Attn Button Pressed Enable */ 30627Sjchu #define PCIE_SLOTCTL_PWR_FAULT_EN 0x2 /* Pwr Fault Detected Enable */ 30727Sjchu #define PCIE_SLOTCTL_MRL_SENSOR_EN 0x4 /* MRL Sensor Changed Enable */ 30827Sjchu #define PCIE_SLOTCTL_PRESENCE_CHANGE_EN 0x8 /* Presence Detect Changed En */ 30927Sjchu #define PCIE_SLOTCTL_CMD_INTR_EN 0x10 /* CMD Completed Interrupt En */ 31027Sjchu #define PCIE_SLOTCTL_HP_INTR_EN 0x20 /* Hot-Plug Interrupt Enable */ 311881Sjohnny #define PCIE_SLOTCTL_PWR_CONTROL 0x0400 /* Power controller Control */ 312881Sjohnny #define PCIE_SLOTCTL_EMI_LOCK_CONTROL 0x0800 /* EMI Lock control */ 3131786Sjj156685 #define PCIE_SLOTCTL_DLL_STATE_EN 0x1000 /* DLL State Changed En */ 314881Sjohnny #define PCIE_SLOTCTL_ATTN_INDICATOR_MASK 0x00C0 /* Attn Indicator mask */ 315881Sjohnny #define PCIE_SLOTCTL_PWR_INDICATOR_MASK 0x0300 /* Power Indicator mask */ 316*10923SEvan.Yan@Sun.COM #define PCIE_SLOTCTL_INTR_MASK 0x103f /* Supported intr mask */ 31727Sjchu 318881Sjohnny /* State values for the Power and Attention Indicators */ 319881Sjohnny #define PCIE_SLOTCTL_INDICATOR_STATE_ON 0x1 /* indicator ON */ 320881Sjohnny #define PCIE_SLOTCTL_INDICATOR_STATE_BLINK 0x2 /* indicator BLINK */ 321881Sjohnny #define PCIE_SLOTCTL_INDICATOR_STATE_OFF 0x3 /* indicator OFF */ 32227Sjchu 32327Sjchu /* 324881Sjohnny * Macros to set/get the state of Power and Attention Indicators 325881Sjohnny * in the PCI Express Slot Control Register. 326881Sjohnny */ 327881Sjohnny #define pcie_slotctl_pwr_indicator_get(reg) \ 328881Sjohnny (((reg) & PCIE_SLOTCTL_PWR_INDICATOR_MASK) >> 8) 329881Sjohnny #define pcie_slotctl_attn_indicator_get(ctrl) \ 330881Sjohnny (((ctrl) & PCIE_SLOTCTL_ATTN_INDICATOR_MASK) >> 6) 331881Sjohnny #define pcie_slotctl_attn_indicator_set(ctrl, v)\ 332881Sjohnny (((ctrl) & ~PCIE_SLOTCTL_ATTN_INDICATOR_MASK) | ((v) << 6)) 333881Sjohnny #define pcie_slotctl_pwr_indicator_set(ctrl, v)\ 334881Sjohnny (((ctrl) & ~PCIE_SLOTCTL_PWR_INDICATOR_MASK) | ((v) << 8)) 335881Sjohnny 336881Sjohnny /* 337881Sjohnny * Slot Status register (2 bytes) 33827Sjchu */ 33927Sjchu #define PCIE_SLOTSTS_ATTN_BTN_PRESSED 0x1 /* Attention Button Pressed */ 34027Sjchu #define PCIE_SLOTSTS_PWR_FAULT_DETECTED 0x2 /* Power Fault Detected */ 34127Sjchu #define PCIE_SLOTSTS_MRL_SENSOR_CHANGED 0x4 /* MRL Sensor Changed */ 34227Sjchu #define PCIE_SLOTSTS_PRESENCE_CHANGED 0x8 /* Presence Detect Changed */ 34327Sjchu #define PCIE_SLOTSTS_COMMAND_COMPLETED 0x10 /* Command Completed */ 344881Sjohnny #define PCIE_SLOTSTS_MRL_SENSOR_OPEN 0x20 /* MRL Sensor Open */ 34527Sjchu #define PCIE_SLOTSTS_PRESENCE_DETECTED 0x40 /* Card Present in slot */ 346881Sjohnny #define PCIE_SLOTSTS_EMI_LOCK_SET 0x0080 /* EMI Lock set */ 347881Sjohnny #define PCIE_SLOTSTS_DLL_STATE_CHANGED 0x0100 /* DLL State Changed */ 348*10923SEvan.Yan@Sun.COM #define PCIE_SLOTSTS_STATUS_EVENTS 0x11f /* Supported events */ 34927Sjchu 35027Sjchu /* 351881Sjohnny * Root Control Register (2 bytes) 35227Sjchu */ 35327Sjchu #define PCIE_ROOTCTL_SYS_ERR_ON_CE_EN 0x1 /* Sys Err on Cor Err Enable */ 35427Sjchu #define PCIE_ROOTCTL_SYS_ERR_ON_NFE_EN 0x2 /* Sys Err on NF Err Enable */ 355881Sjohnny #define PCIE_ROOTCTL_SYS_ERR_ON_FE_EN 0x4 /* Sys Err on Fatal Err En */ 356881Sjohnny #define PCIE_ROOTCTL_PME_INTERRUPT_EN 0x8 /* PME Interrupt Enable */ 35727Sjchu 35827Sjchu /* 359881Sjohnny * Root Status Register (4 bytes) 36027Sjchu */ 36127Sjchu #define PCIE_ROOTSTS_PME_REQ_ID_SHIFT 0 /* PME Requestor ID */ 36227Sjchu #define PCIE_ROOTSTS_PME_REQ_ID_MASK 0xFFFF /* PME Requestor ID */ 36327Sjchu 36427Sjchu #define PCIE_ROOTSTS_PME_STATUS 0x10000 /* PME Status */ 36527Sjchu #define PCIE_ROOTSTS_PME_PENDING 0x20000 /* PME Pending */ 36627Sjchu 367*10923SEvan.Yan@Sun.COM /* 368*10923SEvan.Yan@Sun.COM * Device Capabilities 2 Register (4 bytes) 369*10923SEvan.Yan@Sun.COM */ 370*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_COM_TO_RANGE_MASK 0xF 371*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_COM_TO_DISABLE 0x10 372*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_ARI_FORWARD 0x20 373*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_ATOMICOP_ROUTING 0x40 374*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_32_ATOMICOP_COMPL 0x80 375*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_64_ATOMICOP_COMPL 0x100 376*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_128_CAS_COMPL 0x200 377*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_NO_RO_PR_PR_PASS 0x400 378*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_LTR_MECH 0x800 379*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_TPH_COMP_SHIFT 12 380*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_TPH_COMP_MASK 0x3 381*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_EXT_FMT_FIELD 0x100000 382*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_END_END_TLP_PREFIX 0x200000 383*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_MAX_END_END_SHIFT 22 384*10923SEvan.Yan@Sun.COM #define PCIE_DEVCAP2_MAX_END_END_MASK 0x3 385*10923SEvan.Yan@Sun.COM 386*10923SEvan.Yan@Sun.COM /* 387*10923SEvan.Yan@Sun.COM * Device Control 2 Register (2 bytes) 388*10923SEvan.Yan@Sun.COM */ 389*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_0 0x0 390*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_1 0x1 391*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_2 0x2 392*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_3 0x5 393*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_4 0x6 394*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_5 0x9 395*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_6 0xa 396*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_7 0xd 397*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_RANGE_8 0xe 398*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_COM_TO_DISABLE 0x10 399*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_ARI_FORWARD_EN 0x20 400*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_ATOMICOP_REQ_EN 0x40 401*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_ATOMICOP_EGRS_BLK 0x80 402*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_IDO_REQ_EN 0x100 403*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_IDO_COMPL_EN 0x200 404*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_LTR_MECH_EN 0x400 405*10923SEvan.Yan@Sun.COM #define PCIE_DEVCTL2_END_END_TLP_PREFIX 0x8000 406*10923SEvan.Yan@Sun.COM 407*10923SEvan.Yan@Sun.COM 408*10923SEvan.Yan@Sun.COM 409*10923SEvan.Yan@Sun.COM 41027Sjchu 41127Sjchu /* 41227Sjchu * PCI-Express Enhanced Capabilities Link Entry Bit Offsets 41327Sjchu */ 41427Sjchu #define PCIE_EXT_CAP 0x100 /* Base Address of Ext Cap */ 41527Sjchu 41627Sjchu #define PCIE_EXT_CAP_ID_SHIFT 0 /* PCI-e Ext Cap ID */ 41727Sjchu #define PCIE_EXT_CAP_ID_MASK 0xFFFF 41827Sjchu #define PCIE_EXT_CAP_VER_SHIFT 16 /* PCI-e Ext Cap Ver */ 41927Sjchu #define PCIE_EXT_CAP_VER_MASK 0xF 42027Sjchu #define PCIE_EXT_CAP_NEXT_PTR_SHIFT 20 /* PCI-e Ext Cap Next Ptr */ 42127Sjchu #define PCIE_EXT_CAP_NEXT_PTR_MASK 0xFFF 42227Sjchu 42327Sjchu #define PCIE_EXT_CAP_NEXT_PTR_NULL 0x0 42427Sjchu 42527Sjchu /* 42627Sjchu * PCI-Express Enhanced Capability Identifier Values 42727Sjchu */ 42827Sjchu #define PCIE_EXT_CAP_ID_AER 0x1 /* Advanced Error Handling */ 4293070Sanish #define PCIE_EXT_CAP_ID_VC 0x2 /* Virtual Channel, no MFVC */ 43027Sjchu #define PCIE_EXT_CAP_ID_SER 0x3 /* Serial Number */ 43127Sjchu #define PCIE_EXT_CAP_ID_PWR_BUDGET 0x4 /* Power Budgeting */ 4323070Sanish #define PCIE_EXT_CAP_ID_RC_LINK_DECL 0x5 /* RC Link Declaration */ 4333070Sanish #define PCIE_EXT_CAP_ID_RC_INT_LINKCTRL 0x6 /* RC Internal Link Control */ 4343070Sanish #define PCIE_EXT_CAP_ID_RC_EVNT_CEA 0x7 /* RC Event Collector */ 4353070Sanish /* Endpoint Association */ 4363070Sanish #define PCIE_EXT_CAP_ID_MFVC 0x8 /* Multi-func Virtual Channel */ 4373070Sanish #define PCIE_EXT_CAP_ID_VC_WITH_MFVC 0x9 /* Virtual Channel w/ MFVC */ 4383070Sanish #define PCIE_EXT_CAP_ID_RCRB 0xA /* Root Complex Register Blck */ 4393070Sanish #define PCIE_EXT_CAP_ID_VS 0xB /* Vendor Spec Extended Cap */ 4403070Sanish #define PCIE_EXT_CAP_ID_CAC 0xC /* Config Access Correlation */ 4413070Sanish #define PCIE_EXT_CAP_ID_ACS 0xD /* Access Control Services */ 4423070Sanish #define PCIE_EXT_CAP_ID_ARI 0xE /* Alternative Routing ID */ 4433070Sanish #define PCIE_EXT_CAP_ID_ATS 0xF /* Address Translation Svcs */ 44427Sjchu 44527Sjchu /* 44627Sjchu * PCI-Express Advanced Error Reporting Extended Capability Offsets 44727Sjchu */ 44827Sjchu #define PCIE_AER_CAP 0x0 /* Enhanced Capability Header */ 44927Sjchu #define PCIE_AER_UCE_STS 0x4 /* Uncorrectable Error Status */ 45027Sjchu #define PCIE_AER_UCE_MASK 0x8 /* Uncorrectable Error Mask */ 45127Sjchu #define PCIE_AER_UCE_SERV 0xc /* Uncor Error Severity */ 45227Sjchu #define PCIE_AER_CE_STS 0x10 /* Correctable Error Status */ 45327Sjchu #define PCIE_AER_CE_MASK 0x14 /* Correctable Error Mask */ 45427Sjchu #define PCIE_AER_CTL 0x18 /* AER Capability & Control */ 45527Sjchu #define PCIE_AER_HDR_LOG 0x1c /* Header Log */ 45627Sjchu 45727Sjchu /* Root Ports Only */ 45827Sjchu #define PCIE_AER_RE_CMD 0x2c /* Root Error Command */ 45927Sjchu #define PCIE_AER_RE_STS 0x30 /* Root Error Status */ 46027Sjchu #define PCIE_AER_CE_SRC_ID 0x34 /* Error Source ID */ 46127Sjchu #define PCIE_AER_ERR_SRC_ID 0x36 /* Error Source ID */ 46227Sjchu 46327Sjchu /* Bridges Only */ 46427Sjchu #define PCIE_AER_SUCE_STS 0x2c /* Secondary UCE Status */ 46527Sjchu #define PCIE_AER_SUCE_MASK 0x30 /* Secondary UCE Mask */ 46627Sjchu #define PCIE_AER_SUCE_SERV 0x34 /* Secondary UCE Severity */ 46727Sjchu #define PCIE_AER_SCTL 0x38 /* Secondary Cap & Ctl */ 46827Sjchu #define PCIE_AER_SHDR_LOG 0x3c /* Secondary Header Log */ 46927Sjchu 47027Sjchu /* 47127Sjchu * AER Uncorrectable Error Status/Mask/Severity Register 47227Sjchu */ 4731865Sdilpreet #define PCIE_AER_UCE_TRAINING 0x1 /* Training Error Status */ 47427Sjchu #define PCIE_AER_UCE_DLP 0x10 /* Data Link Protocol Error */ 4751865Sdilpreet #define PCIE_AER_UCE_SD 0x20 /* Link Surprise down */ 47627Sjchu #define PCIE_AER_UCE_PTLP 0x1000 /* Poisoned TLP Status */ 47727Sjchu #define PCIE_AER_UCE_FCP 0x2000 /* Flow Control Protocol Sts */ 47827Sjchu #define PCIE_AER_UCE_TO 0x4000 /* Completion Timeout Status */ 47927Sjchu #define PCIE_AER_UCE_CA 0x8000 /* Completer Abort Status */ 48027Sjchu #define PCIE_AER_UCE_UC 0x10000 /* Unexpected Completion Sts */ 48127Sjchu #define PCIE_AER_UCE_RO 0x20000 /* Receiver Overflow Status */ 48227Sjchu #define PCIE_AER_UCE_MTLP 0x40000 /* Malformed TLP Status */ 48327Sjchu #define PCIE_AER_UCE_ECRC 0x80000 /* ECRC Error Status */ 4841865Sdilpreet #define PCIE_AER_UCE_UR 0x100000 /* Unsupported Req */ 48527Sjchu #define PCIE_AER_UCE_BITS (PCIE_AER_UCE_TRAINING | \ 4861865Sdilpreet PCIE_AER_UCE_DLP | PCIE_AER_UCE_SD | PCIE_AER_UCE_PTLP | \ 4871865Sdilpreet PCIE_AER_UCE_FCP | PCIE_AER_UCE_TO | PCIE_AER_UCE_CA | \ 4881865Sdilpreet PCIE_AER_UCE_UC | PCIE_AER_UCE_RO | PCIE_AER_UCE_MTLP | \ 4891865Sdilpreet PCIE_AER_UCE_ECRC | PCIE_AER_UCE_UR) 4901865Sdilpreet #define PCIE_AER_UCE_LOG_BITS (PCIE_AER_UCE_PTLP | PCIE_AER_UCE_CA | \ 4911865Sdilpreet PCIE_AER_UCE_UC | PCIE_AER_UCE_MTLP | PCIE_AER_UCE_ECRC | PCIE_AER_UCE_UR) 49227Sjchu 49327Sjchu /* 49427Sjchu * AER Correctable Error Status/Mask Register 49527Sjchu */ 49627Sjchu #define PCIE_AER_CE_RECEIVER_ERR 0x1 /* Receiver Error Status */ 49727Sjchu #define PCIE_AER_CE_BAD_TLP 0x40 /* Bad TLP Status */ 49827Sjchu #define PCIE_AER_CE_BAD_DLLP 0x80 /* Bad DLLP Status */ 49927Sjchu #define PCIE_AER_CE_REPLAY_ROLLOVER 0x100 /* REPLAY_NUM Rollover Status */ 50027Sjchu #define PCIE_AER_CE_REPLAY_TO 0x1000 /* Replay Timer Timeout Sts */ 5011865Sdilpreet #define PCIE_AER_CE_AD_NFE 0x2000 /* Advisory Non-Fatal Status */ 50227Sjchu #define PCIE_AER_CE_BITS (PCIE_AER_CE_RECEIVER_ERR | \ 50327Sjchu PCIE_AER_CE_BAD_TLP | PCIE_AER_CE_BAD_DLLP | PCIE_AER_CE_REPLAY_ROLLOVER | \ 50427Sjchu PCIE_AER_CE_REPLAY_TO) 50527Sjchu 50627Sjchu /* 50727Sjchu * AER Capability & Control 50827Sjchu */ 50927Sjchu #define PCIE_AER_CTL_FST_ERR_PTR_MASK 0x1F /* First Error Pointer */ 51027Sjchu #define PCIE_AER_CTL_ECRC_GEN_CAP 0x20 /* ECRC Generation Capable */ 51127Sjchu #define PCIE_AER_CTL_ECRC_GEN_ENA 0x40 /* ECRC Generation Enable */ 51227Sjchu #define PCIE_AER_CTL_ECRC_CHECK_CAP 0x80 /* ECRC Check Capable */ 51327Sjchu #define PCIE_AER_CTL_ECRC_CHECK_ENA 0x100 /* ECRC Check Enable */ 51427Sjchu 51527Sjchu /* 51627Sjchu * AER Root Command Register 51727Sjchu */ 51827Sjchu #define PCIE_AER_RE_CMD_CE_REP_EN 0x1 /* Correctable Error Enable */ 51927Sjchu #define PCIE_AER_RE_CMD_NFE_REP_EN 0x2 /* Non-Fatal Error Enable */ 52027Sjchu #define PCIE_AER_RE_CMD_FE_REP_EN 0x4 /* Fatal Error Enable */ 52127Sjchu 52227Sjchu /* 52327Sjchu * AER Root Error Status Register 52427Sjchu */ 52527Sjchu #define PCIE_AER_RE_STS_CE_RCVD 0x1 /* ERR_COR Received */ 52627Sjchu #define PCIE_AER_RE_STS_MUL_CE_RCVD 0x2 /* Multiple ERR_COR Received */ 52727Sjchu #define PCIE_AER_RE_STS_FE_NFE_RCVD 0x4 /* FATAL/NON-FATAL Received */ 52827Sjchu #define PCIE_AER_RE_STS_MUL_FE_NFE_RCVD 0x8 /* Multiple ERR_F/NF Received */ 52927Sjchu #define PCIE_AER_RE_STS_FIRST_UC_FATAL 0x10 /* First Uncorrectable Fatal */ 53027Sjchu #define PCIE_AER_RE_STS_NFE_MSGS_RCVD 0x20 /* Non-Fatal Error Msgs Rcvd */ 53127Sjchu #define PCIE_AER_RE_STS_FE_MSGS_RCVD 0x40 /* Fatal Error Messages Rcvd */ 53227Sjchu 53327Sjchu #define PCIE_AER_RE_STS_MSG_NUM_SHIFT 27 /* Offset of Intr Msg Number */ 53427Sjchu #define PCIE_AER_RE_STS_MSG_NUM_MASK 0x1F /* Intr Msg Number Mask */ 53527Sjchu 53627Sjchu /* 53727Sjchu * AER Error Source Identification Register 53827Sjchu */ 53927Sjchu #define PCIE_AER_ERR_SRC_ID_CE_SHIFT 0 /* ERR_COR Source ID */ 54027Sjchu #define PCIE_AER_ERR_SRC_ID_CE_MASK 0xFFFF 54127Sjchu #define PCIE_AER_ERR_SRC_ID_UE_SHIFT 16 /* ERR_FATAL/NONFATAL Src ID */ 5426313Skrishnae #define PCIE_AER_ERR_SRC_ID_UE_MASK 0xFFFF 54327Sjchu 54427Sjchu /* 54527Sjchu * AER Secondary Uncorrectable Error Register 54627Sjchu */ 54727Sjchu #define PCIE_AER_SUCE_TA_ON_SC 0x1 /* Target Abort on Split Comp */ 54827Sjchu #define PCIE_AER_SUCE_MA_ON_SC 0x2 /* Master Abort on Split Comp */ 54927Sjchu #define PCIE_AER_SUCE_RCVD_TA 0x4 /* Received Target Abort */ 55027Sjchu #define PCIE_AER_SUCE_RCVD_MA 0x8 /* Received Master Abort */ 55127Sjchu #define PCIE_AER_SUCE_USC_ERR 0x20 /* Unexpected Split Comp Err */ 55227Sjchu #define PCIE_AER_SUCE_USC_MSG_DATA_ERR 0x40 /* USC Message Data Error */ 55327Sjchu #define PCIE_AER_SUCE_UC_DATA_ERR 0x80 /* Uncorrectable Data Error */ 55427Sjchu #define PCIE_AER_SUCE_UC_ATTR_ERR 0x100 /* UC Attribute Err */ 55527Sjchu #define PCIE_AER_SUCE_UC_ADDR_ERR 0x200 /* Uncorrectable Address Err */ 55627Sjchu #define PCIE_AER_SUCE_TIMER_EXPIRED 0x400 /* Delayed xtion discard */ 55727Sjchu #define PCIE_AER_SUCE_PERR_ASSERT 0x800 /* PERR Assertion Detected */ 55827Sjchu #define PCIE_AER_SUCE_SERR_ASSERT 0x1000 /* SERR Assertion Detected */ 55927Sjchu #define PCIE_AER_SUCE_INTERNAL_ERR 0x2000 /* Internal Bridge Err Detect */ 5601865Sdilpreet 5611865Sdilpreet #define PCIE_AER_SUCE_HDR_CMD_LWR_MASK 0xF /* Lower Command Mask */ 5621865Sdilpreet #define PCIE_AER_SUCE_HDR_CMD_LWR_SHIFT 4 /* Lower Command Shift */ 5631865Sdilpreet #define PCIE_AER_SUCE_HDR_CMD_UP_MASK 0xF /* Upper Command Mask */ 5641865Sdilpreet #define PCIE_AER_SUCE_HDR_CMD_UP_SHIFT 8 /* Upper Command Shift */ 5651865Sdilpreet #define PCIE_AER_SUCE_HDR_ADDR_SHIFT 32 /* Upper Command Shift */ 5661865Sdilpreet 56727Sjchu #define PCIE_AER_SUCE_BITS (PCIE_AER_SUCE_TA_ON_SC | \ 56827Sjchu PCIE_AER_SUCE_MA_ON_SC | PCIE_AER_SUCE_RCVD_TA | PCIE_AER_SUCE_RCVD_MA | \ 56927Sjchu PCIE_AER_SUCE_USC_ERR | PCIE_AER_SUCE_USC_MSG_DATA_ERR | \ 57027Sjchu PCIE_AER_SUCE_UC_DATA_ERR | PCIE_AER_SUCE_UC_ATTR_ERR | \ 57127Sjchu PCIE_AER_SUCE_UC_ADDR_ERR | PCIE_AER_SUCE_TIMER_EXPIRED | \ 57227Sjchu PCIE_AER_SUCE_PERR_ASSERT | PCIE_AER_SUCE_SERR_ASSERT | \ 57327Sjchu PCIE_AER_SUCE_INTERNAL_ERR) 5741865Sdilpreet #define PCIE_AER_SUCE_LOG_BITS (PCIE_AER_SUCE_TA_ON_SC | \ 5751865Sdilpreet PCIE_AER_SUCE_MA_ON_SC | PCIE_AER_SUCE_RCVD_TA | PCIE_AER_SUCE_RCVD_MA | \ 5761865Sdilpreet PCIE_AER_SUCE_USC_ERR | PCIE_AER_SUCE_USC_MSG_DATA_ERR | \ 5771865Sdilpreet PCIE_AER_SUCE_UC_DATA_ERR | PCIE_AER_SUCE_UC_ATTR_ERR | \ 5781865Sdilpreet PCIE_AER_SUCE_UC_ADDR_ERR | PCIE_AER_SUCE_PERR_ASSERT) 57927Sjchu 58027Sjchu /* 58127Sjchu * AER Secondary Capability & Control 58227Sjchu */ 58327Sjchu #define PCIE_AER_SCTL_FST_ERR_PTR_MASK 0x1F /* First Error Pointer */ 58427Sjchu 58527Sjchu /* 58627Sjchu * AER Secondary Headers 58727Sjchu * The Secondary Header Logs is 4 DW long. 58827Sjchu * The first 2 DW are split into 3 sections 58927Sjchu * o Transaction Attribute 59027Sjchu * o Transaction Command Lower 59127Sjchu * o Transaction Command Higher 59227Sjchu * The last 2 DW is the Transaction Address 59327Sjchu */ 59427Sjchu #define PCIE_AER_SHDR_LOG_ATTR_MASK 0xFFFFFFFFF 59527Sjchu #define PCIE_AER_SHDR_LOG_CMD_LOW_MASK 0xF000000000 59627Sjchu #define PCIE_AER_SHDR_LOG_CMD_HIGH_MASK 0xF0000000000 59727Sjchu #define PCIE_AER_SHDR_LOG_ADDR_MASK 0xFFFFFFFFFFFFFFFF 59827Sjchu 59927Sjchu /* 6003162Sgovinda * PCI-Express Device Serial Number Capability Offsets. 6013162Sgovinda */ 6023162Sgovinda #define PCIE_SER_CAP 0x0 /* Enhanced Capability Header */ 6033162Sgovinda #define PCIE_SER_SID_LOWER_DW 0x4 /* Lower 32-bit Serial Number */ 6043162Sgovinda #define PCIE_SER_SID_UPPER_DW 0x8 /* Upper 32-bit Serial Number */ 6053162Sgovinda 6063162Sgovinda /* 607*10923SEvan.Yan@Sun.COM * ARI Capability Offsets 608*10923SEvan.Yan@Sun.COM */ 609*10923SEvan.Yan@Sun.COM #define PCIE_ARI_HDR 0x0 /* Enhanced Capability Header */ 610*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CAP 0x4 /* ARI Capability Register */ 611*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CTL 0x6 /* ARI Control Register */ 612*10923SEvan.Yan@Sun.COM 613*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CAP_MFVC_FUNC_GRP 0x01 614*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CAP_ASC_FUNC_GRP 0x02 615*10923SEvan.Yan@Sun.COM 616*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CAP_NEXT_FUNC_SHIFT 8 617*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CAP_NEXT_FUNC_MASK 0xffff 618*10923SEvan.Yan@Sun.COM 619*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CTRL_MFVC_FUNC_GRP 0x01 620*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CTRL_ASC_FUNC_GRP 0x02 621*10923SEvan.Yan@Sun.COM 622*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CTRL_FUNC_GRP_SHIFT 4 623*10923SEvan.Yan@Sun.COM #define PCIE_ARI_CTRL_FUNC_GRP_MASK 0x7 624*10923SEvan.Yan@Sun.COM 625*10923SEvan.Yan@Sun.COM /* 62627Sjchu * PCI-E Common TLP Header Fields 62727Sjchu */ 6281865Sdilpreet #define PCIE_TLP_FMT_3DW 0x00 62927Sjchu #define PCIE_TLP_FMT_4DW 0x20 63027Sjchu #define PCIE_TLP_FMT_3DW_DATA 0x40 63127Sjchu #define PCIE_TLP_FMT_4DW_DATA 0x60 63227Sjchu 63327Sjchu #define PCIE_TLP_TYPE_MEM 0x0 63427Sjchu #define PCIE_TLP_TYPE_MEMLK 0x1 6351865Sdilpreet #define PCIE_TLP_TYPE_IO 0x2 63627Sjchu #define PCIE_TLP_TYPE_CFG0 0x4 63727Sjchu #define PCIE_TLP_TYPE_CFG1 0x5 6381865Sdilpreet #define PCIE_TLP_TYPE_MSG 0x10 63927Sjchu #define PCIE_TLP_TYPE_CPL 0xA 64027Sjchu #define PCIE_TLP_TYPE_CPLLK 0xB 64127Sjchu #define PCIE_TLP_TYPE_MSI 0x18 64227Sjchu 64327Sjchu #define PCIE_TLP_MRD3 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_MEM) 64427Sjchu #define PCIE_TLP_MRD4 (PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MEM) 64527Sjchu #define PCIE_TLP_MRDLK3 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_MEMLK) 64627Sjchu #define PCIE_TLP_MRDLK4 (PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MEMLK) 64727Sjchu #define PCIE_TLP_MRDWR3 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_MEM) 64827Sjchu #define PCIE_TLP_MRDWR4 (PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MEM) 6491865Sdilpreet #define PCIE_TLP_IORD (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_IO) 6501865Sdilpreet #define PCIE_TLP_IOWR (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_IO) 65127Sjchu #define PCIE_TLP_CFGRD0 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CFG0) 65227Sjchu #define PCIE_TLP_CFGWR0 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CFG0) 65327Sjchu #define PCIE_TLP_CFGRD1 (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CFG1) 65427Sjchu #define PCIE_TLP_CFGWR1 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CFG1) 6551865Sdilpreet #define PCIE_TLP_MSG (PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MSG) 6561865Sdilpreet #define PCIE_TLP_MSGD (PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MSG) 65727Sjchu #define PCIE_TLP_CPL (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CPL) 65827Sjchu #define PCIE_TLP_CPLD (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CPL) 65927Sjchu #define PCIE_TLP_CPLLK (PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CPLLK) 66027Sjchu #define PCIE_TLP_CPLDLK (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CPLLK) 66127Sjchu #define PCIE_TLP_MSI32 (PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_MSI) 66227Sjchu #define PCIE_TLP_MSI64 (PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MSI) 66327Sjchu 66427Sjchu typedef uint16_t pcie_req_id_t; 66527Sjchu 66627Sjchu #define PCIE_REQ_ID_BUS_SHIFT 8 66727Sjchu #define PCIE_REQ_ID_BUS_MASK 0xFF00 66827Sjchu #define PCIE_REQ_ID_DEV_SHIFT 3 6699921SKrishna.Elango@Sun.COM #define PCIE_REQ_ID_DEV_MASK 0x00F8 67027Sjchu #define PCIE_REQ_ID_FUNC_SHIFT 0 67127Sjchu #define PCIE_REQ_ID_FUNC_MASK 0x0007 672*10923SEvan.Yan@Sun.COM #define PCIE_REQ_ID_ARI_FUNC_MASK 0x00FF 67327Sjchu 6743274Set142600 #define PCIE_CPL_STS_SUCCESS 0 6753274Set142600 #define PCIE_CPL_STS_UR 1 6763274Set142600 #define PCIE_CPL_STS_CRS 2 6773274Set142600 #define PCIE_CPL_STS_CA 4 6783274Set142600 6791865Sdilpreet #if defined(_BIT_FIELDS_LTOH) 6801865Sdilpreet /* 6811865Sdilpreet * PCI Express little-endian common TLP header format 6821865Sdilpreet */ 6831865Sdilpreet typedef struct pcie_tlp_hdr { 6841865Sdilpreet uint32_t len :10, 6851865Sdilpreet rsvd3 :2, 6861865Sdilpreet attr :2, 6871865Sdilpreet ep :1, 6881865Sdilpreet td :1, 6891865Sdilpreet rsvd2 :4, 6901865Sdilpreet tc :3, 6911865Sdilpreet rsvd1 :1, 6921865Sdilpreet type :5, 6931865Sdilpreet fmt :2, 6941865Sdilpreet rsvd0 :1; 6951865Sdilpreet } pcie_tlp_hdr_t; 6961865Sdilpreet 6971865Sdilpreet typedef struct pcie_mem64 { 6981865Sdilpreet uint32_t fbe :4, 6991865Sdilpreet lbe :4, 7001865Sdilpreet tag :8, 7011865Sdilpreet rid :16; 7021865Sdilpreet uint32_t addr1; 7031865Sdilpreet uint32_t rsvd0 :2, 7041865Sdilpreet addr0 :30; 7051865Sdilpreet } pcie_mem64_t; 7061865Sdilpreet 7071865Sdilpreet typedef struct pcie_memio32 { 7081865Sdilpreet uint32_t fbe :4, 7091865Sdilpreet lbe :4, 7101865Sdilpreet tag :8, 7111865Sdilpreet rid :16; 7121865Sdilpreet uint32_t rsvd0 :2, 7131865Sdilpreet addr0 :30; 7141865Sdilpreet } pcie_memio32_t; 7151865Sdilpreet 7161865Sdilpreet typedef struct pcie_cfg { 7171865Sdilpreet uint32_t fbe :4, 7181865Sdilpreet lbe :4, 7191865Sdilpreet tag :8, 7201865Sdilpreet rid :16; 7211865Sdilpreet uint32_t rsvd1 :2, 7221865Sdilpreet reg :6, 7231865Sdilpreet extreg :4, 7241865Sdilpreet rsvd0 :4, 7251865Sdilpreet func :3, 7261865Sdilpreet dev :5, 7271865Sdilpreet bus :8; 7281865Sdilpreet } pcie_cfg_t; 7291865Sdilpreet 7301865Sdilpreet typedef struct pcie_cpl { 7311865Sdilpreet uint32_t bc :12, 7321865Sdilpreet bcm :1, 7331865Sdilpreet status :3, 7341865Sdilpreet cid :16; 7351865Sdilpreet uint32_t laddr :7, 7361865Sdilpreet rsvd0 :1, 7371865Sdilpreet tag :8, 7381865Sdilpreet rid :16; 7391865Sdilpreet } pcie_cpl_t; 7401865Sdilpreet 74127Sjchu /* 74227Sjchu * PCI-Express Message Request Header 74327Sjchu */ 74427Sjchu typedef struct pcie_msg { 7451865Sdilpreet uint32_t msg_code:8, /* DW1 */ 7461865Sdilpreet tag :8, 7471865Sdilpreet rid :16; 7481865Sdilpreet uint32_t unused[2]; /* DW 2 & 3 */ 7491865Sdilpreet } pcie_msg_t; 7501865Sdilpreet 7511865Sdilpreet #elif defined(_BIT_FIELDS_HTOL) 7521865Sdilpreet /* 7531865Sdilpreet * PCI Express big-endian common TLP header format 7541865Sdilpreet */ 7551865Sdilpreet typedef struct pcie_tlp_hdr { 7561865Sdilpreet uint32_t rsvd0 :1, 7571865Sdilpreet fmt :2, 7581865Sdilpreet type :5, 7591865Sdilpreet rsvd1 :1, 7601865Sdilpreet tc :3, 7611865Sdilpreet rsvd2 :4, 76227Sjchu td :1, 76327Sjchu ep :1, 76427Sjchu attr :2, 7651865Sdilpreet rsvd3 :2, 76627Sjchu len :10; 7671865Sdilpreet } pcie_tlp_hdr_t; 7681865Sdilpreet 7691865Sdilpreet typedef struct pcie_mem64 { 7701865Sdilpreet uint32_t rid :16, 7711865Sdilpreet tag :8, 7721865Sdilpreet lbe :4, 7731865Sdilpreet fbe :4; 7741865Sdilpreet uint32_t addr1; 7751865Sdilpreet uint32_t addr0 :30, 7761865Sdilpreet rsvd0 :2; 7771865Sdilpreet } pcie_mem64_t; 7781865Sdilpreet 7791865Sdilpreet typedef struct pcie_memio32 { 7801865Sdilpreet uint32_t rid :16, 7811865Sdilpreet tag :8, 7821865Sdilpreet lbe :4, 7831865Sdilpreet fbe :4; 7841865Sdilpreet uint32_t addr0 :30, 7851865Sdilpreet rsvd0 :2; 7861865Sdilpreet } pcie_memio32_t; 7871865Sdilpreet 7881865Sdilpreet typedef struct pcie_cfg { 7891865Sdilpreet uint32_t rid :16, 7901865Sdilpreet tag :8, 7911865Sdilpreet lbe :4, 7921865Sdilpreet fbe :4; 7931865Sdilpreet uint32_t bus :8, 7941865Sdilpreet dev :5, 7951865Sdilpreet func :3, 7961865Sdilpreet rsvd0 :4, 7971865Sdilpreet extreg :4, 7981865Sdilpreet reg :6, 7991865Sdilpreet rsvd1 :2; 8001865Sdilpreet } pcie_cfg_t; 8011865Sdilpreet 8021865Sdilpreet typedef struct pcie_cpl { 8031865Sdilpreet uint32_t cid :16, 8041865Sdilpreet status :3, 8051865Sdilpreet bcm :1, 8061865Sdilpreet bc :12; 8071865Sdilpreet uint32_t rid :16, 8081865Sdilpreet tag :8, 8091865Sdilpreet rsvd0 :1, 8101865Sdilpreet laddr :7; 8111865Sdilpreet } pcie_cpl_t; 8121865Sdilpreet 8131865Sdilpreet /* 8141865Sdilpreet * PCI-Express Message Request Header 8151865Sdilpreet */ 8161865Sdilpreet typedef struct pcie_msg { 81727Sjchu uint32_t rid :16, /* DW1 */ 81827Sjchu tag :8, 81927Sjchu msg_code:8; 82027Sjchu uint32_t unused[2]; /* DW 2 & 3 */ 82127Sjchu } pcie_msg_t; 8221865Sdilpreet #else 8231865Sdilpreet #error "bit field not defined" 8241865Sdilpreet #endif 82527Sjchu 82627Sjchu #define PCIE_MSG_CODE_ERR_COR 0x30 82727Sjchu #define PCIE_MSG_CODE_ERR_NONFATAL 0x31 82827Sjchu #define PCIE_MSG_CODE_ERR_FATAL 0x33 82927Sjchu 83027Sjchu #ifdef __cplusplus 83127Sjchu } 83227Sjchu #endif 83327Sjchu 83427Sjchu #endif /* _SYS_PCIE_H */ 835