xref: /onnv-gate/usr/src/lib/fm/topo/modules/common/pcibus/did_props.h (revision 12126:60364f3f65c7)
13062Scindi /*
23062Scindi  * CDDL HEADER START
33062Scindi  *
43062Scindi  * The contents of this file are subject to the terms of the
53062Scindi  * Common Development and Distribution License (the "License").
63062Scindi  * You may not use this file except in compliance with the License.
73062Scindi  *
83062Scindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93062Scindi  * or http://www.opensolaris.org/os/licensing.
103062Scindi  * See the License for the specific language governing permissions
113062Scindi  * and limitations under the License.
123062Scindi  *
133062Scindi  * When distributing Covered Code, include this CDDL HEADER in each
143062Scindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153062Scindi  * If applicable, add the following below this CDDL HEADER, with the
163062Scindi  * fields enclosed by brackets "[]" replaced with your own identifying
173062Scindi  * information: Portions Copyright [yyyy] [name of copyright owner]
183062Scindi  *
193062Scindi  * CDDL HEADER END
203062Scindi  */
213062Scindi 
223062Scindi /*
23*12126SHyon.Kim@Sun.COM  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
243062Scindi  */
253062Scindi 
263062Scindi #ifndef _DID_PROPS_H
273062Scindi #define	_DID_PROPS_H
283062Scindi 
293062Scindi #include <sys/pci.h>
303062Scindi #include <fm/topo_mod.h>
313062Scindi #include <libdevinfo.h>
323062Scindi #include <libnvpair.h>
333062Scindi 
343062Scindi #include <did.h>
353062Scindi 
363062Scindi #ifdef __cplusplus
373062Scindi extern "C" {
383062Scindi #endif
393062Scindi 
403062Scindi /*
413062Scindi  * pci_props_set() processes an array of structures that translate
423062Scindi  * from devinfo props to properties on topology nodes.  The structure
433062Scindi  * provides the name of a devinfo prop, the name of the property
443062Scindi  * group, the name of the property and the stability of the property
453062Scindi  * group that should be established on the topology node, as well as a
463062Scindi  * function to do the work.
473062Scindi  */
483062Scindi typedef struct txprop {
493062Scindi 	const char *tx_diprop;	/* property examined off the di_node_t */
503062Scindi 	const topo_pgroup_info_t *tx_tpgroup; /* pgroup defined for tnode_t */
513062Scindi 	const char *tx_tprop;	/* property defined on the tnode_t */
523062Scindi 	/*
533062Scindi 	 * translation function
543062Scindi 	 *	If NULL, the devinfo prop's value is copied to the
553062Scindi 	 *	topo property.
563062Scindi 	 */
573062Scindi 	int (*tx_xlate)(tnode_t *, did_t *,
583062Scindi 	    const char *, const char *, const char *);
593062Scindi } txprop_t;
603062Scindi 
613062Scindi #define	DI_DEVTYPPROP	"device_type"
623062Scindi #define	DI_VENDIDPROP	"vendor-id"
633062Scindi #define	DI_DEVIDPROP	"device-id"
643062Scindi #define	DI_CLASSPROP	"class-code"
653062Scindi #define	DI_REGPROP	"reg"
663062Scindi #define	DI_CCPROP	"class-code"
673062Scindi #define	DI_PHYSPROP	"physical-slot#"
683062Scindi #define	DI_SLOTPROP	"slot-names"
696313Skrishnae #define	DI_AADDRPROP	"assigned-addresses"
70*12126SHyon.Kim@Sun.COM #define	DI_RECEPTACLE_PHYMASK	"receptacle-pm"
71*12126SHyon.Kim@Sun.COM #define	DI_RECEPTACLE_LABEL	"receptacle-label"
723062Scindi 
733062Scindi extern int did_props_set(tnode_t *, did_t *, txprop_t[], int);
747987SErwin.Tsaur@Sun.COM extern tnode_t *find_predecessor(tnode_t *, char *);
753062Scindi 
767987SErwin.Tsaur@Sun.COM extern char *pci_devtype_get(topo_mod_t *, di_node_t);
773062Scindi extern int pciex_cap_get(topo_mod_t *, di_node_t);
783062Scindi extern int pci_BDF_get(topo_mod_t *, di_node_t, int *, int *, int *);
793062Scindi extern int pci_classcode_get(topo_mod_t *, di_node_t, uint_t *, uint_t *);
803062Scindi 
813062Scindi extern int di_uintprop_get(topo_mod_t *, di_node_t, const char *, uint_t *);
823062Scindi extern int di_bytes_get(topo_mod_t *, di_node_t, const char *, int *,
833062Scindi     uchar_t **);
843895Szx143588 extern int FRU_fmri_set(topo_mod_t *, tnode_t *);
853062Scindi 
863062Scindi #ifdef __cplusplus
873062Scindi }
883062Scindi #endif
893062Scindi 
903062Scindi #endif /* _DID_PROPS_H */
91