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 * Copyright 2019 Joyent, Inc. 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_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" 75 76 #define DI_PCIE_MAX_WIDTH "pcie-link-maximum-width" 77 #define DI_PCIE_CUR_WIDTH "pcie-link-current-width" 78 #define DI_PCIE_CUR_SPEED "pcie-link-current-speed" 79 #define DI_PCIE_MAX_SPEED "pcie-link-maximum-speed" 80 #define DI_PCIE_SUP_SPEEDS "pcie-link-supported-speeds" 81 #define DI_PCIE_TARG_SPEED "pcie-link-target-speed" 82 #define DI_PCIE_ADMIN_TAG "pcie-link-admin-target-speed" 83 84 extern int did_props_set(tnode_t *, did_t *, txprop_t[], int); 85 extern tnode_t *find_predecessor(tnode_t *, char *); 86 87 extern char *pci_devtype_get(topo_mod_t *, di_node_t); 88 extern int pciex_cap_get(topo_mod_t *, di_node_t); 89 extern int pci_BDF_get(topo_mod_t *, di_node_t, int *, int *, int *); 90 extern int pci_classcode_get(topo_mod_t *, di_node_t, uint_t *, uint_t *); 91 92 extern int di_uintprop_get(topo_mod_t *, di_node_t, const char *, uint_t *); 93 extern int di_bytes_get(topo_mod_t *, di_node_t, const char *, int *, 94 uchar_t **); 95 extern int FRU_fmri_set(topo_mod_t *, tnode_t *); 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif /* _DID_PROPS_H */ 102