xref: /freebsd/sys/dev/ofw/openfirmio.h (revision 933c9a14ed5cd289f2740d1c910e5514221e68c9)
1de540622SThomas Moestl /*	$NetBSD: openfirmio.h,v 1.4 2002/09/06 13:23:19 gehenna Exp $ */
2de540622SThomas Moestl 
3de540622SThomas Moestl /*
4de540622SThomas Moestl  * Copyright (c) 1992, 1993
5de540622SThomas Moestl  *	The Regents of the University of California.  All rights reserved.
6de540622SThomas Moestl  *
7de540622SThomas Moestl  * This software was developed by the Computer Systems Engineering group
8de540622SThomas Moestl  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9de540622SThomas Moestl  * contributed to Berkeley.
10de540622SThomas Moestl  *
11de540622SThomas Moestl  * All advertising materials mentioning features or use of this software
12de540622SThomas Moestl  * must display the following acknowledgement:
13de540622SThomas Moestl  *	This product includes software developed by the University of
14de540622SThomas Moestl  *	California, Lawrence Berkeley Laboratory.
15de540622SThomas Moestl  *
16de540622SThomas Moestl  * Redistribution and use in source and binary forms, with or without
17de540622SThomas Moestl  * modification, are permitted provided that the following conditions
18de540622SThomas Moestl  * are met:
19de540622SThomas Moestl  * 1. Redistributions of source code must retain the above copyright
20de540622SThomas Moestl  *    notice, this list of conditions and the following disclaimer.
21de540622SThomas Moestl  * 2. Redistributions in binary form must reproduce the above copyright
22de540622SThomas Moestl  *    notice, this list of conditions and the following disclaimer in the
23de540622SThomas Moestl  *    documentation and/or other materials provided with the distribution.
24de540622SThomas Moestl  * 3. All advertising materials mentioning features or use of this software
25de540622SThomas Moestl  *    must display the following acknowledgement:
26de540622SThomas Moestl  *	This product includes software developed by the University of
27de540622SThomas Moestl  *	California, Berkeley and its contributors.
28de540622SThomas Moestl  * 4. Neither the name of the University nor the names of its contributors
29de540622SThomas Moestl  *    may be used to endorse or promote products derived from this software
30de540622SThomas Moestl  *    without specific prior written permission.
31de540622SThomas Moestl  *
32de540622SThomas Moestl  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
33de540622SThomas Moestl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34de540622SThomas Moestl  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35de540622SThomas Moestl  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
36de540622SThomas Moestl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37de540622SThomas Moestl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38de540622SThomas Moestl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39de540622SThomas Moestl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40de540622SThomas Moestl  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41de540622SThomas Moestl  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42de540622SThomas Moestl  * SUCH DAMAGE.
43de540622SThomas Moestl  *
44de540622SThomas Moestl  *	@(#)openpromio.h	8.1 (Berkeley) 6/11/93
45de540622SThomas Moestl  *
46de540622SThomas Moestl  * $FreeBSD$
47de540622SThomas Moestl  */
48de540622SThomas Moestl 
49de540622SThomas Moestl #ifndef _DEV_OFW_OPENFIRMIO_H_
50de540622SThomas Moestl #define _DEV_OFW_OPENFIRMIO_H_
51de540622SThomas Moestl 
52de540622SThomas Moestl #include <dev/ofw/openfirm.h>
53de540622SThomas Moestl 
54de540622SThomas Moestl struct ofiocdesc {
55de540622SThomas Moestl 	phandle_t	of_nodeid;	/* passed or returned node id */
56de540622SThomas Moestl 	int		of_namelen;	/* length of op_name */
57de540622SThomas Moestl 	const char	*of_name;	/* pointer to field name */
58de540622SThomas Moestl 	int		of_buflen;	/* length of op_buf (value-result) */
59de540622SThomas Moestl 	char		*of_buf;	/* pointer to field value */
60de540622SThomas Moestl };
61de540622SThomas Moestl 
62de540622SThomas Moestl #define	OFIOC_BASE	'O'
63de540622SThomas Moestl 
64de540622SThomas Moestl /* Get openprom field. */
65de540622SThomas Moestl #define	OFIOCGET	_IOWR(OFIOC_BASE, 1, struct ofiocdesc)
66de540622SThomas Moestl #if 0
67de540622SThomas Moestl /* Set openprom field. */
68de540622SThomas Moestl #define	OFIOCSET	_IOW(OFIOC_BASE, 2, struct ofiocdesc)
69de540622SThomas Moestl #endif
70de540622SThomas Moestl /* Get next property. */
71de540622SThomas Moestl #define	OFIOCNEXTPROP	_IOWR(OFIOC_BASE, 3, struct ofiocdesc)
72de540622SThomas Moestl /* Get options node. */
73de540622SThomas Moestl #define	OFIOCGETOPTNODE	_IOR(OFIOC_BASE, 4, phandle_t)
74de540622SThomas Moestl /* Get next node of node. */
75de540622SThomas Moestl #define	OFIOCGETNEXT	_IOWR(OFIOC_BASE, 5, phandle_t)
76de540622SThomas Moestl /* Get first child of node. */
77de540622SThomas Moestl #define	OFIOCGETCHILD	_IOWR(OFIOC_BASE, 6, phandle_t)
78de540622SThomas Moestl /* Find a specific device. */
79de540622SThomas Moestl #define	OFIOCFINDDEVICE	_IOWR(OFIOC_BASE, 7, struct ofiocdesc)
80933c9a14SThomas Moestl /* Retrieve the size of a property. */
81933c9a14SThomas Moestl #define	OFIOCGETPROPLEN	_IOWR(OFIOC_BASE, 8, struct ofiocdesc)
82de540622SThomas Moestl 
83de540622SThomas Moestl #endif /* _DEV_OFW_OPENFIRMIO_H_ */
84