/[gxemul]/trunk/src/machines/machine_pmax.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/src/machines/machine_pmax.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 42 - (show annotations)
Mon Oct 8 16:22:32 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 33084 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1613 2007/06/15 20:11:26 debug Exp $
20070501	Continuing a little on m88k disassembly (control registers,
		more instructions).
		Adding a dummy mvme88k machine mode.
20070502	Re-adding MIPS load/store alignment exceptions.
20070503	Implementing more of the M88K disassembly code.
20070504	Adding disassembly of some more M88K load/store instructions.
		Implementing some relatively simple M88K instructions (br.n,
		xor[.u] imm, and[.u] imm).
20070505	Implementing M88K three-register and, or, xor, and jmp[.n],
		bsr[.n] including function call trace stuff.
		Applying a patch from Bruce M. Simpson which implements the
		SYSCON_BOARD_CPU_CLOCK_FREQ_ID object of the syscon call in
		the yamon PROM emulation.
20070506	Implementing M88K bb0[.n] and bb1[.n], and skeletons for
		ldcr and stcr (although no control regs are implemented yet).
20070509	Found and fixed the bug which caused Linux for QEMU_MIPS to
		stop working in 0.4.5.1: It was a faulty change to the MIPS
		'sc' and 'scd' instructions I made while going through gcc -W
		warnings on 20070428.
20070510	Updating the Linux/QEMU_MIPS section in guestoses.html to
		use mips-test-0.2.tar.gz instead of 0.1.
		A big thank you to Miod Vallat for sending me M88K manuals.
		Implementing more M88K instructions (addu, subu, div[u], mulu,
		ext[u], clr, set, cmp).
20070511	Fixing bugs in the M88K "and" and "and.u" instructions (found
		by comparing against the manual).
		Implementing more M88K instructions (mask[.u], mak, bcnd (auto-
		generated)) and some more control register details.
		Cleanup: Removing the experimental AVR emulation mode and
		corresponding devices; AVR emulation wasn't really meaningful.
		Implementing autogeneration of most M88K loads/stores. The
		rectangle drawing demo (with -O0) for M88K runs :-)
		Beginning on M88K exception handling.
		More M88K instructions: tb0, tb1, rte, sub, jsr[.n].
		Adding some skeleton MVME PROM ("BUG") emulation.
20070512	Fixing a bug in the M88K cmp instruction.
		Adding the M88K lda (scaled register) instruction.
		Fixing bugs in 64-bit (32-bit pairs) M88K loads/stores.
		Removing the unused tick_hz stuff from the machine struct.
		Implementing the M88K xmem instruction. OpenBSD/mvme88k gets
		far enough to display the Copyright banner :-)
		Implementing subu.co (guess), addu.co, addu.ci, ff0, and ff1.
		Adding a dev_mvme187, for MVME187-specific devices/registers.
		OpenBSD/mvme88k prints more boot messages. :)
20070515	Continuing on MVME187 emulation (adding more devices, beginning
		on the CMMUs, etc).
		Adding the M88K and.c, xor.c, and or.c instructions, and making
		sure that mul, div, etc cause exceptions if executed when SFD1
		is disabled.
20070517	Continuing on M88K and MVME187 emulation in general; moving
		the CMMU registers to the CPU struct, separating dev_pcc2 from
		dev_mvme187, and beginning on memory_m88k.c (BATC and PATC).
		Fixing a bug in 64-bit (32-bit pairs) M88K fast stores.
		Implementing the clock part of dev_mk48txx.
		Implementing the M88K fstcr and xcr instructions.
		Implementing m88k_cpu_tlbdump().
		Beginning on the implementation of a separate address space
		for M88K .usr loads/stores.
20070520	Removing the non-working (skeleton) Sandpoint, SonyNEWS, SHARK
		Dnard, and Zaurus machine modes.
		Experimenting with dyntrans to_be_translated read-ahead. It
		seems to give a very small performance increase for MIPS
		emulation, but a large performance degradation for SuperH. Hm.
20070522	Disabling correct SuperH ITLB emulation; it does not seem to be
		necessary in order to let SH4 guest OSes run, and it slows down
		userspace code.
		Implementing "samepage" branches for SuperH emulation, and some
		other minor speed hacks.
20070525	Continuing on M88K memory-related stuff: exceptions, memory
		transaction register contents, etc.
		Implementing the M88K subu.ci instruction.
		Removing the non-working (skeleton) Iyonix machine mode.
		OpenBSD/mvme88k reaches userland :-), starts executing
		/sbin/init's instructions, and issues a few syscalls, before
		crashing.
20070526	Fixing bugs in dev_mk48txx, so that OpenBSD/mvme88k detects
		the correct time-of-day.
		Implementing a generic IRQ controller for the test machines
		(dev_irqc), similar to a proposed patch from Petr Stepan.
		Experimenting some more with translation read-ahead.
		Adding an "expect" script for automated OpenBSD/landisk
		install regression/performance tests.
20070527	Adding a dummy mmEye (SH3) machine mode skeleton.
		FINALLY found the strange M88K bug I have been hunting: I had
		not emulated the SNIP value for exceptions occurring in
		branch delay slots correctly.
		Implementing correct exceptions for 64-bit M88K loads/stores.
		Address to symbol lookups are now disabled when M88K is
		running in usermode (because usermode addresses don't have
		anything to do with supervisor addresses).
20070531	Removing the mmEye machine mode skeleton.
20070604	Some minor code cleanup.
20070605	Moving src/useremul.c into a subdir (src/useremul/), and
		cleaning up some more legacy constructs.
		Adding -Wstrict-aliasing and -fstrict-aliasing detection to
		the configure script.
20070606	Adding a check for broken GCC on Solaris to the configure
		script. (GCC 3.4.3 on Solaris cannot handle static variables
		which are initialized to 0 or NULL. :-/)
		Removing the old (non-working) ARC emulation modes: NEC RD94,
		R94, R96, and R98, and the last traces of Olivetti M700 and
		Deskstation Tyne.
		Removing the non-working skeleton WDSC device (dev_wdsc).
20070607	Thinking about how to use the host's cc + ld at runtime to
		generate native code. (See experiments/native_cc_ld_test.i
		for an example.)
20070608	Adding a program counter sampling timer, which could be useful
		for native code generation experiments.
		The KN02_CSR_NRMMOD bit in the DECstation 5000/200 (KN02) CSR
		should always be set, to allow a 5000/200 PROM to boot.
