--- trunk/src/machines/machine_test.c 2007/10/08 16:20:26 28 +++ trunk/src/machines/machine_test.c 2007/10/08 16:21:17 34 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $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 $ * * Various "test" machines (bare machines with just a CPU, or a bare machine * plus some experimental devices). @@ -36,7 +36,6 @@ #include "cpu.h" #include "device.h" -#include "devices.h" #include "machine.h" #include "memory.h" #include "misc.h" @@ -46,13 +45,14 @@ #include "testmachine/dev_ether.h" #include "testmachine/dev_fb.h" #include "testmachine/dev_mp.h" +#include "testmachine/dev_rtc.h" static void default_test(struct machine *machine, struct cpu *cpu) { char tmpstr[1000]; - snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=0", + snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=none", (uint64_t) DEV_CONS_ADDRESS); machine->main_console_handle = (size_t)device_add(machine, tmpstr); @@ -68,9 +68,13 @@ (uint64_t) DEV_DISK_ADDRESS); device_add(machine, tmpstr); - snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=0", + snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=none", (uint64_t) DEV_ETHER_ADDRESS); device_add(machine, tmpstr); + + snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=none", + (uint64_t) DEV_RTC_ADDRESS); + device_add(machine, tmpstr); } @@ -181,150 +185,6 @@ -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"); -} - - MACHINE_SETUP(barem68k) { machine->machine_name = "Generic \"bare\" M68K machine"; @@ -384,29 +244,32 @@ MACHINE_SETUP(testmips) { /* - * A MIPS test machine (which happens to work with the - * code in my master's thesis). :-) + * A MIPS test machine. Originally, this was created as a way for + * me to test my master's thesis code; since then it has both + * evolved to support new things, and suffered bit rot so that it + * no longer can run my thesis code. Well, well... * * IRQ map: * 7 CPU counter * 6 SMP IPIs * 5 not used yet - * 4 not used yet + * 4 rtc * 3 ethernet * 2 serial console */ - char tmpstr[1000]; + char tmpstr[300]; machine->machine_name = "MIPS test machine"; machine->stable = 1; cpu->byte_order = EMUL_BIG_ENDIAN; - snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=2", - (uint64_t) DEV_CONS_ADDRESS); + snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=%s." + "cpu[%i].2", (uint64_t) DEV_CONS_ADDRESS, machine->path, + machine->bootstrap_cpu); machine->main_console_handle = (size_t)device_add(machine, tmpstr); - snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%"PRIx64, + snprintf(tmpstr, sizeof(tmpstr), "mp irq=6 addr=0x%"PRIx64, (uint64_t) DEV_MP_ADDRESS); device_add(machine, tmpstr); @@ -418,21 +281,27 @@ (uint64_t) DEV_DISK_ADDRESS); device_add(machine, tmpstr); - snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=3", - (uint64_t) DEV_ETHER_ADDRESS); + snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=%s." + "cpu[%i].3", (uint64_t) DEV_ETHER_ADDRESS, machine->path, + machine->bootstrap_cpu); + device_add(machine, tmpstr); + + snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=%s." + "cpu[%i].4", (uint64_t) DEV_RTC_ADDRESS, machine->path, + machine->bootstrap_cpu); device_add(machine, tmpstr); } MACHINE_DEFAULT_CPU(baremips) { - machine->cpu_name = strdup("5Kc"); + machine->cpu_name = strdup("5KE"); } MACHINE_DEFAULT_CPU(testmips) { - machine->cpu_name = strdup("5Kc"); + machine->cpu_name = strdup("5KE"); } @@ -521,13 +390,13 @@ MACHINE_DEFAULT_CPU(baresh) { - machine->cpu_name = strdup("SH"); + machine->cpu_name = strdup("SH7750"); } MACHINE_DEFAULT_CPU(testsh) { - machine->cpu_name = strdup("SH"); + machine->cpu_name = strdup("SH7750"); }