1
2/* parts from: */
3
4/*	$NetBSD: nextrom.h,v 1.11 2011/12/18 04:29:32 tsutsui Exp $	*/
5/*
6 * Copyright (c) 1998 Darrin B. Jewell
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 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/* parts from NeXT headers */
31
32#include <sys/types.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#define	N_SIMM		4		/* number of SIMMs in machine */
39
40/* SIMM types */
41#define SIMM_SIZE       0x03
42#define	SIMM_SIZE_EMPTY	0x00
43#define	SIMM_SIZE_16MB	0x01
44#define	SIMM_SIZE_4MB	0x02
45#define	SIMM_SIZE_1MB	0x03
46#define	SIMM_PAGE_MODE	0x04
47#define	SIMM_PARITY	0x08 /* ?? */
48
49/* Space for onboard RAM
50 */
51#define	MAX_PHYS_SEGS	(N_SIMM + 1)
52
53/* Machine types, used in both assembler and C sources. */
54#define	NeXT_CUBE	0
55#define	NeXT_WARP9	1
56#define	NeXT_X15	2
57#define	NeXT_WARP9C	3
58#define NeXT_TURBO_MONO	4
59#define NeXT_TURBO_COLOR 5			/* probed witnessed */
60
61#define	ROM_STACK_SIZE	(8192 - 2048)
62
63#if 0
64
65/*
66 *  The ROM monitor uses the old structure alignment for backward
67 *  compatibility with previous ROMs.  The old alignment is enabled
68 *  with the following pragma.  The kernel uses the "MG" macro to
69 *  construct an old alignment offset into the mon_global structure.
70 *  The kernel file <mon/assym.h> should be copied from the "assym.h"
71 *  found in the build directory of the current ROM release.
72 *  It will contain the proper old alignment offset constants.
73 */
74
75#if	MONITOR
76#pragma	CC_OLD_STORAGE_LAYOUT_ON
77#else	MONITOR
78#import <mon/assym.h>
79#define	MG(type, off) \
80	((type) ((u_int) (mg) + off))
81#endif	/* MONITOR */
82
83#endif
84
85#define	LMAX		128
86#define	NBOOTFILE	64
87#define	NADDR		8
88
89/* NetBSD defines macros and other stuff to deal with old alignment
90   of this structure, we rather declare it as packed aligned at 2.
91   (the __attribute__ directive does not support an argument so we use pragma)
92   (cf. src/sys/arch/next68k/next68k/nextrom.h in NetBSD)
93   */
94
95/* fake structs to get correct size, calculated from offset deltas */
96
97struct nvram_info {
98	char data[54-22];
99};
100
101struct mon_region {
102	long	first_phys_addr;
103	long	last_phys_addr;
104};
105
106enum SIO_ARGS {
107	SIO_ARGS_max = 1
108};
109
110struct sio {
111	enum SIO_ARGS si_args;
112	unsigned int si_ctrl, si_unit, si_part;
113	struct device *si_dev;
114	unsigned int si_blklen;
115	unsigned int si_lastlba;
116	/*caddr_t*/void *si_sadmem;
117	/*caddr_t*/void *si_protomem;
118	/*caddr_t*/void *si_devmem;
119};
120
121struct km_mon {
122	char data[370-324];
123};
124
125struct km_console_info
126{
127	int	pixels_per_word;	/* Pixels per 32 bit word: 16, 4, 2, or 1 */
128	int	bytes_per_scanline;
129	int	dspy_w;			/* Visible display width in pixels */
130	int	dspy_max_w;		/* Display width in pixels */
131	int	dspy_h;			/* Visible display height in pixels */
132#define KM_CON_ON_NEXTBUS	1	/* flag_bits: Console is NextBus device */
133	int	flag_bits;		/* Vendor and NeXT flags */
134	int	color[4];		/* Bit pattern for white thru black */
135#define KM_HIGH_SLOT	6		/* highest possible console slot. */
136	char	slot_num;		/* Slot of console device */
137	char	fb_num;			/* Logical frame buffer in slot for console */
138	char	byte_lane_id;		/* A value of 1, 4, or 8 */
139	int	start_access_pfunc;	/* P-code run before each FB access */
140	int	end_access_pfunc;	/* P-code run after each FB access */
141	struct	{		/* Frame buffer related addresses to be mapped */
142			int	phys_addr;
143			int	virt_addr;
144			int	size;
145#define KM_CON_MAP_ENTRIES	6
146#define KM_CON_PCODE		0
147#define KM_CON_FRAMEBUFFER	1
148#define KM_CON_BACKINGSTORE	2
149		} map_addr[KM_CON_MAP_ENTRIES];
150	int	access_stack;
151};
152/*
153struct km_console_info {
154	char data[(936-4)-(788+16)];
155};*/
156
157#pragma pack(push,2)
158
159struct mon_global {
160	char mg_simm[N_SIMM];	/* MUST BE FIRST (accesed early by locore) */
161	char mg_flags;		/* MUST BE SECOND */
162#define	MGF_LOGINWINDOW		0x80
163#define	MGF_UART_SETUP		0x40
164#define	MGF_UART_STOP		0x20
165#define	MGF_UART_TYPE_AHEAD	0x10
166#define	MGF_ANIM_RUN		0x08
167#define	MGF_SCSI_INTR		0x04
168#define	MGF_KM_EVENT		0x02
169#define	MGF_KM_TYPE_AHEAD	0x01
170	u_int mg_sid, mg_pagesize, mg_mon_stack, mg_vbr;
171	struct nvram_info mg_nvram;
172	char mg_inetntoa[18];
173	char mg_inputline[LMAX];
174	struct mon_region mg_region[N_SIMM];
175	void *mg_alloc_base, *mg_alloc_brk;
176	char *mg_boot_dev, *mg_boot_arg, *mg_boot_info, *mg_boot_file;
177	char mg_bootfile[NBOOTFILE];
178	enum SIO_ARGS mg_boot_how;
179	struct km_mon km;
180	int mon_init;
181	struct sio *mg_si;
182	int mg_time;
183	char *mg_sddp;
184	char *mg_dgp;
185	char *mg_s5cp;
186	char *mg_odc, *mg_odd;
187	char mg_radix;
188	int mg_dmachip;
189	int mg_diskchip;
190	volatile int *mg_intrstat;
191	volatile int *mg_intrmask;
192	void (*mg_nofault)();
193	char fmt;
194	int addr[NADDR], na;
195	int	mx, my;			/* mouse location */
196	u_int	cursor_save[2][32];
197	int (*mg_getc)(), (*mg_try_getc)(), (*mg_putc)(int);
198	int (*mg_alert)(), (*mg_alert_confirm)();
199	void *(*mg_alloc)();
200	int (*mg_boot_slider)();
201	volatile u_char *eventc_latch;
202	volatile u_int event_high;
203	struct animation *mg_animate;
204	int mg_anim_time;
205	void (*mg_scsi_intr)();
206	int mg_scsi_intrarg;
207	short mg_minor, mg_seq;
208	int (*mg_anim_run)();
209	short mg_major;
210	char *mg_clientetheraddr;
211	int mg_console_i;
212	int mg_console_o;
213#define	CONS_I_KBD	0
214#define	CONS_I_SCC_A	1
215#define	CONS_I_SCC_B	2
216#define	CONS_I_NET	3
217#define	CONS_O_BITMAP	0
218#define	CONS_O_SCC_A	1
219#define	CONS_O_SCC_B	2
220#define	CONS_O_NET	3
221	char *test_msg;
222	/* Next entry should be km_coni. Mach depends on this! */
223	struct km_console_info km_coni;	/* Console configuration info. See kmreg.h */
224	char *mg_fdgp;
225	char mg_machine_type, mg_board_rev;
226	int (*mg_as_tune)();
227	int mg_flags2;
228#define	MGF2_PARITY	0x80000000
229	volatile struct bmap *mg_bmap_chip;
230	enum mg_pkg {PKG_CUBE, PKG_NS} mg_pkg;
231	enum mg_memory_system {MEMSYS_8, MEMSYS_32} mg_memory_system;
232	enum mg_video_system {VIDSYS_313, VIDSYS_W9C, VIDSYS_PC} mg_video_system;
233	int mg_cpu_clk;
234};
235
236#pragma pack(pop)
237
238extern struct mon_global *mg;
239
240#ifdef __cplusplus
241}
242#endif
243