2 * Arnewsh 5206 ColdFire system emulation.
4 * Copyright (c) 2007 CodeSourcery.
6 * This code is licensed under the GPL
14 #include "exec/address-spaces.h"
16 #define KERNEL_LOAD_ADDR 0x10000
17 #define AN5206_MBAR_ADDR 0x10000000
18 #define AN5206_RAMBAR_ADDR 0x20000000
22 static void an5206_init(QEMUMachineInitArgs *args)
24 ram_addr_t ram_size = args->ram_size;
25 const char *cpu_model = args->cpu_model;
26 const char *kernel_filename = args->kernel_filename;
31 MemoryRegion *address_space_mem = get_system_memory();
32 MemoryRegion *ram = g_new(MemoryRegion, 1);
33 MemoryRegion *sram = g_new(MemoryRegion, 1);
37 env = cpu_init(cpu_model);
39 hw_error("Unable to find m68k CPU definition\n");
42 /* Initialize CPU registers. */
44 /* TODO: allow changing MBAR and RAMBAR. */
45 env->mbar = AN5206_MBAR_ADDR | 1;
46 env->rambar0 = AN5206_RAMBAR_ADDR | 1;
48 /* DRAM at address zero */
49 memory_region_init_ram(ram, "an5206.ram", ram_size);
50 vmstate_register_ram_global(ram);
51 memory_region_add_subregion(address_space_mem, 0, ram);
54 memory_region_init_ram(sram, "an5206.sram", 512);
55 vmstate_register_ram_global(sram);
56 memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
58 mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, env);
61 if (!kernel_filename) {
62 fprintf(stderr, "Kernel image must be specified\n");
66 kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
67 NULL, NULL, 1, ELF_MACHINE, 0);
69 if (kernel_size < 0) {
70 kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL);
72 if (kernel_size < 0) {
73 kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR,
74 ram_size - KERNEL_LOAD_ADDR);
75 entry = KERNEL_LOAD_ADDR;
77 if (kernel_size < 0) {
78 fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
85 static QEMUMachine an5206_machine = {
87 .desc = "Arnewsh 5206",
91 static void an5206_machine_init(void)
93 qemu_register_machine(&an5206_machine);
96 machine_init(an5206_machine_init);