Annotation of sys/arch/sparc/include/oldmon.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: oldmon.h,v 1.9 2002/03/15 01:20:04 millert Exp $ */
2: /* $NetBSD: oldmon.h,v 1.11 1996/03/31 22:21:38 pk Exp $ */
3:
4: /*
5: * Copyright (C) 1985 Regents of the University of California
6: * Copyright (c) 1993 Adam Glass
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. All advertising materials mentioning features or use of this software
18: * must display the following acknowledgement:
19: * This product includes software developed by Adam Glass.
20: * 4. The name of the Author may not be used to endorse or promote products
21: * derived from this software without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
24: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: * SUCH DAMAGE.
34: *
35: * from: Sprite /cdrom/src/kernel/Cvsroot/kernel/mach/sun3.md/machMon.h,v
36: * 9.1 90/10/03 13:52:34 mgbaker Exp SPRITE (Berkeley)
37: */
38: #ifndef _MACHINE_OLDMON_H
39: #define _MACHINE_OLDMON_H
40:
41: /*
42: * Structures, constants and defines for access to the sun monitor.
43: * These are translated from the sun monitor header file "sunromvec.h".
44: *
45: * The memory addresses for the PROM, and the EEPROM.
46: * On the sun2 these addresses are actually 0x00EF??00
47: * but only the bottom 24 bits are looked at so these still
48: * work ok.
49: */
50: #define PROM_BASE 0xffe81000
51:
52: enum maptypes { /* Page map entry types. */
53: MAP_MAINMEM,
54: MAP_OBIO,
55: MAP_MBMEM,
56: MAP_MBIO,
57: MAP_VME16A16D,
58: MAP_VME16A32D,
59: MAP_VME24A16D,
60: MAP_VME24A32D,
61: MAP_VME32A16D,
62: MAP_VME32A32D
63: };
64: /*
65: * This table gives information about the resources needed by a device.
66: */
67: struct devinfo {
68: unsigned int d_devbytes; /* Bytes occupied by device in IO space.*/
69: unsigned int d_dmabytes; /* Bytes needed by device in DMA memory.*/
70: unsigned int d_localbytes;/* Bytes needed by device for local info.*/
71: unsigned int d_stdcount; /* How many standard addresses. */
72: unsigned long *d_stdaddrs; /* The vector of standard addresses. */
73: enum maptypes d_devtype; /* What map space device is in. */
74: unsigned int d_maxiobytes;/* Size to break big I/O's into. */
75: };
76:
77: /*
78: * A "stand alone I/O request".
79: * This is passed as the main argument to the PROM I/O routines
80: * in the `om_boottable' structure.
81: */
82: struct saioreq {
83: char si_flgs;
84: struct om_boottable *si_boottab;/* Points to boottab entry if any */
85: char *si_devdata; /* Device-specific data pointer */
86: int si_ctlr; /* Controller number or address */
87: int si_unit; /* Unit number within controller */
88: long si_boff; /* Partition number within unit */
89: long si_cyloff;
90: long si_offset;
91: long si_bn; /* Block number to R/W */
92: char *si_ma; /* Memory address to R/W */
93: int si_cc; /* Character count to R/W */
94: struct saif *si_sif; /* net if. pointer (set by b_open) */
95: char *si_devaddr; /* Points to mapped in device */
96: char *si_dmaaddr; /* Points to allocated DMA space */
97: };
98: #define SAIO_F_READ 0x01
99: #define SAIO_F_WRITE 0x02
100: #define SAIO_F_ALLOC 0x04
101: #define SAIO_F_FILE 0x08
102: #define SAIO_F_EOF 0x10 /* EOF on device */
103: #define SAIO_F_AJAR 0x20 /* Descriptor "ajar" (stopped but not closed) */
104:
105:
106: /*
107: * The table entry that describes a device. It exists in the PROM; a
108: * pointer to it is passed in MachMonBootParam. It can be used to locate
109: * PROM subroutines for opening, reading, and writing the device.
110: *
111: * When using this interface, only one device can be open at once.
112: *
113: * NOTE: I am not sure what arguments boot, open, close, and strategy take.
114: * What is here is just translated verbatim from the sun monitor code. We
115: * should figure this out eventually if we need it.
116: */
117: struct om_boottable {
118: char b_devname[2]; /* The name of the device */
119: int (*b_probe)(void); /* probe() --> -1 or found controller
120: number */
121: int (*b_boot)(void); /* boot(bp) --> -1 or start address */
122: int (*b_open)(struct saioreq *);/* open(iobp) --> -1 or 0 */
123: int (*b_close)(struct saioreq *);/* close(iobp) --> -1 or 0 */
124: int (*b_strategy)(struct saioreq *, int);/* strategy(iobp,rw) --> -1 or 0 */
125: char *b_desc; /* Printable string describing dev */
126: struct devinfo *b_devinfo; /* info to configure device. */
127: };
128:
129: /*
130: * Structure set up by the boot command to pass arguments to the program that
131: * is booted.
132: */
133: struct om_bootparam {
134: char *argPtr[8]; /* String arguments */
135: char strings[100]; /* String table for string arguments */
136: char devName[2]; /* Device name */
137: int ctlrNum; /* Controller number */
138: int unitNum; /* Unit number */
139: int partNum; /* Partition/file number */
140: char *fileName; /* File name, points into strings */
141: struct om_boottable *bootTable; /* Points to table entry for device */
142: };
143:
144: /*
145: * Here is the structure of the vector table which is at the front of the boot
146: * rom. The functions defined in here are explained below.
147: *
148: * NOTE: This struct has references to the structures keybuf and globram which
149: * I have not translated. If anyone needs to use these they should
150: * translate these structs into Sprite format.
151: */
152: struct om_vector {
153: char *initSp; /* Initial system stack ptr for hardware */
154: int (*startMon)(void);/* Initial PC for hardware */
155: int *diagberr; /* Bus err handler for diags */
156:
157: /* Monitor and hardware revision and identification */
158: struct om_bootparam **bootParam;/* Info for bootstrapped pgm */
159: u_long *memorySize; /* Usable memory in bytes */
160:
161: /* Single-character input and output */
162: int (*getChar)(void); /* Get char from input source */
163: void (*putChar)(int); /* Put char to output sink */
164: int (*mayGet)(void); /* Maybe get char, or -1 */
165: int (*mayPut)(int); /* Maybe put char, or -1 */
166: u_char *echo; /* Should getchar echo? */
167: u_char *inSource; /* Input source selector */
168: u_char *outSink; /* Output sink selector */
169: #define PROMDEV_KBD 0 /* input from keyboard */
170: #define PROMDEV_SCREEN 0 /* output to screen */
171: #define PROMDEV_TTYA 1 /* in/out to ttya */
172: #define PROMDEV_TTYB 2 /* in/out to ttyb */
173:
174: /* Keyboard input (scanned by monitor nmi routine) */
175: int (*getKey)(void); /* Get next key if one exists */
176: int (*initGetKey)(void); /* Initialize get key */
177: u_int *translation; /* Kbd translation selector */
178: u_char *keyBid; /* Keyboard ID byte */
179: int *screen_x; /* V2: Screen x pos (R/O) */
180: int *screen_y; /* V2: Screen y pos (R/O) */
181: struct keybuf *keyBuf; /* Up/down keycode buffer */
182:
183: /* Monitor revision level. */
184: char *monId;
185:
186: /* Frame buffer output and terminal emulation */
187: int (*fbWriteChar)(void); /* Write a character to FB */
188: int *fbAddr; /* Address of frame buffer */
189: char **font; /* Font table for FB */
190: void (*fbWriteStr)(char *, int);
191: /* Quickly write string to FB */
192:
193: /* Reboot interface routine -- resets and reboots system. */
194: void (*reBoot)(char *); /* e.g. reBoot("xy()vmunix") */
195:
196: /* Line input and parsing */
197: u_char *lineBuf; /* The line input buffer */
198: u_char **linePtr; /* Cur pointer into linebuf */
199: int *lineSize; /* length of line in linebuf */
200: int (*getLine)(void); /* Get line from user */
201: u_char (*getNextChar)(void); /* Get next char from linebuf */
202: u_char (*peekNextChar)(void); /* Peek at next char */
203: int *fbThere; /* =1 if frame buffer there */
204: int (*getNum)(void); /* Grab hex num from line */
205:
206: /* Print formatted output to current output sink */
207: int (*printf)(void); /* Similar to "Kernel printf" */
208: int (*printHex)(void); /* Format N digits in hex */
209:
210: /* Led stuff */
211: u_char *leds; /* RAM copy of LED register */
212: int (*setLeds)(void); /* Sets LED's and RAM copy */
213:
214: /* Non-maskable interrupt (nmi) information */
215: int (*nmiAddr)(void); /* Addr for level 7 vector */
216: void (*abortEntry)(void); /* Entry for keyboard abort */
217: int *nmiClock; /* Counts up in msec */
218:
219: /* Frame buffer type: see <machine/fbio.h> */
220: int *fbType;
221:
222: /* Assorted other things */
223: u_long romvecVersion; /* Version # of Romvec */
224: struct globram *globRam; /* monitor global variables */
225: caddr_t kbdZscc; /* Addr of keyboard in use */
226:
227: int *keyrInit; /* ms before kbd repeat */
228: u_char *keyrTick; /* ms between repetitions */
229: u_long *memoryAvail; /* V1: Main mem usable size */
230: long *resetAddr; /* where to jump on a reset */
231: long *resetMap; /* pgmap entry for resetaddr */
232: /* Really struct pgmapent * */
233:
234: /* Exit from user program */
235: void (*exitToMon)(void) __attribute__((__noreturn__));
236: u_char **memorybitmap; /* V1: &{0 or &bits} */
237: /* Set seg in any context */
238: void (*setcxsegmap)(int, caddr_t, int);
239: void (**vector_cmd)(u_long, char *);/* V2: Handler for 'v' cmd */
240: u_long *ExpectedTrapSig;
241: u_long *TrapVectorTable;
242: int dummy1z;
243: int dummy2z;
244: int dummy3z;
245: int dummy4z;
246: };
247:
248: #define romVectorPtr ((struct om_vector *)PROM_BASE)
249:
250: #define mon_printf (romVectorPtr->printf)
251: #define mon_putchar (romVectorPtr->putChar)
252: #define mon_may_getchar (romVectorPtr->mayGet)
253: #define mon_exit_to_mon (romVectorPtr->exitToMon)
254: #define mon_reboot (romVectorPtr->exitToMon)
255: #define mon_panic(x) { mon_printf(x); mon_exit_to_mon();}
256:
257: #define mon_setcxsegmap(context, va, sme) \
258: romVectorPtr->setcxsegmap(context, va, sme)
259: #define romp (romVectorPtr)
260:
261: /*
262: * OLDMON_STARTVADDR and OLDMON_ENDVADDR denote the range of the damn monitor.
263: *
264: * supposedly you can steal pmegs within this range that do not contain
265: * valid pages.
266: */
267: #define OLDMON_STARTVADDR 0xFFD00000
268: #define OLDMON_ENDVADDR 0xFFF00000
269:
270: /*
271: * These describe the monitor's short segment which it basically uses to map
272: * one stupid page that it uses for storage. MONSHORTPAGE is the page,
273: * and MONSHORTSEG is the segment that it is in. If this sounds dumb to
274: * you, it is. I can change the pmeg, but not the virtual address.
275: * Sun defines these with the high nibble set to 0xF. I believe this was
276: * for the monitor source which accesses this piece of memory with addressing
277: * limitations or some such crud. I haven't replicated this here, because
278: * it is confusing, and serves no obvious purpose if you aren't the monitor.
279: *
280: */
281: #define MONSHORTPAGE 0x0FFFE000
282: #define MONSHORTSEG 0x0FFE0000
283:
284:
285:
286: /*
287: * Ethernet interface descriptor
288: * First, set: saiop->si_devaddr, saiop->si_dmaaddr, etc.
289: * Then: saiop->si_boottab->b_open() will set:
290: * saiop->si_sif;
291: * saiop->si_devdata;
292: * The latter is the first arg to the following functions.
293: * Note that the buffer must be in DVMA space...
294: */
295: struct saif {
296: /* transmit packet, returns zero on success. */
297: int (*sif_xmit)(void *devdata, char *buf, int len);
298: /* wait for packet, zero if none arrived */
299: int (*sif_poll)(void *devdata, char *buf);
300: /* reset interface, set addresses, etc. */
301: int (*sif_reset)(void *devdata, struct saioreq *sip);
302: /* Later (sun4 only) proms have more stuff here. */
303: };
304:
305:
306: #if defined(SUN4)
307: void oldmon_w_trace(u_long);
308: void oldmon_w_cmd(u_long, char *);
309: #endif
310:
311: #endif /* _MACHINE_OLDMON_H */
CVSweb