20070609	Moving out breakpoint details from the machine struct into
		a helper struct, and removing the limit on max nr of
		breakpoints.
20070610	Moving out tick functions into a helper struct as well (which
		also gets rid of the max limit).
20070612	FINALLY figured out why Debian/DECstation stopped working when
		translation read-ahead was enabled: in src/memory_rw.c, the
		call to invalidate_code_translation was made also if the
		memory access was an instruction load (if the page was mapped
		as writable); it shouldn't be called in that case.
20070613	Implementing some more MIPS32/64 revision 2 instructions: di,
		ei, ext, dext, dextm, dextu, and ins.
20070614	Implementing an instruction combination for the NetBSD/arm
		idle loop (making the host not use any cpu if NetBSD/arm
		inside the emulator is not using any cpu).
		Increasing the nr of ARM VPH entries from 128 to 384.
20070615	Removing the ENABLE_arch stuff from the configure script, so
		that all included architectures are included in both release
		and development builds.
		Moving memory related helper functions from misc.c to memory.c.
		Adding preliminary instructions for netbooting NetBSD/pmppc to
		guestoses.html; it doesn't work yet, there are weird timeouts.
		Beginning a total rewrite of the userland emulation modes
		(removing all emulation modes, beginning from scratch with
		NetBSD/MIPS and FreeBSD/Alpha only).
20070616	After fixing a bug in the DEC21143 NIC (the TDSTAT_OWN bit was
		only cleared for the last segment when transmitting, not all
		segments), NetBSD/pmppc boots with root-on-nfs without the
		timeouts. Updating guestoses.html.
		Removing the skeleton PSP (Playstation Portable) mode.
		Moving X11-related stuff in the machine struct into a helper
		struct.
		Cleanup of out-of-memory checks, to use a new CHECK_ALLOCATION
		macro (which prints a meaningful error message).
		Adding a COMMENT to each machine and device (for automagic
		.index comment generation).
		Doing regression testing for the next release.

==============  RELEASE 0.4.6  ==============


