source: rtems-libbsd/rtemsbsd/include/rtems/bsd/local/ofw_if.h @ c1205ee

55-freebsd-126-freebsd-12
Last change on this file since c1205ee was c1205ee, checked in by Sebastian Huber <sebastian.huber@…>, on 03/02/17 at 15:29:11

FDT(4): Port to RTEMS

  • Property mode set to 100644
File size: 15.4 KB
Line 
1/*
2 * This file is produced automatically.
3 * Do not modify anything in here by hand.
4 *
5 * Created from source file
6 *   freebsd-org/sys/dev/ofw/ofw_if.m
7 * with
8 *   makeobjops.awk
9 *
10 * See the source file for legal information
11 */
12
13/**
14 * @defgroup OFW ofw - KObj methods for Open Firmware RTAS implementations
15 * @brief A set of methods to implement the Open Firmware client side interface.
16 * @{
17 */
18
19#ifndef _ofw_if_h_
20#define _ofw_if_h_
21
22/** @brief Unique descriptor for the OFW_INIT() method */
23extern struct kobjop_desc ofw_init_desc;
24/** @brief A function implementing the OFW_INIT() method */
25typedef int ofw_init_t(ofw_t _ofw, void *_cookie);
26/**
27 * @brief Initialize OFW client interface
28 *
29 * @param _cookie       A handle to the client interface, generally the OF
30 *                      callback routine.
31 */
32
33static __inline int OFW_INIT(ofw_t _ofw, void *_cookie)
34{
35        kobjop_t _m;
36        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_init);
37        return ((ofw_init_t *) _m)(_ofw, _cookie);
38}
39
40/** @brief Unique descriptor for the OFW_PEER() method */
41extern struct kobjop_desc ofw_peer_desc;
42/** @brief A function implementing the OFW_PEER() method */
43typedef phandle_t ofw_peer_t(ofw_t _ofw, phandle_t _node);
44/**
45 * @brief Return next sibling of node.
46 *
47 * @param _node         Selected node
48 */
49
50static __inline phandle_t OFW_PEER(ofw_t _ofw, phandle_t _node)
51{
52        kobjop_t _m;
53        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_peer);
54        return ((ofw_peer_t *) _m)(_ofw, _node);
55}
56
57/** @brief Unique descriptor for the OFW_PARENT() method */
58extern struct kobjop_desc ofw_parent_desc;
59/** @brief A function implementing the OFW_PARENT() method */
60typedef phandle_t ofw_parent_t(ofw_t _ofw, phandle_t _node);
61/**
62 * @brief Return parent of node.
63 *
64 * @param _node         Selected node
65 */
66
67static __inline phandle_t OFW_PARENT(ofw_t _ofw, phandle_t _node)
68{
69        kobjop_t _m;
70        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_parent);
71        return ((ofw_parent_t *) _m)(_ofw, _node);
72}
73
74/** @brief Unique descriptor for the OFW_CHILD() method */
75extern struct kobjop_desc ofw_child_desc;
76/** @brief A function implementing the OFW_CHILD() method */
77typedef phandle_t ofw_child_t(ofw_t _ofw, phandle_t _node);
78/**
79 * @brief Return first child of node.
80 *
81 * @param _node         Selected node
82 */
83
84static __inline phandle_t OFW_CHILD(ofw_t _ofw, phandle_t _node)
85{
86        kobjop_t _m;
87        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_child);
88        return ((ofw_child_t *) _m)(_ofw, _node);
89}
90
91/** @brief Unique descriptor for the OFW_INSTANCE_TO_PACKAGE() method */
92extern struct kobjop_desc ofw_instance_to_package_desc;
93/** @brief A function implementing the OFW_INSTANCE_TO_PACKAGE() method */
94typedef phandle_t ofw_instance_to_package_t(ofw_t _ofw, ihandle_t _handle);
95/**
96 * @brief Return package corresponding to instance.
97 *
98 * @param _handle       Selected instance
99 */
100
101static __inline phandle_t OFW_INSTANCE_TO_PACKAGE(ofw_t _ofw, ihandle_t _handle)
102{
103        kobjop_t _m;
104        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_instance_to_package);
105        return ((ofw_instance_to_package_t *) _m)(_ofw, _handle);
106}
107
108/** @brief Unique descriptor for the OFW_GETPROPLEN() method */
109extern struct kobjop_desc ofw_getproplen_desc;
110/** @brief A function implementing the OFW_GETPROPLEN() method */
111typedef ssize_t ofw_getproplen_t(ofw_t _ofw, phandle_t _node,
112                                 const char *_prop);
113/**
114 * @brief Return length of node property.
115 *
116 * @param _node         Selected node
117 * @param _prop         Property name
118 */
119
120static __inline ssize_t OFW_GETPROPLEN(ofw_t _ofw, phandle_t _node,
121                                       const char *_prop)
122{
123        kobjop_t _m;
124        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_getproplen);
125        return ((ofw_getproplen_t *) _m)(_ofw, _node, _prop);
126}
127
128/** @brief Unique descriptor for the OFW_GETPROP() method */
129extern struct kobjop_desc ofw_getprop_desc;
130/** @brief A function implementing the OFW_GETPROP() method */
131typedef ssize_t ofw_getprop_t(ofw_t _ofw, phandle_t _node, const char *_prop,
132                              void *_buf, size_t _size);
133/**
134 * @brief Read node property.
135 *
136 * @param _node         Selected node
137 * @param _prop         Property name
138 * @param _buf          Pointer to buffer
139 * @param _size         Size of buffer
140 */
141
142static __inline ssize_t OFW_GETPROP(ofw_t _ofw, phandle_t _node,
143                                    const char *_prop, void *_buf, size_t _size)
144{
145        kobjop_t _m;
146        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_getprop);
147        return ((ofw_getprop_t *) _m)(_ofw, _node, _prop, _buf, _size);
148}
149
150/** @brief Unique descriptor for the OFW_NEXTPROP() method */
151extern struct kobjop_desc ofw_nextprop_desc;
152/** @brief A function implementing the OFW_NEXTPROP() method */
153typedef int ofw_nextprop_t(ofw_t _ofw, phandle_t _node, const char *_prop,
154                           char *_buf, size_t _size);
155/**
156 * @brief Get next property name.
157 *
158 * @param _node         Selected node
159 * @param _prop         Current property name
160 * @param _buf          Buffer for next property name
161 * @param _size         Size of buffer
162 */
163
164static __inline int OFW_NEXTPROP(ofw_t _ofw, phandle_t _node, const char *_prop,
165                                 char *_buf, size_t _size)
166{
167        kobjop_t _m;
168        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_nextprop);
169        return ((ofw_nextprop_t *) _m)(_ofw, _node, _prop, _buf, _size);
170}
171
172/** @brief Unique descriptor for the OFW_SETPROP() method */
173extern struct kobjop_desc ofw_setprop_desc;
174/** @brief A function implementing the OFW_SETPROP() method */
175typedef int ofw_setprop_t(ofw_t _ofw, phandle_t _node, const char *_prop,
176                          const void *_buf, size_t _size);
177/**
178 * @brief Set property.
179 *
180 * @param _node         Selected node
181 * @param _prop         Property name
182 * @param _buf          Value to set
183 * @param _size         Size of buffer
184 */
185
186static __inline int OFW_SETPROP(ofw_t _ofw, phandle_t _node, const char *_prop,
187                                const void *_buf, size_t _size)
188{
189        kobjop_t _m;
190        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_setprop);
191        return ((ofw_setprop_t *) _m)(_ofw, _node, _prop, _buf, _size);
192}
193
194/** @brief Unique descriptor for the OFW_CANON() method */
195extern struct kobjop_desc ofw_canon_desc;
196/** @brief A function implementing the OFW_CANON() method */
197typedef ssize_t ofw_canon_t(ofw_t _ofw, const char *_path, char *_buf,
198                            size_t _size);
199/**
200 * @brief Canonicalize path.
201 *
202 * @param _path         Path to canonicalize
203 * @param _buf          Buffer for canonicalized path
204 * @param _size         Size of buffer
205 */
206
207static __inline ssize_t OFW_CANON(ofw_t _ofw, const char *_path, char *_buf,
208                                  size_t _size)
209{
210        kobjop_t _m;
211        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_canon);
212        return ((ofw_canon_t *) _m)(_ofw, _path, _buf, _size);
213}
214
215/** @brief Unique descriptor for the OFW_FINDDEVICE() method */
216extern struct kobjop_desc ofw_finddevice_desc;
217/** @brief A function implementing the OFW_FINDDEVICE() method */
218typedef phandle_t ofw_finddevice_t(ofw_t _ofw, const char *_path);
219/**
220 * @brief Return phandle for named device.
221 *
222 * @param _path         Device path
223 */
224
225static __inline phandle_t OFW_FINDDEVICE(ofw_t _ofw, const char *_path)
226{
227        kobjop_t _m;
228        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_finddevice);
229        return ((ofw_finddevice_t *) _m)(_ofw, _path);
230}
231
232/** @brief Unique descriptor for the OFW_INSTANCE_TO_PATH() method */
233extern struct kobjop_desc ofw_instance_to_path_desc;
234/** @brief A function implementing the OFW_INSTANCE_TO_PATH() method */
235typedef ssize_t ofw_instance_to_path_t(ofw_t _ofw, ihandle_t _handle,
236                                       char *_path, size_t _size);
237/**
238 * @brief Return path for node instance.
239 *
240 * @param _handle       Instance handle
241 * @param _path         Buffer for path
242 * @param _size         Size of buffer
243 */
244
245static __inline ssize_t OFW_INSTANCE_TO_PATH(ofw_t _ofw, ihandle_t _handle,
246                                             char *_path, size_t _size)
247{
248        kobjop_t _m;
249        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_instance_to_path);
250        return ((ofw_instance_to_path_t *) _m)(_ofw, _handle, _path, _size);
251}
252
253/** @brief Unique descriptor for the OFW_PACKAGE_TO_PATH() method */
254extern struct kobjop_desc ofw_package_to_path_desc;
255/** @brief A function implementing the OFW_PACKAGE_TO_PATH() method */
256typedef ssize_t ofw_package_to_path_t(ofw_t _ofw, phandle_t _node, char *_path,
257                                      size_t _size);
258/**
259 * @brief Return path for node.
260 *
261 * @param _node         Package node
262 * @param _path         Buffer for path
263 * @param _size         Size of buffer
264 */
265
266static __inline ssize_t OFW_PACKAGE_TO_PATH(ofw_t _ofw, phandle_t _node,
267                                            char *_path, size_t _size)
268{
269        kobjop_t _m;
270        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_package_to_path);
271        return ((ofw_package_to_path_t *) _m)(_ofw, _node, _path, _size);
272}
273
274/** @brief Unique descriptor for the OFW_TEST() method */
275extern struct kobjop_desc ofw_test_desc;
276/** @brief A function implementing the OFW_TEST() method */
277typedef int ofw_test_t(ofw_t _ofw, const char *_name);
278/**
279 * @brief Test to see if a service exists.
280 *
281 * @param _name         name of the service
282 */
283
284static __inline int OFW_TEST(ofw_t _ofw, const char *_name)
285{
286        kobjop_t _m;
287        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_test);
288        return ((ofw_test_t *) _m)(_ofw, _name);
289}
290
291/** @brief Unique descriptor for the OFW_CALL_METHOD() method */
292extern struct kobjop_desc ofw_call_method_desc;
293/** @brief A function implementing the OFW_CALL_METHOD() method */
294typedef int ofw_call_method_t(ofw_t _ofw, ihandle_t _instance,
295                              const char *_method, int _nargs, int _nreturns,
296                              cell_t *_args_and_returns);
297/**
298 * @brief Call method belonging to an instance handle.
299 *
300 * @param _instance     Instance handle
301 * @param _method       Method name
302 * @param _nargs        Number of arguments
303 * @param _nreturns     Number of return values
304 * @param _args_and_returns     Values for arguments, followed by returns
305 */
306
307static __inline int OFW_CALL_METHOD(ofw_t _ofw, ihandle_t _instance,
308                                    const char *_method, int _nargs,
309                                    int _nreturns, cell_t *_args_and_returns)
310{
311        kobjop_t _m;
312        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_call_method);
313        return ((ofw_call_method_t *) _m)(_ofw, _instance, _method, _nargs, _nreturns, _args_and_returns);
314}
315
316/** @brief Unique descriptor for the OFW_INTERPRET() method */
317extern struct kobjop_desc ofw_interpret_desc;
318/** @brief A function implementing the OFW_INTERPRET() method */
319typedef int ofw_interpret_t(ofw_t _ofw, const char *_cmd, int _nreturns,
320                            cell_t *_returns);
321/**
322 * @brief Interpret a forth command.
323 *
324 * @param _cmd          Command
325 * @param _nreturns     Number of return values
326 * @param _returns      Values for returns
327 */
328
329static __inline int OFW_INTERPRET(ofw_t _ofw, const char *_cmd, int _nreturns,
330                                  cell_t *_returns)
331{
332        kobjop_t _m;
333        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_interpret);
334        return ((ofw_interpret_t *) _m)(_ofw, _cmd, _nreturns, _returns);
335}
336
337/** @brief Unique descriptor for the OFW_OPEN() method */
338extern struct kobjop_desc ofw_open_desc;
339/** @brief A function implementing the OFW_OPEN() method */
340typedef ihandle_t ofw_open_t(ofw_t _ofw, const char *_path);
341/**
342 * @brief Open node, returning instance handle.
343 *
344 * @param _path         Path to node
345 */
346
347static __inline ihandle_t OFW_OPEN(ofw_t _ofw, const char *_path)
348{
349        kobjop_t _m;
350        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_open);
351        return ((ofw_open_t *) _m)(_ofw, _path);
352}
353
354/** @brief Unique descriptor for the OFW_CLOSE() method */
355extern struct kobjop_desc ofw_close_desc;
356/** @brief A function implementing the OFW_CLOSE() method */
357typedef void ofw_close_t(ofw_t _ofw, ihandle_t _instance);
358/**
359 * @brief Close node instance.
360 *
361 * @param _instance     Instance to close
362 */
363
364static __inline void OFW_CLOSE(ofw_t _ofw, ihandle_t _instance)
365{
366        kobjop_t _m;
367        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_close);
368        ((ofw_close_t *) _m)(_ofw, _instance);
369}
370
371/** @brief Unique descriptor for the OFW_READ() method */
372extern struct kobjop_desc ofw_read_desc;
373/** @brief A function implementing the OFW_READ() method */
374typedef ssize_t ofw_read_t(ofw_t _ofw, ihandle_t _instance, void *_buf,
375                           size_t size);
376/**
377 * @brief Read from device.
378 *
379 * @param _instance     Device instance
380 * @param _buf          Buffer to read to
381 * @param _size         Size of buffer
382 */
383
384static __inline ssize_t OFW_READ(ofw_t _ofw, ihandle_t _instance, void *_buf,
385                                 size_t size)
386{
387        kobjop_t _m;
388        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_read);
389        return ((ofw_read_t *) _m)(_ofw, _instance, _buf, size);
390}
391
392/** @brief Unique descriptor for the OFW_WRITE() method */
393extern struct kobjop_desc ofw_write_desc;
394/** @brief A function implementing the OFW_WRITE() method */
395typedef ssize_t ofw_write_t(ofw_t _ofw, ihandle_t _instance, const void *_buf,
396                            size_t size);
397/**
398 * @brief Write to device.
399 *
400 * @param _instance     Device instance
401 * @param _buf          Buffer to write from
402 * @param _size         Size of buffer
403 */
404
405static __inline ssize_t OFW_WRITE(ofw_t _ofw, ihandle_t _instance,
406                                  const void *_buf, size_t size)
407{
408        kobjop_t _m;
409        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_write);
410        return ((ofw_write_t *) _m)(_ofw, _instance, _buf, size);
411}
412
413/** @brief Unique descriptor for the OFW_SEEK() method */
414extern struct kobjop_desc ofw_seek_desc;
415/** @brief A function implementing the OFW_SEEK() method */
416typedef int ofw_seek_t(ofw_t _ofw, ihandle_t _instance, uint64_t _off);
417/**
418 * @brief Seek device.
419 *
420 * @param _instance     Device instance
421 * @param _off          Offset to which to seek
422 */
423
424static __inline int OFW_SEEK(ofw_t _ofw, ihandle_t _instance, uint64_t _off)
425{
426        kobjop_t _m;
427        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_seek);
428        return ((ofw_seek_t *) _m)(_ofw, _instance, _off);
429}
430
431/** @brief Unique descriptor for the OFW_CLAIM() method */
432extern struct kobjop_desc ofw_claim_desc;
433/** @brief A function implementing the OFW_CLAIM() method */
434typedef caddr_t ofw_claim_t(ofw_t _ofw, void *_addr, size_t _size,
435                            u_int _align);
436/**
437 * @brief Claim virtual memory.
438 *
439 * @param _addr         Requested memory location (NULL for first available)
440 * @param _size         Requested size in bytes
441 * @param _align        Requested alignment
442 */
443
444static __inline caddr_t OFW_CLAIM(ofw_t _ofw, void *_addr, size_t _size,
445                                  u_int _align)
446{
447        kobjop_t _m;
448        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_claim);
449        return ((ofw_claim_t *) _m)(_ofw, _addr, _size, _align);
450}
451
452/** @brief Unique descriptor for the OFW_RELEASE() method */
453extern struct kobjop_desc ofw_release_desc;
454/** @brief A function implementing the OFW_RELEASE() method */
455typedef void ofw_release_t(ofw_t _ofw, void *_addr, size_t _size);
456/**
457 * @brief Release virtual memory.
458 *
459 * @param _addr         Memory location
460 * @param _size         Size in bytes
461 */
462
463static __inline void OFW_RELEASE(ofw_t _ofw, void *_addr, size_t _size)
464{
465        kobjop_t _m;
466        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_release);
467        ((ofw_release_t *) _m)(_ofw, _addr, _size);
468}
469
470/** @brief Unique descriptor for the OFW_ENTER() method */
471extern struct kobjop_desc ofw_enter_desc;
472/** @brief A function implementing the OFW_ENTER() method */
473typedef void ofw_enter_t(ofw_t _ofw);
474/**
475 * @brief Temporarily return control to firmware.
476 */
477
478static __inline void OFW_ENTER(ofw_t _ofw)
479{
480        kobjop_t _m;
481        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_enter);
482        ((ofw_enter_t *) _m)(_ofw);
483}
484
485/** @brief Unique descriptor for the OFW_EXIT() method */
486extern struct kobjop_desc ofw_exit_desc;
487/** @brief A function implementing the OFW_EXIT() method */
488typedef void ofw_exit_t(ofw_t _ofw);
489/**
490 * @brief Halt and return control to firmware.
491 */
492
493static __inline void OFW_EXIT(ofw_t _ofw)
494{
495        kobjop_t _m;
496        KOBJOPLOOKUP(((kobj_t)_ofw)->ops,ofw_exit);
497        ((ofw_exit_t *) _m)(_ofw);
498}
499
500#endif /* _ofw_if_h_ */
Note: See TracBrowser for help on using the repository browser.