openfirmio.h revision 116210
17858Sgibbs/*	$NetBSD: openfirmio.h,v 1.4 2002/09/06 13:23:19 gehenna Exp $ */
257206Sgibbs
37858Sgibbs/*
47858Sgibbs * Copyright (c) 1992, 1993
57858Sgibbs *	The Regents of the University of California.  All rights reserved.
67858Sgibbs *
77858Sgibbs * This software was developed by the Computer Systems Engineering group
87858Sgibbs * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
97858Sgibbs * contributed to Berkeley.
107858Sgibbs *
117858Sgibbs * All advertising materials mentioning features or use of this software
127858Sgibbs * must display the following acknowledgement:
137858Sgibbs *	This product includes software developed by the University of
1449276Smpp *	California, Lawrence Berkeley Laboratory.
157858Sgibbs *
167858Sgibbs * Redistribution and use in source and binary forms, with or without
177858Sgibbs * modification, are permitted provided that the following conditions
187858Sgibbs * are met:
197858Sgibbs * 1. Redistributions of source code must retain the above copyright
207858Sgibbs *    notice, this list of conditions and the following disclaimer.
217858Sgibbs * 2. Redistributions in binary form must reproduce the above copyright
227858Sgibbs *    notice, this list of conditions and the following disclaimer in the
237858Sgibbs *    documentation and/or other materials provided with the distribution.
247858Sgibbs * 3. All advertising materials mentioning features or use of this software
257858Sgibbs *    must display the following acknowledgement:
267858Sgibbs *	This product includes software developed by the University of
2750476Speter *	California, Berkeley and its contributors.
287858Sgibbs * 4. Neither the name of the University nor the names of its contributors
29180492Sremko *    may be used to endorse or promote products derived from this software
3053200Sphantom *    without specific prior written permission.
3179538Sru *
327858Sgibbs * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
337858Sgibbs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3413502Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
357858Sgibbs * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
36158762Sbrueffer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37158762Sbrueffer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38158762Sbrueffer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39158762Sbrueffer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40158762Sbrueffer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41158762Sbrueffer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42158762Sbrueffer * SUCH DAMAGE.
4315333Sgibbs *
44158762Sbrueffer *	@(#)openpromio.h	8.1 (Berkeley) 6/11/93
4513502Swollman *
4615333Sgibbs * $FreeBSD: head/sys/dev/ofw/openfirmio.h 116210 2003-06-11 18:33:03Z tmm $
47158762Sbrueffer */
4813502Swollman
4922897Sgibbs#ifndef _DEV_OFW_OPENFIRMIO_H_
5022897Sgibbs#define _DEV_OFW_OPENFIRMIO_H_
5113502Swollman
5257206Sgibbs#include <dev/ofw/openfirm.h>
5357206Sgibbs
54158762Sbruefferstruct ofiocdesc {
5557206Sgibbs	phandle_t	of_nodeid;	/* passed or returned node id */
56158762Sbrueffer	int		of_namelen;	/* length of op_name */
57158762Sbrueffer	const char	*of_name;	/* pointer to field name */
58158762Sbrueffer	int		of_buflen;	/* length of op_buf (value-result) */
59158762Sbrueffer	char		*of_buf;	/* pointer to field value */
60158762Sbrueffer};
61158762Sbrueffer
62158762Sbrueffer#define	OFIOC_BASE	'O'
63158762Sbrueffer
64158762Sbrueffer/* Get openprom field. */
657858Sgibbs#define	OFIOCGET	_IOWR(OFIOC_BASE, 1, struct ofiocdesc)
6613502Swollman#if 0
6713502Swollman/* Set openprom field. */
68131570Ssimon#define	OFIOCSET	_IOW(OFIOC_BASE, 2, struct ofiocdesc)
6915333Sgibbs#endif
7040453Sgibbs/* Get next property. */
7140453Sgibbs#define	OFIOCNEXTPROP	_IOWR(OFIOC_BASE, 3, struct ofiocdesc)
7257206Sgibbs/* Get options node. */
7382328Sdd#define	OFIOCGETOPTNODE	_IOR(OFIOC_BASE, 4, phandle_t)
7422897Sgibbs/* Get next node of node. */
7540453Sgibbs#define	OFIOCGETNEXT	_IOWR(OFIOC_BASE, 5, phandle_t)
7622897Sgibbs/* Get first child of node. */
7713502Swollman#define	OFIOCGETCHILD	_IOWR(OFIOC_BASE, 6, phandle_t)
7822897Sgibbs/* Find a specific device. */
7922897Sgibbs#define	OFIOCFINDDEVICE	_IOWR(OFIOC_BASE, 7, struct ofiocdesc)
8026282Smax/* Retrieve the size of a property. */
8122897Sgibbs#define	OFIOCGETPROPLEN	_IOWR(OFIOC_BASE, 8, struct ofiocdesc)
8222897Sgibbs
8357206Sgibbs#endif /* _DEV_OFW_OPENFIRMIO_H_ */
8457206Sgibbs