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 2009 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _PCIBUS_LABELS_H
2N/A#define _PCIBUS_LABELS_H
2N/A
2N/A#include <hostbridge.h>
2N/A#include <did.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * When all we're provided is a physical slot number, these structures
2N/A * allow us to attach an accompanying label.
2N/A */
2N/Atypedef struct physnm {
2N/A int ps_num;
2N/A const char *ps_label;
2N/A} physnm_t;
2N/A
2N/Atypedef struct pphysnm {
2N/A const char *pnm_platform; /* platform on which the names apply */
2N/A int pnm_nnames; /* number of names */
2N/A struct physnm *pnm_names; /* array of labels */
2N/A} pphysnm_t;
2N/A
2N/Atypedef struct physlot_names {
2N/A int psn_nplats;
2N/A struct pphysnm *psn_names;
2N/A} physlot_names_t;
2N/A
2N/A/*
2N/A * Sometimes OBP gets it wrong, there's a slot-names property, but it
2N/A * is incorrect. These structures allow us to replace a given label A
2N/A * with a different label B prior to attaching the label to a topology node.
2N/A */
2N/Atypedef struct slot_rwd {
2N/A const char *srw_obp; /* slot name found */
2N/A const char *srw_new; /* replacement slot name */
2N/A int (*srw_test)(topo_mod_t *, did_t *); /* test function */
2N/A} slot_rwd_t;
2N/A
2N/Atypedef struct plat_rwd {
2N/A const char *prw_platform; /* platform on which the names apply */
2N/A int prw_nrewrites; /* number of rewrites */
2N/A struct slot_rwd *prw_rewrites; /* array of rewrites */
2N/A} plat_rwd_t;
2N/A
2N/Atypedef struct slotnm_rewrite {
2N/A int srw_nplats;
2N/A struct plat_rwd *srw_platrewrites;
2N/A} slotnm_rewrite_t;
2N/A
2N/A/*
2N/A * We can locate a label without help from OBP slot-names or a
2N/A * physical slot-name, if need be. Having to resort to this, though is
2N/A * really an indication that there's a bug in the platform OBP.
2N/A */
2N/Atypedef struct devlab {
2N/A int dl_board; /* board number */
2N/A int dl_bridge; /* hostbridge number */
2N/A int dl_rc; /* root complex number */
2N/A int dl_bus; /* bus number */
2N/A int dl_dev; /* device number */
2N/A const char *dl_label; /* label to use */
2N/A int (*dl_test)(topo_mod_t *, did_t *); /* test function */
2N/A} devlab_t;
2N/A
2N/Atypedef struct pdevlabs {
2N/A const char *pdl_platform; /* Name of the platform */
2N/A int pdl_nnames; /* number of missing names */
2N/A struct devlab *pdl_names; /* the missing names */
2N/A} pdevlabs_t;
2N/A
2N/Atypedef struct missing_names {
2N/A int mn_nplats; /* number of platforms with entries */
2N/A struct pdevlabs *mn_names; /* platform entries */
2N/A} missing_names_t;
2N/A
2N/Aextern int pci_label_cmn(topo_mod_t *mod, tnode_t *, nvlist_t *, nvlist_t **);
2N/Aextern int pci_fru_cmn(topo_mod_t *mod, tnode_t *, nvlist_t *, nvlist_t **);
2N/Aextern char *pci_slot_label_lookup(topo_mod_t *, tnode_t *, did_t *, did_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _PCIBUS_LABELS_H */