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