xref: /titanic_52/usr/src/uts/common/sys/pci.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_PCI_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_PCI_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * PCI Configuration Header offsets
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_VENID		0x0	/* vendor id, 2 bytes */
40*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_DEVID		0x2	/* device id, 2 bytes */
41*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_COMM		0x4	/* command register, 2 bytes */
42*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_STAT		0x6	/* status register, 2 bytes */
43*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_REVID		0x8	/* revision id, 1 byte */
44*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_PROGCLASS	0x9	/* programming class code, 1 byte */
45*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_SUBCLASS	0xA	/* sub-class code, 1 byte */
46*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASCLASS	0xB	/* basic class code, 1 byte */
47*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_CACHE_LINESZ	0xC	/* cache line size, 1 byte */
48*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_LATENCY_TIMER	0xD	/* latency timer, 1 byte */
49*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_HEADER		0xE	/* header type, 1 byte */
50*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BIST		0xF	/* builtin self test, 1 byte */
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * Header type 0 offsets
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASE0		0x10	/* base register 0, 4 bytes */
56*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASE1		0x14	/* base register 1, 4 bytes */
57*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASE2		0x18	/* base register 2, 4 bytes */
58*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASE3		0x1c	/* base register 3, 4 bytes */
59*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASE4		0x20	/* base register 4, 4 bytes */
60*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_BASE5		0x24	/* base register 5, 4 bytes */
61*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_CIS		0x28	/* Cardbus CIS Pointer */
62*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_SUBVENID	0x2c	/* Subsystem Vendor ID */
63*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_SUBSYSID	0x2e	/* Subsystem ID */
64*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_ROM		0x30	/* ROM base register, 4 bytes */
65*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_CAP_PTR	0x34	/* capabilities pointer, 1 byte */
66*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_ILINE		0x3c	/* interrupt line, 1 byte */
67*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_IPIN		0x3d	/* interrupt pin, 1 byte */
68*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_MIN_G		0x3e	/* minimum grant, 1 byte */
69*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_MAX_L		0x3f	/* maximum grant, 1 byte */
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate /*
72*7c478bd9Sstevel@tonic-gate  * PCI to PCI bridge configuration space header format
73*7c478bd9Sstevel@tonic-gate  */
74*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_PRIBUS		0x18	/* primary bus number */
75*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_SECBUS		0x19	/* secondary bus number */
76*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_SUBBUS		0x1a	/* subordinate bus number */
77*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_LATENCY_TIMER	0x1b
78*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_IO_BASE_LOW	0x1c
79*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_IO_LIMIT_LOW	0x1d
80*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_SEC_STATUS	0x1e
81*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_MEM_BASE	0x20
82*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_MEM_LIMIT	0x22
83*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_PF_BASE_LOW	0x24
84*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_PF_LIMIT_LOW	0x26
85*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_PF_BASE_HIGH	0x28
86*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_PF_LIMIT_HIGH	0x2c
87*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_IO_BASE_HI	0x30
88*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_IO_LIMIT_HI	0x32
89*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_CAP_PTR	0x34
90*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_ROM		0x38
91*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_ILINE		0x3c
92*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_IPIN		0x3d
93*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_BCNTRL		0x3e
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_BASE_NUM	0x2
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate /*
98*7c478bd9Sstevel@tonic-gate  * PCI to PCI bridge control register (0x3e) format
99*7c478bd9Sstevel@tonic-gate  */
100*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_BCNTRL_PARITY_ENABLE	0x1
101*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_BCNTRL_SERR_ENABLE	0x2
102*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_BCNTRL_MAST_AB_MODE	0x20
103*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_BCNTRL_DTO_STAT	0x400
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_IO_MASK	0xf0
106*7c478bd9Sstevel@tonic-gate #define	PCI_BCNF_MEM_MASK	0xfff0
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate /*
109*7c478bd9Sstevel@tonic-gate  * Header type 2 (Cardbus) offsets
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_SOCK_REG	0x10	/* Cardbus socket regs, 4 bytes */
112*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_RESERVED1	0x14	/* Reserved, 2 bytes */
113*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_SEC_STATUS	0x16	/* Secondary status, 2 bytes */
114*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_PCI_BUS_NO	0x18	/* PCI bus number, 1 byte */
115*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_CBUS_NO	0x19	/* Cardbus bus number, 1 byte */
116*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_SUB_BUS_NO	0x1a	/* Subordinate bus number, 1 byte */
117*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_LATENCY_TIMER	0x1b	/* Cardbus latency timer, 1 byte */
118*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_MEM_BASE0	0x1c	/* Memory base reg 0, 4 bytes */
119*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_MEM_LIMIT0	0x20	/* Memory limit reg 0, 4 bytes */
120*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_MEM_BASE1	0x24	/* Memory base reg 1, 4 bytes */
121*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_MEM_LIMIT1	0x28	/* Memory limit reg 1, 4 bytes */
122*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_IO_BASE0	0x2c	/* IO base reg 0, 4 bytes */
123*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_IO_LIMIT0	0x30	/* IO limit reg 0, 4 bytes */
124*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_IO_BASE1	0x34	/* IO base reg 1, 4 bytes */
125*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_IO_LIMIT1	0x38	/* IO limit reg 1, 4 bytes */
126*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_ILINE		0x3c	/* interrupt line, 1 byte */
127*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_IPIN		0x3d	/* interrupt pin, 1 byte */
128*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_BRIDGE_CTRL	0x3e	/* Bridge control, 2 bytes */
129*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_BRIDGE_CTRL	0x3e	/* Bridge control, 2 bytes */
130*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_SUBVENID	0x40	/* Subsystem Vendor ID, 2 bytes */
131*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_SUBSYSID	0x42	/* Subsystem ID, 2 bytes */
132*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_LEG_MODE_ADDR	0x44	/* PCCard 16bit IF legacy mode addr */
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #define	PCI_CBUS_BASE_NUM	0x1	/* number of base registers */
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate /*
137*7c478bd9Sstevel@tonic-gate  * PCI command register bits
138*7c478bd9Sstevel@tonic-gate  */
139*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_IO		0x1	/* I/O access enable */
140*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MAE		0x2	/* memory access enable */
141*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_ME		0x4	/* master enable */
142*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SPEC_CYC	0x8
143*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MEMWR_INVAL	0x10
144*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PALETTE_SNOOP	0x20
145*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARITY_DETECT	0x40
146*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_WAIT_CYC_ENAB	0x80
147*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERR_ENABLE	0x100
148*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_BACK2BACK_ENAB	0x200
149*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_INTX_DISABLE	0x400	/* INTx emulation disable */
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate /*
152*7c478bd9Sstevel@tonic-gate  * PCI Interrupt pin value
153*7c478bd9Sstevel@tonic-gate  */
154*7c478bd9Sstevel@tonic-gate #define	PCI_INTA	1
155*7c478bd9Sstevel@tonic-gate #define	PCI_INTB	2
156*7c478bd9Sstevel@tonic-gate #define	PCI_INTC	3
157*7c478bd9Sstevel@tonic-gate #define	PCI_INTD	4
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * PCI status register bits
161*7c478bd9Sstevel@tonic-gate  */
162*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_INTR		0x8	/* Interrupt state */
163*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_CAP		0x10	/* Implements Capabilities */
164*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_66MHZ		0x20	/* 66 MHz capable */
165*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_UDF		0x40	/* UDF supported */
166*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_FBBC		0x80	/* Fast Back-to-Back Capable */
167*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_S_PERROR	0x100	/* Data Parity Reported */
168*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_DEVSELT	0x600	/* Device select timing */
169*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_S_TARG_AB	0x800	/* Signaled Target Abort */
170*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_R_TARG_AB	0x1000	/* Received Target Abort */
171*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_R_MAST_AB	0x2000	/* Received Master Abort */
172*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_S_SYSERR	0x4000	/* Signaled System Error */
173*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_PERROR		0x8000	/* Detected Parity Error */
174*7c478bd9Sstevel@tonic-gate 
175*7c478bd9Sstevel@tonic-gate /*
176*7c478bd9Sstevel@tonic-gate  * DEVSEL timing values
177*7c478bd9Sstevel@tonic-gate  */
178*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_DEVSELT_FAST	0x0000
179*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_DEVSELT_MEDIUM	0x0200
180*7c478bd9Sstevel@tonic-gate #define	PCI_STAT_DEVSELT_SLOW	0x0400
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate /*
183*7c478bd9Sstevel@tonic-gate  * BIST values
184*7c478bd9Sstevel@tonic-gate  */
185*7c478bd9Sstevel@tonic-gate #define	PCI_BIST_SUPPORTED	0x80
186*7c478bd9Sstevel@tonic-gate #define	PCI_BIST_GO		0x40
187*7c478bd9Sstevel@tonic-gate #define	PCI_BIST_RESULT_M	0x0f
188*7c478bd9Sstevel@tonic-gate #define	PCI_BIST_RESULT_OK	0x00
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate /*
191*7c478bd9Sstevel@tonic-gate  * PCI class codes
192*7c478bd9Sstevel@tonic-gate  */
193*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_NONE		0x0	/* class code for pre-2.0 devices */
194*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_MASS		0x1	/* Mass storage Controller class */
195*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_NET		0x2	/* Network Controller class */
196*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_DISPLAY	0x3	/* Display Controller class */
197*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_MM		0x4	/* Multimedia Controller class */
198*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_MEM		0x5	/* Memory Controller class */
199*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_BRIDGE	0x6	/* Bridge Controller class */
200*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_COMM		0x7	/* Communications Controller class */
201*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_PERIPH	0x8	/* Peripheral Controller class */
202*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_INPUT		0x9	/* Input Device class */
203*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_DOCK		0xa	/* Docking Station class */
204*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_PROCESSOR	0xb	/* Processor class */
205*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_SERIALBUS	0xc	/* Serial Bus class */
206*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_WIRELESS	0xd	/* Wireless Controller class */
207*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_INTIO		0xe	/* Intelligent IO Controller class */
208*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_SATELLITE	0xf	/* Satellite Communication class */
209*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_CRYPT		0x10	/* Encrytion/Decryption class */
210*7c478bd9Sstevel@tonic-gate #define	PCI_CLASS_SIGNAL	0x11	/* Signal Processing class */
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate /*
213*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x0 (no new devices should use this code).
214*7c478bd9Sstevel@tonic-gate  */
215*7c478bd9Sstevel@tonic-gate #define	PCI_NONE_NOTVGA		0x0	/* All devices except VGA compatible */
216*7c478bd9Sstevel@tonic-gate #define	PCI_NONE_VGA		0x1	/* VGA compatible */
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate /*
219*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x1 (mass storage controllers)
220*7c478bd9Sstevel@tonic-gate  */
221*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_SCSI		0x0	/* SCSI bus Controller */
222*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_IDE		0x1	/* IDE Controller */
223*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_FD		0x2	/* floppy disk Controller */
224*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_IPI		0x3	/* IPI bus Controller */
225*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_RAID		0x4	/* RAID Controller */
226*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_ATA		0x5	/* ATA Controller */
227*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_SATA		0x6	/* Serial ATA */
228*7c478bd9Sstevel@tonic-gate #define	PCI_MASS_OTHER		0x80	/* Other Mass Storage Controller */
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate /*
231*7c478bd9Sstevel@tonic-gate  * programming interface for IDE (subclass 1)
232*7c478bd9Sstevel@tonic-gate  */
233*7c478bd9Sstevel@tonic-gate #define	PCI_IDE_IF_NATIVE_PRI	0x1	/* primary channel is native */
234*7c478bd9Sstevel@tonic-gate #define	PCI_IDE_IF_PROG_PRI	0x2	/* primary can operate in either mode */
235*7c478bd9Sstevel@tonic-gate #define	PCI_IDE_IF_NATIVE_SEC	0x4	/* secondary channel is native */
236*7c478bd9Sstevel@tonic-gate #define	PCI_IDE_IF_PROG_SEC	0x8	/* sec. can operate in either mode */
237*7c478bd9Sstevel@tonic-gate #define	PCI_IDE_IF_MASK		0xf	/* programming interface mask */
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate /*
241*7c478bd9Sstevel@tonic-gate  * programming interface for ATA (subclass 5)
242*7c478bd9Sstevel@tonic-gate  */
243*7c478bd9Sstevel@tonic-gate #define	PCI_ATA_IF_SINGLE_DMA	0x20	/* ATA controller with single DMA */
244*7c478bd9Sstevel@tonic-gate #define	PCI_ATA_IF_CHAINED_DMA	0x30	/* ATA controller with chained DMA */
245*7c478bd9Sstevel@tonic-gate 
246*7c478bd9Sstevel@tonic-gate /*
247*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x2 (Network controllers)
248*7c478bd9Sstevel@tonic-gate  */
249*7c478bd9Sstevel@tonic-gate #define	PCI_NET_ENET		0x0	/* Ethernet Controller */
250*7c478bd9Sstevel@tonic-gate #define	PCI_NET_TOKEN		0x1	/* Token Ring Controller */
251*7c478bd9Sstevel@tonic-gate #define	PCI_NET_FDDI		0x2	/* FDDI Controller */
252*7c478bd9Sstevel@tonic-gate #define	PCI_NET_ATM		0x3	/* ATM Controller */
253*7c478bd9Sstevel@tonic-gate #define	PCI_NET_ISDN		0x4	/* ISDN Controller */
254*7c478bd9Sstevel@tonic-gate #define	PCI_NET_WFIP		0x5	/* WorldFip Controller */
255*7c478bd9Sstevel@tonic-gate #define	PCI_NET_PICMG		0x6	/* PICMG 2.14 Multi Computing */
256*7c478bd9Sstevel@tonic-gate #define	PCI_NET_OTHER		0x80	/* Other Network Controller */
257*7c478bd9Sstevel@tonic-gate 
258*7c478bd9Sstevel@tonic-gate /*
259*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 03 (display controllers)
260*7c478bd9Sstevel@tonic-gate  */
261*7c478bd9Sstevel@tonic-gate #define	PCI_DISPLAY_VGA		0x0	/* VGA device */
262*7c478bd9Sstevel@tonic-gate #define	PCI_DISPLAY_XGA		0x1	/* XGA device */
263*7c478bd9Sstevel@tonic-gate #define	PCI_DISPLAY_3D		0x2	/* 3D controller */
264*7c478bd9Sstevel@tonic-gate #define	PCI_DISPLAY_OTHER	0x80	/* Other Display Device */
265*7c478bd9Sstevel@tonic-gate 
266*7c478bd9Sstevel@tonic-gate /*
267*7c478bd9Sstevel@tonic-gate  * programming interface for display for display class (subclass 0) VGA ctrlrs
268*7c478bd9Sstevel@tonic-gate  */
269*7c478bd9Sstevel@tonic-gate #define	PCI_DISPLAY_IF_VGA	0x0	/* VGA compatible */
270*7c478bd9Sstevel@tonic-gate #define	PCI_DISPLAY_IF_8514	0x1	/* 8514 compatible */
271*7c478bd9Sstevel@tonic-gate 
272*7c478bd9Sstevel@tonic-gate /*
273*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x4 (multi-media devices)
274*7c478bd9Sstevel@tonic-gate  */
275*7c478bd9Sstevel@tonic-gate #define	PCI_MM_VIDEO		0x0	/* Video device */
276*7c478bd9Sstevel@tonic-gate #define	PCI_MM_AUDIO		0x1	/* Audio device */
277*7c478bd9Sstevel@tonic-gate #define	PCI_MM_TELEPHONY	0x2	/* Computer Telephony device */
278*7c478bd9Sstevel@tonic-gate #define	PCI_MM_OTHER		0x80	/* Other Multimedia Device */
279*7c478bd9Sstevel@tonic-gate 
280*7c478bd9Sstevel@tonic-gate /*
281*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x5 (memory controllers)
282*7c478bd9Sstevel@tonic-gate  */
283*7c478bd9Sstevel@tonic-gate #define	PCI_MEM_RAM		0x0	/* RAM device */
284*7c478bd9Sstevel@tonic-gate #define	PCI_MEM_FLASH		0x1	/* FLASH device */
285*7c478bd9Sstevel@tonic-gate #define	PCI_MEM_OTHER		0x80	/* Other Memory Controller */
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate /*
288*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x6 (Bridge devices)
289*7c478bd9Sstevel@tonic-gate  */
290*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_HOST		0x0	/* Host/PCI Bridge */
291*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_ISA		0x1	/* PCI/ISA Bridge */
292*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_EISA		0x2	/* PCI/EISA Bridge */
293*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_MC		0x3	/* PCI/MC Bridge */
294*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_PCI		0x4	/* PCI/PCI Bridge */
295*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_PCMCIA	0x5	/* PCI/PCMCIA Bridge */
296*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_NUBUS	0x6	/* PCI/NUBUS Bridge */
297*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_CARDBUS	0x7	/* PCI/CARDBUS Bridge */
298*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_RACE		0x8	/* RACE-way Bridge */
299*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_STPCI	0x9	/* Semi-transparent PCI/PCI Bridge */
300*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_IB		0xA	/* InfiniBand/PCI host Bridge */
301*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_OTHER	0x80	/* PCI/Other Bridge Device */
302*7c478bd9Sstevel@tonic-gate 
303*7c478bd9Sstevel@tonic-gate /*
304*7c478bd9Sstevel@tonic-gate  * programming interface for Bridges class 0x6 (subclass 4) PCI-PCI bridge
305*7c478bd9Sstevel@tonic-gate  */
306*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_PCI_IF_PCI2PCI	0x0	/* PCI-PCI bridge */
307*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_PCI_IF_SUBDECODE	0x1	/* Subtractive Decode */
308*7c478bd9Sstevel@tonic-gate 						/* PCI/PCI bridge */
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate /*
311*7c478bd9Sstevel@tonic-gate  * programming interface for Bridges class 0x6 (subclass 08) RACEway bridge
312*7c478bd9Sstevel@tonic-gate  */
313*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_RACE_IF_TRANSPARENT	0x0	/* Transport mode */
314*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_RACE_IF_ENDPOINT	0x1	/* Endpoint mode */
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate /*
317*7c478bd9Sstevel@tonic-gate  * programming interface for Bridges class 0x6 (subclass 09)
318*7c478bd9Sstevel@tonic-gate  * Semi-transparent PCI-to-PCI bridge
319*7c478bd9Sstevel@tonic-gate  */
320*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_STPCI_IF_PRIMARY	0x40	/* primary PCI side bus */
321*7c478bd9Sstevel@tonic-gate 						/* facing system processor */
322*7c478bd9Sstevel@tonic-gate #define	PCI_BRIDGE_STPCI_IF_SECONDARY	0x80	/* secondary PCI side bus */
323*7c478bd9Sstevel@tonic-gate 						/* facing system processor */
324*7c478bd9Sstevel@tonic-gate 
325*7c478bd9Sstevel@tonic-gate /*
326*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x7 (communication devices)
327*7c478bd9Sstevel@tonic-gate  */
328*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_GENERIC_XT	0x0	/* XT Compatible Serial Controller */
329*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARALLEL	0x1	/* Parallel Port Controller */
330*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MSC		0x2	/* Multiport Serial Controller */
331*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MODEM		0x3	/* Modem Controller */
332*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_GPIB		0x4	/* GPIB Controller */
333*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SMARTCARD	0x5	/* Smart Card Controller */
334*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_OTHER		0x80	/* Other Communications Controller */
335*7c478bd9Sstevel@tonic-gate 
336*7c478bd9Sstevel@tonic-gate /*
337*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x7 / subclass 0x0 (Serial)
338*7c478bd9Sstevel@tonic-gate  */
339*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_GENERIC	0x0	/* Generic XT-compat serial */
340*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_16450	0x1	/* 16450-compat serial ctrlr */
341*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_16550	0x2	/* 16550-compat serial ctrlr */
342*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_16650	0x3	/* 16650-compat serial ctrlr */
343*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_16750	0x4	/* 16750-compat serial ctrlr */
344*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_16850	0x5	/* 16850-compat serial ctrlr */
345*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_SERIAL_IF_16950	0x6	/* 16950-compat serial ctrlr */
346*7c478bd9Sstevel@tonic-gate 
347*7c478bd9Sstevel@tonic-gate /*
348*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x7 / subclass 0x1 (Parallel)
349*7c478bd9Sstevel@tonic-gate  */
350*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARALLEL_IF_GENERIC	0x0	/* Generic Parallel port */
351*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARALLEL_IF_BIDIRECT	0x1	/* Bi-directional Parallel */
352*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARALLEL_IF_ECP	0x2	/* ECP 1.X Parallel port */
353*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARALLEL_IF_1284	0x3	/* IEEE 1284 Parallel port */
354*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_PARALLEL_IF_1284_TARG	0xFE	/* IEEE 1284 target device */
355*7c478bd9Sstevel@tonic-gate 
356*7c478bd9Sstevel@tonic-gate /*
357*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x7 / subclass 0x3 (Modem)
358*7c478bd9Sstevel@tonic-gate  */
359*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MODEM_IF_GENERIC	0x0	/* Generic Modem */
360*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MODEM_IF_HAYES_16450	0x1	/* Hayes 16450-compat Modem */
361*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MODEM_IF_HAYES_16550	0x2	/* Hayes 16550-compat Modem */
362*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MODEM_IF_HAYES_16650	0x3	/* Hayes 16650-compat Modem */
363*7c478bd9Sstevel@tonic-gate #define	PCI_COMM_MODEM_IF_HAYES_16750	0x4	/* Hayes 16750-compat Modem */
364*7c478bd9Sstevel@tonic-gate 
365*7c478bd9Sstevel@tonic-gate /*
366*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x8
367*7c478bd9Sstevel@tonic-gate  */
368*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_PIC		0x0	/* Generic PIC */
369*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_DMA		0x1	/* Generic DMA Controller */
370*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_TIMER	0x2	/* Generic System Timer Controller */
371*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_RTC		0x3	/* Generic RTC Controller */
372*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_HPC		0x3	/* Generic PCI Hot-Plug Controller */
373*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_OTHER	0x80	/* Other System Peripheral */
374*7c478bd9Sstevel@tonic-gate 
375*7c478bd9Sstevel@tonic-gate /*
376*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x8 / subclass 0x0 (interrupt controller)
377*7c478bd9Sstevel@tonic-gate  */
378*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_PIC_IF_GENERIC	0x0	/* Generic 8259 APIC */
379*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_PIC_IF_ISA		0x1	/* ISA PIC */
380*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_PIC_IF_EISA		0x2	/* EISA PIC */
381*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_PIC_IF_IO_APIC	0x10	/* I/O APIC interrupt ctrlr */
382*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_PIC_IF_IOX_APIC	0x20	/* I/O(x) APIC intr ctrlr */
383*7c478bd9Sstevel@tonic-gate 
384*7c478bd9Sstevel@tonic-gate /*
385*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x8 / subclass 0x1 (DMA controller)
386*7c478bd9Sstevel@tonic-gate  */
387*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_DMA_IF_GENERIC	0x0	/* Generic 8237 DMA ctrlr */
388*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_DMA_IF_ISA		0x1	/* ISA DMA ctrlr */
389*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_DMA_IF_EISA		0x2	/* EISA DMA ctrlr */
390*7c478bd9Sstevel@tonic-gate 
391*7c478bd9Sstevel@tonic-gate /*
392*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x8 / subclass 0x2 (timer)
393*7c478bd9Sstevel@tonic-gate  */
394*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_TIMER_IF_GENERIC	0x0	/* Generic 8254 system timer */
395*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_TIMER_IF_ISA		0x1	/* ISA system timers */
396*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_TIMER_IF_EISA	0x2	/* EISA system timers (two) */
397*7c478bd9Sstevel@tonic-gate 
398*7c478bd9Sstevel@tonic-gate /*
399*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x8 / subclass 0x3 (realtime clock)
400*7c478bd9Sstevel@tonic-gate  */
401*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_RTC_IF_GENERIC	0x0	/* Generic RTC controller */
402*7c478bd9Sstevel@tonic-gate #define	PCI_PERIPH_RTC_IF_ISA		0x1	/* ISA RTC controller */
403*7c478bd9Sstevel@tonic-gate 
404*7c478bd9Sstevel@tonic-gate /*
405*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x9
406*7c478bd9Sstevel@tonic-gate  */
407*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_KEYBOARD	0x0	/* Keyboard Controller */
408*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_DIGITIZ	0x1	/* Digitizer (Pen) */
409*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_MOUSE		0x2	/* Mouse Controller */
410*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_SCANNER	0x3	/* Scanner Controller */
411*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_GAMEPORT	0x4	/* Gameport Controller */
412*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_OTHER		0x80	/* Other Input Controller */
413*7c478bd9Sstevel@tonic-gate 
414*7c478bd9Sstevel@tonic-gate /*
415*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0x9 / subclass 0x4 (Gameport controller)
416*7c478bd9Sstevel@tonic-gate  */
417*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_GAMEPORT_IF_GENERIC	0x00	/* Generic controller */
418*7c478bd9Sstevel@tonic-gate #define	PCI_INPUT_GAMEPORT_IF_LEGACY	0x10	/* Legacy controller */
419*7c478bd9Sstevel@tonic-gate 
420*7c478bd9Sstevel@tonic-gate /*
421*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0xa
422*7c478bd9Sstevel@tonic-gate  */
423*7c478bd9Sstevel@tonic-gate #define	PCI_DOCK_GENERIC	0x00	/* Generic Docking Station */
424*7c478bd9Sstevel@tonic-gate #define	PCI_DOCK_OTHER		0x80	/* Other Type of Docking Station */
425*7c478bd9Sstevel@tonic-gate 
426*7c478bd9Sstevel@tonic-gate /*
427*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0xb
428*7c478bd9Sstevel@tonic-gate  */
429*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_386	0x0	/* 386 */
430*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_486	0x1	/* 486 */
431*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_PENT	0x2	/* Pentium */
432*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_ALPHA	0x10	/* Alpha */
433*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_POWERPC	0x20	/* PowerPC */
434*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_MIPS	0x30	/* MIPS */
435*7c478bd9Sstevel@tonic-gate #define	PCI_PROCESSOR_COPROC	0x40	/* Co-processor */
436*7c478bd9Sstevel@tonic-gate 
437*7c478bd9Sstevel@tonic-gate /*
438*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0xc (Serial Controllers)
439*7c478bd9Sstevel@tonic-gate  */
440*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_FIRE		0x0	/* FireWire (IEEE 1394) */
441*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_ACCESS	0x1	/* ACCESS.bus */
442*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_SSA		0x2	/* SSA */
443*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_USB		0x3	/* Universal Serial Bus */
444*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_FIBRE	0x4	/* Fibre Channel */
445*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_SMBUS	0x5	/* System Management Bus */
446*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_IB		0x6	/* InfiniBand */
447*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_IPMI		0x7	/* IPMI */
448*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_SERCOS	0x8	/* SERCOS Interface Std (IEC 61491) */
449*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_CANBUS	0x9	/* CANbus */
450*7c478bd9Sstevel@tonic-gate 
451*7c478bd9Sstevel@tonic-gate /*
452*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0xC / subclass 0x3 (USB controller)
453*7c478bd9Sstevel@tonic-gate  */
454*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_USB_IF_UHCI 		0x00	/* UHCI Compliant */
455*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_USB_IF_OHCI 		0x10	/* OHCI Compliant */
456*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_USB_IF_EHCI 		0x20	/* EHCI Compliant */
457*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_USB_IF_GENERIC 	0x80	/* no specific HCD */
458*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_USB_IF_DEVICE 	0xFE	/* not a HCD */
459*7c478bd9Sstevel@tonic-gate 
460*7c478bd9Sstevel@tonic-gate /*
461*7c478bd9Sstevel@tonic-gate  * Programming interfaces for class 0xC / subclass 0x7 (IPMI controller)
462*7c478bd9Sstevel@tonic-gate  */
463*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_IPMI_IF_SMIC 	0x0	/* SMIC Interface */
464*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_IPMI_IF_KBD 		0x1	/* Keyboard Ctrl Style Intfc */
465*7c478bd9Sstevel@tonic-gate #define	PCI_SERIAL_IPMI_IF_BTI		0x2	/* Block Transfer Interface */
466*7c478bd9Sstevel@tonic-gate 
467*7c478bd9Sstevel@tonic-gate /*
468*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0xd (Wireless controllers)
469*7c478bd9Sstevel@tonic-gate  */
470*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_IRDA		0x0	/* iRDA Compatible Controller */
471*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_IR			0x1	/* Consumer IR Controller */
472*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_RF			0x10	/* RF Controller */
473*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_BLUETOOTH		0x11	/* Bluetooth Controller */
474*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_BROADBAND		0x12	/* Broadband Controller */
475*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_80211A		0x20	/* Ethernet 802.11a 5 GHz */
476*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_80211B		0x21	/* Ethernet 802.11b 2.4 GHz */
477*7c478bd9Sstevel@tonic-gate #define	PCI_WIRELESS_OTHER		0x80	/* Other Wireless Controllers */
478*7c478bd9Sstevel@tonic-gate 
479*7c478bd9Sstevel@tonic-gate /*
480*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0xe (Intelligent I/O controllers)
481*7c478bd9Sstevel@tonic-gate  */
482*7c478bd9Sstevel@tonic-gate #define	PCI_INTIO_I20			0x1	/* I20 Arch Spec 1.0 */
483*7c478bd9Sstevel@tonic-gate 
484*7c478bd9Sstevel@tonic-gate /*
485*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0xf (Satellite Communication controllers)
486*7c478bd9Sstevel@tonic-gate  */
487*7c478bd9Sstevel@tonic-gate #define	PCI_SATELLITE_COMM_TV		0x01	/* TV */
488*7c478bd9Sstevel@tonic-gate #define	PCI_SATELLITE_COMM_AUDIO	0x02	/* Audio */
489*7c478bd9Sstevel@tonic-gate #define	PCI_SATELLITE_COMM_VOICE	0x03	/* Voice */
490*7c478bd9Sstevel@tonic-gate #define	PCI_SATELLITE_COMM_DATA		0x04	/* DATA */
491*7c478bd9Sstevel@tonic-gate 
492*7c478bd9Sstevel@tonic-gate /*
493*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x10 (Encryption/Decryption controllers)
494*7c478bd9Sstevel@tonic-gate  */
495*7c478bd9Sstevel@tonic-gate #define	PCI_CRYPT_NETWORK		0x00	/* Network and Computing */
496*7c478bd9Sstevel@tonic-gate #define	PCI_CRYPT_ENTERTAINMENT		0x10	/* Entertainment en/decrypt */
497*7c478bd9Sstevel@tonic-gate #define	PCI_CRYPT_OTHER			0x80	/* Other en/decryption ctrlrs */
498*7c478bd9Sstevel@tonic-gate 
499*7c478bd9Sstevel@tonic-gate /*
500*7c478bd9Sstevel@tonic-gate  * PCI Sub-class codes - base class 0x11 (Signal Processing controllers)
501*7c478bd9Sstevel@tonic-gate  */
502*7c478bd9Sstevel@tonic-gate #define	PCI_SIGNAL_DPIO			0x00	/* DPIO modules */
503*7c478bd9Sstevel@tonic-gate #define	PCI_SIGNAL_PERF_COUNTERS	0x01	/* Performance counters */
504*7c478bd9Sstevel@tonic-gate #define	PCI_SIGNAL_COMM_SYNC		0x10	/* Comm. synchronization plus */
505*7c478bd9Sstevel@tonic-gate 						/* time and freq test ctrlr */
506*7c478bd9Sstevel@tonic-gate #define	PCI_SIGNAL_MANAGEMENT		0x20	/* Management card */
507*7c478bd9Sstevel@tonic-gate #define	PCI_SIGNAL_OTHER		0x80	/* DSP/DAP controller */
508*7c478bd9Sstevel@tonic-gate 
509*7c478bd9Sstevel@tonic-gate /* PCI header decode */
510*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_MULTI	0x80	/* multi-function device */
511*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_ZERO		0x00	/* type zero PCI header */
512*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_ONE		0x01	/* type one PCI header */
513*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_TWO		0x02	/* type two PCI header */
514*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_PPB		PCI_HEADER_ONE  /* type one PCI to PCI Bridge */
515*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_CARDBUS	PCI_HEADER_TWO	/* type one PCI header */
516*7c478bd9Sstevel@tonic-gate 
517*7c478bd9Sstevel@tonic-gate #define	PCI_HEADER_TYPE_M	0x7f  /* type mask for header */
518*7c478bd9Sstevel@tonic-gate 
519*7c478bd9Sstevel@tonic-gate /*
520*7c478bd9Sstevel@tonic-gate  * Base register bit definitions.
521*7c478bd9Sstevel@tonic-gate  */
522*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_SPACE_M    0x1  /* memory space indicator */
523*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_SPACE_IO   0x1   /* IO space */
524*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_SPACE_MEM  0x0   /* memory space */
525*7c478bd9Sstevel@tonic-gate 
526*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_TYPE_MEM   0x0   /* 32-bit memory address */
527*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_TYPE_LOW   0x2   /* less than 1Mb address */
528*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_TYPE_ALL   0x4   /* 64-bit memory address */
529*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_TYPE_RES   0x6   /* reserved */
530*7c478bd9Sstevel@tonic-gate 
531*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_TYPE_M		0x00000006  /* type indicator mask */
532*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_PREF_M		0x00000008  /* prefetch mask */
533*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_M_ADDR_M	0xfffffff0  /* memory address mask */
534*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_IO_ADDR_M	0xfffffffe  /* I/O address mask */
535*7c478bd9Sstevel@tonic-gate 
536*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_ROM_ADDR_M	0xfffff800  /* ROM address mask */
537*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_ROM_ENABLE	0x00000001  /* ROM decoder enable */
538*7c478bd9Sstevel@tonic-gate 
539*7c478bd9Sstevel@tonic-gate /*
540*7c478bd9Sstevel@tonic-gate  * Capabilities linked list entry offsets
541*7c478bd9Sstevel@tonic-gate  */
542*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID		0x0	/* capability identifier, 1 byte */
543*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_NEXT_PTR	0x1	/* next entry pointer, 1 byte */
544*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_MAX_PTR		0x30	/* maximum number of cap pointers */
545*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_PTR_OFF		0x40	/* minimum cap pointer offset */
546*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_PTR_MASK	0xFC	/* mask for capability pointer */
547*7c478bd9Sstevel@tonic-gate 
548*7c478bd9Sstevel@tonic-gate /*
549*7c478bd9Sstevel@tonic-gate  * Capability identifier values
550*7c478bd9Sstevel@tonic-gate  */
551*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_PM		0x1	/* power management entry */
552*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_AGP		0x2	/* AGP supported */
553*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_VPD		0x3	/* VPD supported */
554*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_SLOT_ID	0x4	/* Slot Identification supported */
555*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_MSI		0x5	/* MSI supported */
556*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_cPCI_HS	0x6	/* CompactPCI Host Swap supported */
557*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_PCIX		0x7	/* PCI-X supported */
558*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_HT		0x8	/* HyperTransport supported */
559*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_VS		0x9	/* Vendor Specific */
560*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_DEBUG_PORT	0xA	/* Debug Port supported */
561*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_cPCI_CRC	0xB	/* CompactPCI central resource ctrl */
562*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_PCI_HOTPLUG	0xC	/* PCI Hot Plug supported */
563*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_AGP_8X	0xE	/* AGP 8X supported */
564*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_SECURE_DEV	0xF	/* Secure Device supported */
565*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_PCI_E	0x10	/* PCI Express supported */
566*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_ID_MSI_X	0x11	/* MSI-X supported */
567*7c478bd9Sstevel@tonic-gate 
568*7c478bd9Sstevel@tonic-gate /*
569*7c478bd9Sstevel@tonic-gate  * Capability next entry pointer values
570*7c478bd9Sstevel@tonic-gate  */
571*7c478bd9Sstevel@tonic-gate #define	PCI_CAP_NEXT_PTR_NULL	0x0	/* no more entries in the list */
572*7c478bd9Sstevel@tonic-gate 
573*7c478bd9Sstevel@tonic-gate /*
574*7c478bd9Sstevel@tonic-gate  * PCI power management (PM) capability entry offsets
575*7c478bd9Sstevel@tonic-gate  */
576*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP		0x2	/* PM capabilities, 2 bytes */
577*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR		0x4	/* PM control/status reg, 2 bytes */
578*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_BSE		0x6	/* PCI-PCI bridge extensions, 1 byte */
579*7c478bd9Sstevel@tonic-gate #define	PCI_PMDATA		0x7	/* PM data, 1 byte */
580*7c478bd9Sstevel@tonic-gate 
581*7c478bd9Sstevel@tonic-gate /*
582*7c478bd9Sstevel@tonic-gate  * PM capabilities values - 2 bytes
583*7c478bd9Sstevel@tonic-gate  */
584*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_VER_1_0	0x1	/* PCI PM spec 1.0 */
585*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_VER_1_1	0x2	/* PCI PM spec 1.1 */
586*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_VER_MASK	0x7	/* version mask */
587*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_PME_CLOCK	0x8	/* needs PCI clock for PME */
588*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_DSI		0x20	/* needs device specific init */
589*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_SELF	0x0	/* 0 aux current - self powered */
590*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_55mA	0x40	/* 55 mA aux current */
591*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_100mA	0x80	/* 100 mA aux current */
592*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_160mA	0xc0	/* 160 mA aux current */
593*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_220mA	0x100	/* 220 mA aux current */
594*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_270mA	0x140	/* 270 mA aux current */
595*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_320mA	0x180	/* 320 mA aux current */
596*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_375mA	0x1c0	/* 375 mA aux current */
597*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_AUX_CUR_MASK	0x1c0	/* 3.3Vaux aux current needs */
598*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D1		0x200	/* D1 state supported */
599*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D2		0x400	/* D2 state supported */
600*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D0_PME	0x800	/* PME from D0 */
601*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D1_PME	0x1000	/* PME from D1 */
602*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D2_PME	0x2000	/* PME from D2 */
603*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D3HOT_PME	0x4000	/* PME from D3hot */
604*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_D3COLD_PME	0x8000	/* PME from D3cold */
605*7c478bd9Sstevel@tonic-gate #define	PCI_PMCAP_PME_MASK	0xf800	/* PME support mask */
606*7c478bd9Sstevel@tonic-gate 
607*7c478bd9Sstevel@tonic-gate /*
608*7c478bd9Sstevel@tonic-gate  * PM control/status values - 2 bytes
609*7c478bd9Sstevel@tonic-gate  */
610*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_D0			0x0	/* power state D0 */
611*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_D1			0x1	/* power state D1 */
612*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_D2			0x2	/* power state D2 */
613*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_D3HOT			0x3	/* power state D3hot */
614*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_STATE_MASK		0x3	/* power state mask */
615*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_PME_EN		0x100	/* enable PME assertion */
616*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D0_PWR_C		0x0	/* D0 power consumed */
617*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D1_PWR_C		0x200	/* D1 power consumed */
618*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D2_PWR_C		0x400	/* D2 power consumed */
619*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D3_PWR_C		0x600	/* D3 power consumed */
620*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D0_PWR_D		0x800	/* D0 power dissipated */
621*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D1_PWR_D		0xa00	/* D1 power dissipated */
622*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D2_PWR_D		0xc00	/* D2 power dissipated */
623*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_D3_PWR_D		0xe00	/* D3 power dissipated */
624*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_COM_C		0x1000	/* common power consumption */
625*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSEL_MASK		0x1e00	/* data select mask */
626*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSCL_UNKNOWN		0x0	/* data scale unknown */
627*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSCL_1_BY_10		0x2000	/* data scale 0.1x */
628*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSCL_1_BY_100		0x4000	/* data scale 0.01x */
629*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSCL_1_BY_1000	0x6000	/* data scale 0.001x */
630*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_DSCL_MASK		0x6000	/* data scale mask */
631*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_PME_STAT		0x8000	/* PME status */
632*7c478bd9Sstevel@tonic-gate 
633*7c478bd9Sstevel@tonic-gate /*
634*7c478bd9Sstevel@tonic-gate  * PM PMCSR PCI to PCI bridge support extension values - 1 byte
635*7c478bd9Sstevel@tonic-gate  */
636*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_BSE_B2_B3	0x40	/* bridge D3hot -> secondary B2 */
637*7c478bd9Sstevel@tonic-gate #define	PCI_PMCSR_BSE_BPCC_EN	0x80	/* bus power/clock control enabled */
638*7c478bd9Sstevel@tonic-gate 
639*7c478bd9Sstevel@tonic-gate /*
640*7c478bd9Sstevel@tonic-gate  * PCI-X capability related definitions
641*7c478bd9Sstevel@tonic-gate  */
642*7c478bd9Sstevel@tonic-gate #define	PCI_PCIX_COMMAND	0x2	/* Command register offset */
643*7c478bd9Sstevel@tonic-gate 
644*7c478bd9Sstevel@tonic-gate #define	PCI_PCIX_VER_MASK	0x3000	/* Bits 12 and 13 */
645*7c478bd9Sstevel@tonic-gate #define	PCI_PCIX_VER_0		0x0000	/* PCIX cap list item version 0 */
646*7c478bd9Sstevel@tonic-gate #define	PCI_PCIX_VER_1		0x1000	/* PCIX cap list item version 1 */
647*7c478bd9Sstevel@tonic-gate #define	PCI_PCIX_VER_2		0x2000	/* PCIX cap list item version 2 */
648*7c478bd9Sstevel@tonic-gate 
649*7c478bd9Sstevel@tonic-gate /*
650*7c478bd9Sstevel@tonic-gate  * PCI Message Signalled Interrupts (MSI) capability entry offsets for 32-bit
651*7c478bd9Sstevel@tonic-gate  */
652*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_CTRL		0x02	/* MSI control register, 2 bytes */
653*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_ADDR_OFFSET	0x04	/* MSI 32-bit msg address, 4 bytes */
654*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_32BIT_DATA	0x08	/* MSI 32-bit msg data, 2 bytes */
655*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_32BIT_MASK	0x0C	/* MSI 32-bit mask bits, 4 bytes */
656*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_32BIT_PENDING	0x10	/* MSI 32-bit pending bits, 4 bytes */
657*7c478bd9Sstevel@tonic-gate 
658*7c478bd9Sstevel@tonic-gate /*
659*7c478bd9Sstevel@tonic-gate  * PCI Message Signalled Interrupts (MSI) capability entry offsets for 64-bit
660*7c478bd9Sstevel@tonic-gate  */
661*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_64BIT_DATA	0x0C	/* MSI 64-bit msg data, 2 bytes */
662*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_64BIT_MASKBITS	0x10	/* MSI 64-bit mask bits, 4 bytes */
663*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_64BIT_PENDING	0x14	/* MSI 64-bit pending bits, 4 bytes */
664*7c478bd9Sstevel@tonic-gate 
665*7c478bd9Sstevel@tonic-gate /*
666*7c478bd9Sstevel@tonic-gate  * PCI Message Signalled Interrupts (MSI) capability masks and shifts
667*7c478bd9Sstevel@tonic-gate  */
668*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_ENABLE_BIT	0x0001	/* MSI enable mask in MSI ctrl reg */
669*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_MMC_MASK	0x000E	/* MMC mask in MSI ctrl reg */
670*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_MMC_SHIFT	0x1	/* Shift for MMC bits */
671*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_MME_MASK	0x0070	/* MME mask in MSI ctrl reg */
672*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_MME_SHIFT	0x4	/* Shift for MME bits */
673*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_64BIT_MASK	0x0080	/* 64bit support mask in MSI ctrl reg */
674*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_PVM_MASK	0x0100	/* PVM support mask in MSI ctrl reg */
675*7c478bd9Sstevel@tonic-gate 
676*7c478bd9Sstevel@tonic-gate /*
677*7c478bd9Sstevel@tonic-gate  * PCI Extended Message Signalled Interrupts (MSI-X) capability entry offsets
678*7c478bd9Sstevel@tonic-gate  */
679*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_CTRL		0x02	/* MSI-X control register, 2 bytes */
680*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_TBL_OFFSET	0x04	/* MSI-X table offset, 4 bytes */
681*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_TBL_BIR_MASK	0x0003	/* MSI-X table BIR mask */
682*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_PBA_OFFSET	0x0C	/* MSI-X pending bit array, 4 bytes */
683*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_PBA_BIR_MASK	0x0003	/* MSI-X PBA BIR mask */
684*7c478bd9Sstevel@tonic-gate 
685*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_TBL_SIZE_MASK	0x07FF	/* table size mask in MSI-X ctrl reg */
686*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_FUNCTION_MASK	0x4000	/* function mask in MSI-X ctrl reg */
687*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_ENABLE_BIT	0x8000	/* MSI-X enable mask in MSI-X ctl reg */
688*7c478bd9Sstevel@tonic-gate 
689*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_LOWER_ADDR_OFFSET	0	/* MSI-X lower addr offset */
690*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_UPPER_ADDR_OFFSET	4	/* MSI-X upper addr offset */
691*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_DATA_OFFSET		8	/* MSI-X data offset */
692*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_VECTOR_CTRL_OFFSET	12	/* MSI-X vector ctrl offset */
693*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_VECTOR_SIZE		16	/* MSI-X size of each vector */
694*7c478bd9Sstevel@tonic-gate 
695*7c478bd9Sstevel@tonic-gate /*
696*7c478bd9Sstevel@tonic-gate  * PCI Message Signalled Interrupts: other interesting constants
697*7c478bd9Sstevel@tonic-gate  */
698*7c478bd9Sstevel@tonic-gate #define	PCI_MSI_MAX_INTRS	32	/* maximum MSI interrupts supported */
699*7c478bd9Sstevel@tonic-gate #define	PCI_MSIX_MAX_INTRS	2048	/* maximum MSI-X interrupts supported */
700*7c478bd9Sstevel@tonic-gate 
701*7c478bd9Sstevel@tonic-gate /*
702*7c478bd9Sstevel@tonic-gate  * other interesting PCI constants
703*7c478bd9Sstevel@tonic-gate  */
704*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_NUM	6	/* num of base regs in configuration header */
705*7c478bd9Sstevel@tonic-gate #define	PCI_BAR_SZ_32	4	/* size of 32 bit base addr reg in bytes */
706*7c478bd9Sstevel@tonic-gate #define	PCI_BAR_SZ_64	8	/* size of 64 bit base addr reg in bytes */
707*7c478bd9Sstevel@tonic-gate #define	PCI_BASE_SIZE	4	/* size of base reg in bytes */
708*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_HDR_SIZE	256	/* configuration header size */
709*7c478bd9Sstevel@tonic-gate #define	PCI_CLK_33MHZ	(33 * 1000 * 1000)	/* 33MHz clock speed */
710*7c478bd9Sstevel@tonic-gate #define	PCI_CLK_66MHZ	(66 * 1000 * 1000)	/* 66MHz clock speed */
711*7c478bd9Sstevel@tonic-gate #define	PCI_CLK_133MHZ	(133 * 1000 * 1000)	/* 133MHz clock speed */
712*7c478bd9Sstevel@tonic-gate 
713*7c478bd9Sstevel@tonic-gate /*
714*7c478bd9Sstevel@tonic-gate  * PCI-Express definitions
715*7c478bd9Sstevel@tonic-gate  */
716*7c478bd9Sstevel@tonic-gate #define	PCIE_CONF_HDR_SIZE	4096	/* PCI-Ex config header size */
717*7c478bd9Sstevel@tonic-gate 
718*7c478bd9Sstevel@tonic-gate /*
719*7c478bd9Sstevel@tonic-gate  * This structure represents one entry of the 1275 "reg" property and
720*7c478bd9Sstevel@tonic-gate  * "assigned-addresses" property for a PCI node.  For the "reg" property, it
721*7c478bd9Sstevel@tonic-gate  * may be one of an arbitrary length array for devices with multiple address
722*7c478bd9Sstevel@tonic-gate  * windows.  For the "assigned-addresses" property, it denotes an assigned
723*7c478bd9Sstevel@tonic-gate  * physical address on the PCI bus.  It may be one entry of the six entries
724*7c478bd9Sstevel@tonic-gate  * for devices with multiple base registers.
725*7c478bd9Sstevel@tonic-gate  *
726*7c478bd9Sstevel@tonic-gate  * The physical address format is:
727*7c478bd9Sstevel@tonic-gate  *
728*7c478bd9Sstevel@tonic-gate  *             Bit#:  33222222 22221111 11111100 00000000
729*7c478bd9Sstevel@tonic-gate  *                    10987654 32109876 54321098 76543210
730*7c478bd9Sstevel@tonic-gate  *
731*7c478bd9Sstevel@tonic-gate  * pci_phys_hi cell:  np0000tt bbbbbbbb dddddfff rrrrrrrr
732*7c478bd9Sstevel@tonic-gate  * pci_phys_mid cell: hhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh
733*7c478bd9Sstevel@tonic-gate  * pci_phys_low cell: llllllll llllllll llllllll llllllll
734*7c478bd9Sstevel@tonic-gate  *
735*7c478bd9Sstevel@tonic-gate  * n          is 0 if the address is relocatable, 1 otherwise
736*7c478bd9Sstevel@tonic-gate  * p          is 1 if the addressable region is "prefetchable", 0 otherwise
737*7c478bd9Sstevel@tonic-gate  * t          is 1 if the address range is aliased
738*7c478bd9Sstevel@tonic-gate  * tt         is the type code, denoting which address space
739*7c478bd9Sstevel@tonic-gate  * bbbbbbbb   is the 8-bit bus number
740*7c478bd9Sstevel@tonic-gate  * ddddd      is the 5-bit device number
741*7c478bd9Sstevel@tonic-gate  * fff        is the 3-bit function number
742*7c478bd9Sstevel@tonic-gate  * rrrrrrrr   is the 8-bit register number
743*7c478bd9Sstevel@tonic-gate  * hh...hhh   is the 32-bit unsigned number
744*7c478bd9Sstevel@tonic-gate  * ll...lll   is the 32-bit unsigned number
745*7c478bd9Sstevel@tonic-gate  *
746*7c478bd9Sstevel@tonic-gate  * The physical size format is:
747*7c478bd9Sstevel@tonic-gate  *
748*7c478bd9Sstevel@tonic-gate  * pci_size_hi cell:  hhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh
749*7c478bd9Sstevel@tonic-gate  * pci_size_low cell: llllllll llllllll llllllll llllllll
750*7c478bd9Sstevel@tonic-gate  *
751*7c478bd9Sstevel@tonic-gate  * hh...hhh   is the 32-bit unsigned number
752*7c478bd9Sstevel@tonic-gate  * ll...lll   is the 32-bit unsigned number
753*7c478bd9Sstevel@tonic-gate  */
754*7c478bd9Sstevel@tonic-gate struct pci_phys_spec {
755*7c478bd9Sstevel@tonic-gate 	uint_t pci_phys_hi;		/* child's address, hi word */
756*7c478bd9Sstevel@tonic-gate 	uint_t pci_phys_mid;		/* child's address, middle word */
757*7c478bd9Sstevel@tonic-gate 	uint_t pci_phys_low;		/* child's address, low word */
758*7c478bd9Sstevel@tonic-gate 	uint_t pci_size_hi;		/* high word of size field */
759*7c478bd9Sstevel@tonic-gate 	uint_t pci_size_low;		/* low word of size field */
760*7c478bd9Sstevel@tonic-gate };
761*7c478bd9Sstevel@tonic-gate 
762*7c478bd9Sstevel@tonic-gate typedef struct pci_phys_spec pci_regspec_t;
763*7c478bd9Sstevel@tonic-gate 
764*7c478bd9Sstevel@tonic-gate /*
765*7c478bd9Sstevel@tonic-gate  * PCI masks for pci_phy_hi of PCI 1275 address cell.
766*7c478bd9Sstevel@tonic-gate  */
767*7c478bd9Sstevel@tonic-gate #define	PCI_REG_REG_M		0xff		/* register mask */
768*7c478bd9Sstevel@tonic-gate #define	PCI_REG_FUNC_M		0x700		/* function mask */
769*7c478bd9Sstevel@tonic-gate #define	PCI_REG_DEV_M		0xf800		/* device mask */
770*7c478bd9Sstevel@tonic-gate #define	PCI_REG_BUS_M		0xff0000	/* bus number mask */
771*7c478bd9Sstevel@tonic-gate #define	PCI_REG_ADDR_M		0x3000000	/* address space mask */
772*7c478bd9Sstevel@tonic-gate #define	PCI_REG_ALIAS_M		0x20000000	/* aliased bit mask */
773*7c478bd9Sstevel@tonic-gate #define	PCI_REG_PF_M		0x40000000	/* prefetch bit mask */
774*7c478bd9Sstevel@tonic-gate #define	PCI_REG_REL_M		0x80000000	/* relocation bit mask */
775*7c478bd9Sstevel@tonic-gate #define	PCI_REG_BDFR_M		0xffffff	/* bus, dev, func, reg mask */
776*7c478bd9Sstevel@tonic-gate 
777*7c478bd9Sstevel@tonic-gate #define	PCI_REG_FUNC_SHIFT	8		/* Offset of function bits */
778*7c478bd9Sstevel@tonic-gate #define	PCI_REG_DEV_SHIFT	11		/* Offset of device bits */
779*7c478bd9Sstevel@tonic-gate #define	PCI_REG_BUS_SHIFT	16		/* Offset of bus bits */
780*7c478bd9Sstevel@tonic-gate #define	PCI_REG_ADDR_SHIFT	24		/* Offset of address bits */
781*7c478bd9Sstevel@tonic-gate 
782*7c478bd9Sstevel@tonic-gate #define	PCI_REG_REG_G(x)	((x) & PCI_REG_REG_M)
783*7c478bd9Sstevel@tonic-gate #define	PCI_REG_FUNC_G(x)	(((x) & PCI_REG_FUNC_M) >> PCI_REG_FUNC_SHIFT)
784*7c478bd9Sstevel@tonic-gate #define	PCI_REG_DEV_G(x)	(((x) & PCI_REG_DEV_M) >> PCI_REG_DEV_SHIFT)
785*7c478bd9Sstevel@tonic-gate #define	PCI_REG_BUS_G(x)	(((x) & PCI_REG_BUS_M) >> PCI_REG_BUS_SHIFT)
786*7c478bd9Sstevel@tonic-gate #define	PCI_REG_ADDR_G(x)	(((x) & PCI_REG_ADDR_M) >> PCI_REG_ADDR_SHIFT)
787*7c478bd9Sstevel@tonic-gate #define	PCI_REG_BDFR_G(x)	((x) & PCI_REG_BDFR_M)
788*7c478bd9Sstevel@tonic-gate 
789*7c478bd9Sstevel@tonic-gate /*
790*7c478bd9Sstevel@tonic-gate  * PCI bit encodings of pci_phys_hi of PCI 1275 address cell.
791*7c478bd9Sstevel@tonic-gate  */
792*7c478bd9Sstevel@tonic-gate #define	PCI_ADDR_MASK		PCI_REG_ADDR_M
793*7c478bd9Sstevel@tonic-gate #define	PCI_ADDR_CONFIG		0x00000000	/* configuration address */
794*7c478bd9Sstevel@tonic-gate #define	PCI_ADDR_IO		0x01000000	/* I/O address */
795*7c478bd9Sstevel@tonic-gate #define	PCI_ADDR_MEM32		0x02000000	/* 32-bit memory address */
796*7c478bd9Sstevel@tonic-gate #define	PCI_ADDR_MEM64		0x03000000	/* 64-bit memory address */
797*7c478bd9Sstevel@tonic-gate #define	PCI_ALIAS_B		PCI_REG_ALIAS_M	/* aliased bit */
798*7c478bd9Sstevel@tonic-gate #define	PCI_PREFETCH_B		PCI_REG_PF_M	/* prefetch bit */
799*7c478bd9Sstevel@tonic-gate #define	PCI_RELOCAT_B		PCI_REG_REL_M	/* non-relocatable bit */
800*7c478bd9Sstevel@tonic-gate #define	PCI_CONF_ADDR_MASK	0x00ffffff	/* mask for config address */
801*7c478bd9Sstevel@tonic-gate 
802*7c478bd9Sstevel@tonic-gate #define	PCI_HARDDEC_8514 2	/* number of reg entries for 8514 hard-decode */
803*7c478bd9Sstevel@tonic-gate #define	PCI_HARDDEC_VGA	3	/* number of reg entries for VGA hard-decode */
804*7c478bd9Sstevel@tonic-gate #define	PCI_HARDDEC_IDE	4	/* number of reg entries for IDE hard-decode */
805*7c478bd9Sstevel@tonic-gate #define	PCI_HARDDEC_IDE_PRI 2	/* number of reg entries for IDE primary */
806*7c478bd9Sstevel@tonic-gate #define	PCI_HARDDEC_IDE_SEC 2	/* number of reg entries for IDE secondary */
807*7c478bd9Sstevel@tonic-gate 
808*7c478bd9Sstevel@tonic-gate /*
809*7c478bd9Sstevel@tonic-gate  * PCI Expansion ROM Header Format
810*7c478bd9Sstevel@tonic-gate  */
811*7c478bd9Sstevel@tonic-gate #define	PCI_ROM_SIGNATURE		0x0	/* ROM Signature 0xaa55 */
812*7c478bd9Sstevel@tonic-gate #define	PCI_ROM_ARCH_UNIQUE_START	0x2	/* Start of processor unique */
813*7c478bd9Sstevel@tonic-gate #define	PCI_ROM_PCI_DATA_STRUCT_PTR	0x18	/* Ptr to PCI Data Structure */
814*7c478bd9Sstevel@tonic-gate 
815*7c478bd9Sstevel@tonic-gate /*
816*7c478bd9Sstevel@tonic-gate  * PCI Data Structure
817*7c478bd9Sstevel@tonic-gate  *
818*7c478bd9Sstevel@tonic-gate  * The PCI Data Structure is located within the first 64KB
819*7c478bd9Sstevel@tonic-gate  * of the ROM image and must be DWORD aligned.
820*7c478bd9Sstevel@tonic-gate  */
821*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_SIGNATURE	0x0	/* Signature, the string 'PCIR' */
822*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_VENDOR_ID	0x4	/* Vendor Identification */
823*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_DEVICE_ID	0x6	/* Device Identification */
824*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_VPD_PTR		0x8	/* Pointer to Vital Product Data */
825*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_PDS_LENGTH	0xa	/* PCI Data Structure Length */
826*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_PDS_REVISION	0xc	/* PCI Data Structure Revision */
827*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_CLASS_CODE	0xd	/* Class Code */
828*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_IMAGE_LENGTH	0x10	/* Image Length in 512 byte units */
829*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_CODE_REVISON	0x12	/* Revision Level of Code/Data */
830*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_CODE_TYPE	0x14	/* Code Type */
831*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_INDICATOR	0x15	/* Indicates if image is last in ROM */
832*7c478bd9Sstevel@tonic-gate 
833*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_CODE_TYPE_PCAT		0x0	/* Intel x86/PC-AT Type */
834*7c478bd9Sstevel@tonic-gate #define	PCI_PDS_CODE_TYPE_OPEN_FW	0x1	/* Open Firmware */
835*7c478bd9Sstevel@tonic-gate 
836*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
837*7c478bd9Sstevel@tonic-gate }
838*7c478bd9Sstevel@tonic-gate #endif
839*7c478bd9Sstevel@tonic-gate 
840*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_PCI_H */
841