xref: /titanic_41/usr/src/uts/common/sys/pcie.h (revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_PCIE_H
27 #define	_SYS_PCIE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/pci.h>
36 
37 /*
38  * PCI Express capability registers in PCI configuration space relative to
39  * the PCI Express Capability structure.
40  */
41 #define	PCIE_CAP_ID			PCI_CAP_ID
42 #define	PCIE_CAP_NEXT_PTR		PCI_CAP_NEXT_PTR
43 #define	PCIE_PCIECAP			0x02	/* PCI-e Capability Reg */
44 #define	PCIE_DEVCAP			0x04	/* Device Capability */
45 #define	PCIE_DEVCTL			0x08	/* Device Control */
46 #define	PCIE_DEVSTS			0x0A	/* Device Status */
47 #define	PCIE_LINKCAP			0x0C	/* Link Capability */
48 #define	PCIE_LINKCTL			0x10	/* Link Control */
49 #define	PCIE_LINKSTS			0x12	/* Link Status */
50 #define	PCIE_SLOTCAP			0x14	/* Slot Capability */
51 #define	PCIE_SLOTCTL			0x18	/* Slot Control */
52 #define	PCIE_SLOTSTS			0x1A	/* Slot Status */
53 #define	PCIE_ROOTCTL			0x1C	/* Root Control */
54 #define	PCIE_ROOTSTS			0x20	/* Root Status */
55 
56 /*
57  * PCI-Express Config Space size
58  */
59 #define	PCIE_CONF_HDR_SIZE	4096	/* PCIe configuration header size */
60 
61 /*
62  * PCI-Express Capabilities Register (2 bytes)
63  */
64 #define	PCIE_PCIECAP_VER_1_0		0x1	/* PCI-E spec 1.0 */
65 #define	PCIE_PCIECAP_VER_MASK		0xF	/* Version Mask */
66 #define	PCIE_PCIECAP_DEV_TYPE_PCIE_DEV	0x00	/* PCI-E Endpont Device */
67 #define	PCIE_PCIECAP_DEV_TYPE_PCI_DEV	0x10	/* Leg PCI Endpont Device */
68 #define	PCIE_PCIECAP_DEV_TYPE_ROOT	0x40	/* Root Port of Root Complex */
69 #define	PCIE_PCIECAP_DEV_TYPE_UP	0x50	/* Upstream Port of Switch */
70 #define	PCIE_PCIECAP_DEV_TYPE_DOWN	0x60	/* Downstream Port of Switch */
71 #define	PCIE_PCIECAP_DEV_TYPE_PCIE2PCI	0x70	/* PCI-E to PCI Bridge */
72 #define	PCIE_PCIECAP_DEV_TYPE_PCI2PCIE	0x80	/* PCI to PCI-E Bridge */
73 #define	PCIE_PCIECAP_DEV_TYPE_MASK	0xF0	/* Device/Port Type Mask */
74 #define	PCIE_PCIECAP_SLOT_IMPL		0x100	/* Slot Impl vs Integrated */
75 #define	PCIE_PCIECAP_INT_MSG_NUM	0x3700	/* Interrupt Message Number */
76 
77 /*
78  * Device Capabilities Register (4 bytes)
79  */
80 #define	PCIE_DEVCAP_MAX_PAYLOAD_128	0x0
81 #define	PCIE_DEVCAP_MAX_PAYLOAD_256	0x1
82 #define	PCIE_DEVCAP_MAX_PAYLOAD_512	0x2
83 #define	PCIE_DEVCAP_MAX_PAYLOAD_1024	0x3
84 #define	PCIE_DEVCAP_MAX_PAYLOAD_2048	0x4
85 #define	PCIE_DEVCAP_MAX_PAYLOAD_4096	0x5
86 #define	PCIE_DEVCAP_MAX_PAYLOAD_MASK	0x7	/* Max Payload Size Supported */
87 
88 #define	PCIE_DEVCAP_PHTM_FUNC_NONE	0x00	/* No Function # bits used */
89 #define	PCIE_DEVCAP_PHTM_FUNC_ONE	0x08	/* First most sig. bit used */
90 #define	PCIE_DEVCAP_PHTM_FUNC_TWO	0x10	/* First 2 most sig bit used */
91 #define	PCIE_DEVCAP_PHTM_FUNC_THREE	0x18	/* All 3 bits used */
92 #define	PCIE_DEVCAP_PHTM_FUNC_MASK	0x18	/* Phantom Func Supported */
93 
94 #define	PCIE_DEVCAP_EXT_TAG_5BIT	0x00	/* 5-Bit Tag Field Supported */
95 #define	PCIE_DEVCAP_EXT_TAG_8BIT	0x20	/* 8-Bit Tag Field Supported */
96 #define	PCIE_DEVCAP_EXT_TAG_MASK	0x20	/* Ext. Tag Field Supported */
97 
98 #define	PCIE_DEVCAP_EP_L0S_LAT_MIN	0x000	/* < 64 ns */
99 #define	PCIE_DEVCAP_EP_L0S_LAT_64ns	0x040	/* 64 ns - 128 ns */
100 #define	PCIE_DEVCAP_EP_L0S_LAT_128ns	0x080	/* 128 ns - 256 ns */
101 #define	PCIE_DEVCAP_EP_L0S_LAT_256ns	0x0C0	/* 256 ns - 512 ns */
102 #define	PCIE_DEVCAP_EP_L0S_LAT_512ns	0x100	/* 512 ns - 1 us */
103 #define	PCIE_DEVCAP_EP_L0S_LAT_1us	0x140	/* 1 us - 2 us */
104 #define	PCIE_DEVCAP_EP_L0S_LAT_2us	0x180	/* 2 us - 4 us */
105 #define	PCIE_DEVCAP_EP_L0S_LAT_MAX	0x1C0	/* > 4 us */
106 #define	PCIE_DEVCAP_EP_L0S_LAT_MASK	0x1C0	/* EP L0s Accetable Latency */
107 
108 #define	PCIE_DEVCAP_EP_L1_LAT_MIN	0x000	/* < 1 us */
109 #define	PCIE_DEVCAP_EP_L1_LAT_1us	0x140	/* 1 us - 2 us */
110 #define	PCIE_DEVCAP_EP_L1_LAT_2us	0x180	/* 2 us - 4 us */
111 #define	PCIE_DEVCAP_EP_L1_LAT_4us	0x140	/* 4 us - 8 us */
112 #define	PCIE_DEVCAP_EP_L1_LAT_8us	0x180	/* 8 us - 16 us */
113 #define	PCIE_DEVCAP_EP_L1_LAT_16us	0x140	/* 16 us - 32 us */
114 #define	PCIE_DEVCAP_EP_L1_LAT_32us	0x180	/* 32 us - 64 us */
115 #define	PCIE_DEVCAP_EP_L1_LAT_MAX	0x1C0	/* > 64 us */
116 #define	PCIE_DEVCAP_EP_L1_LAT_MASK	0x700	/* EP L1 Accetable Latency */
117 
118 #define	PCIE_DEVCAP_ATTN_BUTTON		0x1000	/* Attention Button Present */
119 #define	PCIE_DEVCAP_ATTN_INDICATOR	0x2000	/* Attn Indicator Present */
120 #define	PCIE_DEVCAP_PWR_INDICATOR	0x4000	/* Power Indicator Present */
121 
122 #define	PCIE_DEVCAP_ROLE_BASED_ERR_REP	0x8000	/* Role Based Error Reporting */
123 
124 #define	PCIE_DEVCAP_PLMT_VAL_SHIFT	18	/* Power Limit Value Shift */
125 #define	PCIE_DEVCAP_PLMT_VAL_MASK	0xFF	/* Power Limit Value Mask */
126 
127 #define	PCIE_DEVCAP_PLMT_SCL_1_BY_1	0x0000000	/* 1x Scale */
128 #define	PCIE_DEVCAP_PLMT_SCL_1_BY_10	0x4000000	/* 0.1x Scale */
129 #define	PCIE_DEVCAP_PLMT_SCL_1_BY_100	0x8000000	/* 0.01x Scale */
130 #define	PCIE_DEVCAP_PLMT_SCL_1_BY_1000	0xC000000	/* 0.001x Scale */
131 #define	PCIE_DEVCAP_PLMT_SCL_MASK	0xC000000	/* Power Limit Scale */
132 
133 /*
134  * Device Control Register (2 bytes)
135  */
136 #define	PCIE_DEVCTL_CE_REPORTING_EN	0x1	/* Correctable Error Enable */
137 #define	PCIE_DEVCTL_NFE_REPORTING_EN	0x2	/* Non-Fatal Error Enable */
138 #define	PCIE_DEVCTL_FE_REPORTING_EN	0x4	/* Fatal Error Enable */
139 #define	PCIE_DEVCTL_UR_REPORTING_EN	0x8	/* Unsupported Request Enable */
140 #define	PCIE_DEVCTL_RO_EN		0x10	/* Enable Relaxed Ordering */
141 
142 #define	PCIE_DEVCTL_MAX_PAYLOAD_128	0x00
143 #define	PCIE_DEVCTL_MAX_PAYLOAD_256	0x20
144 #define	PCIE_DEVCTL_MAX_PAYLOAD_512	0x40
145 #define	PCIE_DEVCTL_MAX_PAYLOAD_1024	0x60
146 #define	PCIE_DEVCTL_MAX_PAYLOAD_2048	0x80
147 #define	PCIE_DEVCTL_MAX_PAYLOAD_4096	0xA0
148 #define	PCIE_DEVCTL_MAX_PAYLOAD_MASK	0xE0	/* Max_Payload_Size */
149 
150 #define	PCIE_DEVCTL_EXT_TAG_FIELD_EN	0x100	/* Extended Tag Field Enable */
151 #define	PCIE_DEVCTL_PHTM_FUNC_EN	0x200	/* Phantom Functions Enable */
152 #define	PCIE_DEVCTL_AUX_POWER_PM_EN	0x400	/* Auxiliary Power PM Enable */
153 #define	PCIE_DEVCTL_ENABLE_NO_SNOOP	0x800	/* Enable No Snoop */
154 
155 #define	PCIE_DEVCTL_MAX_READ_REQ_128	0x00
156 #define	PCIE_DEVCTL_MAX_READ_REQ_256	0x10
157 #define	PCIE_DEVCTL_MAX_READ_REQ_512	0x20
158 #define	PCIE_DEVCTL_MAX_READ_REQ_1024	0x30
159 #define	PCIE_DEVCTL_MAX_READ_REQ_2048	0x40
160 #define	PCIE_DEVCTL_MAX_READ_REQ_4096	0x50
161 #define	PCIE_DEVCTL_MAX_READ_REQ_MASK	0x7000	/* Max_Read_Request_Size */
162 
163 /*
164  * Device Status Register (2 bytes)
165  */
166 #define	PCIE_DEVSTS_CE_DETECTED		0x1	/* Correctable Error Detected */
167 #define	PCIE_DEVSTS_NFE_DETECTED	0x2	/* Non Fatal Error Detected */
168 #define	PCIE_DEVSTS_FE_DETECTED		0x4	/* Fatal Error Detected */
169 #define	PCIE_DEVSTS_UR_DETECTED		0x8	/* Unsupported Req Detected */
170 #define	PCIE_DEVSTS_AUX_POWER		0x10	/* AUX Power Detected */
171 #define	PCIE_DEVSTS_TRANS_PENDING	0x20	/* Transactions Pending */
172 
173 /*
174  * Link Capability Register (4 bytes)
175  */
176 #define	PCIE_LINKCAP_MAX_SPEED_2_5	0x1	/* 2.5 Gb/s Speed */
177 #define	PCIE_LINKCAP_MAX_SPEED_MASK	0xF	/* Maximum Link Speed */
178 #define	PCIE_LINKCAP_MAX_WIDTH_X1	0x010
179 #define	PCIE_LINKCAP_MAX_WIDTH_X2	0x020
180 #define	PCIE_LINKCAP_MAX_WIDTH_X4	0x040
181 #define	PCIE_LINKCAP_MAX_WIDTH_X8	0x080
182 #define	PCIE_LINKCAP_MAX_WIDTH_X12	0x0C0
183 #define	PCIE_LINKCAP_MAX_WIDTH_X16	0x100
184 #define	PCIE_LINKCAP_MAX_WIDTH_X32	0x200
185 #define	PCIE_LINKCAP_MAX_WIDTH_MASK	0x3f0	/* Maximum Link Width */
186 
187 #define	PCIE_LINKCAP_ASPM_SUP_L0S	0x400	/* L0s Entry Supported */
188 #define	PCIE_LINKCAP_ASPM_SUP_L0S_L1	0xC00	/* L0s abd L1 Supported */
189 #define	PCIE_LINKCAP_ASPM_SUP_MASK	0xC00	/* ASPM Support */
190 
191 #define	PCIE_LINKCAP_L0S_EXIT_LAT_MIN	0x0000	/* < 64 ns */
192 #define	PCIE_LINKCAP_L0S_EXIT_LAT_64ns	0x1000	/* 64 ns - 128 ns */
193 #define	PCIE_LINKCAP_L0S_EXIT_LAT_128ns	0x2000	/* 128 ns - 256 ns */
194 #define	PCIE_LINKCAP_L0S_EXIT_LAT_256ns	0x3000	/* 256 ns - 512 ns */
195 #define	PCIE_LINKCAP_L0S_EXIT_LAT_512ns	0x4000	/* 512 ns - 1 us */
196 #define	PCIE_LINKCAP_L0S_EXIT_LAT_1us	0x5000	/* 1 us - 2 us */
197 #define	PCIE_LINKCAP_L0S_EXIT_LAT_2us	0x6000	/* 2 us - 4 us */
198 #define	PCIE_LINKCAP_L0S_EXIT_LAT_MAX	0x7000	/* > 4 us */
199 #define	PCIE_LINKCAP_L0S_EXIT_LAT_MASK	0x7000	/* L0s Exit Latency */
200 
201 #define	PCIE_LINKCAP_L1_EXIT_LAT_MIN	0x00000	/* < 1 us */
202 #define	PCIE_LINKCAP_L1_EXIT_LAT_1us	0x08000	/* 1 us - 2 us */
203 #define	PCIE_LINKCAP_L1_EXIT_LAT_2us	0x10000	/* 2 us - 4 us */
204 #define	PCIE_LINKCAP_L1_EXIT_LAT_4us	0x18000	/* 4 us - 8 us */
205 #define	PCIE_LINKCAP_L1_EXIT_LAT_8us	0x20000	/* 8 us - 16 us */
206 #define	PCIE_LINKCAP_L1_EXIT_LAT_16us	0x28000	/* 16 us - 32 us */
207 #define	PCIE_LINKCAP_L1_EXIT_LAT_32us	0x30000	/* 32 us - 64 us */
208 #define	PCIE_LINKCAP_L1_EXIT_LAT_MAX	0x38000	/* > 64 us */
209 #define	PCIE_LINKCAP_L1_EXIT_LAT_MASK	0x38000	/* L1 Exit Latency */
210 
211 /* PCIe v1.1 spec based */
212 #define	PCIE_LINKCAP_DLL_ACTIVE_REP_CAPABLE	0x100000    /* DLL Active */
213 							    /* Capable bit */
214 
215 #define	PCIE_LINKCAP_PORT_NUMBER	0xF0000000	/* Port Number */
216 
217 /*
218  * Link Control Register (2 bytes)
219  */
220 #define	PCIE_LINKCTL_ASPM_CTL_DIS	0x0	/* ASPM Disable */
221 #define	PCIE_LINKCTL_ASPM_CTL_L0S	0x1	/* ASPM L0s only */
222 #define	PCIE_LINKCTL_ASPM_CTL_L1	0x2	/* ASPM L1 only */
223 #define	PCIE_LINKCTL_ASPM_CTL_L0S_L1	0x3	/* ASPM L0s and L1 only */
224 #define	PCIE_LINKCTL_ASPM_CTL_MASK	0x3	/* ASPM Control */
225 
226 #define	PCIE_LINKCTL_RCB_64_BYTE	0x0	/* 64 Byte */
227 #define	PCIE_LINKCTL_RCB_128_BYTE	0x8	/* 128 Byte */
228 #define	PCIE_LINKCTL_RCB_MASK		0x8	/* Read Completion Boundary */
229 
230 #define	PCIE_LINKCTL_LINK_DISABLE	0x10	/* Link Disable */
231 #define	PCIE_LINKCTL_RETRAIN_LINK	0x20	/* Retrain Link */
232 #define	PCIE_LINKCTL_COMMON_CLK_CFG	0x40	/* Common Clock Configuration */
233 #define	PCIE_LINKCTL_EXT_SYNCH		0x80	/* Extended Synch */
234 
235 /*
236  * Link Status Register (2 bytes)
237  */
238 #define	PCIE_LINKSTS_SPEED_2_5		0x1	/* Link Speed */
239 #define	PCIE_LINKSTS_SPEED_MASK		0xF	/* Link Speed */
240 
241 #define	PCIE_LINKSTS_NEG_WIDTH_X1	0x010
242 #define	PCIE_LINKSTS_NEG_WIDTH_X2	0x020
243 #define	PCIE_LINKSTS_NEG_WIDTH_X4	0x040
244 #define	PCIE_LINKSTS_NEG_WIDTH_X8	0x080
245 #define	PCIE_LINKSTS_NEG_WIDTH_X12	0x0C0
246 #define	PCIE_LINKSTS_NEG_WIDTH_X16	0x100
247 #define	PCIE_LINKSTS_NEG_WIDTH_X32	0x200
248 #define	PCIE_LINKSTS_NEG_WIDTH_MASK	0x3F0	/* Negotiated Link Width */
249 
250 #define	PCIE_LINKSTS_TRAINING_ERROR	0x400	/* Training Error */
251 #define	PCIE_LINKSTS_LINK_TRAINING	0x800	/* Link Training */
252 #define	PCIE_LINKSTS_SLOT_CLK_CFG	0x1000	/* Slot Clock Configuration */
253 
254 /* PCIe v1.1 spec based */
255 #define	PCIE_LINKSTS_DLL_LINK_ACTIVE	0x2000	/* DLL Link Active */
256 
257 /*
258  * Slot Capability Register (4 bytes)
259  */
260 #define	PCIE_SLOTCAP_ATTN_BUTTON	0x1	/* Attention Button Present */
261 #define	PCIE_SLOTCAP_POWER_CONTROLLER	0x2	/* Power Controller Present */
262 #define	PCIE_SLOTCAP_MRL_SENSOR		0x4	/* MRL Sensor Present */
263 #define	PCIE_SLOTCAP_ATTN_INDICATOR	0x8	/* Attn Indicator Present */
264 #define	PCIE_SLOTCAP_PWR_INDICATOR	0x10	/* Power Indicator Present */
265 #define	PCIE_SLOTCAP_HP_SURPRISE	0x20	/* Hot-Plug Surprise */
266 #define	PCIE_SLOTCAP_HP_CAPABLE		0x40	/* Hot-Plug Capable */
267 
268 #define	PCIE_SLOTCAP_PLMT_VAL_SHIFT	7	/* Slot Pwr Limit Value Shift */
269 #define	PCIE_SLOTCAP_PLMT_VAL_MASK	0xFF	/* Slot Pwr Limit Value */
270 
271 #define	PCIE_SLOTCAP_PLMT_SCL_1_BY_1	0x00000	/* 1x Scale */
272 #define	PCIE_SLOTCAP_PLMT_SCL_1_BY_10	0x08000	/* 0.1x Scale */
273 #define	PCIE_SLOTCAP_PLMT_SCL_1_BY_100	0x10000	/* 0.01x Scale */
274 #define	PCIE_SLOTCAP_PLMT_SCL_1_BY_1000	0x18000	/* 0.001x Scale */
275 #define	PCIE_SLOTCAP_PLMT_SCL_MASK	0x18000	/* Slot Power Limit Scale */
276 #define	PCIE_SLOTCAP_EMI_LOCK_PRESENT	0x20000 /* EMI Lock Present */
277 #define	PCIE_SLOTCAP_NO_CMD_COMP_SUPP	0x40000 /* No Command Comp. Supported */
278 
279 #define	PCIE_SLOTCAP_PHY_SLOT_NUM_SHIFT	19	/* Physical Slot Num Shift */
280 #define	PCIE_SLOTCAP_PHY_SLOT_NUM_MASK	0x1FFF	/* Physical Slot Num Mask */
281 
282 #define	PCIE_SLOTCAP_PHY_SLOT_NUM(reg) \
283 	    (((reg) >> PCIE_SLOTCAP_PHY_SLOT_NUM_SHIFT) & \
284 	    PCIE_SLOTCAP_PHY_SLOT_NUM_MASK)
285 
286 /*
287  * Slot Control Register (2 bytes)
288  */
289 #define	PCIE_SLOTCTL_ATTN_BTN_EN	0x1	/* Attn Button Pressed Enable */
290 #define	PCIE_SLOTCTL_PWR_FAULT_EN	0x2	/* Pwr Fault Detected Enable */
291 #define	PCIE_SLOTCTL_MRL_SENSOR_EN	0x4	/* MRL Sensor Changed Enable */
292 #define	PCIE_SLOTCTL_PRESENCE_CHANGE_EN	0x8	/* Presence Detect Changed En */
293 #define	PCIE_SLOTCTL_CMD_INTR_EN	0x10	/* CMD Completed Interrupt En */
294 #define	PCIE_SLOTCTL_HP_INTR_EN		0x20	/* Hot-Plug Interrupt Enable */
295 #define	PCIE_SLOTCTL_PWR_CONTROL	0x0400	/* Power controller Control */
296 #define	PCIE_SLOTCTL_EMI_LOCK_CONTROL	0x0800	/* EMI Lock control */
297 #define	PCIE_SLOTCTL_DLL_STATE_EN	0x1000	/* DLL State Changed En */
298 #define	PCIE_SLOTCTL_ATTN_INDICATOR_MASK 0x00C0	/* Attn Indicator mask */
299 #define	PCIE_SLOTCTL_PWR_INDICATOR_MASK	0x0300	/* Power Indicator mask */
300 
301 /* State values for the Power and Attention Indicators */
302 #define	PCIE_SLOTCTL_INDICATOR_STATE_ON		0x1	/* indicator ON */
303 #define	PCIE_SLOTCTL_INDICATOR_STATE_BLINK	0x2	/* indicator BLINK */
304 #define	PCIE_SLOTCTL_INDICATOR_STATE_OFF	0x3	/* indicator OFF */
305 
306 /*
307  * Macros to set/get the state of Power and Attention Indicators
308  * in the PCI Express Slot Control Register.
309  */
310 #define	pcie_slotctl_pwr_indicator_get(reg)	\
311 	(((reg) & PCIE_SLOTCTL_PWR_INDICATOR_MASK) >> 8)
312 #define	pcie_slotctl_attn_indicator_get(ctrl)	\
313 	(((ctrl) & PCIE_SLOTCTL_ATTN_INDICATOR_MASK) >> 6)
314 #define	pcie_slotctl_attn_indicator_set(ctrl, v)\
315 	(((ctrl) & ~PCIE_SLOTCTL_ATTN_INDICATOR_MASK) | ((v) << 6))
316 #define	pcie_slotctl_pwr_indicator_set(ctrl, v)\
317 	(((ctrl) & ~PCIE_SLOTCTL_PWR_INDICATOR_MASK) | ((v) << 8))
318 
319 /*
320  * Slot Status register (2 bytes)
321  */
322 #define	PCIE_SLOTSTS_ATTN_BTN_PRESSED	0x1	/* Attention Button Pressed */
323 #define	PCIE_SLOTSTS_PWR_FAULT_DETECTED	0x2	/* Power Fault Detected */
324 #define	PCIE_SLOTSTS_MRL_SENSOR_CHANGED	0x4	/* MRL Sensor Changed */
325 #define	PCIE_SLOTSTS_PRESENCE_CHANGED	0x8	/* Presence Detect Changed */
326 #define	PCIE_SLOTSTS_COMMAND_COMPLETED	0x10	/* Command Completed */
327 #define	PCIE_SLOTSTS_MRL_SENSOR_OPEN	0x20	/* MRL Sensor Open */
328 #define	PCIE_SLOTSTS_PRESENCE_DETECTED	0x40	/* Card Present in slot */
329 #define	PCIE_SLOTSTS_EMI_LOCK_SET	0x0080	/* EMI Lock set */
330 #define	PCIE_SLOTSTS_DLL_STATE_CHANGED	0x0100	/* DLL State Changed */
331 
332 /*
333  * Root Control Register (2 bytes)
334  */
335 #define	PCIE_ROOTCTL_SYS_ERR_ON_CE_EN	0x1	/* Sys Err on Cor Err Enable */
336 #define	PCIE_ROOTCTL_SYS_ERR_ON_NFE_EN	0x2	/* Sys Err on NF Err Enable */
337 #define	PCIE_ROOTCTL_SYS_ERR_ON_FE_EN	0x4	/* Sys Err on Fatal Err En */
338 #define	PCIE_ROOTCTL_PME_INTERRUPT_EN	0x8	/* PME Interrupt Enable */
339 
340 /*
341  * Root Status Register (4 bytes)
342  */
343 #define	PCIE_ROOTSTS_PME_REQ_ID_SHIFT	0	/* PME Requestor ID */
344 #define	PCIE_ROOTSTS_PME_REQ_ID_MASK	0xFFFF	/* PME Requestor ID */
345 
346 #define	PCIE_ROOTSTS_PME_STATUS		0x10000	/* PME Status */
347 #define	PCIE_ROOTSTS_PME_PENDING	0x20000	/* PME Pending */
348 
349 
350 /*
351  * PCI-Express Enhanced Capabilities Link Entry Bit Offsets
352  */
353 #define	PCIE_EXT_CAP			0x100	/* Base Address of Ext Cap */
354 
355 #define	PCIE_EXT_CAP_ID_SHIFT		0	/* PCI-e Ext Cap ID */
356 #define	PCIE_EXT_CAP_ID_MASK		0xFFFF
357 #define	PCIE_EXT_CAP_VER_SHIFT		16	/* PCI-e Ext Cap Ver */
358 #define	PCIE_EXT_CAP_VER_MASK		0xF
359 #define	PCIE_EXT_CAP_NEXT_PTR_SHIFT	20	/* PCI-e Ext Cap Next Ptr */
360 #define	PCIE_EXT_CAP_NEXT_PTR_MASK	0xFFF
361 
362 #define	PCIE_EXT_CAP_NEXT_PTR_NULL	0x0
363 
364 /*
365  * PCI-Express Enhanced Capability Identifier Values
366  */
367 #define	PCIE_EXT_CAP_ID_AER		0x1	/* Advanced Error Handling */
368 #define	PCIE_EXT_CAP_ID_VC		0x2	/* Virtual Channel, no MFVC */
369 #define	PCIE_EXT_CAP_ID_SER		0x3	/* Serial Number */
370 #define	PCIE_EXT_CAP_ID_PWR_BUDGET	0x4	/* Power Budgeting */
371 #define	PCIE_EXT_CAP_ID_RC_LINK_DECL	0x5	/* RC Link Declaration */
372 #define	PCIE_EXT_CAP_ID_RC_INT_LINKCTRL	0x6	/* RC Internal Link Control */
373 #define	PCIE_EXT_CAP_ID_RC_EVNT_CEA	0x7	/* RC Event Collector */
374 						/* Endpoint Association */
375 #define	PCIE_EXT_CAP_ID_MFVC		0x8	/* Multi-func Virtual Channel */
376 #define	PCIE_EXT_CAP_ID_VC_WITH_MFVC	0x9	/* Virtual Channel w/ MFVC */
377 #define	PCIE_EXT_CAP_ID_RCRB		0xA	/* Root Complex Register Blck */
378 #define	PCIE_EXT_CAP_ID_VS		0xB	/* Vendor Spec Extended Cap */
379 #define	PCIE_EXT_CAP_ID_CAC		0xC	/* Config Access Correlation */
380 #define	PCIE_EXT_CAP_ID_ACS		0xD	/* Access Control Services */
381 #define	PCIE_EXT_CAP_ID_ARI		0xE	/* Alternative Routing ID */
382 #define	PCIE_EXT_CAP_ID_ATS		0xF	/* Address Translation Svcs */
383 
384 /*
385  * PCI-Express Advanced Error Reporting Extended Capability Offsets
386  */
387 #define	PCIE_AER_CAP			0x0	/* Enhanced Capability Header */
388 #define	PCIE_AER_UCE_STS		0x4	/* Uncorrectable Error Status */
389 #define	PCIE_AER_UCE_MASK		0x8	/* Uncorrectable Error Mask */
390 #define	PCIE_AER_UCE_SERV		0xc	/* Uncor Error Severity */
391 #define	PCIE_AER_CE_STS			0x10	/* Correctable Error Status */
392 #define	PCIE_AER_CE_MASK		0x14	/* Correctable Error Mask */
393 #define	PCIE_AER_CTL			0x18	/* AER Capability & Control */
394 #define	PCIE_AER_HDR_LOG		0x1c	/* Header Log */
395 
396 /* Root Ports Only */
397 #define	PCIE_AER_RE_CMD			0x2c	/* Root Error Command */
398 #define	PCIE_AER_RE_STS			0x30	/* Root Error Status */
399 #define	PCIE_AER_CE_SRC_ID		0x34	/* Error Source ID */
400 #define	PCIE_AER_ERR_SRC_ID		0x36	/* Error Source ID */
401 
402 /* Bridges Only */
403 #define	PCIE_AER_SUCE_STS		0x2c	/* Secondary UCE Status */
404 #define	PCIE_AER_SUCE_MASK		0x30	/* Secondary UCE Mask */
405 #define	PCIE_AER_SUCE_SERV		0x34	/* Secondary UCE Severity */
406 #define	PCIE_AER_SCTL			0x38	/* Secondary Cap & Ctl */
407 #define	PCIE_AER_SHDR_LOG		0x3c	/* Secondary Header Log */
408 
409 /*
410  * AER Uncorrectable Error Status/Mask/Severity Register
411  */
412 #define	PCIE_AER_UCE_TRAINING		0x1	/* Training Error Status */
413 #define	PCIE_AER_UCE_DLP		0x10	/* Data Link Protocol Error */
414 #define	PCIE_AER_UCE_SD			0x20	/* Link Surprise down */
415 #define	PCIE_AER_UCE_PTLP		0x1000	/* Poisoned TLP Status */
416 #define	PCIE_AER_UCE_FCP		0x2000	/* Flow Control Protocol Sts */
417 #define	PCIE_AER_UCE_TO			0x4000	/* Completion Timeout Status */
418 #define	PCIE_AER_UCE_CA			0x8000	/* Completer Abort Status */
419 #define	PCIE_AER_UCE_UC			0x10000	/* Unexpected Completion Sts */
420 #define	PCIE_AER_UCE_RO			0x20000	/* Receiver Overflow Status */
421 #define	PCIE_AER_UCE_MTLP		0x40000	/* Malformed TLP Status */
422 #define	PCIE_AER_UCE_ECRC		0x80000	/* ECRC Error Status */
423 #define	PCIE_AER_UCE_UR			0x100000 /* Unsupported Req */
424 #define	PCIE_AER_UCE_BITS		(PCIE_AER_UCE_TRAINING | \
425     PCIE_AER_UCE_DLP | PCIE_AER_UCE_SD | PCIE_AER_UCE_PTLP | \
426     PCIE_AER_UCE_FCP | PCIE_AER_UCE_TO | PCIE_AER_UCE_CA | \
427     PCIE_AER_UCE_UC | PCIE_AER_UCE_RO | PCIE_AER_UCE_MTLP | \
428     PCIE_AER_UCE_ECRC | PCIE_AER_UCE_UR)
429 #define	PCIE_AER_UCE_LOG_BITS		(PCIE_AER_UCE_PTLP | PCIE_AER_UCE_CA | \
430     PCIE_AER_UCE_UC | PCIE_AER_UCE_MTLP | PCIE_AER_UCE_ECRC | PCIE_AER_UCE_UR)
431 
432 /*
433  * AER Correctable Error Status/Mask Register
434  */
435 #define	PCIE_AER_CE_RECEIVER_ERR	0x1	/* Receiver Error Status */
436 #define	PCIE_AER_CE_BAD_TLP		0x40	/* Bad TLP Status */
437 #define	PCIE_AER_CE_BAD_DLLP		0x80	/* Bad DLLP Status */
438 #define	PCIE_AER_CE_REPLAY_ROLLOVER	0x100	/* REPLAY_NUM Rollover Status */
439 #define	PCIE_AER_CE_REPLAY_TO		0x1000	/* Replay Timer Timeout Sts */
440 #define	PCIE_AER_CE_AD_NFE		0x2000	/* Advisory Non-Fatal Status */
441 #define	PCIE_AER_CE_BITS		(PCIE_AER_CE_RECEIVER_ERR | \
442     PCIE_AER_CE_BAD_TLP | PCIE_AER_CE_BAD_DLLP | PCIE_AER_CE_REPLAY_ROLLOVER | \
443     PCIE_AER_CE_REPLAY_TO)
444 
445 /*
446  * AER Capability & Control
447  */
448 #define	PCIE_AER_CTL_FST_ERR_PTR_MASK	0x1F	/* First Error Pointer */
449 #define	PCIE_AER_CTL_ECRC_GEN_CAP	0x20	/* ECRC Generation Capable */
450 #define	PCIE_AER_CTL_ECRC_GEN_ENA	0x40	/* ECRC Generation Enable */
451 #define	PCIE_AER_CTL_ECRC_CHECK_CAP	0x80	/* ECRC Check Capable */
452 #define	PCIE_AER_CTL_ECRC_CHECK_ENA	0x100	/* ECRC Check Enable */
453 
454 /*
455  * AER Root Command Register
456  */
457 #define	PCIE_AER_RE_CMD_CE_REP_EN	0x1	/* Correctable Error Enable */
458 #define	PCIE_AER_RE_CMD_NFE_REP_EN	0x2	/* Non-Fatal Error Enable */
459 #define	PCIE_AER_RE_CMD_FE_REP_EN	0x4	/* Fatal Error Enable */
460 
461 /*
462  * AER Root Error Status Register
463  */
464 #define	PCIE_AER_RE_STS_CE_RCVD		0x1	/* ERR_COR Received */
465 #define	PCIE_AER_RE_STS_MUL_CE_RCVD	0x2	/* Multiple ERR_COR Received */
466 #define	PCIE_AER_RE_STS_FE_NFE_RCVD	0x4	/* FATAL/NON-FATAL Received */
467 #define	PCIE_AER_RE_STS_MUL_FE_NFE_RCVD	0x8	/* Multiple ERR_F/NF Received */
468 #define	PCIE_AER_RE_STS_FIRST_UC_FATAL	0x10	/* First Uncorrectable Fatal */
469 #define	PCIE_AER_RE_STS_NFE_MSGS_RCVD	0x20	/* Non-Fatal Error Msgs Rcvd */
470 #define	PCIE_AER_RE_STS_FE_MSGS_RCVD	0x40	/* Fatal Error Messages Rcvd */
471 
472 #define	PCIE_AER_RE_STS_MSG_NUM_SHIFT	27	/* Offset of Intr Msg Number */
473 #define	PCIE_AER_RE_STS_MSG_NUM_MASK	0x1F	/* Intr Msg Number Mask */
474 
475 /*
476  * AER Error Source Identification Register
477  */
478 #define	PCIE_AER_ERR_SRC_ID_CE_SHIFT	0	/* ERR_COR Source ID */
479 #define	PCIE_AER_ERR_SRC_ID_CE_MASK	0xFFFF
480 #define	PCIE_AER_ERR_SRC_ID_UE_SHIFT	16	/* ERR_FATAL/NONFATAL Src ID */
481 #define	PCIE_AER_ERR_SRC_ID_UE_MASK	0xFFF
482 
483 /*
484  * AER Secondary Uncorrectable Error Register
485  */
486 #define	PCIE_AER_SUCE_TA_ON_SC		0x1	/* Target Abort on Split Comp */
487 #define	PCIE_AER_SUCE_MA_ON_SC 		0x2	/* Master Abort on Split Comp */
488 #define	PCIE_AER_SUCE_RCVD_TA		0x4	/* Received Target Abort */
489 #define	PCIE_AER_SUCE_RCVD_MA 		0x8	/* Received Master Abort */
490 #define	PCIE_AER_SUCE_USC_ERR 		0x20	/* Unexpected Split Comp Err */
491 #define	PCIE_AER_SUCE_USC_MSG_DATA_ERR	0x40	/* USC Message Data Error */
492 #define	PCIE_AER_SUCE_UC_DATA_ERR	0x80	/* Uncorrectable Data Error */
493 #define	PCIE_AER_SUCE_UC_ATTR_ERR	0x100	/* UC Attribute Err */
494 #define	PCIE_AER_SUCE_UC_ADDR_ERR	0x200	/* Uncorrectable Address Err */
495 #define	PCIE_AER_SUCE_TIMER_EXPIRED	0x400	/* Delayed xtion discard */
496 #define	PCIE_AER_SUCE_PERR_ASSERT	0x800	/* PERR Assertion Detected */
497 #define	PCIE_AER_SUCE_SERR_ASSERT	0x1000	/* SERR Assertion Detected */
498 #define	PCIE_AER_SUCE_INTERNAL_ERR	0x2000	/* Internal Bridge Err Detect */
499 
500 #define	PCIE_AER_SUCE_HDR_CMD_LWR_MASK	0xF	/* Lower Command Mask */
501 #define	PCIE_AER_SUCE_HDR_CMD_LWR_SHIFT	4	/* Lower Command Shift */
502 #define	PCIE_AER_SUCE_HDR_CMD_UP_MASK	0xF	/* Upper Command Mask */
503 #define	PCIE_AER_SUCE_HDR_CMD_UP_SHIFT	8	/* Upper Command Shift */
504 #define	PCIE_AER_SUCE_HDR_ADDR_SHIFT	32	/* Upper Command Shift */
505 
506 #define	PCIE_AER_SUCE_BITS		(PCIE_AER_SUCE_TA_ON_SC | \
507     PCIE_AER_SUCE_MA_ON_SC | PCIE_AER_SUCE_RCVD_TA | PCIE_AER_SUCE_RCVD_MA | \
508     PCIE_AER_SUCE_USC_ERR | PCIE_AER_SUCE_USC_MSG_DATA_ERR | \
509     PCIE_AER_SUCE_UC_DATA_ERR | PCIE_AER_SUCE_UC_ATTR_ERR | \
510     PCIE_AER_SUCE_UC_ADDR_ERR |	PCIE_AER_SUCE_TIMER_EXPIRED | \
511     PCIE_AER_SUCE_PERR_ASSERT |	PCIE_AER_SUCE_SERR_ASSERT | \
512     PCIE_AER_SUCE_INTERNAL_ERR)
513 #define	PCIE_AER_SUCE_LOG_BITS		(PCIE_AER_SUCE_TA_ON_SC | \
514     PCIE_AER_SUCE_MA_ON_SC | PCIE_AER_SUCE_RCVD_TA | PCIE_AER_SUCE_RCVD_MA | \
515     PCIE_AER_SUCE_USC_ERR | PCIE_AER_SUCE_USC_MSG_DATA_ERR | \
516     PCIE_AER_SUCE_UC_DATA_ERR | PCIE_AER_SUCE_UC_ATTR_ERR | \
517     PCIE_AER_SUCE_UC_ADDR_ERR |	PCIE_AER_SUCE_PERR_ASSERT)
518 
519 /*
520  * AER Secondary Capability & Control
521  */
522 #define	PCIE_AER_SCTL_FST_ERR_PTR_MASK	0x1F	/* First Error Pointer */
523 
524 /*
525  * AER Secondary Headers
526  * The Secondary Header Logs is 4 DW long.
527  * The first 2 DW are split into 3 sections
528  * o Transaction Attribute
529  * o Transaction Command Lower
530  * o Transaction Command Higher
531  * The last 2 DW is the Transaction Address
532  */
533 #define	PCIE_AER_SHDR_LOG_ATTR_MASK	0xFFFFFFFFF
534 #define	PCIE_AER_SHDR_LOG_CMD_LOW_MASK	0xF000000000
535 #define	PCIE_AER_SHDR_LOG_CMD_HIGH_MASK	0xF0000000000
536 #define	PCIE_AER_SHDR_LOG_ADDR_MASK	0xFFFFFFFFFFFFFFFF
537 
538 /*
539  * PCI-E Common TLP Header Fields
540  */
541 #define	PCIE_TLP_FMT_3DW	0x00
542 #define	PCIE_TLP_FMT_4DW	0x20
543 #define	PCIE_TLP_FMT_3DW_DATA	0x40
544 #define	PCIE_TLP_FMT_4DW_DATA	0x60
545 
546 #define	PCIE_TLP_TYPE_MEM	0x0
547 #define	PCIE_TLP_TYPE_MEMLK	0x1
548 #define	PCIE_TLP_TYPE_IO	0x2
549 #define	PCIE_TLP_TYPE_CFG0	0x4
550 #define	PCIE_TLP_TYPE_CFG1	0x5
551 #define	PCIE_TLP_TYPE_MSG	0x10
552 #define	PCIE_TLP_TYPE_CPL	0xA
553 #define	PCIE_TLP_TYPE_CPLLK	0xB
554 #define	PCIE_TLP_TYPE_MSI	0x18
555 
556 #define	PCIE_TLP_MRD3		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_MEM)
557 #define	PCIE_TLP_MRD4		(PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MEM)
558 #define	PCIE_TLP_MRDLK3		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_MEMLK)
559 #define	PCIE_TLP_MRDLK4		(PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MEMLK)
560 #define	PCIE_TLP_MRDWR3		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_MEM)
561 #define	PCIE_TLP_MRDWR4		(PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MEM)
562 #define	PCIE_TLP_IORD		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_IO)
563 #define	PCIE_TLP_IOWR		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_IO)
564 #define	PCIE_TLP_CFGRD0		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CFG0)
565 #define	PCIE_TLP_CFGWR0		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CFG0)
566 #define	PCIE_TLP_CFGRD1		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CFG1)
567 #define	PCIE_TLP_CFGWR1		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CFG1)
568 #define	PCIE_TLP_MSG		(PCIE_TLP_FMT_4DW | PCIE_TLP_TYPE_MSG)
569 #define	PCIE_TLP_MSGD		(PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MSG)
570 #define	PCIE_TLP_CPL		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CPL)
571 #define	PCIE_TLP_CPLD		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CPL)
572 #define	PCIE_TLP_CPLLK		(PCIE_TLP_FMT_3DW | PCIE_TLP_TYPE_CPLLK)
573 #define	PCIE_TLP_CPLDLK		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_CPLLK)
574 #define	PCIE_TLP_MSI32		(PCIE_TLP_FMT_3DW_DATA | PCIE_TLP_TYPE_MSI)
575 #define	PCIE_TLP_MSI64		(PCIE_TLP_FMT_4DW_DATA | PCIE_TLP_TYPE_MSI)
576 
577 typedef uint16_t pcie_req_id_t;
578 
579 #define	PCIE_REQ_ID_BUS_SHIFT	8
580 #define	PCIE_REQ_ID_BUS_MASK	0xFF00
581 #define	PCIE_REQ_ID_DEV_SHIFT	3
582 #define	PCIE_REQ_ID_DEV_MASK	0x00F1
583 #define	PCIE_REQ_ID_FUNC_SHIFT	0
584 #define	PCIE_REQ_ID_FUNC_MASK	0x0007
585 
586 #if defined(_BIT_FIELDS_LTOH)
587 /*
588  * PCI Express little-endian common TLP header format
589  */
590 typedef struct pcie_tlp_hdr {
591 	uint32_t	len	:10,
592 			rsvd3   :2,
593 			attr    :2,
594 			ep	:1,
595 			td	:1,
596 			rsvd2   :4,
597 			tc	:3,
598 			rsvd1   :1,
599 			type    :5,
600 			fmt	:2,
601 			rsvd0   :1;
602 } pcie_tlp_hdr_t;
603 
604 typedef struct pcie_mem64 {
605 	uint32_t	fbe	:4,
606 			lbe	:4,
607 			tag	:8,
608 			rid	:16;
609 	uint32_t	addr1;
610 	uint32_t	rsvd0   :2,
611 			addr0   :30;
612 } pcie_mem64_t;
613 
614 typedef struct pcie_memio32 {
615 	uint32_t	fbe	:4,
616 			lbe	:4,
617 			tag	:8,
618 			rid	:16;
619 	uint32_t	rsvd0   :2,
620 			addr0   :30;
621 } pcie_memio32_t;
622 
623 typedef struct pcie_cfg {
624 	uint32_t	fbe	:4,
625 			lbe	:4,
626 			tag	:8,
627 			rid	:16;
628 	uint32_t	rsvd1   :2,
629 			reg	:6,
630 			extreg  :4,
631 			rsvd0   :4,
632 			func    :3,
633 			dev	:5,
634 			bus	:8;
635 } pcie_cfg_t;
636 
637 typedef struct pcie_cpl {
638 	uint32_t	bc	:12,
639 			bcm	:1,
640 			status  :3,
641 			cid	:16;
642 	uint32_t	laddr   :7,
643 			rsvd0   :1,
644 			tag	:8,
645 			rid	:16;
646 } pcie_cpl_t;
647 
648 /*
649  * PCI-Express Message Request Header
650  */
651 typedef struct pcie_msg {
652 	uint32_t	msg_code:8,	/* DW1 */
653 			tag	:8,
654 			rid	:16;
655 	uint32_t	unused[2];	/* DW 2 & 3 */
656 } pcie_msg_t;
657 
658 #elif defined(_BIT_FIELDS_HTOL)
659 /*
660  * PCI Express big-endian common TLP header format
661  */
662 typedef struct pcie_tlp_hdr {
663 	uint32_t	rsvd0	:1,
664 			fmt	:2,
665 			type	:5,
666 			rsvd1	:1,
667 			tc	:3,
668 			rsvd2	:4,
669 			td	:1,
670 			ep	:1,
671 			attr	:2,
672 			rsvd3	:2,
673 			len	:10;
674 } pcie_tlp_hdr_t;
675 
676 typedef struct pcie_mem64 {
677 	uint32_t	rid	:16,
678 			tag	:8,
679 			lbe	:4,
680 			fbe	:4;
681 	uint32_t	addr1;
682 	uint32_t	addr0	:30,
683 			rsvd0	:2;
684 } pcie_mem64_t;
685 
686 typedef struct pcie_memio32 {
687 	uint32_t	rid	:16,
688 			tag	:8,
689 			lbe	:4,
690 			fbe	:4;
691 	uint32_t	addr0	:30,
692 			rsvd0	:2;
693 } pcie_memio32_t;
694 
695 typedef struct pcie_cfg {
696 	uint32_t	rid	:16,
697 			tag	:8,
698 			lbe	:4,
699 			fbe	:4;
700 	uint32_t	bus	:8,
701 			dev	:5,
702 			func	:3,
703 			rsvd0	:4,
704 			extreg	:4,
705 			reg	:6,
706 			rsvd1	:2;
707 } pcie_cfg_t;
708 
709 typedef struct pcie_cpl {
710 	uint32_t	cid	:16,
711 			status	:3,
712 			bcm	:1,
713 			bc	:12;
714 	uint32_t	rid	:16,
715 			tag	:8,
716 			rsvd0	:1,
717 			laddr	:7;
718 } pcie_cpl_t;
719 
720 /*
721  * PCI-Express Message Request Header
722  */
723 typedef struct pcie_msg {
724 	uint32_t	rid	:16,	/* DW1 */
725 			tag	:8,
726 			msg_code:8;
727 	uint32_t	unused[2];	/* DW 2 & 3 */
728 } pcie_msg_t;
729 #else
730 #error "bit field not defined"
731 #endif
732 
733 #define	PCIE_MSG_CODE_ERR_COR		0x30
734 #define	PCIE_MSG_CODE_ERR_NONFATAL	0x31
735 #define	PCIE_MSG_CODE_ERR_FATAL		0x33
736 
737 #ifdef	__cplusplus
738 }
739 #endif
740 
741 #endif	/* _SYS_PCIE_H */
742