]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man4/man4.sparc64/openprom.4
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man4 / man4.sparc64 / openprom.4
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$
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
74 The
75 .Pa /dev/openfirm
76 device is a
77 .Tn SunOS /
78 .Tn Solaris
79 compatible interface to the
80 .Tn Open Firmware
81 device tree.
82 This interface is similar to the
83 .Xr openprom 4
84 interface.
85 It uses
86 .Xr ioctl 2
87 calls for all operations.
88 These calls refer to the nodes in the
89 .Tn Open Firmware
90 device tree.
91 However,
92 .Fx
93 only implements a subset of the
94 .Xr ioctl 2
95 calls
96 .Tn SunOS /
97 .Tn Solaris
98 does.
99 The nodes are represented by integer values,
100 which are simply describing data areas.
101 Occasionally the number 0 may be used or returned instead,
102 as described below.
103 .Pp
104 All calls use a pointer to a
105 .Vt "struct openpromio"
106 descriptor,
107 which has the following definition:
108 .Bd -literal
109 struct openpromio {
110         uint32_t        oprom_size;
111         char            oprom_array[];
112 };
113 .Ed
114 .Pp
115 The
116 .Va oprom_size
117 member refers to the size of
118 .Va oprom_array .
119 The
120 .Va oprom_array
121 member actually works like a union.
122 Depending on the
123 .Xr ioctl 2
124 call and whether the
125 .Vt "struct openpromio"
126 is used to pass in or return data,
127 .Va oprom_array
128 either contains an integer referring to a node or a string referring to a
129 property name or property value.
130 The maximum size of
131 .Va oprom_array
132 is
133 .Dv OPROMMAXPARAM .
134 .Pp
135 The following
136 .Xr ioctl 2
137 calls are currently implemented:
138 .Bl -tag -width ".Dv OPROMGETPROP"
139 .It Dv OPROMNEXT
140 Takes the number of a node and returns the number of the next node in the
141 .Tn Open Firmware
142 device tree.
143 The node following the last node is number 0.
144 The node following number 0 is the first node.
145 .It Dv OPROMCHILD
146 Takes the number of a node and returns the number of the first child of that
147 node.
148 This child may have siblings.
149 These can be determined by using
150 .Dv OPROMNEXT .
151 If the node does not have a child,
152 0 is returned.
153 .It Dv OPROMGETPROP
154 Takes the name of a property.
155 Returns the property value.
156 The
157 .Dv OPROMGETPROP
158 call refers to the node previously returned by either the
159 .Dv OPROMNEXT
160 or the
161 .Dv OPROMCHILD
162 call,
163 depending on which one was invoked last.
164 If the property referenced by the given name is not associated with that node,
165 .Er EINVAL
166 is returned.
167 If the named property exists but has no value,
168 an empty string is returned.
169 .It Dv OPROMNXTPROP
170 Takes the name of a property.
171 Returns the name of the next property of the node.
172 As with the
173 .Dv OPROMGETPROP
174 call,
175 the
176 .Dv OPROMNXTPROP
177 call refers to the node previously returned by either the
178 .Dv OPROMNEXT
179 or the
180 .Dv OPROMCHILD
181 call.
182 If the property referenced by the given name is the last property of the node,
183 an empty string is returned.
184 .El
185 .Sh FILES
186 .Bl -tag -width ".Pa /dev/openprom"
187 .It Pa /dev/openprom
188 OPENPROM interface node
189 .El
190 .Sh DIAGNOSTICS
191 The following may result in rejection of an operation:
192 .Bl -tag -width Er
193 .It Bq Er EBUSY
194 The
195 .Pa /dev/openprom
196 node is already opened.
197 .It Bq Er EINVAL
198 The given node number is not 0 and does not correspond to any valid node,
199 or the given node number is 0 where 0 is not allowed,
200 or the given size value is invalid,
201 or the given property name exceeds the maximum allowed length of
202 .Dv OPROMMAXPARAM
203 bytes.
204 .It Bq Er ENOMEM
205 The kernel could not allocate memory to copy in data from user-space or to
206 retrieve data from the
207 .Tn Open Firmware .
208 .El
209 .Sh SEE ALSO
210 .Xr ioctl 2 ,
211 .Xr openfirm 4 ,
212 .Xr eeprom 8 ,
213 .Xr ofwdump 8
214 .Sh HISTORY
215 The first
216 .Fx
217 version to include the
218 .Nm
219 interface was
220 .Fx 5.0 .
221 .Sh AUTHORS
222 The
223 .Nm
224 interface was written by
225 .An "Jake Burkholder" Aq jake@FreeBSD.org .
226 .Sh CAVEATS
227 Due to limitations within
228 .Tn Open Firmware
229 itself,
230 these functions run at elevated priority and may adversely affect system
231 performance.
232 .Pp
233 The
234 .Nm
235 interface exists entirely for compatibility with software like X11,
236 and only the features that are actually needed for that are implemented.
237 The interface sucks too much to actually use,
238 new code should use the
239 .Xr openfirm 4
240 interface instead.