xref: /titanic_50/usr/src/uts/sun/sys/obpdefs.h (revision 0a47c91c895e274dd0990009919e30e984364a8b)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_OBPDEFS_H
27 #define	_SYS_OBPDEFS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	OBP_PSEUDO_ROMVEC_VERSION	5555
36 
37 typedef	int		ihandle_t;
38 typedef	int		phandle_t;
39 typedef	phandle_t	pnode_t;
40 
41 /*
42  * Device type matching
43  */
44 
45 #define	OBP_NONODE	((pnode_t)0)
46 #define	OBP_BADNODE	((pnode_t)-1)
47 
48 /*
49  * Property Defines
50  */
51 
52 #define	OBP_NAME		"name"
53 #define	OBP_REG			"reg"
54 #define	OBP_INTR		"intr"
55 #define	OBP_RANGES		"ranges"
56 #define	OBP_INTERRUPTS		"interrupts"
57 #define	OBP_COMPATIBLE		"compatible"
58 #define	OBP_STATUS		"status"
59 #define	OBP_BOARDNUM		"board#"
60 
61 #define	OBP_MAC_ADDR		"mac-address"
62 #define	OBP_STDINPATH		"stdin-path"
63 #define	OBP_STDOUTPATH		"stdout-path"
64 #define	OBP_IDPROM		"idprom"
65 
66 #define	OBP_DEVICETYPE		"device_type"
67 #define	OBP_DISPLAY		"display"
68 #define	OBP_DISPLAY_CONSOLE	"console"
69 #define	OBP_NETWORK		"network"
70 #define	OBP_BYTE		"byte"
71 #define	OBP_BLOCK		"block"
72 #define	OBP_SERIAL		"serial"
73 #define	OBP_HIERARCHICAL	"hierarchical"
74 #define	OBP_IPI			"ipi3"
75 #define	OBP_CPU			"cpu"
76 #define	OBP_ADDRESS		"address"
77 #define	OBP_SIZE		"size"
78 #define	OBP_ALLOCSIZE		"alloc-size"
79 
80 /*
81  * OBP status values defines
82  */
83 #define	OBP_ST_OKAY		"okay"
84 #define	OBP_ST_DISABLED		"disabled"
85 #define	OBP_ST_FAIL		"fail"
86 
87 /*
88  * Max size of a path component and a property name (not value)
89  * These are standard definitions.
90  */
91 #define	OBP_MAXDRVNAME		32	/* defined in P1275 */
92 #define	OBP_MAXPROPNAME		32	/* defined in P1275 */
93 
94 /*
95  * NB: Max pathname length is a platform-dependent parameter.
96  * Also note that this parameter is used to define the crpconfig
97  * structure in cpr.h. The cprconfig structure is currently
98  * consumed by other consolidations. Care should be take before
99  * changing this parameter value.
100  */
101 #define	OBP_MAXPATHLEN		256	/* Platform dependent */
102 
103 /*
104  *  Every OBP node must have a `/' followed by at least 2 chars,
105  *  so we can deduce the maxdepth of any OBP tree to be
106  *  OBP_MAXPATHNAME/3.  This is a good first swag.
107  */
108 
109 #define	OBP_STACKDEPTH		(OBP_MAXPATHLEN/3)
110 
111 #define	ROMVEC_BLKSIZE		512	/* XXX */
112 
113 /*
114  *  OBP Module mailbox messages for MP's
115  *
116  *	00..7F	: power-on self test
117  *
118  *	80..8F	: active in boot prom (at the "ok" prompt)
119  *
120  *	90..EF  : idle in boot prom
121  *
122  *	F0	: active in application
123  *
124  *	F1..FA	: reserved for future use
125  *
126  *	FB	: One processor exited to the PROM via op_exit(),
127  *		  call to prom_stopcpu() requested.
128  *
129  *	FC	: One processor entered the PROM via op_enter(),
130  *		  call to prom_idlecpu() requested.
131  *
132  *	FD	: One processor hit a BREAKPOINT,
133  *		  call to prom_idlecpu() requested.
134  *
135  *	FE	: One processor got a WATCHDOG RESET
136  *		  call to prom_stopcpu() requested.
137  *
138  *	FF	: This processor not available.
139  *
140  */
141 
142 #define	OBP_MB_IDLE_LOW		((unsigned char)(0x90))
143 #define	OBP_MB_IDLE_HIGH	((unsigned char)(0xef))
144 
145 #define	OBP_MB_IS_IDLE(s)	(((s) >= OBP_MB_IDLE_LOW) && \
146 				    ((s) <= OBP_MB_IDLE_HIGH))
147 
148 #define	OBP_MB_ACTIVE		((unsigned char)(0xf0))
149 #define	OBP_MB_EXIT_STOP	((unsigned char)(0xfb))
150 #define	OBP_MB_ENTER_IDLE	((unsigned char)(0xfc))
151 #define	OBP_MB_BRKPT_IDLE	((unsigned char)(0xfd))
152 #define	OBP_MB_WATCHDOG_STOP	((unsigned char)(0xfe))
153 
154 /*
155  * The possible values for "*romp->v_insource" and "*romp->v_outsink" are
156  * listed below.  These may be extended in the future.  Your program should
157  * cope with this gracefully (e.g. by continuing to vector through the ROM
158  * I/O routines if these are set in a way you don't understand).
159  */
160 #define	INKEYB		0	/* Input from parallel keyboard. */
161 #define	INUARTA		1	/* Input or output to Uart A.	*/
162 #define	INUARTB		2	/* Input or output to Uart B.	*/
163 #define	INUARTC		3	/* Input or output to Uart C.	*/
164 #define	INUARTD		4	/* Input or output to Uart D.	*/
165 #define	OUTSCREEN	0	/* Output to frame buffer.	*/
166 #define	OUTUARTA	1	/* Input or output to Uart A.	*/
167 #define	OUTUARTB	2	/* Input or output to Uart B.	*/
168 #define	OUTUARTC	3	/* Input or output to Uart C.	*/
169 #define	OUTUARTD	4	/* Input or output to Uart D.	*/
170 
171 /*
172  * Structure set up by the boot command to pass arguments to the booted
173  * program.
174  */
175 struct bootparam {
176 	char	*bp_argv[8];	/* String arguments.			*/
177 	char	bp_strings[100]; /* String table for string arguments.	*/
178 	char	bp_dev[2];	/* Device name.				*/
179 	int	bp_ctlr;	/* Controller Number.			*/
180 	int	bp_unit;	/* Unit Number.				*/
181 	int	bp_part;	/* Partition/file Number.		*/
182 	char	*bp_name;	/* File name.  Points into "bp_strings"	*/
183 	struct boottab *bp_boottab; /* Points to table entry for device	*/
184 };
185 
186 #ifdef	__cplusplus
187 }
188 #endif
189 
190 #endif	/* _SYS_OBPDEFS_H */
191