root / hw / an5206.c @ 0fead125
History | View | Annotate | Download (2.2 kB)
1 |
/*
|
---|---|
2 |
* Arnewsh 5206 ColdFire system emulation.
|
3 |
*
|
4 |
* Copyright (c) 2007 CodeSourcery.
|
5 |
*
|
6 |
* This code is licenced under the GPL
|
7 |
*/
|
8 |
|
9 |
#include "hw.h" |
10 |
#include "mcf.h" |
11 |
#include "sysemu.h" |
12 |
#include "boards.h" |
13 |
|
14 |
#define KERNEL_LOAD_ADDR 0x10000 |
15 |
#define AN5206_MBAR_ADDR 0x10000000 |
16 |
#define AN5206_RAMBAR_ADDR 0x20000000 |
17 |
|
18 |
/* Stub functions for hardware that doesn't exist. */
|
19 |
void pic_info(void) |
20 |
{ |
21 |
} |
22 |
|
23 |
void irq_info(void) |
24 |
{ |
25 |
} |
26 |
|
27 |
void DMA_run (void) |
28 |
{ |
29 |
} |
30 |
|
31 |
/* Board init. */
|
32 |
|
33 |
static void an5206_init(ram_addr_t ram_size, int vga_ram_size, |
34 |
const char *boot_device, DisplayState *ds, |
35 |
const char *kernel_filename, const char *kernel_cmdline, |
36 |
const char *initrd_filename, const char *cpu_model) |
37 |
{ |
38 |
CPUState *env; |
39 |
int kernel_size;
|
40 |
uint64_t elf_entry; |
41 |
target_ulong entry; |
42 |
|
43 |
if (!cpu_model)
|
44 |
cpu_model = "m5206";
|
45 |
env = cpu_init(cpu_model); |
46 |
if (!env) {
|
47 |
cpu_abort(env, "Unable to find m68k CPU definition\n");
|
48 |
} |
49 |
|
50 |
/* Initialize CPU registers. */
|
51 |
env->vbr = 0;
|
52 |
/* TODO: allow changing MBAR and RAMBAR. */
|
53 |
env->mbar = AN5206_MBAR_ADDR | 1;
|
54 |
env->rambar0 = AN5206_RAMBAR_ADDR | 1;
|
55 |
|
56 |
/* DRAM at address zero */
|
57 |
cpu_register_physical_memory(0, ram_size,
|
58 |
qemu_ram_alloc(ram_size) | IO_MEM_RAM); |
59 |
|
60 |
/* Internal SRAM. */
|
61 |
cpu_register_physical_memory(AN5206_RAMBAR_ADDR, 512,
|
62 |
qemu_ram_alloc(512) | IO_MEM_RAM);
|
63 |
|
64 |
mcf5206_init(AN5206_MBAR_ADDR, env); |
65 |
|
66 |
/* Load kernel. */
|
67 |
if (!kernel_filename) {
|
68 |
fprintf(stderr, "Kernel image must be specified\n");
|
69 |
exit(1);
|
70 |
} |
71 |
|
72 |
kernel_size = load_elf(kernel_filename, 0, &elf_entry, NULL, NULL); |
73 |
entry = elf_entry; |
74 |
if (kernel_size < 0) { |
75 |
kernel_size = load_uboot(kernel_filename, &entry, NULL);
|
76 |
} |
77 |
if (kernel_size < 0) { |
78 |
kernel_size = load_image(kernel_filename, |
79 |
phys_ram_base + KERNEL_LOAD_ADDR); |
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 |
|
90 |
QEMUMachine an5206_machine = { |
91 |
"an5206",
|
92 |
"Arnewsh 5206",
|
93 |
an5206_init, |
94 |
512,
|
95 |
}; |