]> git.proxmox.com Git - qemu.git/blame - hw/an5206.c
acpi_piix4: Re-define PCI hotplug eject register read
[qemu.git] / hw / an5206.c
CommitLineData
5fafdf24 1/*
0633879f
PB
2 * Arnewsh 5206 ColdFire system emulation.
3 *
4 * Copyright (c) 2007 CodeSourcery.
5 *
8e31bf38 6 * This code is licensed under the GPL
0633879f
PB
7 */
8
87ecb68b
PB
9#include "hw.h"
10#include "mcf.h"
87ecb68b 11#include "boards.h"
ca20cf32
BS
12#include "loader.h"
13#include "elf.h"
72e4d255 14#include "exec-memory.h"
0633879f
PB
15
16#define KERNEL_LOAD_ADDR 0x10000
17#define AN5206_MBAR_ADDR 0x10000000
18#define AN5206_RAMBAR_ADDR 0x20000000
19
0633879f
PB
20/* Board init. */
21
c227f099 22static void an5206_init(ram_addr_t ram_size,
3023f332 23 const char *boot_device,
0633879f
PB
24 const char *kernel_filename, const char *kernel_cmdline,
25 const char *initrd_filename, const char *cpu_model)
26{
7927df3a 27 CPUM68KState *env;
0633879f
PB
28 int kernel_size;
29 uint64_t elf_entry;
c227f099 30 target_phys_addr_t entry;
72e4d255
AK
31 MemoryRegion *address_space_mem = get_system_memory();
32 MemoryRegion *ram = g_new(MemoryRegion, 1);
33 MemoryRegion *sram = g_new(MemoryRegion, 1);
0633879f 34
0633879f
PB
35 if (!cpu_model)
36 cpu_model = "m5206";
aaed909a
FB
37 env = cpu_init(cpu_model);
38 if (!env) {
2ac71179 39 hw_error("Unable to find m68k CPU definition\n");
20dcee94 40 }
0633879f
PB
41
42 /* Initialize CPU registers. */
43 env->vbr = 0;
44 /* TODO: allow changing MBAR and RAMBAR. */
45 env->mbar = AN5206_MBAR_ADDR | 1;
46 env->rambar0 = AN5206_RAMBAR_ADDR | 1;
47
48 /* DRAM at address zero */
c5705a77
AK
49 memory_region_init_ram(ram, "an5206.ram", ram_size);
50 vmstate_register_ram_global(ram);
72e4d255 51 memory_region_add_subregion(address_space_mem, 0, ram);
0633879f
PB
52
53 /* Internal SRAM. */
c5705a77
AK
54 memory_region_init_ram(sram, "an5206.sram", 512);
55 vmstate_register_ram_global(sram);
72e4d255 56 memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
0633879f 57
653fa85c 58 mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, env);
0633879f
PB
59
60 /* Load kernel. */
61 if (!kernel_filename) {
62 fprintf(stderr, "Kernel image must be specified\n");
63 exit(1);
64 }
65
409dbce5
AJ
66 kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
67 NULL, NULL, 1, ELF_MACHINE, 0);
0633879f
PB
68 entry = elf_entry;
69 if (kernel_size < 0) {
5a9154e0 70 kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL);
0633879f
PB
71 }
72 if (kernel_size < 0) {
dcac9679
PB
73 kernel_size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR,
74 ram_size - KERNEL_LOAD_ADDR);
0633879f
PB
75 entry = KERNEL_LOAD_ADDR;
76 }
77 if (kernel_size < 0) {
78 fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
79 exit(1);
80 }
81
82 env->pc = entry;
83}
84
f80f9ec9 85static QEMUMachine an5206_machine = {
4b32e168
AL
86 .name = "an5206",
87 .desc = "Arnewsh 5206",
88 .init = an5206_init,
0633879f 89};
f80f9ec9
AL
90
91static void an5206_machine_init(void)
92{
93 qemu_register_machine(&an5206_machine);
94}
95
96machine_init(an5206_machine_init);