1 /*        $NetBSD: nextrom.h,v 1.13 2023/02/11 02:33:27 tsutsui Exp $ */
2 /*
3  * Copyright (c) 1998 Darrin B. Jewell
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #ifndef NEXTROM_H_INCLUDED
28 #define NEXTROM_H_INCLUDED
29 
30 #define MG_simm 0
31 #define MG_flags 4
32 #define MG_sid 6
33 #define MG_pagesize 10
34 #define MG_mon_stack 14
35 #define MG_vbr 18
36 #define MG_nvram 22
37 #define MG_inetntoa 54
38 #define MG_inputline 72
39 #define MG_region 200
40 #define MG_alloc_base 232
41 #define MG_alloc_brk 236
42 #define MG_boot_dev 240
43 #define MG_boot_arg 244
44 #define MG_boot_info 248
45 #define MG_boot_file 252
46 #define MG_bootfile 256
47 #define MG_boot_how 320
48 #define MG_km 324
49 #define MG_km_flags 368
50 #define MG_mon_init 370
51 #define MG_si 374
52 #define MG_time 378
53 #define MG_sddp 382
54 #define MG_dgp 386
55 #define MG_s5cp 390
56 #define MG_odc 394
57 #define MG_odd 398
58 #define MG_radix 402
59 #define MG_dmachip 404
60 #define MG_diskchip 408
61 #define MG_intrstat 412
62 #define MG_intrmask 416
63 #define MG_nofault 420
64 #define MG_fmt 424
65 #define MG_addr 426
66 #define MG_na 458
67 #define MG_mx 462
68 #define MG_my 466
69 #define MG_cursor_save 470
70 #define MG_getc 726
71 #define MG_try_getc 730
72 #define MG_putc 734
73 #define MG_alert 738
74 #define MG_alert_confirm 742
75 #define MG_alloc 746
76 #define MG_boot_slider 750
77 #define MG_eventc 754
78 #define MG_event_high 758
79 #define MG_animate 762
80 #define MG_anim_time 766
81 #define MG_scsi_intr 770
82 #define MG_scsi_intrarg 774
83 #define MG_minor 778
84 #define MG_seq 780
85 #define MG_anim_run 782
86 #define MG_major 786
87 #define MG_con_slot 844
88 #define MG_con_fbnum 845
89 #define MG_con_map_vaddr0 860
90 #define MG_con_map_vaddr1 872
91 #define MG_con_map_vaddr2 884
92 #define MG_con_map_vaddr3 896
93 #define MG_con_map_vaddr4 908
94 #define MG_con_map_vaddr5 920
95 
96 
97 /*
98  * Darrin B Jewell <jewell@mit.edu>  Mon Jan 19 13:17:20 1998
99  * I made up these:
100  */
101 #define MG_clientetheraddr 788
102 #define MG_machine_type    936
103 #define MG_board_rev       937
104 
105 #if 0
106 
107 /*
108  *  The ROM monitor uses the old structure alignment for backward
109  *  compatibility with previous ROMs.  The old alignment is enabled
110  *  with the following pragma.  The kernel uses the "MG" macro to
111  *  construct an old alignment offset into the mon_global structure.
112  *  The kernel file <mon/assym.h> should be copied from the "assym.h"
113  *  found in the build directory of the current ROM release.
114  *  It will contain the proper old alignment offset constants.
115  */
116 #if       MONITOR
117 #pragma   CC_OLD_STORAGE_LAYOUT_ON
118 #else     MONITOR
119 #import <mon/assym.h>
120 #define   MG(type, off) \
121           ((type) ((u_int) (mg) + off))
122 #endif    /* MONITOR */
123 
124 #import <mon/nvram.h>
125 #import <mon/region.h>
126 #import <mon/tftp.h>
127 #import <mon/sio.h>
128 #import <mon/animate.h>
129 #import <mon/kmreg.h>
130 #import <next/cpu.h>
131 #import <next/machparam.h>
132 
133 #define   LMAX                128
134 #define   NBOOTFILE 64
135 #define   NADDR               8
136 
137 struct mon_global {
138           char mg_simm[N_SIMM];         /* MUST BE FIRST (accessed early by locore) */
139           char mg_flags;                /* MUST BE SECOND */
140 #define   MGF_LOGINWINDOW               0x80
141 #define   MGF_UART_SETUP                0x40
142 #define   MGF_UART_STOP                 0x20
143 #define   MGF_UART_TYPE_AHEAD 0x10
144 #define   MGF_ANIM_RUN                  0x08
145 #define   MGF_SCSI_INTR                 0x04
146 #define   MGF_KM_EVENT                  0x02
147 #define   MGF_KM_TYPE_AHEAD   0x01
148           u_int mg_sid, mg_pagesize, mg_mon_stack, mg_vbr;
149           struct nvram_info mg_nvram;
150           char mg_inetntoa[18];
151           char mg_inputline[LMAX];
152           struct mon_region mg_region[N_SIMM];
153           void *mg_alloc_base, mg_alloc_brk;
154           char *mg_boot_dev, *mg_boot_arg, *mg_boot_info, *mg_boot_file;
155           char mg_bootfile[NBOOTFILE];
156           enum SIO_ARGS mg_boot_how;
157           struct km_mon km;
158           int mon_init;
159           struct sio *mg_si;
160           int mg_time;
161           char *mg_sddp;
162           char *mg_dgp;
163           char *mg_s5cp;
164           char *mg_odc, *mg_odd;
165           char mg_radix;
166           int mg_dmachip;
167           int mg_diskchip;
168           volatile int *mg_intrstat;
169           volatile int *mg_intrmask;
170           void (*mg_nofault)();
171           char fmt;
172           int addr[NADDR], na;
173           int       mx, my;                       /* mouse location */
174           u_int     cursor_save[2][32];
175           int (*mg_getc)(), (*mg_try_getc)(), (*mg_putc)();
176           int (*mg_alert)(), (*mg_alert_confirm)();
177           void *(*mg_alloc)();
178           int (*mg_boot_slider)();
179           volatile u_char *eventc_latch;
180           volatile u_int event_high;
181           struct animation *mg_animate;
182           int mg_anim_time;
183           void (*mg_scsi_intr)();
184           int mg_scsi_intrarg;
185           short mg_minor, mg_seq;
186           int (*mg_anim_run)();
187           short mg_major;
188           char *mg_clientetheraddr;
189           int mg_console_i;
190           int mg_console_o;
191 #define   CONS_I_KBD          0
192 #define   CONS_I_SCC_A        1
193 #define   CONS_I_SCC_B        2
194 #define   CONS_I_NET          3
195 #define   CONS_O_BITMAP       0
196 #define   CONS_O_SCC_A        1
197 #define   CONS_O_SCC_B        2
198 #define   CONS_O_NET          3
199           char *test_msg;
200           /* Next entry should be km_coni. Mach depends on this! */
201           struct km_console_info km_coni;         /* Console configuration info. See kmreg.h */
202           char *mg_fdgp;
203           char mg_machine_type, mg_board_rev;
204           int (*mg_as_tune)();
205           int mg_flags2;
206 #define   MGF2_PARITY         0x80000000
207 };
208 
209 struct mon_global *restore_mg();
210 void *mon_alloc();
211 
212 #endif /* if 0 */
213 
214 #define   N_SIMM              4                   /* number of SIMMs in machine */
215 
216 /* SIMM types */
217 #define SIMM_SIZE       0x03
218 #define   SIMM_SIZE_EMPTY     0x00
219 #define   SIMM_SIZE_16MB      0x01
220 #define   SIMM_SIZE_4MB       0x02
221 #define   SIMM_SIZE_1MB       0x03
222 #define   SIMM_PAGE_MODE      0x04
223 #define   SIMM_PARITY         0x08 /* ?? */
224 
225 /* Space for onboard RAM
226  */
227 #define   MAX_PHYS_SEGS       (N_SIMM + 1)
228 
229 /* Machine types, used in both assembler and C sources. */
230 #define   NeXT_CUBE 0
231 #define   NeXT_WARP9          1
232 #define   NeXT_X15  2
233 #define   NeXT_WARP9C         3
234 #define NeXT_TURBO_MONO       4
235 #define NeXT_TURBO_COLOR 5                        /* probed witnessed */
236 #define NeXT_CUBE_TURBO       8
237 
238 #define   ROM_STACK_SIZE      (8192 - 2048)
239 
240 extern uint8_t rom_enetaddr[];
241 extern uint8_t rom_boot_dev[];
242 extern uint8_t rom_boot_arg[];
243 extern uint8_t rom_boot_info[];
244 extern uint8_t rom_boot_file[];
245 extern uint8_t rom_bootfile[];
246 extern char rom_machine_type;
247 
248 extern u_int  monbootflag;
249 
250 #endif /* NEXTROM_H_INCLUDED */
251