1de540622SThomas Moestl /* $NetBSD: openfirmio.h,v 1.4 2002/09/06 13:23:19 gehenna Exp $ */ 2de540622SThomas Moestl 3098ca2bdSWarner Losh /*- 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 * Redistribution and use in source and binary forms, with or without 12de540622SThomas Moestl * modification, are permitted provided that the following conditions 13de540622SThomas Moestl * are met: 14de540622SThomas Moestl * 1. Redistributions of source code must retain the above copyright 15de540622SThomas Moestl * notice, this list of conditions and the following disclaimer. 16de540622SThomas Moestl * 2. Redistributions in binary form must reproduce the above copyright 17de540622SThomas Moestl * notice, this list of conditions and the following disclaimer in the 18de540622SThomas Moestl * documentation and/or other materials provided with the distribution. 19*fbbd9655SWarner Losh * 3. Neither the name of the University nor the names of its contributors 20de540622SThomas Moestl * may be used to endorse or promote products derived from this software 21de540622SThomas Moestl * without specific prior written permission. 22de540622SThomas Moestl * 23de540622SThomas Moestl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24de540622SThomas Moestl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25de540622SThomas Moestl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26de540622SThomas Moestl * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27de540622SThomas Moestl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28de540622SThomas Moestl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29de540622SThomas Moestl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30de540622SThomas Moestl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31de540622SThomas Moestl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32de540622SThomas Moestl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33de540622SThomas Moestl * SUCH DAMAGE. 34de540622SThomas Moestl * 35de540622SThomas Moestl * @(#)openpromio.h 8.1 (Berkeley) 6/11/93 36de540622SThomas Moestl * 37de540622SThomas Moestl * $FreeBSD$ 38de540622SThomas Moestl */ 39de540622SThomas Moestl 40de540622SThomas Moestl #ifndef _DEV_OFW_OPENFIRMIO_H_ 41de540622SThomas Moestl #define _DEV_OFW_OPENFIRMIO_H_ 42de540622SThomas Moestl 43de540622SThomas Moestl #include <dev/ofw/openfirm.h> 44de540622SThomas Moestl 45de540622SThomas Moestl struct ofiocdesc { 46de540622SThomas Moestl phandle_t of_nodeid; /* passed or returned node id */ 472ad15420SMarius Strobl int of_namelen; /* length of of_name */ 48de540622SThomas Moestl const char *of_name; /* pointer to field name */ 492ad15420SMarius Strobl int of_buflen; /* length of of_buf (value-result) */ 50de540622SThomas Moestl char *of_buf; /* pointer to field value */ 51de540622SThomas Moestl }; 52de540622SThomas Moestl 53de540622SThomas Moestl #define OFIOC_BASE 'O' 54de540622SThomas Moestl 55de540622SThomas Moestl /* Get openprom field. */ 56de540622SThomas Moestl #define OFIOCGET _IOWR(OFIOC_BASE, 1, struct ofiocdesc) 57de540622SThomas Moestl /* Set openprom field. */ 58073e8552SMarius Strobl #define OFIOCSET _IOWR(OFIOC_BASE, 2, struct ofiocdesc) 59de540622SThomas Moestl /* Get next property. */ 60de540622SThomas Moestl #define OFIOCNEXTPROP _IOWR(OFIOC_BASE, 3, struct ofiocdesc) 61de540622SThomas Moestl /* Get options node. */ 62de540622SThomas Moestl #define OFIOCGETOPTNODE _IOR(OFIOC_BASE, 4, phandle_t) 63de540622SThomas Moestl /* Get next node of node. */ 64de540622SThomas Moestl #define OFIOCGETNEXT _IOWR(OFIOC_BASE, 5, phandle_t) 65de540622SThomas Moestl /* Get first child of node. */ 66de540622SThomas Moestl #define OFIOCGETCHILD _IOWR(OFIOC_BASE, 6, phandle_t) 67de540622SThomas Moestl /* Find a specific device. */ 68de540622SThomas Moestl #define OFIOCFINDDEVICE _IOWR(OFIOC_BASE, 7, struct ofiocdesc) 69933c9a14SThomas Moestl /* Retrieve the size of a property. */ 70933c9a14SThomas Moestl #define OFIOCGETPROPLEN _IOWR(OFIOC_BASE, 8, struct ofiocdesc) 71de540622SThomas Moestl 72073e8552SMarius Strobl /* Maximum accepted name length. */ 73073e8552SMarius Strobl #define OFIOCMAXNAME 8191 74073e8552SMarius Strobl /* Maximum accepted value length (maximum of nvramrc property). */ 75073e8552SMarius Strobl #define OFIOCMAXVALUE 8192 76073e8552SMarius Strobl 77de540622SThomas Moestl #endif /* _DEV_OFW_OPENFIRMIO_H_ */ 78