1*61583Sbostic.\" Copyright (c) 1992, 1993
2*61583Sbostic.\"	The Regents of the University of California.  All rights reserved.
358031Storek.\"
458031Storek.\" This software was developed by the Computer Systems Engineering group
558031Storek.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
658031Storek.\" contributed to Berkeley.
758031Storek.\"
858031Storek.\" %sccs.include.redist.man%
958031Storek.\"
10*61583Sbostic.\"     @(#)openprom.4	8.1 (Berkeley) 06/05/93
1158031Storek.\"
1258031Storek.Dd
1358031Storek.Dt OPENPROM 4 sparc
1458031Storek.Os
1558031Storek.Sh NAME
1658031Storek.Nm openprom
1758031Storek.Nd OPENPROM and EEPROM interface
1858031Storek.Sh SYNOPSIS
1958031Storek.Fd #include <machine/openpromio.h>
2058031Storek.Sh DESCRIPTION
2158031StorekThe file
2258031Storek.Nm /dev/openprom
2358031Storekis an interface to the SPARC OPENPROM,
2458031Storekincluding the EEPROM area.
2558031StorekThis interface is highly stylized;
2658031Storekioctls are used for all operations.
2758031StorekThese ioctls refer to
2858031Storek.Dq nodes ,
2958031Storekwhich are simply
3058031Storek.Dq magic
3158031Storekinteger values describing data areas.
3258031StorekOccasionally the number 0 may be used or returned instead,
3358031Storekas described below.
3458031StorekA special distinguished
3558031Storek.Dq options
3658031Storeknode holds the EEPROM settings.
3758031Storek.Pp
3858031StorekThe calls that take and/or return a node
3958031Storekuse a pointer to an
4058031Storek.Li int
4158031Storekvariable for this purpose;
4258031Storekothers use a pointer to an
4358031Storek.Li struct opiocdesc
4458031Storekdescriptor,
4558031Storekwhich contains a node and two counted strings.
4658031StorekThe first string is comprised of the fields
4758031Storek.Li op_namelen
4858031Storek(an
4958031Storek.Li int )
5058031Storekand
5158031Storek.Li op_name
5258031Storek(a
5358031Storek.Li "char *" ) ,
5458031Storekgiving the name of a field.
5558031StorekThe second string is comprised of the fields
5658031Storek.Li op_buflen
5758031Storekand
5858031Storek.Li op_buf ,
5958031Storekused analogously.
6058031StorekThese two counted strings work in a
6158031Storek.Dq value-result
6258031Storekfashion.
6358031StorekAt entry to the ioctl,
6458031Storekthe counts are expected to reflect the buffer size;
6558031Storekon return,
6658031Storekthe counts are updated to reflect the buffer contents.
6758031Storek.Pp
6858031StorekThe following ioctls are supported:
6958031Storek.Bl -tag -width OPIOCGETOPTNODE
7058031Storek.It Dv OPIOCGETOPTNODE
7158031StorekTakes nothing, and fills in the options node number.
7258031Storek.It OPIOCGETNEXT
7358031StorekTakes a node number and returns the number of the following node.
7458031StorekThe node following the last node is number 0;
7558031Storekthe node following number 0 is the first node.
7658031Storek.It Dv OPIOCGETCHILD
7758031StorekTakes a node number and returns the number of the first
7858031Storek.Dq child
7958031Storekof that node.
8058031StorekThis child may have siblings; these can be discovered by using
8158031Storek.Dv OPIOCGETNEXT .
8258031Storek.It Dv OPIOCGET
8358031StorekFills in the value of the named property for the given node.
8458031StorekIf no such property is associated with that node,
8558031Storekthe value length is set to -1.
8658031StorekIf the named property exists but has no value,
8758031Storekthe value length is set to 0.
8858031Storek.It Dv OPIOCSET
8958031StorekWrites the given value under the given name.
9058031StorekThe OPENPROM may refuse this operation;
9158031Storekin this case
9258031Storek.Dv EINVAL
9358031Storekis returned.
9458031Storek.It Dv OPIOCNEXTPROP
9558031StorekFinds the property whose name follows the given name
9658031Storekin OPENPROM internal order.
9758031StorekThe resulting name is returned in the value field.
9858031StorekIf the named property is the last, the
9958031Storek.Dq next
10058031Storekname is the empty string.
10158031StorekAs with
10258031Storek.Dv OPIOCGETNEXT ,
10358031Storekthe next name after the empty string is the first name.
10458031Storek.El
10558031Storek.Sh FILES
10658031Storek.Pa /dev/openprom
10758031Storek.Sh ERRORS
10858031StorekThe following may result in rejection of an operation:
10958031Storek.Bl -tag -width Er
11058031Storek.It Bq Er EINVAL
11158031StorekThe given node number
11258031Storekis not zero
11358031Storekand does not correspond to any valid node,
11458031Storekor is zero where zero is not allowed.
11558031Storek.It Bq Er EBADF
11658031StorekThe requested operation requires permissions not specified at the call to
11758031Storek.Fn open .
11858031Storek.It Bq Er ENAMETOOLONG
11958031StorekThe given name or value field
12058031Storekexceeds the maximum allowed length (8191 bytes).
12158031Storek.El
12258031Storek.Sh SEE ALSO
12358031Storek.Xr ioctl 2
12458031Storek.Sh BUGS
12558031StorekDue to limitations within the OPENPROM itself,
12658031Storekthese functions run at elevated priority
12758031Storekand may adversely affect system performance.
128