1105398Stmm/*	$NetBSD: openfirmio.h,v 1.4 2002/09/06 13:23:19 gehenna Exp $ */
2105398Stmm
3139749Simp/*-
4105398Stmm * Copyright (c) 1992, 1993
5105398Stmm *	The Regents of the University of California.  All rights reserved.
6105398Stmm *
7105398Stmm * This software was developed by the Computer Systems Engineering group
8105398Stmm * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9105398Stmm * contributed to Berkeley.
10105398Stmm *
11105398Stmm * Redistribution and use in source and binary forms, with or without
12105398Stmm * modification, are permitted provided that the following conditions
13105398Stmm * are met:
14105398Stmm * 1. Redistributions of source code must retain the above copyright
15105398Stmm *    notice, this list of conditions and the following disclaimer.
16105398Stmm * 2. Redistributions in binary form must reproduce the above copyright
17105398Stmm *    notice, this list of conditions and the following disclaimer in the
18105398Stmm *    documentation and/or other materials provided with the distribution.
19105398Stmm * 4. Neither the name of the University nor the names of its contributors
20105398Stmm *    may be used to endorse or promote products derived from this software
21105398Stmm *    without specific prior written permission.
22105398Stmm *
23105398Stmm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24105398Stmm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25105398Stmm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26105398Stmm * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27105398Stmm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28105398Stmm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29105398Stmm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30105398Stmm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31105398Stmm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32105398Stmm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33105398Stmm * SUCH DAMAGE.
34105398Stmm *
35105398Stmm *	@(#)openpromio.h	8.1 (Berkeley) 6/11/93
36105398Stmm *
37105398Stmm * $FreeBSD$
38105398Stmm */
39105398Stmm
40105398Stmm#ifndef _DEV_OFW_OPENFIRMIO_H_
41105398Stmm#define _DEV_OFW_OPENFIRMIO_H_
42105398Stmm
43105398Stmm#include <dev/ofw/openfirm.h>
44105398Stmm
45105398Stmmstruct ofiocdesc {
46105398Stmm	phandle_t	of_nodeid;	/* passed or returned node id */
47146400Smarius	int		of_namelen;	/* length of of_name */
48105398Stmm	const char	*of_name;	/* pointer to field name */
49146400Smarius	int		of_buflen;	/* length of of_buf (value-result) */
50105398Stmm	char		*of_buf;	/* pointer to field value */
51105398Stmm};
52105398Stmm
53105398Stmm#define	OFIOC_BASE	'O'
54105398Stmm
55105398Stmm/* Get openprom field. */
56105398Stmm#define	OFIOCGET	_IOWR(OFIOC_BASE, 1, struct ofiocdesc)
57105398Stmm/* Set openprom field. */
58129587Smarius#define	OFIOCSET	_IOWR(OFIOC_BASE, 2, struct ofiocdesc)
59105398Stmm/* Get next property. */
60105398Stmm#define	OFIOCNEXTPROP	_IOWR(OFIOC_BASE, 3, struct ofiocdesc)
61105398Stmm/* Get options node. */
62105398Stmm#define	OFIOCGETOPTNODE	_IOR(OFIOC_BASE, 4, phandle_t)
63105398Stmm/* Get next node of node. */
64105398Stmm#define	OFIOCGETNEXT	_IOWR(OFIOC_BASE, 5, phandle_t)
65105398Stmm/* Get first child of node. */
66105398Stmm#define	OFIOCGETCHILD	_IOWR(OFIOC_BASE, 6, phandle_t)
67105398Stmm/* Find a specific device. */
68105398Stmm#define	OFIOCFINDDEVICE	_IOWR(OFIOC_BASE, 7, struct ofiocdesc)
69116210Stmm/* Retrieve the size of a property. */
70116210Stmm#define	OFIOCGETPROPLEN	_IOWR(OFIOC_BASE, 8, struct ofiocdesc)
71105398Stmm
72129587Smarius/* Maximum accepted name length. */
73129587Smarius#define	OFIOCMAXNAME	8191
74129587Smarius/* Maximum accepted value length (maximum of nvramrc property). */
75129587Smarius#define	OFIOCMAXVALUE	8192
76129587Smarius
77105398Stmm#endif /* _DEV_OFW_OPENFIRMIO_H_ */
78