1*58031Storek.\" Copyright (c) 1992 The Regents of the University of California.
2*58031Storek.\" All rights reserved.
3*58031Storek.\"
4*58031Storek.\" This software was developed by the Computer Systems Engineering group
5*58031Storek.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
6*58031Storek.\" contributed to Berkeley.
7*58031Storek.\"
8*58031Storek.\" %sccs.include.redist.man%
9*58031Storek.\"
10*58031Storek.\"     @(#)openprom.4	5.1 (Berkeley) 02/17/93
11*58031Storek.\"
12*58031Storek.Dd
13*58031Storek.Dt OPENPROM 4 sparc
14*58031Storek.Os
15*58031Storek.Sh NAME
16*58031Storek.Nm openprom
17*58031Storek.Nd OPENPROM and EEPROM interface
18*58031Storek.Sh SYNOPSIS
19*58031Storek.Fd #include <machine/openpromio.h>
20*58031Storek.Sh DESCRIPTION
21*58031StorekThe file
22*58031Storek.Nm /dev/openprom
23*58031Storekis an interface to the SPARC OPENPROM,
24*58031Storekincluding the EEPROM area.
25*58031StorekThis interface is highly stylized;
26*58031Storekioctls are used for all operations.
27*58031StorekThese ioctls refer to
28*58031Storek.Dq nodes ,
29*58031Storekwhich are simply
30*58031Storek.Dq magic
31*58031Storekinteger values describing data areas.
32*58031StorekOccasionally the number 0 may be used or returned instead,
33*58031Storekas described below.
34*58031StorekA special distinguished
35*58031Storek.Dq options
36*58031Storeknode holds the EEPROM settings.
37*58031Storek.Pp
38*58031StorekThe calls that take and/or return a node
39*58031Storekuse a pointer to an
40*58031Storek.Li int
41*58031Storekvariable for this purpose;
42*58031Storekothers use a pointer to an
43*58031Storek.Li struct opiocdesc
44*58031Storekdescriptor,
45*58031Storekwhich contains a node and two counted strings.
46*58031StorekThe first string is comprised of the fields
47*58031Storek.Li op_namelen
48*58031Storek(an
49*58031Storek.Li int )
50*58031Storekand
51*58031Storek.Li op_name
52*58031Storek(a
53*58031Storek.Li "char *" ) ,
54*58031Storekgiving the name of a field.
55*58031StorekThe second string is comprised of the fields
56*58031Storek.Li op_buflen
57*58031Storekand
58*58031Storek.Li op_buf ,
59*58031Storekused analogously.
60*58031StorekThese two counted strings work in a
61*58031Storek.Dq value-result
62*58031Storekfashion.
63*58031StorekAt entry to the ioctl,
64*58031Storekthe counts are expected to reflect the buffer size;
65*58031Storekon return,
66*58031Storekthe counts are updated to reflect the buffer contents.
67*58031Storek.Pp
68*58031StorekThe following ioctls are supported:
69*58031Storek.Bl -tag -width OPIOCGETOPTNODE
70*58031Storek.It Dv OPIOCGETOPTNODE
71*58031StorekTakes nothing, and fills in the options node number.
72*58031Storek.It OPIOCGETNEXT
73*58031StorekTakes a node number and returns the number of the following node.
74*58031StorekThe node following the last node is number 0;
75*58031Storekthe node following number 0 is the first node.
76*58031Storek.It Dv OPIOCGETCHILD
77*58031StorekTakes a node number and returns the number of the first
78*58031Storek.Dq child
79*58031Storekof that node.
80*58031StorekThis child may have siblings; these can be discovered by using
81*58031Storek.Dv OPIOCGETNEXT .
82*58031Storek.It Dv OPIOCGET
83*58031StorekFills in the value of the named property for the given node.
84*58031StorekIf no such property is associated with that node,
85*58031Storekthe value length is set to -1.
86*58031StorekIf the named property exists but has no value,
87*58031Storekthe value length is set to 0.
88*58031Storek.It Dv OPIOCSET
89*58031StorekWrites the given value under the given name.
90*58031StorekThe OPENPROM may refuse this operation;
91*58031Storekin this case
92*58031Storek.Dv EINVAL
93*58031Storekis returned.
94*58031Storek.It Dv OPIOCNEXTPROP
95*58031StorekFinds the property whose name follows the given name
96*58031Storekin OPENPROM internal order.
97*58031StorekThe resulting name is returned in the value field.
98*58031StorekIf the named property is the last, the
99*58031Storek.Dq next
100*58031Storekname is the empty string.
101*58031StorekAs with
102*58031Storek.Dv OPIOCGETNEXT ,
103*58031Storekthe next name after the empty string is the first name.
104*58031Storek.El
105*58031Storek.Sh FILES
106*58031Storek.Pa /dev/openprom
107*58031Storek.Sh ERRORS
108*58031StorekThe following may result in rejection of an operation:
109*58031Storek.Bl -tag -width Er
110*58031Storek.It Bq Er EINVAL
111*58031StorekThe given node number
112*58031Storekis not zero
113*58031Storekand does not correspond to any valid node,
114*58031Storekor is zero where zero is not allowed.
115*58031Storek.It Bq Er EBADF
116*58031StorekThe requested operation requires permissions not specified at the call to
117*58031Storek.Fn open .
118*58031Storek.It Bq Er ENAMETOOLONG
119*58031StorekThe given name or value field
120*58031Storekexceeds the maximum allowed length (8191 bytes).
121*58031Storek.El
122*58031Storek.Sh SEE ALSO
123*58031Storek.Xr ioctl 2
124*58031Storek.Sh BUGS
125*58031StorekDue to limitations within the OPENPROM itself,
126*58031Storekthese functions run at elevated priority
127*58031Storekand may adversely affect system performance.
128