156829Sralph /* 2*63226Sbostic * Copyright (c) 1992, 1993 3*63226Sbostic * The Regents of the University of California. All rights reserved. 456829Sralph * 556829Sralph * This code is derived from software contributed to Berkeley by 656829Sralph * Ralph Campbell. 756829Sralph * 856829Sralph * %sccs.include.redist.c% 956829Sralph * 10*63226Sbostic * @(#)dec_prom.h 8.1 (Berkeley) 06/10/93 1156829Sralph * 1256829Sralph * machMon.h -- 1356829Sralph * 1456829Sralph * Structures, constants and defines for access to the pmax prom. 1556829Sralph * 1656829Sralph * Copyright (C) 1989 Digital Equipment Corporation. 1756829Sralph * Permission to use, copy, modify, and distribute this software and 1856829Sralph * its documentation for any purpose and without fee is hereby granted, 1956829Sralph * provided that the above copyright notice appears in all copies. 2056829Sralph * Digital Equipment Corporation makes no representations about the 2156829Sralph * suitability of this software for any purpose. It is provided "as is" 2256829Sralph * without express or implied warranty. 2356829Sralph * 2456829Sralph * from: $Header: /sprite/src/kernel/mach/ds3100.md/RCS/machMon.h, 2556829Sralph * v 9.3 90/02/20 14:34:07 shirriff Exp $ SPRITE (Berkeley) 2656829Sralph */ 2756829Sralph 2856829Sralph #ifndef _DEC_PROM 2956829Sralph #define _DEC_PROM 3056829Sralph 3156829Sralph /* 3256829Sralph * This file was created based on information from the document 3356829Sralph * "TURBOchannel Firmware Specification" (EK-TCAAD-FS-003) 3456829Sralph * by Digital Equipment Corporation. 3556829Sralph */ 3656829Sralph 3756829Sralph #ifndef LOCORE 3856829Sralph #include <sys/types.h> 3956829Sralph #include <sys/cdefs.h> 4056829Sralph 4156829Sralph /* 4256829Sralph * Programs loaded by the new PROMs pass the following arguments: 4356829Sralph * a0 argc 4456829Sralph * a1 argv 4556829Sralph * a2 DEC_PROM_MAGIC 4656829Sralph * a3 The callback vector defined below 4756829Sralph */ 4856829Sralph 4956829Sralph #define DEC_PROM_MAGIC 0x30464354 5056829Sralph 5156829Sralph typedef struct { 5256829Sralph int pagesize; /* system page size */ 5356829Sralph u_char *bitmap; /* bit for each page indicating safe to use */ 5456829Sralph } memmap; 5556829Sralph 5656829Sralph typedef struct { 5756829Sralph int revision; /* hardware revision level */ 5856829Sralph int clk_period; /* clock period in nano seconds */ 5956829Sralph int slot_size; /* slot size in magabytes */ 6056829Sralph int io_timeout; /* I/O timeout in cycles 6156829Sralph int dma_range; /* DMA address range in megabytes */ 6256829Sralph int max_dma_burst; /* maximum DMA burst length */ 6356829Sralph int parity; /* true if system module supports T.C. parity */ 6456829Sralph int reserved[4]; 6556829Sralph } tcinfo; 6656829Sralph 6756829Sralph typedef int jmp_buf[12]; 6856829Sralph typedef void (*psig_t)(int); 6956829Sralph 7056829Sralph struct callback { 7156829Sralph void *(*memcpy) __P((void *s1, void *s2, int n)); /* 00 */ 7256829Sralph void *(*memset) __P((void *s1, int c, int n)); /* 04 */ 7356829Sralph char *(*strcat) __P((char *s1, char *s2)); /* 08 */ 7456829Sralph int (*strcmp) __P((char *s1, char *s2)); /* 0c */ 7556829Sralph char *(*strcpy) __P((char *s1, char *s2)); /* 10 */ 7656829Sralph int (*strlen) __P((char *s1)); /* 14 */ 7756829Sralph char *(*strncat) __P((char *s1, char *s2, int n)); /* 18 */ 7856829Sralph char *(*strncpy) __P((char *s1, char *s2, int n)); /* 1c */ 7956829Sralph int (*strncmp) __P((char *s1, char *s2, int n)); /* 20 */ 8056829Sralph int (*getchar) __P((void)); /* 24 */ 8156829Sralph char *(*gets) __P((char *s)); /* 28 */ 8256829Sralph int (*puts) __P((char *s)); /* 2c */ 8356829Sralph int (*printf) __P((char *fmt, ...)); /* 30 */ 8456829Sralph int (*sprintf) __P((char *s, char *fmt, ...)); /* 34 */ 8556829Sralph int (*io_poll) __P((void)); /* 38 */ 8656829Sralph long (*strtol) __P((char *s, char **endptr, int base)); /* 3c */ 8756829Sralph psig_t (*signal) __P((int sig, psig_t func)); /* 40 */ 8856829Sralph int (*raise) __P((int sig)); /* 44 */ 8956829Sralph long (*time) __P((long *tod)); /* 48 */ 9056829Sralph int (*setjmp) __P((jmp_buf env)); /* 4c */ 9156829Sralph void (*longjmp) __P((jmp_buf env, int value)); /* 50 */ 9256829Sralph int (*bootinit) __P((void)); /* 54 */ 9356829Sralph int (*bootread) __P((int b, void *buffer, int n)); /* 58 */ 9456829Sralph int (*bootwrite) __P((int b, void *buffer, int n)); /* 5c */ 9556829Sralph int (*setenv) __P((char *name, char *value)); /* 60 */ 9656829Sralph char *(*getenv) __P((char *name)); /* 64 */ 9756829Sralph int (*unsetenv) __P((char *name)); /* 68 */ 9856829Sralph u_long (*slot_address) __P((int sn)); /* 6c */ 9956829Sralph void (*wbflush) __P((void)); /* 70 */ 10056829Sralph void (*msdelay) __P((int delay)); /* 74 */ 10156829Sralph void (*leds) __P((int value)); /* 78 */ 10256829Sralph void (*clear_cache) __P((void)); /* 7c */ 10356829Sralph int (*getsysid) __P((void)); /* 80 */ 10456829Sralph int (*getbitmap) __P((memmap *map)); /* 84 */ 10556829Sralph int (*disableintr) __P((int sn)); /* 88 */ 10656829Sralph int (*enableintr) __P((int sn)); /* 8c */ 10756829Sralph int (*testintr) __P((int sn)); /* 90 */ 10856829Sralph void *reserved_data; /* 94 */ 10956829Sralph int (*console_init) __P((void)); /* 98 */ 11056829Sralph void (*halt) __P((int *v, int cnt)); /* 9c */ 11156829Sralph void (*showfault) __P((void)); /* a0 */ 11256829Sralph tcinfo *(*gettcinfo) __P(()); /* a4 */ 11356829Sralph int (*execute_cmd) __P((char *cmd)); /* a8 */ 11456829Sralph void (*rex) __P((char cmd)); /* ac */ 11556829Sralph /* b0 to d4 reserved */ 11656829Sralph }; 11756829Sralph 11856829Sralph extern const struct callback *callv; 11956829Sralph extern const struct callback callvec; 12056829Sralph 12156829Sralph /* 12256829Sralph * The prom routines use the following structure to hold strings. 12356829Sralph */ 12456829Sralph typedef struct { 12556829Sralph char *argPtr[16]; /* Pointers to the strings. */ 12656829Sralph char strings[256]; /* Buffer for the strings. */ 12756829Sralph char *end; /* Pointer to end of used buf. */ 12856829Sralph int num; /* Number of strings used. */ 12956829Sralph } MachStringTable; 13056829Sralph 13156829Sralph #endif /* LOCORE */ 13256829Sralph 13356829Sralph /* 13456829Sralph * The prom has a jump table at the beginning of it to get to its 13556829Sralph * functions. 13656829Sralph */ 13756829Sralph #define DEC_PROM_JUMP_TABLE_ADDR 0xBFC00000 13856829Sralph 13956829Sralph /* 14056829Sralph * Each entry in the jump table is 8 bytes - 4 for the jump and 4 for a nop. 14156829Sralph */ 14256829Sralph #define DEC_PROM_FUNC_ADDR(funcNum) (DEC_PROM_JUMP_TABLE_ADDR+((funcNum)*8)) 14356829Sralph 14456829Sralph /* 14556829Sralph * The functions: 14656829Sralph * 14756829Sralph * DEC_PROM_RESET Run diags, check bootmode, reinit. 14856829Sralph * DEC_PROM_EXEC Load new program image. 14956829Sralph * DEC_PROM_RESTART Re-enter monitor command loop. 15056829Sralph * DEC_PROM_REINIT Re-init monitor, then cmd loop. 15156829Sralph * DEC_PROM_REBOOT Check bootmode, no config. 15256829Sralph * DEC_PROM_AUTOBOOT Autoboot the system. 15356829Sralph * 15456829Sralph * The following routines access PROM saio routines and may be used by 15556829Sralph * standalone programs that would like to use PROM I/O: 15656829Sralph * 15756829Sralph * DEC_PROM_OPEN Open a file. 15856829Sralph * DEC_PROM_READ Read from a file. 15956829Sralph * DEC_PROM_WRITE Write to a file. 16056829Sralph * DEC_PROM_IOCTL Iocontrol on a file. 16156829Sralph * DEC_PROM_CLOSE Close a file. 16256829Sralph * DEC_PROM_LSEEK Seek on a file. 16356829Sralph * DEC_PROM_GETCHAR Get character from console. 16456829Sralph * DEC_PROM_PUTCHAR Put character on console. 16556829Sralph * DEC_PROM_SHOWCHAR Show a char visibly. 16656829Sralph * DEC_PROM_GETS gets with editing. 16756829Sralph * DEC_PROM_PUTS Put string to console. 16856829Sralph * DEC_PROM_PRINTF Kernel style printf to console. 16956829Sralph * 17056829Sralph * The following are other prom routines: 17156829Sralph * DEC_PROM_FLUSHCACHE Flush entire cache (). 17256829Sralph * DEC_PROM_CLEARCACHE Clear I & D cache in range (addr, len). 17356829Sralph * DEC_PROM_SAVEREGS Save registers in a buffer. 17456829Sralph * DEC_PROM_LOADREGS Get register back from buffer. 17556829Sralph * DEC_PROM_JUMPS8 Jump to address in s8. 17656829Sralph * DEC_PROM_GETENV2 Gets a string from system environment. 17756829Sralph * DEC_PROM_SETENV2 Sets a string in system environment. 17856829Sralph * DEC_PROM_ATONUM Converts ascii string to number. 17956829Sralph * DEC_PROM_STRCMP Compares strings (strcmp). 18056829Sralph * DEC_PROM_STRLEN Length of string (strlen). 18156829Sralph * DEC_PROM_STRCPY Copies string (strcpy). 18256829Sralph * DEC_PROM_STRCAT Appends string (strcat). 18356829Sralph * DEC_PROM_GETCMD Gets a command. 18456829Sralph * DEC_PROM_GETNUMS Gets numbers. 18556829Sralph * DEC_PROM_ARGPARSE Parses string to argc,argv. 18656829Sralph * DEC_PROM_HELP Help on prom commands. 18756829Sralph * DEC_PROM_DUMP Dumps memory. 18856829Sralph * DEC_PROM_SETENV Sets a string in system environment. 18956829Sralph * DEC_PROM_UNSETENV Unsets a string in system environment 19056829Sralph * DEC_PROM_PRINTENV Prints system environment 19156829Sralph * DEC_PROM_JUMP2S8 Jumps to s8 19256829Sralph * DEC_PROM_ENABLE Performs prom enable command. 19356829Sralph * DEC_PROM_DISABLE Performs prom disable command. 19456829Sralph * DEC_PROM_ZEROB Zeros a system buffer. 19556829Sralph */ 19656829Sralph #define DEC_PROM_RESET DEC_PROM_FUNC_ADDR(0) 19756829Sralph #define DEC_PROM_EXEC DEC_PROM_FUNC_ADDR(1) 19856829Sralph #define DEC_PROM_RESTART DEC_PROM_FUNC_ADDR(2) 19956829Sralph #define DEC_PROM_REINIT DEC_PROM_FUNC_ADDR(3) 20056829Sralph #define DEC_PROM_REBOOT DEC_PROM_FUNC_ADDR(4) 20156829Sralph #define DEC_PROM_AUTOBOOT DEC_PROM_FUNC_ADDR(5) 20256829Sralph #define DEC_PROM_OPEN DEC_PROM_FUNC_ADDR(6) 20356829Sralph #define DEC_PROM_READ DEC_PROM_FUNC_ADDR(7) 20456829Sralph #define DEC_PROM_WRITE DEC_PROM_FUNC_ADDR(8) 20556829Sralph #define DEC_PROM_IOCTL DEC_PROM_FUNC_ADDR(9) 20656829Sralph #define DEC_PROM_CLOSE DEC_PROM_FUNC_ADDR(10) 20756829Sralph #define DEC_PROM_LSEEK DEC_PROM_FUNC_ADDR(11) 20856829Sralph #define DEC_PROM_GETCHAR DEC_PROM_FUNC_ADDR(12) 20956829Sralph #define DEC_PROM_PUTCHAR DEC_PROM_FUNC_ADDR(13) 21056829Sralph #define DEC_PROM_SHOWCHAR DEC_PROM_FUNC_ADDR(14) 21156829Sralph #define DEC_PROM_GETS DEC_PROM_FUNC_ADDR(15) 21256829Sralph #define DEC_PROM_PUTS DEC_PROM_FUNC_ADDR(16) 21356829Sralph #define DEC_PROM_PRINTF DEC_PROM_FUNC_ADDR(17) 21456829Sralph #define DEC_PROM_FLUSHCACHE DEC_PROM_FUNC_ADDR(28) 21556829Sralph #define DEC_PROM_CLEARCACHE DEC_PROM_FUNC_ADDR(29) 21656829Sralph #define DEC_PROM_SAVEREGS DEC_PROM_FUNC_ADDR(30) 21756829Sralph #define DEC_PROM_LOADREGS DEC_PROM_FUNC_ADDR(31) 21856829Sralph #define DEC_PROM_JUMPS8 DEC_PROM_FUNC_ADDR(32) 21956829Sralph #define DEC_PROM_GETENV2 DEC_PROM_FUNC_ADDR(33) 22056829Sralph #define DEC_PROM_SETENV2 DEC_PROM_FUNC_ADDR(34) 22156829Sralph #define DEC_PROM_ATONUM DEC_PROM_FUNC_ADDR(35) 22256829Sralph #define DEC_PROM_STRCMP DEC_PROM_FUNC_ADDR(36) 22356829Sralph #define DEC_PROM_STRLEN DEC_PROM_FUNC_ADDR(37) 22456829Sralph #define DEC_PROM_STRCPY DEC_PROM_FUNC_ADDR(38) 22556829Sralph #define DEC_PROM_STRCAT DEC_PROM_FUNC_ADDR(39) 22656829Sralph #define DEC_PROM_GETCMD DEC_PROM_FUNC_ADDR(40) 22756829Sralph #define DEC_PROM_GETNUMS DEC_PROM_FUNC_ADDR(41) 22856829Sralph #define DEC_PROM_ARGPARSE DEC_PROM_FUNC_ADDR(42) 22956829Sralph #define DEC_PROM_HELP DEC_PROM_FUNC_ADDR(43) 23056829Sralph #define DEC_PROM_DUMP DEC_PROM_FUNC_ADDR(44) 23156829Sralph #define DEC_PROM_SETENV DEC_PROM_FUNC_ADDR(45) 23256829Sralph #define DEC_PROM_UNSETENV DEC_PROM_FUNC_ADDR(46) 23356829Sralph #define DEC_PROM_PRINTENV DEC_PROM_FUNC_ADDR(47) 23456829Sralph #define DEC_PROM_JUMP2S8 DEC_PROM_FUNC_ADDR(48) 23556829Sralph #define DEC_PROM_ENABLE DEC_PROM_FUNC_ADDR(49) 23656829Sralph #define DEC_PROM_DISABLE DEC_PROM_FUNC_ADDR(50) 23756829Sralph #define DEC_PROM_ZEROB DEC_PROM_FUNC_ADDR(51) 23856829Sralph 23956829Sralph /* 24056829Sralph * The nonvolatile ram has a flag to indicate it is usable. 24156829Sralph */ 24256829Sralph #define MACH_USE_NON_VOLATILE ((char *)0xbd0000c0) 24356829Sralph #define MACH_NON_VOLATILE_FLAG 0x02 24456829Sralph 24556829Sralph #endif /* _DEC_PROM */ 246