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