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