xref: /csrg-svn/sys/pmax/stand/dec_prom.h (revision 56829)
1*56829Sralph /*
2*56829Sralph  * Copyright (c) 1992 The Regents of the University of California.
3*56829Sralph  * All rights reserved.
4*56829Sralph  *
5*56829Sralph  * This code is derived from software contributed to Berkeley by
6*56829Sralph  * Ralph Campbell.
7*56829Sralph  *
8*56829Sralph  * %sccs.include.redist.c%
9*56829Sralph  *
10*56829Sralph  *	@(#)dec_prom.h	7.1 (Berkeley) 11/15/92
11*56829Sralph  *
12*56829Sralph  * machMon.h --
13*56829Sralph  *
14*56829Sralph  *	Structures, constants and defines for access to the pmax prom.
15*56829Sralph  *
16*56829Sralph  *	Copyright (C) 1989 Digital Equipment Corporation.
17*56829Sralph  *	Permission to use, copy, modify, and distribute this software and
18*56829Sralph  *	its documentation for any purpose and without fee is hereby granted,
19*56829Sralph  *	provided that the above copyright notice appears in all copies.
20*56829Sralph  *	Digital Equipment Corporation makes no representations about the
21*56829Sralph  *	suitability of this software for any purpose.  It is provided "as is"
22*56829Sralph  *	without express or implied warranty.
23*56829Sralph  *
24*56829Sralph  * from: $Header: /sprite/src/kernel/mach/ds3100.md/RCS/machMon.h,
25*56829Sralph  *	v 9.3 90/02/20 14:34:07 shirriff Exp $ SPRITE (Berkeley)
26*56829Sralph  */
27*56829Sralph 
28*56829Sralph #ifndef _DEC_PROM
29*56829Sralph #define _DEC_PROM
30*56829Sralph 
31*56829Sralph /*
32*56829Sralph  * This file was created based on information from the document
33*56829Sralph  * "TURBOchannel Firmware Specification" (EK-TCAAD-FS-003)
34*56829Sralph  * by Digital Equipment Corporation.
35*56829Sralph  */
36*56829Sralph 
37*56829Sralph #ifndef LOCORE
38*56829Sralph #include <sys/types.h>
39*56829Sralph #include <sys/cdefs.h>
40*56829Sralph 
41*56829Sralph /*
42*56829Sralph  * Programs loaded by the new PROMs pass the following arguments:
43*56829Sralph  *	a0	argc
44*56829Sralph  *	a1	argv
45*56829Sralph  *	a2	DEC_PROM_MAGIC
46*56829Sralph  *	a3	The callback vector defined below
47*56829Sralph  */
48*56829Sralph 
49*56829Sralph #define DEC_PROM_MAGIC	0x30464354
50*56829Sralph 
51*56829Sralph typedef struct {
52*56829Sralph 	int	pagesize;	/* system page size */
53*56829Sralph 	u_char	*bitmap;	/* bit for each page indicating safe to use */
54*56829Sralph } memmap;
55*56829Sralph 
56*56829Sralph typedef struct {
57*56829Sralph 	int	revision;	/* hardware revision level */
58*56829Sralph 	int	clk_period;	/* clock period in nano seconds */
59*56829Sralph 	int	slot_size;	/* slot size in magabytes */
60*56829Sralph 	int	io_timeout;	/* I/O timeout in cycles
61*56829Sralph 	int	dma_range;	/* DMA address range in megabytes */
62*56829Sralph 	int	max_dma_burst;	/* maximum DMA burst length */
63*56829Sralph 	int	parity;		/* true if system module supports T.C. parity */
64*56829Sralph 	int	reserved[4];
65*56829Sralph } tcinfo;
66*56829Sralph 
67*56829Sralph typedef int jmp_buf[12];
68*56829Sralph typedef void (*psig_t)(int);
69*56829Sralph 
70*56829Sralph struct callback {
71*56829Sralph 	void	*(*memcpy) __P((void *s1, void *s2, int n));		/* 00 */
72*56829Sralph 	void	*(*memset) __P((void *s1, int c, int n));		/* 04 */
73*56829Sralph 	char	*(*strcat) __P((char *s1, char *s2));			/* 08 */
74*56829Sralph 	int	(*strcmp) __P((char *s1, char *s2));			/* 0c */
75*56829Sralph 	char	*(*strcpy) __P((char *s1, char *s2));			/* 10 */
76*56829Sralph 	int	(*strlen) __P((char *s1));				/* 14 */
77*56829Sralph 	char	*(*strncat) __P((char *s1, char *s2, int n));		/* 18 */
78*56829Sralph 	char	*(*strncpy) __P((char *s1, char *s2, int n));		/* 1c */
79*56829Sralph 	int	(*strncmp) __P((char *s1, char *s2, int n));		/* 20 */
80*56829Sralph 	int	(*getchar) __P((void));					/* 24 */
81*56829Sralph 	char	*(*gets) __P((char *s));				/* 28 */
82*56829Sralph 	int	(*puts) __P((char *s));					/* 2c */
83*56829Sralph 	int	(*printf) __P((char *fmt, ...));			/* 30 */
84*56829Sralph 	int	(*sprintf) __P((char *s, char *fmt, ...));		/* 34 */
85*56829Sralph 	int	(*io_poll) __P((void));					/* 38 */
86*56829Sralph 	long	(*strtol) __P((char *s, char **endptr, int base));	/* 3c */
87*56829Sralph 	psig_t	(*signal) __P((int sig, psig_t func));			/* 40 */
88*56829Sralph 	int	(*raise) __P((int sig));				/* 44 */
89*56829Sralph 	long	(*time) __P((long *tod));				/* 48 */
90*56829Sralph 	int	(*setjmp) __P((jmp_buf env));				/* 4c */
91*56829Sralph 	void	(*longjmp) __P((jmp_buf env, int value));		/* 50 */
92*56829Sralph 	int	(*bootinit) __P((void));				/* 54 */
93*56829Sralph 	int	(*bootread) __P((int b, void *buffer, int n));		/* 58 */
94*56829Sralph 	int	(*bootwrite) __P((int b, void *buffer, int n));		/* 5c */
95*56829Sralph 	int	(*setenv) __P((char *name, char *value));		/* 60 */
96*56829Sralph 	char	*(*getenv) __P((char *name));				/* 64 */
97*56829Sralph 	int	(*unsetenv) __P((char *name));				/* 68 */
98*56829Sralph 	u_long	(*slot_address) __P((int sn));				/* 6c */
99*56829Sralph 	void	(*wbflush) __P((void));					/* 70 */
100*56829Sralph 	void	(*msdelay) __P((int delay));				/* 74 */
101*56829Sralph 	void	(*leds) __P((int value));				/* 78 */
102*56829Sralph 	void	(*clear_cache) __P((void));				/* 7c */
103*56829Sralph 	int	(*getsysid) __P((void));				/* 80 */
104*56829Sralph 	int	(*getbitmap) __P((memmap *map));			/* 84 */
105*56829Sralph 	int	(*disableintr) __P((int sn));				/* 88 */
106*56829Sralph 	int	(*enableintr) __P((int sn));				/* 8c */
107*56829Sralph 	int	(*testintr) __P((int sn));				/* 90 */
108*56829Sralph 	void	*reserved_data;						/* 94 */
109*56829Sralph 	int	(*console_init) __P((void));				/* 98 */
110*56829Sralph 	void	(*halt) __P((int *v, int cnt));				/* 9c */
111*56829Sralph 	void	(*showfault) __P((void));				/* a0 */
112*56829Sralph 	tcinfo	*(*gettcinfo) __P(());					/* a4 */
113*56829Sralph 	int	(*execute_cmd) __P((char *cmd));			/* a8 */
114*56829Sralph 	void	(*rex) __P((char cmd));					/* ac */
115*56829Sralph 	/* b0 to d4 reserved */
116*56829Sralph };
117*56829Sralph 
118*56829Sralph extern const struct callback *callv;
119*56829Sralph extern const struct callback callvec;
120*56829Sralph 
121*56829Sralph /*
122*56829Sralph  * The prom routines use the following structure to hold strings.
123*56829Sralph  */
124*56829Sralph typedef struct {
125*56829Sralph 	char	*argPtr[16];	/* Pointers to the strings. */
126*56829Sralph 	char	strings[256];	/* Buffer for the strings. */
127*56829Sralph 	char	*end;		/* Pointer to end of used buf. */
128*56829Sralph 	int 	num;		/* Number of strings used. */
129*56829Sralph } MachStringTable;
130*56829Sralph 
131*56829Sralph #endif /* LOCORE */
132*56829Sralph 
133*56829Sralph /*
134*56829Sralph  * The prom has a jump table at the beginning of it to get to its
135*56829Sralph  * functions.
136*56829Sralph  */
137*56829Sralph #define DEC_PROM_JUMP_TABLE_ADDR	0xBFC00000
138*56829Sralph 
139*56829Sralph /*
140*56829Sralph  * Each entry in the jump table is 8 bytes - 4 for the jump and 4 for a nop.
141*56829Sralph  */
142*56829Sralph #define DEC_PROM_FUNC_ADDR(funcNum)	(DEC_PROM_JUMP_TABLE_ADDR+((funcNum)*8))
143*56829Sralph 
144*56829Sralph /*
145*56829Sralph  * The functions:
146*56829Sralph  *
147*56829Sralph  *	DEC_PROM_RESET		Run diags, check bootmode, reinit.
148*56829Sralph  *	DEC_PROM_EXEC		Load new program image.
149*56829Sralph  *	DEC_PROM_RESTART	Re-enter monitor command loop.
150*56829Sralph  *	DEC_PROM_REINIT		Re-init monitor, then cmd loop.
151*56829Sralph  *	DEC_PROM_REBOOT		Check bootmode, no config.
152*56829Sralph  *	DEC_PROM_AUTOBOOT	Autoboot the system.
153*56829Sralph  *
154*56829Sralph  * The following routines access PROM saio routines and may be used by
155*56829Sralph  * standalone programs that would like to use PROM I/O:
156*56829Sralph  *
157*56829Sralph  *	DEC_PROM_OPEN		Open a file.
158*56829Sralph  *	DEC_PROM_READ		Read from a file.
159*56829Sralph  *	DEC_PROM_WRITE		Write to a file.
160*56829Sralph  *	DEC_PROM_IOCTL		Iocontrol on a file.
161*56829Sralph  *	DEC_PROM_CLOSE		Close a file.
162*56829Sralph  *	DEC_PROM_LSEEK		Seek on a file.
163*56829Sralph  *	DEC_PROM_GETCHAR	Get character from console.
164*56829Sralph  *	DEC_PROM_PUTCHAR	Put character on console.
165*56829Sralph  *	DEC_PROM_SHOWCHAR	Show a char visibly.
166*56829Sralph  *	DEC_PROM_GETS		gets with editing.
167*56829Sralph  *	DEC_PROM_PUTS		Put string to console.
168*56829Sralph  *	DEC_PROM_PRINTF		Kernel style printf to console.
169*56829Sralph  *
170*56829Sralph  * The following are other prom routines:
171*56829Sralph  *	DEC_PROM_FLUSHCACHE	Flush entire cache ().
172*56829Sralph  *	DEC_PROM_CLEARCACHE	Clear I & D cache in range (addr, len).
173*56829Sralph  *	DEC_PROM_SAVEREGS	Save registers in a buffer.
174*56829Sralph  *	DEC_PROM_LOADREGS	Get register back from buffer.
175*56829Sralph  *	DEC_PROM_JUMPS8		Jump to address in s8.
176*56829Sralph  *	DEC_PROM_GETENV2	Gets a string from system environment.
177*56829Sralph  *	DEC_PROM_SETENV2	Sets a string in system environment.
178*56829Sralph  *	DEC_PROM_ATONUM		Converts ascii string to number.
179*56829Sralph  *	DEC_PROM_STRCMP		Compares strings (strcmp).
180*56829Sralph  *	DEC_PROM_STRLEN		Length of string (strlen).
181*56829Sralph  *	DEC_PROM_STRCPY		Copies string (strcpy).
182*56829Sralph  *	DEC_PROM_STRCAT		Appends string (strcat).
183*56829Sralph  *	DEC_PROM_GETCMD		Gets a command.
184*56829Sralph  *	DEC_PROM_GETNUMS	Gets numbers.
185*56829Sralph  *	DEC_PROM_ARGPARSE	Parses string to argc,argv.
186*56829Sralph  *	DEC_PROM_HELP		Help on prom commands.
187*56829Sralph  *	DEC_PROM_DUMP		Dumps memory.
188*56829Sralph  *	DEC_PROM_SETENV		Sets a string in system environment.
189*56829Sralph  *	DEC_PROM_UNSETENV	Unsets a string in system environment
190*56829Sralph  *	DEC_PROM_PRINTENV	Prints system environment
191*56829Sralph  *	DEC_PROM_JUMP2S8	Jumps to s8
192*56829Sralph  *	DEC_PROM_ENABLE		Performs prom enable command.
193*56829Sralph  *	DEC_PROM_DISABLE	Performs prom disable command.
194*56829Sralph  *	DEC_PROM_ZEROB		Zeros a system buffer.
195*56829Sralph  */
196*56829Sralph #define DEC_PROM_RESET		DEC_PROM_FUNC_ADDR(0)
197*56829Sralph #define DEC_PROM_EXEC		DEC_PROM_FUNC_ADDR(1)
198*56829Sralph #define DEC_PROM_RESTART	DEC_PROM_FUNC_ADDR(2)
199*56829Sralph #define DEC_PROM_REINIT		DEC_PROM_FUNC_ADDR(3)
200*56829Sralph #define DEC_PROM_REBOOT		DEC_PROM_FUNC_ADDR(4)
201*56829Sralph #define DEC_PROM_AUTOBOOT	DEC_PROM_FUNC_ADDR(5)
202*56829Sralph #define DEC_PROM_OPEN		DEC_PROM_FUNC_ADDR(6)
203*56829Sralph #define DEC_PROM_READ		DEC_PROM_FUNC_ADDR(7)
204*56829Sralph #define DEC_PROM_WRITE		DEC_PROM_FUNC_ADDR(8)
205*56829Sralph #define DEC_PROM_IOCTL		DEC_PROM_FUNC_ADDR(9)
206*56829Sralph #define DEC_PROM_CLOSE		DEC_PROM_FUNC_ADDR(10)
207*56829Sralph #define DEC_PROM_LSEEK		DEC_PROM_FUNC_ADDR(11)
208*56829Sralph #define DEC_PROM_GETCHAR	DEC_PROM_FUNC_ADDR(12)
209*56829Sralph #define DEC_PROM_PUTCHAR	DEC_PROM_FUNC_ADDR(13)
210*56829Sralph #define DEC_PROM_SHOWCHAR	DEC_PROM_FUNC_ADDR(14)
211*56829Sralph #define DEC_PROM_GETS		DEC_PROM_FUNC_ADDR(15)
212*56829Sralph #define DEC_PROM_PUTS		DEC_PROM_FUNC_ADDR(16)
213*56829Sralph #define DEC_PROM_PRINTF		DEC_PROM_FUNC_ADDR(17)
214*56829Sralph #define DEC_PROM_FLUSHCACHE	DEC_PROM_FUNC_ADDR(28)
215*56829Sralph #define DEC_PROM_CLEARCACHE	DEC_PROM_FUNC_ADDR(29)
216*56829Sralph #define DEC_PROM_SAVEREGS	DEC_PROM_FUNC_ADDR(30)
217*56829Sralph #define DEC_PROM_LOADREGS	DEC_PROM_FUNC_ADDR(31)
218*56829Sralph #define DEC_PROM_JUMPS8		DEC_PROM_FUNC_ADDR(32)
219*56829Sralph #define DEC_PROM_GETENV2	DEC_PROM_FUNC_ADDR(33)
220*56829Sralph #define DEC_PROM_SETENV2	DEC_PROM_FUNC_ADDR(34)
221*56829Sralph #define DEC_PROM_ATONUM		DEC_PROM_FUNC_ADDR(35)
222*56829Sralph #define DEC_PROM_STRCMP		DEC_PROM_FUNC_ADDR(36)
223*56829Sralph #define DEC_PROM_STRLEN		DEC_PROM_FUNC_ADDR(37)
224*56829Sralph #define DEC_PROM_STRCPY		DEC_PROM_FUNC_ADDR(38)
225*56829Sralph #define DEC_PROM_STRCAT		DEC_PROM_FUNC_ADDR(39)
226*56829Sralph #define DEC_PROM_GETCMD		DEC_PROM_FUNC_ADDR(40)
227*56829Sralph #define DEC_PROM_GETNUMS	DEC_PROM_FUNC_ADDR(41)
228*56829Sralph #define DEC_PROM_ARGPARSE	DEC_PROM_FUNC_ADDR(42)
229*56829Sralph #define DEC_PROM_HELP		DEC_PROM_FUNC_ADDR(43)
230*56829Sralph #define DEC_PROM_DUMP		DEC_PROM_FUNC_ADDR(44)
231*56829Sralph #define DEC_PROM_SETENV		DEC_PROM_FUNC_ADDR(45)
232*56829Sralph #define DEC_PROM_UNSETENV	DEC_PROM_FUNC_ADDR(46)
233*56829Sralph #define DEC_PROM_PRINTENV	DEC_PROM_FUNC_ADDR(47)
234*56829Sralph #define DEC_PROM_JUMP2S8	DEC_PROM_FUNC_ADDR(48)
235*56829Sralph #define DEC_PROM_ENABLE		DEC_PROM_FUNC_ADDR(49)
236*56829Sralph #define DEC_PROM_DISABLE	DEC_PROM_FUNC_ADDR(50)
237*56829Sralph #define DEC_PROM_ZEROB		DEC_PROM_FUNC_ADDR(51)
238*56829Sralph 
239*56829Sralph /*
240*56829Sralph  * The nonvolatile ram has a flag to indicate it is usable.
241*56829Sralph  */
242*56829Sralph #define MACH_USE_NON_VOLATILE 	((char *)0xbd0000c0)
243*56829Sralph #define MACH_NON_VOLATILE_FLAG	0x02
244*56829Sralph 
245*56829Sralph #endif /* _DEC_PROM */
246