/[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 24 - (show annotations)
Mon Oct 8 16:19:56 2007 UTC (16 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 31009 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1256 2006/06/23 20:43:44 debug Exp $
20060219	Various minor updates. Removing the old MIPS16 skeleton code,
		because it will need to be rewritten for dyntrans anyway.
20060220-22	Removing the non-working dyntrans backend support.
		Continuing on the 64-bit dyntrans virtual memory generalization.
20060223	More work on the 64-bit vm generalization.
20060225	Beginning on MIPS dyntrans load/store instructions.
		Minor PPC updates (64-bit load/store, etc).
		Fixes for the variable-instruction-length framework, some
		minor AVR updates (a simple Hello World program works!).
		Beginning on a skeleton for automatically generating documen-
		tation (for devices etc.).
20060226	PPC updates (adding some more 64-bit instructions, etc).
		AVR updates (more instructions).
		FINALLY found and fixed the zs bug, making NetBSD/macppc
		accept the serial console.
20060301	Adding more AVR instructions.
20060304	Continuing on AVR-related stuff. Beginning on a framework for
		cycle-accurate device emulation. Adding an experimental "PAL
		TV" device (just a dummy so far).
20060305	Adding more AVR instructions.
		Adding a dummy epcom serial controller (for TS7200 emulation).
20060310	Removing the emul() command from configuration files, so only
		net() and machine() are supported.
		Minor progress on the MIPS dyntrans rewrite.
20060311	Continuing on the MIPS dyntrans rewrite (adding more
		instructions, etc).
20060315	Adding more instructions (sllv, srav, srlv, bgtz[l], blez[l],
		beql, bnel, slti[u], various loads and stores).
20060316	Removing the ALWAYS_SIGNEXTEND_32 option, since it was rarely
		used.
		Adding more MIPS dyntrans instructions, and fixing bugs.
20060318	Implementing fast loads/stores for MIPS dyntrans (big/little
		endian, 32-bit and 64-bit modes).
20060320	Making MIPS dyntrans the default configure option; use
		"--enable-oldmips" to use the old bintrans system.
		Adding MIPS dyntrans dmult[u]; minor updates.
20060322	Continuing... adding some more instructions.
		Adding a simple skeleton for demangling C++ "_ZN" symbols.
20060323	Moving src/debugger.c into a new directory (src/debugger/).
20060324	Fixing the hack used to load PPC ELFs (useful for relocated
		Linux/ppc kernels), and adding a dummy G3 machine mode.
20060325-26	Beginning to experiment with GDB remote serial protocol
		connections; adding a -G command line option for selecting
		which TCP port to listen to.
20060330	Beginning a major cleanup to replace things like "0x%016llx"
		with more correct "0x%016"PRIx64, etc.
		Continuing on the GDB remote serial protocol support.
20060331	More cleanup, and some minor GDB remote progress.
20060402	Adding a hack to the configure script, to allow compilation
		on systems that lack PRIx64 etc.
20060406	Removing the temporary FreeBSD/arm hack in dev_ns16550.c and
		replacing it with a better fix from Olivier Houchard.
20060407	A remote debugger (gdb or ddd) can now start and stop the
		emulator using the GDB remote serial protocol, and registers
		and memory can be read. MIPS only for now.
20060408	More GDB progress: single-stepping also works, and also adding
		support for ARM, PowerPC, and Alpha targets.
		Continuing on the delay-slot-across-page-boundary issue.
20060412	Minor update: beginning to add support for the SPARC target
		to the remote GDB functionality.
20060414	Various MIPS updates: adding more instructions for dyntrans
		(eret, add), and making some exceptions work. Fixing a bug
		in dmult[u].
		Implementing the first SPARC instructions (sethi, or).
20060415	Adding "magic trap" instructions so that PROM calls can be
		software emulated in MIPS dyntrans.
		Adding more MIPS dyntrans instructions (ddiv, dadd) and
		fixing another bug in dmult.
20060416	More MIPS dyntrans progress: adding [d]addi, movn, movz, dsllv,
		rfi, an ugly hack for supporting R2000/R3000 style faked caches,
		preliminary interrupt support, and various other updates and
		bugfixes.
20060417	Adding more SPARC instructions (add, sub, sll[x], sra[x],
		srl[x]), and useful SPARC header definitions.
		Adding the first (trivial) x86/AMD64 dyntrans instructions (nop,
		cli/sti, stc/clc, std/cld, simple mov, inc ax). Various other
		x86 updates related to variable instruction length stuff.
		Adding unaligned loads/stores to the MIPS dyntrans mode (but
		still using the pre-dyntrans (slow) imlementation).
20060419	Fixing a MIPS dyntrans exception-in-delay-slot bug.
		Removing the old "show opcode statistics" functionality, since
		it wasn't really useful and isn't implemented for dyntrans.
		Single-stepping (or running with instruction trace) now looks
		ok with dyntrans with delay-slot architectures.
20060420	Minor hacks (removing the -B command line option when compiled
		for non-bintrans, and some other very minor updates).
		Adding (slow) MIPS dyntrans load-linked/store-conditional.
20060422	Applying fixes for bugs discovered by Nils Weller's nwcc
		(static DEC memmap => now per machine, and adding an extern
		keyword in cpu_arm_instr.c).
		Finally found one of the MIPS dyntrans bugs that I've been
		looking for (copy/paste spelling error BIG vs LITTLE endian in
		cpu_mips_instr_loadstore.c for 16-bit fast stores).
		FINALLY found the major MIPS dyntrans bug: slti vs sltiu
		signed/unsigned code in cpu_mips_instr.c. :-)
		Adding more MIPS dyntrans instructions (lwc1, swc1, bgezal[l],
		ctc1, tlt[u], tge[u], tne, beginning on rdhwr).
		NetBSD/hpcmips can now reach userland when using dyntrans :-)
		Adding some more x86 dyntrans instructions.
		Finally removed the old Alpha-specific virtual memory code,
		and replaced it with the generic 64-bit version.
		Beginning to add disassembly support for SPECIAL3 MIPS opcodes.
