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