xref: /titanic_51/usr/src/uts/common/sys/openpromio.h (revision 3b133bec939f5230f040960ee1503dadd3dff343)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3b133becSGangadhar Mylapuram  * Common Development and Distribution License (the "License").
6*3b133becSGangadhar Mylapuram  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*3b133becSGangadhar Mylapuram  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_OPENPROMIO_H
277c478bd9Sstevel@tonic-gate #define	_SYS_OPENPROMIO_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /* From SunOS 4.1.1 <sundev/openpromio.h> */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * XXX HACK ALERT
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * You might think that this interface could support setting non-ASCII
397c478bd9Sstevel@tonic-gate  * property values.  Unfortunately the 4.0.3c openprom driver SETOPT
407c478bd9Sstevel@tonic-gate  * code ignores oprom_size and uses strlen() to compute the length of
417c478bd9Sstevel@tonic-gate  * the value.  The 4.0.3c openprom eeprom command makes its contribution
427c478bd9Sstevel@tonic-gate  * by not setting oprom_size to anything meaningful.  So, if we want the
437c478bd9Sstevel@tonic-gate  * driver to trust oprom_size we have to use SETOPT2.  XXX.
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate struct openpromio {
467c478bd9Sstevel@tonic-gate 	uint_t	oprom_size;		/* real size of following array */
477c478bd9Sstevel@tonic-gate 	union {
487c478bd9Sstevel@tonic-gate 		char	b[1];		/* For property names and values */
497c478bd9Sstevel@tonic-gate 					/* NB: Adjacent, Null terminated */
507c478bd9Sstevel@tonic-gate 		int	i;
517c478bd9Sstevel@tonic-gate 	} opio_u;
527c478bd9Sstevel@tonic-gate };
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #define	oprom_array	opio_u.b
557c478bd9Sstevel@tonic-gate #define	oprom_node	opio_u.i
567c478bd9Sstevel@tonic-gate #define	oprom_len	opio_u.i
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
597c478bd9Sstevel@tonic-gate  * OPROMMAXPARAM is used as a limit by the driver, and it has been
607c478bd9Sstevel@tonic-gate  * increased to be 4 times the largest possible size of a property,
617c478bd9Sstevel@tonic-gate  * which is 8K (nvramrc property).
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate #define	OPROMMAXPARAM	32768		/* max size of array */
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate  * Note that all OPROM ioctl codes are type void. Since the amount
677c478bd9Sstevel@tonic-gate  * of data copied in/out may (and does) vary, the openprom driver
687c478bd9Sstevel@tonic-gate  * handles the copyin/copyout itself.
697c478bd9Sstevel@tonic-gate  */
707c478bd9Sstevel@tonic-gate #define	OIOC	('O'<<8)
717c478bd9Sstevel@tonic-gate #define	OPROMGETOPT	(OIOC | 1)
727c478bd9Sstevel@tonic-gate #define	OPROMSETOPT	(OIOC | 2)
737c478bd9Sstevel@tonic-gate #define	OPROMNXTOPT	(OIOC | 3)
747c478bd9Sstevel@tonic-gate #define	OPROMSETOPT2	(OIOC | 4)	/* working OPROMSETOPT */
757c478bd9Sstevel@tonic-gate #define	OPROMNEXT	(OIOC | 5)	/* interface to raw config_ops */
767c478bd9Sstevel@tonic-gate #define	OPROMCHILD	(OIOC | 6)	/* interface to raw config_ops */
777c478bd9Sstevel@tonic-gate #define	OPROMGETPROP	(OIOC | 7)	/* interface to raw config_ops */
787c478bd9Sstevel@tonic-gate #define	OPROMNXTPROP	(OIOC | 8)	/* interface to raw config_ops */
797c478bd9Sstevel@tonic-gate #define	OPROMU2P	(OIOC | 9)	/* NOT SUPPORTED after 4.x */
807c478bd9Sstevel@tonic-gate #define	OPROMGETCONS	(OIOC | 10)	/* enquire which console device */
817c478bd9Sstevel@tonic-gate #define	OPROMGETFBNAME	(OIOC | 11)	/* Frame buffer OBP pathname */
827c478bd9Sstevel@tonic-gate #define	OPROMGETBOOTARGS (OIOC | 12)	/* Get boot arguments */
837c478bd9Sstevel@tonic-gate #define	OPROMGETVERSION	(OIOC | 13)	/* Get OpenProm Version string */
847c478bd9Sstevel@tonic-gate #define	OPROMPATH2DRV	(OIOC | 14)	/* Convert prom path to driver name */
857c478bd9Sstevel@tonic-gate #define	OPROMDEV2PROMNAME (OIOC | 15)	/* Convert devfs path to prom path */
867c478bd9Sstevel@tonic-gate #define	OPROMPROM2DEVNAME (OIOC | 16)	/* Convert devfs path to prom path */
877c478bd9Sstevel@tonic-gate #define	OPROMGETPROPLEN	(OIOC | 17)	/* interface to raw config_ops */
887c478bd9Sstevel@tonic-gate #define	OPROMREADY64	(OIOC | 18)	/* is prom 64-bit ready? */
897c478bd9Sstevel@tonic-gate #define	OPROMSETNODEID	(OIOC | 19)	/* set current node_id */
907c478bd9Sstevel@tonic-gate #define	OPROMSNAPSHOT	(OIOC | 20)	/* create a snapshot */
917c478bd9Sstevel@tonic-gate #define	OPROMCOPYOUT	(OIOC | 21)	/* copyout and free snapshot */
927c478bd9Sstevel@tonic-gate #define	OPROMLISTKEYS	(OIOC | 22)	/* asr-list-keys */
937c478bd9Sstevel@tonic-gate #define	OPROMLISTKEYSLEN (OIOC | 23)	/* asr-list-keys-len */
947c478bd9Sstevel@tonic-gate #define	OPROMEXPORT	(OIOC | 24)	/* asr-export */
957c478bd9Sstevel@tonic-gate #define	OPROMEXPORTLEN	(OIOC | 25)	/* asr-export-len */
96*3b133becSGangadhar Mylapuram #define	OPROMGETBOOTPATH	(OIOC | 26)	/* Get bootpath */
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * Return values from OPROMGETCONS:
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate #define	OPROMCONS_NOT_WSCONS	0
1037c478bd9Sstevel@tonic-gate #define	OPROMCONS_STDIN_IS_KBD	0x1	/* stdin device is kbd */
1047c478bd9Sstevel@tonic-gate #define	OPROMCONS_STDOUT_IS_FB	0x2	/* stdout is a framebuffer */
1057c478bd9Sstevel@tonic-gate #define	OPROMCONS_OPENPROM	0x4	/* supports openboot */
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #if defined(__sparc)
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /*
1107c478bd9Sstevel@tonic-gate  * Data structure returned in oprom_array, from OPROMREADY64:
1117c478bd9Sstevel@tonic-gate  *
1127c478bd9Sstevel@tonic-gate  * With return codes 1 and 2, also returns nodeid, a nodeid
1137c478bd9Sstevel@tonic-gate  * of a flashprom node, and a message string with the minimum version
1147c478bd9Sstevel@tonic-gate  * requirement for this platform.
1157c478bd9Sstevel@tonic-gate  */
1167c478bd9Sstevel@tonic-gate struct openprom_opr64 {
1177c478bd9Sstevel@tonic-gate 	int return_code;		/* See below */
1187c478bd9Sstevel@tonic-gate 	int nodeid;			/* Valid with positive return codes */
1197c478bd9Sstevel@tonic-gate 	char message[1];		/* NULL terminated message string */
1207c478bd9Sstevel@tonic-gate };
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate /*
1237c478bd9Sstevel@tonic-gate  * return_code values from OPROMREADY64:
1247c478bd9Sstevel@tonic-gate  */
1257c478bd9Sstevel@tonic-gate #define	OP64R_READY			0	/* ready or not applicable */
1267c478bd9Sstevel@tonic-gate #define	OP64R_UPGRADE_REQUIRED		1	/* Upgrade required */
1277c478bd9Sstevel@tonic-gate #define	OP64R_UPGRADE_RECOMMENDED 	2	/* Upgrade recommended */
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate #endif
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1327c478bd9Sstevel@tonic-gate }
1337c478bd9Sstevel@tonic-gate #endif
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate #endif	/* _SYS_OPENPROMIO_H */
136