20060423	Continuing on the delay-slot-across-page-boundary issue;
		adding an end_of_page2 ic slot (like I had planned before, but
		had removed for some reason).
		Adding a quick-and-dirty fallback to legacy coprocessor 1
		code (i.e. skipping dyntrans implementation for now).
		NetBSD/hpcmips and NetBSD/pmax (when running on an emulated
		R4400) can now be installed and run. :-)  (Many bugs left
		to fix, though.)
		Adding more MIPS dyntrans instructions: madd[u], msub[u].
		Cleaning up the SPECIAL2 vs R5900/TX79/C790 "MMI" opcode
		maps somewhat (disassembly and dyntrans instruction decoding).
20060424	Adding an isa_revision field to mips_cpu_types.h, and making
		sure that SPECIAL3 opcodes cause Reserved Instruction
		exceptions on MIPS32/64 revisions lower than 2.
		Adding the SPARC 'ba', 'call', 'jmpl/retl', 'and', and 'xor'
		instructions.
20060425	Removing the -m command line option ("run at most x 
		instructions") and -T ("single_step_on_bad_addr"), because
		they never worked correctly with dyntrans anyway.
		Freshening up the man page.
20060428	Adding more MIPS dyntrans instructions: bltzal[l], idle.
		Enabling MIPS dyntrans compare interrupts.
20060429	FINALLY found the weird dyntrans bug, causing NetBSD etc. to
		behave strangely: some floating point code (conditional
		coprocessor branches) could not be reused from the old
		non-dyntrans code. The "quick-and-dirty fallback" only appeared
		to work. Fixing by implementing bc1* for MIPS dyntrans.
		More MIPS instructions: [d]sub, sdc1, ldc1, dmtc1, dmfc1, cfc0.
		Freshening up MIPS floating point disassembly appearance.
20060430	Continuing on C790/R5900/TX79 disassembly; implementing 128-bit
		"por" and "pextlw".
20060504	Disabling -u (userland emulation) unless compiled as unstable
		development version.
		Beginning on freshening up the testmachine include files,
		to make it easier to reuse those files (placing them in
		src/include/testmachine/), and beginning on a set of "demos"
		or "tutorials" for the testmachine functionality.
		Minor updates to the MIPS GDB remote protocol stub.
		Refreshing doc/experiments.html and gdb_remote.html.
		Enabling Alpha emulation in the stable release configuration,
		even though no guest OSes for Alpha can run yet.
20060505	Adding a generic 'settings' object, which will contain
		references to settable variables (which will later be possible
		to access using the debugger).
20060506	Updating dev_disk and corresponding demo/documentation (and
		switching from SCSI to IDE disk types, so it actually works
		with current test machines :-).
20060510	Adding a -D_LARGEFILE_SOURCE hack for 64-bit Linux hosts,
		so that fseeko() doesn't give a warning.
		Updating the section about how dyntrans works (the "runnable
		IR") in doc/intro.html.
		Instruction updates (some x64=1 checks, some more R5900
		dyntrans stuff: better mul/mult separation from MIPS32/64,
		adding ei and di).
		Updating MIPS cpuregs.h to a newer one (from NetBSD).
		Adding more MIPS dyntrans instructions: deret, ehb.
20060514	Adding disassembly and beginning implementation of SPARC wr
		and wrpr instructions.
20060515	Adding a SUN SPARC machine mode, with dummy SS20 and Ultra1
		machines. Adding the 32-bit "rd psr" instruction.
20060517	Disassembly support for the general SPARC rd instruction.
		Partial implementation of the cmp (subcc) instruction.
		Some other minor updates (making sure that R5900 processors
		start up with the EIE bit enabled, otherwise Linux/playstation2
		receives no interrupts).
20060519	Minor MIPS updates/cleanups.
20060521	Moving the MeshCube machine into evbmips; this seems to work
		reasonably well with a snapshot of a NetBSD MeshCube kernel.
		Cleanup/fix of MIPS config0 register initialization.
20060529	Minor MIPS fixes, including a sign-extension fix to the
		unaligned load/store code, which makes NetBSD/pmax on R3000
		work better with dyntrans. (Ultrix and Linux/DECstation still
		don't work, though.)
20060530	Minor updates to the Alpha machine mode: adding an AlphaBook
		mode, an LCA bus (forwarding accesses to an ISA bus), etc.
20060531	Applying a bugfix for the MIPS dyntrans sc[d] instruction from
		Ondrej Palkovsky. (Many thanks.)
20060601	Minifix to allow ARM immediate msr instruction to not give
		an error for some valid values.
		More Alpha updates.
20060602	Some minor Alpha updates.
20060603	Adding the Alpha cmpbge instruction. NetBSD/alpha prints its
		first boot messages :-) on an emulated Alphabook 1.
20060612	Minor updates; adding a dev_ether.h include file for the
		testmachine ether device. Continuing the hunt for the dyntrans
		bug which makes Linux and Ultrix on DECstation behave
		strangely... FINALLY found it! It seems to be related to
		invalidation of the translation cache, on tlbw{r,i}. There
		also seems to be some remaining interrupt-related problems.
20060614	Correcting the implementation of ldc1/sdc1 for MIPS dyntrans
		(so that it uses 16 32-bit registers if the FR bit in the
		status register is not set).
20060616	REMOVING BINTRANS COMPLETELY!
		Removing the old MIPS interpretation mode.
		Removing the MFHILO_DELAY and instruction delay stuff, because
		they wouldn't work with dyntrans anyway.
20060617	Some documentation updates (adding "NetBSD-archive" to some
		URLs, and new Debian/DECstation installation screenshots).
		Removing the "tracenull" and "enable-caches" configure options.
		Improving MIPS dyntrans performance somewhat (only invalidate
		translations if necessary, on writes to the entryhi register,
		instead of doing it for all cop0 writes).
20060618	More cleanup after the removal of the old MIPS emulation.
		Trying to fix the MIPS dyntrans performance bugs/bottlenecks;
		only semi-successful so far (for R3000).
20060620	Minor update to allow clean compilation again on Tru64/Alpha.
20060622	MIPS cleanup and fixes (removing the pc_last stuff, which
		doesn't make sense with dyntrans anyway, and fixing a cross-
		page-delay-slot-with-exception case in end_of_page).
		Removing the old max_random_cycles_per_chunk stuff, and the
		concept of cycles vs instructions for MIPS emulation.
		FINALLY found and fixed the bug which caused NetBSD/pmax
		clocks to behave strangely (it was a load to the zero register,
		which was treated as a NOP; now it is treated as a load to a
		dummy scratch register).
20060623	Increasing the dyntrans chunk size back to
		N_SAFE_DYNTRANS_LIMIT, instead of N_SAFE_DYNTRANS_LIMIT/2.
		Preparing for a quick release, even though there are known
		bugs, and performance for non-R3000 MIPS emulation is very
		poor. :-/
		Reverting to half the dyntrans chunk size again, because
		NetBSD/cats seemed less stable with full size chunks. :(
		NetBSD/sgimips 3.0 can now run :-)  (With release 0.3.8, only
		NetBSD/sgimips 2.1 worked, not 3.0.)

==============  RELEASE 0.4.0  ==============


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

  ViewVC Help
Powered by ViewVC 1.1.26