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