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 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _PCIBUS_LABELS_H 28 #define _PCIBUS_LABELS_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <hostbridge.h> 33 #include <did.h> 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* 40 * When all we're provided is a physical slot number, these structures 41 * allow us to attach an accompanying label. 42 */ 43 typedef struct physnm { 44 int ps_num; 45 const char *ps_label; 46 } physnm_t; 47 48 typedef struct pphysnm { 49 const char *pnm_platform; /* platform on which the names apply */ 50 int pnm_nnames; /* number of names */ 51 struct physnm *pnm_names; /* array of labels */ 52 } pphysnm_t; 53 54 typedef struct physlot_names { 55 int psn_nplats; 56 struct pphysnm *psn_names; 57 } physlot_names_t; 58 59 /* 60 * Sometimes OBP gets it wrong, there's a slot-names property, but it 61 * is incorrect. These structures allow us to replace a given label A 62 * with a different label B prior to attaching the label to a topology node. 63 */ 64 typedef struct slot_rwd { 65 const char *srw_obp; /* slot name found */ 66 const char *srw_new; /* replacement slot name */ 67 } slot_rwd_t; 68 69 typedef struct plat_rwd { 70 const char *prw_platform; /* platform on which the names apply */ 71 int prw_nrewrites; /* number of rewrites */ 72 struct slot_rwd *prw_rewrites; /* array of rewrites */ 73 } plat_rwd_t; 74 75 typedef struct slotnm_rewrite { 76 int srw_nplats; 77 struct plat_rwd *srw_platrewrites; 78 } slotnm_rewrite_t; 79 80 /* 81 * We can locate a label without help from OBP slot-names or a 82 * physical slot-name, if need be. Having to resort to this, though is 83 * really an indication that there's a bug in the platform OBP. 84 */ 85 typedef struct devlab { 86 int dl_board; 87 int dl_bridge; 88 int dl_rc; 89 int dl_bus; 90 int dl_dev; 91 const char *dl_label; 92 } devlab_t; 93 94 typedef struct pdevlabs { 95 const char *pdl_platform; /* Name of the platform */ 96 int pdl_nnames; /* number of missing names */ 97 struct devlab *pdl_names; /* the missing names */ 98 } pdevlabs_t; 99 100 typedef struct missing_names { 101 int mn_nplats; /* number of platforms with entries */ 102 struct pdevlabs *mn_names; /* platform entries */ 103 } missing_names_t; 104 105 extern int pci_label_cmn(topo_mod_t *mod, tnode_t *, nvlist_t *, nvlist_t **); 106 extern int pci_fru_cmn(topo_mod_t *mod, tnode_t *, nvlist_t *, nvlist_t **); 107 extern const char * 108 pci_slotname_lookup(topo_mod_t *, tnode_t *, did_t *, did_t *); 109 110 #ifdef __cplusplus 111 } 112 #endif 113 114 #endif /* _PCIBUS_LABELS_H */ 115