1.\" Copyright (c) 1992, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This software was developed by the Computer Systems Engineering group 5.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 6.\" contributed to Berkeley. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 3. All advertising materials mentioning features or use of this software 17.\" must display the following acknowledgement: 18.\" This product includes software developed by the University of 19.\" California, Berkeley and its contributors. 20.\" 4. Neither the name of the University nor the names of its contributors 21.\" may be used to endorse or promote products derived from this software 22.\" without specific prior written permission. 23.\" 24.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34.\" SUCH DAMAGE. 35.\" 36.\" from: @(#)openprom.4 8.1 (Berkeley) 6/5/93 37.\" $Id: openprom.4,v 1.1 1994/07/01 20:47:56 deraadt Exp $ 38.\" 39.Dd June 5, 1993 40.Dt OPENPROM 4 sparc 41.Os 42.Sh NAME 43.Nm openprom 44.Nd OPENPROM and EEPROM interface 45.Sh SYNOPSIS 46.Fd #include <machine/openpromio.h> 47.Sh DESCRIPTION 48The file 49.Nm /dev/openprom 50is an interface to the SPARC OPENPROM, 51including the EEPROM area. 52This interface is highly stylized; 53ioctls are used for all operations. 54These ioctls refer to 55.Dq nodes , 56which are simply 57.Dq magic 58integer values describing data areas. 59Occasionally the number 0 may be used or returned instead, 60as described below. 61A special distinguished 62.Dq options 63node holds the EEPROM settings. 64.Pp 65The calls that take and/or return a node 66use a pointer to an 67.Li int 68variable for this purpose; 69others use a pointer to an 70.Li struct opiocdesc 71descriptor, 72which contains a node and two counted strings. 73The first string is comprised of the fields 74.Li op_namelen 75(an 76.Li int ) 77and 78.Li op_name 79(a 80.Li "char *" ) , 81giving the name of a field. 82The second string is comprised of the fields 83.Li op_buflen 84and 85.Li op_buf , 86used analogously. 87These two counted strings work in a 88.Dq value-result 89fashion. 90At entry to the ioctl, 91the counts are expected to reflect the buffer size; 92on return, 93the counts are updated to reflect the buffer contents. 94.Pp 95The following ioctls are supported: 96.Bl -tag -width OPIOCGETOPTNODE 97.It Dv OPIOCGETOPTNODE 98Takes nothing, and fills in the options node number. 99.It OPIOCGETNEXT 100Takes a node number and returns the number of the following node. 101The node following the last node is number 0; 102the node following number 0 is the first node. 103.It Dv OPIOCGETCHILD 104Takes a node number and returns the number of the first 105.Dq child 106of that node. 107This child may have siblings; these can be discovered by using 108.Dv OPIOCGETNEXT . 109.It Dv OPIOCGET 110Fills in the value of the named property for the given node. 111If no such property is associated with that node, 112the value length is set to -1. 113If the named property exists but has no value, 114the value length is set to 0. 115.It Dv OPIOCSET 116Writes the given value under the given name. 117The OPENPROM may refuse this operation; 118in this case 119.Dv EINVAL 120is returned. 121.It Dv OPIOCNEXTPROP 122Finds the property whose name follows the given name 123in OPENPROM internal order. 124The resulting name is returned in the value field. 125If the named property is the last, the 126.Dq next 127name is the empty string. 128As with 129.Dv OPIOCGETNEXT , 130the next name after the empty string is the first name. 131.El 132.Sh FILES 133.Pa /dev/openprom 134.Sh ERRORS 135The following may result in rejection of an operation: 136.Bl -tag -width Er 137.It Bq Er EINVAL 138The given node number 139is not zero 140and does not correspond to any valid node, 141or is zero where zero is not allowed. 142.It Bq Er EBADF 143The requested operation requires permissions not specified at the call to 144.Fn open . 145.It Bq Er ENAMETOOLONG 146The given name or value field 147exceeds the maximum allowed length (8191 bytes). 148.El 149.Sh SEE ALSO 150.Xr ioctl 2 151.Sh BUGS 152Due to limitations within the OPENPROM itself, 153these functions run at elevated priority 154and may adversely affect system performance. 155