1 |
/* GXemul: $Id: alpha_prom.h,v 1.2 2006/09/01 16:40:57 debug 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 |
#if 0 |
32 |
|
33 |
#ifndef ASSEMBLER |
34 |
struct prom_vec { |
35 |
u_int64_t routine; |
36 |
void *routine_arg; |
37 |
}; |
38 |
|
39 |
/* The return value from a prom call. */ |
40 |
typedef union { |
41 |
struct { |
42 |
u_int64_t |
43 |
retval : 32, /* return value. */ |
44 |
unit : 8, |
45 |
mbz : 8, |
46 |
error : 13, |
47 |
status : 3; |
48 |
} u; |
49 |
u_int64_t bits; |
50 |
} prom_return_t; |
51 |
|
52 |
#ifdef _STANDALONE |
53 |
int getchar(void); |
54 |
void putchar(int); |
55 |
#endif |
56 |
|
57 |
void prom_halt(int) __attribute__((__noreturn__)); |
58 |
int prom_getenv(int, char *, int); |
59 |
|
60 |
void hwrpb_primary_init(void); |
61 |
void hwrpb_restart_setup(void); |
62 |
#endif |
63 |
|
64 |
#endif |
65 |
|
66 |
/* Prom operation values. */ |
67 |
#define PROM_R_CLOSE 0x11 |
68 |
#define PROM_R_GETC 0x01 |
69 |
#define PROM_R_GETENV 0x22 |
70 |
#define PROM_R_OPEN 0x10 |
71 |
#define PROM_R_PUTS 0x02 |
72 |
#define PROM_R_READ 0x13 |
73 |
#define PROM_R_WRITE 0x14 |
74 |
#define PROM_R_IOCTL 0x12 |
75 |
|
76 |
/* Prom IOCTL operation subcodes */ |
77 |
#define PROM_I_SKIP2IRG 1 |
78 |
#define PROM_I_SKIP2MARK 2 |
79 |
#define PROM_I_REWIND 3 |
80 |
#define PROM_I_WRITEMARK 4 |
81 |
|
82 |
/* Environment variable values. */ |
83 |
#define PROM_E_BOOTED_DEV 0x4 |
84 |
#define PROM_E_BOOTED_FILE 0x6 |
85 |
#define PROM_E_BOOTED_OSFLAGS 0x8 |
86 |
#define PROM_E_TTY_DEV 0xf |
87 |
#define PROM_E_SCSIID 0x42 |
88 |
#define PROM_E_SCSIFAST 0x43 |
89 |
|
90 |
#if defined(_STANDALONE) || defined(ENABLEPROM) |
91 |
/* |
92 |
* These can't be called from the kernel without great care. |
93 |
* |
94 |
* There have to be stub routines to do the copying that ensures that the |
95 |
* PROM doesn't get called with an address larger than 32 bits. Calls that |
96 |
* either don't need to copy anything, or don't need the copy because it's |
97 |
* already being done elsewhere, are defined here. |
98 |
*/ |
99 |
#define prom_open(dev, len) \ |
100 |
prom_dispatch(PROM_R_OPEN, (dev), (len), 0, 0) |
101 |
#define prom_close(chan) \ |
102 |
prom_dispatch(PROM_R_CLOSE, chan, 0, 0, 0) |
103 |
#define prom_read(chan, len, buf, blkno) \ |
104 |
prom_dispatch(PROM_R_READ, chan, len, (u_int64_t)buf, blkno) |
105 |
#define prom_write(chan, len, buf, blkno) \ |
106 |
prom_dispatch(PROM_R_WRITE, chan, len, (u_int64_t)buf, blkno) |
107 |
#define prom_ioctl(chan, op, count) \ |
108 |
prom_dispatch(PROM_R_IOCTL, chan, op, (int64_t)count, 0, 0) |
109 |
#define prom_putstr(chan, str, len) \ |
110 |
prom_dispatch(PROM_R_PUTS, chan, (u_int64_t)str, len, 0) |
111 |
#define prom_getc(chan) \ |
112 |
prom_dispatch(PROM_R_GETC, chan, 0, 0, 0) |
113 |
#define prom_getenv_disp(id, buf, len) \ |
114 |
prom_dispatch(PROM_R_GETENV, id, (u_int64_t)buf, len, 0) |
115 |
#endif |
116 |
|
117 |
#ifndef ASSEMBLER |
118 |
#ifdef _KERNEL |
119 |
int prom_enter(void); |
120 |
void prom_leave(int); |
121 |
|
122 |
void promcnputc(dev_t, int); |
123 |
int promcngetc(dev_t); |
124 |
int promcnlookc(dev_t, char *); |
125 |
|
126 |
u_int64_t prom_dispatch(u_int64_t, u_int64_t, u_int64_t, u_int64_t, |
127 |
u_int64_t); |
128 |
#endif /* _KERNEL */ |
129 |
#endif /* ASSEMBLER */ |