/* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */12/*-3* Copyright (C) 1995, 1996 Wolfgang Solfrank.4* Copyright (C) 1995, 1996 TooLs GmbH.5* All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15* 3. All advertising materials mentioning features or use of this software16* must display the following acknowledgement:17* This product includes software developed by TooLs GmbH.18* 4. The name of TooLs GmbH may not be used to endorse or promote products19* derived from this software without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR22* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES23* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.24* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,25* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,26* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;27* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,28* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR29* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF30* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31*/32/*-33* Copyright (C) 2000 Benno Rice.34* All rights reserved.35*36* Redistribution and use in source and binary forms, with or without37* modification, are permitted provided that the following conditions38* are met:39* 1. Redistributions of source code must retain the above copyright40* notice, this list of conditions and the following disclaimer.41* 2. Redistributions in binary form must reproduce the above copyright42* notice, this list of conditions and the following disclaimer in the43* documentation and/or other materials provided with the distribution.44*45* THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR46* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES47* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.48* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,49* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,50* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;51* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,52* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR53* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF54* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.55*/56#ifndef _OPENFIRM_H_57#define _OPENFIRM_H_58/*59* Prototypes for Open Firmware Interface Routines60*/6162#include <sys/types.h>6364typedef uint32_t ihandle_t;65typedef uint32_t phandle_t;66typedef uint32_t cell_t;6768extern int (*openfirmware)(void *);69extern phandle_t chosen;70extern ihandle_t memory, mmu;71extern int real_mode;7273/*74* This isn't actually an Open Firmware function, but it seemed like the right75* place for it to go.76*/77void OF_init(int (*openfirm)(void *));7879/* Generic functions */80int OF_test(char *);81void OF_quiesce(); /* Disable firmware */8283/* Device tree functions */84phandle_t OF_peer(phandle_t);85phandle_t OF_child(phandle_t);86phandle_t OF_parent(phandle_t);87phandle_t OF_instance_to_package(ihandle_t);88int OF_getproplen(phandle_t, const char *);89int OF_getprop(phandle_t, const char *, void *, int);90int OF_getencprop(phandle_t, const char *, cell_t *, int);91int OF_nextprop(phandle_t, const char *, char *);92int OF_setprop(phandle_t, const char *, void *, int);93int OF_canon(const char *, char *, int);94phandle_t OF_finddevice(const char *);95int OF_instance_to_path(ihandle_t, char *, int);96int OF_package_to_path(phandle_t, char *, int);97int OF_call_method(char *, ihandle_t, int, int, ...);9899/* Device I/O functions */100ihandle_t OF_open(char *);101void OF_close(ihandle_t);102int OF_read(ihandle_t, void *, int);103int OF_write(ihandle_t, void *, int);104int OF_seek(ihandle_t, u_quad_t);105unsigned int OF_blocks(ihandle_t);106int OF_block_size(ihandle_t);107108/* Memory functions */109void *OF_claim(void *, u_int, u_int);110void OF_release(void *, u_int);111112/* Control transfer functions */113void OF_boot(char *);114void OF_enter(void);115void OF_exit(void) __attribute__((noreturn));116void OF_chain(void *, u_int, void (*)(), void *, u_int);117118/* Time function */119int OF_milliseconds(void);120121#endif /* _OPENFIRM_H_ */122123124