prom.h revision 1.1 1 1.1 cgd /* $NetBSD: prom.h,v 1.1 1995/02/13 23:07:48 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.1 cgd int prom_getenv __P((int, char *, int));
56 1.1 cgd #endif
57 1.1 cgd
58 1.1 cgd /* Prom operation values. */
59 1.1 cgd #define PROM_R_CLOSE 0x11
60 1.1 cgd #define PROM_R_GETC 0x01
61 1.1 cgd #define PROM_R_GETENV 0x22
62 1.1 cgd #define PROM_R_OPEN 0x10
63 1.1 cgd #define PROM_R_PUTS 0x02
64 1.1 cgd #define PROM_R_READ 0x13
65 1.1 cgd
66 1.1 cgd /* Environment variable values. */
67 1.1 cgd #define PROM_E_BOOTED_DEV 0x4
68 1.1 cgd #define PROM_E_BOOTED_FILE 0x6
69 1.1 cgd #define PROM_E_BOOTED_OSFLAGS 0x8
70 1.1 cgd #define PROM_E_TTY_DEV 0xf
71 1.1 cgd
72 1.1 cgd /*
73 1.1 cgd * There have to be stub routines to do the copying that ensures that the
74 1.1 cgd * PROM doesn't get called with an address larger than 32 bits. Calls that
75 1.1 cgd * either don't need to copy anything, or don't need the copy because it's
76 1.1 cgd * already being done elsewhere, are defined here.
77 1.1 cgd */
78 1.1 cgd #define prom_close(chan) prom_dispatch(PROM_R_CLOSE, chan)
79 1.1 cgd #define prom_read(chan, len, buf, blkno) \
80 1.1 cgd prom_dispatch(PROM_R_READ, chan, len, buf, blkno)
81