xref: /netbsd-src/sys/arch/sparc/include/openfirm.h (revision 0059b91df19b077e9479bfedc734a2233a4cbdd1)
1*0059b91dSpalle /*	$NetBSD: openfirm.h,v 1.10 2016/04/01 20:21:45 palle Exp $	*/
2a99ba293Spk 
3a99ba293Spk /*
4a99ba293Spk  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5a99ba293Spk  * Copyright (C) 1995, 1996 TooLs GmbH.
6a99ba293Spk  * All rights reserved.
7a99ba293Spk  *
8a99ba293Spk  * Redistribution and use in source and binary forms, with or without
9a99ba293Spk  * modification, are permitted provided that the following conditions
10a99ba293Spk  * are met:
11a99ba293Spk  * 1. Redistributions of source code must retain the above copyright
12a99ba293Spk  *    notice, this list of conditions and the following disclaimer.
13a99ba293Spk  * 2. Redistributions in binary form must reproduce the above copyright
14a99ba293Spk  *    notice, this list of conditions and the following disclaimer in the
15a99ba293Spk  *    documentation and/or other materials provided with the distribution.
16a99ba293Spk  * 3. All advertising materials mentioning features or use of this software
17a99ba293Spk  *    must display the following acknowledgement:
18a99ba293Spk  *	This product includes software developed by TooLs GmbH.
19a99ba293Spk  * 4. The name of TooLs GmbH may not be used to endorse or promote products
20a99ba293Spk  *    derived from this software without specific prior written permission.
21a99ba293Spk  *
22a99ba293Spk  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23a99ba293Spk  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24a99ba293Spk  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25a99ba293Spk  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26a99ba293Spk  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27a99ba293Spk  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28a99ba293Spk  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29a99ba293Spk  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30a99ba293Spk  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31a99ba293Spk  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32a99ba293Spk  */
33a99ba293Spk /*
34a99ba293Spk  * Prototypes for additional OpenFirmware Interface Routines
35a99ba293Spk  */
36a99ba293Spk 
377446de91Spk #ifndef _SPARC_OPENFIRM_H_
387446de91Spk #define _SPARC_OPENFIRM_H_
397446de91Spk 
40a99ba293Spk #include <dev/ofw/openfirm.h>
41a99ba293Spk 
4227d8dabcSmartin #ifdef __sparc_v9__
43a99ba293Spk /* All cells are 8 byte slots */
446e4f5eb5Suwe typedef uint64_t cell_t;
457446de91Spk #ifdef __arch64__
467446de91Spk #define HDL2CELL(x)	(cell_t)(u_int)(int)(x)
477446de91Spk #define ADR2CELL(x)	(cell_t)(x)
487446de91Spk #else
497446de91Spk #define HDL2CELL(x)	(cell_t)(u_int)(int)(x)
507446de91Spk #define ADR2CELL(x)	(cell_t)(u_int)(int)(x)
517446de91Spk #endif
528276d7c5Snakayama #define HDQ2CELL_HI(x)	(cell_t)(0)
538276d7c5Snakayama #define HDQ2CELL_LO(x)	(cell_t)(x)
548276d7c5Snakayama #define CELL2HDQ(hi,lo)	(lo)
5527d8dabcSmartin #else /* __sparc_v9__ */
567446de91Spk /* All cells are 4 byte slots */
576e4f5eb5Suwe typedef uint32_t cell_t;
58a99ba293Spk #define HDL2CELL(x)	(cell_t)(x)
59a99ba293Spk #define ADR2CELL(x)	(cell_t)(x)
60f1e575acSnakayama #define HDQ2CELL_HI(x)	(cell_t)((x) >> 32)
61f1e575acSnakayama #define HDQ2CELL_LO(x)	(cell_t)(x)
6227d8dabcSmartin #endif /* __sparc_v9__ */
63a99ba293Spk 
64*0059b91dSpalle void	OF_init(void);
65be19dad5Schristos int	OF_test(const char *);
66be19dad5Schristos int	OF_test_method(int, const char *);
67be19dad5Schristos void	OF_set_symbol_lookup(void (*)(void *), void (*)(void *));
68be19dad5Schristos int	OF_searchprop (int, const char *, void *, int);
69be19dad5Schristos int	OF_mapintr(int, int *, int, int);
707446de91Spk 
717446de91Spk void	OF_poweroff(void) __attribute__((__noreturn__));
72be19dad5Schristos int	OF_interpret(const char *, int, int, ...);
737446de91Spk void	OF_sym2val(void *);
747446de91Spk void	OF_val2sym(void *);
757446de91Spk 
767446de91Spk #endif /* _SPARC_OPENFIRM_H_ */
77