]> git.proxmox.com Git - qemu.git/blame - hw/an5206.c
More phys_ram_base removal.
[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"
0633879f
PB
14
15#define KERNEL_LOAD_ADDR 0x10000
16#define AN5206_MBAR_ADDR 0x10000000
17#define AN5206_RAMBAR_ADDR 0x20000000
18
19/* Stub functions for hardware that doesn't exist. */
376253ec 20void pic_info(Monitor *mon)
0633879f
PB
21{
22}
23
376253ec 24void irq_info(Monitor *mon)
0633879f
PB
25{
26}
27
0633879f
PB
28/* Board init. */
29
00f82b8a 30static void an5206_init(ram_addr_t ram_size, int vga_ram_size,
3023f332 31 const char *boot_device,
0633879f
PB
32 const char *kernel_filename, const char *kernel_cmdline,
33 const char *initrd_filename, const char *cpu_model)
34{
35 CPUState *env;
36 int kernel_size;
37 uint64_t elf_entry;
38 target_ulong entry;
39
0633879f
PB
40 if (!cpu_model)
41 cpu_model = "m5206";
aaed909a
FB
42 env = cpu_init(cpu_model);
43 if (!env) {
20dcee94
PB
44 cpu_abort(env, "Unable to find m68k CPU definition\n");
45 }
0633879f
PB
46
47 /* Initialize CPU registers. */
48 env->vbr = 0;
49 /* TODO: allow changing MBAR and RAMBAR. */
50 env->mbar = AN5206_MBAR_ADDR | 1;
51 env->rambar0 = AN5206_RAMBAR_ADDR | 1;
52
53 /* DRAM at address zero */
54 cpu_register_physical_memory(0, ram_size,
55 qemu_ram_alloc(ram_size) | IO_MEM_RAM);
56
57 /* Internal SRAM. */
58 cpu_register_physical_memory(AN5206_RAMBAR_ADDR, 512,
59 qemu_ram_alloc(512) | IO_MEM_RAM);
60
61 mcf5206_init(AN5206_MBAR_ADDR, env);
62
63 /* Load kernel. */
64 if (!kernel_filename) {
65 fprintf(stderr, "Kernel image must be specified\n");
66 exit(1);
67 }
68
69 kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL);
70 entry = elf_entry;
71 if (kernel_size < 0) {
5a9154e0 72 kernel_size = load_uimage(kernel_filename, &entry, NULL, NULL);
0633879f
PB
73 }
74 if (kernel_size < 0) {
75 kernel_size = load_image(kernel_filename,
76 phys_ram_base + KERNEL_LOAD_ADDR);
77 entry = KERNEL_LOAD_ADDR;
78 }
79 if (kernel_size < 0) {
80 fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
81 exit(1);
82 }
83
84 env->pc = entry;
85}
86
87QEMUMachine an5206_machine = {
4b32e168
AL
88 .name = "an5206",
89 .desc = "Arnewsh 5206",
90 .init = an5206_init,
91 .ram_require = 512,
0633879f 92};