|
|
1.1 ! root 1: /* @(#)sunromvec.h 2.30 85/08/13 SMI */ ! 2: ! 3: /* ! 4: * Copyright (c) 1985 by Sun Microsystems, Inc. ! 5: */ ! 6: ! 7: #ifndef MONSTART ! 8: /* ! 9: * sunromvec.h ! 10: * ! 11: * This file defines the entire interface between the PROM Monitor ! 12: * and programs (or kernels) that run under it. ! 13: * ! 14: * The main interface is the vector table at the front of the boot rom. ! 15: * ! 16: * This vector table is the only knowledge the outside world has of this prom. ! 17: * It is referenced by hardware (Reset SSP, PC), and software. ! 18: * Once located, no entry can be re-located unless you change the world ! 19: * that needs it. ! 20: * ! 21: * The easiest way to reference elements of this vector is to say: ! 22: * ! 23: * *romp->xxx ! 24: * ! 25: * as in: ! 26: * ! 27: * (*romp->v_putchar) (c); ! 28: * ! 29: * This is pretty cheap as it only generates movl 0xNNNNNNNN:l,a0; jsr a0@ . ! 30: * That's 2 bytes longer, and 4 cycles longer, than a simple subroutine call. ! 31: * ! 32: * Various entries have been added at various times. As of Rev N PROM ! 33: * Monitors, the vector table includes an entry "v_romvec_version" which ! 34: * is an integer defining which entries in the table are valid. The ! 35: * comments on each entry say which version the entry first appeared in ! 36: * with a prefix like "V1:". To determine if the PROMs your program is ! 37: * running under contain the entry, you can simply compare the value ! 38: * of v_romvec_version to the constant in the comment field, e.g. ! 39: * ! 40: * if (romp->v_romvec_version >= 1) ! 41: * { reference *romp->v_memorybitmap...} ! 42: * else ! 43: * { running under older prom, punt somehow } ! 44: * ! 45: * Entries which do not contain a "Vn:" string are in Version 0 of the ! 46: * proms (Rev N and onward). ! 47: */ ! 48: ! 49: struct sunromvec { ! 50: char *v_initsp; /* Initial SSP for hardware */ ! 51: void (*v_startmon)(); /* Initial PC for hardware */ ! 52: int *v_diagberr; /* Bus err handler for diags */ ! 53: ! 54: /* Configuration information passed to standalone code & Unix */ ! 55: struct bootparam **v_bootparam; /* Info for bootstrapped pgm */ ! 56: unsigned *v_memorysize; /* Total phys memory in bytes */ ! 57: ! 58: /* Single-character input and output */ ! 59: unsigned char (*v_getchar)(); /* Get char from input source */ ! 60: void (*v_putchar)(); /* Put char to output sink */ ! 61: int (*v_mayget)(); /* Maybe get char, or -1 */ ! 62: int (*v_mayput)(); /* Maybe put char, or -1 */ ! 63: unsigned char *v_echo; /* Should getchar echo? */ ! 64: unsigned char *v_insource; /* Input source selector */ ! 65: unsigned char *v_outsink; /* Output sink selector */ ! 66: ! 67: /* Keyboard input and frame buffer output */ ! 68: int (*v_getkey)(); /* Get next key if one exists */ ! 69: void (*v_initgetkey)(); /* Like it says */ ! 70: unsigned int *v_translation; /* Kbd translation selector */ ! 71: unsigned char *v_keybid; /* Keyboard ID byte */ ! 72: int *v_screen_x; /* V2: Screen x pos (R/O) */ ! 73: int *v_screen_y; /* V2: Screen y pos (R/O) */ ! 74: struct keybuf *v_keybuf; /* Up/down keycode buffer */ ! 75: ! 76: char *v_mon_id; /* Revision level of monitor */ ! 77: ! 78: /* Frame buffer output and terminal emulation */ ! 79: void (*v_fwritechar)(); /* Write a character to FB */ ! 80: int *v_fbaddr; /* Address of frame buffer */ ! 81: char **v_font; /* font table for FB */ ! 82: void (*v_fwritestr)(); /* Quickly write string to FB */ ! 83: ! 84: /* Reboot interface routine -- resets and reboots system. No return. */ ! 85: void (*v_boot_me)(); /* eg boot_me("xy()vmunix") */ ! 86: ! 87: /* Line input and parsing */ ! 88: unsigned char *v_linebuf; /* The line input buffer */ ! 89: unsigned char **v_lineptr; /* Cur pointer into linebuf */ ! 90: int *v_linesize; /* length of line in linebuf */ ! 91: void (*v_getline)(); /* Get line from user */ ! 92: unsigned char (*v_getone)(); /* Get next char from linebuf */ ! 93: unsigned char (*v_peekchar)(); /* Peek at next char */ ! 94: int *v_fbthere; /* =1 if frame buffer there */ ! 95: int (*v_getnum)(); /* Grab hex num from line */ ! 96: ! 97: /* Phrase output to current output sink */ ! 98: int (*v_printf)(); /* Similar to "Kernel printf" */ ! 99: void (*v_printhex)(); /* Format N digits in hex */ ! 100: ! 101: unsigned char *v_leds; /* RAM copy of LED register */ ! 102: void (*v_set_leds)(); /* Sets LED's and RAM copy */ ! 103: ! 104: /* nmi related information */ ! 105: void (*v_nmi)(); /* Addr for level 7 vector */ ! 106: void (*v_abortent)(); /* entry for keyboard abort */ ! 107: int *v_nmiclock; /* counts up in msec */ ! 108: ! 109: int *v_fbtype; /* FB type: see <sun/fbio.h> */ ! 110: ! 111: /* Assorted other things */ ! 112: unsigned v_romvec_version; /* Version # of Romvec */ ! 113: struct globram *v_gp; /* monitor global variables */ ! 114: struct zscc_device *v_keybzscc; /* Addr of keyboard in use */ ! 115: ! 116: int *v_keyrinit; /* ms before kbd repeat */ ! 117: unsigned char *v_keyrtick; /* ms between repetitions */ ! 118: unsigned *v_memoryavail; /* V1: Main mem usable size */ ! 119: long *v_resetaddr; /* where to jump on a reset */ ! 120: long *v_resetmap; /* pgmap entry for resetaddr */ ! 121: /* Really struct pgmapent * */ ! 122: void (*v_exit_to_mon)(); /* Exit from user program */ ! 123: ! 124: unsigned char **v_memorybitmap; /* V1: &{0 or &bits} */ ! 125: void (*v_setcxsegmap)(); /* Set seg in any context */ ! 126: void (**v_vector_cmd)(); /* V2: Handler for 'v' cmd */ ! 127: int dummy1z; ! 128: int dummy2z; ! 129: int dummy3z; ! 130: int dummy4z; ! 131: }; ! 132: ! 133: /* ! 134: * THE FOLLOWING CONSTANT MUST BE CHANGED ANYTIME THE VALUE OF "PROM_BASE" ! 135: * IN cpu.addrs.h IS CHANGED. IT IS CONSTANT HERE SO THAT EVERY MODULE ! 136: * WHICH NEEDS AN ADDRESS OUT OF SUNROMVEC DOESN'T HAVE TO INCLUDE cpu.addrs.h. ! 137: */ ! 138: #define romp ((struct sunromvec *)0x0FEF0000) ! 139: /* ! 140: * Note that the value of romp will be truncated based on the running ! 141: * hardware: ! 142: * Sun-2 0x00EF0000 ! 143: * Sun-3 0x0FEF0000 ! 144: * This was deliberately done for Sun-3 so that programs using this ! 145: * header file (with Sun-3 support) will continue to run in Sun-2 systems. ! 146: */ ! 147: ! 148: /* ! 149: * The currently possible values for *romp->v_insource and *romp->v_outsink: ! 150: * Note that these may be extended in the future. Your program should ! 151: * cope with this gracefully (e.g. by continuing to vector thru the ! 152: * PROM I/O routines if these are set in a way you don't understand). ! 153: */ ! 154: #define INKEYB 0 /* Input from parallel keyboard */ ! 155: #define INUARTA 1 /* Input or output to Uart A */ ! 156: #define INUARTB 2 /* Input or output to Uart B */ ! 157: ! 158: #define OUTSCREEN 0 /* Output to frame buffer */ ! 159: #define OUTUARTA 1 /* Input or output to Uart A */ ! 160: #define OUTUARTB 2 /* Input or output to Uart B */ ! 161: ! 162: /* ! 163: * Structure set up by boot command to pass arguments to program booted. ! 164: */ ! 165: struct bootparam { ! 166: char *bp_argv[8]; /* string arguments */ ! 167: char bp_strings[100];/* string table for string arguments */ ! 168: char bp_dev[2]; /* device name */ ! 169: int bp_ctlr; /* controller # */ ! 170: int bp_unit; /* unit # */ ! 171: int bp_part; /* partition/file # */ ! 172: char *bp_name; /* file name, points into bp_strings */ ! 173: struct boottab *bp_boottab; /* Points to table entry for dev */ ! 174: }; ! 175: ! 176: ! 177: /* ! 178: * This table entry describes a device. It exists in the PROM; a ! 179: * pointer to it is passed in bootparam. It can be used to locate ! 180: * PROM subroutines for opening, reading, and writing the device. ! 181: * NOTE: When using this interface, only ONE device can be open at once. ! 182: * You can't open a tape and a disk. Sorry. ! 183: */ ! 184: struct boottab { ! 185: char b_dev[2]; /* Two char name of dev */ ! 186: int (*b_probe)(); /* probe() --> -1 or found ctlr # */ ! 187: int (*b_boot)(); /* boot(bp) --> -1 or start address */ ! 188: int (*b_open)(); /* open(iobp) --> -1 or 0 */ ! 189: int (*b_close)(); /* close(iobp) --> -1 or 0 */ ! 190: int (*b_strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ ! 191: char *b_desc; /* Printable string describing dev */ ! 192: struct devinfo *b_devinfo; /* Info to configure device */ ! 193: }; ! 194: ! 195: /* This defines the set of map entry types */ ! 196: enum MAPTYPES { ! 197: MAP_MAINMEM, MAP_OBIO, MAP_MBMEM, MAP_MBIO, ! 198: MAP_VME16A16D, MAP_VME16A32D, ! 199: MAP_VME24A16D, MAP_VME24A32D, ! 200: MAP_VME32A16D, MAP_VME32A32D, ! 201: }; ! 202: ! 203: /* ! 204: * This table entry gives information about the resources needed by a ! 205: * device. Maybe it should be merged into the struct boottab, but ! 206: * then the struct boottab for each dev should be merged into that ! 207: * dev's foo.c file rather than some global config file. ! 208: */ ! 209: struct devinfo { ! 210: unsigned d_devbytes; /* Bytes occupied by dev in IO space */ ! 211: unsigned d_dmabytes; /* Bytes needed by dev in DMA memory */ ! 212: unsigned d_localbytes; /* Bytes needed by dev for local info */ ! 213: unsigned d_stdcount; /* How many standard addresses */ ! 214: unsigned long *d_stdaddrs; /* The vector of standard addresses */ ! 215: enum MAPTYPES d_devtype; /* What map space dev is in */ ! 216: unsigned d_maxiobytes; /* Size to break big I/O's into */ ! 217: }; ! 218: ! 219: /* ! 220: * This defines the memory map interface between the PROM Monitor ! 221: * and the Unix kernel. ! 222: */ ! 223: ! 224: /* ! 225: * The PROM Monitor requires that nobody mess with parts of virtual ! 226: * memory if they expect any PROM Monitor services. These rules ! 227: * apply to all the virtual memory between MONSTART and MONEND: ! 228: * ! 229: * * Do not write to these addresses. ! 230: * * Do not read from (depend on the contents of) these addresses, except ! 231: * as documented here or in <mon/sunromvec.h>. ! 232: * * Do not remap these addresses. ! 233: * * Do not change or double-map the pmegs that these addresses ! 234: * map through. ! 235: * * Do not change or double-map the main memory that these ! 236: * addresses map to. ! 237: * * You are free to change or double-map I/O devices which these ! 238: * addresses map to. ! 239: * * These rules apply in all map contexts. ! 240: * ! 241: * Other than that, you can do whatever you want with them. ! 242: */ ! 243: #if defined(SUN2) || defined(sun2) ! 244: #define MONSTART 0x00E00000 ! 245: #define MONEND 0x00F00000 ! 246: #endif ! 247: ! 248: #if defined(SUN3) || defined(sun3) ! 249: #define MONSTART 0x0FE00000 ! 250: #define MONEND 0x0FF00000 ! 251: #endif ! 252: ! 253: /* ! 254: * The one page at MONSHORTPAGE must remain mapped to the same piece ! 255: * of main memory. The pmeg used to map it there can be changed if ! 256: * desired. This page should not be read from or written in. It is ! 257: * used for ROM Monitor globals, since it is addressable with short ! 258: * absolute instructions. (We give a 32-bit value below so the ! 259: * compiler/assembler will use absolute short addressing. The hardware ! 260: * will accept either 0 or 0xF as the top 4 bits.) ! 261: */ ! 262: #define MONSHORTPAGE 0xFFFFE000 ! 263: #define MONSHORTSEG 0xFFFE0000 ! 264: ! 265: /* ! 266: * For virtual addresses outside the above range, you can remap ! 267: * the addresses as desired (but see MONSHORTPAGE). ! 268: * ! 269: * Any pmeg not referenced by segments between MONSTART and MONEND ! 270: * can be used freely (but see MONSHORTPAGE). ! 271: * ! 272: * When a standalone program is booted, available main memory ! 273: * will be mapped contiguously, using ascending physical page addresses, ! 274: * starting at virtual location 0. The complete set of available ! 275: * memory may not be mapped due to a lack of PMEGs. The complete set ! 276: * is defined by v_memorysize, v_memoryavail, and v_memorybitmap. ! 277: * We guarantee that at least MAINMEM_MAP_SIZE page map entries ! 278: * will be available for mapping starting from location 0. ! 279: * ! 280: * When a standalone program is booted, at least DVMA_MAP_SIZE bytes ! 281: * of segment map entries will be allocated, so that pages can be mapped ! 282: * into DVMA space. ! 283: */ ! 284: #if defined(SUN2) || defined(sun2) ! 285: #define MAINMEM_MAP_SIZE 0x00600000 ! 286: #define DVMA_MAP_SIZE 0x00080000 ! 287: #endif ! 288: ! 289: #if defined(SUN3) || defined(sun3) ! 290: #define MAINMEM_MAP_SIZE 0x00600000 ! 291: #define DVMA_MAP_SIZE 0x00080000 ! 292: #endif ! 293: ! 294: /* ! 295: * The following are included for compatability with previous versions ! 296: * of this header file. Names containing capital letters have been ! 297: * changed to conform with "Bill Joy Normal Form". This section provides ! 298: * the translation between the old and new names. It can go away once ! 299: * Sun-1 applications have been converted over. ! 300: */ ! 301: #define RomVecPtr romp ! 302: #define v_SunRev v_mon_id ! 303: #define v_MemorySize v_memorysize ! 304: #define v_EchoOn v_echo ! 305: #define v_InSource v_insource ! 306: #define v_OutSink v_outsink ! 307: #define v_InitGetkey v_initgetkey ! 308: #define v_KeybId v_keybid ! 309: #define v_Keybuf v_keybuf ! 310: #define v_FBAddr v_fbaddr ! 311: #define v_FontTable v_font ! 312: #define v_message v_printf ! 313: #define v_KeyFrsh v_nmi ! 314: #define AbortEnt v_abortent ! 315: #define v_RefrCnt v_nmiclock ! 316: #define v_GlobPtr v_gp ! 317: #define v_KRptInitial v_keyrinit ! 318: #define v_KRptTick v_keyrtick ! 319: #define v_ExitOp v_exit_to_mon ! 320: #define v_fwrstr v_fwritestr ! 321: #define v_linbuf v_linebuf ! 322: ! 323: #endif MONSTART
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.