/[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 22 - (show annotations)
Mon Oct 8 16:19:37 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 17098 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.1121 2006/02/18 21:03:08 debug Exp $
20051126	Cobalt and PReP now work with the 21143 NIC.
		Continuing on Alpha dyntrans things.
		Fixing some more left-shift-by-24 to unsigned.
20051127	Working on OpenFirmware emulation; major cleanup/redesign.
		Progress on MacPPC emulation: NetBSD detects two CPUs (when
		running with -n 2), framebuffer output (for text) works.
		Adding quick-hack Bandit PCI controller and "gc" interrupt
		controller for MacPPC.
20051128	Changing from a Bandit to a Uni-North controller for macppc.
		Continuing on OpenFirmware and MacPPC emulation in general
		(obio controller, and wdc attached to the obio seems to work).
20051129	More work on MacPPC emulation (adding a dummy ADB controller).
		Continuing the PCI bus cleanup (endianness and tag composition)
		and rewriting all PCI controllers' access functions.
20051130	Various minor PPC dyntrans optimizations.
		Manually inlining some parts of the framebuffer redraw routine.
		Slowly beginning the conversion of the old MIPS emulation into
		dyntrans (but this will take quite some time to get right).
		Generalizing quick_pc_to_pointers.
20051201	Documentation update (David Muse has made available a kernel
		which simplifies Debian/DECstation installation).
		Continuing on the ADB bus controller.
20051202	Beginning a rewrite of the Zilog serial controller (dev_zs).
20051203	Continuing on the zs rewrite (now called dev_z8530); conversion
		to devinit style.
		Reworking some of the input-only vs output-only vs input-output
		details of src/console.c, better warning messages, and adding
		a debug dump.
		Removing the concept of "device state"; it wasn't really used.
		Changing some debug output (-vv should now be used to show all
		details about devices and busses; not shown during normal
		startup anymore).
		Beginning on some SPARC instruction disassembly support.
20051204	Minor PPC updates (WALNUT skeleton stuff).
		Continuing on the MIPS dyntrans rewrite.
		More progress on the ADB controller (a keyboard is "detected"
		by NetBSD and OpenBSD).
		Downgrading OpenBSD/arc as a guest OS from "working" to
		"almost working" in the documentation.
		Progress on Algor emulation ("v3" PCI controller).
20051205	Minor updates.
20051207	Sorting devices according to address; this reduces complexity
		of device lookups from O(n) to O(log n) in memory_rw (but no
		real performance increase (yet) in experiments).
20051210	Beginning the work on native dyntrans backends (by making a
		simple skeleton; so far only for Alpha hosts).
20051211	Some very minor SPARC updates.
20051215	Fixing a bug in the MIPS mul (note: not mult) instruction,
		so it also works with non-64-bit emulation. (Thanks to Alec
		Voropay for noticing the problem.)
20051216	More work on the fake/empty/simple/skeleton/whatever backend;
		performance doesn't increase, so this isn't really worth it,
		but it was probably worth it to prepare for a real backend
		later.
20051219	More instr call statistics gathering and analysis stuff.
20051220	Another fix for MIPS 'mul'. Also converting mul and {d,}cl{o,z}
		to dyntrans.
		memory_ppc.c syntax error fix (noticed by Peter Valchev).
		Beginning to move out machines from src/machine.c into
		individual files in src/machines (in a way similar to the
		autodev system for devices).
20051222	Updating the documentation regarding NetBSD/pmax 3.0.
20051223	- " - NetBSD/cats 3.0.
20051225	- " - NetBSD/hpcmips 3.0.
20051226	Continuing on the machine registry redesign.
		Adding support for ARM rrx (33-bit rotate).
		Fixing some signed/unsigned issues (exposed by gcc -W).
20051227	Fixing the bug which prevented a NetBSD/prep 3.0 install kernel
		from starting (triggered when an mtmsr was the last instruction
		on a page). Unfortunately not enough to get the kernel to run
		as well as the 2.1 kernels did.
20051230	Some dyntrans refactoring.
20051231	Continuing on the machine registry redesign.
20060101-10	Continuing... moving more machines. Moving MD interrupt stuff
		from machine.c into a new src/machines/interrupts.c.
20060114	Adding various mvmeppc machine skeletons.
20060115	Continuing on mvme* stuff. NetBSD/mvmeppc prints boot messages
		(for MVME1600) and reaches the root device prompt, but no
		specific hardware devices are emulated yet.
20060116	Minor updates to the mvme1600 emulation mode; the Eagle PCI bus
		seems to work without much modification, and a 21143 can be
		detected, interrupts might work (but untested so far).
		Adding a fake MK48Txx (mkclock) device, for NetBSD/mvmeppc.
20060121	Adding an aux control register for ARM. (A BIG thank you to
		Olivier Houchard for tracking down this bug.)
20060122	Adding more ARM instructions (smulXY), and dev_iq80321_7seg.
20060124	Adding disassembly of more ARM instructions (mia*, mra/mar),
		and some semi-bogus XScale and i80321 registers.
20060201-02	Various minor updates. Moving the last machines out of
		machine.c.
20060204	Adding a -c command line option, for running debugger commands
		before the simulation starts, but after all files have been
		loaded.
		Minor iq80321-related updates.
20060209	Minor hacks (DEVINIT macro, etc).
		Preparing for the generalization of the 64-bit dyntrans address
		translation subsystem.
20060216	Adding ARM ldrd (double-register load).
20060217	Continuing on various ARM-related stuff.
20060218	More progress on the ATA/wdc emulation for NetBSD/iq80321.
		NetBSD/evbarm can now be installed :-)  Updating the docs, etc.
		Continuing on Algor emulation.

==============  RELEASE 0.3.8  ==============


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

  ViewVC Help
Powered by ViewVC 1.1.26