xref: /titanic_44/usr/src/uts/sun/sys/obpdefs.h (revision 781c49dbfbeba15db4c0ec80e381771a0b756ddd)
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 
78 /*
79  * OBP status values defines
80  */
81 #define	OBP_ST_OKAY		"okay"
82 #define	OBP_ST_DISABLED		"disabled"
83 #define	OBP_ST_FAIL		"fail"
84 
85 /*
86  * Max size of a path component and a property name (not value)
87  * These are standard definitions.
88  */
89 #define	OBP_MAXDRVNAME		32	/* defined in P1275 */
90 #define	OBP_MAXPROPNAME		32	/* defined in P1275 */
91 
92 /*
93  * NB: Max pathname length is a platform-dependent parameter.
94  * Also note that this parameter is used to define the crpconfig
95  * structure in cpr.h. The cprconfig structure is currently
96  * consumed by other consolidations. Care should be take before
97  * changing this parameter value.
98  */
99 #define	OBP_MAXPATHLEN		256	/* Platform dependent */
100 
101 /*
102  *  Every OBP node must have a `/' followed by at least 2 chars,
103  *  so we can deduce the maxdepth of any OBP tree to be
104  *  OBP_MAXPATHNAME/3.  This is a good first swag.
105  */
106 
107 #define	OBP_STACKDEPTH		(OBP_MAXPATHLEN/3)
108 
109 #define	ROMVEC_BLKSIZE		512	/* XXX */
110 
111 /*
112  *  OBP Module mailbox messages for MP's
113  *
114  *	00..7F	: power-on self test
115  *
116  *	80..8F	: active in boot prom (at the "ok" prompt)
117  *
118  *	90..EF  : idle in boot prom
119  *
120  *	F0	: active in application
121  *
122  *	F1..FA	: reserved for future use
123  *
124  *	FB	: One processor exited to the PROM via op_exit(),
125  *		  call to prom_stopcpu() requested.
126  *
127  *	FC	: One processor entered the PROM via op_enter(),
128  *		  call to prom_idlecpu() requested.
129  *
130  *	FD	: One processor hit a BREAKPOINT,
131  *		  call to prom_idlecpu() requested.
132  *
133  *	FE	: One processor got a WATCHDOG RESET
134  *		  call to prom_stopcpu() requested.
135  *
136  *	FF	: This processor not available.
137  *
138  */
139 
140 #define	OBP_MB_IDLE_LOW		((unsigned char)(0x90))
141 #define	OBP_MB_IDLE_HIGH	((unsigned char)(0xef))
142 
143 #define	OBP_MB_IS_IDLE(s)	(((s) >= OBP_MB_IDLE_LOW) && \
144 				    ((s) <= OBP_MB_IDLE_HIGH))
145 
146 #define	OBP_MB_ACTIVE		((unsigned char)(0xf0))
147 #define	OBP_MB_EXIT_STOP	((unsigned char)(0xfb))
148 #define	OBP_MB_ENTER_IDLE	((unsigned char)(0xfc))
149 #define	OBP_MB_BRKPT_IDLE	((unsigned char)(0xfd))
150 #define	OBP_MB_WATCHDOG_STOP	((unsigned char)(0xfe))
151 
152 /*
153  * The possible values for "*romp->v_insource" and "*romp->v_outsink" are
154  * listed below.  These may be extended in the future.  Your program should
155  * cope with this gracefully (e.g. by continuing to vector through the ROM
156  * I/O routines if these are set in a way you don't understand).
157  */
158 #define	INKEYB		0	/* Input from parallel keyboard. */
159 #define	INUARTA		1	/* Input or output to Uart A.	*/
160 #define	INUARTB		2	/* Input or output to Uart B.	*/
161 #define	INUARTC		3	/* Input or output to Uart C.	*/
162 #define	INUARTD		4	/* Input or output to Uart D.	*/
163 #define	OUTSCREEN	0	/* Output to frame buffer.	*/
164 #define	OUTUARTA	1	/* Input or output to Uart A.	*/
165 #define	OUTUARTB	2	/* Input or output to Uart B.	*/
166 #define	OUTUARTC	3	/* Input or output to Uart C.	*/
167 #define	OUTUARTD	4	/* Input or output to Uart D.	*/
168 
169 /*
170  * Structure set up by the boot command to pass arguments to the booted
171  * program.
172  */
173 struct bootparam {
174 	char	*bp_argv[8];	/* String arguments.			*/
175 	char	bp_strings[100]; /* String table for string arguments.	*/
176 	char	bp_dev[2];	/* Device name.				*/
177 	int	bp_ctlr;	/* Controller Number.			*/
178 	int	bp_unit;	/* Unit Number.				*/
179 	int	bp_part;	/* Partition/file Number.		*/
180 	char	*bp_name;	/* File name.  Points into "bp_strings"	*/
181 	struct boottab *bp_boottab; /* Points to table entry for device	*/
182 };
183 
184 #ifdef	__cplusplus
185 }
186 #endif
187 
188 #endif	/* _SYS_OBPDEFS_H */
189