root / hw / ppc405_boards.c @ 49a2942d
History | View | Annotate | Download (19.6 kB)
1 | 1a6c0886 | j_mayer | /*
|
---|---|---|---|
2 | 1a6c0886 | j_mayer | * QEMU PowerPC 405 evaluation boards emulation
|
3 | 5fafdf24 | ths | *
|
4 | 1a6c0886 | j_mayer | * Copyright (c) 2007 Jocelyn Mayer
|
5 | 5fafdf24 | ths | *
|
6 | 1a6c0886 | j_mayer | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | 1a6c0886 | j_mayer | * of this software and associated documentation files (the "Software"), to deal
|
8 | 1a6c0886 | j_mayer | * in the Software without restriction, including without limitation the rights
|
9 | 1a6c0886 | j_mayer | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | 1a6c0886 | j_mayer | * copies of the Software, and to permit persons to whom the Software is
|
11 | 1a6c0886 | j_mayer | * furnished to do so, subject to the following conditions:
|
12 | 1a6c0886 | j_mayer | *
|
13 | 1a6c0886 | j_mayer | * The above copyright notice and this permission notice shall be included in
|
14 | 1a6c0886 | j_mayer | * all copies or substantial portions of the Software.
|
15 | 1a6c0886 | j_mayer | *
|
16 | 1a6c0886 | j_mayer | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | 1a6c0886 | j_mayer | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | 1a6c0886 | j_mayer | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | 1a6c0886 | j_mayer | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | 1a6c0886 | j_mayer | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | 1a6c0886 | j_mayer | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | 1a6c0886 | j_mayer | * THE SOFTWARE.
|
23 | 1a6c0886 | j_mayer | */
|
24 | 87ecb68b | pbrook | #include "hw.h" |
25 | 87ecb68b | pbrook | #include "ppc.h" |
26 | 1a6c0886 | j_mayer | #include "ppc405.h" |
27 | 87ecb68b | pbrook | #include "nvram.h" |
28 | 87ecb68b | pbrook | #include "flash.h" |
29 | 87ecb68b | pbrook | #include "sysemu.h" |
30 | 87ecb68b | pbrook | #include "block.h" |
31 | 87ecb68b | pbrook | #include "boards.h" |
32 | 3b3fb322 | blueswir1 | #include "qemu-log.h" |
33 | ca20cf32 | Blue Swirl | #include "loader.h" |
34 | 2446333c | Blue Swirl | #include "blockdev.h" |
35 | 1a6c0886 | j_mayer | |
36 | 1a6c0886 | j_mayer | #define BIOS_FILENAME "ppc405_rom.bin" |
37 | 1a6c0886 | j_mayer | #define BIOS_SIZE (2048 * 1024) |
38 | 1a6c0886 | j_mayer | |
39 | 1a6c0886 | j_mayer | #define KERNEL_LOAD_ADDR 0x00000000 |
40 | 1a6c0886 | j_mayer | #define INITRD_LOAD_ADDR 0x01800000 |
41 | 1a6c0886 | j_mayer | |
42 | 1a6c0886 | j_mayer | #define USE_FLASH_BIOS
|
43 | 1a6c0886 | j_mayer | |
44 | 1a6c0886 | j_mayer | #define DEBUG_BOARD_INIT
|
45 | 1a6c0886 | j_mayer | |
46 | 1a6c0886 | j_mayer | /*****************************************************************************/
|
47 | 1a6c0886 | j_mayer | /* PPC405EP reference board (IBM) */
|
48 | 1a6c0886 | j_mayer | /* Standalone board with:
|
49 | 1a6c0886 | j_mayer | * - PowerPC 405EP CPU
|
50 | 1a6c0886 | j_mayer | * - SDRAM (0x00000000)
|
51 | 1a6c0886 | j_mayer | * - Flash (0xFFF80000)
|
52 | 1a6c0886 | j_mayer | * - SRAM (0xFFF00000)
|
53 | 1a6c0886 | j_mayer | * - NVRAM (0xF0000000)
|
54 | 1a6c0886 | j_mayer | * - FPGA (0xF0300000)
|
55 | 1a6c0886 | j_mayer | */
|
56 | c227f099 | Anthony Liguori | typedef struct ref405ep_fpga_t ref405ep_fpga_t; |
57 | c227f099 | Anthony Liguori | struct ref405ep_fpga_t {
|
58 | 1a6c0886 | j_mayer | uint8_t reg0; |
59 | 1a6c0886 | j_mayer | uint8_t reg1; |
60 | 1a6c0886 | j_mayer | }; |
61 | 1a6c0886 | j_mayer | |
62 | c227f099 | Anthony Liguori | static uint32_t ref405ep_fpga_readb (void *opaque, target_phys_addr_t addr) |
63 | 1a6c0886 | j_mayer | { |
64 | c227f099 | Anthony Liguori | ref405ep_fpga_t *fpga; |
65 | 1a6c0886 | j_mayer | uint32_t ret; |
66 | 1a6c0886 | j_mayer | |
67 | 1a6c0886 | j_mayer | fpga = opaque; |
68 | 1a6c0886 | j_mayer | switch (addr) {
|
69 | 1a6c0886 | j_mayer | case 0x0: |
70 | 1a6c0886 | j_mayer | ret = fpga->reg0; |
71 | 1a6c0886 | j_mayer | break;
|
72 | 1a6c0886 | j_mayer | case 0x1: |
73 | 1a6c0886 | j_mayer | ret = fpga->reg1; |
74 | 1a6c0886 | j_mayer | break;
|
75 | 1a6c0886 | j_mayer | default:
|
76 | 1a6c0886 | j_mayer | ret = 0;
|
77 | 1a6c0886 | j_mayer | break;
|
78 | 1a6c0886 | j_mayer | } |
79 | 1a6c0886 | j_mayer | |
80 | 1a6c0886 | j_mayer | return ret;
|
81 | 1a6c0886 | j_mayer | } |
82 | 1a6c0886 | j_mayer | |
83 | 1a6c0886 | j_mayer | static void ref405ep_fpga_writeb (void *opaque, |
84 | c227f099 | Anthony Liguori | target_phys_addr_t addr, uint32_t value) |
85 | 1a6c0886 | j_mayer | { |
86 | c227f099 | Anthony Liguori | ref405ep_fpga_t *fpga; |
87 | 1a6c0886 | j_mayer | |
88 | 1a6c0886 | j_mayer | fpga = opaque; |
89 | 1a6c0886 | j_mayer | switch (addr) {
|
90 | 1a6c0886 | j_mayer | case 0x0: |
91 | 1a6c0886 | j_mayer | /* Read only */
|
92 | 1a6c0886 | j_mayer | break;
|
93 | 1a6c0886 | j_mayer | case 0x1: |
94 | 1a6c0886 | j_mayer | fpga->reg1 = value; |
95 | 1a6c0886 | j_mayer | break;
|
96 | 1a6c0886 | j_mayer | default:
|
97 | 1a6c0886 | j_mayer | break;
|
98 | 1a6c0886 | j_mayer | } |
99 | 1a6c0886 | j_mayer | } |
100 | 1a6c0886 | j_mayer | |
101 | c227f099 | Anthony Liguori | static uint32_t ref405ep_fpga_readw (void *opaque, target_phys_addr_t addr) |
102 | 1a6c0886 | j_mayer | { |
103 | 1a6c0886 | j_mayer | uint32_t ret; |
104 | 1a6c0886 | j_mayer | |
105 | 1a6c0886 | j_mayer | ret = ref405ep_fpga_readb(opaque, addr) << 8;
|
106 | 1a6c0886 | j_mayer | ret |= ref405ep_fpga_readb(opaque, addr + 1);
|
107 | 1a6c0886 | j_mayer | |
108 | 1a6c0886 | j_mayer | return ret;
|
109 | 1a6c0886 | j_mayer | } |
110 | 1a6c0886 | j_mayer | |
111 | 1a6c0886 | j_mayer | static void ref405ep_fpga_writew (void *opaque, |
112 | c227f099 | Anthony Liguori | target_phys_addr_t addr, uint32_t value) |
113 | 1a6c0886 | j_mayer | { |
114 | 1a6c0886 | j_mayer | ref405ep_fpga_writeb(opaque, addr, (value >> 8) & 0xFF); |
115 | 1a6c0886 | j_mayer | ref405ep_fpga_writeb(opaque, addr + 1, value & 0xFF); |
116 | 1a6c0886 | j_mayer | } |
117 | 1a6c0886 | j_mayer | |
118 | c227f099 | Anthony Liguori | static uint32_t ref405ep_fpga_readl (void *opaque, target_phys_addr_t addr) |
119 | 1a6c0886 | j_mayer | { |
120 | 1a6c0886 | j_mayer | uint32_t ret; |
121 | 1a6c0886 | j_mayer | |
122 | 1a6c0886 | j_mayer | ret = ref405ep_fpga_readb(opaque, addr) << 24;
|
123 | 1a6c0886 | j_mayer | ret |= ref405ep_fpga_readb(opaque, addr + 1) << 16; |
124 | 1a6c0886 | j_mayer | ret |= ref405ep_fpga_readb(opaque, addr + 2) << 8; |
125 | 1a6c0886 | j_mayer | ret |= ref405ep_fpga_readb(opaque, addr + 3);
|
126 | 1a6c0886 | j_mayer | |
127 | 1a6c0886 | j_mayer | return ret;
|
128 | 1a6c0886 | j_mayer | } |
129 | 1a6c0886 | j_mayer | |
130 | 1a6c0886 | j_mayer | static void ref405ep_fpga_writel (void *opaque, |
131 | c227f099 | Anthony Liguori | target_phys_addr_t addr, uint32_t value) |
132 | 1a6c0886 | j_mayer | { |
133 | 8de24106 | aurel32 | ref405ep_fpga_writeb(opaque, addr, (value >> 24) & 0xFF); |
134 | 8de24106 | aurel32 | ref405ep_fpga_writeb(opaque, addr + 1, (value >> 16) & 0xFF); |
135 | 8de24106 | aurel32 | ref405ep_fpga_writeb(opaque, addr + 2, (value >> 8) & 0xFF); |
136 | 1a6c0886 | j_mayer | ref405ep_fpga_writeb(opaque, addr + 3, value & 0xFF); |
137 | 1a6c0886 | j_mayer | } |
138 | 1a6c0886 | j_mayer | |
139 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const ref405ep_fpga_read[] = { |
140 | 1a6c0886 | j_mayer | &ref405ep_fpga_readb, |
141 | 1a6c0886 | j_mayer | &ref405ep_fpga_readw, |
142 | 1a6c0886 | j_mayer | &ref405ep_fpga_readl, |
143 | 1a6c0886 | j_mayer | }; |
144 | 1a6c0886 | j_mayer | |
145 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const ref405ep_fpga_write[] = { |
146 | 1a6c0886 | j_mayer | &ref405ep_fpga_writeb, |
147 | 1a6c0886 | j_mayer | &ref405ep_fpga_writew, |
148 | 1a6c0886 | j_mayer | &ref405ep_fpga_writel, |
149 | 1a6c0886 | j_mayer | }; |
150 | 1a6c0886 | j_mayer | |
151 | 1a6c0886 | j_mayer | static void ref405ep_fpga_reset (void *opaque) |
152 | 1a6c0886 | j_mayer | { |
153 | c227f099 | Anthony Liguori | ref405ep_fpga_t *fpga; |
154 | 1a6c0886 | j_mayer | |
155 | 1a6c0886 | j_mayer | fpga = opaque; |
156 | 1a6c0886 | j_mayer | fpga->reg0 = 0x00;
|
157 | 1a6c0886 | j_mayer | fpga->reg1 = 0x0F;
|
158 | 1a6c0886 | j_mayer | } |
159 | 1a6c0886 | j_mayer | |
160 | 1a6c0886 | j_mayer | static void ref405ep_fpga_init (uint32_t base) |
161 | 1a6c0886 | j_mayer | { |
162 | c227f099 | Anthony Liguori | ref405ep_fpga_t *fpga; |
163 | 1a6c0886 | j_mayer | int fpga_memory;
|
164 | 1a6c0886 | j_mayer | |
165 | c227f099 | Anthony Liguori | fpga = qemu_mallocz(sizeof(ref405ep_fpga_t));
|
166 | 1eed09cb | Avi Kivity | fpga_memory = cpu_register_io_memory(ref405ep_fpga_read, |
167 | 487414f1 | aliguori | ref405ep_fpga_write, fpga); |
168 | 487414f1 | aliguori | cpu_register_physical_memory(base, 0x00000100, fpga_memory);
|
169 | a08d4367 | Jan Kiszka | qemu_register_reset(&ref405ep_fpga_reset, fpga); |
170 | 1a6c0886 | j_mayer | } |
171 | 1a6c0886 | j_mayer | |
172 | c227f099 | Anthony Liguori | static void ref405ep_init (ram_addr_t ram_size, |
173 | 3023f332 | aliguori | const char *boot_device, |
174 | 5fafdf24 | ths | const char *kernel_filename, |
175 | 1a6c0886 | j_mayer | const char *kernel_cmdline, |
176 | 1a6c0886 | j_mayer | const char *initrd_filename, |
177 | 1a6c0886 | j_mayer | const char *cpu_model) |
178 | 1a6c0886 | j_mayer | { |
179 | 5cea8590 | Paul Brook | char *filename;
|
180 | c227f099 | Anthony Liguori | ppc4xx_bd_info_t bd; |
181 | 1a6c0886 | j_mayer | CPUPPCState *env; |
182 | 1a6c0886 | j_mayer | qemu_irq *pic; |
183 | c227f099 | Anthony Liguori | ram_addr_t sram_offset, bios_offset, bdloc; |
184 | c227f099 | Anthony Liguori | target_phys_addr_t ram_bases[2], ram_sizes[2]; |
185 | 093209cd | Blue Swirl | target_ulong sram_size; |
186 | 093209cd | Blue Swirl | long bios_size;
|
187 | 1a6c0886 | j_mayer | //int phy_addr = 0;
|
188 | 1a6c0886 | j_mayer | //static int phy_addr = 1;
|
189 | 093209cd | Blue Swirl | target_ulong kernel_base, initrd_base; |
190 | 093209cd | Blue Swirl | long kernel_size, initrd_size;
|
191 | 1a6c0886 | j_mayer | int linux_boot;
|
192 | 1a6c0886 | j_mayer | int fl_idx, fl_sectors, len;
|
193 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
194 | 1a6c0886 | j_mayer | |
195 | 1a6c0886 | j_mayer | /* XXX: fix this */
|
196 | 1724f049 | Alex Williamson | ram_bases[0] = qemu_ram_alloc(NULL, "ef405ep.ram", 0x08000000); |
197 | 1a6c0886 | j_mayer | ram_sizes[0] = 0x08000000; |
198 | 1a6c0886 | j_mayer | ram_bases[1] = 0x00000000; |
199 | 1a6c0886 | j_mayer | ram_sizes[1] = 0x00000000; |
200 | 1a6c0886 | j_mayer | ram_size = 128 * 1024 * 1024; |
201 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
202 | 1a6c0886 | j_mayer | printf("%s: register cpu\n", __func__);
|
203 | 1a6c0886 | j_mayer | #endif
|
204 | 5c130f65 | pbrook | env = ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,
|
205 | 1a6c0886 | j_mayer | kernel_filename == NULL ? 0 : 1); |
206 | 1a6c0886 | j_mayer | /* allocate SRAM */
|
207 | 5c130f65 | pbrook | sram_size = 512 * 1024; |
208 | 1724f049 | Alex Williamson | sram_offset = qemu_ram_alloc(NULL, "ef405ep.sram", sram_size); |
209 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
210 | 1a6c0886 | j_mayer | printf("%s: register SRAM at offset %08lx\n", __func__, sram_offset);
|
211 | 1a6c0886 | j_mayer | #endif
|
212 | 1a6c0886 | j_mayer | cpu_register_physical_memory(0xFFF00000, sram_size,
|
213 | 1a6c0886 | j_mayer | sram_offset | IO_MEM_RAM); |
214 | 1a6c0886 | j_mayer | /* allocate and load BIOS */
|
215 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
216 | 1a6c0886 | j_mayer | printf("%s: register BIOS\n", __func__);
|
217 | 1a6c0886 | j_mayer | #endif
|
218 | 1a6c0886 | j_mayer | fl_idx = 0;
|
219 | 1a6c0886 | j_mayer | #ifdef USE_FLASH_BIOS
|
220 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_PFLASH, 0, fl_idx);
|
221 | 751c6a17 | Gerd Hoffmann | if (dinfo) {
|
222 | 751c6a17 | Gerd Hoffmann | bios_size = bdrv_getlength(dinfo->bdrv); |
223 | 1724f049 | Alex Williamson | bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", bios_size); |
224 | 1a6c0886 | j_mayer | fl_sectors = (bios_size + 65535) >> 16; |
225 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
226 | 093209cd | Blue Swirl | printf("Register parallel flash %d size %lx"
|
227 | 093209cd | Blue Swirl | " at offset %08lx addr %lx '%s' %d\n",
|
228 | 1a6c0886 | j_mayer | fl_idx, bios_size, bios_offset, -bios_size, |
229 | 751c6a17 | Gerd Hoffmann | bdrv_get_device_name(dinfo->bdrv), fl_sectors); |
230 | 1a6c0886 | j_mayer | #endif
|
231 | 88eeee0a | balrog | pflash_cfi02_register((uint32_t)(-bios_size), bios_offset, |
232 | 751c6a17 | Gerd Hoffmann | dinfo->bdrv, 65536, fl_sectors, 1, |
233 | 5f9fc5ad | Blue Swirl | 2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, |
234 | 5f9fc5ad | Blue Swirl | 1);
|
235 | 1a6c0886 | j_mayer | fl_idx++; |
236 | 1a6c0886 | j_mayer | } else
|
237 | 1a6c0886 | j_mayer | #endif
|
238 | 1a6c0886 | j_mayer | { |
239 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
240 | 1a6c0886 | j_mayer | printf("Load BIOS from file\n");
|
241 | 1a6c0886 | j_mayer | #endif
|
242 | 1724f049 | Alex Williamson | bios_offset = qemu_ram_alloc(NULL, "ef405ep.bios", BIOS_SIZE); |
243 | 1192dad8 | j_mayer | if (bios_name == NULL) |
244 | 1192dad8 | j_mayer | bios_name = BIOS_FILENAME; |
245 | 5cea8590 | Paul Brook | filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); |
246 | 5cea8590 | Paul Brook | if (filename) {
|
247 | 5cea8590 | Paul Brook | bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset)); |
248 | 5cea8590 | Paul Brook | qemu_free(filename); |
249 | 5cea8590 | Paul Brook | } else {
|
250 | 5cea8590 | Paul Brook | bios_size = -1;
|
251 | 5cea8590 | Paul Brook | } |
252 | 1a6c0886 | j_mayer | if (bios_size < 0 || bios_size > BIOS_SIZE) { |
253 | 5cea8590 | Paul Brook | fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
|
254 | 5cea8590 | Paul Brook | bios_name); |
255 | 1a6c0886 | j_mayer | exit(1);
|
256 | 1a6c0886 | j_mayer | } |
257 | 1a6c0886 | j_mayer | bios_size = (bios_size + 0xfff) & ~0xfff; |
258 | 5fafdf24 | ths | cpu_register_physical_memory((uint32_t)(-bios_size), |
259 | 1a6c0886 | j_mayer | bios_size, bios_offset | IO_MEM_ROM); |
260 | 1a6c0886 | j_mayer | } |
261 | 1a6c0886 | j_mayer | /* Register FPGA */
|
262 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
263 | 1a6c0886 | j_mayer | printf("%s: register FPGA\n", __func__);
|
264 | 1a6c0886 | j_mayer | #endif
|
265 | 1a6c0886 | j_mayer | ref405ep_fpga_init(0xF0300000);
|
266 | 1a6c0886 | j_mayer | /* Register NVRAM */
|
267 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
268 | 1a6c0886 | j_mayer | printf("%s: register NVRAM\n", __func__);
|
269 | 1a6c0886 | j_mayer | #endif
|
270 | 1a6c0886 | j_mayer | m48t59_init(NULL, 0xF0000000, 0, 8192, 8); |
271 | 1a6c0886 | j_mayer | /* Load kernel */
|
272 | 1a6c0886 | j_mayer | linux_boot = (kernel_filename != NULL);
|
273 | 1a6c0886 | j_mayer | if (linux_boot) {
|
274 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
275 | 1a6c0886 | j_mayer | printf("%s: load kernel\n", __func__);
|
276 | 1a6c0886 | j_mayer | #endif
|
277 | 1a6c0886 | j_mayer | memset(&bd, 0, sizeof(bd)); |
278 | 1a6c0886 | j_mayer | bd.bi_memstart = 0x00000000;
|
279 | 1a6c0886 | j_mayer | bd.bi_memsize = ram_size; |
280 | 217fae2d | j_mayer | bd.bi_flashstart = -bios_size; |
281 | 1a6c0886 | j_mayer | bd.bi_flashsize = -bios_size; |
282 | 1a6c0886 | j_mayer | bd.bi_flashoffset = 0;
|
283 | 1a6c0886 | j_mayer | bd.bi_sramstart = 0xFFF00000;
|
284 | 1a6c0886 | j_mayer | bd.bi_sramsize = sram_size; |
285 | 1a6c0886 | j_mayer | bd.bi_bootflags = 0;
|
286 | 1a6c0886 | j_mayer | bd.bi_intfreq = 133333333;
|
287 | 1a6c0886 | j_mayer | bd.bi_busfreq = 33333333;
|
288 | 1a6c0886 | j_mayer | bd.bi_baudrate = 115200;
|
289 | 1a6c0886 | j_mayer | bd.bi_s_version[0] = 'Q'; |
290 | 1a6c0886 | j_mayer | bd.bi_s_version[1] = 'M'; |
291 | 1a6c0886 | j_mayer | bd.bi_s_version[2] = 'U'; |
292 | 1a6c0886 | j_mayer | bd.bi_s_version[3] = '\0'; |
293 | 1a6c0886 | j_mayer | bd.bi_r_version[0] = 'Q'; |
294 | 1a6c0886 | j_mayer | bd.bi_r_version[1] = 'E'; |
295 | 1a6c0886 | j_mayer | bd.bi_r_version[2] = 'M'; |
296 | 1a6c0886 | j_mayer | bd.bi_r_version[3] = 'U'; |
297 | 1a6c0886 | j_mayer | bd.bi_r_version[4] = '\0'; |
298 | 1a6c0886 | j_mayer | bd.bi_procfreq = 133333333;
|
299 | 1a6c0886 | j_mayer | bd.bi_plb_busfreq = 33333333;
|
300 | 1a6c0886 | j_mayer | bd.bi_pci_busfreq = 33333333;
|
301 | 1a6c0886 | j_mayer | bd.bi_opbfreq = 33333333;
|
302 | b8d3f5d1 | j_mayer | bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001);
|
303 | 1a6c0886 | j_mayer | env->gpr[3] = bdloc;
|
304 | 1a6c0886 | j_mayer | kernel_base = KERNEL_LOAD_ADDR; |
305 | 1a6c0886 | j_mayer | /* now we can load the kernel */
|
306 | 5c130f65 | pbrook | kernel_size = load_image_targphys(kernel_filename, kernel_base, |
307 | 5c130f65 | pbrook | ram_size - kernel_base); |
308 | 1a6c0886 | j_mayer | if (kernel_size < 0) { |
309 | 5fafdf24 | ths | fprintf(stderr, "qemu: could not load kernel '%s'\n",
|
310 | 1a6c0886 | j_mayer | kernel_filename); |
311 | 1a6c0886 | j_mayer | exit(1);
|
312 | 1a6c0886 | j_mayer | } |
313 | 093209cd | Blue Swirl | printf("Load kernel size %ld at " TARGET_FMT_lx,
|
314 | 5c130f65 | pbrook | kernel_size, kernel_base); |
315 | 1a6c0886 | j_mayer | /* load initrd */
|
316 | 1a6c0886 | j_mayer | if (initrd_filename) {
|
317 | 1a6c0886 | j_mayer | initrd_base = INITRD_LOAD_ADDR; |
318 | 5c130f65 | pbrook | initrd_size = load_image_targphys(initrd_filename, initrd_base, |
319 | 5c130f65 | pbrook | ram_size - initrd_base); |
320 | 1a6c0886 | j_mayer | if (initrd_size < 0) { |
321 | 5fafdf24 | ths | fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
|
322 | 1a6c0886 | j_mayer | initrd_filename); |
323 | 1a6c0886 | j_mayer | exit(1);
|
324 | 1a6c0886 | j_mayer | } |
325 | 1a6c0886 | j_mayer | } else {
|
326 | 1a6c0886 | j_mayer | initrd_base = 0;
|
327 | 1a6c0886 | j_mayer | initrd_size = 0;
|
328 | 1a6c0886 | j_mayer | } |
329 | 1a6c0886 | j_mayer | env->gpr[4] = initrd_base;
|
330 | 1a6c0886 | j_mayer | env->gpr[5] = initrd_size;
|
331 | 1a6c0886 | j_mayer | if (kernel_cmdline != NULL) { |
332 | 1a6c0886 | j_mayer | len = strlen(kernel_cmdline); |
333 | 1a6c0886 | j_mayer | bdloc -= ((len + 255) & ~255); |
334 | 5c130f65 | pbrook | cpu_physical_memory_write(bdloc, (void *)kernel_cmdline, len + 1); |
335 | 1a6c0886 | j_mayer | env->gpr[6] = bdloc;
|
336 | 1a6c0886 | j_mayer | env->gpr[7] = bdloc + len;
|
337 | 1a6c0886 | j_mayer | } else {
|
338 | 1a6c0886 | j_mayer | env->gpr[6] = 0; |
339 | 1a6c0886 | j_mayer | env->gpr[7] = 0; |
340 | 1a6c0886 | j_mayer | } |
341 | 1a6c0886 | j_mayer | env->nip = KERNEL_LOAD_ADDR; |
342 | 1a6c0886 | j_mayer | } else {
|
343 | 1a6c0886 | j_mayer | kernel_base = 0;
|
344 | 1a6c0886 | j_mayer | kernel_size = 0;
|
345 | 1a6c0886 | j_mayer | initrd_base = 0;
|
346 | 1a6c0886 | j_mayer | initrd_size = 0;
|
347 | 1a6c0886 | j_mayer | bdloc = 0;
|
348 | 1a6c0886 | j_mayer | } |
349 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
350 | 1a6c0886 | j_mayer | printf("%s: Done\n", __func__);
|
351 | 1a6c0886 | j_mayer | #endif
|
352 | 5c130f65 | pbrook | printf("bdloc %016lx\n", (unsigned long)bdloc); |
353 | 1a6c0886 | j_mayer | } |
354 | 1a6c0886 | j_mayer | |
355 | f80f9ec9 | Anthony Liguori | static QEMUMachine ref405ep_machine = {
|
356 | 4b32e168 | aliguori | .name = "ref405ep",
|
357 | 4b32e168 | aliguori | .desc = "ref405ep",
|
358 | 4b32e168 | aliguori | .init = ref405ep_init, |
359 | 1a6c0886 | j_mayer | }; |
360 | 1a6c0886 | j_mayer | |
361 | 1a6c0886 | j_mayer | /*****************************************************************************/
|
362 | 1a6c0886 | j_mayer | /* AMCC Taihu evaluation board */
|
363 | 1a6c0886 | j_mayer | /* - PowerPC 405EP processor
|
364 | 1a6c0886 | j_mayer | * - SDRAM 128 MB at 0x00000000
|
365 | 1a6c0886 | j_mayer | * - Boot flash 2 MB at 0xFFE00000
|
366 | 1a6c0886 | j_mayer | * - Application flash 32 MB at 0xFC000000
|
367 | 1a6c0886 | j_mayer | * - 2 serial ports
|
368 | 1a6c0886 | j_mayer | * - 2 ethernet PHY
|
369 | 1a6c0886 | j_mayer | * - 1 USB 1.1 device 0x50000000
|
370 | 1a6c0886 | j_mayer | * - 1 LCD display 0x50100000
|
371 | 1a6c0886 | j_mayer | * - 1 CPLD 0x50100000
|
372 | 1a6c0886 | j_mayer | * - 1 I2C EEPROM
|
373 | 1a6c0886 | j_mayer | * - 1 I2C thermal sensor
|
374 | 1a6c0886 | j_mayer | * - a set of LEDs
|
375 | 1a6c0886 | j_mayer | * - bit-bang SPI port using GPIOs
|
376 | 1a6c0886 | j_mayer | * - 1 EBC interface connector 0 0x50200000
|
377 | 1a6c0886 | j_mayer | * - 1 cardbus controller + expansion slot.
|
378 | 1a6c0886 | j_mayer | * - 1 PCI expansion slot.
|
379 | 1a6c0886 | j_mayer | */
|
380 | 1a6c0886 | j_mayer | typedef struct taihu_cpld_t taihu_cpld_t; |
381 | 1a6c0886 | j_mayer | struct taihu_cpld_t {
|
382 | 1a6c0886 | j_mayer | uint8_t reg0; |
383 | 1a6c0886 | j_mayer | uint8_t reg1; |
384 | 1a6c0886 | j_mayer | }; |
385 | 1a6c0886 | j_mayer | |
386 | c227f099 | Anthony Liguori | static uint32_t taihu_cpld_readb (void *opaque, target_phys_addr_t addr) |
387 | 1a6c0886 | j_mayer | { |
388 | 1a6c0886 | j_mayer | taihu_cpld_t *cpld; |
389 | 1a6c0886 | j_mayer | uint32_t ret; |
390 | 1a6c0886 | j_mayer | |
391 | 1a6c0886 | j_mayer | cpld = opaque; |
392 | 1a6c0886 | j_mayer | switch (addr) {
|
393 | 1a6c0886 | j_mayer | case 0x0: |
394 | 1a6c0886 | j_mayer | ret = cpld->reg0; |
395 | 1a6c0886 | j_mayer | break;
|
396 | 1a6c0886 | j_mayer | case 0x1: |
397 | 1a6c0886 | j_mayer | ret = cpld->reg1; |
398 | 1a6c0886 | j_mayer | break;
|
399 | 1a6c0886 | j_mayer | default:
|
400 | 1a6c0886 | j_mayer | ret = 0;
|
401 | 1a6c0886 | j_mayer | break;
|
402 | 1a6c0886 | j_mayer | } |
403 | 1a6c0886 | j_mayer | |
404 | 1a6c0886 | j_mayer | return ret;
|
405 | 1a6c0886 | j_mayer | } |
406 | 1a6c0886 | j_mayer | |
407 | 1a6c0886 | j_mayer | static void taihu_cpld_writeb (void *opaque, |
408 | c227f099 | Anthony Liguori | target_phys_addr_t addr, uint32_t value) |
409 | 1a6c0886 | j_mayer | { |
410 | 1a6c0886 | j_mayer | taihu_cpld_t *cpld; |
411 | 1a6c0886 | j_mayer | |
412 | 1a6c0886 | j_mayer | cpld = opaque; |
413 | 1a6c0886 | j_mayer | switch (addr) {
|
414 | 1a6c0886 | j_mayer | case 0x0: |
415 | 1a6c0886 | j_mayer | /* Read only */
|
416 | 1a6c0886 | j_mayer | break;
|
417 | 1a6c0886 | j_mayer | case 0x1: |
418 | 1a6c0886 | j_mayer | cpld->reg1 = value; |
419 | 1a6c0886 | j_mayer | break;
|
420 | 1a6c0886 | j_mayer | default:
|
421 | 1a6c0886 | j_mayer | break;
|
422 | 1a6c0886 | j_mayer | } |
423 | 1a6c0886 | j_mayer | } |
424 | 1a6c0886 | j_mayer | |
425 | c227f099 | Anthony Liguori | static uint32_t taihu_cpld_readw (void *opaque, target_phys_addr_t addr) |
426 | 1a6c0886 | j_mayer | { |
427 | 1a6c0886 | j_mayer | uint32_t ret; |
428 | 1a6c0886 | j_mayer | |
429 | 1a6c0886 | j_mayer | ret = taihu_cpld_readb(opaque, addr) << 8;
|
430 | 1a6c0886 | j_mayer | ret |= taihu_cpld_readb(opaque, addr + 1);
|
431 | 1a6c0886 | j_mayer | |
432 | 1a6c0886 | j_mayer | return ret;
|
433 | 1a6c0886 | j_mayer | } |
434 | 1a6c0886 | j_mayer | |
435 | 1a6c0886 | j_mayer | static void taihu_cpld_writew (void *opaque, |
436 | c227f099 | Anthony Liguori | target_phys_addr_t addr, uint32_t value) |
437 | 1a6c0886 | j_mayer | { |
438 | 1a6c0886 | j_mayer | taihu_cpld_writeb(opaque, addr, (value >> 8) & 0xFF); |
439 | 1a6c0886 | j_mayer | taihu_cpld_writeb(opaque, addr + 1, value & 0xFF); |
440 | 1a6c0886 | j_mayer | } |
441 | 1a6c0886 | j_mayer | |
442 | c227f099 | Anthony Liguori | static uint32_t taihu_cpld_readl (void *opaque, target_phys_addr_t addr) |
443 | 1a6c0886 | j_mayer | { |
444 | 1a6c0886 | j_mayer | uint32_t ret; |
445 | 1a6c0886 | j_mayer | |
446 | 1a6c0886 | j_mayer | ret = taihu_cpld_readb(opaque, addr) << 24;
|
447 | 1a6c0886 | j_mayer | ret |= taihu_cpld_readb(opaque, addr + 1) << 16; |
448 | 1a6c0886 | j_mayer | ret |= taihu_cpld_readb(opaque, addr + 2) << 8; |
449 | 1a6c0886 | j_mayer | ret |= taihu_cpld_readb(opaque, addr + 3);
|
450 | 1a6c0886 | j_mayer | |
451 | 1a6c0886 | j_mayer | return ret;
|
452 | 1a6c0886 | j_mayer | } |
453 | 1a6c0886 | j_mayer | |
454 | 1a6c0886 | j_mayer | static void taihu_cpld_writel (void *opaque, |
455 | c227f099 | Anthony Liguori | target_phys_addr_t addr, uint32_t value) |
456 | 1a6c0886 | j_mayer | { |
457 | 1a6c0886 | j_mayer | taihu_cpld_writel(opaque, addr, (value >> 24) & 0xFF); |
458 | 1a6c0886 | j_mayer | taihu_cpld_writel(opaque, addr + 1, (value >> 16) & 0xFF); |
459 | 1a6c0886 | j_mayer | taihu_cpld_writel(opaque, addr + 2, (value >> 8) & 0xFF); |
460 | 1a6c0886 | j_mayer | taihu_cpld_writeb(opaque, addr + 3, value & 0xFF); |
461 | 1a6c0886 | j_mayer | } |
462 | 1a6c0886 | j_mayer | |
463 | d60efc6b | Blue Swirl | static CPUReadMemoryFunc * const taihu_cpld_read[] = { |
464 | 1a6c0886 | j_mayer | &taihu_cpld_readb, |
465 | 1a6c0886 | j_mayer | &taihu_cpld_readw, |
466 | 1a6c0886 | j_mayer | &taihu_cpld_readl, |
467 | 1a6c0886 | j_mayer | }; |
468 | 1a6c0886 | j_mayer | |
469 | d60efc6b | Blue Swirl | static CPUWriteMemoryFunc * const taihu_cpld_write[] = { |
470 | 1a6c0886 | j_mayer | &taihu_cpld_writeb, |
471 | 1a6c0886 | j_mayer | &taihu_cpld_writew, |
472 | 1a6c0886 | j_mayer | &taihu_cpld_writel, |
473 | 1a6c0886 | j_mayer | }; |
474 | 1a6c0886 | j_mayer | |
475 | 1a6c0886 | j_mayer | static void taihu_cpld_reset (void *opaque) |
476 | 1a6c0886 | j_mayer | { |
477 | 1a6c0886 | j_mayer | taihu_cpld_t *cpld; |
478 | 1a6c0886 | j_mayer | |
479 | 1a6c0886 | j_mayer | cpld = opaque; |
480 | 1a6c0886 | j_mayer | cpld->reg0 = 0x01;
|
481 | 1a6c0886 | j_mayer | cpld->reg1 = 0x80;
|
482 | 1a6c0886 | j_mayer | } |
483 | 1a6c0886 | j_mayer | |
484 | 1a6c0886 | j_mayer | static void taihu_cpld_init (uint32_t base) |
485 | 1a6c0886 | j_mayer | { |
486 | 1a6c0886 | j_mayer | taihu_cpld_t *cpld; |
487 | 1a6c0886 | j_mayer | int cpld_memory;
|
488 | 1a6c0886 | j_mayer | |
489 | 1a6c0886 | j_mayer | cpld = qemu_mallocz(sizeof(taihu_cpld_t));
|
490 | 1eed09cb | Avi Kivity | cpld_memory = cpu_register_io_memory(taihu_cpld_read, |
491 | 487414f1 | aliguori | taihu_cpld_write, cpld); |
492 | 487414f1 | aliguori | cpu_register_physical_memory(base, 0x00000100, cpld_memory);
|
493 | a08d4367 | Jan Kiszka | qemu_register_reset(&taihu_cpld_reset, cpld); |
494 | 1a6c0886 | j_mayer | } |
495 | 1a6c0886 | j_mayer | |
496 | c227f099 | Anthony Liguori | static void taihu_405ep_init(ram_addr_t ram_size, |
497 | 3023f332 | aliguori | const char *boot_device, |
498 | 5fafdf24 | ths | const char *kernel_filename, |
499 | 1a6c0886 | j_mayer | const char *kernel_cmdline, |
500 | 1a6c0886 | j_mayer | const char *initrd_filename, |
501 | 1a6c0886 | j_mayer | const char *cpu_model) |
502 | 1a6c0886 | j_mayer | { |
503 | 5cea8590 | Paul Brook | char *filename;
|
504 | 1a6c0886 | j_mayer | qemu_irq *pic; |
505 | c227f099 | Anthony Liguori | ram_addr_t bios_offset; |
506 | c227f099 | Anthony Liguori | target_phys_addr_t ram_bases[2], ram_sizes[2]; |
507 | 093209cd | Blue Swirl | long bios_size;
|
508 | 093209cd | Blue Swirl | target_ulong kernel_base, initrd_base; |
509 | 093209cd | Blue Swirl | long kernel_size, initrd_size;
|
510 | 1a6c0886 | j_mayer | int linux_boot;
|
511 | 1a6c0886 | j_mayer | int fl_idx, fl_sectors;
|
512 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
513 | 3b46e624 | ths | |
514 | 1a6c0886 | j_mayer | /* RAM is soldered to the board so the size cannot be changed */
|
515 | 1724f049 | Alex Williamson | ram_bases[0] = qemu_ram_alloc(NULL, "taihu_405ep.ram-0", 0x04000000); |
516 | 1a6c0886 | j_mayer | ram_sizes[0] = 0x04000000; |
517 | 1724f049 | Alex Williamson | ram_bases[1] = qemu_ram_alloc(NULL, "taihu_405ep.ram-1", 0x04000000); |
518 | 1a6c0886 | j_mayer | ram_sizes[1] = 0x04000000; |
519 | a0b753df | pbrook | ram_size = 0x08000000;
|
520 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
521 | 1a6c0886 | j_mayer | printf("%s: register cpu\n", __func__);
|
522 | 1a6c0886 | j_mayer | #endif
|
523 | 49a2942d | Blue Swirl | ppc405ep_init(ram_bases, ram_sizes, 33333333, &pic,
|
524 | 49a2942d | Blue Swirl | kernel_filename == NULL ? 0 : 1); |
525 | 1a6c0886 | j_mayer | /* allocate and load BIOS */
|
526 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
527 | 1a6c0886 | j_mayer | printf("%s: register BIOS\n", __func__);
|
528 | 1a6c0886 | j_mayer | #endif
|
529 | 1a6c0886 | j_mayer | fl_idx = 0;
|
530 | 1a6c0886 | j_mayer | #if defined(USE_FLASH_BIOS)
|
531 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_PFLASH, 0, fl_idx);
|
532 | 751c6a17 | Gerd Hoffmann | if (dinfo) {
|
533 | 751c6a17 | Gerd Hoffmann | bios_size = bdrv_getlength(dinfo->bdrv); |
534 | 1a6c0886 | j_mayer | /* XXX: should check that size is 2MB */
|
535 | 1a6c0886 | j_mayer | // bios_size = 2 * 1024 * 1024;
|
536 | 1a6c0886 | j_mayer | fl_sectors = (bios_size + 65535) >> 16; |
537 | 1724f049 | Alex Williamson | bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", bios_size); |
538 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
539 | 093209cd | Blue Swirl | printf("Register parallel flash %d size %lx"
|
540 | 093209cd | Blue Swirl | " at offset %08lx addr %lx '%s' %d\n",
|
541 | 1a6c0886 | j_mayer | fl_idx, bios_size, bios_offset, -bios_size, |
542 | 751c6a17 | Gerd Hoffmann | bdrv_get_device_name(dinfo->bdrv), fl_sectors); |
543 | 1a6c0886 | j_mayer | #endif
|
544 | 88eeee0a | balrog | pflash_cfi02_register((uint32_t)(-bios_size), bios_offset, |
545 | 751c6a17 | Gerd Hoffmann | dinfo->bdrv, 65536, fl_sectors, 1, |
546 | 5f9fc5ad | Blue Swirl | 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, |
547 | 5f9fc5ad | Blue Swirl | 1);
|
548 | 1a6c0886 | j_mayer | fl_idx++; |
549 | 1a6c0886 | j_mayer | } else
|
550 | 1a6c0886 | j_mayer | #endif
|
551 | 1a6c0886 | j_mayer | { |
552 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
553 | 1a6c0886 | j_mayer | printf("Load BIOS from file\n");
|
554 | 1a6c0886 | j_mayer | #endif
|
555 | 1192dad8 | j_mayer | if (bios_name == NULL) |
556 | 1192dad8 | j_mayer | bios_name = BIOS_FILENAME; |
557 | 1724f049 | Alex Williamson | bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.bios", BIOS_SIZE); |
558 | 5cea8590 | Paul Brook | filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); |
559 | 5cea8590 | Paul Brook | if (filename) {
|
560 | 5cea8590 | Paul Brook | bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset)); |
561 | 5cea8590 | Paul Brook | } else {
|
562 | 5cea8590 | Paul Brook | bios_size = -1;
|
563 | 5cea8590 | Paul Brook | } |
564 | 1a6c0886 | j_mayer | if (bios_size < 0 || bios_size > BIOS_SIZE) { |
565 | 5cea8590 | Paul Brook | fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
|
566 | 5cea8590 | Paul Brook | bios_name); |
567 | 1a6c0886 | j_mayer | exit(1);
|
568 | 1a6c0886 | j_mayer | } |
569 | 1a6c0886 | j_mayer | bios_size = (bios_size + 0xfff) & ~0xfff; |
570 | 5fafdf24 | ths | cpu_register_physical_memory((uint32_t)(-bios_size), |
571 | 1a6c0886 | j_mayer | bios_size, bios_offset | IO_MEM_ROM); |
572 | 1a6c0886 | j_mayer | } |
573 | 1a6c0886 | j_mayer | /* Register Linux flash */
|
574 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_PFLASH, 0, fl_idx);
|
575 | 751c6a17 | Gerd Hoffmann | if (dinfo) {
|
576 | 751c6a17 | Gerd Hoffmann | bios_size = bdrv_getlength(dinfo->bdrv); |
577 | 1a6c0886 | j_mayer | /* XXX: should check that size is 32MB */
|
578 | 1a6c0886 | j_mayer | bios_size = 32 * 1024 * 1024; |
579 | 1a6c0886 | j_mayer | fl_sectors = (bios_size + 65535) >> 16; |
580 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
581 | 093209cd | Blue Swirl | printf("Register parallel flash %d size %lx"
|
582 | 90e189ec | Blue Swirl | " at offset %08lx addr " TARGET_FMT_lx " '%s'\n", |
583 | 1a6c0886 | j_mayer | fl_idx, bios_size, bios_offset, (target_ulong)0xfc000000,
|
584 | 751c6a17 | Gerd Hoffmann | bdrv_get_device_name(dinfo->bdrv)); |
585 | 1a6c0886 | j_mayer | #endif
|
586 | 1724f049 | Alex Williamson | bios_offset = qemu_ram_alloc(NULL, "taihu_405ep.flash", bios_size); |
587 | 88eeee0a | balrog | pflash_cfi02_register(0xfc000000, bios_offset,
|
588 | 751c6a17 | Gerd Hoffmann | dinfo->bdrv, 65536, fl_sectors, 1, |
589 | 5f9fc5ad | Blue Swirl | 4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA, |
590 | 5f9fc5ad | Blue Swirl | 1);
|
591 | 1a6c0886 | j_mayer | fl_idx++; |
592 | 1a6c0886 | j_mayer | } |
593 | 1a6c0886 | j_mayer | /* Register CLPD & LCD display */
|
594 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
595 | 1a6c0886 | j_mayer | printf("%s: register CPLD\n", __func__);
|
596 | 1a6c0886 | j_mayer | #endif
|
597 | 1a6c0886 | j_mayer | taihu_cpld_init(0x50100000);
|
598 | 1a6c0886 | j_mayer | /* Load kernel */
|
599 | 1a6c0886 | j_mayer | linux_boot = (kernel_filename != NULL);
|
600 | 1a6c0886 | j_mayer | if (linux_boot) {
|
601 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
602 | 1a6c0886 | j_mayer | printf("%s: load kernel\n", __func__);
|
603 | 1a6c0886 | j_mayer | #endif
|
604 | 1a6c0886 | j_mayer | kernel_base = KERNEL_LOAD_ADDR; |
605 | 1a6c0886 | j_mayer | /* now we can load the kernel */
|
606 | 5c130f65 | pbrook | kernel_size = load_image_targphys(kernel_filename, kernel_base, |
607 | 5c130f65 | pbrook | ram_size - kernel_base); |
608 | 1a6c0886 | j_mayer | if (kernel_size < 0) { |
609 | 5fafdf24 | ths | fprintf(stderr, "qemu: could not load kernel '%s'\n",
|
610 | 1a6c0886 | j_mayer | kernel_filename); |
611 | 1a6c0886 | j_mayer | exit(1);
|
612 | 1a6c0886 | j_mayer | } |
613 | 1a6c0886 | j_mayer | /* load initrd */
|
614 | 1a6c0886 | j_mayer | if (initrd_filename) {
|
615 | 1a6c0886 | j_mayer | initrd_base = INITRD_LOAD_ADDR; |
616 | 5c130f65 | pbrook | initrd_size = load_image_targphys(initrd_filename, initrd_base, |
617 | 5c130f65 | pbrook | ram_size - initrd_base); |
618 | 1a6c0886 | j_mayer | if (initrd_size < 0) { |
619 | 1a6c0886 | j_mayer | fprintf(stderr, |
620 | 5fafdf24 | ths | "qemu: could not load initial ram disk '%s'\n",
|
621 | 1a6c0886 | j_mayer | initrd_filename); |
622 | 1a6c0886 | j_mayer | exit(1);
|
623 | 1a6c0886 | j_mayer | } |
624 | 1a6c0886 | j_mayer | } else {
|
625 | 1a6c0886 | j_mayer | initrd_base = 0;
|
626 | 1a6c0886 | j_mayer | initrd_size = 0;
|
627 | 1a6c0886 | j_mayer | } |
628 | 1a6c0886 | j_mayer | } else {
|
629 | 1a6c0886 | j_mayer | kernel_base = 0;
|
630 | 1a6c0886 | j_mayer | kernel_size = 0;
|
631 | 1a6c0886 | j_mayer | initrd_base = 0;
|
632 | 1a6c0886 | j_mayer | initrd_size = 0;
|
633 | 1a6c0886 | j_mayer | } |
634 | 1a6c0886 | j_mayer | #ifdef DEBUG_BOARD_INIT
|
635 | 1a6c0886 | j_mayer | printf("%s: Done\n", __func__);
|
636 | 1a6c0886 | j_mayer | #endif
|
637 | 1a6c0886 | j_mayer | } |
638 | 1a6c0886 | j_mayer | |
639 | f80f9ec9 | Anthony Liguori | static QEMUMachine taihu_machine = {
|
640 | b2ee0ce2 | pbrook | .name = "taihu",
|
641 | b2ee0ce2 | pbrook | .desc = "taihu",
|
642 | b2ee0ce2 | pbrook | .init = taihu_405ep_init, |
643 | 1a6c0886 | j_mayer | }; |
644 | f80f9ec9 | Anthony Liguori | |
645 | f80f9ec9 | Anthony Liguori | static void ppc405_machine_init(void) |
646 | f80f9ec9 | Anthony Liguori | { |
647 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&ref405ep_machine); |
648 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&taihu_machine); |
649 | f80f9ec9 | Anthony Liguori | } |
650 | f80f9ec9 | Anthony Liguori | |
651 | f80f9ec9 | Anthony Liguori | machine_init(ppc405_machine_init); |