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