xref: /openbsd/sys/arch/alpha/include/prom.h (revision 07ea8d15)
1 /*	$OpenBSD: prom.h,v 1.5 1996/11/28 20:09:29 niklas Exp $	*/
2 /*	$NetBSD: prom.h,v 1.4 1996/10/15 23:52:49 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
6  * All rights reserved.
7  *
8  * Author: Keith Bostic, Chris G. Demetriou
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 #ifndef	ASSEMBLER
32 struct prom_vec {
33 	int	(*routine) __P((struct crd *));
34 	struct crd *routine_arg;
35 };
36 
37 /* The return value from a prom call. */
38 typedef union {
39 	struct {
40 		u_int64_t
41 			retval	: 32,		/* return value. */
42 			unit	: 8,
43 			mbz	: 8,
44 			error	: 13,
45 			status	: 3;
46 	} u;
47 	u_int64_t bits;
48 } prom_return_t;
49 
50 #ifdef STANDALONE
51 int	getchar __P((void));
52 int	prom_open __P((char *, int));
53 void	putchar __P((int));
54 #endif
55 
56 void	prom_halt __P((int)) __attribute__((__noreturn__));
57 int	prom_getenv __P((int, char *, int));
58 
59 void	init_prom_interface __P((void));
60 void	hwrbp_restart_setup __P((void));
61 int	prom_dispatch __P((int, ...));
62 int	promcnlookc __P((dev_t, char *));
63 #endif
64 
65 /* Prom operation values. */
66 #define	PROM_R_CLOSE		0x11
67 #define	PROM_R_GETC		0x01
68 #define	PROM_R_GETENV		0x22
69 #define	PROM_R_OPEN		0x10
70 #define	PROM_R_PUTS		0x02
71 #define	PROM_R_READ		0x13
72 #define	PROM_R_WRITE		0x14
73 
74 /* Environment variable values. */
75 #define	PROM_E_BOOTED_DEV	0x4
76 #define	PROM_E_BOOTED_FILE	0x6
77 #define	PROM_E_BOOTED_OSFLAGS	0x8
78 #define	PROM_E_TTY_DEV		0xf
79 
80 /*
81  * There have to be stub routines to do the copying that ensures that the
82  * PROM doesn't get called with an address larger than 32 bits.  Calls that
83  * either don't need to copy anything, or don't need the copy because it's
84  * already being done elsewhere, are defined here.
85  */
86 #define	prom_close(chan)	prom_dispatch(PROM_R_CLOSE, chan)
87 #define	prom_read(chan, len, buf, blkno) \
88 	prom_dispatch(PROM_R_READ, chan, len, buf, blkno)
89 #define	prom_write(chan, len, buf, blkno) \
90 	prom_dispatch(PROM_R_WRITE, chan, len, buf, blkno)
91