xref: /titanic_41/usr/src/uts/common/sys/openpromio.h (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1989-2000, 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_OPENPROMIO_H
28 #define	_SYS_OPENPROMIO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 /* From SunOS 4.1.1 <sundev/openpromio.h> */
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * XXX HACK ALERT
39  *
40  * You might think that this interface could support setting non-ASCII
41  * property values.  Unfortunately the 4.0.3c openprom driver SETOPT
42  * code ignores oprom_size and uses strlen() to compute the length of
43  * the value.  The 4.0.3c openprom eeprom command makes its contribution
44  * by not setting oprom_size to anything meaningful.  So, if we want the
45  * driver to trust oprom_size we have to use SETOPT2.  XXX.
46  */
47 struct openpromio {
48 	uint_t	oprom_size;		/* real size of following array */
49 	union {
50 		char	b[1];		/* For property names and values */
51 					/* NB: Adjacent, Null terminated */
52 		int	i;
53 	} opio_u;
54 };
55 
56 #define	oprom_array	opio_u.b
57 #define	oprom_node	opio_u.i
58 #define	oprom_len	opio_u.i
59 
60 /*
61  * OPROMMAXPARAM is used as a limit by the driver, and it has been
62  * increased to be 4 times the largest possible size of a property,
63  * which is 8K (nvramrc property).
64  */
65 #define	OPROMMAXPARAM	32768		/* max size of array */
66 
67 /*
68  * Note that all OPROM ioctl codes are type void. Since the amount
69  * of data copied in/out may (and does) vary, the openprom driver
70  * handles the copyin/copyout itself.
71  */
72 #define	OIOC	('O'<<8)
73 #define	OPROMGETOPT	(OIOC | 1)
74 #define	OPROMSETOPT	(OIOC | 2)
75 #define	OPROMNXTOPT	(OIOC | 3)
76 #define	OPROMSETOPT2	(OIOC | 4)	/* working OPROMSETOPT */
77 #define	OPROMNEXT	(OIOC | 5)	/* interface to raw config_ops */
78 #define	OPROMCHILD	(OIOC | 6)	/* interface to raw config_ops */
79 #define	OPROMGETPROP	(OIOC | 7)	/* interface to raw config_ops */
80 #define	OPROMNXTPROP	(OIOC | 8)	/* interface to raw config_ops */
81 #define	OPROMU2P	(OIOC | 9)	/* NOT SUPPORTED after 4.x */
82 #define	OPROMGETCONS	(OIOC | 10)	/* enquire which console device */
83 #define	OPROMGETFBNAME	(OIOC | 11)	/* Frame buffer OBP pathname */
84 #define	OPROMGETBOOTARGS (OIOC | 12)	/* Get boot arguments */
85 #define	OPROMGETVERSION	(OIOC | 13)	/* Get OpenProm Version string */
86 #define	OPROMPATH2DRV	(OIOC | 14)	/* Convert prom path to driver name */
87 #define	OPROMDEV2PROMNAME (OIOC | 15)	/* Convert devfs path to prom path */
88 #define	OPROMPROM2DEVNAME (OIOC | 16)	/* Convert devfs path to prom path */
89 #define	OPROMGETPROPLEN	(OIOC | 17)	/* interface to raw config_ops */
90 #define	OPROMREADY64	(OIOC | 18)	/* is prom 64-bit ready? */
91 #define	OPROMSETNODEID	(OIOC | 19)	/* set current node_id */
92 #define	OPROMSNAPSHOT	(OIOC | 20)	/* create a snapshot */
93 #define	OPROMCOPYOUT	(OIOC | 21)	/* copyout and free snapshot */
94 #define	OPROMLISTKEYS	(OIOC | 22)	/* asr-list-keys */
95 #define	OPROMLISTKEYSLEN (OIOC | 23)	/* asr-list-keys-len */
96 #define	OPROMEXPORT	(OIOC | 24)	/* asr-export */
97 #define	OPROMEXPORTLEN	(OIOC | 25)	/* asr-export-len */
98 
99 /*
100  * Return values from OPROMGETCONS:
101  */
102 
103 #define	OPROMCONS_NOT_WSCONS	0
104 #define	OPROMCONS_STDIN_IS_KBD	0x1	/* stdin device is kbd */
105 #define	OPROMCONS_STDOUT_IS_FB	0x2	/* stdout is a framebuffer */
106 #define	OPROMCONS_OPENPROM	0x4	/* supports openboot */
107 
108 #if defined(__sparc)
109 
110 /*
111  * Data structure returned in oprom_array, from OPROMREADY64:
112  *
113  * With return codes 1 and 2, also returns nodeid, a nodeid
114  * of a flashprom node, and a message string with the minimum version
115  * requirement for this platform.
116  */
117 struct openprom_opr64 {
118 	int return_code;		/* See below */
119 	int nodeid;			/* Valid with positive return codes */
120 	char message[1];		/* NULL terminated message string */
121 };
122 
123 /*
124  * return_code values from OPROMREADY64:
125  */
126 #define	OP64R_READY			0	/* ready or not applicable */
127 #define	OP64R_UPGRADE_REQUIRED		1	/* Upgrade required */
128 #define	OP64R_UPGRADE_RECOMMENDED 	2	/* Upgrade recommended */
129 
130 #endif
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif	/* _SYS_OPENPROMIO_H */
137