xref: /titanic_50/usr/src/lib/fm/topo/modules/common/pcibus/did_props.h (revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a)
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 (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef _DID_PROPS_H
27 #define	_DID_PROPS_H
28 
29 #include <sys/pci.h>
30 #include <fm/topo_mod.h>
31 #include <libdevinfo.h>
32 #include <libnvpair.h>
33 
34 #include <did.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * pci_props_set() processes an array of structures that translate
42  * from devinfo props to properties on topology nodes.  The structure
43  * provides the name of a devinfo prop, the name of the property
44  * group, the name of the property and the stability of the property
45  * group that should be established on the topology node, as well as a
46  * function to do the work.
47  */
48 typedef struct txprop {
49 	const char *tx_diprop;	/* property examined off the di_node_t */
50 	const topo_pgroup_info_t *tx_tpgroup; /* pgroup defined for tnode_t */
51 	const char *tx_tprop;	/* property defined on the tnode_t */
52 	/*
53 	 * translation function
54 	 *	If NULL, the devinfo prop's value is copied to the
55 	 *	topo property.
56 	 */
57 	int (*tx_xlate)(tnode_t *, did_t *,
58 	    const char *, const char *, const char *);
59 } txprop_t;
60 
61 #define	DI_DEVTYPPROP	"device_type"
62 #define	DI_VENDIDPROP	"vendor-id"
63 #define	DI_DEVIDPROP	"device-id"
64 #define	DI_CLASSPROP	"class-code"
65 #define	DI_REGPROP	"reg"
66 #define	DI_CCPROP	"class-code"
67 #define	DI_PHYSPROP	"physical-slot#"
68 #define	DI_SLOTPROP	"slot-names"
69 #define	DI_AADDRPROP	"assigned-addresses"
70 #define	DI_RECEPTACLE_PHYMASK	"receptacle-pm"
71 #define	DI_RECEPTACLE_LABEL	"receptacle-label"
72 
73 extern int did_props_set(tnode_t *, did_t *, txprop_t[], int);
74 extern tnode_t *find_predecessor(tnode_t *, char *);
75 
76 extern char *pci_devtype_get(topo_mod_t *, di_node_t);
77 extern int pciex_cap_get(topo_mod_t *, di_node_t);
78 extern int pci_BDF_get(topo_mod_t *, di_node_t, int *, int *, int *);
79 extern int pci_classcode_get(topo_mod_t *, di_node_t, uint_t *, uint_t *);
80 
81 extern int di_uintprop_get(topo_mod_t *, di_node_t, const char *, uint_t *);
82 extern int di_bytes_get(topo_mod_t *, di_node_t, const char *, int *,
83     uchar_t **);
84 extern int FRU_fmri_set(topo_mod_t *, tnode_t *);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* _DID_PROPS_H */
91