openfirm.h revision 215438
167204Sobrien/* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ 267204Sobrien 3139738Simp/*- 467204Sobrien * Copyright (C) 1995, 1996 Wolfgang Solfrank. 567204Sobrien * Copyright (C) 1995, 1996 TooLs GmbH. 667204Sobrien * All rights reserved. 767204Sobrien * 867204Sobrien * Redistribution and use in source and binary forms, with or without 967204Sobrien * modification, are permitted provided that the following conditions 1067204Sobrien * are met: 1167204Sobrien * 1. Redistributions of source code must retain the above copyright 1267204Sobrien * notice, this list of conditions and the following disclaimer. 1367204Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1467204Sobrien * notice, this list of conditions and the following disclaimer in the 1567204Sobrien * documentation and/or other materials provided with the distribution. 1667204Sobrien * 3. All advertising materials mentioning features or use of this software 1767204Sobrien * must display the following acknowledgement: 1867204Sobrien * This product includes software developed by TooLs GmbH. 1967204Sobrien * 4. The name of TooLs GmbH may not be used to endorse or promote products 2067204Sobrien * derived from this software without specific prior written permission. 2167204Sobrien * 2267204Sobrien * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 2367204Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2467204Sobrien * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2567204Sobrien * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2667204Sobrien * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2767204Sobrien * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2867204Sobrien * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2967204Sobrien * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 3067204Sobrien * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 3167204Sobrien * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3267204Sobrien */ 33139738Simp/*- 3467204Sobrien * Copyright (C) 2000 Benno Rice. 3567204Sobrien * All rights reserved. 3667204Sobrien * 3767204Sobrien * Redistribution and use in source and binary forms, with or without 3867204Sobrien * modification, are permitted provided that the following conditions 3967204Sobrien * are met: 4067204Sobrien * 1. Redistributions of source code must retain the above copyright 4167204Sobrien * notice, this list of conditions and the following disclaimer. 4267204Sobrien * 2. Redistributions in binary form must reproduce the above copyright 4367204Sobrien * notice, this list of conditions and the following disclaimer in the 4467204Sobrien * documentation and/or other materials provided with the distribution. 4567204Sobrien * 4667204Sobrien * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR 4767204Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 4867204Sobrien * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 4967204Sobrien * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 5067204Sobrien * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 5167204Sobrien * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 5267204Sobrien * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 5367204Sobrien * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 5467204Sobrien * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 5567204Sobrien * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5667204Sobrien * 5767204Sobrien * $FreeBSD: head/sys/boot/ofw/libofw/openfirm.h 215438 2010-11-17 19:35:56Z andreast $ 5867204Sobrien */ 5984967Srobert#ifndef _OPENFIRM_H_ 6084967Srobert#define _OPENFIRM_H_ 6167204Sobrien/* 62133862Smarius * Prototypes for Open Firmware Interface Routines 6367204Sobrien */ 6467204Sobrien 6567204Sobrien#include <sys/cdefs.h> 6667204Sobrien#include <sys/types.h> 6767204Sobrien 6884967Sroberttypedef unsigned int ihandle_t; 6984967Sroberttypedef unsigned int phandle_t; 7084967Sroberttypedef unsigned long int cell_t; 7167204Sobrien 7285717Sjakeextern int (*openfirmware)(void *); 7384617Sbennoextern phandle_t chosen; 74100318Sbennoextern ihandle_t memory, mmu; 75215438Sandreastextern int real_mode; 7684617Sbenno 7767204Sobrien/* 78133862Smarius * This isn't actually an Open Firmware function, but it seemed like the right 7967204Sobrien * place for it to go. 8067204Sobrien */ 8167204Sobrienvoid OF_init(int (*openfirm)(void *)); 8267204Sobrien 8367204Sobrien/* Generic functions */ 8467204Sobrienint OF_test(char *); 8567204Sobrien 8667204Sobrien/* Device tree functions */ 8767204Sobrienphandle_t OF_peer(phandle_t); 8867204Sobrienphandle_t OF_child(phandle_t); 8967204Sobrienphandle_t OF_parent(phandle_t); 9067204Sobrienphandle_t OF_instance_to_package(ihandle_t); 9167204Sobrienint OF_getproplen(phandle_t, char *); 9267204Sobrienint OF_getprop(phandle_t, char *, void *, int); 9367204Sobrienint OF_nextprop(phandle_t, char *, char *); 9467204Sobrienint OF_setprop(phandle_t, char *, void *, int); 9568548Sbennoint OF_canon(const char *, char *, int); 9668548Sbennophandle_t OF_finddevice(const char *); 9767204Sobrienint OF_instance_to_path(ihandle_t, char *, int); 9867204Sobrienint OF_package_to_path(phandle_t, char *, int); 9967204Sobrienint OF_call_method(char *, ihandle_t, int, int, ...); 10067204Sobrien 10167204Sobrien/* Device I/O functions */ 10267204Sobrienihandle_t OF_open(char *); 10367204Sobrienvoid OF_close(ihandle_t); 10467204Sobrienint OF_read(ihandle_t, void *, int); 10567204Sobrienint OF_write(ihandle_t, void *, int); 10667204Sobrienint OF_seek(ihandle_t, u_quad_t); 10767204Sobrien 10867204Sobrien/* Memory functions */ 10967204Sobrienvoid *OF_claim(void *, u_int, u_int); 11067204Sobrienvoid OF_release(void *, u_int); 11167204Sobrien 11267204Sobrien/* Control transfer functions */ 11367204Sobrienvoid OF_boot(char *); 11467204Sobrienvoid OF_enter(void); 11568548Sbennovoid OF_exit(void) __attribute__((noreturn)); 11667204Sobrienvoid OF_chain(void *, u_int, void (*)(), void *, u_int); 11767204Sobrien 11867204Sobrien/* Time function */ 11967204Sobrienint OF_milliseconds(void); 120170854Smarius 12184967Srobert#endif /* _OPENFIRM_H_ */ 122