xref: /pciutils/lib/header.h (revision 6f7640b8)
1d6b297d0SMartin Mares /*
2bfc4fe7aSMartin Mares  *	The PCI Library -- PCI Header Structure (based on <linux/pci.h>)
3d6b297d0SMartin Mares  *
48f39f69eSMartin Mares  *	Copyright (c) 1997--2010 Martin Mares <[email protected]>
5d6b297d0SMartin Mares  *
661829219SMartin Mares  *	Can be freely distributed and used under the terms of the GNU GPL v2+
761829219SMartin Mares  *
861829219SMartin Mares  *	SPDX-License-Identifier: GPL-2.0-or-later
9d6b297d0SMartin Mares  */
10d6b297d0SMartin Mares 
11d6b297d0SMartin Mares /*
12d6b297d0SMartin Mares  * Under PCI, each device has 256 bytes of configuration address space,
13d6b297d0SMartin Mares  * of which the first 64 bytes are standardized as follows:
14d6b297d0SMartin Mares  */
15d6b297d0SMartin Mares #define PCI_VENDOR_ID		0x00	/* 16 bits */
16d6b297d0SMartin Mares #define PCI_DEVICE_ID		0x02	/* 16 bits */
17d6b297d0SMartin Mares #define PCI_COMMAND		0x04	/* 16 bits */
18d6b297d0SMartin Mares #define  PCI_COMMAND_IO		0x1	/* Enable response in I/O space */
19d6b297d0SMartin Mares #define  PCI_COMMAND_MEMORY	0x2	/* Enable response in Memory space */
20d6b297d0SMartin Mares #define  PCI_COMMAND_MASTER	0x4	/* Enable bus mastering */
21d6b297d0SMartin Mares #define  PCI_COMMAND_SPECIAL	0x8	/* Enable response to special cycles */
22d6b297d0SMartin Mares #define  PCI_COMMAND_INVALIDATE	0x10	/* Use memory write and invalidate */
23d6b297d0SMartin Mares #define  PCI_COMMAND_VGA_PALETTE 0x20	/* Enable palette snooping */
24d6b297d0SMartin Mares #define  PCI_COMMAND_PARITY	0x40	/* Enable parity checking */
25d6b297d0SMartin Mares #define  PCI_COMMAND_WAIT 	0x80	/* Enable address/data stepping */
26d6b297d0SMartin Mares #define  PCI_COMMAND_SERR	0x100	/* Enable SERR */
27d6b297d0SMartin Mares #define  PCI_COMMAND_FAST_BACK	0x200	/* Enable back-to-back writes */
284efcfc5fSMartin Mares #define  PCI_COMMAND_DISABLE_INTx	0x400	/* PCIE: Disable INTx interrupts */
29d6b297d0SMartin Mares 
30d6b297d0SMartin Mares #define PCI_STATUS		0x06	/* 16 bits */
314efcfc5fSMartin Mares #define  PCI_STATUS_INTx	0x08	/* PCIE: INTx interrupt pending */
32d6b297d0SMartin Mares #define  PCI_STATUS_CAP_LIST	0x10	/* Support Capability List */
33d6b297d0SMartin Mares #define  PCI_STATUS_66MHZ	0x20	/* Support 66 Mhz PCI 2.1 bus */
34e95c8373SMartin Mares #define  PCI_STATUS_UDF		0x40	/* Support User Definable Features [obsolete] */
35d6b297d0SMartin Mares #define  PCI_STATUS_FAST_BACK	0x80	/* Accept fast-back to back */
36d6b297d0SMartin Mares #define  PCI_STATUS_PARITY	0x100	/* Detected parity error */
37d6b297d0SMartin Mares #define  PCI_STATUS_DEVSEL_MASK	0x600	/* DEVSEL timing */
38d6b297d0SMartin Mares #define  PCI_STATUS_DEVSEL_FAST	0x000
39d6b297d0SMartin Mares #define  PCI_STATUS_DEVSEL_MEDIUM 0x200
40d6b297d0SMartin Mares #define  PCI_STATUS_DEVSEL_SLOW 0x400
41d6b297d0SMartin Mares #define  PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
42d6b297d0SMartin Mares #define  PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
43d6b297d0SMartin Mares #define  PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
44d6b297d0SMartin Mares #define  PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
45d6b297d0SMartin Mares #define  PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
46d6b297d0SMartin Mares 
47d6b297d0SMartin Mares #define PCI_CLASS_REVISION	0x08	/* High 24 bits are class, low 8
48d6b297d0SMartin Mares 					   revision */
49d6b297d0SMartin Mares #define PCI_REVISION_ID         0x08    /* Revision ID */
50d6b297d0SMartin Mares #define PCI_CLASS_PROG          0x09    /* Reg. Level Programming Interface */
51d6b297d0SMartin Mares #define PCI_CLASS_DEVICE        0x0a    /* Device class */
52d6b297d0SMartin Mares 
53d6b297d0SMartin Mares #define PCI_CACHE_LINE_SIZE	0x0c	/* 8 bits */
54d6b297d0SMartin Mares #define PCI_LATENCY_TIMER	0x0d	/* 8 bits */
55d6b297d0SMartin Mares #define PCI_HEADER_TYPE		0x0e	/* 8 bits */
56d6b297d0SMartin Mares #define  PCI_HEADER_TYPE_NORMAL	0
57d6b297d0SMartin Mares #define  PCI_HEADER_TYPE_BRIDGE 1
58d6b297d0SMartin Mares #define  PCI_HEADER_TYPE_CARDBUS 2
59d6b297d0SMartin Mares 
60d6b297d0SMartin Mares #define PCI_BIST		0x0f	/* 8 bits */
61d6b297d0SMartin Mares #define PCI_BIST_CODE_MASK	0x0f	/* Return result */
62d6b297d0SMartin Mares #define PCI_BIST_START		0x40	/* 1 to start BIST, 2 secs or less */
63d6b297d0SMartin Mares #define PCI_BIST_CAPABLE	0x80	/* 1 if BIST capable */
64d6b297d0SMartin Mares 
65d6b297d0SMartin Mares /*
66d6b297d0SMartin Mares  * Base addresses specify locations in memory or I/O space.
67d6b297d0SMartin Mares  * Decoded size can be determined by writing a value of
68d6b297d0SMartin Mares  * 0xffffffff to the register, and reading it back.  Only
69d6b297d0SMartin Mares  * 1 bits are decoded.
70d6b297d0SMartin Mares  */
71d6b297d0SMartin Mares #define PCI_BASE_ADDRESS_0	0x10	/* 32 bits */
72d6b297d0SMartin Mares #define PCI_BASE_ADDRESS_1	0x14	/* 32 bits [htype 0,1 only] */
73d6b297d0SMartin Mares #define PCI_BASE_ADDRESS_2	0x18	/* 32 bits [htype 0 only] */
74d6b297d0SMartin Mares #define PCI_BASE_ADDRESS_3	0x1c	/* 32 bits */
75d6b297d0SMartin Mares #define PCI_BASE_ADDRESS_4	0x20	/* 32 bits */
76d6b297d0SMartin Mares #define PCI_BASE_ADDRESS_5	0x24	/* 32 bits */
77d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_SPACE	0x01	/* 0 = memory, 1 = I/O */
78d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_SPACE_IO 0x01
79d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
80d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
81d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_MEM_TYPE_32	0x00	/* 32 bit address */
82e95c8373SMartin Mares #define  PCI_BASE_ADDRESS_MEM_TYPE_1M	0x02	/* Below 1M [obsolete] */
83d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_MEM_TYPE_64	0x04	/* 64 bit address */
84d6b297d0SMartin Mares #define  PCI_BASE_ADDRESS_MEM_PREFETCH	0x08	/* prefetchable? */
859739916eSMartin Mares #define  PCI_BASE_ADDRESS_MEM_MASK	(~(pciaddr_t)0x0f)
869739916eSMartin Mares #define  PCI_BASE_ADDRESS_IO_MASK	(~(pciaddr_t)0x03)
87d6b297d0SMartin Mares /* bit 1 is reserved if address_space = 1 */
88d6b297d0SMartin Mares 
89d6b297d0SMartin Mares /* Header type 0 (normal devices) */
90d6b297d0SMartin Mares #define PCI_CARDBUS_CIS		0x28
91d6b297d0SMartin Mares #define PCI_SUBSYSTEM_VENDOR_ID	0x2c
92d6b297d0SMartin Mares #define PCI_SUBSYSTEM_ID	0x2e
93d6b297d0SMartin Mares #define PCI_ROM_ADDRESS		0x30	/* Bits 31..11 are address, 10..1 reserved */
94d6b297d0SMartin Mares #define  PCI_ROM_ADDRESS_ENABLE	0x01
959739916eSMartin Mares #define PCI_ROM_ADDRESS_MASK	(~(pciaddr_t)0x7ff)
96d6b297d0SMartin Mares 
97d6b297d0SMartin Mares #define PCI_CAPABILITY_LIST	0x34	/* Offset of first capability list entry */
98d6b297d0SMartin Mares 
99d6b297d0SMartin Mares /* 0x35-0x3b are reserved */
100d6b297d0SMartin Mares #define PCI_INTERRUPT_LINE	0x3c	/* 8 bits */
101d6b297d0SMartin Mares #define PCI_INTERRUPT_PIN	0x3d	/* 8 bits */
102d6b297d0SMartin Mares #define PCI_MIN_GNT		0x3e	/* 8 bits */
103d6b297d0SMartin Mares #define PCI_MAX_LAT		0x3f	/* 8 bits */
104d6b297d0SMartin Mares 
105d6b297d0SMartin Mares /* Header type 1 (PCI-to-PCI bridges) */
106d6b297d0SMartin Mares #define PCI_PRIMARY_BUS		0x18	/* Primary bus number */
107d6b297d0SMartin Mares #define PCI_SECONDARY_BUS	0x19	/* Secondary bus number */
108d6b297d0SMartin Mares #define PCI_SUBORDINATE_BUS	0x1a	/* Highest bus number behind the bridge */
109d6b297d0SMartin Mares #define PCI_SEC_LATENCY_TIMER	0x1b	/* Latency timer for secondary interface */
110d6b297d0SMartin Mares #define PCI_IO_BASE		0x1c	/* I/O range behind the bridge */
111d6b297d0SMartin Mares #define PCI_IO_LIMIT		0x1d
112d6b297d0SMartin Mares #define  PCI_IO_RANGE_TYPE_MASK	0x0f	/* I/O bridging type */
113d6b297d0SMartin Mares #define  PCI_IO_RANGE_TYPE_16	0x00
114d6b297d0SMartin Mares #define  PCI_IO_RANGE_TYPE_32	0x01
115d6b297d0SMartin Mares #define  PCI_IO_RANGE_MASK	~0x0f
116138c0385SMartin Mares #define PCI_SEC_STATUS		0x1e	/* Secondary status register */
117d6b297d0SMartin Mares #define PCI_MEMORY_BASE		0x20	/* Memory range behind */
118d6b297d0SMartin Mares #define PCI_MEMORY_LIMIT	0x22
119d6b297d0SMartin Mares #define  PCI_MEMORY_RANGE_TYPE_MASK 0x0f
120d6b297d0SMartin Mares #define  PCI_MEMORY_RANGE_MASK	~0x0f
121d6b297d0SMartin Mares #define PCI_PREF_MEMORY_BASE	0x24	/* Prefetchable memory range behind */
122d6b297d0SMartin Mares #define PCI_PREF_MEMORY_LIMIT	0x26
123d6b297d0SMartin Mares #define  PCI_PREF_RANGE_TYPE_MASK 0x0f
124d6b297d0SMartin Mares #define  PCI_PREF_RANGE_TYPE_32	0x00
125d6b297d0SMartin Mares #define  PCI_PREF_RANGE_TYPE_64	0x01
126d6b297d0SMartin Mares #define  PCI_PREF_RANGE_MASK	~0x0f
127d6b297d0SMartin Mares #define PCI_PREF_BASE_UPPER32	0x28	/* Upper half of prefetchable memory range */
128d6b297d0SMartin Mares #define PCI_PREF_LIMIT_UPPER32	0x2c
129d6b297d0SMartin Mares #define PCI_IO_BASE_UPPER16	0x30	/* Upper half of I/O addresses */
130d6b297d0SMartin Mares #define PCI_IO_LIMIT_UPPER16	0x32
131e95c8373SMartin Mares /* 0x34 same as for htype 0 */
132*6f7640b8SRong Tao /* 0x35-0x37 is reserved */
133d6b297d0SMartin Mares #define PCI_ROM_ADDRESS1	0x38	/* Same as PCI_ROM_ADDRESS, but for htype 1 */
134d6b297d0SMartin Mares /* 0x3c-0x3d are same as for htype 0 */
135d6b297d0SMartin Mares #define PCI_BRIDGE_CONTROL	0x3e
136d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_PARITY	0x01	/* Enable parity detection on secondary interface */
137d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_SERR	0x02	/* The same for SERR forwarding */
138d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_NO_ISA	0x04	/* Disable bridging of ISA ports */
139d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_VGA	0x08	/* Forward VGA addresses */
140b2a45526SBjorn Helgaas #define  PCI_BRIDGE_CTL_VGA_16BIT 0x10	/* VGA 16-bit decode */
141d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_MASTER_ABORT 0x20  /* Report master aborts */
142d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_BUS_RESET 0x40	/* Secondary bus reset */
143d6b297d0SMartin Mares #define  PCI_BRIDGE_CTL_FAST_BACK 0x80	/* Fast Back2Back enabled on secondary interface */
1444efcfc5fSMartin Mares #define  PCI_BRIDGE_CTL_PRI_DISCARD_TIMER 0x100		/* PCI-X? */
1454efcfc5fSMartin Mares #define  PCI_BRIDGE_CTL_SEC_DISCARD_TIMER 0x200		/* PCI-X? */
1464efcfc5fSMartin Mares #define  PCI_BRIDGE_CTL_DISCARD_TIMER_STATUS 0x400	/* PCI-X? */
1474efcfc5fSMartin Mares #define  PCI_BRIDGE_CTL_DISCARD_TIMER_SERR_EN 0x800	/* PCI-X? */
148d6b297d0SMartin Mares 
149d6b297d0SMartin Mares /* Header type 2 (CardBus bridges) */
15021510591SMatthew Wilcox #define PCI_CB_CAPABILITY_LIST	0x14
15121510591SMatthew Wilcox /* 0x15 reserved */
152d6b297d0SMartin Mares #define PCI_CB_SEC_STATUS	0x16	/* Secondary status */
153d6b297d0SMartin Mares #define PCI_CB_PRIMARY_BUS	0x18	/* PCI bus number */
154d6b297d0SMartin Mares #define PCI_CB_CARD_BUS		0x19	/* CardBus bus number */
155d6b297d0SMartin Mares #define PCI_CB_SUBORDINATE_BUS	0x1a	/* Subordinate bus number */
156d6b297d0SMartin Mares #define PCI_CB_LATENCY_TIMER	0x1b	/* CardBus latency timer */
157d6b297d0SMartin Mares #define PCI_CB_MEMORY_BASE_0	0x1c
158d6b297d0SMartin Mares #define PCI_CB_MEMORY_LIMIT_0	0x20
159d6b297d0SMartin Mares #define PCI_CB_MEMORY_BASE_1	0x24
160d6b297d0SMartin Mares #define PCI_CB_MEMORY_LIMIT_1	0x28
161d6b297d0SMartin Mares #define PCI_CB_IO_BASE_0	0x2c
162d6b297d0SMartin Mares #define PCI_CB_IO_BASE_0_HI	0x2e
163d6b297d0SMartin Mares #define PCI_CB_IO_LIMIT_0	0x30
164d6b297d0SMartin Mares #define PCI_CB_IO_LIMIT_0_HI	0x32
165d6b297d0SMartin Mares #define PCI_CB_IO_BASE_1	0x34
166d6b297d0SMartin Mares #define PCI_CB_IO_BASE_1_HI	0x36
167d6b297d0SMartin Mares #define PCI_CB_IO_LIMIT_1	0x38
168d6b297d0SMartin Mares #define PCI_CB_IO_LIMIT_1_HI	0x3a
169d6b297d0SMartin Mares #define  PCI_CB_IO_RANGE_MASK	~0x03
170d6b297d0SMartin Mares /* 0x3c-0x3d are same as for htype 0 */
171d6b297d0SMartin Mares #define PCI_CB_BRIDGE_CONTROL	0x3e
172d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_PARITY	0x01	/* Similar to standard bridge control register */
173d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_SERR		0x02
174d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_ISA		0x04
175d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_VGA		0x08
176d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_MASTER_ABORT	0x20
177d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_CB_RESET	0x40	/* CardBus reset */
178d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_16BIT_INT	0x80	/* Enable interrupt for 16-bit cards */
179d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100	/* Prefetch enable for both memory regions */
180d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200
181d6b297d0SMartin Mares #define  PCI_CB_BRIDGE_CTL_POST_WRITES	0x400
182d6b297d0SMartin Mares #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40
183d6b297d0SMartin Mares #define PCI_CB_SUBSYSTEM_ID	0x42
184d6b297d0SMartin Mares #define PCI_CB_LEGACY_MODE_BASE	0x44	/* 16-bit PC Card legacy mode base address (ExCa) */
185d6b297d0SMartin Mares /* 0x48-0x7f reserved */
186d6b297d0SMartin Mares 
187d6b297d0SMartin Mares /* Capability lists */
188e95c8373SMartin Mares 
189d6b297d0SMartin Mares #define PCI_CAP_LIST_ID		0	/* Capability ID */
190c508d1c9SBjorn Helgaas #define  PCI_CAP_ID_NULL	0x00	/* Null Capability */
1911c31d620SMartin Mares #define  PCI_CAP_ID_PM		0x01	/* Power Management */
1921c31d620SMartin Mares #define  PCI_CAP_ID_AGP		0x02	/* Accelerated Graphics Port */
193e95c8373SMartin Mares #define  PCI_CAP_ID_VPD		0x03	/* Vital Product Data */
194e95c8373SMartin Mares #define  PCI_CAP_ID_SLOTID	0x04	/* Slot Identification */
195acbd2e05SMartin Mares #define  PCI_CAP_ID_MSI		0x05	/* Message Signaled Interrupts */
196e95c8373SMartin Mares #define  PCI_CAP_ID_CHSWP	0x06	/* CompactPCI HotSwap */
1975f5e6f64SMartin Mares #define  PCI_CAP_ID_PCIX        0x07    /* PCI-X */
198bfc4fe7aSMartin Mares #define  PCI_CAP_ID_HT          0x08    /* HyperTransport */
1994d67aa89SMartin Mares #define  PCI_CAP_ID_VNDR	0x09	/* Vendor specific */
2004d67aa89SMartin Mares #define  PCI_CAP_ID_DBG		0x0A	/* Debug port */
2014d67aa89SMartin Mares #define  PCI_CAP_ID_CCRC	0x0B	/* CompactPCI Central Resource Control */
2022d2c4810SMartin Mares #define  PCI_CAP_ID_HOTPLUG	0x0C	/* PCI hot-plug */
203248a04f8SMartin Mares #define  PCI_CAP_ID_SSVID	0x0D	/* Bridge subsystem vendor/device ID */
2044d67aa89SMartin Mares #define  PCI_CAP_ID_AGP3	0x0E	/* AGP 8x */
2052d2c4810SMartin Mares #define  PCI_CAP_ID_SECURE	0x0F	/* Secure device (?) */
2064d67aa89SMartin Mares #define  PCI_CAP_ID_EXP		0x10	/* PCI Express */
2074d67aa89SMartin Mares #define  PCI_CAP_ID_MSIX	0x11	/* MSI-X */
208f7c76ec5SMartin Mares #define  PCI_CAP_ID_SATA	0x12	/* Serial-ATA HBA */
209f7c76ec5SMartin Mares #define  PCI_CAP_ID_AF		0x13	/* Advanced features of PCI devices integrated in PCIe root cplx */
2104cd841dfSDavid Daney #define  PCI_CAP_ID_EA		0x14	/* Enhanced Allocation */
211fca6726eSMartin Mares #define  PCI_CAP_ID_FPB		0x15	/* Flattening Portal Bridge */
212d6b297d0SMartin Mares #define PCI_CAP_LIST_NEXT	1	/* Next capability in the list */
2131c31d620SMartin Mares #define PCI_CAP_FLAGS		2	/* Capability defined flags (16 bits) */
2141c31d620SMartin Mares #define PCI_CAP_SIZEOF		4
2151c31d620SMartin Mares 
2164d67aa89SMartin Mares /* Capabilities residing in the PCI Express extended configuration space */
2174d67aa89SMartin Mares 
218c508d1c9SBjorn Helgaas #define PCI_EXT_CAP_ID_NULL	0x00	/* Null Capability */
2194d67aa89SMartin Mares #define PCI_EXT_CAP_ID_AER	0x01	/* Advanced Error Reporting */
2204d67aa89SMartin Mares #define PCI_EXT_CAP_ID_VC	0x02	/* Virtual Channel */
2214d67aa89SMartin Mares #define PCI_EXT_CAP_ID_DSN	0x03	/* Device Serial Number */
2224d67aa89SMartin Mares #define PCI_EXT_CAP_ID_PB	0x04	/* Power Budgeting */
223dfdb0840SMartin Mares #define PCI_EXT_CAP_ID_RCLINK	0x05	/* Root Complex Link Declaration */
224dfdb0840SMartin Mares #define PCI_EXT_CAP_ID_RCILINK	0x06	/* Root Complex Internal Link Declaration */
225e12bd01eSSean V Kelley #define PCI_EXT_CAP_ID_RCEC	0x07	/* Root Complex Event Collector */
226dfdb0840SMartin Mares #define PCI_EXT_CAP_ID_MFVC	0x08	/* Multi-Function Virtual Channel */
22733088c24SMartin Mares #define PCI_EXT_CAP_ID_VC2	0x09	/* Virtual Channel (2nd ID) */
228eff08b33SBjorn Helgaas #define PCI_EXT_CAP_ID_RCRB	0x0a	/* Root Complex Register Block */
229dfdb0840SMartin Mares #define PCI_EXT_CAP_ID_VNDR	0x0b	/* Vendor specific */
230dfdb0840SMartin Mares #define PCI_EXT_CAP_ID_ACS	0x0d	/* Access Controls */
23138190363SZhao, Yu #define PCI_EXT_CAP_ID_ARI	0x0e	/* Alternative Routing-ID Interpretation */
232be697708SYu Zhao #define PCI_EXT_CAP_ID_ATS	0x0f	/* Address Translation Service */
233fa74afb3SZhao, Yu #define PCI_EXT_CAP_ID_SRIOV	0x10	/* Single Root I/O Virtualization */
234b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_MRIOV	0x11	/* Multi-Root I/O Virtualization */
235b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_MCAST	0x12	/* Multicast */
236a858df0dSDavid Woodhouse #define PCI_EXT_CAP_ID_PRI	0x13	/* Page Request Interface */
237b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_REBAR	0x15	/* Resizable BAR */
238b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_DPA	0x16	/* Dynamic Power Allocation */
23967da1792SMartin Mares #define PCI_EXT_CAP_ID_TPH	0x17	/* Transaction processing hints */
24067da1792SMartin Mares #define PCI_EXT_CAP_ID_LTR	0x18	/* Latency Tolerance Reporting */
241b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_SECPCI	0x19	/* Secondary PCI Express */
242b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_PMUX	0x1a	/* Protocol Multiplexing */
243a858df0dSDavid Woodhouse #define PCI_EXT_CAP_ID_PASID	0x1b	/* Process Address Space ID */
244b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_LNR	0x1c	/* LN Requester */
245de91b6f2SKeith Busch #define PCI_EXT_CAP_ID_DPC	0x1d	/* Downstream Port Containment */
246214c9a95SDavid Box #define PCI_EXT_CAP_ID_L1PM	0x1e	/* L1 PM Substates */
247415a9c18SYong, Jonathan #define PCI_EXT_CAP_ID_PTM	0x1f	/* Precision Time Measurement */
248b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_M_PCIE	0x20	/* PCIe over M-PHY */
249b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_FRS	0x21	/* FRS Queuing */
250b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_RTR	0x22	/* Readiness Time Reporting */
251b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_DVSEC	0x23	/* Designated Vendor-Specific */
252b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_VF_REBAR	0x24	/* VF Resizable BAR */
253b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_DLNK	0x25	/* Data Link Feature */
254b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_16GT	0x26	/* Physical Layer 16.0 GT/s */
255b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_LMR	0x27	/* Lane Margining at Receiver */
256b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_HIER_ID	0x28	/* Hierarchy ID */
257b8f7cd64SBjorn Helgaas #define PCI_EXT_CAP_ID_NPEM	0x29	/* Native PCIe Enclosure Management */
258db43fb5eSMateusz Nowicki #define PCI_EXT_CAP_ID_32GT	0x2a	/* Physical Layer 32.0 GT/s */
259fca6726eSMartin Mares #define PCI_EXT_CAP_ID_ALT_PROT	0x2b	/* Alternate Protocol */
260fca6726eSMartin Mares #define PCI_EXT_CAP_ID_SFI	0x2c	/* System Firmware Intermediary */
26160be9345SJonathan Cameron #define PCI_EXT_CAP_ID_DOE	0x2e	/* Data Object Exchange */
2629611db3eSPaul Cassidy #define PCI_EXT_CAP_ID_DEV3	0x2f	/* Device 3 */
26342fc4263SAlexey Kardashevskiy #define PCI_EXT_CAP_ID_IDE	0x30	/* Integrity and Data Encryption */
26404d90becSTristan Watts-Willis #define PCI_EXT_CAP_ID_64GT	0x31	/* Physical Layer 64.0 GT/s */
265fca6726eSMartin Mares #define PCI_EXT_CAP_ID_FLIT_LOG	0x32	/* Flit Logging */
266fca6726eSMartin Mares #define PCI_EXT_CAP_ID_FLIT_PM	0x33	/* Flit Performance Measurement */
267fca6726eSMartin Mares #define PCI_EXT_CAP_ID_FLIT_EI	0x34	/* Flit Error Injection*/
268fca6726eSMartin Mares #define PCI_EXT_CAP_ID_SVC	0x35	/* Streamlined Virtual Channel */
269fca6726eSMartin Mares #define PCI_EXT_CAP_ID_MMIO_RBL	0x36	/* MMIO Register Block Locator */
270fca6726eSMartin Mares #define PCI_EXT_CAP_ID_NOP_FLIT	0x37	/* NOP Flit Extended Capability */
271fca6726eSMartin Mares #define PCI_EXT_CAP_ID_SIOV	0x38	/* Scalable I/O Virtualization */
272fca6726eSMartin Mares #define PCI_EXT_CAP_ID_128GT	0x39	/* Physical Layer 128.0 GT/s */
273fca6726eSMartin Mares #define PCI_EXT_CAP_ID_CAPT_D	0x3a	/* Captured Data */
2744d67aa89SMartin Mares 
275be9c1b75SMartin Mares /*** Definitions of capabilities ***/
276be9c1b75SMartin Mares 
2771c31d620SMartin Mares /* Power Management Registers */
2781c31d620SMartin Mares 
27972b9b690SMartin Mares #define  PCI_PM_CAP_VER_MASK	0x0007	/* Version (2=PM1.1) */
28072b9b690SMartin Mares #define  PCI_PM_CAP_PME_CLOCK	0x0008	/* Clock required for PME generation */
28172b9b690SMartin Mares #define  PCI_PM_CAP_DSI		0x0020	/* Device specific initialization required */
28272b9b690SMartin Mares #define  PCI_PM_CAP_AUX_C_MASK	0x01c0	/* Maximum aux current required in D3cold */
2831c31d620SMartin Mares #define  PCI_PM_CAP_D1		0x0200	/* D1 power state support */
2841c31d620SMartin Mares #define  PCI_PM_CAP_D2		0x0400	/* D2 power state support */
28572b9b690SMartin Mares #define  PCI_PM_CAP_PME_D0	0x0800	/* PME can be asserted from D0 */
28672b9b690SMartin Mares #define  PCI_PM_CAP_PME_D1	0x1000	/* PME can be asserted from D1 */
28772b9b690SMartin Mares #define  PCI_PM_CAP_PME_D2	0x2000	/* PME can be asserted from D2 */
28872b9b690SMartin Mares #define  PCI_PM_CAP_PME_D3_HOT	0x4000	/* PME can be asserted from D3hot */
28972b9b690SMartin Mares #define  PCI_PM_CAP_PME_D3_COLD	0x8000	/* PME can be asserted from D3cold */
2901c31d620SMartin Mares #define PCI_PM_CTRL		4	/* PM control and status register */
2911c31d620SMartin Mares #define  PCI_PM_CTRL_STATE_MASK	0x0003	/* Current power state (D0 to D3) */
2921c702facSYu Zhao #define  PCI_PM_CTRL_NO_SOFT_RST	0x0008	/* No Soft Reset from D3hot to D0 */
2931c31d620SMartin Mares #define  PCI_PM_CTRL_PME_ENABLE	0x0100	/* PME pin enable */
29472b9b690SMartin Mares #define  PCI_PM_CTRL_DATA_SEL_MASK	0x1e00	/* PM table data index */
29572b9b690SMartin Mares #define  PCI_PM_CTRL_DATA_SCALE_MASK	0x6000	/* PM table data scaling factor */
2961c31d620SMartin Mares #define  PCI_PM_CTRL_PME_STATUS	0x8000	/* PME pin status */
29772b9b690SMartin Mares #define PCI_PM_PPB_EXTENSIONS	6	/* PPB support extensions */
29872b9b690SMartin Mares #define  PCI_PM_PPB_B2_B3	0x40	/* If bridge enters D3hot, bus enters: 0=B3, 1=B2 */
29972b9b690SMartin Mares #define  PCI_PM_BPCC_ENABLE	0x80	/* Secondary bus is power managed */
30072b9b690SMartin Mares #define PCI_PM_DATA_REGISTER	7	/* PM table contents read here */
3011c31d620SMartin Mares #define PCI_PM_SIZEOF		8
3021c31d620SMartin Mares 
3031c31d620SMartin Mares /* AGP registers */
3041c31d620SMartin Mares 
3051c31d620SMartin Mares #define PCI_AGP_VERSION		2	/* BCD version number */
3061c31d620SMartin Mares #define PCI_AGP_RFU		3	/* Rest of capability flags */
3071c31d620SMartin Mares #define PCI_AGP_STATUS		4	/* Status register */
3081c31d620SMartin Mares #define  PCI_AGP_STATUS_RQ_MASK	0xff000000	/* Maximum number of requests - 1 */
309579b19ffSMartin Mares #define  PCI_AGP_STATUS_ISOCH	0x10000	/* Isochronous transactions supported */
310579b19ffSMartin Mares #define  PCI_AGP_STATUS_ARQSZ_MASK	0xe000	/* log2(optimum async req size in bytes) - 4 */
311579b19ffSMartin Mares #define  PCI_AGP_STATUS_CAL_MASK	0x1c00	/* Calibration cycle timing */
3121c31d620SMartin Mares #define  PCI_AGP_STATUS_SBA	0x0200	/* Sideband addressing supported */
313579b19ffSMartin Mares #define  PCI_AGP_STATUS_ITA_COH	0x0100	/* In-aperture accesses always coherent */
314579b19ffSMartin Mares #define  PCI_AGP_STATUS_GART64	0x0080	/* 64-bit GART entries supported */
315579b19ffSMartin Mares #define  PCI_AGP_STATUS_HTRANS	0x0040	/* If 0, core logic can xlate host CPU accesses thru aperture */
316579b19ffSMartin Mares #define  PCI_AGP_STATUS_64BIT	0x0020	/* 64-bit addressing cycles supported */
317579b19ffSMartin Mares #define  PCI_AGP_STATUS_FW	0x0010	/* Fast write transfers supported */
318579b19ffSMartin Mares #define  PCI_AGP_STATUS_AGP3	0x0008	/* AGP3 mode supported */
319579b19ffSMartin Mares #define  PCI_AGP_STATUS_RATE4	0x0004	/* 4x transfer rate supported (RFU in AGP3 mode) */
320579b19ffSMartin Mares #define  PCI_AGP_STATUS_RATE2	0x0002	/* 2x transfer rate supported (8x in AGP3 mode) */
321579b19ffSMartin Mares #define  PCI_AGP_STATUS_RATE1	0x0001	/* 1x transfer rate supported (4x in AGP3 mode) */
3221c31d620SMartin Mares #define PCI_AGP_COMMAND		8	/* Control register */
3231c31d620SMartin Mares #define  PCI_AGP_COMMAND_RQ_MASK 0xff000000  /* Master: Maximum number of requests */
324579b19ffSMartin Mares #define  PCI_AGP_COMMAND_ARQSZ_MASK	0xe000	/* log2(optimum async req size in bytes) - 4 */
325579b19ffSMartin Mares #define  PCI_AGP_COMMAND_CAL_MASK	0x1c00	/* Calibration cycle timing */
3261c31d620SMartin Mares #define  PCI_AGP_COMMAND_SBA	0x0200	/* Sideband addressing enabled */
3271c31d620SMartin Mares #define  PCI_AGP_COMMAND_AGP	0x0100	/* Allow processing of AGP transactions */
328579b19ffSMartin Mares #define  PCI_AGP_COMMAND_GART64	0x0080	/* 64-bit GART entries enabled */
329579b19ffSMartin Mares #define  PCI_AGP_COMMAND_64BIT	0x0020 	/* Allow generation of 64-bit addr cycles */
330579b19ffSMartin Mares #define  PCI_AGP_COMMAND_FW	0x0010 	/* Enable FW transfers */
331579b19ffSMartin Mares #define  PCI_AGP_COMMAND_RATE4	0x0004	/* Use 4x rate (RFU in AGP3 mode) */
332579b19ffSMartin Mares #define  PCI_AGP_COMMAND_RATE2	0x0002	/* Use 2x rate (8x in AGP3 mode) */
333579b19ffSMartin Mares #define  PCI_AGP_COMMAND_RATE1	0x0001	/* Use 1x rate (4x in AGP3 mode) */
3341c31d620SMartin Mares #define PCI_AGP_SIZEOF		12
335d6b297d0SMartin Mares 
336522f0277SBen Hutchings /* Vital Product Data */
337522f0277SBen Hutchings 
338522f0277SBen Hutchings #define PCI_VPD_ADDR		2	/* Address to access (15 bits!) */
339522f0277SBen Hutchings #define  PCI_VPD_ADDR_MASK	0x7fff	/* Address mask */
340522f0277SBen Hutchings #define  PCI_VPD_ADDR_F		0x8000	/* Write 0, 1 indicates completion */
341522f0277SBen Hutchings #define PCI_VPD_DATA		4	/* 32-bits of data returned here */
342522f0277SBen Hutchings 
343e95c8373SMartin Mares /* Slot Identification */
344e95c8373SMartin Mares 
345e95c8373SMartin Mares #define PCI_SID_ESR		2	/* Expansion Slot Register */
346e95c8373SMartin Mares #define  PCI_SID_ESR_NSLOTS	0x1f	/* Number of expansion slots available */
347e95c8373SMartin Mares #define  PCI_SID_ESR_FIC	0x20	/* First In Chassis Flag */
348e95c8373SMartin Mares #define PCI_SID_CHASSIS_NR	3	/* Chassis Number */
349e95c8373SMartin Mares 
350acbd2e05SMartin Mares /* Message Signaled Interrupts registers */
351e95c8373SMartin Mares 
352e95c8373SMartin Mares #define PCI_MSI_FLAGS		2	/* Various flags */
353c7ddfa3eSMartin Mares #define  PCI_MSI_FLAGS_MASK_BIT	0x100	/* interrupt masking & reporting supported */
354c7ddfa3eSMartin Mares #define  PCI_MSI_FLAGS_64BIT	0x080	/* 64-bit addresses allowed */
355c7ddfa3eSMartin Mares #define  PCI_MSI_FLAGS_QSIZE	0x070	/* Message queue size configured */
356c7ddfa3eSMartin Mares #define  PCI_MSI_FLAGS_QMASK	0x00e	/* Maximum queue size available */
357c7ddfa3eSMartin Mares #define  PCI_MSI_FLAGS_ENABLE	0x001	/* MSI feature enabled */
358e95c8373SMartin Mares #define PCI_MSI_RFU		3	/* Rest of capability flags */
359e95c8373SMartin Mares #define PCI_MSI_ADDRESS_LO	4	/* Lower 32 bits */
360e95c8373SMartin Mares #define PCI_MSI_ADDRESS_HI	8	/* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
361e95c8373SMartin Mares #define PCI_MSI_DATA_32		8	/* 16 bits of data for 32-bit devices */
362e95c8373SMartin Mares #define PCI_MSI_DATA_64		12	/* 16 bits of data for 64-bit devices */
363c7ddfa3eSMartin Mares #define PCI_MSI_MASK_BIT_32	12	/* per-vector masking for 32-bit devices */
364c7ddfa3eSMartin Mares #define PCI_MSI_MASK_BIT_64	16	/* per-vector masking for 64-bit devices */
365c7ddfa3eSMartin Mares #define PCI_MSI_PENDING_32	16	/* per-vector interrupt pending for 32-bit devices */
366c7ddfa3eSMartin Mares #define PCI_MSI_PENDING_64	20	/* per-vector interrupt pending for 64-bit devices */
367e95c8373SMartin Mares 
3685f5e6f64SMartin Mares /* PCI-X */
3695f5e6f64SMartin Mares #define PCI_PCIX_COMMAND                                                2 /* Command register offset */
3705f5e6f64SMartin Mares #define PCI_PCIX_COMMAND_DPERE                                     0x0001 /* Data Parity Error Recover Enable */
3715f5e6f64SMartin Mares #define PCI_PCIX_COMMAND_ERO                                       0x0002 /* Enable Relaxed Ordering */
3725f5e6f64SMartin Mares #define PCI_PCIX_COMMAND_MAX_MEM_READ_BYTE_COUNT                   0x000c /* Maximum Memory Read Byte Count */
3735f5e6f64SMartin Mares #define PCI_PCIX_COMMAND_MAX_OUTSTANDING_SPLIT_TRANS               0x0070
3745f5e6f64SMartin Mares #define PCI_PCIX_COMMAND_RESERVED                                   0xf80
3755f5e6f64SMartin Mares #define PCI_PCIX_STATUS                                                 4 /* Status register offset */
3765f5e6f64SMartin Mares #define PCI_PCIX_STATUS_FUNCTION                               0x00000007
3775f5e6f64SMartin Mares #define PCI_PCIX_STATUS_DEVICE                                 0x000000f8
3785f5e6f64SMartin Mares #define PCI_PCIX_STATUS_BUS                                    0x0000ff00
3795f5e6f64SMartin Mares #define PCI_PCIX_STATUS_64BIT                                  0x00010000
3805f5e6f64SMartin Mares #define PCI_PCIX_STATUS_133MHZ                                 0x00020000
3815f5e6f64SMartin Mares #define PCI_PCIX_STATUS_SC_DISCARDED                           0x00040000 /* Split Completion Discarded */
3825f5e6f64SMartin Mares #define PCI_PCIX_STATUS_UNEXPECTED_SC                          0x00080000 /* Unexpected Split Completion */
3835f5e6f64SMartin Mares #define PCI_PCIX_STATUS_DEVICE_COMPLEXITY                      0x00100000 /* 0 = simple device, 1 = bridge device */
3845f5e6f64SMartin Mares #define PCI_PCIX_STATUS_DESIGNED_MAX_MEM_READ_BYTE_COUNT       0x00600000 /* 0 = 512 bytes, 1 = 1024, 2 = 2048, 3 = 4096 */
3855f5e6f64SMartin Mares #define PCI_PCIX_STATUS_DESIGNED_MAX_OUTSTANDING_SPLIT_TRANS   0x03800000
3865f5e6f64SMartin Mares #define PCI_PCIX_STATUS_DESIGNED_MAX_CUMULATIVE_READ_SIZE      0x1c000000
3875f5e6f64SMartin Mares #define PCI_PCIX_STATUS_RCVD_SC_ERR_MESS                       0x20000000 /* Received Split Completion Error Message */
3883b8bf739SMartin Mares #define PCI_PCIX_STATUS_266MHZ				       0x40000000 /* 266 MHz capable */
3893b8bf739SMartin Mares #define PCI_PCIX_STATUS_533MHZ				       0x80000000 /* 533 MHz capable */
3905f5e6f64SMartin Mares #define PCI_PCIX_SIZEOF		4
3915f5e6f64SMartin Mares 
3925f5e6f64SMartin Mares /* PCI-X Bridges */
3935f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS                                      2 /* Secondary bus status register offset */
3945f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_64BIT                           0x0001
3955f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_133MHZ                          0x0002
3965f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_SC_DISCARDED                    0x0004 /* Split Completion Discarded on secondary bus */
3975f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_UNEXPECTED_SC                   0x0008 /* Unexpected Split Completion on secondary bus */
3985f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_SC_OVERRUN                      0x0010 /* Split Completion Overrun on secondary bus */
3995f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_SPLIT_REQUEST_DELAYED           0x0020
4005f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_CLOCK_FREQ                      0x01c0
4015f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SEC_STATUS_RESERVED                        0xfe00
4025f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS                                          4 /* Primary bus status register offset */
4035f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_FUNCTION                        0x00000007
4045f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_DEVICE                          0x000000f8
4055f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_BUS                             0x0000ff00
4065f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_64BIT                           0x00010000
4075f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_133MHZ                          0x00020000
4085f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_SC_DISCARDED                    0x00040000 /* Split Completion Discarded */
4095f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_UNEXPECTED_SC                   0x00080000 /* Unexpected Split Completion */
4105f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_SC_OVERRUN                      0x00100000 /* Split Completion Overrun */
4115f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_SPLIT_REQUEST_DELAYED           0x00200000
4125f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STATUS_RESERVED                        0xffc00000
4135f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_UPSTREAM_SPLIT_TRANS_CTRL                       8 /* Upstream Split Transaction Register offset */
4145f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_DOWNSTREAM_SPLIT_TRANS_CTRL                    12 /* Downstream Split Transaction Register offset */
4155f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STR_CAPACITY                           0x0000ffff
4165f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_STR_COMMITMENT_LIMIT                   0xffff0000
4175f5e6f64SMartin Mares #define PCI_PCIX_BRIDGE_SIZEOF 12
4185f5e6f64SMartin Mares 
41980e6c636SMartin Mares /* HyperTransport (as of spec rev. 2.00) */
420bfc4fe7aSMartin Mares #define PCI_HT_CMD		2	/* Command Register */
421bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_HI	0xe000	/* Capability Type high part */
422bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_HI_PRI	0x0000	/* Slave or Primary Interface */
423bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_HI_SEC	0x2000	/* Host or Secondary Interface */
424bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP		0xf800	/* Capability Type */
425bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_SW	0x4000	/* Switch */
426bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_IDC	0x8000	/* Interrupt Discovery and Configuration */
427bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_RID	0x8800	/* Revision ID */
428bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_UIDC	0x9000	/* UnitID Clumping */
429bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_ECSA	0x9800	/* Extended Configuration Space Access */
430bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_AM	0xa000	/* Address Mapping */
431bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_MSIM	0xa800	/* MSI Mapping */
432bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_DR	0xb000	/* DirectRoute */
433bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_VCS	0xb800	/* VCSet */
434bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_RM	0xc000	/* Retry Mode */
435bfc4fe7aSMartin Mares #define  PCI_HT_CMD_TYP_X86	0xc800	/* X86 (reserved) */
436bfc4fe7aSMartin Mares 
437bfc4fe7aSMartin Mares 					/* Link Control Register */
438bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_CFLE	0x0002	/* CRC Flood Enable */
439bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_CST	0x0004	/* CRC Start Test */
440bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_CFE	0x0008	/* CRC Force Error */
441bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_LKFAIL	0x0010	/* Link Failure */
442bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_INIT	0x0020	/* Initialization Complete */
443bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_EOC	0x0040	/* End of Chain */
444bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_TXO	0x0080	/* Transmitter Off */
445bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_CRCERR	0x0f00	/* CRC Error */
446bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_ISOCEN	0x1000	/* Isochronous Flow Control Enable */
447bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_LSEN	0x2000	/* LDTSTOP# Tristate Enable */
448bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_EXTCTL	0x4000	/* Extended CTL Time */
449bfc4fe7aSMartin Mares #define  PCI_HT_LCTR_64B	0x8000	/* 64-bit Addressing Enable */
450bfc4fe7aSMartin Mares 
451bfc4fe7aSMartin Mares 					/* Link Configuration Register */
452bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_MLWI	0x0007	/* Max Link Width In */
453bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LW_8B	0x0	/* Link Width 8 bits */
454bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LW_16B	0x1	/* Link Width 16 bits */
455bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LW_32B	0x3	/* Link Width 32 bits */
456bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LW_2B	0x4	/* Link Width 2 bits */
457bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LW_4B	0x5	/* Link Width 4 bits */
458bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LW_NC	0x7	/* Link physically not connected */
459bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_DFI	0x0008	/* Doubleword Flow Control In */
460bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_MLWO	0x0070	/* Max Link Width Out */
461bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_DFO	0x0080	/* Doubleword Flow Control Out */
462bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LWI	0x0700	/* Link Width In */
463bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_DFIE	0x0800	/* Doubleword Flow Control In Enable */
464bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_LWO	0x7000	/* Link Width Out */
465bfc4fe7aSMartin Mares #define  PCI_HT_LCNF_DFOE	0x8000	/* Doubleword Flow Control Out Enable */
466bfc4fe7aSMartin Mares 
467bfc4fe7aSMartin Mares 					/* Revision ID Register */
468bfc4fe7aSMartin Mares #define  PCI_HT_RID_MIN		0x1f	/* Minor Revision */
469bfc4fe7aSMartin Mares #define  PCI_HT_RID_MAJ		0xe0	/* Major Revision */
470bfc4fe7aSMartin Mares 
471bfc4fe7aSMartin Mares 					/* Link Frequency/Error Register */
472bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_FREQ	0x0f	/* Transmitter Clock Frequency */
473bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_200	0x00	/* 200MHz */
474bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_300	0x01	/* 300MHz */
475bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_400	0x02	/* 400MHz */
476bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_500	0x03	/* 500MHz */
477bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_600	0x04	/* 600MHz */
478bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_800	0x05	/* 800MHz */
479bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_1000	0x06	/* 1.0GHz */
480bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_1200	0x07	/* 1.2GHz */
481bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_1400	0x08	/* 1.4GHz */
482bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_1600	0x09	/* 1.6GHz */
483bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_VEND	0x0f	/* Vendor-Specific */
484bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_ERR	0xf0	/* Link Error */
485bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_PROT	0x10	/* Protocol Error */
486bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_OV	0x20	/* Overflow Error */
487bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_EOC	0x40	/* End of Chain Error */
488bfc4fe7aSMartin Mares #define  PCI_HT_LFRER_CTLT	0x80	/* CTL Timeout */
489bfc4fe7aSMartin Mares 
490bfc4fe7aSMartin Mares 					/* Link Frequency Capability Register */
491bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_200	0x0001	/* 200MHz */
492bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_300	0x0002	/* 300MHz */
493bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_400	0x0004	/* 400MHz */
494bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_500	0x0008	/* 500MHz */
495bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_600	0x0010	/* 600MHz */
496bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_800	0x0020	/* 800MHz */
497bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_1000	0x0040	/* 1.0GHz */
498bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_1200	0x0080	/* 1.2GHz */
499bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_1400	0x0100	/* 1.4GHz */
500bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_1600	0x0200	/* 1.6GHz */
501bfc4fe7aSMartin Mares #define  PCI_HT_LFCAP_VEND	0x8000	/* Vendor-Specific */
502bfc4fe7aSMartin Mares 
503bfc4fe7aSMartin Mares 					/* Feature Register */
504bfc4fe7aSMartin Mares #define  PCI_HT_FTR_ISOCFC	0x0001	/* Isochronous Flow Control Mode */
505bfc4fe7aSMartin Mares #define  PCI_HT_FTR_LDTSTOP	0x0002	/* LDTSTOP# Supported */
506bfc4fe7aSMartin Mares #define  PCI_HT_FTR_CRCTM	0x0004	/* CRC Test Mode */
507bfc4fe7aSMartin Mares #define  PCI_HT_FTR_ECTLT	0x0008	/* Extended CTL Time Required */
508bfc4fe7aSMartin Mares #define  PCI_HT_FTR_64BA	0x0010	/* 64-bit Addressing */
509bfc4fe7aSMartin Mares #define  PCI_HT_FTR_UIDRD	0x0020	/* UnitID Reorder Disable */
510bfc4fe7aSMartin Mares 
511bfc4fe7aSMartin Mares 					/* Error Handling Register */
512bfc4fe7aSMartin Mares #define  PCI_HT_EH_PFLE		0x0001	/* Protocol Error Flood Enable */
513bfc4fe7aSMartin Mares #define  PCI_HT_EH_OFLE		0x0002	/* Overflow Error Flood Enable */
514bfc4fe7aSMartin Mares #define  PCI_HT_EH_PFE		0x0004	/* Protocol Error Fatal Enable */
515bfc4fe7aSMartin Mares #define  PCI_HT_EH_OFE		0x0008	/* Overflow Error Fatal Enable */
516bfc4fe7aSMartin Mares #define  PCI_HT_EH_EOCFE	0x0010	/* End of Chain Error Fatal Enable */
517bfc4fe7aSMartin Mares #define  PCI_HT_EH_RFE		0x0020	/* Response Error Fatal Enable */
518bfc4fe7aSMartin Mares #define  PCI_HT_EH_CRCFE	0x0040	/* CRC Error Fatal Enable */
519bfc4fe7aSMartin Mares #define  PCI_HT_EH_SERRFE	0x0080	/* System Error Fatal Enable (B */
520bfc4fe7aSMartin Mares #define  PCI_HT_EH_CF		0x0100	/* Chain Fail */
521bfc4fe7aSMartin Mares #define  PCI_HT_EH_RE		0x0200	/* Response Error */
522bfc4fe7aSMartin Mares #define  PCI_HT_EH_PNFE		0x0400	/* Protocol Error Nonfatal Enable */
523bfc4fe7aSMartin Mares #define  PCI_HT_EH_ONFE		0x0800	/* Overflow Error Nonfatal Enable */
524bfc4fe7aSMartin Mares #define  PCI_HT_EH_EOCNFE	0x1000	/* End of Chain Error Nonfatal Enable */
525bfc4fe7aSMartin Mares #define  PCI_HT_EH_RNFE		0x2000	/* Response Error Nonfatal Enable */
526bfc4fe7aSMartin Mares #define  PCI_HT_EH_CRCNFE	0x4000	/* CRC Error Nonfatal Enable */
527bfc4fe7aSMartin Mares #define  PCI_HT_EH_SERRNFE	0x8000	/* System Error Nonfatal Enable */
528bfc4fe7aSMartin Mares 
529bfc4fe7aSMartin Mares /* HyperTransport: Slave or Primary Interface */
530bfc4fe7aSMartin Mares #define PCI_HT_PRI_CMD		2	/* Command Register */
531bfc4fe7aSMartin Mares #define  PCI_HT_PRI_CMD_BUID	0x001f	/* Base UnitID */
532bfc4fe7aSMartin Mares #define  PCI_HT_PRI_CMD_UC	0x03e0	/* Unit Count */
533bfc4fe7aSMartin Mares #define  PCI_HT_PRI_CMD_MH	0x0400	/* Master Host */
534bfc4fe7aSMartin Mares #define  PCI_HT_PRI_CMD_DD	0x0800	/* Default Direction */
535bfc4fe7aSMartin Mares #define  PCI_HT_PRI_CMD_DUL	0x1000	/* Drop on Uninitialized Link */
536bfc4fe7aSMartin Mares 
537bfc4fe7aSMartin Mares #define PCI_HT_PRI_LCTR0	4	/* Link Control 0 Register */
538bfc4fe7aSMartin Mares #define PCI_HT_PRI_LCNF0	6	/* Link Config 0 Register */
539bfc4fe7aSMartin Mares #define PCI_HT_PRI_LCTR1	8	/* Link Control 1 Register */
540bfc4fe7aSMartin Mares #define PCI_HT_PRI_LCNF1	10	/* Link Config 1 Register */
541bfc4fe7aSMartin Mares #define PCI_HT_PRI_RID		12	/* Revision ID Register */
542bfc4fe7aSMartin Mares #define PCI_HT_PRI_LFRER0	13	/* Link Frequency/Error 0 Register */
543bfc4fe7aSMartin Mares #define PCI_HT_PRI_LFCAP0	14	/* Link Frequency Capability 0 Register */
544bfc4fe7aSMartin Mares #define PCI_HT_PRI_FTR		16	/* Feature Register */
545bfc4fe7aSMartin Mares #define PCI_HT_PRI_LFRER1	17	/* Link Frequency/Error 1 Register */
546bfc4fe7aSMartin Mares #define PCI_HT_PRI_LFCAP1	18	/* Link Frequency Capability 1 Register */
547bfc4fe7aSMartin Mares #define PCI_HT_PRI_ES		20	/* Enumeration Scratchpad Register */
548bfc4fe7aSMartin Mares #define PCI_HT_PRI_EH		22	/* Error Handling Register */
549bfc4fe7aSMartin Mares #define PCI_HT_PRI_MBU		24	/* Memory Base Upper Register */
550bfc4fe7aSMartin Mares #define PCI_HT_PRI_MLU		25	/* Memory Limit Upper Register */
551bfc4fe7aSMartin Mares #define PCI_HT_PRI_BN		26	/* Bus Number Register */
552bfc4fe7aSMartin Mares #define PCI_HT_PRI_SIZEOF	28
553bfc4fe7aSMartin Mares 
554bfc4fe7aSMartin Mares /* HyperTransport: Host or Secondary Interface */
555bfc4fe7aSMartin Mares #define PCI_HT_SEC_CMD		2	/* Command Register */
556bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_WR	0x0001	/* Warm Reset */
557bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_DE	0x0002	/* Double-Ended */
558224b552fSMikhail Bratchikov #define  PCI_HT_SEC_CMD_DN	0x007c	/* Device Number */
559bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_CS	0x0080	/* Chain Side */
560bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_HH	0x0100	/* Host Hide */
561bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_AS	0x0400	/* Act as Slave */
562bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_HIECE	0x0800	/* Host Inbound End of Chain Error */
563bfc4fe7aSMartin Mares #define  PCI_HT_SEC_CMD_DUL	0x1000	/* Drop on Uninitialized Link */
564bfc4fe7aSMartin Mares 
565bfc4fe7aSMartin Mares #define PCI_HT_SEC_LCTR		4	/* Link Control Register */
566bfc4fe7aSMartin Mares #define PCI_HT_SEC_LCNF		6	/* Link Config Register */
567bfc4fe7aSMartin Mares #define PCI_HT_SEC_RID		8	/* Revision ID Register */
568bfc4fe7aSMartin Mares #define PCI_HT_SEC_LFRER	9	/* Link Frequency/Error Register */
569bfc4fe7aSMartin Mares #define PCI_HT_SEC_LFCAP	10	/* Link Frequency Capability Register */
570bfc4fe7aSMartin Mares #define PCI_HT_SEC_FTR		12	/* Feature Register */
571bfc4fe7aSMartin Mares #define  PCI_HT_SEC_FTR_EXTRS	0x0100	/* Extended Register Set */
572bfc4fe7aSMartin Mares #define  PCI_HT_SEC_FTR_UCNFE	0x0200	/* Upstream Configuration Enable */
573bfc4fe7aSMartin Mares #define PCI_HT_SEC_ES		16	/* Enumeration Scratchpad Register */
574bfc4fe7aSMartin Mares #define PCI_HT_SEC_EH		18	/* Error Handling Register */
575bfc4fe7aSMartin Mares #define PCI_HT_SEC_MBU		20	/* Memory Base Upper Register */
576bfc4fe7aSMartin Mares #define PCI_HT_SEC_MLU		21	/* Memory Limit Upper Register */
577bfc4fe7aSMartin Mares #define PCI_HT_SEC_SIZEOF	24
578bfc4fe7aSMartin Mares 
579bfc4fe7aSMartin Mares /* HyperTransport: Switch */
580bfc4fe7aSMartin Mares #define PCI_HT_SW_CMD		2	/* Switch Command Register */
581bfc4fe7aSMartin Mares #define  PCI_HT_SW_CMD_VIBERR	0x0080	/* VIB Error */
582bfc4fe7aSMartin Mares #define  PCI_HT_SW_CMD_VIBFL	0x0100	/* VIB Flood */
583bfc4fe7aSMartin Mares #define  PCI_HT_SW_CMD_VIBFT	0x0200	/* VIB Fatal */
584bfc4fe7aSMartin Mares #define  PCI_HT_SW_CMD_VIBNFT	0x0400	/* VIB Nonfatal */
585bfc4fe7aSMartin Mares #define PCI_HT_SW_PMASK		4	/* Partition Mask Register */
586bfc4fe7aSMartin Mares #define PCI_HT_SW_SWINF		8	/* Switch Info Register */
587bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_DP	0x0000001f /* Default Port */
588bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_EN	0x00000020 /* Enable Decode */
589bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_CR	0x00000040 /* Cold Reset */
590bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_PCIDX	0x00000f00 /* Performance Counter Index */
591bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_BLRIDX	0x0003f000 /* Base/Limit Range Index */
592bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_SBIDX	0x00002000 /* Secondary Base Range Index */
593bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_HP	0x00040000 /* Hot Plug */
594bfc4fe7aSMartin Mares #define  PCI_HT_SW_SWINF_HIDE	0x00080000 /* Hide Port */
595bfc4fe7aSMartin Mares #define PCI_HT_SW_PCD		12	/* Performance Counter Data Register */
596bfc4fe7aSMartin Mares #define PCI_HT_SW_BLRD		16	/* Base/Limit Range Data Register */
597bfc4fe7aSMartin Mares #define PCI_HT_SW_SBD		20	/* Secondary Base Data Register */
598bfc4fe7aSMartin Mares #define PCI_HT_SW_SIZEOF	24
599bfc4fe7aSMartin Mares 
600bfc4fe7aSMartin Mares 					/* Counter indices */
601bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_PCR	0x0	/* Posted Command Receive */
602bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_NPCR	0x1	/* Nonposted Command Receive */
603bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_RCR	0x2	/* Response Command Receive */
604bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_PDWR	0x3	/* Posted DW Receive */
605bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_NPDWR	0x4	/* Nonposted DW Receive */
606bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_RDWR	0x5	/* Response DW Receive */
607bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_PCT	0x6	/* Posted Command Transmit */
608bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_NPCT	0x7	/* Nonposted Command Transmit */
609bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_RCT	0x8	/* Response Command Transmit */
610bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_PDWT	0x9	/* Posted DW Transmit */
611bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_NPDWT	0xa	/* Nonposted DW Transmit */
612bfc4fe7aSMartin Mares #define  PCI_HT_SW_PC_RDWT	0xb	/* Response DW Transmit */
613bfc4fe7aSMartin Mares 
614bfc4fe7aSMartin Mares 					/* Base/Limit Range indices */
615bfc4fe7aSMartin Mares #define  PCI_HT_SW_BLR_BASE0_LO	0x0	/* Base 0[31:1], Enable */
616bfc4fe7aSMartin Mares #define  PCI_HT_SW_BLR_BASE0_HI	0x1	/* Base 0 Upper */
617bfc4fe7aSMartin Mares #define  PCI_HT_SW_BLR_LIM0_LO	0x2	/* Limit 0 Lower */
618bfc4fe7aSMartin Mares #define  PCI_HT_SW_BLR_LIM0_HI	0x3	/* Limit 0 Upper */
619bfc4fe7aSMartin Mares 
620bfc4fe7aSMartin Mares 					/* Secondary Base indices */
621bfc4fe7aSMartin Mares #define  PCI_HT_SW_SB_LO	0x0	/* Secondary Base[31:1], Enable */
622bfc4fe7aSMartin Mares #define  PCI_HT_SW_S0_HI	0x1	/* Secondary Base Upper */
623bfc4fe7aSMartin Mares 
624bfc4fe7aSMartin Mares /* HyperTransport: Interrupt Discovery and Configuration */
625bfc4fe7aSMartin Mares #define PCI_HT_IDC_IDX		2	/* Index Register */
626bfc4fe7aSMartin Mares #define PCI_HT_IDC_DATA		4	/* Data Register */
627bfc4fe7aSMartin Mares #define PCI_HT_IDC_SIZEOF	8
628bfc4fe7aSMartin Mares 
629bfc4fe7aSMartin Mares 					/* Register indices */
630bfc4fe7aSMartin Mares #define  PCI_HT_IDC_IDX_LINT	0x01	/* Last Interrupt Register */
631bfc4fe7aSMartin Mares #define   PCI_HT_IDC_LINT	0x00ff0000 /* Last interrupt definition */
632bfc4fe7aSMartin Mares #define  PCI_HT_IDC_IDX_IDR	0x10	/* Interrupt Definition Registers */
633bfc4fe7aSMartin Mares 					/* Low part (at index) */
634bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_MASK	0x10000001 /* Mask */
635bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_POL	0x10000002 /* Polarity */
636bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_II_2	0x1000001c /* IntrInfo[4:2]: Message Type */
637bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_II_5	0x10000020 /* IntrInfo[5]: Request EOI */
638bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_II_6	0x00ffffc0 /* IntrInfo[23:6] */
639bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_II_24	0xff000000 /* IntrInfo[31:24] */
640bfc4fe7aSMartin Mares 					/* High part (at index + 1) */
641bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_II_32	0x00ffffff /* IntrInfo[55:32] */
642bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_PASSPW	0x40000000 /* PassPW setting for messages */
643bfc4fe7aSMartin Mares #define   PCI_HT_IDC_IDR_WEOI	0x80000000 /* Waiting for EOI */
644bfc4fe7aSMartin Mares 
645bfc4fe7aSMartin Mares /* HyperTransport: Revision ID */
646bfc4fe7aSMartin Mares #define PCI_HT_RID_RID		2	/* Revision Register */
647bfc4fe7aSMartin Mares #define PCI_HT_RID_SIZEOF	4
648bfc4fe7aSMartin Mares 
649bfc4fe7aSMartin Mares /* HyperTransport: UnitID Clumping */
650bfc4fe7aSMartin Mares #define PCI_HT_UIDC_CS		4	/* Clumping Support Register */
651bfc4fe7aSMartin Mares #define PCI_HT_UIDC_CE		8	/* Clumping Enable Register */
652bfc4fe7aSMartin Mares #define PCI_HT_UIDC_SIZEOF	12
653bfc4fe7aSMartin Mares 
654bfc4fe7aSMartin Mares /* HyperTransport: Extended Configuration Space Access */
655bfc4fe7aSMartin Mares #define PCI_HT_ECSA_ADDR	4	/* Configuration Address Register */
656bfc4fe7aSMartin Mares #define  PCI_HT_ECSA_ADDR_REG	0x00000ffc /* Register */
657bfc4fe7aSMartin Mares #define  PCI_HT_ECSA_ADDR_FUN	0x00007000 /* Function */
658bfc4fe7aSMartin Mares #define  PCI_HT_ECSA_ADDR_DEV	0x000f1000 /* Device */
659bfc4fe7aSMartin Mares #define  PCI_HT_ECSA_ADDR_BUS	0x0ff00000 /* Bus Number */
660bfc4fe7aSMartin Mares #define  PCI_HT_ECSA_ADDR_TYPE	0x10000000 /* Access Type */
661bfc4fe7aSMartin Mares #define PCI_HT_ECSA_DATA	8	/* Configuration Data Register */
662bfc4fe7aSMartin Mares #define PCI_HT_ECSA_SIZEOF	12
663bfc4fe7aSMartin Mares 
664bfc4fe7aSMartin Mares /* HyperTransport: Address Mapping */
665bfc4fe7aSMartin Mares #define PCI_HT_AM_CMD		2	/* Command Register */
666bfc4fe7aSMartin Mares #define  PCI_HT_AM_CMD_NDMA	0x000f	/* Number of DMA Mappings */
667bfc4fe7aSMartin Mares #define  PCI_HT_AM_CMD_IOSIZ	0x01f0	/* I/O Size */
668bfc4fe7aSMartin Mares #define  PCI_HT_AM_CMD_MT	0x0600	/* Map Type */
669bfc4fe7aSMartin Mares #define  PCI_HT_AM_CMD_MT_40B	0x0000	/* 40-bit */
670bfc4fe7aSMartin Mares #define  PCI_HT_AM_CMD_MT_64B	0x0200	/* 64-bit */
671bfc4fe7aSMartin Mares 
672bfc4fe7aSMartin Mares 					/* Window Control Register bits */
673bfc4fe7aSMartin Mares #define  PCI_HT_AM_SBW_CTR_COMP	0x1	/* Compat */
674bfc4fe7aSMartin Mares #define  PCI_HT_AM_SBW_CTR_NCOH	0x2	/* NonCoherent */
675bfc4fe7aSMartin Mares #define  PCI_HT_AM_SBW_CTR_ISOC	0x4	/* Isochronous */
676bfc4fe7aSMartin Mares #define  PCI_HT_AM_SBW_CTR_EN	0x8	/* Enable */
677bfc4fe7aSMartin Mares 
678bfc4fe7aSMartin Mares /* HyperTransport: 40-bit Address Mapping */
679bfc4fe7aSMartin Mares #define PCI_HT_AM40_SBNPW	4	/* Secondary Bus Non-Prefetchable Window Register */
680bfc4fe7aSMartin Mares #define  PCI_HT_AM40_SBW_BASE	0x000fffff /* Window Base */
681bfc4fe7aSMartin Mares #define  PCI_HT_AM40_SBW_CTR	0xf0000000 /* Window Control */
682bfc4fe7aSMartin Mares #define PCI_HT_AM40_SBPW	8	/* Secondary Bus Prefetchable Window Register */
683bfc4fe7aSMartin Mares #define PCI_HT_AM40_DMA_PBASE0	12	/* DMA Window Primary Base 0 Register */
684bfc4fe7aSMartin Mares #define PCI_HT_AM40_DMA_CTR0	15	/* DMA Window Control 0 Register */
685bfc4fe7aSMartin Mares #define  PCI_HT_AM40_DMA_CTR_CTR 0xf0	/* Window Control */
686bfc4fe7aSMartin Mares #define PCI_HT_AM40_DMA_SLIM0	16	/* DMA Window Secondary Limit 0 Register */
687bfc4fe7aSMartin Mares #define PCI_HT_AM40_DMA_SBASE0	18	/* DMA Window Secondary Base 0 Register */
688bfc4fe7aSMartin Mares #define PCI_HT_AM40_SIZEOF	12	/* size is variable: 12 + 8 * NDMA */
689bfc4fe7aSMartin Mares 
690bfc4fe7aSMartin Mares /* HyperTransport: 64-bit Address Mapping */
691bfc4fe7aSMartin Mares #define PCI_HT_AM64_IDX		4	/* Index Register */
692bfc4fe7aSMartin Mares #define PCI_HT_AM64_DATA_LO	8	/* Data Lower Register */
693bfc4fe7aSMartin Mares #define PCI_HT_AM64_DATA_HI	12	/* Data Upper Register */
694bfc4fe7aSMartin Mares #define PCI_HT_AM64_SIZEOF	16
695bfc4fe7aSMartin Mares 
696bfc4fe7aSMartin Mares 					/* Register indices */
697bfc4fe7aSMartin Mares #define  PCI_HT_AM64_IDX_SBNPW	0x00	/* Secondary Bus Non-Prefetchable Window Register */
698bfc4fe7aSMartin Mares #define   PCI_HT_AM64_W_BASE_LO	0xfff00000 /* Window Base Lower */
699bfc4fe7aSMartin Mares #define   PCI_HT_AM64_W_CTR	0x0000000f /* Window Control */
700bfc4fe7aSMartin Mares #define  PCI_HT_AM64_IDX_SBPW	0x01	/* Secondary Bus Prefetchable Window Register */
701bfc4fe7aSMartin Mares #define   PCI_HT_AM64_IDX_PBNPW	0x02	/* Primary Bus Non-Prefetchable Window Register */
702bfc4fe7aSMartin Mares #define   PCI_HT_AM64_IDX_DMAPB0 0x04	/* DMA Window Primary Base 0 Register */
703bfc4fe7aSMartin Mares #define   PCI_HT_AM64_IDX_DMASB0 0x05	/* DMA Window Secondary Base 0 Register */
704bfc4fe7aSMartin Mares #define   PCI_HT_AM64_IDX_DMASL0 0x06	/* DMA Window Secondary Limit 0 Register */
705bfc4fe7aSMartin Mares 
706bfc4fe7aSMartin Mares /* HyperTransport: MSI Mapping */
707bfc4fe7aSMartin Mares #define PCI_HT_MSIM_CMD		2	/* Command Register */
708bfc4fe7aSMartin Mares #define  PCI_HT_MSIM_CMD_EN	0x0001	/* Mapping Active */
709bfc4fe7aSMartin Mares #define  PCI_HT_MSIM_CMD_FIXD	0x0002	/* MSI Mapping Address Fixed */
710bfc4fe7aSMartin Mares #define PCI_HT_MSIM_ADDR_LO	4	/* MSI Mapping Address Lower Register */
711bfc4fe7aSMartin Mares #define PCI_HT_MSIM_ADDR_HI	8	/* MSI Mapping Address Upper Register */
712bfc4fe7aSMartin Mares #define PCI_HT_MSIM_SIZEOF	12
713bfc4fe7aSMartin Mares 
714bfc4fe7aSMartin Mares /* HyperTransport: DirectRoute */
715bfc4fe7aSMartin Mares #define PCI_HT_DR_CMD		2	/* Command Register */
716bfc4fe7aSMartin Mares #define  PCI_HT_DR_CMD_NDRS	0x000f	/* Number of DirectRoute Spaces */
717bfc4fe7aSMartin Mares #define  PCI_HT_DR_CMD_IDX	0x01f0	/* Index */
718bfc4fe7aSMartin Mares #define PCI_HT_DR_EN		4	/* Enable Vector Register */
719bfc4fe7aSMartin Mares #define PCI_HT_DR_DATA		8	/* Data Register */
720bfc4fe7aSMartin Mares #define PCI_HT_DR_SIZEOF	12
721bfc4fe7aSMartin Mares 
722bfc4fe7aSMartin Mares 					/* Register indices */
723bfc4fe7aSMartin Mares #define  PCI_HT_DR_IDX_BASE_LO	0x00	/* DirectRoute Base Lower Register */
724bfc4fe7aSMartin Mares #define   PCI_HT_DR_OTNRD	0x00000001 /* Opposite to Normal Request Direction */
725bfc4fe7aSMartin Mares #define   PCI_HT_DR_BL_LO	0xffffff00 /* Base/Limit Lower */
726bfc4fe7aSMartin Mares #define  PCI_HT_DR_IDX_BASE_HI	0x01	/* DirectRoute Base Upper Register */
727bfc4fe7aSMartin Mares #define  PCI_HT_DR_IDX_LIMIT_LO	0x02	/* DirectRoute Limit Lower Register */
728bfc4fe7aSMartin Mares #define  PCI_HT_DR_IDX_LIMIT_HI	0x03	/* DirectRoute Limit Upper Register */
729bfc4fe7aSMartin Mares 
730bfc4fe7aSMartin Mares /* HyperTransport: VCSet */
731bfc4fe7aSMartin Mares #define PCI_HT_VCS_SUP		4	/* VCSets Supported Register */
732bfc4fe7aSMartin Mares #define PCI_HT_VCS_L1EN		5	/* Link 1 VCSets Enabled Register */
733bfc4fe7aSMartin Mares #define PCI_HT_VCS_L0EN		6	/* Link 0 VCSets Enabled Register */
734bfc4fe7aSMartin Mares #define PCI_HT_VCS_SBD		8	/* Stream Bucket Depth Register */
735bfc4fe7aSMartin Mares #define PCI_HT_VCS_SINT		9	/* Stream Interval Register */
736bfc4fe7aSMartin Mares #define PCI_HT_VCS_SSUP		10	/* Number of Streaming VCs Supported Register */
737bfc4fe7aSMartin Mares #define  PCI_HT_VCS_SSUP_0	0x00	/* Streaming VC 0 */
738bfc4fe7aSMartin Mares #define  PCI_HT_VCS_SSUP_3	0x01	/* Streaming VCs 0-3 */
739bfc4fe7aSMartin Mares #define  PCI_HT_VCS_SSUP_15	0x02	/* Streaming VCs 0-15 */
740bfc4fe7aSMartin Mares #define PCI_HT_VCS_NFCBD	12	/* Non-FC Bucket Depth Register */
741bfc4fe7aSMartin Mares #define PCI_HT_VCS_NFCINT	13	/* Non-FC Bucket Interval Register */
742bfc4fe7aSMartin Mares #define PCI_HT_VCS_SIZEOF	16
743bfc4fe7aSMartin Mares 
744bfc4fe7aSMartin Mares /* HyperTransport: Retry Mode */
745bfc4fe7aSMartin Mares #define PCI_HT_RM_CTR0		4	/* Control 0 Register */
746bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_LRETEN	0x01	/* Link Retry Enable */
747bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_FSER	0x02	/* Force Single Error */
748bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_ROLNEN	0x04	/* Rollover Nonfatal Enable */
749bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_FSS	0x08	/* Force Single Stomp */
750bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_RETNEN	0x10	/* Retry Nonfatal Enable */
751bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_RETFEN	0x20	/* Retry Fatal Enable */
752bfc4fe7aSMartin Mares #define  PCI_HT_RM_CTR_AA	0xc0	/* Allowed Attempts */
753bfc4fe7aSMartin Mares #define PCI_HT_RM_STS0		5	/* Status 0 Register */
754bfc4fe7aSMartin Mares #define  PCI_HT_RM_STS_RETSNT	0x01	/* Retry Sent */
755bfc4fe7aSMartin Mares #define  PCI_HT_RM_STS_CNTROL	0x02	/* Count Rollover */
756bfc4fe7aSMartin Mares #define  PCI_HT_RM_STS_SRCV	0x04	/* Stomp Received */
757bfc4fe7aSMartin Mares #define PCI_HT_RM_CTR1		6	/* Control 1 Register */
758bfc4fe7aSMartin Mares #define PCI_HT_RM_STS1		7	/* Status 1 Register */
759bfc4fe7aSMartin Mares #define PCI_HT_RM_CNT0		8	/* Retry Count 0 Register */
760bfc4fe7aSMartin Mares #define PCI_HT_RM_CNT1		10	/* Retry Count 1 Register */
761bfc4fe7aSMartin Mares #define PCI_HT_RM_SIZEOF	12
762bfc4fe7aSMartin Mares 
76378ca9582SMartin Mares /* Vendor-Specific Capability (see PCI_EVNDR_xxx for the PCIe version) */
76478ca9582SMartin Mares #define PCI_VNDR_LENGTH		2	/* Length byte */
76578ca9582SMartin Mares 
7664d67aa89SMartin Mares /* PCI Express */
7674d67aa89SMartin Mares #define PCI_EXP_FLAGS		0x2	/* Capabilities register */
7684d67aa89SMartin Mares #define PCI_EXP_FLAGS_VERS	0x000f	/* Capability version */
7694d67aa89SMartin Mares #define PCI_EXP_FLAGS_TYPE	0x00f0	/* Device/Port type */
7704d67aa89SMartin Mares #define  PCI_EXP_TYPE_ENDPOINT	0x0	/* Express Endpoint */
7714d67aa89SMartin Mares #define  PCI_EXP_TYPE_LEG_END	0x1	/* Legacy Endpoint */
7724d67aa89SMartin Mares #define  PCI_EXP_TYPE_ROOT_PORT 0x4	/* Root Port */
7734d67aa89SMartin Mares #define  PCI_EXP_TYPE_UPSTREAM	0x5	/* Upstream Port */
7744d67aa89SMartin Mares #define  PCI_EXP_TYPE_DOWNSTREAM 0x6	/* Downstream Port */
77577120d53SBjorn Helgaas #define  PCI_EXP_TYPE_PCI_BRIDGE 0x7	/* PCIe to PCI/PCI-X Bridge */
77677120d53SBjorn Helgaas #define  PCI_EXP_TYPE_PCIE_BRIDGE 0x8	/* PCI/PCI-X to PCIe Bridge */
7774efcfc5fSMartin Mares #define  PCI_EXP_TYPE_ROOT_INT_EP 0x9	/* Root Complex Integrated Endpoint */
7784efcfc5fSMartin Mares #define  PCI_EXP_TYPE_ROOT_EC 0xa	/* Root Complex Event Collector */
7794d67aa89SMartin Mares #define PCI_EXP_FLAGS_SLOT	0x0100	/* Slot implemented */
7804d67aa89SMartin Mares #define PCI_EXP_FLAGS_IRQ	0x3e00	/* Interrupt message number */
7819611db3eSPaul Cassidy #define PCI_EXP_FLAGS_FLIT_MODE  0x8000  /* FLIT mode supported */
7824d67aa89SMartin Mares #define PCI_EXP_DEVCAP		0x4	/* Device capabilities */
7834d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_PAYLOAD	0x07	/* Max_Payload_Size */
7844d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_PHANTOM	0x18	/* Phantom functions */
7854d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_EXT_TAG	0x20	/* Extended tags */
7864d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_L0S	0x1c0	/* L0s Acceptable Latency */
7874d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_L1	0xe00	/* L1 Acceptable Latency */
7884d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_ATN_BUT	0x1000	/* Attention Button Present */
7894d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_ATN_IND	0x2000	/* Attention Indicator Present */
7904d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_PWR_IND	0x4000	/* Power Indicator Present */
791dfdb0840SMartin Mares #define  PCI_EXP_DEVCAP_RBE	0x8000	/* Role-Based Error Reporting */
7924d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_PWR_VAL	0x3fc0000 /* Slot Power Limit Value */
7934d67aa89SMartin Mares #define  PCI_EXP_DEVCAP_PWR_SCL	0xc000000 /* Slot Power Limit Scale */
794dfdb0840SMartin Mares #define  PCI_EXP_DEVCAP_FLRESET	0x10000000 /* Function-Level Reset */
795651a352aSAlexey Kardashevskiy #define  PCI_EXP_DEVCAP_TEE_IO  0x40000000 /* TEE-IO Supported (TDISP) */
7964d67aa89SMartin Mares #define PCI_EXP_DEVCTL		0x8	/* Device Control */
7974d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_CERE	0x0001	/* Correctable Error Reporting En. */
7984d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_NFERE	0x0002	/* Non-Fatal Error Reporting Enable */
7994d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_FERE	0x0004	/* Fatal Error Reporting Enable */
8004d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_URRE	0x0008	/* Unsupported Request Reporting En. */
801ec25b52dSMartin Mares #define  PCI_EXP_DEVCTL_RELAXED	0x0010	/* Enable Relaxed Ordering */
8024d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_PAYLOAD	0x00e0	/* Max_Payload_Size */
8034d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_EXT_TAG	0x0100	/* Extended Tag Field Enable */
8044d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_PHANTOM	0x0200	/* Phantom Functions Enable */
8054d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
806ec25b52dSMartin Mares #define  PCI_EXP_DEVCTL_NOSNOOP	0x0800	/* Enable No Snoop */
8074d67aa89SMartin Mares #define  PCI_EXP_DEVCTL_READRQ	0x7000	/* Max_Read_Request_Size */
808dfdb0840SMartin Mares #define  PCI_EXP_DEVCTL_BCRE	0x8000	/* Bridge Configuration Retry Enable */
809dfdb0840SMartin Mares #define  PCI_EXP_DEVCTL_FLRESET	0x8000	/* Function-Level Reset [bit shared with BCRE] */
8104d67aa89SMartin Mares #define PCI_EXP_DEVSTA		0xa	/* Device Status */
8114d67aa89SMartin Mares #define  PCI_EXP_DEVSTA_CED	0x01	/* Correctable Error Detected */
8124d67aa89SMartin Mares #define  PCI_EXP_DEVSTA_NFED	0x02	/* Non-Fatal Error Detected */
8134d67aa89SMartin Mares #define  PCI_EXP_DEVSTA_FED	0x04	/* Fatal Error Detected */
8144d67aa89SMartin Mares #define  PCI_EXP_DEVSTA_URD	0x08	/* Unsupported Request Detected */
8154d67aa89SMartin Mares #define  PCI_EXP_DEVSTA_AUXPD	0x10	/* AUX Power Detected */
8164d67aa89SMartin Mares #define  PCI_EXP_DEVSTA_TRPND	0x20	/* Transactions Pending */
8174d67aa89SMartin Mares #define PCI_EXP_LNKCAP		0xc	/* Link Capabilities */
818ec25b52dSMartin Mares #define  PCI_EXP_LNKCAP_SPEED	0x0000f	/* Maximum Link Speed */
819ec25b52dSMartin Mares #define  PCI_EXP_LNKCAP_WIDTH	0x003f0	/* Maximum Link Width */
820ec25b52dSMartin Mares #define  PCI_EXP_LNKCAP_ASPM	0x00c00	/* Active State Power Management */
82178996f1cSBjorn Helgaas #define  PCI_EXP_LNKCAP_L0S	0x07000	/* L0s Exit Latency */
82278996f1cSBjorn Helgaas #define  PCI_EXP_LNKCAP_L1	0x38000	/* L1 Exit Latency */
823dfdb0840SMartin Mares #define  PCI_EXP_LNKCAP_CLOCKPM	0x40000	/* Clock Power Management */
824dfdb0840SMartin Mares #define  PCI_EXP_LNKCAP_SURPRISE 0x80000 /* Surprise Down Error Reporting */
825dfdb0840SMartin Mares #define  PCI_EXP_LNKCAP_DLLA	0x100000 /* Data Link Layer Active Reporting */
826dfdb0840SMartin Mares #define  PCI_EXP_LNKCAP_LBNC	0x200000 /* Link Bandwidth Notification Capability */
827b7a807b4SMartin Mares #define  PCI_EXP_LNKCAP_AOC 	0x400000 /* ASPM Optionality Compliance */
828ec25b52dSMartin Mares #define  PCI_EXP_LNKCAP_PORT	0xff000000 /* Port Number */
8294d67aa89SMartin Mares #define PCI_EXP_LNKCTL		0x10	/* Link Control */
830ec25b52dSMartin Mares #define  PCI_EXP_LNKCTL_ASPM	0x0003	/* ASPM Control */
831ec25b52dSMartin Mares #define  PCI_EXP_LNKCTL_RCB	0x0008	/* Read Completion Boundary */
832ec25b52dSMartin Mares #define  PCI_EXP_LNKCTL_DISABLE	0x0010	/* Link Disable */
833ec25b52dSMartin Mares #define  PCI_EXP_LNKCTL_RETRAIN	0x0020	/* Retrain Link */
834ec25b52dSMartin Mares #define  PCI_EXP_LNKCTL_CLOCK	0x0040	/* Common Clock Configuration */
835ec25b52dSMartin Mares #define  PCI_EXP_LNKCTL_XSYNCH	0x0080	/* Extended Synch */
836dfdb0840SMartin Mares #define  PCI_EXP_LNKCTL_CLOCKPM	0x0100	/* Clock Power Management */
837dfdb0840SMartin Mares #define  PCI_EXP_LNKCTL_HWAUTWD	0x0200	/* Hardware Autonomous Width Disable */
838dfdb0840SMartin Mares #define  PCI_EXP_LNKCTL_BWMIE	0x0400	/* Bandwidth Mgmt Interrupt Enable */
839dfdb0840SMartin Mares #define  PCI_EXP_LNKCTL_AUTBWIE	0x0800	/* Autonomous Bandwidth Mgmt Interrupt Enable */
8409611db3eSPaul Cassidy #define  PCI_EXP_LNKCTL_FLIT_MODE_DIS  0x2000      /* FLIT mode disable */
8414d67aa89SMartin Mares #define PCI_EXP_LNKSTA		0x12	/* Link Status */
842ec25b52dSMartin Mares #define  PCI_EXP_LNKSTA_SPEED	0x000f	/* Negotiated Link Speed */
843ec25b52dSMartin Mares #define  PCI_EXP_LNKSTA_WIDTH	0x03f0	/* Negotiated Link Width */
844dfdb0840SMartin Mares #define  PCI_EXP_LNKSTA_TR_ERR	0x0400	/* Training Error (obsolete) */
845ec25b52dSMartin Mares #define  PCI_EXP_LNKSTA_TRAIN	0x0800	/* Link Training */
846ec25b52dSMartin Mares #define  PCI_EXP_LNKSTA_SL_CLK	0x1000	/* Slot Clock Configuration */
847dfdb0840SMartin Mares #define  PCI_EXP_LNKSTA_DL_ACT	0x2000	/* Data Link Layer in DL_Active State */
848dfdb0840SMartin Mares #define  PCI_EXP_LNKSTA_BWMGMT	0x4000	/* Bandwidth Mgmt Status */
849dfdb0840SMartin Mares #define  PCI_EXP_LNKSTA_AUTBW	0x8000	/* Autonomous Bandwidth Mgmt Status */
8504d67aa89SMartin Mares #define PCI_EXP_SLTCAP		0x14	/* Slot Capabilities */
851ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_ATNB	0x0001	/* Attention Button Present */
852ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_PWRC	0x0002	/* Power Controller Present */
853ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_MRL	0x0004	/* MRL Sensor Present */
854ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_ATNI	0x0008	/* Attention Indicator Present */
855ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_PWRI	0x0010	/* Power Indicator Present */
856ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_HPS	0x0020	/* Hot-Plug Surprise */
857ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_HPC	0x0040	/* Hot-Plug Capable */
858ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_PWR_VAL	0x00007f80 /* Slot Power Limit Value */
859ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_PWR_SCL	0x00018000 /* Slot Power Limit Scale */
860dfdb0840SMartin Mares #define  PCI_EXP_SLTCAP_INTERLOCK 0x020000 /* Electromechanical Interlock Present */
861dfdb0840SMartin Mares #define  PCI_EXP_SLTCAP_NOCMDCOMP 0x040000 /* No Command Completed Support */
862ec25b52dSMartin Mares #define  PCI_EXP_SLTCAP_PSN	0xfff80000 /* Physical Slot Number */
8634d67aa89SMartin Mares #define PCI_EXP_SLTCTL		0x18	/* Slot Control */
864ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_ATNB	0x0001	/* Attention Button Pressed Enable */
865ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_PWRF	0x0002	/* Power Fault Detected Enable */
866ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_MRLS	0x0004	/* MRL Sensor Changed Enable */
867ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_PRSD	0x0008	/* Presence Detect Changed Enable */
868ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_CMDC	0x0010	/* Command Completed Interrupt Enable */
869ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_HPIE	0x0020	/* Hot-Plug Interrupt Enable */
870dfdb0840SMartin Mares #define  PCI_EXP_SLTCTL_ATNI	0x00c0	/* Attention Indicator Control */
871ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_PWRI	0x0300	/* Power Indicator Control */
872ec25b52dSMartin Mares #define  PCI_EXP_SLTCTL_PWRC	0x0400	/* Power Controller Control */
873dfdb0840SMartin Mares #define  PCI_EXP_SLTCTL_INTERLOCK 0x0800 /* Electromechanical Interlock Control */
874dfdb0840SMartin Mares #define  PCI_EXP_SLTCTL_LLCHG	0x1000	/* Data Link Layer State Changed Enable */
8754d67aa89SMartin Mares #define PCI_EXP_SLTSTA		0x1a	/* Slot Status */
876dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_ATNB	0x0001	/* Attention Button Pressed */
877dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_PWRF	0x0002	/* Power Fault Detected */
878dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_MRLS	0x0004	/* MRL Sensor Changed */
879dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_PRSD	0x0008	/* Presence Detect Changed */
880dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_CMDC	0x0010	/* Command Completed */
881dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_MRL_ST	0x0020	/* MRL Sensor State */
882dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_PRES	0x0040	/* Presence Detect State */
883dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_INTERLOCK 0x0080 /* Electromechanical Interlock Status */
884dfdb0840SMartin Mares #define  PCI_EXP_SLTSTA_LLCHG	0x0100	/* Data Link Layer State Changed */
8854d67aa89SMartin Mares #define PCI_EXP_RTCTL		0x1c	/* Root Control */
886dfdb0840SMartin Mares #define  PCI_EXP_RTCTL_SECEE	0x0001	/* System Error on Correctable Error */
887dfdb0840SMartin Mares #define  PCI_EXP_RTCTL_SENFEE	0x0002	/* System Error on Non-Fatal Error */
888dfdb0840SMartin Mares #define  PCI_EXP_RTCTL_SEFEE	0x0004	/* System Error on Fatal Error */
889dfdb0840SMartin Mares #define  PCI_EXP_RTCTL_PMEIE	0x0008	/* PME Interrupt Enable */
890dfdb0840SMartin Mares #define  PCI_EXP_RTCTL_CRSVIS	0x0010	/* Configuration Request Retry Status Visible to SW */
891dfdb0840SMartin Mares #define PCI_EXP_RTCAP		0x1e	/* Root Capabilities */
8921cefd379SBjorn Helgaas #define  PCI_EXP_RTCAP_CRSVIS	0x0001	/* Configuration Request Retry Status Visible to SW */
8934d67aa89SMartin Mares #define PCI_EXP_RTSTA		0x20	/* Root Status */
894dfdb0840SMartin Mares #define  PCI_EXP_RTSTA_PME_REQID   0x0000ffff /* PME Requester ID */
895dfdb0840SMartin Mares #define  PCI_EXP_RTSTA_PME_STATUS  0x00010000 /* PME Status */
896dfdb0840SMartin Mares #define  PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */
897659b4f15SZhao, Yu #define PCI_EXP_DEVCAP2			0x24	/* Device capabilities 2 */
898e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_TIMEOUT_RANGE(x)	((x) & 0xf) /* Completion Timeout Ranges Supported */
899e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_TIMEOUT_DIS	0x0010	/* Completion Timeout Disable Supported */
900e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_ARI		0x0020	/* ARI Forwarding Supported */
901e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_ATOMICOP_ROUTING	0x0040	/* AtomicOp Routing Supported */
902e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_32BIT_ATOMICOP_COMP	0x0080	/* 32bit AtomicOp Completer Supported */
903e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_64BIT_ATOMICOP_COMP	0x0100	/* 64bit AtomicOp Completer Supported */
904e79a4207SDongdong Liu #define  PCI_EXP_DEVCAP2_128BIT_CAS_COMP	0x0200	/* 128bit CAS Completer Supported */
90533226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_NROPRPRP	0x0400 /* No RO-enabled PR-PR Passing */
906d4c91e40SMika Westerberg #define  PCI_EXP_DEVCAP2_LTR		0x0800	/* LTR supported */
90733226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_TPH_COMP(x)	(((x) >> 12) & 3) /* TPH Completer Supported */
90833226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_LN_CLS(x)	(((x) >> 14) & 3) /* LN System CLS Supported */
90933226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_10BIT_TAG_COMP 0x00010000 /* 10 Bit Tag Completer */
91033226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_10BIT_TAG_REQ	0x00020000 /* 10 Bit Tag Requester */
911d4c91e40SMika Westerberg #define  PCI_EXP_DEVCAP2_OBFF(x)	(((x) >> 18) & 3) /* OBFF supported */
91233226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_EXTFMT		0x00100000 /* Extended Fmt Field Supported */
91333226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_EE_TLP		0x00200000 /* End-End TLP Prefix Supported */
91433226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_MEE_TLP(x)	(((x) >> 22) & 3) /* Max End-End TLP Prefixes */
91533226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_EPR(x)		(((x) >> 24) & 3) /* Emergency Power Reduction Supported */
91633226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_EPR_INIT	0x04000000 /* Emergency Power Reduction Initialization Required */
91733226851SFrederick Lawler #define  PCI_EXP_DEVCAP2_FRS		0x80000000 /* FRS supported */
918659b4f15SZhao, Yu #define PCI_EXP_DEVCTL2			0x28	/* Device Control */
919e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_TIMEOUT_VALUE(x)	((x) & 0xf) /* Completion Timeout Value */
920e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_TIMEOUT_DIS	0x0010	/* Completion Timeout Disable */
921e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_ARI		0x0020	/* ARI Forwarding */
922e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_ATOMICOP_REQUESTER_EN	0x0040	/* AtomicOp RequesterEnable */
923e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_ATOMICOP_EGRESS_BLOCK	0x0080	/* AtomicOp Egress Blocking */
9243746111dSBjorn Helgaas #define  PCI_EXP_DEVCTL2_IDO_REQ_EN	0x0100	/* Allow IDO for requests */
9253746111dSBjorn Helgaas #define  PCI_EXP_DEVCTL2_IDO_CMP_EN	0x0200	/* Allow IDO for completions */
926e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_LTR		0x0400	/* LTR enabled */
927a99d27a3SBjorn Helgaas #define  PCI_EXP_DEVCTL2_EPR_REQ	0x0800	/* Emergency Power Reduction Request */
9283afdb452SDongdong Liu #define  PCI_EXP_DEVCTL2_10BIT_TAG_REQ	0x1000 /* 10 Bit Tag Requester enabled */
929e79a4207SDongdong Liu #define  PCI_EXP_DEVCTL2_OBFF(x)		(((x) >> 13) & 3) /* OBFF enabled */
9307d2b2d69SBjorn Helgaas #define  PCI_EXP_DEVCTL2_EE_TLP_BLK	0x8000	/* End-End TLP Prefix Blocking */
931659b4f15SZhao, Yu #define PCI_EXP_DEVSTA2			0x2a	/* Device Status */
932659b4f15SZhao, Yu #define PCI_EXP_LNKCAP2			0x2c	/* Link Capabilities */
933623ed0e1SBjorn Helgaas #define  PCI_EXP_LNKCAP2_SPEED(x)	(((x) >> 1) & 0x7f)
934623ed0e1SBjorn Helgaas #define  PCI_EXP_LNKCAP2_CROSSLINK	0x00000100 /* Crosslink Supported */
935623ed0e1SBjorn Helgaas #define  PCI_EXP_LNKCAP2_RETIMER	0x00800000 /* Retimer Supported */
936623ed0e1SBjorn Helgaas #define  PCI_EXP_LNKCAP2_2RETIMERS	0x01000000 /* 2 Retimers Supported */
937623ed0e1SBjorn Helgaas #define  PCI_EXP_LNKCAP2_DRS		0x80000000 /* Device Readiness Status */
938659b4f15SZhao, Yu #define PCI_EXP_LNKCTL2			0x30	/* Link Control */
939659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_SPEED(x)	((x) & 0xf) /* Target Link Speed */
940659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_CMPLNC		0x0010	/* Enter Compliance */
941659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_SPEED_DIS	0x0020	/* Hardware Autonomous Speed Disable */
942659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_DEEMPHASIS(x)	(((x) >> 6) & 1) /* Selectable De-emphasis */
943659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_MARGIN(x)	(((x) >> 7) & 7) /* Transmit Margin */
944659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_MOD_CMPLNC	0x0400	/* Enter Modified Compliance */
945659b4f15SZhao, Yu #define  PCI_EXP_LNKCTL2_CMPLNC_SOS	0x0800	/* Compliance SOS */
946ad140168SLennert Buytenhek #define  PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 0xf) /* Compliance Preset/De-emphasis */
947659b4f15SZhao, Yu #define PCI_EXP_LNKSTA2			0x32	/* Link Status */
948659b4f15SZhao, Yu #define  PCI_EXP_LINKSTA2_DEEMPHASIS(x)	((x) & 1)	/* Current De-emphasis Level */
9494dc4ff43SMartin Mares #define  PCI_EXP_LINKSTA2_EQU_COMP	0x02	/* Equalization Complete */
9504dc4ff43SMartin Mares #define  PCI_EXP_LINKSTA2_EQU_PHASE1	0x04	/* Equalization Phase 1 Successful */
9514dc4ff43SMartin Mares #define  PCI_EXP_LINKSTA2_EQU_PHASE2	0x08	/* Equalization Phase 2 Successful */
9524dc4ff43SMartin Mares #define  PCI_EXP_LINKSTA2_EQU_PHASE3	0x10	/* Equalization Phase 3 Successful */
9534dc4ff43SMartin Mares #define  PCI_EXP_LINKSTA2_EQU_REQ	0x20	/* Link Equalization Request */
954623ed0e1SBjorn Helgaas #define  PCI_EXP_LINKSTA2_RETIMER	0x0040	/* Retimer Detected */
955623ed0e1SBjorn Helgaas #define  PCI_EXP_LINKSTA2_2RETIMERS	0x0080	/* 2 Retimers Detected */
956623ed0e1SBjorn Helgaas #define  PCI_EXP_LINKSTA2_CROSSLINK(x)	(((x) >> 8) & 0x3) /* Crosslink Res */
957623ed0e1SBjorn Helgaas #define  PCI_EXP_LINKSTA2_COMPONENT(x)	(((x) >> 12) & 0x7) /* Presence */
958623ed0e1SBjorn Helgaas #define  PCI_EXP_LINKSTA2_DRS_RCVD	0x8000	/* DRS Msg Received */
9599611db3eSPaul Cassidy #define  PCI_EXP_LINKSTA2_FLIT_MODE 0x0400  /* FLIT mode active */
960659b4f15SZhao, Yu #define PCI_EXP_SLTCAP2			0x34	/* Slot Capabilities */
961659b4f15SZhao, Yu #define PCI_EXP_SLTCTL2			0x38	/* Slot Control */
962659b4f15SZhao, Yu #define PCI_EXP_SLTSTA2			0x3a	/* Slot Status */
9634d67aa89SMartin Mares 
9644d67aa89SMartin Mares /* MSI-X */
9654d67aa89SMartin Mares #define  PCI_MSIX_ENABLE	0x8000
9664d67aa89SMartin Mares #define  PCI_MSIX_MASK		0x4000
967ab12e4beSMichael S. Tsirkin #define  PCI_MSIX_TABSIZE	0x07ff
9684d67aa89SMartin Mares #define PCI_MSIX_TABLE		4
9694d67aa89SMartin Mares #define PCI_MSIX_PBA		8
9704d67aa89SMartin Mares #define  PCI_MSIX_BIR		0x7
9714d67aa89SMartin Mares 
972248a04f8SMartin Mares /* Subsystem vendor/device ID for PCI bridges */
973248a04f8SMartin Mares #define PCI_SSVID_VENDOR	4
974248a04f8SMartin Mares #define PCI_SSVID_DEVICE	6
975248a04f8SMartin Mares 
97699eb76e5SYu Zhao /* PCI Advanced Features */
97799eb76e5SYu Zhao #define PCI_AF_CAP		3
97899eb76e5SYu Zhao #define  PCI_AF_CAP_TP		0x01
97999eb76e5SYu Zhao #define  PCI_AF_CAP_FLR		0x02
98099eb76e5SYu Zhao #define PCI_AF_CTRL		4
98199eb76e5SYu Zhao #define  PCI_AF_CTRL_FLR	0x01
98299eb76e5SYu Zhao #define PCI_AF_STATUS		5
98399eb76e5SYu Zhao #define  PCI_AF_STATUS_TP	0x01
98499eb76e5SYu Zhao 
985be9c1b75SMartin Mares /* SATA Host Bus Adapter */
986be9c1b75SMartin Mares #define PCI_SATA_HBA_BARS	4
987be9c1b75SMartin Mares #define PCI_SATA_HBA_REG0	8
988be9c1b75SMartin Mares 
9894cd841dfSDavid Daney /* Enhanced Allocation (EA) */
9904cd841dfSDavid Daney #define PCI_EA_CAP_TYPE1_SECONDARY	4
9914cd841dfSDavid Daney #define PCI_EA_CAP_TYPE1_SUBORDINATE	5
9924cd841dfSDavid Daney /* EA Entry header */
9934cd841dfSDavid Daney #define PCI_EA_CAP_ENT_WRITABLE	0x40000000	/* Writable: 1 = RW, 0 = HwInit */
9944cd841dfSDavid Daney #define PCI_EA_CAP_ENT_ENABLE	0x80000000	/* Enable for this entry */
9954cd841dfSDavid Daney 
996be9c1b75SMartin Mares /*** Definitions of extended capabilities ***/
997be9c1b75SMartin Mares 
9983b8bf739SMartin Mares /* Advanced Error Reporting */
9993b8bf739SMartin Mares #define PCI_ERR_UNCOR_STATUS	4	/* Uncorrectable Error Status */
100006cb86c3SZhao, Yu #define  PCI_ERR_UNC_TRAIN	0x00000001	/* Undefined in PCIe rev1.1 & 2.0 spec */
10013b8bf739SMartin Mares #define  PCI_ERR_UNC_DLP	0x00000010	/* Data Link Protocol */
100206cb86c3SZhao, Yu #define  PCI_ERR_UNC_SDES	0x00000020	/* Surprise Down Error */
10033b8bf739SMartin Mares #define  PCI_ERR_UNC_POISON_TLP	0x00001000	/* Poisoned TLP */
10043b8bf739SMartin Mares #define  PCI_ERR_UNC_FCP	0x00002000	/* Flow Control Protocol */
10053b8bf739SMartin Mares #define  PCI_ERR_UNC_COMP_TIME	0x00004000	/* Completion Timeout */
10063b8bf739SMartin Mares #define  PCI_ERR_UNC_COMP_ABORT	0x00008000	/* Completer Abort */
10073b8bf739SMartin Mares #define  PCI_ERR_UNC_UNX_COMP	0x00010000	/* Unexpected Completion */
10083b8bf739SMartin Mares #define  PCI_ERR_UNC_RX_OVER	0x00020000	/* Receiver Overflow */
10093b8bf739SMartin Mares #define  PCI_ERR_UNC_MALF_TLP	0x00040000	/* Malformed TLP */
10103b8bf739SMartin Mares #define  PCI_ERR_UNC_ECRC	0x00080000	/* ECRC Error Status */
10113b8bf739SMartin Mares #define  PCI_ERR_UNC_UNSUP	0x00100000	/* Unsupported Request */
101206cb86c3SZhao, Yu #define  PCI_ERR_UNC_ACS_VIOL	0x00200000	/* ACS Violation */
1013144b0911SShuai Xue #define  PCI_ERR_UNC_INTERNAL					0x00400000	/* Uncorrectable Internal Error */
1014144b0911SShuai Xue #define  PCI_ERR_UNC_MC_BLOCKED_TLP				0x00800000	/* MC Blocked TLP */
1015144b0911SShuai Xue #define  PCI_ERR_UNC_ATOMICOP_EGRESS_BLOCKED	0x01000000	/* AtomicOp Egress Blocked */
1016144b0911SShuai Xue #define  PCI_ERR_UNC_TLP_PREFIX_BLOCKED			0x02000000	/* TLP Prefix Blocked Error */
1017144b0911SShuai Xue #define  PCI_ERR_UNC_POISONED_TLP_EGRESS		0x04000000	/* Poisoned TLP Egress Blocked */
1018144b0911SShuai Xue #define  PCI_ERR_UNC_DMWR_REQ_EGRESS_BLOCKED	0x08000000	/* DMWr Request Egress Blocked */
1019144b0911SShuai Xue #define  PCI_ERR_UNC_IDE_CHECK					0x10000000	/* IDE Check Failed */
1020144b0911SShuai Xue #define  PCI_ERR_UNC_MISR_IDE_TLP				0x20000000	/* Misrouted IDE TLP */
1021144b0911SShuai Xue #define  PCI_ERR_UNC_PCRC_CHECK					0x40000000	/* PCRC Check Failed */
1022144b0911SShuai Xue #define  PCI_ERR_UNC_TLP_XLAT_EGRESS_BLOCKED	0x80000000	/* TLP Translation Egress Blocked */
10233b8bf739SMartin Mares #define PCI_ERR_UNCOR_MASK	8	/* Uncorrectable Error Mask */
10243b8bf739SMartin Mares 	/* Same bits as above */
10253b8bf739SMartin Mares #define PCI_ERR_UNCOR_SEVER	12	/* Uncorrectable Error Severity */
10263b8bf739SMartin Mares 	/* Same bits as above */
10273b8bf739SMartin Mares #define PCI_ERR_COR_STATUS	16	/* Correctable Error Status */
10283b8bf739SMartin Mares #define  PCI_ERR_COR_RCVR	0x00000001	/* Receiver Error Status */
10293b8bf739SMartin Mares #define  PCI_ERR_COR_BAD_TLP	0x00000040	/* Bad TLP Status */
10303b8bf739SMartin Mares #define  PCI_ERR_COR_BAD_DLLP	0x00000080	/* Bad DLLP Status */
10313b8bf739SMartin Mares #define  PCI_ERR_COR_REP_ROLL	0x00000100	/* REPLAY_NUM Rollover */
10323b8bf739SMartin Mares #define  PCI_ERR_COR_REP_TIMER	0x00001000	/* Replay Timer Timeout */
103306cb86c3SZhao, Yu #define  PCI_ERR_COR_REP_ANFE	0x00002000	/* Advisory Non-Fatal Error */
1034144b0911SShuai Xue #define  PCI_ERR_COR_INTERNAL	0x00004000	/* Corrected Internal Error */
1035144b0911SShuai Xue #define  PCI_ERR_COR_HDRLOG_OVER	0x00008000	/* Header Log Overflow */
10363b8bf739SMartin Mares #define PCI_ERR_COR_MASK	20	/* Correctable Error Mask */
10373b8bf739SMartin Mares 	/* Same bits as above */
10383b8bf739SMartin Mares #define PCI_ERR_CAP		24	/* Advanced Error Capabilities */
10393b8bf739SMartin Mares #define  PCI_ERR_CAP_FEP(x)	((x) & 31)	/* First Error Pointer */
10403b8bf739SMartin Mares #define  PCI_ERR_CAP_ECRC_GENC	0x00000020	/* ECRC Generation Capable */
10413b8bf739SMartin Mares #define  PCI_ERR_CAP_ECRC_GENE	0x00000040	/* ECRC Generation Enable */
10423b8bf739SMartin Mares #define  PCI_ERR_CAP_ECRC_CHKC	0x00000080	/* ECRC Check Capable */
10433b8bf739SMartin Mares #define  PCI_ERR_CAP_ECRC_CHKE	0x00000100	/* ECRC Check Enable */
1044b33a4a2bSBjorn Helgaas #define  PCI_ERR_CAP_MULT_HDRC	0x00000200	/* Multiple Header Capable */
1045b33a4a2bSBjorn Helgaas #define  PCI_ERR_CAP_MULT_HDRE	0x00000400	/* Multiple Header Enable */
1046b33a4a2bSBjorn Helgaas #define  PCI_ERR_CAP_TLP_PFX	0x00000800	/* TLP Prefix Log Present */
1047b33a4a2bSBjorn Helgaas #define  PCI_ERR_CAP_HDR_LOG	0x00001000	/* Completion Timeout Prefix/Header Log Capable */
10483b8bf739SMartin Mares #define PCI_ERR_HEADER_LOG	28	/* Header Log Register (16 bytes) */
10493b8bf739SMartin Mares #define PCI_ERR_ROOT_COMMAND	44	/* Root Error Command */
1050a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_CMD_COR_EN	0x00000001 /* Correctable Error Reporting Enable */
1051a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_CMD_NONFATAL_EN	0x00000002 /* Non-Fatal Error Reporting Enable*/
1052a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_CMD_FATAL_EN	0x00000004 /* Fatal Error Reporting Enable */
1053a1492b88SBjorn Helgaas #define PCI_ERR_ROOT_STATUS	48	/* Root Error Status */
1054a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_COR_RCV		0x00000001 /* ERR_COR Received */
1055a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_MULTI_COR_RCV	0x00000002 /* Multiple ERR_COR Received */
1056a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_UNCOR_RCV		0x00000004 /* ERR_FATAL/NONFATAL Received */
1057a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_MULTI_UNCOR_RCV	0x00000008 /* Multiple ERR_FATAL/NONFATAL Received */
1058a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_FIRST_FATAL	0x00000010 /* First Uncorrectable Fatal */
1059a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_NONFATAL_RCV	0x00000020 /* Non-Fatal Error Messages Received */
1060a1492b88SBjorn Helgaas #define  PCI_ERR_ROOT_FATAL_RCV		0x00000040 /* Fatal Error Messages Received */
1061a1492b88SBjorn Helgaas #define  PCI_ERR_MSG_NUM(x)	(((x) >> 27) & 0x1f) /* MSI/MSI-X vector */
10623b8bf739SMartin Mares #define PCI_ERR_ROOT_COR_SRC	52
10633b8bf739SMartin Mares #define PCI_ERR_ROOT_SRC	54
10643b8bf739SMartin Mares 
10653b8bf739SMartin Mares /* Virtual Channel */
10663b8bf739SMartin Mares #define PCI_VC_PORT_REG1	4
10673b8bf739SMartin Mares #define PCI_VC_PORT_REG2	8
10683b8bf739SMartin Mares #define PCI_VC_PORT_CTRL	12
10693b8bf739SMartin Mares #define PCI_VC_PORT_STATUS	14
10703b8bf739SMartin Mares #define PCI_VC_RES_CAP		16
10713b8bf739SMartin Mares #define PCI_VC_RES_CTRL		20
10723b8bf739SMartin Mares #define PCI_VC_RES_STATUS	26
10733b8bf739SMartin Mares 
10743b8bf739SMartin Mares /* Power Budgeting */
10753b8bf739SMartin Mares #define PCI_PWR_DSR		4	/* Data Select Register */
10763b8bf739SMartin Mares #define PCI_PWR_DATA		8	/* Data Register */
10773b8bf739SMartin Mares #define  PCI_PWR_DATA_BASE(x)	((x) & 0xff)	    /* Base Power */
10783b8bf739SMartin Mares #define  PCI_PWR_DATA_SCALE(x)	(((x) >> 8) & 3)    /* Data Scale */
10793b8bf739SMartin Mares #define  PCI_PWR_DATA_PM_SUB(x)	(((x) >> 10) & 7)   /* PM Sub State */
10803b8bf739SMartin Mares #define  PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */
10813b8bf739SMartin Mares #define  PCI_PWR_DATA_TYPE(x)	(((x) >> 15) & 7)   /* Type */
10823b8bf739SMartin Mares #define  PCI_PWR_DATA_RAIL(x)	(((x) >> 18) & 7)   /* Power Rail */
10833b8bf739SMartin Mares #define PCI_PWR_CAP		12	/* Capability */
10843b8bf739SMartin Mares #define  PCI_PWR_CAP_BUDGET(x)	((x) & 1)	/* Included in system budget */
10853b8bf739SMartin Mares 
10865a9a932cSMartin Mares /* Root Complex Link */
10875a9a932cSMartin Mares #define PCI_RCLINK_ESD		4	/* Element Self Description */
10885a9a932cSMartin Mares #define PCI_RCLINK_LINK1	16	/* First Link Entry */
10895a9a932cSMartin Mares #define  PCI_RCLINK_LINK_DESC	0	/* Link Entry: Description */
10905a9a932cSMartin Mares #define  PCI_RCLINK_LINK_ADDR	8	/* Link Entry: Address (64-bit) */
10915a9a932cSMartin Mares #define  PCI_RCLINK_LINK_SIZE	16	/* Link Entry: sizeof */
10925a9a932cSMartin Mares 
1093e12bd01eSSean V Kelley /* Root Complex Event Collector Endpoint Association */
1094e12bd01eSSean V Kelley #define  PCI_RCEC_EP_CAP_VER(reg)	(((reg) >> 16) & 0xf)
1095e12bd01eSSean V Kelley #define  PCI_RCEC_BUSN_REG_VER	0x02	/* as per PCIe sec 7.9.10.1 */
1096e12bd01eSSean V Kelley #define  PCI_RCEC_RCIEP_BMAP	0x0004	/* as per PCIe sec 7.9.10.2 */
1097e12bd01eSSean V Kelley #define  PCI_RCEC_BUSN_REG	0x0008	/* as per PCIe sec 7.9.10.3 */
1098e12bd01eSSean V Kelley 
109978ca9582SMartin Mares /* PCIe Vendor-Specific Capability */
110078ca9582SMartin Mares #define PCI_EVNDR_HEADER	4	/* Vendor-Specific Header */
110178ca9582SMartin Mares #define PCI_EVNDR_REGISTERS	8	/* Vendor-Specific Registers */
110278ca9582SMartin Mares 
11035f1d1265SSean V Kelley /* PCIe Designated Vendor-Specific Capability */
11045f1d1265SSean V Kelley #define PCI_DVSEC_HEADER1	4	/* Designated Vendor-Specific Header 1 */
11055f1d1265SSean V Kelley #define PCI_DVSEC_HEADER2	8	/* Designated Vendor-Specific Header 2 */
110622c4be4aSMartin Mares #define PCI_DVSEC_VENDOR_ID_CXL	0x1e98	/* Designated Vendor-Specific Vendor ID for CXL */
110722c4be4aSMartin Mares #define PCI_DVSEC_ID_CXL	0	/* Designated Vendor-Specific ID for Intel CXL */
1108bd853ef8SSean V Kelley 
11094c2b4b1bSBen Widawsky /* PCIe CXL Designated Vendor-Specific Capabilities for Devices: Control, Status */
1110944bb1dfSMartin Mares #define PCI_CXL_DEV_LEN 		0x38	/* CXL Device DVSEC Length for Rev1 */
1111944bb1dfSMartin Mares #define PCI_CXL_DEV_LEN_REV2 		0x3c	/* ... for Rev2 */
11124c2b4b1bSBen Widawsky #define PCI_CXL_DEV_CAP			0x0a	/* CXL Capability Register */
11134c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CAP_CACHE		0x0001	/* CXL.cache Protocol Support */
11144c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CAP_IO		0x0002	/* CXL.io Protocol Support */
11154c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CAP_MEM		0x0004	/* CXL.mem Protocol Support */
11164c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CAP_MEM_HWINIT	0x0008	/* CXL.mem Initializes with HW/FW Support */
11174c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CAP_HDM_CNT(x)	(((x) & (3 << 4)) >> 4)	/* CXL Number of HDM ranges */
11184c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CAP_VIRAL		0x4000	/* CXL Viral Handling Support */
11194c2b4b1bSBen Widawsky #define PCI_CXL_DEV_CTRL		0x0c	/* CXL Control Register */
11204c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_CACHE		0x0001	/* CXL.cache Protocol Enable */
11214c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_IO		0x0002	/* CXL.io Protocol Enable */
11224c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_MEM		0x0004	/* CXL.mem Protocol Enable */
11234c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_CACHE_SF_COV(x) (((x) & (0x1f << 3)) >> 3) /* Snoop Filter Coverage */
11244c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_CACHE_SF_GRAN(x) (((x) & (0x7 << 8)) >> 8) /* Snoop Filter Granularity */
11254c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_CACHE_CLN	0x0800	/* CXL.cache Performance Hint on Clean Evictions */
11264c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_CTRL_VIRAL		0x4000	/* CXL Viral Handling Enable */
11274c2b4b1bSBen Widawsky #define PCI_CXL_DEV_STATUS		0x0e	/* CXL Status Register */
11284c2b4b1bSBen Widawsky #define  PCI_CXL_DEV_STATUS_VIRAL	0x4000	/* CXL Viral Handling Status */
1129c0ccce1bSAlexis Gryta #define PCI_CXL_DEV_CTRL2		0x10	/* CXL Control Register 2 */
1130c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CTRL2_DISABLE_CACHING            0x0001
1131c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CTRL2_INIT_WB_INVAL              0x0002
1132c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CTRL2_INIT_CXL_RST               0x0003
1133c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CTRL2_INIT_CXL_RST_CLR_EN        0x0004
1134c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CTRL2_INIT_CXL_HDM_STATE_HOTRST  0x0005
113552097446SBen Widawsky #define PCI_CXL_DEV_STATUS2		0x12
113652097446SBen Widawsky #define  PCI_CXL_DEV_STATUS_CACHE_INV	0x0001
113752097446SBen Widawsky #define  PCI_CXL_DEV_STATUS_RC		0x0002  /* Device Reset Complete */
113852097446SBen Widawsky #define  PCI_CXL_DEV_STATUS_RE		0x0004  /* Device Reset Error */
113952097446SBen Widawsky #define  PCI_CXL_DEV_STATUS_PMC		0x8000  /* Power Management Init Complete */
114052097446SBen Widawsky #define PCI_CXL_DEV_CAP2		0x16
114152097446SBen Widawsky #define  PCI_CXL_DEV_CAP2_CACHE_UNK	0x0000	/* Cache Size Isn't Reported */
114252097446SBen Widawsky #define  PCI_CXL_DEV_CAP2_CACHE_64K	0x0001  /* Unit Size 64K */
114352097446SBen Widawsky #define  PCI_CXL_DEV_CAP2_CACHE_1M	0x0002  /* Unit Size 1M */
114452097446SBen Widawsky #define PCI_CXL_DEV_RANGE1_SIZE_HI	0x18
114552097446SBen Widawsky #define PCI_CXL_DEV_RANGE1_SIZE_LO	0x1c
114652097446SBen Widawsky #define  PCI_CXL_RANGE_VALID		0x0001
114752097446SBen Widawsky #define  PCI_CXL_RANGE_ACTIVE		0x0002
114852097446SBen Widawsky #define  PCI_CXL_RANGE_TYPE(x)		(((x) >> 2) & 0x7)
114952097446SBen Widawsky #define  PCI_CXL_RANGE_CLASS(x)		(((x) >> 5) & 0x7)
115052097446SBen Widawsky #define  PCI_CXL_RANGE_INTERLEAVE(x)	(((x) >> 8) & 0x1f)
115152097446SBen Widawsky #define  PCI_CXL_RANGE_TIMEOUT(x)	(((x) >> 13) & 0x7)
115252097446SBen Widawsky #define PCI_CXL_DEV_RANGE1_BASE_HI	0x20
115352097446SBen Widawsky #define PCI_CXL_DEV_RANGE1_BASE_LO	0x24
115452097446SBen Widawsky #define PCI_CXL_DEV_RANGE2_SIZE_HI	0x28
115552097446SBen Widawsky #define PCI_CXL_DEV_RANGE2_SIZE_LO	0x2c
115652097446SBen Widawsky #define PCI_CXL_DEV_RANGE2_BASE_HI	0x30
115752097446SBen Widawsky #define PCI_CXL_DEV_RANGE2_BASE_LO	0x34
1158c0ccce1bSAlexis Gryta /* From Rev2 */
1159c0ccce1bSAlexis Gryta #define PCI_CXL_DEV_CAP3  0x38
1160c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CAP3_HDM_STATE_RST_COLD     0x0001
1161c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CAP3_HDM_STATE_RST_WARM     0x0002
1162c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CAP3_HDM_STATE_RST_HOT      0x0003
1163c0ccce1bSAlexis Gryta #define  PCI_CXL_DEV_CAP3_HDM_STATE_RST_HOT_CFG  0x0004
1164c0ccce1bSAlexis Gryta 
11655f1d1265SSean V Kelley 
1166c8b83c6cSBen Widawsky /* PCIe CXL 2.0 Designated Vendor-Specific Capabilities for Ports */
1167c8b83c6cSBen Widawsky #define PCI_CXL_PORT_EXT_LEN 0x28 /* CXL Extensions DVSEC for Ports Length */
1168c8b83c6cSBen Widawsky #define PCI_CXL_PORT_EXT_STATUS 0x0a		/* Port Extension Status */
1169c8b83c6cSBen Widawsky #define  PCI_CXL_PORT_PM_INIT_COMPLETE 0x1	/* Port Power Management Initialization Complete */
1170c8b83c6cSBen Widawsky #define PCI_CXL_PORT_CTRL 0x0c			/* Port Control Override */
1171c8b83c6cSBen Widawsky #define  PCI_CXL_PORT_UNMASK_SBR 0x0001		/* Unmask SBR */
1172c8b83c6cSBen Widawsky #define  PCI_CXL_PORT_UNMASK_LINK 0x0002	/* Unmask Link Disable */
1173c8b83c6cSBen Widawsky #define  PCI_CXL_PORT_ALT_MEMORY 0x0004		/* Alt Memory and ID Space Enable */
1174c8b83c6cSBen Widawsky #define  PCI_CXL_PORT_ALT_BME 0x0008		/* Alt BME */
1175c8b83c6cSBen Widawsky #define  PCI_CXL_PORT_VIRAL_EN 0x4000		/* Viral Enable */
1176c8b83c6cSBen Widawsky #define PCI_CXL_PORT_ALT_BUS_BASE 0xe
1177c8b83c6cSBen Widawsky #define PCI_CXL_PORT_ALT_BUS_LIMIT 0xf
1178c8b83c6cSBen Widawsky #define PCI_CXL_PORT_ALT_MEM_BASE 0x10
1179c8b83c6cSBen Widawsky #define PCI_CXL_PORT_ALT_MEM_LIMIT 0x12
1180c8b83c6cSBen Widawsky 
11810dfa1050SBen Widawsky /* PCIe CXL 2.0 Designated Vendor-Specific Capabilities for Register Locator */
118255704534SJaxon Haws #define PCI_CXL_RL_BLOCK1_LO 0x0c
11830dfa1050SBen Widawsky 
1184d462e89cSJaxon Haws /* PCIe CXL Designated Vendor-Specific Capabilities for Global Persistent Flush */
1185d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_LEN         0x10
1186d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_PHASE2_DUR  0x0a /* GPF Phase 2 Duration Register */
1187d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_PHASE2_POW  0x0c /* GPF Phase 2 Power Register */
1188d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_1US     0x0
1189d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_10US    0x1
1190d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_100US   0x2
1191d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_1MS     0x3
1192d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_10MS    0x4
1193d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_100MS   0x5
1194d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_1S      0x6
1195d462e89cSJaxon Haws #define PCI_CXL_GPF_DEV_10S     0x7
11965c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_LEN    0x10
11975c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_PHASE1_CTRL  0x0c /* GPF Phase 1 Control Register */
11985c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_PHASE2_CTRL 0x0e /* GPF Phase 2 Control Register */
11995c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_1US     0x0
12005c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_10US    0x1
12015c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_100US   0x2
12025c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_1MS     0x3
12035c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_10MS    0x4
12045c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_100MS   0x5
12055c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_1S      0x6
12065c75f737SJaxon Haws #define PCI_CXL_GPF_PORT_10S     0x7
1207d462e89cSJaxon Haws 
12089e567a4eSJaxon Haws /* PCIe CXL Designated Vendor-Specific Capabilities for Flex Bus Port */
12099e567a4eSJaxon Haws #define PCI_CXL_FB_LEN                0x20
12109e567a4eSJaxon Haws #define PCI_CXL_FB_PORT_CAP           0x0a    /* CXL Flex Bus Port Capability Register */
12119e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_CACHE         0x0001  /* CXL.cache Capable */
12129e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_IO            0x0002  /* CXL.io Capable */
12139e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_MEM           0x0004  /* CXL.mem Capable */
12149e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_68B_FLIT      0x0020  /* CXL 68B Flit and VH Capable */
12159e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_MULT_LOG_DEV  0x0040  /* CXL Multi-Logical Device Capable */
12169e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_256B_FLIT     0x2000  /* CXL Latency Optimized 256B Flit Capable */
12179e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP_PBR_FLIT      0x4000  /* CXL PBR Flit Capable */
12189e567a4eSJaxon Haws #define PCI_CXL_FB_PORT_CTRL            0x0c    /* CXL Flex Bus Port Control Register */
12199e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_CACHE          0x0001  /* CXL.cache Enable */
12209e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_IO             0x0002  /* CXL.io Enable */
12219e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_MEM            0x0004  /* CXL.mem Enable */
12229e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_SYNC_HDR_BYP   0x0008  /* CXL Sync Header Bypass Enable */
12239e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_DRFT_BUF       0x0010  /* Drift Buffer Enable */
12249e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_68B_FLIT       0x0020  /* CXL 68B Flit and VH Enable */
12259e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_MULT_LOG_DEV   0x0040  /* CXL Multi Logical Device Enable */
12269e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_RCD            0x0080  /* Disable RCD Training */
12279e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_RETIMER1       0x0100  /* Retimer1 Present */
12289e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_RETIMER2       0x0200  /* Retimer2 Present */
12299e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_256B_FLIT      0x2000  /* CXL Latency Optimized 256B Flit Enable */
12309e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL_PBR_FLIT       0x4000  /* CXL PBR Flit Enable */
12319e567a4eSJaxon Haws #define PCI_CXL_FB_PORT_STATUS            0x0e    /* CXL Flex Bus Port Status Register */
12329e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_CACHE            0x0001  /* CXL.cache Enabled */
12339e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_IO               0x0002  /* CXL.io Enabled */
12349e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_MEM              0x0004  /* CXL.mem Enabled */
12359e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_SYNC_HDR_BYP     0x0008  /* CXL Sync Header Bypass Enabled */
12369e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_DRFT_BUF         0x0010  /* Drift Buffer Enabled */
12379e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_68B_FLIT         0x0020  /* CXL 68B Flit and VH Enabled */
12389e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_MULT_LOG_DEV     0x0040  /* CXL Multi Logical Device Enabled */
12399e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_256B_FLIT        0x2000  /* CXL Latency Optimized 256B Flit Enabled */
12409e567a4eSJaxon Haws #define  PCI_CXL_FB_STAT_PBR_FLIT         0x4000  /* CXL PBR Flit Enabled */
12419e567a4eSJaxon Haws #define PCI_CXL_FB_MOD_TS_DATA              0x10    /* CXL Flex Bus Port Received Modified TS Data Phase1 Register */
12429e567a4eSJaxon Haws #define PCI_CXL_FB_PORT_CAP2                0x14    /* CXL Flex Bus Port Capability2 Register */
12439e567a4eSJaxon Haws #define  PCI_CXL_FB_CAP2_NOP_HINT           0x01    /* NOP Hint Capable */
12449e567a4eSJaxon Haws #define PCI_CXL_FB_PORT_CTRL2               0x18    /* CXL Flex Bus Port Control2 Register */
12459e567a4eSJaxon Haws #define  PCI_CXL_FB_CTRL2_NOP_HINT          0x01    /* NOP Hint Enable */
12469e567a4eSJaxon Haws #define PCI_CXL_FB_PORT_STATUS2             0x1c    /* CXL Flex Bus Port Status2 Register */
124723b1ee0cSAlexis Gryta #define PCI_CXL_FB_NEXT_UNSUPPORTED         0x20
12489e567a4eSJaxon Haws 
124945824262SJaxon Haws /* PCIe CXL Designated Vendor-Specific Capabilities for Multi-Logical Device */
125045824262SJaxon Haws #define PCI_CXL_MLD_LEN     0x10
125145824262SJaxon Haws #define PCI_CXL_MLD_NUM_LD  0xa
125245824262SJaxon Haws #define PCI_CXL_MLD_MAX_LD  0x10
125345824262SJaxon Haws 
1254ec4cd47bSJaxon Haws /* PCIe CXL Designated Vendor-Specific Capabilities for Non-CXL Function Map */
1255ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_LEN     0x2c
1256ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_0   0x0c
1257ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_1   0x10
1258ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_2   0x14
1259ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_3   0x18
1260ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_4   0x1c
1261ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_5   0x20
1262ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_6   0x24
1263ec4cd47bSJaxon Haws #define PCI_CXL_FUN_MAP_REG_7   0x28
1264ec4cd47bSJaxon Haws 
1265b34a0fe5SZhao, Yu /* Access Control Services */
1266b34a0fe5SZhao, Yu #define PCI_ACS_CAP		0x04	/* ACS Capability Register */
1267b34a0fe5SZhao, Yu #define PCI_ACS_CAP_VALID	0x0001	/* ACS Source Validation */
1268b34a0fe5SZhao, Yu #define PCI_ACS_CAP_BLOCK	0x0002	/* ACS Translation Blocking */
1269b34a0fe5SZhao, Yu #define PCI_ACS_CAP_REQ_RED	0x0004	/* ACS P2P Request Redirect */
1270b34a0fe5SZhao, Yu #define PCI_ACS_CAP_CMPLT_RED	0x0008	/* ACS P2P Completion Redirect */
1271b34a0fe5SZhao, Yu #define PCI_ACS_CAP_FORWARD	0x0010	/* ACS Upstream Forwarding */
1272b34a0fe5SZhao, Yu #define PCI_ACS_CAP_EGRESS	0x0020	/* ACS P2P Egress Control */
1273b34a0fe5SZhao, Yu #define PCI_ACS_CAP_TRANS	0x0040	/* ACS Direct Translated P2P */
1274b34a0fe5SZhao, Yu #define PCI_ACS_CAP_VECTOR(x)	(((x) >> 8) & 0xff) /* Egress Control Vector Size */
1275b34a0fe5SZhao, Yu #define PCI_ACS_CTRL		0x06	/* ACS Control Register */
1276b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_VALID	0x0001	/* ACS Source Validation Enable */
1277b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_BLOCK	0x0002	/* ACS Translation Blocking Enable */
1278b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_REQ_RED	0x0004	/* ACS P2P Request Redirect Enable */
1279b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_CMPLT_RED	0x0008	/* ACS P2P Completion Redirect Enable */
1280b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_FORWARD	0x0010	/* ACS Upstream Forwarding Enable */
1281b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_EGRESS	0x0020	/* ACS P2P Egress Control Enable */
1282b34a0fe5SZhao, Yu #define PCI_ACS_CTRL_TRANS	0x0040	/* ACS Direct Translated P2P Enable */
1283b34a0fe5SZhao, Yu #define PCI_ACS_EGRESS_CTRL	0x08	/* Egress Control Vector */
1284b34a0fe5SZhao, Yu 
128538190363SZhao, Yu /* Alternative Routing-ID Interpretation */
128638190363SZhao, Yu #define PCI_ARI_CAP		0x04	/* ARI Capability Register */
128738190363SZhao, Yu #define  PCI_ARI_CAP_MFVC	0x0001	/* MFVC Function Groups Capability */
128838190363SZhao, Yu #define  PCI_ARI_CAP_ACS	0x0002	/* ACS Function Groups Capability */
128938190363SZhao, Yu #define  PCI_ARI_CAP_NFN(x)	(((x) >> 8) & 0xff) /* Next Function Number */
129038190363SZhao, Yu #define PCI_ARI_CTRL		0x06	/* ARI Control Register */
129138190363SZhao, Yu #define  PCI_ARI_CTRL_MFVC	0x0001	/* MFVC Function Groups Enable */
129238190363SZhao, Yu #define  PCI_ARI_CTRL_ACS	0x0002	/* ACS Function Groups Enable */
129338190363SZhao, Yu #define  PCI_ARI_CTRL_FG(x)	(((x) >> 4) & 7) /* Function Group */
129438190363SZhao, Yu 
1295be697708SYu Zhao /* Address Translation Service */
1296be697708SYu Zhao #define PCI_ATS_CAP		0x04	/* ATS Capability Register */
1297be697708SYu Zhao #define  PCI_ATS_CAP_IQD(x)	((x) & 0x1f) /* Invalidate Queue Depth */
1298be697708SYu Zhao #define PCI_ATS_CTRL		0x06	/* ATS Control Register */
1299be697708SYu Zhao #define  PCI_ATS_CTRL_STU(x)	((x) & 0x1f) /* Smallest Translation Unit */
1300c32a6d2dSYu Zhao #define  PCI_ATS_CTRL_ENABLE	0x8000	/* ATS Enable */
1301be697708SYu Zhao 
1302fa74afb3SZhao, Yu /* Single Root I/O Virtualization */
1303fa74afb3SZhao, Yu #define PCI_IOV_CAP		0x04	/* SR-IOV Capability Register */
1304fa74afb3SZhao, Yu #define  PCI_IOV_CAP_VFM	0x00000001 /* VF Migration Capable */
1305053d08d2SDongdong Liu #define  PCI_IOV_CAP_VF_10BIT_TAG_REQ 0x00000004 /* VF 10-Bit Tag Requester Supported */
1306fa74afb3SZhao, Yu #define  PCI_IOV_CAP_IMN(x)	((x) >> 21) /* VF Migration Interrupt Message Number */
1307fa74afb3SZhao, Yu #define PCI_IOV_CTRL		0x08	/* SR-IOV Control Register */
1308fa74afb3SZhao, Yu #define  PCI_IOV_CTRL_VFE	0x0001	/* VF Enable */
1309fa74afb3SZhao, Yu #define  PCI_IOV_CTRL_VFME	0x0002	/* VF Migration Enable */
1310fa74afb3SZhao, Yu #define  PCI_IOV_CTRL_VFMIE	0x0004	/* VF Migration Interrupt Enable */
1311fa74afb3SZhao, Yu #define  PCI_IOV_CTRL_MSE	0x0008	/* VF MSE */
1312fa74afb3SZhao, Yu #define  PCI_IOV_CTRL_ARI	0x0010	/* ARI Capable Hierarchy */
1313053d08d2SDongdong Liu #define  PCI_IOV_CTRL_VF_10BIT_TAG_REQ_EN 0x0020 /* VF 10-Bit Tag Requester Enable */
1314fa74afb3SZhao, Yu #define PCI_IOV_STATUS		0x0a	/* SR-IOV Status Register */
1315fa74afb3SZhao, Yu #define  PCI_IOV_STATUS_MS	0x0001	/* VF Migration Status */
1316fa74afb3SZhao, Yu #define PCI_IOV_INITIALVF	0x0c	/* Number of VFs that are initially associated */
1317fa74afb3SZhao, Yu #define PCI_IOV_TOTALVF		0x0e	/* Maximum number of VFs that could be associated */
1318fa74afb3SZhao, Yu #define PCI_IOV_NUMVF		0x10	/* Number of VFs that are available */
1319fa74afb3SZhao, Yu #define PCI_IOV_FDL		0x12	/* Function Dependency Link */
1320fa74afb3SZhao, Yu #define PCI_IOV_OFFSET		0x14	/* First VF Offset */
1321fa74afb3SZhao, Yu #define PCI_IOV_STRIDE		0x16	/* Routing ID offset from one VF to the next one */
1322fa74afb3SZhao, Yu #define PCI_IOV_DID		0x1a	/* VF Device ID */
1323fa74afb3SZhao, Yu #define PCI_IOV_SUPPS		0x1c	/* Supported Page Sizes */
1324fa74afb3SZhao, Yu #define PCI_IOV_SYSPS		0x20	/* System Page Size */
1325fa74afb3SZhao, Yu #define PCI_IOV_BAR_BASE	0x24	/* VF BAR0, VF BAR1, ... VF BAR5 */
1326fa74afb3SZhao, Yu #define PCI_IOV_NUM_BAR		6	/* Number of VF BARs */
1327fa74afb3SZhao, Yu #define PCI_IOV_MSAO		0x3c	/* VF Migration State Array Offset */
1328fa74afb3SZhao, Yu #define PCI_IOV_MSA_BIR(x)	((x) & 7) /* VF Migration State BIR */
1329fa74afb3SZhao, Yu #define PCI_IOV_MSA_OFFSET(x)	((x) & 0xfffffff8) /* VF Migration State Offset */
1330fa74afb3SZhao, Yu 
1331c0d9545cSBjorn Helgaas /* Multicast */
1332c0d9545cSBjorn Helgaas #define PCI_MCAST_CAP		0x04	/* Multicast Capability */
1333c0d9545cSBjorn Helgaas #define  PCI_MCAST_CAP_MAX_GROUP(x) ((x) & 0x3f)
1334c0d9545cSBjorn Helgaas #define  PCI_MCAST_CAP_WIN_SIZE(x) (((x) >> 8) & 0x3f)
1335c0d9545cSBjorn Helgaas #define  PCI_MCAST_CAP_ECRC	0x8000	/* ECRC Regeneration Supported */
1336c0d9545cSBjorn Helgaas #define PCI_MCAST_CTRL		0x06	/* Multicast Control */
1337c0d9545cSBjorn Helgaas #define  PCI_MCAST_CTRL_NUM_GROUP(x) ((x) & 0x3f)
1338c0d9545cSBjorn Helgaas #define  PCI_MCAST_CTRL_ENABLE	0x8000	/* MC Enabled */
1339c0d9545cSBjorn Helgaas #define PCI_MCAST_BAR		0x08	/* Base Address */
1340c0d9545cSBjorn Helgaas #define  PCI_MCAST_BAR_INDEX_POS(x)	((u32) ((x) & 0x3f))
1341c0d9545cSBjorn Helgaas #define  PCI_MCAST_BAR_MASK	(~0xfffUL)
1342c0d9545cSBjorn Helgaas #define PCI_MCAST_RCV		0x10	/* Receive */
1343c0d9545cSBjorn Helgaas #define PCI_MCAST_BLOCK		0x18	/* Block All */
1344c0d9545cSBjorn Helgaas #define PCI_MCAST_BLOCK_UNTRANS	0x20	/* Block Untranslated */
1345c0d9545cSBjorn Helgaas #define PCI_MCAST_OVL_BAR	0x28	/* Overlay BAR */
1346c0d9545cSBjorn Helgaas #define  PCI_MCAST_OVL_SIZE(x)	((u32) ((x) & 0x3f))
1347c0d9545cSBjorn Helgaas #define  PCI_MCAST_OVL_MASK	(~0x3fUL)
1348c0d9545cSBjorn Helgaas 
1349a858df0dSDavid Woodhouse /* Page Request Interface */
1350a858df0dSDavid Woodhouse #define PCI_PRI_CTRL		0x04	/* PRI Control Register */
1351a858df0dSDavid Woodhouse #define  PCI_PRI_CTRL_ENABLE	0x01	/* Enable */
1352a858df0dSDavid Woodhouse #define  PCI_PRI_CTRL_RESET	0x02	/* Reset */
1353a858df0dSDavid Woodhouse #define PCI_PRI_STATUS		0x06	/* PRI status register */
1354548a6e3bSAshok Raj #define  PCI_PRI_STATUS_RF	0x0001	/* Response Failure */
1355548a6e3bSAshok Raj #define  PCI_PRI_STATUS_UPRGI	0x0002	/* Unexpected PRG index */
1356548a6e3bSAshok Raj #define  PCI_PRI_STATUS_STOPPED	0x0100	/* PRI Stopped */
1357548a6e3bSAshok Raj #define  PCI_PRI_STATUS_PASID	0x8000	/* PASID required in PRG response */
1358a858df0dSDavid Woodhouse #define PCI_PRI_MAX_REQ		0x08	/* PRI max reqs supported */
1359a858df0dSDavid Woodhouse #define PCI_PRI_ALLOC_REQ	0x0c	/* PRI max reqs allowed */
1360a858df0dSDavid Woodhouse 
136167da1792SMartin Mares /* Transaction Processing Hints */
136267da1792SMartin Mares #define PCI_TPH_CAPABILITIES	4
136367da1792SMartin Mares #define   PCI_TPH_INTVEC_SUP	(1<<1)	/* Supports interrupt vector mode */
136467da1792SMartin Mares #define   PCI_TPH_DEV_SUP      	(1<<2)	/* Device specific mode supported */
136567da1792SMartin Mares #define   PCI_TPH_EXT_REQ_SUP	(1<<8)	/* Supports extended requests */
136667da1792SMartin Mares #define   PCI_TPH_ST_LOC_MASK	(3<<9)	/* Steering table location bits */
136767da1792SMartin Mares #define     PCI_TPH_ST_NONE	(0<<9)	/* No steering table */
136867da1792SMartin Mares #define     PCI_TPH_ST_CAP	(1<<9)	/* Steering table in TPH cap */
136967da1792SMartin Mares #define     PCI_TPH_ST_MSIX	(2<<9)	/* Steering table in MSI-X table */
137067da1792SMartin Mares #define   PCI_TPH_ST_SIZE_SHIFT	(16)	/* Encoded as size - 1 */
137167da1792SMartin Mares 
137267da1792SMartin Mares /* Latency Tolerance Reporting */
137367da1792SMartin Mares #define PCI_LTR_MAX_SNOOP	4	/* 16 bit value */
137467da1792SMartin Mares #define   PCI_LTR_VALUE_MASK	(0x3ff)
137567da1792SMartin Mares #define   PCI_LTR_SCALE_SHIFT	(10)
137667da1792SMartin Mares #define   PCI_LTR_SCALE_MASK	(7)
137767da1792SMartin Mares #define PCI_LTR_MAX_NOSNOOP	6	/* 16 bit value */
137867da1792SMartin Mares 
137921ff9851SBasavaraja M S /* Secondary PCI Express Extended Capability */
138021ff9851SBasavaraja M S #define PCI_SEC_LNKCTL3		4	/* Link Control 3 register */
138121ff9851SBasavaraja M S #define  PCI_SEC_LNKCTL3_PERFORM_LINK_EQU	0x01
138221ff9851SBasavaraja M S #define  PCI_SEC_LNKCTL3_LNK_EQU_REQ_INTR_EN	0x02
138321ff9851SBasavaraja M S #define  PCI_SEC_LNKCTL3_ENBL_LOWER_SKP_OS_GEN_VEC(x) ((x >> 8) & 0x7F)
138421ff9851SBasavaraja M S #define PCI_SEC_LANE_ERR	8	/* Lane Error status register */
13859f7dc65cSMartin Mares #define PCI_SEC_LANE_EQU_CTRL	12	/* Lane Equalization control register */
138621ff9851SBasavaraja M S 
13870c6383e9STristan Watts-Willis /* Physical Layer 16 GT/s Extended Capability */
13880c6383e9STristan Watts-Willis #define PCI_16GT_CAP		0x04	/* 16 GT/s Capabilities Register */
13890c6383e9STristan Watts-Willis #define PCI_16GT_CTL		0x08	/* 16 GT/s Control Register */
13900c6383e9STristan Watts-Willis #define PCI_16GT_STATUS		0x0C	/* 16 GT/s Status Register */
13910c6383e9STristan Watts-Willis #define  PCI_16GT_STATUS_EQU_COMP	0x0001	/* Equalization 16 GT/s Complete */
13920c6383e9STristan Watts-Willis #define  PCI_16GT_STATUS_EQU_PHASE1	0x0002	/* Equalization 16 GT/s Phase 1 Successful */
13930c6383e9STristan Watts-Willis #define  PCI_16GT_STATUS_EQU_PHASE2	0x0004	/* Equalization 16 GT/s Phase 2 Successful */
13940c6383e9STristan Watts-Willis #define  PCI_16GT_STATUS_EQU_PHASE3	0x0008	/* Equalization 16 GT/s Phase 3 Successful */
13950c6383e9STristan Watts-Willis #define  PCI_16GT_STATUS_EQU_REQ	0x0010	/* Link Equalization Request 16 GT/s */
13960c6383e9STristan Watts-Willis #define PCI_16GT_LDPM		0x10	/* 16 GT/s Local Data Parity Mismatch Status Register */
13970c6383e9STristan Watts-Willis #define PCI_16GT_FRDPM		0x14	/* 16 GT/s First Retimer Data Parity Mismatch Status Register */
13980c6383e9STristan Watts-Willis #define PCI_16GT_SRDPM		0x18	/* 16 GT/s Second Retimer Data Parity Mismatch Status Register */
13990c6383e9STristan Watts-Willis 
14000c6383e9STristan Watts-Willis /* Physical Layer 32 GT/s Extended Capability */
14010c6383e9STristan Watts-Willis #define PCI_32GT_CAP		0x04	/* 32 GT/s Capabilities Register */
14020c6383e9STristan Watts-Willis #define  PCI_32GT_CAP_EQU_BYPASS	0x0001	/* Equalization bypass to highest rate Supported */
14030c6383e9STristan Watts-Willis #define  PCI_32GT_CAP_NO_EQU_NEEDED	0x0002	/* No Equalization Needed Supported */
14040c6383e9STristan Watts-Willis #define  PCI_32GT_CAP_MOD_TS_MODE_0	0x0100	/* Modified TS Usage Mode 0 Supported - PCI Express */
14050c6383e9STristan Watts-Willis #define  PCI_32GT_CAP_MOD_TS_MODE_1	0x0200	/* Modified TS Usage Mode 1 Supported - Training Set Message */
14060c6383e9STristan Watts-Willis #define  PCI_32GT_CAP_MOD_TS_MODE_2	0x0400	/* Modified TS Usage Mode 2 Supported - Alternate Protocol */
14070c6383e9STristan Watts-Willis #define PCI_32GT_CTL		0x08	/* 32 GT/s Control Register */
14080c6383e9STristan Watts-Willis #define  PCI_32GT_CTL_EQU_BYPASS_DIS	0x1	/* Equalization bypass to highest rate Disable */
14090c6383e9STristan Watts-Willis #define  PCI_32GT_CTL_NO_EQU_NEEDED_DIS	0x2	/* No Equalization Needed Disable */
14100c6383e9STristan Watts-Willis #define  PCI_32GT_CTL_MOD_TS_MODE(x) (((x) >> 8) & 0x7)	/* Modified TS Usage Mode Selected */
14110c6383e9STristan Watts-Willis #define PCI_32GT_STATUS		0x0C	/* 32 GT/s Status Register */
14120c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_EQU_COMP	0x0001	/* Equalization 32 GT/s Complete */
14130c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_EQU_PHASE1	0x0002	/* Equalization 32 GT/s Phase 1 Successful */
14140c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_EQU_PHASE2	0x0004	/* Equalization 32 GT/s Phase 2 Successful */
14150c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_EQU_PHASE3	0x0008	/* Equalization 32 GT/s Phase 3 Successful */
14160c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_EQU_REQ	0x0010	/* Link Equalization Request 32 GT/s */
14170c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_MOD_TS		0x0020	/* Modified TS Received */
14180c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_RCV_ENH_LINK(x) (((x) >> 6) & 0x3)	/* Received Enhanced Link Behavior Control */
14190c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_TX_PRE_ON	0x0100	/* Transmitter Precoding On */
14200c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_TX_PRE_REQ	0x0200	/* Transmitter Precoding Request */
14210c6383e9STristan Watts-Willis #define  PCI_32GT_STATUS_NO_EQU 	0x0400	/* No Equalization Needed Received */
14220c6383e9STristan Watts-Willis #define PCI_32GT_RXMODTS1	0x10	/* Received Modified TS Data 1 Register */
14230c6383e9STristan Watts-Willis #define PCI_32GT_RXMODTS2	0x14	/* Received Modified TS Data 2 Register */
14240c6383e9STristan Watts-Willis #define PCI_32GT_TXMODTS1	0x18	/* Transmitted Modified TS Data 1 Register */
14250c6383e9STristan Watts-Willis #define PCI_32GT_TXMODTS2	0x1C	/* Transmitted Modified TS Data 2 Register */
14260c6383e9STristan Watts-Willis 
142704d90becSTristan Watts-Willis /* Physical Layer 64 GT/s Extended Capability */
142804d90becSTristan Watts-Willis #define PCI_64GT_CAP		0x04	/* 64 GT/s Capabilities Register */
142904d90becSTristan Watts-Willis #define PCI_64GT_CTL		0x08	/* 64 GT/s Control Register */
143004d90becSTristan Watts-Willis #define PCI_64GT_STATUS		0x0C	/* 64 GT/s Status Register */
143104d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_EQU_COMP	0x0001	/* Equalization 64 GT/s Complete */
143204d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_EQU_PHASE1	0x0002	/* Equalization 64 GT/s Phase 1 Successful */
143304d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_EQU_PHASE2	0x0004	/* Equalization 64 GT/s Phase 2 Successful */
143404d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_EQU_PHASE3	0x0008	/* Equalization 64 GT/s Phase 3 Successful */
143504d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_EQU_REQ	0x0010	/* Link Equalization Request 64 GT/s */
143604d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_TX_PRE_ON	0x0020	/* Transmitter Precoding On */
143704d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_TX_PRE_REQ	0x0040	/* Transmitter Precoding Request */
143804d90becSTristan Watts-Willis #define  PCI_64GT_STATUS_NO_EQU 	0x0080	/* No Equalization Needed Received */
143904d90becSTristan Watts-Willis 
1440a858df0dSDavid Woodhouse /* Process Address Space ID */
1441a858df0dSDavid Woodhouse #define PCI_PASID_CAP		0x04	/* PASID feature register */
1442a858df0dSDavid Woodhouse #define  PCI_PASID_CAP_EXEC	0x02	/* Exec permissions Supported */
1443a858df0dSDavid Woodhouse #define  PCI_PASID_CAP_PRIV	0x04	/* Privilege Mode Supported */
1444a858df0dSDavid Woodhouse #define  PCI_PASID_CAP_WIDTH(x) (((x) >> 8) & 0x1f) /* Max PASID Width */
1445a858df0dSDavid Woodhouse #define PCI_PASID_CTRL		0x06	/* PASID control register */
1446a858df0dSDavid Woodhouse #define  PCI_PASID_CTRL_ENABLE	0x01	/* Enable bit */
1447a858df0dSDavid Woodhouse #define  PCI_PASID_CTRL_EXEC	0x02	/* Exec permissions Enable */
1448a858df0dSDavid Woodhouse #define  PCI_PASID_CTRL_PRIV	0x04	/* Privilege Mode Enable */
1449de91b6f2SKeith Busch 
1450de91b6f2SKeith Busch #define PCI_DPC_CAP		4	/* DPC Capability */
1451de91b6f2SKeith Busch #define  PCI_DPC_CAP_INT_MSG(x) ((x) & 0x1f)	/* DPC Interrupt Message Number */
14528f33a693SGuillem Jover #define  PCI_DPC_CAP_RP_EXT	0x20		/* DPC Root Port Extensions */
1453de91b6f2SKeith Busch #define  PCI_DPC_CAP_TLP_BLOCK	0x40		/* DPC Poisoned TLP Egress Blocking */
1454de91b6f2SKeith Busch #define  PCI_DPC_CAP_SW_TRIGGER	0x80		/* DPC Software Trigger */
1455de91b6f2SKeith Busch #define  PCI_DPC_CAP_RP_LOG(x)	(((x) >> 8) & 0xf) /* DPC RP PIO Log Size */
1456de91b6f2SKeith Busch #define  PCI_DPC_CAP_DL_ACT_ERR	0x1000		/* DPC DL_Active ERR_COR Signal */
1457de91b6f2SKeith Busch #define PCI_DPC_CTL		6	/* DPC Control */
1458de91b6f2SKeith Busch #define  PCI_DPC_CTL_TRIGGER(x) ((x) & 0x3)	/* DPC Trigger Enable */
1459de91b6f2SKeith Busch #define  PCI_DPC_CTL_CMPL	0x4		/* DPC Completion Control */
1460de91b6f2SKeith Busch #define  PCI_DPC_CTL_INT	0x8		/* DPC Interrupt Enabled */
1461de91b6f2SKeith Busch #define  PCI_DPC_CTL_ERR_COR	0x10		/* DPC ERR_COR Enabled */
1462de91b6f2SKeith Busch #define  PCI_DPC_CTL_TLP	0x20		/* DPC Poisoned TLP Egress Blocking Enabled */
1463de91b6f2SKeith Busch #define  PCI_DPC_CTL_SW_TRIGGER	0x40		/* DPC Software Trigger */
1464de91b6f2SKeith Busch #define  PCI_DPC_CTL_DL_ACTIVE	0x80		/* DPC DL_Active ERR_COR Enable */
1465de91b6f2SKeith Busch #define PCI_DPC_STATUS		8	/* DPC STATUS */
1466de91b6f2SKeith Busch #define  PCI_DPC_STS_TRIGGER	0x01		/* DPC Trigger Status */
1467de91b6f2SKeith Busch #define  PCI_DPC_STS_REASON(x) (((x) >> 1) & 0x3) /* DPC Trigger Reason */
1468de91b6f2SKeith Busch #define  PCI_DPC_STS_INT	0x08		/* DPC Interrupt Status */
1469de91b6f2SKeith Busch #define  PCI_DPC_STS_RP_BUSY	0x10		/* DPC Root Port Busy */
14708f33a693SGuillem Jover #define  PCI_DPC_STS_TRIGGER_EXT(x) (((x) >> 5) & 0x3) /* Trigger Reason Extension */
1471de91b6f2SKeith Busch #define  PCI_DPC_STS_PIO_FEP(x) (((x) >> 8) & 0x1f) /* DPC PIO First Error Pointer */
1472de91b6f2SKeith Busch #define PCI_DPC_SOURCE		10	/* DPC Source ID */
1473de91b6f2SKeith Busch 
14748efbe075SRajat Jain /* L1 PM Substates Extended Capability */
14758efbe075SRajat Jain #define PCI_L1PM_SUBSTAT_CAP	0x4	/* L1 PM Substate Capability */
14768efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CAP_PM_L12	0x1	/* PCI-PM L1.2 Supported */
14778efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CAP_PM_L11	0x2	/* PCI-PM L1.1 Supported */
14788efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CAP_ASPM_L12	0x4	/* ASPM L1.2 Supported */
14798efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CAP_ASPM_L11	0x8	/* ASPM L1.1 Supported */
1480c84f5352SMikhail Bratchikov #define  PCI_L1PM_SUBSTAT_CAP_L1PM_SUPP	0x10	/* L1 PM Substates supported */
14818efbe075SRajat Jain #define PCI_L1PM_SUBSTAT_CTL1	0x8	/* L1 PM Substate Control 1 */
14828efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CTL1_PM_L12	0x1	/* PCI-PM L1.2 Enable */
14838efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CTL1_PM_L11	0x2	/* PCI-PM L1.1 Enable */
14848efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CTL1_ASPM_L12	0x4	/* ASPM L1.2 Enable */
14858efbe075SRajat Jain #define  PCI_L1PM_SUBSTAT_CTL1_ASPM_L11	0x8	/* ASPM L1.1 Enable */
14868efbe075SRajat Jain #define PCI_L1PM_SUBSTAT_CTL2	0xC	/* L1 PM Substate Control 2 */
14878efbe075SRajat Jain 
148860be9345SJonathan Cameron /* Data Object Exchange Extended Capability */
148960be9345SJonathan Cameron #define PCI_DOE_CAP		0x4	/* DOE Capabilities Register */
149060be9345SJonathan Cameron #define  PCI_DOE_CAP_INT_SUPP		0x1	/* Interrupt Support */
149160be9345SJonathan Cameron #define  PCI_DOE_CAP_INT_MSG(x) (((x) >> 1) & 0x7ff) /* DOE Interrupt Message Number */
149260be9345SJonathan Cameron #define PCI_DOE_CTL		0x8	/* DOE Control Register */
149360be9345SJonathan Cameron #define  PCI_DOE_CTL_ABORT		0x1	/* DOE Abort */
149460be9345SJonathan Cameron #define  PCI_DOE_CTL_INT		0x2	/* DOE Interrupt Enable */
149560be9345SJonathan Cameron #define  PCI_DOE_CTL_GO			0x80000000 /* DOE Go */
149660be9345SJonathan Cameron #define PCI_DOE_STS		0xC	/* DOE Status Register */
149760be9345SJonathan Cameron #define  PCI_DOE_STS_BUSY		0x1	/* DOE Busy */
149860be9345SJonathan Cameron #define  PCI_DOE_STS_INT		0x2	/* DOE Interrupt Status */
14992e05a86bSWilfred Mallawa #define  PCI_DOE_STS_ERROR		0x4	/* DOE Error */
150060be9345SJonathan Cameron #define  PCI_DOE_STS_OBJECT_READY	0x80000000 /* Data Object Ready */
150160be9345SJonathan Cameron 
15020eebdc1cSNikita Proshkin /* Lane Margining at the Receiver Extended Capability */
15030eebdc1cSNikita Proshkin #define PCI_LMR_CAPS			0x4 /* Margining Port Capabilities Register */
15040eebdc1cSNikita Proshkin #define PCI_LMR_CAPS_DRVR		0x1 /* Margining uses Driver Software */
15050eebdc1cSNikita Proshkin #define PCI_LMR_PORT_STS		0x6 /* Margining Port Status Register */
15060eebdc1cSNikita Proshkin #define PCI_LMR_PORT_STS_READY		0x1 /* Margining Ready */
15070eebdc1cSNikita Proshkin #define PCI_LMR_PORT_STS_SOFT_READY	0x2 /* Margining Software Ready */
15080eebdc1cSNikita Proshkin 
15099611db3eSPaul Cassidy /* Device 3 Extended Capability */
15109611db3eSPaul Cassidy #define PCI_DEV3_DEVCAP3		0x04	/* Device Capabilities 3 */
15119611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_DMWR_REQ	0x0001	/* DMWr Request Routing Supported */
15129611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_14BIT_TAG_COMP	0x0002	/* 14-Bit Tag Completer Supported */
15139611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_14BIT_TAG_REQ	0x0004	/* 14-Bit Tag Requester Supported */
15149611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_L0P_SUPP	0x0008	/* L0p Supported */
15159611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_PORT_L0P_EXIT(x)	(((x) >> 4) & 0x7) /* Port L0p Exit Latency */
15169611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_RETIMER_L0P_EXIT(x)	(((x) >> 7) & 0x7) /* Retimer L0p Exit Latency */
15179611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_UIO_MEM_RDWR_COMP	0x0400	/* UIO Mem RdWr Completer Supported */
15189611db3eSPaul Cassidy #define  PCI_DEV3_DEVCAP3_UIO_MEM_RDWR_REQ	0x0800	/* UIO Mem RdWr Requester Supported */
15199611db3eSPaul Cassidy 
15209611db3eSPaul Cassidy #define PCI_DEV3_DEVCTL3		0x08	/* Device Control 3 */
15219611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_DMWR_REQ_EN	0x0001	/* DMWr Requester Enable */
15229611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_DMWR_EGRESS_BLK	0x0002	/* DMWr Egress Blocking */
15239611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_14BIT_TAG_REQ_EN	0x0004	/* 14-Bit Tag Requester Enable */
15249611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_L0P_EN	0x0008	/* L0p Enable */
15259611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_TARGET_LINK_WIDTH(x)	(((x) >> 4) & 0x7) /* Target Link Width */
15269611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_UIO_MEM_RDWR_REQ_EN	0x0080	/* UIO Mem RdWr Requester Enable */
15279611db3eSPaul Cassidy #define  PCI_DEV3_DEVCTL3_UIO_REQ_256B_DIS	0x0100	/* UIO Request 256B Boundary Disable */
15289611db3eSPaul Cassidy 
15299611db3eSPaul Cassidy #define PCI_DEV3_DEVSTA3		0x0C	/* Device Status 3 */
15309611db3eSPaul Cassidy #define  PCI_DEV3_DEVSTA3_INIT_LINK_WIDTH(x)	((x) & 0x7) /* Initial Link Width */
15319611db3eSPaul Cassidy #define  PCI_DEV3_DEVSTA3_SEGMENT_CAPTURED	0x0008	/* Segment Captured */
15329611db3eSPaul Cassidy #define  PCI_DEV3_DEVSTA3_REMOTE_L0P_SUPP	0x0010	/* Remote L0p Supported */
15339611db3eSPaul Cassidy 
153442fc4263SAlexey Kardashevskiy /* Integrity and Data Encryption Extended Capability */
153542fc4263SAlexey Kardashevskiy #define PCI_IDE_CAP		0x4
153642fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_LINK_IDE_SUPP	0x1	/* Link IDE Stream Supported */
153742fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_SELECTIVE_IDE_SUPP 0x2	/* Selective IDE Streams Supported */
153842fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_FLOWTHROUGH_IDE_SUPP 0x4	/* Flow-Through IDE Stream Supported */
153942fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_PARTIAL_HEADER_ENC_SUPP 0x8 /* Partial Header Encryption Supported */
154042fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_AGGREGATION_SUPP	0x10	/* Aggregation Supported */
154142fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_PCRC_SUPP		0x20	/* PCRC Supported */
154242fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_IDE_KM_SUPP	0x40	/* IDE_KM Protocol Supported */
154342fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_ALG(x)	(((x) >> 8) & 0x1f) /* Supported Algorithms */
154442fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_ALG_AES_GCM_256	0	/* AES-GCM 256 key size, 96b MAC */
154542fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_LINK_TC_NUM(x)		(((x) >> 13) & 0x7) /* Number of TCs Supported for Link IDE */
154642fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_SELECTIVE_STREAMS_NUM(x)	(((x) >> 16) & 0xff) /* Number of Selective IDE Streams Supported */
154742fc4263SAlexey Kardashevskiy #define  PCI_IDE_CAP_TEE_LIMITED_SUPP   0x1000000 /* TEE-Limited Stream Supported */
154842fc4263SAlexey Kardashevskiy #define PCI_IDE_CTL		0x8
154942fc4263SAlexey Kardashevskiy #define  PCI_IDE_CTL_FLOWTHROUGH_IDE	0x4	/* Flow-Through IDE Stream Enabled */
155042fc4263SAlexey Kardashevskiy #define PCI_IDE_LINK_STREAM		0xC
155142fc4263SAlexey Kardashevskiy /* Link IDE Stream block, up to PCI_IDE_CAP_LINK_TC_NUM */
155242fc4263SAlexey Kardashevskiy /* Link IDE Stream Control Register */
155342fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_EN		0x1	/* Link IDE Stream Enable */
155442fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_TX_AGGR_NPR(x)(((x) >> 2) & 0x3) /* Tx Aggregation Mode NPR */
155542fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_TX_AGGR_PR(x)	(((x) >> 4) & 0x3) /* Tx Aggregation Mode PR */
155642fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_TX_AGGR_CPL(x)(((x) >> 6) & 0x3) /* Tx Aggregation Mode CPL */
155742fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_PCRC_EN	0x100	/* PCRC Enable */
155842fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_PART_ENC(x)	(((x) >> 10) & 0xf)  /* Partial Header Encryption Mode */
155942fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_ALG(x)	(((x) >> 14) & 0x1f) /* Selected Algorithm */
156042fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_TC(x)		(((x) >> 19) & 0x7)  /* Traffic Class */
156142fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_CTL_ID(x)		(((x) >> 24) & 0xff) /* Stream ID */
156242fc4263SAlexey Kardashevskiy /* Link IDE Stream Status Register */
156342fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_STS_STATUS(x)	((x) & 0xf) /* Link IDE Stream State */
156442fc4263SAlexey Kardashevskiy #define  PCI_IDE_LINK_STS_RECVD_INTEGRITY_CHECK	0x80000000 /* Received Integrity Check Fail Message */
156542fc4263SAlexey Kardashevskiy /* Selective IDE Stream block, up to PCI_IDE_CAP_SELECTIVE_STREAMS_NUM */
156642fc4263SAlexey Kardashevskiy /* Selective IDE Stream Capability Register */
156742fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CAP_BLOCKS_NUM(x)	((x) & 0xf) /* Number of Address Association Register Blocks */
156842fc4263SAlexey Kardashevskiy /* Selective IDE Stream Control Register */
156942fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_EN		0x1	/* Selective IDE Stream Enable */
157042fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_TX_AGGR_NPR(x)	(((x) >> 2) & 0x3) /* Tx Aggregation Mode NPR */
157142fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_TX_AGGR_PR(x)	(((x) >> 4) & 0x3) /* Tx Aggregation Mode PR */
157242fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_TX_AGGR_CPL(x)	(((x) >> 6) & 0x3) /* Tx Aggregation Mode CPL */
157342fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_PCRC_EN	0x100	/* PCRC Enable */
15748c140beeSAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_CFG_EN         0x200   /* Selective IDE for Configuration Requests Enable */
157542fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_PART_ENC(x)	(((x) >> 10) & 0xf)  /* Partial Header Encryption Mode */
157642fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_ALG(x)		(((x) >> 14) & 0x1f) /* Selected Algorithm */
157742fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_TC(x)		(((x) >> 19) & 0x7)  /* Traffic Class */
157842fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_DEFAULT	0x400000 /* Default Stream */
157942fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_CTL_ID(x)		(((x) >> 24) & 0xff) /* Stream ID */
158042fc4263SAlexey Kardashevskiy /* Selective IDE Stream Status Register */
158142fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_STS_STATUS(x)	((x) & 0xf) /* Selective IDE Stream State */
158242fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_STS_RECVD_INTEGRITY_CHECK	0x80000000 /* Received Integrity Check Fail Message */
158342fc4263SAlexey Kardashevskiy /* IDE RID Association Register 1 */
158442fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_RID_1_LIMIT(x)	(((x) >> 8) & 0xffff) /* RID Limit */
158542fc4263SAlexey Kardashevskiy /* IDE RID Association Register 2 */
158642fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_RID_2_VALID	0x1	/* Valid */
158742fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_RID_2_BASE(x)	(((x) >> 8) & 0xffff) /* RID Base */
158842fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_RID_2_SEG_BASE(x)	(((x) >> 24) & 0xff) /* Segmeng Base */
158942fc4263SAlexey Kardashevskiy /* Selective IDE Address Association Register Block, up to PCI_IDE_SEL_CAP_BLOCKS_NUM */
159042fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_ADDR_1_VALID	0x1	/* Valid */
159142fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_ADDR_1_BASE_LOW(x)	(((x) >> 8) & 0xfff) /* Memory Base Lower */
159242fc4263SAlexey Kardashevskiy #define  PCI_IDE_SEL_ADDR_1_LIMIT_LOW(x)(((x) >> 20) & 0xfff) /* Memory Limit Lower */
159342fc4263SAlexey Kardashevskiy /* IDE Address Association Register 2 is "Memory Limit Upper" */
159442fc4263SAlexey Kardashevskiy /* IDE Address Association Register 3 is "Memory Base Upper" */
159542fc4263SAlexey Kardashevskiy 
1596d6b297d0SMartin Mares /*
1597d6b297d0SMartin Mares  * The PCI interface treats multi-function devices as independent
1598d6b297d0SMartin Mares  * devices.  The slot/function address of each device is encoded
1599d6b297d0SMartin Mares  * in a single byte as follows:
1600d6b297d0SMartin Mares  *
1601d6b297d0SMartin Mares  *	7:3 = slot
1602d6b297d0SMartin Mares  *	2:0 = function
1603d6b297d0SMartin Mares  */
1604d6b297d0SMartin Mares #define PCI_DEVFN(slot,func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
1605d6b297d0SMartin Mares #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
1606d6b297d0SMartin Mares #define PCI_FUNC(devfn)		((devfn) & 0x07)
1607d6b297d0SMartin Mares 
1608d6b297d0SMartin Mares /* Device classes and subclasses */
1609d6b297d0SMartin Mares 
1610d6b297d0SMartin Mares #define PCI_CLASS_NOT_DEFINED		0x0000
1611d6b297d0SMartin Mares #define PCI_CLASS_NOT_DEFINED_VGA	0x0001
1612d6b297d0SMartin Mares 
1613d6b297d0SMartin Mares #define PCI_BASE_CLASS_STORAGE		0x01
1614d6b297d0SMartin Mares #define PCI_CLASS_STORAGE_SCSI		0x0100
1615d6b297d0SMartin Mares #define PCI_CLASS_STORAGE_IDE		0x0101
1616d6b297d0SMartin Mares #define PCI_CLASS_STORAGE_FLOPPY	0x0102
1617d6b297d0SMartin Mares #define PCI_CLASS_STORAGE_IPI		0x0103
1618d6b297d0SMartin Mares #define PCI_CLASS_STORAGE_RAID		0x0104
1619b2055313SMartin Mares #define PCI_CLASS_STORAGE_ATA		0x0105
1620b2055313SMartin Mares #define PCI_CLASS_STORAGE_SATA		0x0106
1621b2055313SMartin Mares #define PCI_CLASS_STORAGE_SAS		0x0107
1622fef7acc7SRonan Pigott #define PCI_CLASS_STORAGE_NVM		0x0108
1623fef7acc7SRonan Pigott #define PCI_CLASS_STORAGE_UFS		0x0109
1624d6b297d0SMartin Mares #define PCI_CLASS_STORAGE_OTHER		0x0180
1625d6b297d0SMartin Mares 
1626d6b297d0SMartin Mares #define PCI_BASE_CLASS_NETWORK		0x02
1627d6b297d0SMartin Mares #define PCI_CLASS_NETWORK_ETHERNET	0x0200
1628d6b297d0SMartin Mares #define PCI_CLASS_NETWORK_TOKEN_RING	0x0201
1629d6b297d0SMartin Mares #define PCI_CLASS_NETWORK_FDDI		0x0202
1630d6b297d0SMartin Mares #define PCI_CLASS_NETWORK_ATM		0x0203
1631b2055313SMartin Mares #define PCI_CLASS_NETWORK_ISDN		0x0204
1632fef7acc7SRonan Pigott #define PCI_CLASS_NETWORK_WORLDFLIP	0x0205
1633fef7acc7SRonan Pigott #define PCI_CLASS_NETWORK_PICMG		0x0206
1634fef7acc7SRonan Pigott #define PCI_CLASS_NETWORK_INFINIBAND	0x0207
1635fef7acc7SRonan Pigott #define PCI_CLASS_NETWORK_FABRIC	0x0208
1636d6b297d0SMartin Mares #define PCI_CLASS_NETWORK_OTHER		0x0280
1637d6b297d0SMartin Mares 
1638d6b297d0SMartin Mares #define PCI_BASE_CLASS_DISPLAY		0x03
1639d6b297d0SMartin Mares #define PCI_CLASS_DISPLAY_VGA		0x0300
1640d6b297d0SMartin Mares #define PCI_CLASS_DISPLAY_XGA		0x0301
1641b2055313SMartin Mares #define PCI_CLASS_DISPLAY_3D		0x0302
1642d6b297d0SMartin Mares #define PCI_CLASS_DISPLAY_OTHER		0x0380
1643d6b297d0SMartin Mares 
1644d6b297d0SMartin Mares #define PCI_BASE_CLASS_MULTIMEDIA	0x04
1645d6b297d0SMartin Mares #define PCI_CLASS_MULTIMEDIA_VIDEO	0x0400
1646d6b297d0SMartin Mares #define PCI_CLASS_MULTIMEDIA_AUDIO	0x0401
1647b2055313SMartin Mares #define PCI_CLASS_MULTIMEDIA_PHONE	0x0402
1648b2055313SMartin Mares #define PCI_CLASS_MULTIMEDIA_AUDIO_DEV	0x0403
1649d6b297d0SMartin Mares #define PCI_CLASS_MULTIMEDIA_OTHER	0x0480
1650d6b297d0SMartin Mares 
1651d6b297d0SMartin Mares #define PCI_BASE_CLASS_MEMORY		0x05
1652d6b297d0SMartin Mares #define  PCI_CLASS_MEMORY_RAM		0x0500
1653d6b297d0SMartin Mares #define  PCI_CLASS_MEMORY_FLASH		0x0501
1654d6b297d0SMartin Mares #define  PCI_CLASS_MEMORY_OTHER		0x0580
1655d6b297d0SMartin Mares 
1656d6b297d0SMartin Mares #define PCI_BASE_CLASS_BRIDGE		0x06
1657d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_HOST		0x0600
1658d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_ISA		0x0601
1659d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_EISA		0x0602
1660d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_MC		0x0603
1661d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_PCI		0x0604
1662d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_PCMCIA	0x0605
1663d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_NUBUS		0x0606
1664d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_CARDBUS	0x0607
1665b2055313SMartin Mares #define  PCI_CLASS_BRIDGE_RACEWAY	0x0608
1666b2055313SMartin Mares #define  PCI_CLASS_BRIDGE_PCI_SEMI	0x0609
1667b2055313SMartin Mares #define  PCI_CLASS_BRIDGE_IB_TO_PCI	0x060a
1668fca6726eSMartin Mares #define  PCI_CLASS_BRIDGE_ADV_SWITCHING	0x060b
1669d6b297d0SMartin Mares #define  PCI_CLASS_BRIDGE_OTHER		0x0680
1670d6b297d0SMartin Mares 
1671d6b297d0SMartin Mares #define PCI_BASE_CLASS_COMMUNICATION	0x07
1672d6b297d0SMartin Mares #define PCI_CLASS_COMMUNICATION_SERIAL	0x0700
1673d6b297d0SMartin Mares #define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701
1674b2055313SMartin Mares #define PCI_CLASS_COMMUNICATION_MSERIAL	0x0702
1675b2055313SMartin Mares #define PCI_CLASS_COMMUNICATION_MODEM	0x0703
1676fef7acc7SRonan Pigott #define PCI_CLASS_COMMUNICATION_GPIB	0x0704
1677fef7acc7SRonan Pigott #define PCI_CLASS_COMMUNICATION_SMARTCARD 0x0705
1678d6b297d0SMartin Mares #define PCI_CLASS_COMMUNICATION_OTHER	0x0780
1679d6b297d0SMartin Mares 
1680d6b297d0SMartin Mares #define PCI_BASE_CLASS_SYSTEM		0x08
1681d6b297d0SMartin Mares #define PCI_CLASS_SYSTEM_PIC		0x0800
1682d6b297d0SMartin Mares #define PCI_CLASS_SYSTEM_DMA		0x0801
1683d6b297d0SMartin Mares #define PCI_CLASS_SYSTEM_TIMER		0x0802
1684d6b297d0SMartin Mares #define PCI_CLASS_SYSTEM_RTC		0x0803
1685b2055313SMartin Mares #define PCI_CLASS_SYSTEM_PCI_HOTPLUG	0x0804
1686fef7acc7SRonan Pigott #define PCI_CLASS_SYSTEM_SD_HOST	0x0805
1687fef7acc7SRonan Pigott #define PCI_CLASS_SYSTEM_IOMMU		0x0806
1688fca6726eSMartin Mares #define PCI_CLASS_SYSTEM_ROOT_EVENT_COLL	0x0807
1689fca6726eSMartin Mares #define PCI_CLASS_SYSTEM_TIME_CARD	0x0808
1690d6b297d0SMartin Mares #define PCI_CLASS_SYSTEM_OTHER		0x0880
1691fca6726eSMartin Mares #define PCI_CLASS_SYSTEM_TIMING_CARD	0x0899	// Experimental use before official PCI SIG allocation
1692d6b297d0SMartin Mares 
1693d6b297d0SMartin Mares #define PCI_BASE_CLASS_INPUT		0x09
1694d6b297d0SMartin Mares #define PCI_CLASS_INPUT_KEYBOARD	0x0900
1695d6b297d0SMartin Mares #define PCI_CLASS_INPUT_PEN		0x0901
1696d6b297d0SMartin Mares #define PCI_CLASS_INPUT_MOUSE		0x0902
1697b2055313SMartin Mares #define PCI_CLASS_INPUT_SCANNER		0x0903
1698b2055313SMartin Mares #define PCI_CLASS_INPUT_GAMEPORT	0x0904
1699d6b297d0SMartin Mares #define PCI_CLASS_INPUT_OTHER		0x0980
1700d6b297d0SMartin Mares 
1701d6b297d0SMartin Mares #define PCI_BASE_CLASS_DOCKING		0x0a
1702d6b297d0SMartin Mares #define PCI_CLASS_DOCKING_GENERIC	0x0a00
1703fd54ccebSMartin Mares #define PCI_CLASS_DOCKING_OTHER		0x0a80
1704d6b297d0SMartin Mares 
1705d6b297d0SMartin Mares #define PCI_BASE_CLASS_PROCESSOR	0x0b
1706d6b297d0SMartin Mares #define PCI_CLASS_PROCESSOR_386		0x0b00
1707d6b297d0SMartin Mares #define PCI_CLASS_PROCESSOR_486		0x0b01
1708d6b297d0SMartin Mares #define PCI_CLASS_PROCESSOR_PENTIUM	0x0b02
1709d6b297d0SMartin Mares #define PCI_CLASS_PROCESSOR_ALPHA	0x0b10
1710d6b297d0SMartin Mares #define PCI_CLASS_PROCESSOR_POWERPC	0x0b20
1711b2055313SMartin Mares #define PCI_CLASS_PROCESSOR_MIPS	0x0b30
1712d6b297d0SMartin Mares #define PCI_CLASS_PROCESSOR_CO		0x0b40
1713fca6726eSMartin Mares #define PCI_CLASS_PROCESSOR_OTHER	0x0b80
1714d6b297d0SMartin Mares 
1715d6b297d0SMartin Mares #define PCI_BASE_CLASS_SERIAL		0x0c
1716d6b297d0SMartin Mares #define PCI_CLASS_SERIAL_FIREWIRE	0x0c00
1717d6b297d0SMartin Mares #define PCI_CLASS_SERIAL_ACCESS		0x0c01
1718d6b297d0SMartin Mares #define PCI_CLASS_SERIAL_SSA		0x0c02
1719d6b297d0SMartin Mares #define PCI_CLASS_SERIAL_USB		0x0c03
1720d6b297d0SMartin Mares #define PCI_CLASS_SERIAL_FIBER		0x0c04
1721b2055313SMartin Mares #define PCI_CLASS_SERIAL_SMBUS		0x0c05
1722b2055313SMartin Mares #define PCI_CLASS_SERIAL_INFINIBAND	0x0c06
1723fef7acc7SRonan Pigott #define PCI_CLASS_SERIAL_IPMI		0x0c07
1724fef7acc7SRonan Pigott #define PCI_CLASS_SERIAL_SERCOS		0x0c08
1725fef7acc7SRonan Pigott #define PCI_CLASS_SERIAL_CANBUS		0x0c09
1726fca6726eSMartin Mares #define PCI_CLASS_SERIAL_MIPS_I3C	0x0c0a
1727fca6726eSMartin Mares #define PCI_CLASS_SERIAL_CXL_FMHI	0x0c0b
1728fca6726eSMartin Mares #define PCI_CLASS_SERIAL_MMBI		0x0c0c
1729fef7acc7SRonan Pigott #define PCI_CLASS_SERIAL_OTHER		0x0c80
1730b2055313SMartin Mares 
1731b2055313SMartin Mares #define PCI_BASE_CLASS_WIRELESS		0x0d
1732b2055313SMartin Mares #define PCI_CLASS_WIRELESS_IRDA		0x0d00
1733b2055313SMartin Mares #define PCI_CLASS_WIRELESS_CONSUMER_IR	0x0d01
1734b2055313SMartin Mares #define PCI_CLASS_WIRELESS_RF		0x0d10
1735fef7acc7SRonan Pigott #define PCI_CLASS_WIRELESS_BLUETOOTH	0x0d11
1736fef7acc7SRonan Pigott #define PCI_CLASS_WIRELESS_BROADBAND	0x0d12
1737fef7acc7SRonan Pigott #define PCI_CLASS_WIRELESS_80211a	0x0d20
1738fef7acc7SRonan Pigott #define PCI_CLASS_WIRELESS_80211b	0x0d21
1739fca6726eSMartin Mares #define PCI_CLASS_WIRELESS_CELLULAR	0x0d40
1740fca6726eSMartin Mares #define PCI_CLASS_WIRELESS_CELLULAR_PLUS_80211	0x0d41
1741b2055313SMartin Mares #define PCI_CLASS_WIRELESS_OTHER	0x0d80
1742b2055313SMartin Mares 
1743b2055313SMartin Mares #define PCI_BASE_CLASS_INTELLIGENT	0x0e
1744b2055313SMartin Mares #define PCI_CLASS_INTELLIGENT_I2O	0x0e00
1745b2055313SMartin Mares 
1746b2055313SMartin Mares #define PCI_BASE_CLASS_SATELLITE	0x0f
1747b2055313SMartin Mares #define PCI_CLASS_SATELLITE_TV		0x0f00
1748b2055313SMartin Mares #define PCI_CLASS_SATELLITE_AUDIO	0x0f01
1749b2055313SMartin Mares #define PCI_CLASS_SATELLITE_VOICE	0x0f03
1750b2055313SMartin Mares #define PCI_CLASS_SATELLITE_DATA	0x0f04
1751fca6726eSMartin Mares #define PCI_CLASS_SATELLITE_OTHER	0x0f80
1752b2055313SMartin Mares 
1753b2055313SMartin Mares #define PCI_BASE_CLASS_CRYPT		0x10
1754b2055313SMartin Mares #define PCI_CLASS_CRYPT_NETWORK		0x1000
1755b2055313SMartin Mares #define PCI_CLASS_CRYPT_ENTERTAINMENT	0x1010
1756fca6726eSMartin Mares #define PCI_CLASS_CRYPT_TPM		0x1020
1757b2055313SMartin Mares #define PCI_CLASS_CRYPT_OTHER		0x1080
1758b2055313SMartin Mares 
1759b2055313SMartin Mares #define PCI_BASE_CLASS_SIGNAL		0x11
1760b2055313SMartin Mares #define PCI_CLASS_SIGNAL_DPIO		0x1100
1761b2055313SMartin Mares #define PCI_CLASS_SIGNAL_PERF_CTR	0x1101
1762b2055313SMartin Mares #define PCI_CLASS_SIGNAL_SYNCHRONIZER	0x1110
1763fef7acc7SRonan Pigott #define PCI_CLASS_SIGNAL_MANAGEMENT	0x1120
1764b2055313SMartin Mares #define PCI_CLASS_SIGNAL_OTHER		0x1180
1765d6b297d0SMartin Mares 
1766fca6726eSMartin Mares #define PCI_BASE_CLASS_ACCEL		0x12
1767fca6726eSMartin Mares #define PCI_CLASS_ACCEL_PROCESSING	0x1200
1768fca6726eSMartin Mares #define PCI_CLASS_ACCEL_SDXI		0x1201
1769fca6726eSMartin Mares 
1770fca6726eSMartin Mares #define PCI_BASE_CLASS_INSTRUM		0x13
1771fca6726eSMartin Mares #define PCI_CLASS_INSTRUM_NON_ESS	0x1300
1772fca6726eSMartin Mares 
1773d6b297d0SMartin Mares #define PCI_CLASS_OTHERS		0xff
1774d6b297d0SMartin Mares 
1775d6b297d0SMartin Mares /* Several ID's we need in the library */
1776d6b297d0SMartin Mares 
1777d6b297d0SMartin Mares #define PCI_VENDOR_ID_INTEL		0x8086
1778d6b297d0SMartin Mares #define PCI_VENDOR_ID_COMPAQ		0x0e11
1779558f736bSSean O. Stalley 
17803d0a6d88SMartin Mares /* I/O resource flags, compatible with <include/linux/ioport.h> */
1781558f736bSSean O. Stalley 
17824520c595SPali Rohár #define PCI_IORESOURCE_TYPE_BITS	0x00001f00
17834520c595SPali Rohár #define PCI_IORESOURCE_IO		0x00000100
17844520c595SPali Rohár #define PCI_IORESOURCE_MEM		0x00000200
17854520c595SPali Rohár #define PCI_IORESOURCE_PREFETCH		0x00002000
17864520c595SPali Rohár #define PCI_IORESOURCE_MEM_64		0x00100000
17874520c595SPali Rohár #define PCI_IORESOURCE_IO_16BIT_ADDR	(1<<0)
17883d0a6d88SMartin Mares #define PCI_IORESOURCE_PCI_EA_BEI	(1<<5)
1789