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