xref: /onnv-gate/usr/src/uts/common/sys/openpromio.h (revision 11906:6743277598ac)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*11906SGangadhar.M@Sun.COM  * Common Development and Distribution License (the "License").
6*11906SGangadhar.M@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11906SGangadhar.M@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_OPENPROMIO_H
270Sstevel@tonic-gate #define	_SYS_OPENPROMIO_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /* From SunOS 4.1.1 <sundev/openpromio.h> */
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * XXX HACK ALERT
370Sstevel@tonic-gate  *
380Sstevel@tonic-gate  * You might think that this interface could support setting non-ASCII
390Sstevel@tonic-gate  * property values.  Unfortunately the 4.0.3c openprom driver SETOPT
400Sstevel@tonic-gate  * code ignores oprom_size and uses strlen() to compute the length of
410Sstevel@tonic-gate  * the value.  The 4.0.3c openprom eeprom command makes its contribution
420Sstevel@tonic-gate  * by not setting oprom_size to anything meaningful.  So, if we want the
430Sstevel@tonic-gate  * driver to trust oprom_size we have to use SETOPT2.  XXX.
440Sstevel@tonic-gate  */
450Sstevel@tonic-gate struct openpromio {
460Sstevel@tonic-gate 	uint_t	oprom_size;		/* real size of following array */
470Sstevel@tonic-gate 	union {
480Sstevel@tonic-gate 		char	b[1];		/* For property names and values */
490Sstevel@tonic-gate 					/* NB: Adjacent, Null terminated */
500Sstevel@tonic-gate 		int	i;
510Sstevel@tonic-gate 	} opio_u;
520Sstevel@tonic-gate };
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #define	oprom_array	opio_u.b
550Sstevel@tonic-gate #define	oprom_node	opio_u.i
560Sstevel@tonic-gate #define	oprom_len	opio_u.i
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
590Sstevel@tonic-gate  * OPROMMAXPARAM is used as a limit by the driver, and it has been
600Sstevel@tonic-gate  * increased to be 4 times the largest possible size of a property,
610Sstevel@tonic-gate  * which is 8K (nvramrc property).
620Sstevel@tonic-gate  */
630Sstevel@tonic-gate #define	OPROMMAXPARAM	32768		/* max size of array */
640Sstevel@tonic-gate 
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate  * Note that all OPROM ioctl codes are type void. Since the amount
670Sstevel@tonic-gate  * of data copied in/out may (and does) vary, the openprom driver
680Sstevel@tonic-gate  * handles the copyin/copyout itself.
690Sstevel@tonic-gate  */
700Sstevel@tonic-gate #define	OIOC	('O'<<8)
710Sstevel@tonic-gate #define	OPROMGETOPT	(OIOC | 1)
720Sstevel@tonic-gate #define	OPROMSETOPT	(OIOC | 2)
730Sstevel@tonic-gate #define	OPROMNXTOPT	(OIOC | 3)
740Sstevel@tonic-gate #define	OPROMSETOPT2	(OIOC | 4)	/* working OPROMSETOPT */
750Sstevel@tonic-gate #define	OPROMNEXT	(OIOC | 5)	/* interface to raw config_ops */
760Sstevel@tonic-gate #define	OPROMCHILD	(OIOC | 6)	/* interface to raw config_ops */
770Sstevel@tonic-gate #define	OPROMGETPROP	(OIOC | 7)	/* interface to raw config_ops */
780Sstevel@tonic-gate #define	OPROMNXTPROP	(OIOC | 8)	/* interface to raw config_ops */
790Sstevel@tonic-gate #define	OPROMU2P	(OIOC | 9)	/* NOT SUPPORTED after 4.x */
800Sstevel@tonic-gate #define	OPROMGETCONS	(OIOC | 10)	/* enquire which console device */
810Sstevel@tonic-gate #define	OPROMGETFBNAME	(OIOC | 11)	/* Frame buffer OBP pathname */
820Sstevel@tonic-gate #define	OPROMGETBOOTARGS (OIOC | 12)	/* Get boot arguments */
830Sstevel@tonic-gate #define	OPROMGETVERSION	(OIOC | 13)	/* Get OpenProm Version string */
840Sstevel@tonic-gate #define	OPROMPATH2DRV	(OIOC | 14)	/* Convert prom path to driver name */
850Sstevel@tonic-gate #define	OPROMDEV2PROMNAME (OIOC | 15)	/* Convert devfs path to prom path */
860Sstevel@tonic-gate #define	OPROMPROM2DEVNAME (OIOC | 16)	/* Convert devfs path to prom path */
870Sstevel@tonic-gate #define	OPROMGETPROPLEN	(OIOC | 17)	/* interface to raw config_ops */
880Sstevel@tonic-gate #define	OPROMREADY64	(OIOC | 18)	/* is prom 64-bit ready? */
890Sstevel@tonic-gate #define	OPROMSETNODEID	(OIOC | 19)	/* set current node_id */
900Sstevel@tonic-gate #define	OPROMSNAPSHOT	(OIOC | 20)	/* create a snapshot */
910Sstevel@tonic-gate #define	OPROMCOPYOUT	(OIOC | 21)	/* copyout and free snapshot */
920Sstevel@tonic-gate #define	OPROMLISTKEYS	(OIOC | 22)	/* asr-list-keys */
930Sstevel@tonic-gate #define	OPROMLISTKEYSLEN (OIOC | 23)	/* asr-list-keys-len */
940Sstevel@tonic-gate #define	OPROMEXPORT	(OIOC | 24)	/* asr-export */
950Sstevel@tonic-gate #define	OPROMEXPORTLEN	(OIOC | 25)	/* asr-export-len */
96*11906SGangadhar.M@Sun.COM #define	OPROMGETBOOTPATH	(OIOC | 26)	/* Get bootpath */
970Sstevel@tonic-gate 
980Sstevel@tonic-gate /*
990Sstevel@tonic-gate  * Return values from OPROMGETCONS:
1000Sstevel@tonic-gate  */
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #define	OPROMCONS_NOT_WSCONS	0
1030Sstevel@tonic-gate #define	OPROMCONS_STDIN_IS_KBD	0x1	/* stdin device is kbd */
1040Sstevel@tonic-gate #define	OPROMCONS_STDOUT_IS_FB	0x2	/* stdout is a framebuffer */
1050Sstevel@tonic-gate #define	OPROMCONS_OPENPROM	0x4	/* supports openboot */
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate #if defined(__sparc)
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate /*
1100Sstevel@tonic-gate  * Data structure returned in oprom_array, from OPROMREADY64:
1110Sstevel@tonic-gate  *
1120Sstevel@tonic-gate  * With return codes 1 and 2, also returns nodeid, a nodeid
1130Sstevel@tonic-gate  * of a flashprom node, and a message string with the minimum version
1140Sstevel@tonic-gate  * requirement for this platform.
1150Sstevel@tonic-gate  */
1160Sstevel@tonic-gate struct openprom_opr64 {
1170Sstevel@tonic-gate 	int return_code;		/* See below */
1180Sstevel@tonic-gate 	int nodeid;			/* Valid with positive return codes */
1190Sstevel@tonic-gate 	char message[1];		/* NULL terminated message string */
1200Sstevel@tonic-gate };
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate /*
1230Sstevel@tonic-gate  * return_code values from OPROMREADY64:
1240Sstevel@tonic-gate  */
1250Sstevel@tonic-gate #define	OP64R_READY			0	/* ready or not applicable */
1260Sstevel@tonic-gate #define	OP64R_UPGRADE_REQUIRED		1	/* Upgrade required */
1270Sstevel@tonic-gate #define	OP64R_UPGRADE_RECOMMENDED 	2	/* Upgrade recommended */
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate #endif
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate #ifdef __cplusplus
1320Sstevel@tonic-gate }
1330Sstevel@tonic-gate #endif
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate #endif	/* _SYS_OPENPROMIO_H */
136