1 /*
2 * Copyright (C) 2003-2007 Anders Gavare. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 *
28 * $Id: machine_pmax.c,v 1.29 2007/06/15 19:11:15 debug Exp $
29 *
30 * COMMENT: Digital DECstation ("PMAX") machines
31 */
32
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36
37 #include "cpu.h"
38 #include "device.h"
39 #include "devices.h"
40 #include "diskimage.h"
41 #include "machine.h"
42 #include "machine_pmax.h"
43 #include "memory.h"
44 #include "misc.h"
45
46 #include "dec_prom.h"
47 #include "dec_bootinfo.h"
48 #include "dec_5100.h"
49 #include "dec_kn01.h"
50 #include "dec_kn02.h"
51 #include "dec_kn03.h"
52 #include "dec_kmin.h"
53 #include "dec_maxine.h"
54
55 #define BOOTARG_BUFLEN 2000
56
57
58 MACHINE_SETUP(pmax)
59 {
60 char *framebuffer_console_name, *serial_console_name, *init_bootpath;
61 int color_fb_flag, i;
62 int boot_scsi_boardnumber = 3, boot_net_boardnumber = 3;
63 char *turbochannel_default_gfx_card = "PMAG-BA";
64 /* PMAG-AA, -BA, -CA/DA/EA/FA, -JA, -RO, PMAGB-BA */
65 struct xx {
66 struct btinfo_magic a;
67 struct btinfo_bootpath b;
68 struct btinfo_symtab c;
69 } xx;
70 char tmpstr[1000];
71 struct vfb_data *fb;
72 struct memory *mem = machine->memory;
73 uint64_t addr;
74
75 cpu->byte_order = EMUL_LITTLE_ENDIAN;
76
77 /*
78 * Add an R2020 or R3220 writeback memory thing:
79 */
80 cpu->cd.mips.coproc[3] = mips_coproc_new(cpu, 3);
81
82 /* There aren't really any good standard values... */
83 framebuffer_console_name = "osconsole=0,3";
84 serial_console_name = "osconsole=1";
85
86 switch (machine->machine_subtype) {
87
88 case MACHINE_DEC_PMAX_3100: /* type 1, KN01 */
89 /* Supposed to have 12MHz or 16.67MHz R2000 CPU, R2010 FPC,
90 R2020 Memory coprocessor */
91 machine->machine_name = "DEC PMAX 3100 (KN01)";
92
93 /* 12 MHz for 2100, 16.67 MHz for 3100 */
94 if (machine->emulated_hz == 0)
95 machine->emulated_hz = 16670000;
96
97 if (machine->physical_ram_in_mb > 24)
98 fprintf(stderr, "WARNING! Real DECstation 3100 machines"
99 " cannot have more than 24MB RAM.\n");
100
101 if ((machine->physical_ram_in_mb % 4) != 0)
102 fprintf(stderr, "WARNING! Real DECstation 3100 machines"
103 " have an integer multiple of 4 MBs of RAM.\n");
104
105 /* 1 for color, 0 for mono. TODO: command line option? */
106 color_fb_flag = 1;
107
108 /*
109 * According to NetBSD/pmax:
110 *
111 * pm0 at ibus0 addr 0xfc00000: 1024x864x1 (or x8 for color)
112 * dc0 at ibus0 addr 0x1c000000
113 * le0 at ibus0 addr 0x18000000: address 00:00:00:00:00:00
114 * sii0 at ibus0 addr 0x1a000000
115 * mcclock0 at ibus0 addr 0x1d000000: mc146818 or compatible
116 * 0x1e000000 = system status and control register
117 */
118 fb = dev_fb_init(machine, mem, KN01_PHYS_FBUF_START,
119 color_fb_flag? VFB_DEC_VFB02 : VFB_DEC_VFB01,
120 0,0,0,0,0, color_fb_flag? "VFB02":"VFB01");
121 dev_colorplanemask_init(mem, KN01_PHYS_COLMASK_START,
122 &fb->color_plane_mask);
123 dev_vdac_init(mem, KN01_SYS_VDAC, fb->rgb_palette,
124 color_fb_flag);
125
126 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i",
127 machine->path, machine->bootstrap_cpu, KN01_INT_LANCE);
128 dev_le_init(machine, mem, KN01_SYS_LANCE,
129 KN01_SYS_LANCE_B_START, KN01_SYS_LANCE_B_END,
130 tmpstr, 4*1048576);
131
132 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i",
133 machine->path, machine->bootstrap_cpu, KN01_INT_SII);
134 dev_sii_init(machine, mem, KN01_SYS_SII, KN01_SYS_SII_B_START,
135 KN01_SYS_SII_B_END, tmpstr);
136
137 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i",
138 machine->path, machine->bootstrap_cpu, KN01_INT_DZ);
139 dev_dc7085_init(machine, mem, KN01_SYS_DZ, tmpstr,
140 machine->x11_md.in_use);
141
142 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i",
143 machine->path, machine->bootstrap_cpu, KN01_INT_CLOCK);
144 dev_mc146818_init(machine, mem, KN01_SYS_CLOCK, tmpstr,
145 MC146818_DEC, 1);
146
147 dev_kn01_init(mem, KN01_SYS_CSR, color_fb_flag);
148
149 framebuffer_console_name = "osconsole=0,3"; /* fb,keyb */
150 serial_console_name = "osconsole=3"; /* 3 */
151 break;
152
153 case MACHINE_DEC_3MAX_5000: /* type 2, KN02 */
154 /* Supposed to have 25MHz R3000 CPU, R3010 FPC, */
155 /* and a R3220 Memory coprocessor */
156 machine->machine_name = "DECstation 5000/200 (3MAX, KN02)";
157
158 if (machine->emulated_hz == 0)
159 machine->emulated_hz = 25000000;
160
161 if (machine->physical_ram_in_mb < 8)
162 fprintf(stderr, "WARNING! Real KN02 machines do not "
163 "have less than 8MB RAM. Continuing anyway.\n");
164 if (machine->physical_ram_in_mb > 480)
165 fprintf(stderr, "WARNING! Real KN02 machines cannot "
166 "have more than 480MB RAM. Continuing anyway.\n");
167
168 /* An R3220 memory thingy: */
169 cpu->cd.mips.coproc[3] = mips_coproc_new(cpu, 3);
170
171 /*
172 * According to NetBSD/pmax:
173 * asc0 at tc0 slot 5 offset 0x0
174 * le0 at tc0 slot 6 offset 0x0
175 * ibus0 at tc0 slot 7 offset 0x0
176 * dc0 at ibus0 addr 0x1fe00000
177 * mcclock0 at ibus0 addr 0x1fe80000: mc146818
178 */
179
180 /* KN02 mainbus (TurboChannel interrupt controller): */
181 snprintf(tmpstr, sizeof(tmpstr), "kn02 addr=0x%x "
182 "irq=%s.cpu[%i].2", (int) KN02_SYS_CSR,
183 machine->path, machine->bootstrap_cpu);
184 device_add(machine, tmpstr);
185
186 /*
187 * TURBOchannel slots 0, 1, and 2 are free for option cards.
188 * Let's put in zero or more graphics boards:
189 *
190 * TODO: It's also possible to have larger graphics cards that
191 * occupy several slots. How should this be solved nicely?
192 */
193
194 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.kn02.%i",
195 machine->path, machine->bootstrap_cpu, 0);
196 dev_turbochannel_init(machine, mem, 0,
197 KN02_PHYS_TC_0_START, KN02_PHYS_TC_0_END,
198 machine->n_gfx_cards >= 1?
199 turbochannel_default_gfx_card : "",
200 tmpstr);
201
202 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.kn02.%i",
203 machine->path, machine->bootstrap_cpu, 1);
204 dev_turbochannel_init(machine, mem, 1,
205 KN02_PHYS_TC_1_START, KN02_PHYS_TC_1_END,
206 machine->n_gfx_cards >= 2?
207 turbochannel_default_gfx_card : "",
208 tmpstr);
209
210 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.kn02.%i",
211 machine->path, machine->bootstrap_cpu, 2);
212 dev_turbochannel_init(machine, mem, 2,
213 KN02_PHYS_TC_2_START, KN02_PHYS_TC_2_END,
214 machine->n_gfx_cards >= 3?
215 turbochannel_default_gfx_card : "",
216 tmpstr);
217
218 /* TURBOchannel slots 3 and 4 are reserved. */
219
220 /* TURBOchannel slot 5 is PMAZ-AA ("asc" SCSI). */
221 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.kn02.%i",
222 machine->path, machine->bootstrap_cpu, 5);
223 dev_turbochannel_init(machine, mem, 5,
224 KN02_PHYS_TC_5_START, KN02_PHYS_TC_5_END,
225 "PMAZ-AA", tmpstr);
226
227 /* TURBOchannel slot 6 is PMAD-AA ("le" ethernet). */
228 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.kn02.%i",
229 machine->path, machine->bootstrap_cpu, 6);
230 dev_turbochannel_init(machine, mem, 6,
231 KN02_PHYS_TC_6_START, KN02_PHYS_TC_6_END,
232 "PMAD-AA", tmpstr);
233
234 /* TURBOchannel slot 7 is system stuff. */
235 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.kn02.%i",
236 machine->path, machine->bootstrap_cpu, 7);
237 machine->main_console_handle =
238 dev_dc7085_init(machine, mem,
239 KN02_SYS_DZ, tmpstr, machine->x11_md.in_use);
240
241 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i",
242 machine->path, machine->bootstrap_cpu, KN02_INT_CLOCK);
243 dev_mc146818_init(machine, mem,
244 KN02_SYS_CLOCK, tmpstr, MC146818_DEC, 1);
245
246 framebuffer_console_name = "osconsole=0,7";
247 /* fb,keyb */
248 serial_console_name = "osconsole=2";
249 boot_scsi_boardnumber = 5;
250 boot_net_boardnumber = 6; /* TODO: 3? */
251 break;
252
253 case MACHINE_DEC_3MIN_5000: /* type 3, KN02BA */
254 machine->machine_name = "DECstation 5000/112 or 145 (3MIN,"
255 " KN02BA)";
256 if (machine->emulated_hz == 0)
257 machine->emulated_hz = 33000000;
258 if (machine->physical_ram_in_mb > 128)
259 fprintf(stderr, "WARNING! Real 3MIN machines cannot "
260 "have more than 128MB RAM. Continuing anyway.\n");
261
262 /* KMIN interrupts: */
263 fatal("TODO: Legacy rewrite\n");
264 abort();
265 // machine->md_interrupt = kmin_interrupt;
266
267 /*
268 * tc0 at mainbus0: 12.5 MHz clock (0x10000000,slotsize=64MB)
269 * tc slot 1: 0x14000000
270 * tc slot 2: 0x18000000
271 * ioasic0 at tc0 slot 3 offset 0x0 (0x1c000000) slot 0
272 * asic regs (0x1c040000) slot 1
273 * station's ether address (0x1c080000) slot 2
274 * le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00
275 * (0x1c0c0000) slot 3
276 * scc0 at ioasic0 offset 0x100000 (0x1c100000) slot 4
277 * scc1 at ioasic0 offset 0x180000: console(0x1c180000) slot 6
278 * mcclock0 at ioasic0 offset 0x200000: mc146818 or
279 * compatible (0x1c200000) slot 8
280 * asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz,
281 * SCSI ID 7 (0x1c300000) slot 12
282 * dma for asc0 (0x1c380000) slot 14
283 */
284 fatal("TODO: dec_ioasic legacy rewrite\n");
285 abort();
286 // machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu,
287 // mem, 0x1c000000, 0);
288 fatal("TODO: kmin dev_le_init.\n");
289 abort();
290 // dev_le_init(machine, mem, 0x1c0c0000, 0, 0,
291 // KMIN_INTR_LANCE + 8, 4 * 65536);
292 dev_scc_init(machine, mem, 0x1c100000, KMIN_INTR_SCC_0 + 8,
293 machine->x11_md.in_use, 0, 1);
294 dev_scc_init(machine, mem, 0x1c180000, KMIN_INTR_SCC_1 + 8,
295 machine->x11_md.in_use, 1, 1);
296 fatal("TODO: mc146818 irq\n");
297 abort();
298 // dev_mc146818_init(machine, mem, 0x1c200000,
299 //KMIN_INTR_CLOCK + 8,
300 // MC146818_DEC, 1);
301 fatal("TODO: kmin asc init\n");
302 abort();
303 // dev_asc_init(machine, mem, 0x1c300000, KMIN_INTR_SCSI +8,
304 // NULL, DEV_ASC_DEC, NULL, NULL);
305
306 /*
307 * TURBOchannel slots 0, 1, and 2 are free for
308 * option cards. These are by default filled with
309 * zero or more graphics boards.
310 *
311 * TODO: irqs
312 */
313 fatal("TODO: turbochannel init rewrite!\n");
314 abort();
315 #if 0
316 dev_turbochannel_init(machine, mem, 0, 0x10000000, 0x103fffff,
317 machine->n_gfx_cards >= 1?
318 turbochannel_default_gfx_card : "", KMIN_INT_TC0);
319
320 dev_turbochannel_init(machine, mem, 1, 0x14000000, 0x143fffff,
321 machine->n_gfx_cards >= 2?
322 turbochannel_default_gfx_card : "", KMIN_INT_TC1);
323
324 dev_turbochannel_init(machine, mem, 2, 0x18000000, 0x183fffff,
325 machine->n_gfx_cards >= 3?
326 turbochannel_default_gfx_card : "", KMIN_INT_TC2);
327 #endif
328 /* (kmin shared irq numbers (IP) are offset by +8 in the
329 emulator) */
330 /* kmin_csr = dev_kmin_init(cpu, mem, KMIN_REG_INTR); */
331
332 framebuffer_console_name = "osconsole=0,3"; /* fb,keyb(?) */
333 serial_console_name = "osconsole=3"; /* ? */
334 break;
335
336 case MACHINE_DEC_3MAXPLUS_5000: /* type 4, KN03 */
337 machine->machine_name = "DECsystem 5900 or 5000 (3MAX+) (KN03)";
338
339 /* 5000/240 (KN03-GA, R3000): 40 MHz */
340 /* 5000/260 (KN05-NB, R4000): 60 MHz */
341 /* TODO: are both these type 4? */
342 if (machine->emulated_hz == 0)
343 machine->emulated_hz = 40000000;
344 if (machine->physical_ram_in_mb > 480)
345 fprintf(stderr, "WARNING! Real KN03 machines cannot "
346 "have more than 480MB RAM. Continuing anyway.\n");
347
348 /* KN03 interrupts: */
349 fatal("TODO: Legacy rewrite\n");
350 abort();
351 // machine->md_interrupt = kn03_interrupt;
352
353 /*
354 * tc0 at mainbus0: 25 MHz clock (slot 0) (0x1e000000)
355 * tc0 slot 1 (0x1e800000)
356 * tc0 slot 2 (0x1f000000)
357 * ioasic0 at tc0 slot 3 offset 0x0 (0x1f800000)
358 * something that has to do with interrupts? (?)(0x1f840000?)
359 * le0 at ioasic0 offset 0xc0000 (0x1f8c0000)
360 * scc0 at ioasic0 offset 0x100000 (0x1f900000)
361 * scc1 at ioasic0 offset 0x180000: console (0x1f980000)
362 * mcclock0 at ioasic0 offset 0x200000: mc146818 or
363 * compatible (0x1fa00000)
364 * asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz,
365 * SCSI ID 7 (0x1fb00000)
366 */
367 fatal("TODO: dec_ioasic legacy rewrite\n");
368 abort();
369 // machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu,
370 // mem, 0x1f800000, 0);
371
372 fatal("TODO: kn03 dev_le_init rewrite\n");
373 abort();
374 // dev_le_init(machine, mem, KN03_SYS_LANCE, 0, 0,
375 // KN03_INTR_LANCE +8, 4 * 65536);
376
377 fatal("TODO: dec_ioasic legacy rewrite\n");
378 abort();
379 // machine->md_int.dec_ioasic_data->dma_func[3] =
380 // dev_scc_dma_func;
381 // machine->md_int.dec_ioasic_data->dma_func_extra[2] =
382 // dev_scc_init(machine, mem, KN03_SYS_SCC_0,
383 // KN03_INTR_SCC_0 +8, machine->x11_md.in_use, 0, 1);
384 // machine->md_int.dec_ioasic_data->dma_func[2] =
385 // dev_scc_dma_func;
386 // machine->md_int.dec_ioasic_data->dma_func_extra[3] =
387 // dev_scc_init(machine, mem, KN03_SYS_SCC_1,
388 // KN03_INTR_SCC_1 +8, machine->x11_md.in_use, 1, 1);
389
390 fatal("TODO: mc146818 irq\n");
391 abort();
392 // dev_mc146818_init(machine, mem, KN03_SYS_CLOCK, KN03_INT_RTC,
393 // MC146818_DEC, 1);
394 fatal("TODO: asc init rewrite\n");
395 abort();
396 // dev_asc_init(machine, mem, KN03_SYS_SCSI,
397 // KN03_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL);
398
399 /*
400 * TURBOchannel slots 0, 1, and 2 are free for
401 * option cards. These are by default filled with
402 * zero or more graphics boards.
403 *
404 * TODO: irqs
405 */
406 fatal("TODO: turbochannel rewrite init\n");
407 abort();
408 #if 0
409 dev_turbochannel_init(machine, mem, 0,
410 KN03_PHYS_TC_0_START, KN03_PHYS_TC_0_END,
411 machine->n_gfx_cards >= 1?
412 turbochannel_default_gfx_card : "",
413 KN03_INTR_TC_0 +8);
414
415 dev_turbochannel_init(machine, mem, 1,
416 KN03_PHYS_TC_1_START, KN03_PHYS_TC_1_END,
417 machine->n_gfx_cards >= 2?
418 turbochannel_default_gfx_card : "",
419 KN03_INTR_TC_1 +8);
420
421 dev_turbochannel_init(machine, mem, 2,
422 KN03_PHYS_TC_2_START, KN03_PHYS_TC_2_END,
423 machine->n_gfx_cards >= 3?
424 turbochannel_default_gfx_card : "",
425 KN03_INTR_TC_2 +8);
426 #endif
427
428 /* TODO: interrupts */
429 /* shared (turbochannel) interrupts are +8 */
430
431 framebuffer_console_name = "osconsole=0,3"; /* fb,keyb(?) */
432 serial_console_name = "osconsole=3"; /* ? */
433 break;
434
435 case MACHINE_DEC_5800: /* type 5, KN5800 */
436 machine->machine_name = "DECsystem 5800";
437
438 /* TODO: this is incorrect, banks multiply by 8 etc */
439 if (machine->physical_ram_in_mb < 48)
440 fprintf(stderr, "WARNING! 5800 will probably not run "
441 "with less than 48MB RAM. Continuing anyway.\n");
442
443 /*
444 * According to
445 * http://www2.no.netbsd.org/ports/pmax/models.html,
446 * the 5800-series is based on VAX 6000/300.
447 */
448
449 /*
450 * Ultrix might support SMP on this machine type.
451 *
452 * Something at 0x10000000.
453 * ssc serial console at 0x10140000, interrupt 2 (shared
454 * with XMI?).
455 * xmi 0 at address 0x11800000 (node x at offset x*0x80000)
456 * Clock uses interrupt 3 (shared with XMI?).
457 */
458
459 device_add(machine, "dec5800 addr=0x10000000");
460 device_add(machine, "decbi addr=0x10000000");
461
462 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].dec5800.28",
463 machine->path, machine->bootstrap_cpu);
464 dev_ssc_init(machine, mem, 0x10140000,
465 tmpstr, machine->x11_md.in_use);
466
467 dev_decxmi_init(mem, 0x11800000);
468 dev_deccca_init(mem, DEC_DECCCA_BASEADDR);
469
470 break;
471
472 case MACHINE_DEC_5400: /* type 6, KN210 */
473 machine->machine_name = "DECsystem 5400 (KN210)";
474 /*
475 * Misc. info from the KN210 manual:
476 *
477 * Interrupt lines:
478 * irq5 fpu
479 * irq4 halt
480 * irq3 pwrfl -> mer1 -> mer0 -> wear
481 * irq2 100 Hz -> birq7
482 * irq1 dssi -> ni -> birq6
483 * irq0 birq5 -> console -> timers -> birq4
484 *
485 * Interrupt status register at 0x10048000.
486 * Main memory error status register at 0x1008140.
487 * Interval Timer Register (ITR) at 0x10084010.
488 * Q22 stuff at 0x10088000 - 0x1008ffff.
489 * TODR at 0x1014006c.
490 * TCR0 (timer control register 0) 0x10140100.
491 * TIR0 (timer interval register 0) 0x10140104.
492 * TCR1 (timer control register 1) 0x10140110.
493 * TIR1 (timer interval register 1) 0x10140114.
494 * VRR0 (Vector Read Register 0) at 0x16000050.
495 * VRR1 (Vector Read Register 1) at 0x16000054.
496 * VRR2 (Vector Read Register 2) at 0x16000058.
497 * VRR3 (Vector Read Register 3) at 0x1600005c.
498 */
499 /* ln (ethernet) at 0x10084x00 ? and 0x10120000 ? */
500 /* error registers (?) at 0x17000000 and 0x10080000 */
501 /* device_add(machine, "kn210 addr=0x10080000"); */
502 dev_ssc_init(machine, mem, 0x10140000, "irq? TODO",
503 machine->x11_md.in_use);
504 break;
505
506 case MACHINE_DEC_MAXINE_5000: /* type 7, KN02CA */
507 machine->machine_name = "Personal DECstation 5000/xxx "
508 "(MAXINE) (KN02CA)";
509 if (machine->emulated_hz == 0)
510 machine->emulated_hz = 33000000;
511
512 if (machine->physical_ram_in_mb < 8)
513 fprintf(stderr, "WARNING! Real KN02CA machines do not "
514 "have less than 8MB RAM. Continuing anyway.\n");
515 if (machine->physical_ram_in_mb > 40)
516 fprintf(stderr, "WARNING! Real KN02CA machines cannot "
517 "have more than 40MB RAM. Continuing anyway.\n");
518
519 /* Maxine interrupts: */
520 fatal("TODO: Legacy rewrite\n");
521 abort();
522
523 // machine->md_interrupt = maxine_interrupt;
524
525 /*
526 * Something at address 0xca00000. (?)
527 * Something at address 0xe000000. (?)
528 * tc0 slot 0 (0x10000000)
529 * tc0 slot 1 (0x14000000)
530 * (tc0 slot 2 used by the framebuffer)
531 * ioasic0 at tc0 slot 3 offset 0x0 (0x1c000000)
532 * le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00
533 * (0x1c0c0000)
534 * scc0 at ioasic0 offset 0x100000: console <-- serial
535 * (0x1c100000)
536 * mcclock0 at ioasic0 offset 0x200000: mc146818 (0x1c200000)
537 * isdn at ioasic0 offset 0x240000 not configured (0x1c240000)
538 * bba0 at ioasic0 offset 0x240000 (audio0 at bba0)
539 * ^--- which one of isdn and bba0?
540 * dtop0 at ioasic0 offset 0x280000 (0x1c280000)
541 * fdc at ioasic0 offset 0x2c0000 not configured
542 * ^-- floppy (0x1c2c0000)
543 * asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI
544 * ID 7 (0x1c300000)
545 * xcfb0 at tc0 slot 2 offset 0x0: 1024x768x8
546 * built-in framebuffer (0xa000000)
547 */
548 fatal("TODO: dec_ioasic legacy rewrite\n");
549 abort();
550 // machine->md_int.dec_ioasic_data =
551 // dev_dec_ioasic_init(cpu, mem, 0x1c000000, 0);
552
553 fatal("TODO: turbochannel rewrite!\n");
554 abort();
555 #if 0
556 /* TURBOchannel slots (0 and 1): */
557 dev_turbochannel_init(machine, mem, 0,
558 0x10000000, 0x103fffff,
559 machine->n_gfx_cards >= 2?
560 turbochannel_default_gfx_card : "",
561 XINE_INTR_TC_0 +8);
562 dev_turbochannel_init(machine, mem, 1,
563 0x14000000, 0x143fffff,
564 machine->n_gfx_cards >= 3?
565 turbochannel_default_gfx_card : "",
566 XINE_INTR_TC_1 +8);
567
568 /*
569 * TURBOchannel slot 2 is hardwired to be used by
570 * the framebuffer: (NOTE: 0x8000000, not 0x18000000)
571 */
572 dev_turbochannel_init(machine, mem, 2,
573 0x8000000, 0xbffffff, "PMAG-DV", 0);
574 #endif
575 /*
576 * TURBOchannel slot 3: fixed, ioasic
577 * (the system stuff), 0x1c000000
578 */
579 fatal("TODO: xine dev_le_init rewrite\n");
580 abort();
581 // dev_le_init(machine, mem, 0x1c0c0000, 0, 0,
582 // XINE_INTR_LANCE +8, 4*65536);
583 dev_scc_init(machine, mem, 0x1c100000,
584 XINE_INTR_SCC_0 +8, machine->x11_md.in_use, 0, 1);
585 fatal("TODO: mc146818 irq\n");
586 abort();
587 // dev_mc146818_init(machine, mem, 0x1c200000,
588 // XINE_INT_TOY, MC146818_DEC, 1);
589 fatal("TODO: xine asc init rewrite\n");
590 abort();
591 // dev_asc_init(machine, mem, 0x1c300000,
592 // XINE_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL);
593
594 framebuffer_console_name = "osconsole=3,2"; /* keyb,fb? */
595 serial_console_name = "osconsole=3";
596 break;
597
598 case MACHINE_DEC_5500: /* type 11, KN220 */
599 machine->machine_name = "DECsystem 5500 (KN220)";
600
601 /*
602 * According to NetBSD's pmax ports page:
603 * KN220-AA is a "30 MHz R3000 CPU with R3010 FPU"
604 * with "512 kBytes of Prestoserve battery backed RAM."
605 */
606 if (machine->emulated_hz == 0)
607 machine->emulated_hz = 30000000;
608
609 /*
610 * See KN220 docs for more info.
611 *
612 * something at 0x10000000
613 * something at 0x10001000
614 * something at 0x10040000
615 * scc at 0x10140000
616 * qbus at (or around) 0x10080000
617 * dssi (disk controller) buffers at 0x10100000,
618 * registers at 0x10160000.
619 * sgec (ethernet) registers at 0x10008000, station
620 * addresss at 0x10120000.
621 * asc (scsi) at 0x17100000.
622 */
623
624 dev_ssc_init(machine, mem, 0x10140000, "TODO: irq",
625 machine->x11_md.in_use);
626
627 /* something at 0x17000000, ultrix says "cpu 0 panic: "
628 "DS5500 I/O Board is missing" if this is not here */
629 dev_dec5500_ioboard_init(cpu, mem, 0x17000000);
630
631 dev_sgec_init(mem, 0x10008000, 0); /* irq? */
632
633 /* The asc controller might be TURBOchannel-ish? */
634 #if 0
635 dev_turbochannel_init(machine, mem, 0, 0x17100000,
636 0x171fffff, "PMAZ-AA", 0); /* irq? */
637 #else
638 dev_asc_init(machine, mem, 0x17100000, 0, NULL,
639 DEV_ASC_DEC, NULL, NULL); /* irq? */
640 #endif
641
642 framebuffer_console_name = "osconsole=0,0"; /* TODO (?) */
643 serial_console_name = "osconsole=0";
644 break;
645
646 case MACHINE_DEC_MIPSMATE_5100: /* type 12 */
647 machine->machine_name = "DEC MIPSMATE 5100 (KN230)";
648
649 if (machine->emulated_hz == 0)
650 machine->emulated_hz = 20000000;
651
652 if (machine->physical_ram_in_mb > 128)
653 fprintf(stderr, "WARNING! Real MIPSMATE 5100 machines "
654 "cannot have more than 128MB RAM. Continuing"
655 " anyway.\n");
656
657 if (machine->x11_md.in_use)
658 fprintf(stderr, "WARNING! Real MIPSMATE 5100 machines "
659 "cannot have a graphical framebuffer. "
660 "Continuing anyway.\n");
661
662 /* KN230 mainbus / interrupt controller: */
663 snprintf(tmpstr, sizeof(tmpstr),
664 "kn230 addr=0x%"PRIx64, (uint64_t) KN230_SYS_ICSR);
665 device_add(machine, tmpstr);
666
667 /*
668 * According to NetBSD/pmax:
669 * dc0 at ibus0 addr 0x1c000000
670 * le0 at ibus0 addr 0x18000000: address 00:00:00:00:00:00
671 * sii0 at ibus0 addr 0x1a000000
672 */
673
674 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i",
675 machine->path, machine->bootstrap_cpu, 4);
676 dev_mc146818_init(machine, mem, KN230_SYS_CLOCK, tmpstr,
677 MC146818_DEC, 1);
678
679 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x",
680 machine->path, machine->bootstrap_cpu, KN230_CSR_INTR_DZ0);
681 dev_dc7085_init(machine, mem, KN230_SYS_DZ0,
682 tmpstr, machine->x11_md.in_use);
683
684 /* dev_dc7085_init(machine, mem, KN230_SYS_DZ1,
685 KN230_CSR_INTR_OPT0, machine->x11_md.in_use); */
686 /* dev_dc7085_init(machine, mem, KN230_SYS_DZ2,
687 KN230_CSR_INTR_OPT1, machine->x11_md.in_use); */
688
689 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x",
690 machine->path, machine->bootstrap_cpu,
691 KN230_CSR_INTR_LANCE);
692 dev_le_init(machine, mem, KN230_SYS_LANCE,
693 KN230_SYS_LANCE_B_START, KN230_SYS_LANCE_B_END,
694 tmpstr, 4*1048576);
695
696 snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x",
697 machine->path, machine->bootstrap_cpu, KN230_CSR_INTR_SII);
698 dev_sii_init(machine, mem, KN230_SYS_SII,
699 KN230_SYS_SII_B_START, KN230_SYS_SII_B_END, tmpstr);
700
701 serial_console_name = "osconsole=0";
702 break;
703
704 default:fatal("Unknown DEC machine type: %i\n",
705 machine->machine_subtype);
706 exit(1);
707 }
708
709 /*
710 * Most OSes on DECstation use physical addresses below
711 * 0x20000000, but both OSF/1 and Sprite use 0xbe...... as if
712 * it was 0x1e......, so we need this hack:
713 */
714 dev_ram_init(machine, 0xa0000000, 0x20000000,
715 DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0);
716
717 if (!machine->prom_emulation)
718 return;
719
720
721 /* DECstation PROM stuff: (TODO: endianness) */
722 for (i=0; i<150; i++)
723 store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4,
724 DEC_PROM_EMULATION + i*8);
725
726 /* Fill PROM with special "magic trap" instructions: */
727 for (i=0; i<150; i++) {
728 store_32bit_word(cpu, DEC_PROM_EMULATION + i*8,
729 0x00c0de0c); /* trap instruction */
730 store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4,
731 0x00000000); /* nop */
732 }
733
734 /* Jumptable at beginning of PROM: also "magic trap" instructions: */
735 for (i=0; i<0x180; i+=8) {
736 store_32bit_word(cpu, 0xbfc00000 + i,
737 0x00c0de0c); /* trap instruction */
738 store_32bit_word(cpu, 0xbfc00000 + i + 4,
739 0x00000000); /* nop */
740 }
741
742
743 /*
744 * According to dec_prom.h from NetBSD:
745 *
746 * "Programs loaded by the new PROMs pass the following arguments:
747 * a0 argc
748 * a1 argv
749 * a2 DEC_PROM_MAGIC
750 * a3 The callback vector defined below"
751 *
752 * So we try to emulate a PROM, even though no such thing has been
753 * loaded.
754 */
755
756 cpu->cd.mips.gpr[MIPS_GPR_A0] = 3;
757 cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV;
758 cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC;
759 cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT;
760
761 store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, BOOTINFO_MAGIC);
762 store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, BOOTINFO_ADDR);
763
764 store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV,
765 (DEC_PROM_INITIAL_ARGV + 0x10));
766 store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4,
767 (DEC_PROM_INITIAL_ARGV + 0x70));
768 store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8,
769 (DEC_PROM_INITIAL_ARGV + 0xe0));
770 store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0);
771
772 /*
773 * NetBSD and Ultrix expect the boot args to be like this:
774 *
775 * "boot" "bootdev" [args?]
776 *
777 * where bootdev is supposed to be "rz(0,0,0)netbsd" for
778 * 3100/2100 (although that crashes Ultrix :-/), and
779 * "5/rz0a/netbsd" for all others. The number '5' is the
780 * slot number of the boot device.
781 *
782 * 'rz' for disks, 'tz' for tapes.
783 *
784 * TODO: Make this nicer.
785 */
786 {
787 char bootpath[200];
788 #if 0
789 if (machine->machine_subtype == MACHINE_DEC_PMAX_3100)
790 strlcpy(bootpath, "rz(0,0,0)", sizeof(bootpath));
791 else
792 #endif
793 strlcpy(bootpath, "5/rz1/", sizeof(bootpath));
794
795 if (machine->bootdev_id < 0 || machine->force_netboot) {
796 /* tftp boot: */
797 strlcpy(bootpath, "5/tftp/", sizeof(bootpath));
798 bootpath[0] = '0' + boot_net_boardnumber;
799 } else {
800 /* disk boot: */
801 bootpath[0] = '0' + boot_scsi_boardnumber;
802 if (diskimage_is_a_tape(machine, machine->bootdev_id,
803 machine->bootdev_type))
804 bootpath[2] = 't';
805 bootpath[4] = '0' + machine->bootdev_id;
806 }
807
808 init_bootpath = bootpath;
809 }
810
811 CHECK_ALLOCATION(machine->bootarg = malloc(BOOTARG_BUFLEN));
812 strlcpy(machine->bootarg, init_bootpath, BOOTARG_BUFLEN);
813 if (strlcat(machine->bootarg, machine->boot_kernel_filename,
814 BOOTARG_BUFLEN) > BOOTARG_BUFLEN) {
815 fprintf(stderr, "bootarg truncated?\n");
816 exit(1);
817 }
818
819 machine->bootstr = "boot";
820
821 store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, machine->bootstr);
822 store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, machine->bootarg);
823 store_string(cpu, DEC_PROM_INITIAL_ARGV+0xe0,
824 machine->boot_string_argument);
825
826 /* Decrease the nr of args, if there are no args :-) */
827 if (machine->boot_string_argument == NULL ||
828 machine->boot_string_argument[0] == '\0')
829 cpu->cd.mips.gpr[MIPS_GPR_A0] --;
830
831 if (machine->boot_string_argument[0] != '\0') {
832 strlcat(machine->bootarg, " ", BOOTARG_BUFLEN);
833 if (strlcat(machine->bootarg, machine->boot_string_argument,
834 BOOTARG_BUFLEN) >= BOOTARG_BUFLEN) {
835 fprintf(stderr, "bootstr truncated?\n");
836 exit(1);
837 }
838 }
839
840 xx.a.common.next = (char *)&xx.b - (char *)&xx;
841 xx.a.common.type = BTINFO_MAGIC;
842 xx.a.magic = BOOTINFO_MAGIC;
843
844 xx.b.common.next = (char *)&xx.c - (char *)&xx.b;
845 xx.b.common.type = BTINFO_BOOTPATH;
846 strlcpy(xx.b.bootpath, machine->bootstr, sizeof(xx.b.bootpath));
847
848 xx.c.common.next = 0;
849 xx.c.common.type = BTINFO_SYMTAB;
850 xx.c.nsym = 0;
851 xx.c.ssym = 0;
852 xx.c.esym = machine->file_loaded_end_addr;
853
854 store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx));
855
856 CHECK_ALLOCATION(machine->md.pmax =
857 malloc(sizeof(struct machine_pmax)));
858 memset(machine->md.pmax, 0, sizeof(struct machine_pmax));
859
860 /* The system's memmap: */
861 CHECK_ALLOCATION(machine->md.pmax->memmap =
862 malloc(sizeof(struct dec_memmap)));
863 store_32bit_word_in_host(cpu,
864 (unsigned char *)&machine->md.pmax->memmap->pagesize, 4096);
865 {
866 unsigned int i;
867 for (i=0; i<sizeof(machine->md.pmax->memmap->bitmap); i++)
868 machine->md.pmax->memmap->bitmap[i] = ((int)i * 4096*8 <
869 1048576*machine->physical_ram_in_mb)? 0xff : 0x00;
870 }
871 store_buf(cpu, DEC_MEMMAP_ADDR,
872 (char *)machine->md.pmax->memmap, sizeof(struct dec_memmap));
873
874 /* Environment variables: */
875 addr = DEC_PROM_STRINGS;
876
877 if (machine->x11_md.in_use && machine->n_gfx_cards > 0)
878 /* (0,3) Keyboard and Framebuffer */
879 add_environment_string(cpu, framebuffer_console_name, &addr);
880 else
881 /* Serial console */
882 add_environment_string(cpu, serial_console_name, &addr);
883
884 /*
885 * The KN5800 (SMP system) uses a CCA (console communications
886 * area): (See VAX 6000 documentation for details.)
887 */
888 {
889 char tmps[300];
890 snprintf(tmps, sizeof(tmps), "cca=%"PRIx32,
891 (uint32_t) (DEC_DECCCA_BASEADDR + 0xa0000000ULL));
892 add_environment_string(cpu, tmps, &addr);
893 }
894
895 /* These are needed for Sprite to boot: */
896 {
897 char tmps[500];
898
899 snprintf(tmps, sizeof(tmps), "boot=%s", machine->bootarg);
900 tmps[sizeof(tmps)-1] = '\0';
901 add_environment_string(cpu, tmps, &addr);
902
903 snprintf(tmps, sizeof(tmps), "bitmap=0x%"PRIx32, (uint32_t)
904 ( (DEC_MEMMAP_ADDR + sizeof(uint32_t) /* skip the
905 page size and point to the memmap */
906 ) & 0xffffffffULL) );
907 tmps[sizeof(tmps)-1] = '\0';
908 add_environment_string(cpu, tmps, &addr);
909
910 snprintf(tmps, sizeof(tmps), "bitmaplen=0x%"PRIx32, (uint32_t)
911 ( machine->physical_ram_in_mb * 1048576 / 4096 / 8) );
912 tmps[sizeof(tmps)-1] = '\0';
913 add_environment_string(cpu, tmps, &addr);
914 }
915
916 add_environment_string(cpu, "scsiid0=7", &addr);
917 add_environment_string(cpu, "bootmode=a", &addr);
918 add_environment_string(cpu, "testaction=q", &addr);
919 add_environment_string(cpu, "haltaction=h", &addr);
920 add_environment_string(cpu, "more=24", &addr);
921
922 /* Used in at least Ultrix on the 5100: */
923 add_environment_string(cpu, "scsiid=7", &addr);
924 add_environment_string(cpu, "baud0=9600", &addr);
925 add_environment_string(cpu, "baud1=9600", &addr);
926 add_environment_string(cpu, "baud2=9600", &addr);
927 add_environment_string(cpu, "baud3=9600", &addr);
928 add_environment_string(cpu, "iooption=0x1", &addr);
929
930 /* The end: */
931 add_environment_string(cpu, "", &addr);
932 }
933
934
935 MACHINE_DEFAULT_CPU(pmax)
936 {
937 if (machine->machine_subtype > 2)
938 CHECK_ALLOCATION(machine->cpu_name = strdup("R3000A"));
939
940 if (machine->machine_subtype > 1 && machine->cpu_name == NULL)
941 CHECK_ALLOCATION(machine->cpu_name = strdup("R3000"));
942
943 if (machine->cpu_name == NULL)
944 CHECK_ALLOCATION(machine->cpu_name = strdup("R2000"));
945 }
946
947
948 MACHINE_DEFAULT_RAM(pmax)
949 {
950 switch (machine->machine_subtype) {
951 case MACHINE_DEC_PMAX_3100:
952 machine->physical_ram_in_mb = 24;
953 break;
954 case MACHINE_DEC_3MAX_5000:
955 machine->physical_ram_in_mb = 64;
956 break;
957 default:machine->physical_ram_in_mb = 32;
958 }
959 }
960
961
962 MACHINE_REGISTER(pmax)
963 {
964 MR_DEFAULT(pmax, "DECstation/DECsystem", ARCH_MIPS, MACHINE_PMAX);
965
966 machine_entry_add_alias(me, "decstation");
967 machine_entry_add_alias(me, "decsystem");
968 machine_entry_add_alias(me, "dec");
969
970 machine_entry_add_subtype(me, "DECstation 3100 (PMAX)",
971 MACHINE_DEC_PMAX_3100, "pmax", "3100", "2100", NULL);
972
973 machine_entry_add_subtype(me, "DECstation 5000/200 (3MAX)",
974 MACHINE_DEC_3MAX_5000, "3max", "5000/200", NULL);
975
976 machine_entry_add_subtype(me, "DECstation 5000/1xx (3MIN)",
977 MACHINE_DEC_3MIN_5000, "3min", "5000/1xx", NULL);
978
979 machine_entry_add_subtype(me, "DECstation 5000 (3MAXPLUS)",
980 MACHINE_DEC_3MAXPLUS_5000, "3maxplus", "3max+", NULL);
981
982 machine_entry_add_subtype(me, "DECsystem 58x0",
983 MACHINE_DEC_5800, "5800", "58x0", NULL);
984
985 machine_entry_add_subtype(me, "DECsystem 5400",
986 MACHINE_DEC_5400, "5400", NULL);
987
988 machine_entry_add_subtype(me, "DECstation Maxine (5000)",
989 MACHINE_DEC_MAXINE_5000, "maxine", NULL);
990
991 machine_entry_add_subtype(me, "DECsystem 5500",
992 MACHINE_DEC_5500, "5500", NULL);
993
994 machine_entry_add_subtype(me, "DECstation MipsMate (5100)",
995 MACHINE_DEC_MIPSMATE_5100, "5100", "mipsmate", NULL);
996
997 me->set_default_ram = machine_default_ram_pmax;
998 }
999

  ViewVC Help
Powered by ViewVC 1.1.26