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