9113 Expose vendor-name/device-name/subsystem-name as props on pcifn/pciexfn topo...
[unleashed.git] / usr / src / lib / fm / topo / modules / common / pcibus / did_props.h
blobcddf90e79db0c8e7529b4b14e486a59e009bce56
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2018, Joyent, Inc.
27 #ifndef _DID_PROPS_H
28 #define _DID_PROPS_H
30 #include <sys/pci.h>
31 #include <fm/topo_mod.h>
32 #include <libdevinfo.h>
33 #include <libnvpair.h>
35 #include <did.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
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.
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 */
54 * translation function
55 * If NULL, the devinfo prop's value is copied to the
56 * topo property.
58 int (*tx_xlate)(tnode_t *, did_t *,
59 const char *, const char *, const char *);
60 } txprop_t;
62 #define DI_DEVTYPPROP "device_type"
63 #define DI_VENDIDPROP "vendor-id"
64 #define DI_SUBVENDIDPROP "subsystem-vendor-id"
65 #define DI_SUBSYSTEMID "subsystem-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 #define DI_AADDRPROP "assigned-addresses"
73 #define DI_RECEPTACLE_PHYMASK "receptacle-pm"
74 #define DI_RECEPTACLE_LABEL "receptacle-label"
76 extern int did_props_set(tnode_t *, did_t *, txprop_t[], int);
77 extern tnode_t *find_predecessor(tnode_t *, char *);
79 extern char *pci_devtype_get(topo_mod_t *, di_node_t);
80 extern int pciex_cap_get(topo_mod_t *, di_node_t);
81 extern int pci_BDF_get(topo_mod_t *, di_node_t, int *, int *, int *);
82 extern int pci_classcode_get(topo_mod_t *, di_node_t, uint_t *, uint_t *);
84 extern int di_uintprop_get(topo_mod_t *, di_node_t, const char *, uint_t *);
85 extern int di_bytes_get(topo_mod_t *, di_node_t, const char *, int *,
86 uchar_t **);
87 extern int FRU_fmri_set(topo_mod_t *, tnode_t *);
89 #ifdef __cplusplus
91 #endif
93 #endif /* _DID_PROPS_H */