xref: /titanic_44/usr/src/lib/fm/topo/modules/sun4v/hostbridge/hb_mdesc.h (revision 29493bd8e037cbaea9095b34172305abb589cb6b)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_HB_MDESC_H
28 #define	_HB_MDESC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <fm/topo_mod.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Node/Field names in the PRI/MD
40  */
41 #define	MD_STR_ID		"id"
42 #define	MD_STR_IODEVICE		"iodevice"
43 #define	MD_STR_DEVICE_TYPE	"device-type"
44 #define	MD_STR_PCIEX		"pciex"
45 #define	MD_STR_CFGHDL		"cfg-handle"
46 
47 /* A root complex */
48 typedef struct md_rc {
49 	int16_t id;			/* physical id of the rc */
50 	uint64_t cfg_handle;		/* bus address */
51 } md_rc_t;
52 
53 /* A hostbridge */
54 typedef struct md_hb {
55 	int16_t id;			/* physiscal id of the hostbridge */
56 	md_rc_t *rcs;			/* a list of pciex root complexes */
57 	int16_t srcs;			/* size of the rcs */
58 	int16_t nrcs;			/* count of rc entries in rcs */
59 } md_hb_t;
60 
61 typedef struct md_info {
62 	md_hb_t *hbs;			/* a list of hostbridges */
63 	int16_t shbs;			/* size of the hbs */
64 	int16_t nhbs;			/* count of hb entries in hbs */
65 } md_info_t;
66 
67 
68 extern int hb_mdesc_init(topo_mod_t *mod, md_info_t *hbmdp);
69 extern void hb_mdesc_fini(topo_mod_t *mod, md_info_t *hbmdp);
70 
71 extern md_hb_t *hb_find_hb(md_info_t *hbmd, int hbid);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif	/* _HB_MDESC_H */
78