Annotation of sys/arch/alpha/include/prom.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: prom.h,v 1.8 2000/11/08 21:27:22 ericj Exp $ */
2: /* $NetBSD: prom.h,v 1.12 2000/06/08 03:10:06 thorpej Exp $ */
3:
4: /*
5: * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
6: * All rights reserved.
7: *
8: * Author: Keith Bostic, Chris G. Demetriou
9: *
10: * Permission to use, copy, modify and distribute this software and
11: * its documentation is hereby granted, provided that both the copyright
12: * notice and this permission notice appear in all copies of the
13: * software, derivative works or modified versions, and any portions
14: * thereof, and that both notices appear in supporting documentation.
15: *
16: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18: * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19: *
20: * Carnegie Mellon requests users of this software to return to
21: *
22: * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23: * School of Computer Science
24: * Carnegie Mellon University
25: * Pittsburgh PA 15213-3890
26: *
27: * any improvements or extensions that they make and grant Carnegie the
28: * rights to redistribute these changes.
29: */
30:
31: #ifndef ASSEMBLER
32: struct prom_vec {
33: u_int64_t routine;
34: void *routine_arg;
35: };
36:
37: /* The return value from a prom call. */
38: typedef union {
39: struct {
40: u_int64_t
41: retval : 32, /* return value. */
42: unit : 8,
43: mbz : 8,
44: error : 13,
45: status : 3;
46: } u;
47: u_int64_t bits;
48: } prom_return_t;
49:
50: #ifdef _STANDALONE
51: int getchar(void);
52: int prom_open(char *, int);
53: void putchar(int);
54: #endif
55:
56: void prom_halt(int) __attribute__((__noreturn__));
57: int prom_getenv(int, char *, int);
58:
59: void hwrpb_primary_init(void);
60: void hwrpb_restart_setup(void);
61: #endif
62:
63: /* Prom operation values. */
64: #define PROM_R_CLOSE 0x11
65: #define PROM_R_GETC 0x01
66: #define PROM_R_GETENV 0x22
67: #define PROM_R_OPEN 0x10
68: #define PROM_R_PUTS 0x02
69: #define PROM_R_READ 0x13
70: #define PROM_R_WRITE 0x14
71: #define PROM_R_IOCTL 0x12
72:
73: /* Prom IOCTL operation subcodes */
74: #define PROM_I_SKIP2IRG 1
75: #define PROM_I_SKIP2MARK 2
76: #define PROM_I_REWIND 3
77: #define PROM_I_WRITEMARK 4
78:
79: /* Environment variable values. */
80: #define PROM_E_BOOTED_DEV 0x4
81: #define PROM_E_BOOTED_FILE 0x6
82: #define PROM_E_BOOTED_OSFLAGS 0x8
83: #define PROM_E_TTY_DEV 0xf
84: #define PROM_E_SCSIID 0x42
85: #define PROM_E_SCSIFAST 0x43
86:
87: #if defined(_STANDALONE) || defined(ENABLEPROM)
88: /*
89: * These can't be called from the kernel without great care.
90: *
91: * There have to be stub routines to do the copying that ensures that the
92: * PROM doesn't get called with an address larger than 32 bits. Calls that
93: * either don't need to copy anything, or don't need the copy because it's
94: * already being done elsewhere, are defined here.
95: */
96: #define prom_close(chan) \
97: prom_dispatch(PROM_R_CLOSE, chan, 0, 0, 0)
98: #define prom_read(chan, len, buf, blkno) \
99: prom_dispatch(PROM_R_READ, chan, len, (u_int64_t)buf, blkno)
100: #define prom_write(chan, len, buf, blkno) \
101: prom_dispatch(PROM_R_WRITE, chan, len, (u_int64_t)buf, blkno)
102: #define prom_ioctl(chan, op, count) \
103: prom_dispatch(PROM_R_IOCTL, chan, op, (int64_t)count, 0, 0)
104: #define prom_putstr(chan, str, len) \
105: prom_dispatch(PROM_R_PUTS, chan, (u_int64_t)str, len, 0)
106: #define prom_getc(chan) \
107: prom_dispatch(PROM_R_GETC, chan, 0, 0, 0)
108: #define prom_getenv_disp(id, buf, len) \
109: prom_dispatch(PROM_R_GETENV, id, (u_int64_t)buf, len, 0)
110: #endif
111:
112: #ifndef ASSEMBLER
113: #ifdef _KERNEL
114: int prom_enter(void);
115: void prom_leave(int);
116:
117: void promcnputc(dev_t, int);
118: int promcngetc(dev_t);
119: int promcnlookc(dev_t, char *);
120:
121: u_int64_t prom_dispatch(u_int64_t, u_int64_t, u_int64_t, u_int64_t,
122: u_int64_t);
123: #endif /* _KERNEL */
124: #endif /* ASSEMBLER */
CVSweb