xref: /titanic_52/usr/src/uts/sun4u/lw8/sys/sgfrutree.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
1*03831d35Sstevel /*
2*03831d35Sstevel  * CDDL HEADER START
3*03831d35Sstevel  *
4*03831d35Sstevel  * The contents of this file are subject to the terms of the
5*03831d35Sstevel  * Common Development and Distribution License (the "License").
6*03831d35Sstevel  * You may not use this file except in compliance with the License.
7*03831d35Sstevel  *
8*03831d35Sstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*03831d35Sstevel  * or http://www.opensolaris.org/os/licensing.
10*03831d35Sstevel  * See the License for the specific language governing permissions
11*03831d35Sstevel  * and limitations under the License.
12*03831d35Sstevel  *
13*03831d35Sstevel  * When distributing Covered Code, include this CDDL HEADER in each
14*03831d35Sstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*03831d35Sstevel  * If applicable, add the following below this CDDL HEADER, with the
16*03831d35Sstevel  * fields enclosed by brackets "[]" replaced with your own identifying
17*03831d35Sstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
18*03831d35Sstevel  *
19*03831d35Sstevel  * CDDL HEADER END
20*03831d35Sstevel  */
21*03831d35Sstevel 
22*03831d35Sstevel /*
23*03831d35Sstevel  * Copyright 2000 Sun Microsystems, Inc.  All rights reserved.
24*03831d35Sstevel  * Use is subject to license terms.
25*03831d35Sstevel  */
26*03831d35Sstevel 
27*03831d35Sstevel #ifndef _SGFRUTREE_H
28*03831d35Sstevel #define	_SGFRUTREE_H
29*03831d35Sstevel 
30*03831d35Sstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*03831d35Sstevel 
32*03831d35Sstevel #ifdef	__cplusplus
33*03831d35Sstevel extern "C" {
34*03831d35Sstevel #endif
35*03831d35Sstevel 
36*03831d35Sstevel #include <sys/types.h>
37*03831d35Sstevel #include <sys/sgfru.h>
38*03831d35Sstevel 
39*03831d35Sstevel #define	ROOTPARENT		0		/* well-known node value */
40*03831d35Sstevel #define	MAX_NODE_CHILDREN	16		/* hint */
41*03831d35Sstevel #define	MAX_NODE_NAME		16		/* max name size */
42*03831d35Sstevel 
43*03831d35Sstevel /*
44*03831d35Sstevel  * PICL classes used by serengeti sgfrutree
45*03831d35Sstevel  */
46*03831d35Sstevel #define	TEMP_CLASS		0x0		/* currently unused */
47*03831d35Sstevel #define	FRU_CLASS		0x1		/* fru class */
48*03831d35Sstevel #define	LOCATION_CLASS		0x2		/* location class */
49*03831d35Sstevel #define	PSEUDO_FRU_CLASS	0x3		/* fru class with no seeprom */
50*03831d35Sstevel 
51*03831d35Sstevel typedef struct {
52*03831d35Sstevel 	fru_hdl_t	handle;			/* (container) handle */
53*03831d35Sstevel 	char		nodename[MAX_NODE_NAME]; /* picl nodename, thing name */
54*03831d35Sstevel 	int16_t		has_children;		/* hint if node has children */
55*03831d35Sstevel 	uint16_t	class;			/* one of the picl classes */
56*03831d35Sstevel 	union class_info {
57*03831d35Sstevel 	    struct location_info {
58*03831d35Sstevel 		int16_t	slot;			/* location: valid slot or -1 */
59*03831d35Sstevel 		char	label[MAX_NODE_NAME];	/* label property, place name */
60*03831d35Sstevel 	    } linfo;
61*03831d35Sstevel 	} cinfo;
62*03831d35Sstevel } node_t;
63*03831d35Sstevel 
64*03831d35Sstevel #define	location_slot	cinfo.linfo.slot
65*03831d35Sstevel #define	location_label	cinfo.linfo.label
66*03831d35Sstevel 
67*03831d35Sstevel typedef frup_info_t	child_info_t;
68*03831d35Sstevel typedef frup_info_t	handles_t;
69*03831d35Sstevel typedef frup_info_t	node_info_t;
70*03831d35Sstevel 
71*03831d35Sstevel /*
72*03831d35Sstevel  *   PICL FRU Hierarchy
73*03831d35Sstevel  *
74*03831d35Sstevel  *	    + frutree
75*03831d35Sstevel  *	    |
76*03831d35Sstevel  *	    +-- safari-node
77*03831d35Sstevel  *		|
78*03831d35Sstevel  *		+-- picl fru node, name = <name> (picl class = fru)
79*03831d35Sstevel  *		|
80*03831d35Sstevel  *		+-- picl location node, name = <name> (picl class = location)
81*03831d35Sstevel  *		|     o optional property slot = <instance>
82*03831d35Sstevel  *		|
83*03831d35Sstevel  *		+-- picl location node, name = <name> (picl class = location)
84*03831d35Sstevel  *		|  |  o optional property slot = <instance>
85*03831d35Sstevel  *		|  |
86*03831d35Sstevel  *		|  +-- picl fru node, name = <name> (picl class = fru)
87*03831d35Sstevel  *		|
88*03831d35Sstevel  *		+-- picl tree sibling +-- picl tree child
89*03831d35Sstevel  *
90*03831d35Sstevel  *
91*03831d35Sstevel  * Request: child_info_t, with parent fru handle and max count
92*03831d35Sstevel  * Receive: child_info_t, with child_info_t array and actual count
93*03831d35Sstevel  */
94*03831d35Sstevel #define	SGFRU_GETCHILDLIST			0x000f
95*03831d35Sstevel /*
96*03831d35Sstevel  * Request: handles_t, with fru handle, max count, and preallocated buffer
97*03831d35Sstevel  * Receive: handles_t, with handle array and actual count
98*03831d35Sstevel  */
99*03831d35Sstevel #define	SGFRU_GETCHILDHANDLES			0x0010
100*03831d35Sstevel /*
101*03831d35Sstevel  * Request: node_info_t, with fru handle
102*03831d35Sstevel  * Receive: node_info_t, with node_t info for the node
103*03831d35Sstevel  */
104*03831d35Sstevel #define	SGFRU_GETNODEINFO			0x0020
105*03831d35Sstevel 
106*03831d35Sstevel #ifdef DEBUG
107*03831d35Sstevel /*
108*03831d35Sstevel  * DESCRIPTION
109*03831d35Sstevel  *   fru_get_children() fills an array of structures representing the
110*03831d35Sstevel  *   children of a node.
111*03831d35Sstevel  *
112*03831d35Sstevel  * ARGUMENTS
113*03831d35Sstevel  *
114*03831d35Sstevel  * RETURN
115*03831d35Sstevel  *   int
116*03831d35Sstevel  *     On success, the number of node_t structures written is returned;
117*03831d35Sstevel  *     on error, -1 is returned and "errno" is set appropriately.
118*03831d35Sstevel  *
119*03831d35Sstevel  * ERRORS
120*03831d35Sstevel  *   ENOMEM
121*03831d35Sstevel  *     The parent FRU has more than "max_children" children.
122*03831d35Sstevel  */
123*03831d35Sstevel int fru_get_children(fru_hdl_t parent, node_t *children, int max_children);
124*03831d35Sstevel 
125*03831d35Sstevel /*
126*03831d35Sstevel  * DESCRIPTION
127*03831d35Sstevel  *   fru_get_handles() fills an array of structures representing the
128*03831d35Sstevel  *   children of a node that have FRUs. Use 0 for the top root node.
129*03831d35Sstevel  *
130*03831d35Sstevel  * ARGUMENTS
131*03831d35Sstevel  *
132*03831d35Sstevel  * RETURN
133*03831d35Sstevel  *   int
134*03831d35Sstevel  *     On success, the number of fru_hdl_t structures written is returned;
135*03831d35Sstevel  *     on error, -1 is returned and "errno" is set appropriately.
136*03831d35Sstevel  *
137*03831d35Sstevel  * ERRORS
138*03831d35Sstevel  *   ENOMEM
139*03831d35Sstevel  *     The parent FRU has more than "max_handles" children.
140*03831d35Sstevel  */
141*03831d35Sstevel int fru_get_handles(fru_hdl_t parent, fru_hdl_t *children, int max_handles);
142*03831d35Sstevel 
143*03831d35Sstevel /*
144*03831d35Sstevel  * DESCRIPTION
145*03831d35Sstevel  *   fru_get_node_info() gets the node_t info for a handle.
146*03831d35Sstevel  *
147*03831d35Sstevel  * ARGUMENTS
148*03831d35Sstevel  *
149*03831d35Sstevel  * RETURN
150*03831d35Sstevel  *   int
151*03831d35Sstevel  *     On success, 0 is returned as well as the node_info;
152*03831d35Sstevel  *     on error, -1 is returned and "errno" is set appropriately.
153*03831d35Sstevel  *
154*03831d35Sstevel  * ERRORS
155*03831d35Sstevel  */
156*03831d35Sstevel int fru_get_node_info(fru_hdl_t node_hdl, node_t *node);
157*03831d35Sstevel #endif /* DEBUG */
158*03831d35Sstevel 
159*03831d35Sstevel #ifdef	__cplusplus
160*03831d35Sstevel }
161*03831d35Sstevel #endif
162*03831d35Sstevel 
163*03831d35Sstevel #endif	/* _SGFRUTREE_H */
164