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 /* 237987SErwin.Tsaur@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 243062Scindi * Use is subject to license terms. 253062Scindi */ 263062Scindi 273062Scindi #ifndef _DID_IMPL_H 283062Scindi #define _DID_IMPL_H 293062Scindi 303062Scindi #include <sys/pci.h> 313062Scindi #include <fm/libtopo.h> 323062Scindi #include <libdevinfo.h> 333062Scindi #include <libnvpair.h> 343062Scindi #include <did.h> 353062Scindi 363062Scindi #ifdef __cplusplus 373062Scindi extern "C" { 383062Scindi #endif 393062Scindi 403062Scindi #define REC_HASHLEN 253 413062Scindi 423062Scindi /* 433062Scindi * Slot name info is attached to devinfo nodes, compressed inside of 443062Scindi * a "slot-names" property. When we dig this out we store each name 453062Scindi * as an FMRI, along with the device number to which it applies. 463062Scindi */ 473062Scindi typedef struct slotnm { 483062Scindi topo_mod_t *snm_mod; /* module that allocated the slot name */ 493062Scindi struct slotnm *snm_next; 50*8216STarik.Soydan@Sun.COM int snm_dev; /* device on the bus that implements the slot */ 51*8216STarik.Soydan@Sun.COM char *snm_name; /* name describing the slot */ 523062Scindi } slotnm_t; 533062Scindi 543062Scindi typedef struct did_hash did_hash_t; 553062Scindi 563062Scindi /* 573062Scindi * Private data stored with a tnode_t. We collect slot-name info from 583062Scindi * di_nodes that describe buses, but then don't use it until we get to 593062Scindi * a tnode_t actually describing a function of a device. We also use 603062Scindi * this struct to pass around bus, dev, function info so that doesn't 613062Scindi * have to be re-computed. 623062Scindi */ 633062Scindi struct did { 64*8216STarik.Soydan@Sun.COM struct did *dp_next; /* for chaining in a hash bucket */ 65*8216STarik.Soydan@Sun.COM struct did *dp_link; /* for chaining to related did_t */ 66*8216STarik.Soydan@Sun.COM struct did *dp_chain; /* for chaining to another chain of did_ts */ 67*8216STarik.Soydan@Sun.COM did_hash_t *dp_hash; /* the hash table where we reside */ 68*8216STarik.Soydan@Sun.COM topo_mod_t *dp_mod; /* module that allocated the private data */ 69*8216STarik.Soydan@Sun.COM di_node_t dp_src; /* di_node_t from which the info was derived */ 70*8216STarik.Soydan@Sun.COM int dp_refcnt; /* multiple nodes may point at a did_t */ 717987SErwin.Tsaur@Sun.COM uint_t dp_excap; /* PCI-Express port/device type */ 723062Scindi int dp_physlot; /* PCI-Express physical slot # */ 73*8216STarik.Soydan@Sun.COM char *dp_physlot_name; /* PCI-Express physical slot name */ 743062Scindi int dp_class; /* PCI class */ 753062Scindi int dp_subclass; /* PCI subclass */ 767987SErwin.Tsaur@Sun.COM char *dp_devtype; /* PCI 1275 spec device-type */ 773062Scindi int dp_board; /* Board number */ 783062Scindi int dp_bridge; /* Bridge number */ 793062Scindi int dp_rc; /* Root Complex number */ 803062Scindi int dp_bus; /* PCI bus number */ 813062Scindi int dp_dev; /* PCI device number on the above bus */ 823062Scindi int dp_fn; /* PCI function number of the above device */ 833062Scindi int dp_bdf; /* PCI "real" bdf */ 84*8216STarik.Soydan@Sun.COM int dp_nslots; /* PCI number of slots described */ 85*8216STarik.Soydan@Sun.COM slotnm_t *dp_slotnames; /* PCI slot names list */ 86*8216STarik.Soydan@Sun.COM tnode_t *dp_tnode; /* the parent tnode */ 87*8216STarik.Soydan@Sun.COM char *dp_slot_label; /* the slot label */ 883062Scindi }; 893062Scindi 903062Scindi struct did_hash { 913062Scindi did_t **dph_hash; /* hash bucket array */ 923062Scindi uint_t dph_hashlen; /* size of hash bucket array */ 933062Scindi uint_t dph_nelems; /* number of elements in the hash */ 943062Scindi topo_mod_t *dph_mod; /* module that allocated the hash table */ 953062Scindi }; 963062Scindi 973062Scindi #ifdef __cplusplus 983062Scindi } 993062Scindi #endif 1003062Scindi 1013062Scindi #endif /* _DID_IMPL_H */ 102