openfirm.h revision 78877
1285612Sdelphij/*	$NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $	*/
2181834Sroberto
3285612Sdelphij/*
4285612Sdelphij * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5181834Sroberto * Copyright (C) 1995, 1996 TooLs GmbH.
6285612Sdelphij * All rights reserved.
7285612Sdelphij *
8285612Sdelphij * Redistribution and use in source and binary forms, with or without
9285612Sdelphij * modification, are permitted provided that the following conditions
10285612Sdelphij * are met:
11285612Sdelphij * 1. Redistributions of source code must retain the above copyright
12285612Sdelphij *    notice, this list of conditions and the following disclaimer.
13285612Sdelphij * 2. Redistributions in binary form must reproduce the above copyright
14285612Sdelphij *    notice, this list of conditions and the following disclaimer in the
15285612Sdelphij *    documentation and/or other materials provided with the distribution.
16285612Sdelphij * 3. All advertising materials mentioning features or use of this software
17285612Sdelphij *    must display the following acknowledgement:
18285612Sdelphij *	This product includes software developed by TooLs GmbH.
19285612Sdelphij * 4. The name of TooLs GmbH may not be used to endorse or promote products
20285612Sdelphij *    derived from this software without specific prior written permission.
21285612Sdelphij *
22285612Sdelphij * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23181834Sroberto * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24285612Sdelphij * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25285612Sdelphij * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26285612Sdelphij * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27285612Sdelphij * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28285612Sdelphij * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29181834Sroberto * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30181834Sroberto * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31181834Sroberto * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32181834Sroberto */
33181834Sroberto/*
34181834Sroberto * Copyright (C) 2000 Benno Rice.
35181834Sroberto * All rights reserved.
36181834Sroberto *
37181834Sroberto * Redistribution and use in source and binary forms, with or without
38181834Sroberto * modification, are permitted provided that the following conditions
39181834Sroberto * are met:
40181834Sroberto * 1. Redistributions of source code must retain the above copyright
41181834Sroberto *    notice, this list of conditions and the following disclaimer.
42181834Sroberto * 2. Redistributions in binary form must reproduce the above copyright
43181834Sroberto *    notice, this list of conditions and the following disclaimer in the
44181834Sroberto *    documentation and/or other materials provided with the distribution.
45285612Sdelphij *
46285612Sdelphij * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
47285612Sdelphij * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
48181834Sroberto * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
49181834Sroberto * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50181834Sroberto * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
51181834Sroberto * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
52181834Sroberto * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
53181834Sroberto * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
54181834Sroberto * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55181834Sroberto * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56181834Sroberto *
57181834Sroberto * $FreeBSD: head/sys/dev/ofw/openfirm.h 78877 2001-06-27 12:15:58Z benno $
58181834Sroberto */
59181834Sroberto
60181834Sroberto#ifndef _OPENFIRM_H_
61181834Sroberto#define _OPENFIRM_H_
62181834Sroberto
63181834Sroberto/*
64181834Sroberto * Prototypes for Openfirmware Interface Routines
65181834Sroberto */
66181834Sroberto
67285612Sdelphij#include <sys/cdefs.h>
68285612Sdelphij#include <sys/types.h>
69285612Sdelphij
70181834Srobertotypedef	int	ihandle_t;
71181834Srobertotypedef int	phandle_t;
72181834Sroberto
73181834Sroberto/*
74181834Sroberto * Stuff that is used by the OpenFirmware code.
75181834Sroberto */
76181834Srobertovoid	set_openfirm_callback(int (*)(void *));
77181834Srobertoint	openfirmware(void *);
78181834Sroberto
79181834Sroberto/*
80181834Sroberto * This isn't actually an OpenFirmware function, but it seemed like the right
81181834Sroberto * place for it to go.
82181834Sroberto */
83181834Srobertovoid		OF_init(int (*openfirm)(void *));
84181834Sroberto
85181834Sroberto/* Generic functions */
86181834Srobertoint		OF_test(char *);
87181834Srobertovoid		OF_helloworld(void);
88181834Srobertovoid		OF_printf(const char *, ...);
89181834Sroberto
90181834Sroberto/* Device tree functions */
91181834Srobertophandle_t	OF_peer(phandle_t);
92181834Srobertophandle_t	OF_child(phandle_t);
93181834Srobertophandle_t	OF_parent(phandle_t);
94181834Srobertophandle_t	OF_instance_to_package(ihandle_t);
95181834Srobertoint		OF_getproplen(phandle_t, char *);
96181834Srobertoint		OF_getprop(phandle_t, char *, void *, int);
97181834Srobertoint		OF_nextprop(phandle_t, char *, char *);
98181834Srobertoint		OF_setprop(phandle_t, char *, void *, int);
99181834Srobertoint		OF_canon(const char *, char *, int);
100181834Srobertophandle_t	OF_finddevice(const char *);
101181834Srobertoint		OF_instance_to_path(ihandle_t, char *, int);
102181834Srobertoint		OF_package_to_path(phandle_t, char *, int);
103181834Srobertoint		OF_call_method(char *, ihandle_t, int, int, ...);
104181834Sroberto
105181834Sroberto/* Device I/O functions */
106181834Srobertoihandle_t	OF_open(char *);
107181834Srobertovoid		OF_close(ihandle_t);
108181834Srobertoint		OF_read(ihandle_t, void *, int);
109181834Srobertoint		OF_write(ihandle_t, void *, int);
110181834Srobertoint		OF_seek(ihandle_t, u_quad_t);
111181834Sroberto
112181834Sroberto/* Memory functions */
113181834Srobertovoid 		*OF_claim(void *, u_int, u_int);
114181834Srobertovoid		OF_release(void *, u_int);
115181834Sroberto
116181834Sroberto/* Control transfer functions */
117181834Srobertovoid		OF_boot(char *);
118181834Srobertovoid		OF_enter(void);
119181834Srobertovoid		OF_exit(void) __attribute__((noreturn));
120181834Srobertovoid		OF_chain(void *, u_int,
121181834Sroberto    void (*)(void *, u_int, void *, void *, u_int), void *, u_int);
122181834Sroberto
123181834Sroberto#if 0
124181834Sroberto/* User interface functions */
125181834Sroberto/* OF_interpret */
126181834Srobertovoid 		*OF_set_callback(void *);
127181834Srobertovoid		OF_set_symbol_lookup(void *, void *);
128181834Sroberto#endif
129181834Sroberto
130181834Sroberto/* Time function */
131181834Srobertoint		OF_milliseconds(void);
132181834Sroberto
133181834Sroberto#endif /* _OPENFIRM_H_ */
134181834Sroberto