Home | History | Annotate | Line # | Download | only in include
prom.h revision 1.8
      1  1.8  thorpej /* $NetBSD: prom.h,v 1.8 1998/05/25 04:01:10 thorpej Exp $ */
      2  1.1      cgd 
      3  1.1      cgd /*
      4  1.6      cgd  * Copyright (c) 1994, 1995, 1996 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.5      cgd 	u_int64_t	routine;
     33  1.5      cgd 	void		*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.4      cgd 
     58  1.4      cgd void	hwrpb_restart_setup __P((void));
     59  1.1      cgd #endif
     60  1.1      cgd 
     61  1.1      cgd /* Prom operation values. */
     62  1.1      cgd #define	PROM_R_CLOSE		0x11
     63  1.1      cgd #define	PROM_R_GETC		0x01
     64  1.1      cgd #define	PROM_R_GETENV		0x22
     65  1.1      cgd #define	PROM_R_OPEN		0x10
     66  1.1      cgd #define	PROM_R_PUTS		0x02
     67  1.1      cgd #define	PROM_R_READ		0x13
     68  1.3      cgd #define	PROM_R_WRITE		0x14
     69  1.1      cgd 
     70  1.1      cgd /* Environment variable values. */
     71  1.1      cgd #define	PROM_E_BOOTED_DEV	0x4
     72  1.1      cgd #define	PROM_E_BOOTED_FILE	0x6
     73  1.1      cgd #define	PROM_E_BOOTED_OSFLAGS	0x8
     74  1.1      cgd #define	PROM_E_TTY_DEV		0xf
     75  1.8  thorpej #define	PROM_E_SCSIID		0x42
     76  1.8  thorpej #define	PROM_E_SCSIFAST		0x43
     77  1.1      cgd 
     78  1.1      cgd /*
     79  1.1      cgd  * There have to be stub routines to do the copying that ensures that the
     80  1.1      cgd  * PROM doesn't get called with an address larger than 32 bits.  Calls that
     81  1.1      cgd  * either don't need to copy anything, or don't need the copy because it's
     82  1.1      cgd  * already being done elsewhere, are defined here.
     83  1.1      cgd  */
     84  1.5      cgd #define	prom_close(chan)						\
     85  1.5      cgd 	prom_dispatch(PROM_R_CLOSE, chan, 0, 0, 0)
     86  1.5      cgd #define	prom_read(chan, len, buf, blkno)				\
     87  1.5      cgd 	prom_dispatch(PROM_R_READ, chan, len, (u_int64_t)buf, blkno)
     88  1.5      cgd #define	prom_write(chan, len, buf, blkno)				\
     89  1.5      cgd 	prom_dispatch(PROM_R_WRITE, chan, len, (u_int64_t)buf, blkno)
     90  1.5      cgd #define	prom_putstr(chan, str, len)					\
     91  1.5      cgd 	prom_dispatch(PROM_R_PUTS, chan, (u_int64_t)str, len, 0)
     92  1.5      cgd #define	prom_getc(chan)							\
     93  1.5      cgd 	prom_dispatch(PROM_R_GETC, chan, 0, 0, 0)
     94  1.5      cgd #define prom_getenv_disp(id, buf, len)					\
     95  1.5      cgd 	prom_dispatch(PROM_R_GETENV, id, (u_int64_t)buf, len, 0)
     96  1.5      cgd 
     97  1.5      cgd #ifndef ASSEMBLER
     98  1.5      cgd #ifdef _KERNEL
     99  1.5      cgd void	promcnputc __P((dev_t, int));
    100  1.5      cgd int	promcngetc __P((dev_t));
    101  1.5      cgd int	promcnlookc __P((dev_t, char *));
    102  1.5      cgd 
    103  1.5      cgd u_int64_t	prom_dispatch __P((u_int64_t, u_int64_t, u_int64_t, u_int64_t,
    104  1.5      cgd 		    u_int64_t));
    105  1.5      cgd #endif /* _KERNEL */
    106  1.5      cgd #endif /* ASSEMBLER */
    107