2000-06-08 07:10:06 +04:00
|
|
|
/* $NetBSD: prom.h,v 1.12 2000/06/08 03:10:06 thorpej Exp $ */
|
1995-02-14 02:06:39 +03:00
|
|
|
|
|
|
|
/*
|
1996-11-14 01:20:54 +03:00
|
|
|
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
1995-02-14 02:06:39 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Keith Bostic, Chris G. Demetriou
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ASSEMBLER
|
|
|
|
struct prom_vec {
|
1996-11-14 00:13:04 +03:00
|
|
|
u_int64_t routine;
|
|
|
|
void *routine_arg;
|
1995-02-14 02:06:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* The return value from a prom call. */
|
|
|
|
typedef union {
|
|
|
|
struct {
|
|
|
|
u_int64_t
|
|
|
|
retval : 32, /* return value. */
|
|
|
|
unit : 8,
|
|
|
|
mbz : 8,
|
|
|
|
error : 13,
|
|
|
|
status : 3;
|
|
|
|
} u;
|
|
|
|
u_int64_t bits;
|
|
|
|
} prom_return_t;
|
|
|
|
|
1998-10-15 04:47:28 +04:00
|
|
|
#ifdef _STANDALONE
|
2000-06-08 07:10:06 +04:00
|
|
|
int getchar(void);
|
|
|
|
void putchar(int);
|
1995-02-14 02:06:39 +03:00
|
|
|
#endif
|
|
|
|
|
2000-06-08 07:10:06 +04:00
|
|
|
void prom_halt(int) __attribute__((__noreturn__));
|
|
|
|
int prom_getenv(int, char *, int);
|
1996-10-16 03:52:49 +04:00
|
|
|
|
2000-06-08 07:10:06 +04:00
|
|
|
void hwrpb_primary_init(void);
|
|
|
|
void hwrpb_restart_setup(void);
|
1995-02-14 02:06:39 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Prom operation values. */
|
|
|
|
#define PROM_R_CLOSE 0x11
|
|
|
|
#define PROM_R_GETC 0x01
|
|
|
|
#define PROM_R_GETENV 0x22
|
|
|
|
#define PROM_R_OPEN 0x10
|
|
|
|
#define PROM_R_PUTS 0x02
|
|
|
|
#define PROM_R_READ 0x13
|
1996-09-27 02:51:53 +04:00
|
|
|
#define PROM_R_WRITE 0x14
|
1998-10-15 04:47:28 +04:00
|
|
|
#define PROM_R_IOCTL 0x12
|
|
|
|
|
|
|
|
/* Prom IOCTL operation subcodes */
|
|
|
|
#define PROM_I_SKIP2IRG 1
|
|
|
|
#define PROM_I_SKIP2MARK 2
|
|
|
|
#define PROM_I_REWIND 3
|
|
|
|
#define PROM_I_WRITEMARK 4
|
1995-02-14 02:06:39 +03:00
|
|
|
|
|
|
|
/* Environment variable values. */
|
|
|
|
#define PROM_E_BOOTED_DEV 0x4
|
|
|
|
#define PROM_E_BOOTED_FILE 0x6
|
|
|
|
#define PROM_E_BOOTED_OSFLAGS 0x8
|
|
|
|
#define PROM_E_TTY_DEV 0xf
|
1998-05-25 08:01:10 +04:00
|
|
|
#define PROM_E_SCSIID 0x42
|
|
|
|
#define PROM_E_SCSIFAST 0x43
|
1995-02-14 02:06:39 +03:00
|
|
|
|
1998-10-15 04:47:28 +04:00
|
|
|
#if defined(_STANDALONE) || defined(ENABLEPROM)
|
1995-02-14 02:06:39 +03:00
|
|
|
/*
|
1998-10-15 04:47:28 +04:00
|
|
|
* These can't be called from the kernel without great care.
|
|
|
|
*
|
1995-02-14 02:06:39 +03:00
|
|
|
* There have to be stub routines to do the copying that ensures that the
|
|
|
|
* PROM doesn't get called with an address larger than 32 bits. Calls that
|
|
|
|
* either don't need to copy anything, or don't need the copy because it's
|
|
|
|
* already being done elsewhere, are defined here.
|
|
|
|
*/
|
1998-10-15 04:47:28 +04:00
|
|
|
#define prom_open(dev, len) \
|
|
|
|
prom_dispatch(PROM_R_OPEN, (dev), (len), 0, 0)
|
1996-11-14 00:13:04 +03:00
|
|
|
#define prom_close(chan) \
|
|
|
|
prom_dispatch(PROM_R_CLOSE, chan, 0, 0, 0)
|
|
|
|
#define prom_read(chan, len, buf, blkno) \
|
|
|
|
prom_dispatch(PROM_R_READ, chan, len, (u_int64_t)buf, blkno)
|
|
|
|
#define prom_write(chan, len, buf, blkno) \
|
|
|
|
prom_dispatch(PROM_R_WRITE, chan, len, (u_int64_t)buf, blkno)
|
1998-10-15 04:47:28 +04:00
|
|
|
#define prom_ioctl(chan, op, count) \
|
|
|
|
prom_dispatch(PROM_R_IOCTL, chan, op, (int64_t)count, 0, 0)
|
1996-11-14 00:13:04 +03:00
|
|
|
#define prom_putstr(chan, str, len) \
|
|
|
|
prom_dispatch(PROM_R_PUTS, chan, (u_int64_t)str, len, 0)
|
|
|
|
#define prom_getc(chan) \
|
|
|
|
prom_dispatch(PROM_R_GETC, chan, 0, 0, 0)
|
|
|
|
#define prom_getenv_disp(id, buf, len) \
|
|
|
|
prom_dispatch(PROM_R_GETENV, id, (u_int64_t)buf, len, 0)
|
1998-10-15 04:47:28 +04:00
|
|
|
#endif
|
1996-11-14 00:13:04 +03:00
|
|
|
|
|
|
|
#ifndef ASSEMBLER
|
|
|
|
#ifdef _KERNEL
|
2000-06-08 07:10:06 +04:00
|
|
|
int prom_enter(void);
|
|
|
|
void prom_leave(int);
|
1998-09-25 01:18:13 +04:00
|
|
|
|
2000-06-08 07:10:06 +04:00
|
|
|
void promcnputc(dev_t, int);
|
|
|
|
int promcngetc(dev_t);
|
|
|
|
int promcnlookc(dev_t, char *);
|
1996-11-14 00:13:04 +03:00
|
|
|
|
2000-06-08 07:10:06 +04:00
|
|
|
u_int64_t prom_dispatch(u_int64_t, u_int64_t, u_int64_t, u_int64_t,
|
|
|
|
u_int64_t);
|
1996-11-14 00:13:04 +03:00
|
|
|
#endif /* _KERNEL */
|
|
|
|
#endif /* ASSEMBLER */
|