2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _DID_IMPL_H
2N/A#define _DID_IMPL_H
2N/A
2N/A#include <sys/pci.h>
2N/A#include <fm/libtopo.h>
2N/A#include <libdevinfo.h>
2N/A#include <libnvpair.h>
2N/A#include <did.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define REC_HASHLEN 253
2N/A
2N/A/*
2N/A * Slot name info is attached to devinfo nodes, compressed inside of
2N/A * a "slot-names" property. When we dig this out we store each name
2N/A * as an FMRI, along with the device number to which it applies.
2N/A */
2N/Atypedef struct slotnm {
2N/A topo_mod_t *snm_mod; /* module that allocated the slot name */
2N/A struct slotnm *snm_next;
2N/A int snm_dev; /* device on the bus that implements the slot */
2N/A char *snm_name; /* name describing the slot */
2N/A} slotnm_t;
2N/A
2N/Atypedef struct did_hash did_hash_t;
2N/A
2N/A/*
2N/A * Private data stored with a tnode_t. We collect slot-name info from
2N/A * di_nodes that describe buses, but then don't use it until we get to
2N/A * a tnode_t actually describing a function of a device. We also use
2N/A * this struct to pass around bus, dev, function info so that doesn't
2N/A * have to be re-computed.
2N/A */
2N/Astruct did {
2N/A struct did *dp_next; /* for chaining in a hash bucket */
2N/A struct did *dp_link; /* for chaining to related did_t */
2N/A struct did *dp_chain; /* for chaining to another chain of did_ts */
2N/A did_hash_t *dp_hash; /* the hash table where we reside */
2N/A topo_mod_t *dp_mod; /* module that allocated the private data */
2N/A di_node_t dp_src; /* di_node_t from which the info was derived */
2N/A int dp_refcnt; /* multiple nodes may point at a did_t */
2N/A uint_t dp_excap; /* PCI-Express port/device type */
2N/A int dp_physlot; /* PCI-Express physical slot # */
2N/A char *dp_physlot_name; /* PCI-Express physical slot name */
2N/A int dp_class; /* PCI class */
2N/A int dp_subclass; /* PCI subclass */
2N/A char *dp_devtype; /* PCI 1275 spec device-type */
2N/A int dp_board; /* Board number */
2N/A int dp_bridge; /* Bridge number */
2N/A int dp_rc; /* Root Complex number */
2N/A int dp_bus; /* PCI bus number */
2N/A int dp_dev; /* PCI device number on the above bus */
2N/A int dp_fn; /* PCI function number of the above device */
2N/A int dp_bdf; /* PCI "real" bdf */
2N/A int dp_nslots; /* PCI number of slots described */
2N/A slotnm_t *dp_slotnames; /* PCI slot names list */
2N/A tnode_t *dp_tnode; /* the parent tnode */
2N/A char *dp_slot_label; /* the slot label */
2N/A};
2N/A
2N/Astruct did_hash {
2N/A did_t **dph_hash; /* hash bucket array */
2N/A uint_t dph_hashlen; /* size of hash bucket array */
2N/A uint_t dph_nelems; /* number of elements in the hash */
2N/A topo_mod_t *dph_mod; /* module that allocated the hash table */
2N/A};
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _DID_IMPL_H */