/[gxemul]/trunk/src/machines/machine_hpcmips.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_hpcmips.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: 15807 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_hpcmips.c,v 1.9 2007/06/15 18:08:10 debug Exp $
29 *
30 * COMMENT: Handheld MIPS-based 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 "machine.h"
41 #include "memory.h"
42 #include "misc.h"
43
44 #include "hpc_bootinfo.h"
45 #include "vripreg.h"
46
47
48 MACHINE_SETUP(hpcmips)
49 {
50 char tmpstr[1000];
51 struct hpc_bootinfo hpc_bootinfo;
52 int hpc_platid_flags = 0, hpc_platid_cpu_submodel = 0,
53 hpc_platid_cpu_model = 0, hpc_platid_cpu_series = 0,
54 hpc_platid_cpu_arch = 0,
55 hpc_platid_submodel = 0, hpc_platid_model = 0,
56 hpc_platid_series = 0, hpc_platid_vendor = 0;
57 uint64_t hpc_fb_addr = 0;
58 int hpc_fb_bits = 0, hpc_fb_encoding = 0;
59 int hpc_fb_xsize = 0;
60 int hpc_fb_ysize = 0;
61 int hpc_fb_xsize_mem = 0;
62 int hpc_fb_ysize_mem = 0;
63
64 cpu->byte_order = EMUL_LITTLE_ENDIAN;
65 memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo));
66
67 /*
68 * NOTE: See http://forums.projectmayo.com/viewtopic.php?topic=2743&
69 * forum=23 for info on framebuffer addresses.
70 */
71
72 switch (machine->machine_subtype) {
73
74 case MACHINE_HPCMIPS_CASIO_BE300:
75 /* 166MHz VR4131 */
76 machine->machine_name = "Casio Cassiopeia BE-300";
77 hpc_fb_addr = 0x0a200000;
78 hpc_fb_xsize = 240;
79 hpc_fb_ysize = 320;
80 hpc_fb_xsize_mem = 256;
81 hpc_fb_ysize_mem = 320;
82 hpc_fb_bits = 15;
83 hpc_fb_encoding = BIFB_D16_0000;
84
85 /* TODO: irq? */
86 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x"
87 "0a008680 addr_mult=4 in_use=%i", !machine->x11_md.in_use);
88 machine->main_console_handle = (size_t)
89 device_add(machine, tmpstr);
90
91 dev_vr41xx_init(machine, machine->memory, 4131);
92
93 hpc_platid_cpu_arch = 1; /* MIPS */
94 hpc_platid_cpu_series = 1; /* VR */
95 hpc_platid_cpu_model = 1; /* VR41XX */
96 hpc_platid_cpu_submodel = 6; /* VR4131 */
97 hpc_platid_vendor = 3; /* Casio */
98 hpc_platid_series = 1; /* CASSIOPEIAE */
99 hpc_platid_model = 2; /* EXXX */
100 hpc_platid_submodel = 3; /* E500 */
101 /* TODO: Don't use model number for E500, it's a BE300! */
102 break;
103
104 case MACHINE_HPCMIPS_CASIO_E105:
105 /* 131MHz VR4121 */
106 machine->machine_name = "Casio Cassiopeia E-105";
107 hpc_fb_addr = 0x0a200000; /* TODO? */
108 hpc_fb_xsize = 240;
109 hpc_fb_ysize = 320;
110 hpc_fb_xsize_mem = 256;
111 hpc_fb_ysize_mem = 320;
112 hpc_fb_bits = 16;
113 hpc_fb_encoding = BIFB_D16_0000;
114
115 /* TODO: irq? */
116 snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x"
117 "0a008680 addr_mult=4 in_use=%i", !machine->x11_md.in_use);
118 machine->main_console_handle = (size_t)
119 device_add(machine, tmpstr);
120
121 dev_vr41xx_init(machine, machine->memory, 4121);
122
123 hpc_platid_cpu_arch = 1; /* MIPS */
124 hpc_platid_cpu_series = 1; /* VR */
125 hpc_platid_cpu_model = 1; /* VR41XX */
126 hpc_platid_cpu_submodel = 3; /* VR4121 */
127 hpc_platid_vendor = 3; /* Casio */
128 hpc_platid_series = 1; /* CASSIOPEIAE */
129 hpc_platid_model = 2; /* EXXX */
130 hpc_platid_submodel = 2; /* E105 */
131 break;
132
133 case MACHINE_HPCMIPS_NEC_MOBILEPRO_770:
134 /* 131 MHz VR4121 */
135 machine->machine_name = "NEC MobilePro 770";
136 hpc_fb_addr = 0xa000000;
137 hpc_fb_xsize = 640;
138 hpc_fb_ysize = 240;
139 hpc_fb_xsize_mem = 800;
140 hpc_fb_ysize_mem = 240;
141 hpc_fb_bits = 16;
142 hpc_fb_encoding = BIFB_D16_0000;
143
144 dev_vr41xx_init(machine, machine->memory, 4121);
145
146 hpc_platid_cpu_arch = 1; /* MIPS */
147 hpc_platid_cpu_series = 1; /* VR */
148 hpc_platid_cpu_model = 1; /* VR41XX */
149 hpc_platid_cpu_submodel = 3; /* VR4121 */
150 hpc_platid_vendor = 1; /* NEC */
151 hpc_platid_series = 2; /* NEC MCR */
152 hpc_platid_model = 2; /* MCR 5XX */
153 hpc_platid_submodel = 4; /* MCR 520A */
154 break;
155
156 case MACHINE_HPCMIPS_NEC_MOBILEPRO_780:
157 /* 166 (or 168) MHz VR4121 */
158 machine->machine_name = "NEC MobilePro 780";
159 hpc_fb_addr = 0xa180100;
160 hpc_fb_xsize = 640;
161 hpc_fb_ysize = 240;
162 hpc_fb_xsize_mem = 640;
163 hpc_fb_ysize_mem = 240;
164 hpc_fb_bits = 16;
165 hpc_fb_encoding = BIFB_D16_0000;
166
167 dev_vr41xx_init(machine, machine->memory, 4121);
168
169 hpc_platid_cpu_arch = 1; /* MIPS */
170 hpc_platid_cpu_series = 1; /* VR */
171 hpc_platid_cpu_model = 1; /* VR41XX */
172 hpc_platid_cpu_submodel = 3; /* VR4121 */
173 hpc_platid_vendor = 1; /* NEC */
174 hpc_platid_series = 2; /* NEC MCR */
175 hpc_platid_model = 2; /* MCR 5XX */
176 hpc_platid_submodel = 8; /* MCR 530A */
177 break;
178
179 case MACHINE_HPCMIPS_NEC_MOBILEPRO_800:
180 /* 131 MHz VR4121 */
181 machine->machine_name = "NEC MobilePro 800";
182 hpc_fb_addr = 0xa000000;
183 hpc_fb_xsize = 800;
184 hpc_fb_ysize = 600;
185 hpc_fb_xsize_mem = 800;
186 hpc_fb_ysize_mem = 600;
187 hpc_fb_bits = 16;
188 hpc_fb_encoding = BIFB_D16_0000;
189
190 dev_vr41xx_init(machine, machine->memory, 4121);
191
192 hpc_platid_cpu_arch = 1; /* MIPS */
193 hpc_platid_cpu_series = 1; /* VR */
194 hpc_platid_cpu_model = 1; /* VR41XX */
195 hpc_platid_cpu_submodel = 3; /* VR4121 */
196 hpc_platid_vendor = 1; /* NEC */
197 hpc_platid_series = 2; /* NEC MCR */
198 hpc_platid_model = 3; /* MCR 7XX */
199 hpc_platid_submodel = 2; /* MCR 700A */
200 break;
201
202 case MACHINE_HPCMIPS_NEC_MOBILEPRO_880:
203 /* 168 MHz VR4121 */
204 machine->machine_name = "NEC MobilePro 880";
205 hpc_fb_addr = 0xa0ea600;
206 hpc_fb_xsize = 800;
207 hpc_fb_ysize = 600;
208 hpc_fb_xsize_mem = 800;
209 hpc_fb_ysize_mem = 600;
210 hpc_fb_bits = 16;
211 hpc_fb_encoding = BIFB_D16_0000;
212
213 dev_vr41xx_init(machine, machine->memory, 4121);
214
215 hpc_platid_cpu_arch = 1; /* MIPS */
216 hpc_platid_cpu_series = 1; /* VR */
217 hpc_platid_cpu_model = 1; /* VR41XX */
218 hpc_platid_cpu_submodel = 3; /* VR4121 */
219 hpc_platid_vendor = 1; /* NEC */
220 hpc_platid_series = 2; /* NEC MCR */
221 hpc_platid_model = 3; /* MCR 7XX */
222 hpc_platid_submodel = 4; /* MCR 730A */
223 break;
224
225 case MACHINE_HPCMIPS_AGENDA_VR3:
226 /* 66 MHz VR4181 */
227 machine->machine_name = "Agenda VR3";
228 /* TODO: */
229 hpc_fb_addr = 0x1000;
230 hpc_fb_xsize = 160;
231 hpc_fb_ysize = 240;
232 hpc_fb_xsize_mem = 160;
233 hpc_fb_ysize_mem = 240;
234 hpc_fb_bits = 4;
235 hpc_fb_encoding = BIFB_D4_M2L_F;
236
237 dev_vr41xx_init(machine, machine->memory, 4181);
238
239 /* TODO: Hm... irq 17 according to linux, but
240 VRIP_INTR_SIU (=9) here? */
241 {
242 int x;
243 snprintf(tmpstr, sizeof(tmpstr),
244 "ns16550 irq=%i addr=0x0c000010", 8+VRIP_INTR_SIU);
245 x = (size_t)device_add(machine, tmpstr);
246
247 if (!machine->x11_md.in_use)
248 machine->main_console_handle = x;
249 }
250
251 hpc_platid_cpu_arch = 1; /* MIPS */
252 hpc_platid_cpu_series = 1; /* VR */
253 hpc_platid_cpu_model = 1; /* VR41XX */
254 hpc_platid_cpu_submodel = 4; /* VR4181 */
255 hpc_platid_vendor = 15; /* Agenda */
256 hpc_platid_series = 1; /* VR */
257 hpc_platid_model = 1; /* VR3 */
258 hpc_platid_submodel = 0; /* - */
259
260 dev_ram_init(machine, 0x0f000000, 0x01000000,
261 DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0);
262 break;
263
264 case MACHINE_HPCMIPS_IBM_WORKPAD_Z50:
265 /* 131 MHz VR4121 */
266 machine->machine_name = "IBM Workpad Z50";
267 /* TODO: */
268 hpc_fb_addr = 0xa000000;
269 hpc_fb_xsize = 640;
270 hpc_fb_ysize = 480;
271 hpc_fb_xsize_mem = 640;
272 hpc_fb_ysize_mem = 480;
273 hpc_fb_bits = 16;
274 hpc_fb_encoding = BIFB_D16_0000;
275
276 dev_vr41xx_init(machine, machine->memory, 4121);
277
278 hpc_platid_cpu_arch = 1; /* MIPS */
279 hpc_platid_cpu_series = 1; /* VR */
280 hpc_platid_cpu_model = 1; /* VR41XX */
281 hpc_platid_cpu_submodel = 3; /* VR4121 */
282 hpc_platid_vendor = 9; /* IBM */
283 hpc_platid_series = 1; /* WorkPad */
284 hpc_platid_model = 1; /* Z50 */
285 hpc_platid_submodel = 0; /* 0 */
286 break;
287
288 default:printf("Unimplemented hpcmips machine number.\n");
289 exit(1);
290 }
291
292 store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu,
293 (hpc_platid_cpu_arch << 26) + (hpc_platid_cpu_series << 20)
294 + (hpc_platid_cpu_model << 14) + (hpc_platid_cpu_submodel << 8)
295 + hpc_platid_flags);
296 store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.
297 platid_machine, (hpc_platid_vendor << 22) + (hpc_platid_series<<16)
298 + (hpc_platid_model << 8) + hpc_platid_submodel);
299
300 if (hpc_fb_addr != 0) {
301 dev_fb_init(machine, machine->memory, hpc_fb_addr, VFB_HPC,
302 hpc_fb_xsize, hpc_fb_ysize,
303 hpc_fb_xsize_mem, hpc_fb_ysize_mem,
304 hpc_fb_bits, machine->machine_name);
305
306 /* NetBSD/hpcmips uses framebuffer at physical
307 address 0x8.......: */
308 dev_ram_init(machine, 0x80000000, 0x20000000,
309 DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0);
310 }
311
312 if (!machine->prom_emulation)
313 return;
314
315
316 /* NetBSD/hpcmips and possibly others expects the following: */
317
318 cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */
319 cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576
320 + 0xffffffff80000000ULL - 512; /* argv */
321 cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576
322 + 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */
323
324 machine->bootstr = machine->boot_kernel_filename;
325 store_32bit_word(cpu, 0x80000000ULL + (machine->physical_ram_in_mb <<
326 20) - 512, 0x80000000ULL + (machine->physical_ram_in_mb << 20)
327 - 512 + 16);
328 store_32bit_word(cpu, 0x80000000ULL + (machine->physical_ram_in_mb <<
329 20) - 512 + 4, 0);
330 store_string(cpu, 0x80000000ULL + (machine->physical_ram_in_mb <<
331 20) - 512 + 16, machine->bootstr);
332
333 /* Special case for the Agenda VR3: */
334 if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) {
335 const int tmplen = 1000;
336 char *tmp = malloc(tmplen);
337
338 cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */
339
340 store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb
341 * 1048576-512 + 4, 0x80000000 + machine->physical_ram_in_mb
342 * 1048576 - 512 + 64);
343 store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb
344 * 1048576 - 512 + 8, 0);
345
346 snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,y"
347 "res:240,bpp:4,gray,hpck:3084,inv ether=0,0x03fe0300,eth0");
348 tmp[tmplen-1] = '\0';
349
350 if (!machine->x11_md.in_use)
351 snprintf(tmp+strlen(tmp), tmplen-strlen(tmp),
352 " console=ttyS0,115200");
353 tmp[tmplen-1] = '\0';
354
355 if (machine->boot_string_argument[0])
356 snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s",
357 machine->boot_string_argument);
358 tmp[tmplen-1] = '\0';
359
360 store_string(cpu, 0x80000000 + machine->physical_ram_in_mb
361 * 1048576 - 512 + 64, tmp);
362
363 machine->bootarg = tmp;
364 } else if (machine->boot_string_argument[0]) {
365 cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */
366
367 store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb
368 * 1048576-512 + 4, 0x80000000 + machine->physical_ram_in_mb
369 * 1048576 - 512 + 64);
370 store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb
371 * 1048576 - 512 + 8, 0);
372
373 store_string(cpu, 0x80000000 + machine->physical_ram_in_mb *
374 1048576 - 512 + 64, machine->boot_string_argument);
375
376 machine->bootarg = machine->boot_string_argument;
377 }
378
379 store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length,
380 sizeof(hpc_bootinfo));
381 store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic,
382 HPC_BOOTINFO_MAGIC);
383 store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr,
384 0x80000000 + hpc_fb_addr);
385 store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.
386 fb_line_bytes, hpc_fb_xsize_mem * (((hpc_fb_bits-1)|7)+1) / 8);
387 store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width,
388 hpc_fb_xsize);
389 store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height,
390 hpc_fb_ysize);
391 store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type,
392 hpc_fb_encoding);
393 store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse,
394 BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */
395
396 /* printf("hpc_bootinfo.platid_cpu = 0x%08x\n",
397 hpc_bootinfo.platid_cpu);
398 printf("hpc_bootinfo.platid_machine = 0x%08x\n",
399 hpc_bootinfo.platid_machine); */
400 store_32bit_word_in_host(cpu,(unsigned char *)&hpc_bootinfo.timezone,0);
401 store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb *
402 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo));
403 }
404
405
406 MACHINE_DEFAULT_CPU(hpcmips)
407 {
408 switch (machine->machine_subtype) {
409 case MACHINE_HPCMIPS_CASIO_BE300:
410 machine->cpu_name = strdup("VR4131");
411 break;
412 case MACHINE_HPCMIPS_CASIO_E105:
413 machine->cpu_name = strdup("VR4121");
414 break;
415 case MACHINE_HPCMIPS_NEC_MOBILEPRO_770:
416 case MACHINE_HPCMIPS_NEC_MOBILEPRO_780:
417 case MACHINE_HPCMIPS_NEC_MOBILEPRO_800:
418 case MACHINE_HPCMIPS_NEC_MOBILEPRO_880:
419 machine->cpu_name = strdup("VR4121");
420 break;
421 case MACHINE_HPCMIPS_AGENDA_VR3:
422 machine->cpu_name = strdup("VR4181");
423 break;
424 case MACHINE_HPCMIPS_IBM_WORKPAD_Z50:
425 machine->cpu_name = strdup("VR4121");
426 break;
427 default:printf("Unimplemented HPCMIPS model?\n");
428 exit(1);
429 }
430 }
431
432
433 MACHINE_DEFAULT_RAM(hpcmips)
434 {
435 /* Most have 32 MB by default. */
436 machine->physical_ram_in_mb = 32;
437
438 switch (machine->machine_subtype) {
439 case MACHINE_HPCMIPS_CASIO_BE300:
440 machine->physical_ram_in_mb = 16;
441 break;
442 case MACHINE_HPCMIPS_CASIO_E105:
443 machine->physical_ram_in_mb = 32;
444 break;
445 case MACHINE_HPCMIPS_AGENDA_VR3:
446 machine->physical_ram_in_mb = 16;
447 break;
448 }
449 }
450
451
452 MACHINE_REGISTER(hpcmips)
453 {
454 MR_DEFAULT(hpcmips, "Handhelp MIPS (HPCmips)",
455 ARCH_MIPS, MACHINE_HPCMIPS);
456
457 machine_entry_add_alias(me, "hpcmips");
458
459 machine_entry_add_subtype(me, "Casio Cassiopeia BE-300",
460 MACHINE_HPCMIPS_CASIO_BE300, "be-300", "be300", NULL);
461
462 machine_entry_add_subtype(me, "Casio Cassiopeia E-105",
463 MACHINE_HPCMIPS_CASIO_E105, "e-105", "e105", NULL);
464
465 machine_entry_add_subtype(me, "Agenda VR3", MACHINE_HPCMIPS_AGENDA_VR3,
466 "agenda", "vr3", NULL);
467
468 machine_entry_add_subtype(me, "IBM WorkPad Z50",
469 MACHINE_HPCMIPS_IBM_WORKPAD_Z50, "workpad", "z50", NULL);
470
471 machine_entry_add_subtype(me, "NEC MobilePro 770",
472 MACHINE_HPCMIPS_NEC_MOBILEPRO_770, "mobilepro770", NULL);
473
474 machine_entry_add_subtype(me, "NEC MobilePro 780",
475 MACHINE_HPCMIPS_NEC_MOBILEPRO_780, "mobilepro780", NULL);
476
477 machine_entry_add_subtype(me, "NEC MobilePro 800",
478 MACHINE_HPCMIPS_NEC_MOBILEPRO_800, "mobilepro800", NULL);
479
480 machine_entry_add_subtype(me, "NEC MobilePro 880",
481 MACHINE_HPCMIPS_NEC_MOBILEPRO_880, "mobilepro880", NULL);
482
483 me->set_default_ram = machine_default_ram_hpcmips;
484 }
485

  ViewVC Help
Powered by ViewVC 1.1.26