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