Deleted Added
full compact
openprom.4 (148580) openprom.4 (208027)
1.\"-
2.\" Copyright (c) 1992, 1993
3.\" The Regents of the University of California. All rights reserved.
4.\"
5.\" This software was developed by the Computer Systems Engineering group
6.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7.\" contributed to Berkeley.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\" 3. Neither the name of the University nor the names of its contributors
18.\" may be used to endorse or promote products derived from this software
19.\" without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.\" from: @(#)openprom.4 8.1 (Berkeley) 6/5/93
34.\" from: OpenBSD: openprom.4,v 1.9 2004/03/22 22:07:21 miod Exp
35.\"
36.\"-
37.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
38.\" All rights reserved.
39.\"
40.\" Redistribution and use in source and binary forms, with or without
41.\" modification, are permitted provided that the following conditions
42.\" are met:
43.\"
44.\" 1. Redistributions of source code must retain the above copyright
45.\" notice, this list of conditions and the following disclaimer.
46.\" 2. Redistributions in binary form must reproduce the above copyright
47.\" notice, this list of conditions and the following disclaimer in the
48.\" documentation and/or other materials provided with the distribution.
49.\"
50.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
51.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
54.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
55.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
59.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60.\"
1.\"-
2.\" Copyright (c) 1992, 1993
3.\" The Regents of the University of California. All rights reserved.
4.\"
5.\" This software was developed by the Computer Systems Engineering group
6.\" at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7.\" contributed to Berkeley.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\" 3. Neither the name of the University nor the names of its contributors
18.\" may be used to endorse or promote products derived from this software
19.\" without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.\" from: @(#)openprom.4 8.1 (Berkeley) 6/5/93
34.\" from: OpenBSD: openprom.4,v 1.9 2004/03/22 22:07:21 miod Exp
35.\"
36.\"-
37.\" Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>
38.\" All rights reserved.
39.\"
40.\" Redistribution and use in source and binary forms, with or without
41.\" modification, are permitted provided that the following conditions
42.\" are met:
43.\"
44.\" 1. Redistributions of source code must retain the above copyright
45.\" notice, this list of conditions and the following disclaimer.
46.\" 2. Redistributions in binary form must reproduce the above copyright
47.\" notice, this list of conditions and the following disclaimer in the
48.\" documentation and/or other materials provided with the distribution.
49.\"
50.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
51.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
54.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
55.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
59.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60.\"
61.\" $FreeBSD: head/share/man/man4/man4.sparc64/openprom.4 148580 2005-07-31 03:30:48Z keramida $
61.\" $FreeBSD: head/share/man/man4/man4.sparc64/openprom.4 208027 2010-05-13 12:07:55Z uqs $
62.\"
63.Dd June 18, 2005
64.Dt OPENPROM 4 sparc64
65.Os
66.Sh NAME
67.Nm openprom
68.Nd "OPENPROM interface"
69.Sh SYNOPSIS
70.In sys/types.h
71.In sys/ioctl.h
72.In dev/ofw/openpromio.h
73.Sh DESCRIPTION
74The
75.Pa /dev/openfirm
76device is a
77.Tn SunOS /
78.Tn Solaris
79compatible interface to the
80.Tn Open Firmware
81device tree.
82This interface is similar to the
83.Xr openprom 4
84interface.
85It uses
86.Xr ioctl 2
87calls for all operations.
88These calls refer to the nodes in the
89.Tn Open Firmware
90device tree.
91However,
92.Fx
93only implements a subset of the
94.Xr ioctl 2
95calls
96.Tn SunOS /
97.Tn Solaris
98does.
99The nodes are represented by integer values,
100which are simply describing data areas.
101Occasionally the number 0 may be used or returned instead,
102as described below.
103.Pp
104All calls use a pointer to a
105.Vt "struct openpromio"
106descriptor,
107which has the following definition:
108.Bd -literal
109struct openpromio {
110 uint32_t oprom_size;
111 char oprom_array[];
112};
113.Ed
114.Pp
115The
116.Va oprom_size
117member refers to the size of
118.Va oprom_array .
119The
120.Va oprom_array
121member actually works like a union.
122Depending on the
123.Xr ioctl 2
124call and whether the
125.Vt "struct openpromio"
126is used to pass in or return data,
127.Va oprom_array
128either contains an integer referring to a node or a string referring to a
129property name or property value.
130The maximum size of
131.Va oprom_array
132is
133.Dv OPROMMAXPARAM .
134.Pp
135The following
136.Xr ioctl 2
137calls are currently implemented:
138.Bl -tag -width ".Dv OPROMGETPROP"
139.It Dv OPROMNEXT
140Takes the number of a node and returns the number of the next node in the
141.Tn Open Firmware
142device tree.
143The node following the last node is number 0.
144The node following number 0 is the first node.
145.It Dv OPROMCHILD
146Takes the number of a node and returns the number of the first child of that
147node.
148This child may have siblings.
149These can be determined by using
150.Dv OPROMNEXT .
151If the node does not have a child,
1520 is returned.
153.It Dv OPROMGETPROP
154Takes the name of a property.
155Returns the property value.
156The
157.Dv OPROMGETPROP
158call refers to the node previously returned by either the
159.Dv OPROMNEXT
160or the
161.Dv OPROMCHILD
162call,
163depending on which one was invoked last.
164If the property referenced by the given name is not associated with that node,
165.Er EINVAL
166is returned.
167If the named property exists but has no value,
168an empty string is returned.
169.It Dv OPROMNXTPROP
170Takes the name of a property.
171Returns the name of the next property of the node.
172As with the
173.Dv OPROMGETPROP
174call,
175the
176.Dv OPROMNXTPROP
177call refers to the node previously returned by either the
178.Dv OPROMNEXT
179or the
180.Dv OPROMCHILD
181call.
182If the property referenced by the given name is the last property of the node,
183an empty string is returned.
184.El
185.Sh FILES
186.Bl -tag -width ".Pa /dev/openprom"
187.It Pa /dev/openprom
188OPENPROM interface node
189.El
190.Sh ERRORS
191The following may result in rejection of an operation:
192.Bl -tag -width Er
193.It Bq Er EBUSY
194The
195.Pa /dev/openprom
196node is already opened.
197.It Bq Er EINVAL
198The given node number is not 0 and does not correspond to any valid node,
199or the given node number is 0 where 0 is not allowed,
200or the given size value is invalid,
201or the given property name exceeds the maximum allowed length of
202.Dv OPROMMAXPARAM
203bytes.
204.It Bq Er ENOMEM
205The kernel could not allocate memory to copy in data from user-space or to
206retrieve data from the
207.Tn Open Firmware .
208.El
62.\"
63.Dd June 18, 2005
64.Dt OPENPROM 4 sparc64
65.Os
66.Sh NAME
67.Nm openprom
68.Nd "OPENPROM interface"
69.Sh SYNOPSIS
70.In sys/types.h
71.In sys/ioctl.h
72.In dev/ofw/openpromio.h
73.Sh DESCRIPTION
74The
75.Pa /dev/openfirm
76device is a
77.Tn SunOS /
78.Tn Solaris
79compatible interface to the
80.Tn Open Firmware
81device tree.
82This interface is similar to the
83.Xr openprom 4
84interface.
85It uses
86.Xr ioctl 2
87calls for all operations.
88These calls refer to the nodes in the
89.Tn Open Firmware
90device tree.
91However,
92.Fx
93only implements a subset of the
94.Xr ioctl 2
95calls
96.Tn SunOS /
97.Tn Solaris
98does.
99The nodes are represented by integer values,
100which are simply describing data areas.
101Occasionally the number 0 may be used or returned instead,
102as described below.
103.Pp
104All calls use a pointer to a
105.Vt "struct openpromio"
106descriptor,
107which has the following definition:
108.Bd -literal
109struct openpromio {
110 uint32_t oprom_size;
111 char oprom_array[];
112};
113.Ed
114.Pp
115The
116.Va oprom_size
117member refers to the size of
118.Va oprom_array .
119The
120.Va oprom_array
121member actually works like a union.
122Depending on the
123.Xr ioctl 2
124call and whether the
125.Vt "struct openpromio"
126is used to pass in or return data,
127.Va oprom_array
128either contains an integer referring to a node or a string referring to a
129property name or property value.
130The maximum size of
131.Va oprom_array
132is
133.Dv OPROMMAXPARAM .
134.Pp
135The following
136.Xr ioctl 2
137calls are currently implemented:
138.Bl -tag -width ".Dv OPROMGETPROP"
139.It Dv OPROMNEXT
140Takes the number of a node and returns the number of the next node in the
141.Tn Open Firmware
142device tree.
143The node following the last node is number 0.
144The node following number 0 is the first node.
145.It Dv OPROMCHILD
146Takes the number of a node and returns the number of the first child of that
147node.
148This child may have siblings.
149These can be determined by using
150.Dv OPROMNEXT .
151If the node does not have a child,
1520 is returned.
153.It Dv OPROMGETPROP
154Takes the name of a property.
155Returns the property value.
156The
157.Dv OPROMGETPROP
158call refers to the node previously returned by either the
159.Dv OPROMNEXT
160or the
161.Dv OPROMCHILD
162call,
163depending on which one was invoked last.
164If the property referenced by the given name is not associated with that node,
165.Er EINVAL
166is returned.
167If the named property exists but has no value,
168an empty string is returned.
169.It Dv OPROMNXTPROP
170Takes the name of a property.
171Returns the name of the next property of the node.
172As with the
173.Dv OPROMGETPROP
174call,
175the
176.Dv OPROMNXTPROP
177call refers to the node previously returned by either the
178.Dv OPROMNEXT
179or the
180.Dv OPROMCHILD
181call.
182If the property referenced by the given name is the last property of the node,
183an empty string is returned.
184.El
185.Sh FILES
186.Bl -tag -width ".Pa /dev/openprom"
187.It Pa /dev/openprom
188OPENPROM interface node
189.El
190.Sh ERRORS
191The following may result in rejection of an operation:
192.Bl -tag -width Er
193.It Bq Er EBUSY
194The
195.Pa /dev/openprom
196node is already opened.
197.It Bq Er EINVAL
198The given node number is not 0 and does not correspond to any valid node,
199or the given node number is 0 where 0 is not allowed,
200or the given size value is invalid,
201or the given property name exceeds the maximum allowed length of
202.Dv OPROMMAXPARAM
203bytes.
204.It Bq Er ENOMEM
205The kernel could not allocate memory to copy in data from user-space or to
206retrieve data from the
207.Tn Open Firmware .
208.El
209.Sh CAVEATS
210Due to limitations within
211.Tn Open Firmware
212itself,
213these functions run at elevated priority and may adversely affect system
214performance.
215.Pp
216The
217.Nm
218interface exists entirely for compatibility with software like X11,
219and only the features that are actually needed for that are implemented.
220The interface sucks too much to actually use,
221new code should use the
222.Xr openfirm 4
223interface instead.
224.Sh SEE ALSO
225.Xr ioctl 2 ,
226.Xr openfirm 4 ,
227.Xr eeprom 8 ,
228.Xr ofwdump 8
229.Sh HISTORY
230The first
231.Fx
232version to include the
233.Nm
234interface was
235.Fx 5.0 .
236.Sh AUTHORS
237The
238.Nm
239interface was written by
240.An "Jake Burkholder" Aq jake@FreeBSD.org .
209.Sh SEE ALSO
210.Xr ioctl 2 ,
211.Xr openfirm 4 ,
212.Xr eeprom 8 ,
213.Xr ofwdump 8
214.Sh HISTORY
215The first
216.Fx
217version to include the
218.Nm
219interface was
220.Fx 5.0 .
221.Sh AUTHORS
222The
223.Nm
224interface was written by
225.An "Jake Burkholder" Aq jake@FreeBSD.org .
226.Sh CAVEATS
227Due to limitations within
228.Tn Open Firmware
229itself,
230these functions run at elevated priority and may adversely affect system
231performance.
232.Pp
233The
234.Nm
235interface exists entirely for compatibility with software like X11,
236and only the features that are actually needed for that are implemented.
237The interface sucks too much to actually use,
238new code should use the
239.Xr openfirm 4
240interface instead.