2000-10-16 10:46:22 +00:00
|
|
|
/* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */
|
|
|
|
|
2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
2000-10-16 10:46:22 +00:00
|
|
|
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
|
|
|
* Copyright (C) 1995, 1996 TooLs GmbH.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by TooLs GmbH.
|
|
|
|
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2000 Benno Rice.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
2001-06-27 12:15:58 +00:00
|
|
|
#ifndef _OPENFIRM_H_
|
|
|
|
#define _OPENFIRM_H_
|
|
|
|
|
2000-10-16 10:46:22 +00:00
|
|
|
/*
|
2004-08-16 15:45:27 +00:00
|
|
|
* Prototypes for Open Firmware Interface Routines
|
2000-10-16 10:46:22 +00:00
|
|
|
*/
|
|
|
|
|
2002-10-18 15:21:09 +00:00
|
|
|
typedef unsigned long cell_t;
|
|
|
|
|
|
|
|
typedef unsigned int ihandle_t;
|
|
|
|
typedef unsigned int phandle_t;
|
|
|
|
|
2008-12-15 15:31:10 +00:00
|
|
|
/*
|
|
|
|
* Other than in Open Firmware calls, the size of a bus cell seems to be
|
|
|
|
* always the same.
|
|
|
|
*/
|
|
|
|
typedef u_int32_t pcell_t;
|
|
|
|
|
2002-10-18 15:21:09 +00:00
|
|
|
#ifdef _KERNEL
|
2000-10-16 10:46:22 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <sys/types.h>
|
2001-11-18 20:38:44 +00:00
|
|
|
#include <sys/malloc.h>
|
|
|
|
|
|
|
|
MALLOC_DECLARE(M_OFWPROP);
|
2000-10-16 10:46:22 +00:00
|
|
|
|
2001-06-16 07:17:56 +00:00
|
|
|
/*
|
2004-08-16 15:45:27 +00:00
|
|
|
* Stuff that is used by the Open Firmware code.
|
2001-06-16 07:17:56 +00:00
|
|
|
*/
|
|
|
|
void set_openfirm_callback(int (*)(void *));
|
|
|
|
int openfirmware(void *);
|
|
|
|
|
2000-10-16 10:46:22 +00:00
|
|
|
/*
|
2004-08-16 15:45:27 +00:00
|
|
|
* This isn't actually an Open Firmware function, but it seemed like the right
|
2000-10-16 10:46:22 +00:00
|
|
|
* place for it to go.
|
|
|
|
*/
|
|
|
|
void OF_init(int (*openfirm)(void *));
|
|
|
|
|
|
|
|
/* Generic functions */
|
|
|
|
int OF_test(char *);
|
2001-06-16 07:17:56 +00:00
|
|
|
void OF_printf(const char *, ...);
|
2000-10-16 10:46:22 +00:00
|
|
|
|
|
|
|
/* Device tree functions */
|
|
|
|
phandle_t OF_peer(phandle_t);
|
|
|
|
phandle_t OF_child(phandle_t);
|
|
|
|
phandle_t OF_parent(phandle_t);
|
|
|
|
phandle_t OF_instance_to_package(ihandle_t);
|
|
|
|
int OF_getproplen(phandle_t, char *);
|
|
|
|
int OF_getprop(phandle_t, char *, void *, int);
|
2001-11-18 20:38:44 +00:00
|
|
|
int OF_getprop_alloc(phandle_t package, char *propname, int elsz,
|
|
|
|
void **buf);
|
2000-10-16 10:46:22 +00:00
|
|
|
int OF_nextprop(phandle_t, char *, char *);
|
|
|
|
int OF_setprop(phandle_t, char *, void *, int);
|
2000-11-10 06:39:58 +00:00
|
|
|
int OF_canon(const char *, char *, int);
|
|
|
|
phandle_t OF_finddevice(const char *);
|
2000-10-16 10:46:22 +00:00
|
|
|
int OF_instance_to_path(ihandle_t, char *, int);
|
|
|
|
int OF_package_to_path(phandle_t, char *, int);
|
|
|
|
int OF_call_method(char *, ihandle_t, int, int, ...);
|
|
|
|
|
|
|
|
/* Device I/O functions */
|
|
|
|
ihandle_t OF_open(char *);
|
|
|
|
void OF_close(ihandle_t);
|
|
|
|
int OF_read(ihandle_t, void *, int);
|
|
|
|
int OF_write(ihandle_t, void *, int);
|
|
|
|
int OF_seek(ihandle_t, u_quad_t);
|
|
|
|
|
|
|
|
/* Memory functions */
|
|
|
|
void *OF_claim(void *, u_int, u_int);
|
|
|
|
void OF_release(void *, u_int);
|
|
|
|
|
|
|
|
/* Control transfer functions */
|
|
|
|
void OF_boot(char *);
|
|
|
|
void OF_enter(void);
|
2000-11-10 06:39:58 +00:00
|
|
|
void OF_exit(void) __attribute__((noreturn));
|
2001-06-16 07:17:56 +00:00
|
|
|
void OF_chain(void *, u_int,
|
|
|
|
void (*)(void *, u_int, void *, void *, u_int), void *, u_int);
|
2000-10-16 10:46:22 +00:00
|
|
|
|
|
|
|
/* User interface functions */
|
2003-06-07 18:34:04 +00:00
|
|
|
int OF_interpret(char *, int, ...);
|
2000-10-16 10:46:22 +00:00
|
|
|
|
|
|
|
/* Time function */
|
|
|
|
int OF_milliseconds(void);
|
2001-06-27 12:15:58 +00:00
|
|
|
|
2002-10-18 15:21:09 +00:00
|
|
|
#endif /* _KERNEL */
|
2001-06-27 12:15:58 +00:00
|
|
|
#endif /* _OPENFIRM_H_ */
|