1/*	$NetBSD: promlib.h,v 1.8 2005/12/11 12:19:16 christos Exp $ */
2
3/*-
4 * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Paul Kranenburg and Matthew Fredette.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/*
33 * Macros and functions to hide the Sun2 PROM interface from the
34 * common Sun parts of the kernel.
35 */
36
37#ifndef _MACHINE_PROMLIB_H_
38#define _MACHINE_PROMLIB_H_
39
40#include <machine/mon.h>
41
42#ifdef	_SUN2_PROMLIB_PRIVATE
43#define	romVectorPtr	((struct sunromvec *) SUN2_PROM_BASE)
44#endif	/* _SUN2_PROMLIB_PRIVATE */
45
46/*
47 * We define both of these, since there are places where their
48 * functionality is the same, and some common code knows that
49 * (e.g. dev/sun/zs.c).
50 */
51#define PROM_OLDMON	0
52#define PROM_OBP_V0	1
53
54void	prom_init(void);	/* To setup promops */
55
56#define	prom_version()	(PROM_OLDMON)
57int	prom_memsize(void);
58int	prom_stdin(void);
59int	prom_stdout(void);
60int	prom_kbdid(void);
61int	prom_getchar(void);
62int	prom_peekchar(void);
63void	prom_putchar(int);
64void	prom_putstr(char *, int);
65void	prom_printf(const char *, ...);
66void	prom_abort(void);
67void	prom_halt(void) __attribute__((__noreturn__));
68void	prom_boot(const char *) __attribute__((__noreturn__));
69char	*prom_getbootpath(void);
70char	*prom_getbootfile(void);
71char	*prom_getbootargs(void);
72int	prom_sd_target(int);
73#define	callrom		prom_abort
74
75/*
76 * We also provide these, to keep #ifdef'ing down in common
77 * code.  These should be revisited.  The worst offender is
78 * our definition of CPU_ISSUN4, for the benefit of
79 * sys/dev/sun/fb.c.
80 */
81#define PROM_OBP_V2	2
82#define PROM_OBP_V3	3
83#define PROM_OPENFIRM	4
84#define prom_getpropint(a, b, c) (0)
85#define CPU_ISSUN4 (1)
86
87#endif /* _MACHINE_PROMLIB_H_ */
88