xref: /illumos-gate/usr/src/lib/fm/topo/modules/common/pcibus/pcibus.h (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
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 #include <sys/pci.h>
31 #include <fm/topo_mod.h>
32 #include <libdevinfo.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define	PCI_ENUMR_VERS	1
39 
40 #define	PCI_ENUM "pcibus"
41 
42 #define	PCI_BUS		"pcibus"
43 #define	PCI_DEVICE	"pcidev"
44 #define	PCI_FUNCTION	"pcifn"
45 #define	PCIEX_ROOT	"pciexrc"
46 #define	PCIEX_SWUP	"pciexswu"
47 #define	PCIEX_SWDWN	"pciexswd"
48 #define	PCIEX_BUS	"pciexbus"
49 #define	PCIEX_DEVICE	"pciexdev"
50 #define	PCIEX_FUNCTION	"pciexfn"
51 
52 #define	PCIEXTYPE "pciex"
53 #define	PCITYPE "pci"
54 
55 #define	MAX_HB_BUSES	255
56 #define	MAX_PCIBUS_DEVS	32
57 #define	MAX_PCIDEV_FNS	8
58 
59 /* vendor/device ids for Neptune */
60 #define	SUN_VENDOR_ID		0x108e
61 #define	NEPTUNE_DEVICE_ID	0xabcd
62 
63 #define	GETCLASS(x) (((x) & 0xff0000) >> 16)
64 #define	GETSUBCLASS(x) (((x) & 0xff00) >> 8)
65 
66 extern tnode_t *pcibus_declare(topo_mod_t *, tnode_t *, di_node_t,
67     topo_instance_t);
68 extern tnode_t *pcidev_declare(topo_mod_t *, tnode_t *, di_node_t,
69     topo_instance_t);
70 extern tnode_t *pcifn_declare(topo_mod_t *, tnode_t *, di_node_t,
71     topo_instance_t);
72 extern tnode_t *pciexbus_declare(topo_mod_t *, tnode_t *, di_node_t,
73     topo_instance_t);
74 extern tnode_t *pciexdev_declare(topo_mod_t *, tnode_t *, di_node_t,
75     topo_instance_t);
76 extern tnode_t *pciexfn_declare(topo_mod_t *, tnode_t *, di_node_t,
77     topo_instance_t);
78 extern int pci_children_instantiate(topo_mod_t *, tnode_t *, di_node_t,
79     int, int, int, int, int);
80 
81 extern int platform_pci_label(topo_mod_t *, tnode_t *, nvlist_t *, nvlist_t **);
82 extern int pci_create_dev_sensors(topo_mod_t *, tnode_t *);
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* _PCIBUS_H */
89