xref: /titanic_50/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.h (revision ee5416c9d7e449233197d5d20bc6b81e4ff091b2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _PCIBUS_H
28 #define	_PCIBUS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/pci.h>
33 #include <fm/topo_mod.h>
34 #include <libdevinfo.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #define	PCI_ENUMR_VERS	1
41 
42 #define	PCI_ENUM "pcibus"
43 
44 #define	PCI_BUS		"pcibus"
45 #define	PCI_DEVICE	"pcidev"
46 #define	PCI_FUNCTION	"pcifn"
47 #define	PCIEX_ROOT	"pciexrc"
48 #define	PCIEX_SWUP	"pciexswu"
49 #define	PCIEX_SWDWN	"pciexswd"
50 #define	PCIEX_BUS	"pciexbus"
51 #define	PCIEX_DEVICE	"pciexdev"
52 #define	PCIEX_FUNCTION	"pciexfn"
53 
54 #define	PCIEXTYPE "pciex"
55 #define	PCITYPE "pci"
56 
57 #define	MAX_HB_BUSES	255
58 #define	MAX_PCIBUS_DEVS	32
59 #define	MAX_PCIDEV_FNS	8
60 
61 /* vendor/device ids for Neptune */
62 #define	SUN_VENDOR_ID		0x108e
63 #define	NEPTUNE_DEVICE_ID	0xabcd
64 
65 #define	GETCLASS(x) (((x) & 0xff0000) >> 16)
66 #define	GETSUBCLASS(x) (((x) & 0xff00) >> 8)
67 
68 extern tnode_t *pcibus_declare(topo_mod_t *, tnode_t *, di_node_t,
69     topo_instance_t);
70 extern tnode_t *pcidev_declare(topo_mod_t *, tnode_t *, di_node_t,
71     topo_instance_t);
72 extern tnode_t *pcifn_declare(topo_mod_t *, tnode_t *, di_node_t,
73     topo_instance_t);
74 extern tnode_t *pciexbus_declare(topo_mod_t *, tnode_t *, di_node_t,
75     topo_instance_t);
76 extern tnode_t *pciexdev_declare(topo_mod_t *, tnode_t *, di_node_t,
77     topo_instance_t);
78 extern tnode_t *pciexfn_declare(topo_mod_t *, tnode_t *, di_node_t,
79     topo_instance_t);
80 extern int pci_children_instantiate(topo_mod_t *, tnode_t *, di_node_t,
81     int, int, int, int, int);
82 
83 extern int platform_pci_label(topo_mod_t *, tnode_t *, nvlist_t *, nvlist_t **);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* _PCIBUS_H */
90