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