summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/lw8/sys/sgfrutree.h
blob: 77d8cb7f57b8445913d31ceb31eb4d74e91c94c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2000 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _SGFRUTREE_H
#define	_SGFRUTREE_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

#include <sys/types.h>
#include <sys/sgfru.h>

#define	ROOTPARENT		0		/* well-known node value */
#define	MAX_NODE_CHILDREN	16		/* hint */
#define	MAX_NODE_NAME		16		/* max name size */

/*
 * PICL classes used by serengeti sgfrutree
 */
#define	TEMP_CLASS		0x0		/* currently unused */
#define	FRU_CLASS		0x1		/* fru class */
#define	LOCATION_CLASS		0x2		/* location class */
#define	PSEUDO_FRU_CLASS	0x3		/* fru class with no seeprom */

typedef struct {
	fru_hdl_t	handle;			/* (container) handle */
	char		nodename[MAX_NODE_NAME]; /* picl nodename, thing name */
	int16_t		has_children;		/* hint if node has children */
	uint16_t	class;			/* one of the picl classes */
	union class_info {
	    struct location_info {
		int16_t	slot;			/* location: valid slot or -1 */
		char	label[MAX_NODE_NAME];	/* label property, place name */
	    } linfo;
	} cinfo;
} node_t;

#define	location_slot	cinfo.linfo.slot
#define	location_label	cinfo.linfo.label

typedef frup_info_t	child_info_t;
typedef frup_info_t	handles_t;
typedef frup_info_t	node_info_t;

/*
 *   PICL FRU Hierarchy
 *
 *	    + frutree
 *	    |
 *	    +-- safari-node
 *		|
 *		+-- picl fru node, name = <name> (picl class = fru)
 *		|
 *		+-- picl location node, name = <name> (picl class = location)
 *		|     o optional property slot = <instance>
 *		|
 *		+-- picl location node, name = <name> (picl class = location)
 *		|  |  o optional property slot = <instance>
 *		|  |
 *		|  +-- picl fru node, name = <name> (picl class = fru)
 *		|
 *		+-- picl tree sibling +-- picl tree child
 *
 *
 * Request: child_info_t, with parent fru handle and max count
 * Receive: child_info_t, with child_info_t array and actual count
 */
#define	SGFRU_GETCHILDLIST			0x000f
/*
 * Request: handles_t, with fru handle, max count, and preallocated buffer
 * Receive: handles_t, with handle array and actual count
 */
#define	SGFRU_GETCHILDHANDLES			0x0010
/*
 * Request: node_info_t, with fru handle
 * Receive: node_info_t, with node_t info for the node
 */
#define	SGFRU_GETNODEINFO			0x0020

#ifdef DEBUG
/*
 * DESCRIPTION
 *   fru_get_children() fills an array of structures representing the
 *   children of a node.
 *
 * ARGUMENTS
 *
 * RETURN
 *   int
 *     On success, the number of node_t structures written is returned;
 *     on error, -1 is returned and "errno" is set appropriately.
 *
 * ERRORS
 *   ENOMEM
 *     The parent FRU has more than "max_children" children.
 */
int fru_get_children(fru_hdl_t parent, node_t *children, int max_children);

/*
 * DESCRIPTION
 *   fru_get_handles() fills an array of structures representing the
 *   children of a node that have FRUs. Use 0 for the top root node.
 *
 * ARGUMENTS
 *
 * RETURN
 *   int
 *     On success, the number of fru_hdl_t structures written is returned;
 *     on error, -1 is returned and "errno" is set appropriately.
 *
 * ERRORS
 *   ENOMEM
 *     The parent FRU has more than "max_handles" children.
 */
int fru_get_handles(fru_hdl_t parent, fru_hdl_t *children, int max_handles);

/*
 * DESCRIPTION
 *   fru_get_node_info() gets the node_t info for a handle.
 *
 * ARGUMENTS
 *
 * RETURN
 *   int
 *     On success, 0 is returned as well as the node_info;
 *     on error, -1 is returned and "errno" is set appropriately.
 *
 * ERRORS
 */
int fru_get_node_info(fru_hdl_t node_hdl, node_t *node);
#endif /* DEBUG */

#ifdef	__cplusplus
}
#endif

#endif	/* _SGFRUTREE_H */