1 |
/* |
/* |
2 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2007 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine_test.c,v 1.17 2006/07/20 21:53:00 debug Exp $ |
* $Id: machine_test.c,v 1.30 2007/02/10 14:38:39 debug Exp $ |
29 |
* |
* |
30 |
* Various "test" machines (bare machines with just a CPU, or a bare machine |
* Various "test" machines (bare machines with just a CPU, or a bare machine |
31 |
* plus some experimental devices). |
* plus some experimental devices). |
36 |
|
|
37 |
#include "cpu.h" |
#include "cpu.h" |
38 |
#include "device.h" |
#include "device.h" |
|
#include "devices.h" |
|
39 |
#include "machine.h" |
#include "machine.h" |
40 |
#include "memory.h" |
#include "memory.h" |
41 |
#include "misc.h" |
#include "misc.h" |
45 |
#include "testmachine/dev_ether.h" |
#include "testmachine/dev_ether.h" |
46 |
#include "testmachine/dev_fb.h" |
#include "testmachine/dev_fb.h" |
47 |
#include "testmachine/dev_mp.h" |
#include "testmachine/dev_mp.h" |
48 |
|
#include "testmachine/dev_rtc.h" |
49 |
|
|
50 |
|
|
51 |
static void default_test(struct machine *machine, struct cpu *cpu) |
static void default_test(struct machine *machine, struct cpu *cpu) |
52 |
{ |
{ |
53 |
char tmpstr[1000]; |
char tmpstr[1000]; |
54 |
|
|
55 |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=0", |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=none", |
56 |
(uint64_t) DEV_CONS_ADDRESS); |
(uint64_t) DEV_CONS_ADDRESS); |
57 |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
58 |
|
|
68 |
(uint64_t) DEV_DISK_ADDRESS); |
(uint64_t) DEV_DISK_ADDRESS); |
69 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
70 |
|
|
71 |
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=0", |
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=none", |
72 |
(uint64_t) DEV_ETHER_ADDRESS); |
(uint64_t) DEV_ETHER_ADDRESS); |
73 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
74 |
|
|
75 |
|
snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=none", |
76 |
|
(uint64_t) DEV_RTC_ADDRESS); |
77 |
|
device_add(machine, tmpstr); |
78 |
} |
} |
79 |
|
|
80 |
|
|
185 |
|
|
186 |
|
|
187 |
|
|
|
MACHINE_SETUP(barehppa) |
|
|
{ |
|
|
machine->machine_name = "Generic \"bare\" HPPA machine"; |
|
|
machine->stable = 1; |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_SETUP(testhppa) |
|
|
{ |
|
|
machine->machine_name = "HPPA test machine"; |
|
|
machine->stable = 1; |
|
|
|
|
|
/* TODO: interrupt for HPPA? */ |
|
|
|
|
|
default_test(machine, cpu); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_DEFAULT_CPU(barehppa) |
|
|
{ |
|
|
machine->cpu_name = strdup("HPPA"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_DEFAULT_CPU(testhppa) |
|
|
{ |
|
|
machine->cpu_name = strdup("HPPA"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_REGISTER(barehppa) |
|
|
{ |
|
|
MR_DEFAULT(barehppa, "Generic \"bare\" HPPA machine", |
|
|
ARCH_HPPA, MACHINE_BAREHPPA); |
|
|
|
|
|
machine_entry_add_alias(me, "barehppa"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_REGISTER(testhppa) |
|
|
{ |
|
|
MR_DEFAULT(testhppa, "Test-machine for HPPA", |
|
|
ARCH_HPPA, MACHINE_TESTHPPA); |
|
|
|
|
|
machine_entry_add_alias(me, "testhppa"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_SETUP(barei960) |
|
|
{ |
|
|
machine->machine_name = "Generic \"bare\" i960 machine"; |
|
|
machine->stable = 1; |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_SETUP(testi960) |
|
|
{ |
|
|
machine->machine_name = "i960 test machine"; |
|
|
machine->stable = 1; |
|
|
|
|
|
/* TODO: interrupt for i960? */ |
|
|
|
|
|
default_test(machine, cpu); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_DEFAULT_CPU(barei960) |
|
|
{ |
|
|
machine->cpu_name = strdup("i960"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_DEFAULT_CPU(testi960) |
|
|
{ |
|
|
machine->cpu_name = strdup("i960"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_REGISTER(barei960) |
|
|
{ |
|
|
MR_DEFAULT(barei960, "Generic \"bare\" i960 machine", |
|
|
ARCH_I960, MACHINE_BAREI960); |
|
|
|
|
|
machine_entry_add_alias(me, "barei960"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_REGISTER(testi960) |
|
|
{ |
|
|
MR_DEFAULT(testi960, "Test-machine for i960", |
|
|
ARCH_I960, MACHINE_TESTI960); |
|
|
|
|
|
machine_entry_add_alias(me, "testi960"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_SETUP(bareia64) |
|
|
{ |
|
|
machine->machine_name = "Generic \"bare\" IA64 machine"; |
|
|
machine->stable = 1; |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_SETUP(testia64) |
|
|
{ |
|
|
machine->machine_name = "IA64 test machine"; |
|
|
machine->stable = 1; |
|
|
|
|
|
/* TODO: interrupt for IA64? */ |
|
|
|
|
|
default_test(machine, cpu); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_DEFAULT_CPU(bareia64) |
|
|
{ |
|
|
machine->cpu_name = strdup("IA64"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_DEFAULT_CPU(testia64) |
|
|
{ |
|
|
machine->cpu_name = strdup("IA64"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_REGISTER(bareia64) |
|
|
{ |
|
|
MR_DEFAULT(bareia64, "Generic \"bare\" IA64 machine", |
|
|
ARCH_IA64, MACHINE_BAREIA64); |
|
|
|
|
|
machine_entry_add_alias(me, "bareia64"); |
|
|
} |
|
|
|
|
|
|
|
|
MACHINE_REGISTER(testia64) |
|
|
{ |
|
|
MR_DEFAULT(testia64, "Test-machine for IA64", |
|
|
ARCH_IA64, MACHINE_TESTIA64); |
|
|
|
|
|
machine_entry_add_alias(me, "testia64"); |
|
|
} |
|
|
|
|
|
|
|
188 |
MACHINE_SETUP(barem68k) |
MACHINE_SETUP(barem68k) |
189 |
{ |
{ |
190 |
machine->machine_name = "Generic \"bare\" M68K machine"; |
machine->machine_name = "Generic \"bare\" M68K machine"; |
244 |
MACHINE_SETUP(testmips) |
MACHINE_SETUP(testmips) |
245 |
{ |
{ |
246 |
/* |
/* |
247 |
* A MIPS test machine (which happens to work with the |
* A MIPS test machine. Originally, this was created as a way for |
248 |
* code in my master's thesis). :-) |
* me to test my master's thesis code; since then it has both |
249 |
|
* evolved to support new things, and suffered bit rot so that it |
250 |
|
* no longer can run my thesis code. Well, well... |
251 |
* |
* |
252 |
* IRQ map: |
* IRQ map: |
253 |
* 7 CPU counter |
* 7 CPU counter |
254 |
* 6 SMP IPIs |
* 6 SMP IPIs |
255 |
* 5 not used yet |
* 5 not used yet |
256 |
* 4 not used yet |
* 4 rtc |
257 |
* 3 ethernet |
* 3 ethernet |
258 |
* 2 serial console |
* 2 serial console |
259 |
*/ |
*/ |
260 |
|
|
261 |
char tmpstr[1000]; |
char tmpstr[300]; |
262 |
|
|
263 |
machine->machine_name = "MIPS test machine"; |
machine->machine_name = "MIPS test machine"; |
264 |
machine->stable = 1; |
machine->stable = 1; |
265 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
266 |
|
|
267 |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=2", |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=%s." |
268 |
(uint64_t) DEV_CONS_ADDRESS); |
"cpu[%i].2", (uint64_t) DEV_CONS_ADDRESS, machine->path, |
269 |
|
machine->bootstrap_cpu); |
270 |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
271 |
|
|
272 |
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%"PRIx64, |
snprintf(tmpstr, sizeof(tmpstr), "mp irq=6 addr=0x%"PRIx64, |
273 |
(uint64_t) DEV_MP_ADDRESS); |
(uint64_t) DEV_MP_ADDRESS); |
274 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
275 |
|
|
281 |
(uint64_t) DEV_DISK_ADDRESS); |
(uint64_t) DEV_DISK_ADDRESS); |
282 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
283 |
|
|
284 |
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=3", |
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=%s." |
285 |
(uint64_t) DEV_ETHER_ADDRESS); |
"cpu[%i].3", (uint64_t) DEV_ETHER_ADDRESS, machine->path, |
286 |
|
machine->bootstrap_cpu); |
287 |
|
device_add(machine, tmpstr); |
288 |
|
|
289 |
|
snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=%s." |
290 |
|
"cpu[%i].4", (uint64_t) DEV_RTC_ADDRESS, machine->path, |
291 |
|
machine->bootstrap_cpu); |
292 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
293 |
} |
} |
294 |
|
|
295 |
|
|
296 |
MACHINE_DEFAULT_CPU(baremips) |
MACHINE_DEFAULT_CPU(baremips) |
297 |
{ |
{ |
298 |
machine->cpu_name = strdup("5Kc"); |
machine->cpu_name = strdup("5KE"); |
299 |
} |
} |
300 |
|
|
301 |
|
|
302 |
MACHINE_DEFAULT_CPU(testmips) |
MACHINE_DEFAULT_CPU(testmips) |
303 |
{ |
{ |
304 |
machine->cpu_name = strdup("5Kc"); |
machine->cpu_name = strdup("5KE"); |
305 |
} |
} |
306 |
|
|
307 |
|
|
390 |
|
|
391 |
MACHINE_DEFAULT_CPU(baresh) |
MACHINE_DEFAULT_CPU(baresh) |
392 |
{ |
{ |
393 |
machine->cpu_name = strdup("SH"); |
machine->cpu_name = strdup("SH7750"); |
394 |
} |
} |
395 |
|
|
396 |
|
|
397 |
MACHINE_DEFAULT_CPU(testsh) |
MACHINE_DEFAULT_CPU(testsh) |
398 |
{ |
{ |
399 |
machine->cpu_name = strdup("SH"); |
machine->cpu_name = strdup("SH7750"); |
400 |
} |
} |
401 |
|
|
402 |
|
|