Statistics
| Branch: | Revision:

root / hw / ppce500_mpc8544ds.c @ 9c8255e1

History | View | Annotate | Download (11.3 kB)

1 1db09b84 aurel32
/*
2 1db09b84 aurel32
 * Qemu PowerPC MPC8544DS board emualtion
3 1db09b84 aurel32
 *
4 1db09b84 aurel32
 * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
5 1db09b84 aurel32
 *
6 1db09b84 aurel32
 * Author: Yu Liu,     <yu.liu@freescale.com>
7 1db09b84 aurel32
 *
8 1db09b84 aurel32
 * This file is derived from hw/ppc440_bamboo.c,
9 1db09b84 aurel32
 * the copyright for that material belongs to the original owners.
10 1db09b84 aurel32
 *
11 1db09b84 aurel32
 * This is free software; you can redistribute it and/or modify
12 1db09b84 aurel32
 * it under the terms of  the GNU General  Public License as published by
13 1db09b84 aurel32
 * the Free Software Foundation;  either version 2 of the  License, or
14 1db09b84 aurel32
 * (at your option) any later version.
15 1db09b84 aurel32
 */
16 1db09b84 aurel32
17 1db09b84 aurel32
#include <dirent.h>
18 1db09b84 aurel32
19 1db09b84 aurel32
#include "config.h"
20 1db09b84 aurel32
#include "qemu-common.h"
21 1db09b84 aurel32
#include "net.h"
22 1db09b84 aurel32
#include "hw.h"
23 1db09b84 aurel32
#include "pc.h"
24 1db09b84 aurel32
#include "pci.h"
25 1db09b84 aurel32
#include "boards.h"
26 1db09b84 aurel32
#include "sysemu.h"
27 1db09b84 aurel32
#include "kvm.h"
28 1db09b84 aurel32
#include "kvm_ppc.h"
29 1db09b84 aurel32
#include "device_tree.h"
30 1db09b84 aurel32
#include "openpic.h"
31 3b989d49 Alexander Graf
#include "ppc.h"
32 ca20cf32 Blue Swirl
#include "loader.h"
33 ca20cf32 Blue Swirl
#include "elf.h"
34 be13cc7a Alexander Graf
#include "sysbus.h"
35 1db09b84 aurel32
36 1db09b84 aurel32
#define BINARY_DEVICE_TREE_FILE    "mpc8544ds.dtb"
37 1db09b84 aurel32
#define UIMAGE_LOAD_BASE           0
38 75bb6589 Liu Yu
#define DTC_LOAD_PAD               0x500000
39 75bb6589 Liu Yu
#define DTC_PAD_MASK               0xFFFFF
40 75bb6589 Liu Yu
#define INITRD_LOAD_PAD            0x2000000
41 75bb6589 Liu Yu
#define INITRD_PAD_MASK            0xFFFFFF
42 1db09b84 aurel32
43 1db09b84 aurel32
#define RAM_SIZES_ALIGN            (64UL << 20)
44 1db09b84 aurel32
45 1db09b84 aurel32
#define MPC8544_CCSRBAR_BASE       0xE0000000
46 1db09b84 aurel32
#define MPC8544_MPIC_REGS_BASE     (MPC8544_CCSRBAR_BASE + 0x40000)
47 1db09b84 aurel32
#define MPC8544_SERIAL0_REGS_BASE  (MPC8544_CCSRBAR_BASE + 0x4500)
48 1db09b84 aurel32
#define MPC8544_SERIAL1_REGS_BASE  (MPC8544_CCSRBAR_BASE + 0x4600)
49 1db09b84 aurel32
#define MPC8544_PCI_REGS_BASE      (MPC8544_CCSRBAR_BASE + 0x8000)
50 1db09b84 aurel32
#define MPC8544_PCI_REGS_SIZE      0x1000
51 1db09b84 aurel32
#define MPC8544_PCI_IO             0xE1000000
52 1db09b84 aurel32
#define MPC8544_PCI_IOLEN          0x10000
53 b0fb8423 Alexander Graf
#define MPC8544_UTIL_BASE          (MPC8544_CCSRBAR_BASE + 0xe0000)
54 1db09b84 aurel32
55 3b989d49 Alexander Graf
struct boot_info
56 3b989d49 Alexander Graf
{
57 3b989d49 Alexander Graf
    uint32_t dt_base;
58 3b989d49 Alexander Graf
    uint32_t entry;
59 3b989d49 Alexander Graf
};
60 3b989d49 Alexander Graf
61 3f0855b1 Juan Quintela
#ifdef CONFIG_FDT
62 1db09b84 aurel32
static int mpc8544_copy_soc_cell(void *fdt, const char *node, const char *prop)
63 1db09b84 aurel32
{
64 1db09b84 aurel32
    uint32_t cell;
65 1db09b84 aurel32
    int ret;
66 1db09b84 aurel32
67 1db09b84 aurel32
    ret = kvmppc_read_host_property(node, prop, &cell, sizeof(cell));
68 1db09b84 aurel32
    if (ret < 0) {
69 1db09b84 aurel32
        fprintf(stderr, "couldn't read host %s/%s\n", node, prop);
70 1db09b84 aurel32
        goto out;
71 1db09b84 aurel32
    }
72 1db09b84 aurel32
73 1db09b84 aurel32
    ret = qemu_devtree_setprop_cell(fdt, "/cpus/PowerPC,8544@0",
74 1db09b84 aurel32
                                prop, cell);
75 1db09b84 aurel32
    if (ret < 0) {
76 1db09b84 aurel32
        fprintf(stderr, "couldn't set guest /cpus/PowerPC,8544@0/%s\n", prop);
77 1db09b84 aurel32
        goto out;
78 1db09b84 aurel32
    }
79 1db09b84 aurel32
80 1db09b84 aurel32
out:
81 1db09b84 aurel32
    return ret;
82 1db09b84 aurel32
}
83 511d2b14 blueswir1
#endif
84 1db09b84 aurel32
85 5de6b46d Alexander Graf
static int mpc8544_load_device_tree(CPUState *env,
86 5de6b46d Alexander Graf
                                    target_phys_addr_t addr,
87 5de6b46d Alexander Graf
                                    uint32_t ramsize,
88 5de6b46d Alexander Graf
                                    target_phys_addr_t initrd_base,
89 5de6b46d Alexander Graf
                                    target_phys_addr_t initrd_size,
90 5de6b46d Alexander Graf
                                    const char *kernel_cmdline)
91 1db09b84 aurel32
{
92 dbf916d8 Aurelien Jarno
    int ret = -1;
93 3f0855b1 Juan Quintela
#ifdef CONFIG_FDT
94 3b989d49 Alexander Graf
    uint32_t mem_reg_property[] = {0, cpu_to_be32(ramsize)};
95 5cea8590 Paul Brook
    char *filename;
96 7ec632b4 pbrook
    int fdt_size;
97 dbf916d8 Aurelien Jarno
    void *fdt;
98 5de6b46d Alexander Graf
    uint8_t hypercall[16];
99 1db09b84 aurel32
100 5cea8590 Paul Brook
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
101 5cea8590 Paul Brook
    if (!filename) {
102 1db09b84 aurel32
        goto out;
103 5cea8590 Paul Brook
    }
104 5cea8590 Paul Brook
    fdt = load_device_tree(filename, &fdt_size);
105 7267c094 Anthony Liguori
    g_free(filename);
106 5cea8590 Paul Brook
    if (fdt == NULL) {
107 5cea8590 Paul Brook
        goto out;
108 5cea8590 Paul Brook
    }
109 1db09b84 aurel32
110 1db09b84 aurel32
    /* Manipulate device tree in memory. */
111 1db09b84 aurel32
    ret = qemu_devtree_setprop(fdt, "/memory", "reg", mem_reg_property,
112 1db09b84 aurel32
                               sizeof(mem_reg_property));
113 1db09b84 aurel32
    if (ret < 0)
114 1db09b84 aurel32
        fprintf(stderr, "couldn't set /memory/reg\n");
115 1db09b84 aurel32
116 3b989d49 Alexander Graf
    if (initrd_size) {
117 3b989d49 Alexander Graf
        ret = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-start",
118 3b989d49 Alexander Graf
                                        initrd_base);
119 3b989d49 Alexander Graf
        if (ret < 0) {
120 3b989d49 Alexander Graf
            fprintf(stderr, "couldn't set /chosen/linux,initrd-start\n");
121 3b989d49 Alexander Graf
        }
122 1db09b84 aurel32
123 3b989d49 Alexander Graf
        ret = qemu_devtree_setprop_cell(fdt, "/chosen", "linux,initrd-end",
124 3b989d49 Alexander Graf
                                        (initrd_base + initrd_size));
125 3b989d49 Alexander Graf
        if (ret < 0) {
126 3b989d49 Alexander Graf
            fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n");
127 3b989d49 Alexander Graf
        }
128 3b989d49 Alexander Graf
    }
129 1db09b84 aurel32
130 1db09b84 aurel32
    ret = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs",
131 1db09b84 aurel32
                                      kernel_cmdline);
132 1db09b84 aurel32
    if (ret < 0)
133 1db09b84 aurel32
        fprintf(stderr, "couldn't set /chosen/bootargs\n");
134 1db09b84 aurel32
135 1db09b84 aurel32
    if (kvm_enabled()) {
136 1db09b84 aurel32
        struct dirent *dirp;
137 1db09b84 aurel32
        DIR *dp;
138 1db09b84 aurel32
        char buf[128];
139 1db09b84 aurel32
140 1db09b84 aurel32
        if ((dp = opendir("/proc/device-tree/cpus/")) == NULL) {
141 1db09b84 aurel32
            printf("Can't open directory /proc/device-tree/cpus/\n");
142 04088adb Liu Yu
            ret = -1;
143 1db09b84 aurel32
            goto out;
144 1db09b84 aurel32
        }
145 1db09b84 aurel32
146 1db09b84 aurel32
        buf[0] = '\0';
147 1db09b84 aurel32
        while ((dirp = readdir(dp)) != NULL) {
148 1db09b84 aurel32
            if (strncmp(dirp->d_name, "PowerPC", 7) == 0) {
149 1db09b84 aurel32
                snprintf(buf, 128, "/cpus/%s", dirp->d_name);
150 1db09b84 aurel32
                break;
151 1db09b84 aurel32
            }
152 1db09b84 aurel32
        }
153 1db09b84 aurel32
        closedir(dp);
154 1db09b84 aurel32
        if (buf[0] == '\0') {
155 1db09b84 aurel32
            printf("Unknow host!\n");
156 04088adb Liu Yu
            ret = -1;
157 1db09b84 aurel32
            goto out;
158 1db09b84 aurel32
        }
159 1db09b84 aurel32
160 1db09b84 aurel32
        mpc8544_copy_soc_cell(fdt, buf, "clock-frequency");
161 1db09b84 aurel32
        mpc8544_copy_soc_cell(fdt, buf, "timebase-frequency");
162 5de6b46d Alexander Graf
163 5de6b46d Alexander Graf
        /* indicate KVM hypercall interface */
164 5de6b46d Alexander Graf
        qemu_devtree_setprop_string(fdt, "/hypervisor", "compatible",
165 5de6b46d Alexander Graf
                                    "linux,kvm");
166 5de6b46d Alexander Graf
        kvmppc_get_hypercall(env, hypercall, sizeof(hypercall));
167 5de6b46d Alexander Graf
        qemu_devtree_setprop(fdt, "/hypervisor", "hcall-instructions",
168 5de6b46d Alexander Graf
                             hypercall, sizeof(hypercall));
169 3b989d49 Alexander Graf
    } else {
170 3b989d49 Alexander Graf
        const uint32_t freq = 400000000;
171 3b989d49 Alexander Graf
172 3b989d49 Alexander Graf
        qemu_devtree_setprop_cell(fdt, "/cpus/PowerPC,8544@0",
173 3b989d49 Alexander Graf
                                  "clock-frequency", freq);
174 3b989d49 Alexander Graf
        qemu_devtree_setprop_cell(fdt, "/cpus/PowerPC,8544@0",
175 3b989d49 Alexander Graf
                                  "timebase-frequency", freq);
176 1db09b84 aurel32
    }
177 1db09b84 aurel32
178 04088adb Liu Yu
    ret = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
179 7267c094 Anthony Liguori
    g_free(fdt);
180 7ec632b4 pbrook
181 1db09b84 aurel32
out:
182 1db09b84 aurel32
#endif
183 1db09b84 aurel32
184 04088adb Liu Yu
    return ret;
185 1db09b84 aurel32
}
186 1db09b84 aurel32
187 3b989d49 Alexander Graf
/* Create -kernel TLB entries for BookE, linearly spanning 256MB.  */
188 d1e256fe Alexander Graf
static inline target_phys_addr_t booke206_page_size_to_tlb(uint64_t size)
189 d1e256fe Alexander Graf
{
190 d1e256fe Alexander Graf
    return (ffs(size >> 10) - 1) >> 1;
191 d1e256fe Alexander Graf
}
192 d1e256fe Alexander Graf
193 3b989d49 Alexander Graf
static void mmubooke_create_initial_mapping(CPUState *env,
194 3b989d49 Alexander Graf
                                     target_ulong va,
195 3b989d49 Alexander Graf
                                     target_phys_addr_t pa)
196 3b989d49 Alexander Graf
{
197 d1e256fe Alexander Graf
    ppcmas_tlb_t *tlb = booke206_get_tlbm(env, 1, 0, 0);
198 d1e256fe Alexander Graf
    target_phys_addr_t size;
199 d1e256fe Alexander Graf
200 d1e256fe Alexander Graf
    size = (booke206_page_size_to_tlb(256 * 1024 * 1024) << MAS1_TSIZE_SHIFT);
201 d1e256fe Alexander Graf
    tlb->mas1 = MAS1_VALID | size;
202 d1e256fe Alexander Graf
    tlb->mas2 = va & TARGET_PAGE_MASK;
203 d1e256fe Alexander Graf
    tlb->mas7_3 = pa & TARGET_PAGE_MASK;
204 d1e256fe Alexander Graf
    tlb->mas7_3 |= MAS3_UR | MAS3_UW | MAS3_UX | MAS3_SR | MAS3_SW | MAS3_SX;
205 3b989d49 Alexander Graf
}
206 3b989d49 Alexander Graf
207 3b989d49 Alexander Graf
static void mpc8544ds_cpu_reset(void *opaque)
208 3b989d49 Alexander Graf
{
209 3b989d49 Alexander Graf
    CPUState *env = opaque;
210 3b989d49 Alexander Graf
    struct boot_info *bi = env->load_info;
211 3b989d49 Alexander Graf
212 3b989d49 Alexander Graf
    cpu_reset(env);
213 3b989d49 Alexander Graf
214 3b989d49 Alexander Graf
    /* Set initial guest state. */
215 3b989d49 Alexander Graf
    env->gpr[1] = (16<<20) - 8;
216 3b989d49 Alexander Graf
    env->gpr[3] = bi->dt_base;
217 3b989d49 Alexander Graf
    env->nip = bi->entry;
218 3b989d49 Alexander Graf
    mmubooke_create_initial_mapping(env, 0, 0);
219 3b989d49 Alexander Graf
}
220 3b989d49 Alexander Graf
221 c227f099 Anthony Liguori
static void mpc8544ds_init(ram_addr_t ram_size,
222 1db09b84 aurel32
                         const char *boot_device,
223 1db09b84 aurel32
                         const char *kernel_filename,
224 1db09b84 aurel32
                         const char *kernel_cmdline,
225 1db09b84 aurel32
                         const char *initrd_filename,
226 1db09b84 aurel32
                         const char *cpu_model)
227 1db09b84 aurel32
{
228 1db09b84 aurel32
    PCIBus *pci_bus;
229 1db09b84 aurel32
    CPUState *env;
230 1db09b84 aurel32
    uint64_t elf_entry;
231 1db09b84 aurel32
    uint64_t elf_lowaddr;
232 c227f099 Anthony Liguori
    target_phys_addr_t entry=0;
233 c227f099 Anthony Liguori
    target_phys_addr_t loadaddr=UIMAGE_LOAD_BASE;
234 1db09b84 aurel32
    target_long kernel_size=0;
235 75bb6589 Liu Yu
    target_ulong dt_base = 0;
236 75bb6589 Liu Yu
    target_ulong initrd_base = 0;
237 1db09b84 aurel32
    target_long initrd_size=0;
238 1db09b84 aurel32
    int i=0;
239 1db09b84 aurel32
    unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
240 be13cc7a Alexander Graf
    qemu_irq *irqs, *mpic;
241 be13cc7a Alexander Graf
    DeviceState *dev;
242 3b989d49 Alexander Graf
    struct boot_info *boot_info;
243 1db09b84 aurel32
244 1db09b84 aurel32
    /* Setup CPU */
245 ef250db6 Alexander Graf
    if (cpu_model == NULL) {
246 ef250db6 Alexander Graf
        cpu_model = "e500v2_v30";
247 ef250db6 Alexander Graf
    }
248 ef250db6 Alexander Graf
249 ef250db6 Alexander Graf
    env = cpu_ppc_init(cpu_model);
250 1db09b84 aurel32
    if (!env) {
251 1db09b84 aurel32
        fprintf(stderr, "Unable to initialize CPU!\n");
252 1db09b84 aurel32
        exit(1);
253 1db09b84 aurel32
    }
254 1db09b84 aurel32
255 3b989d49 Alexander Graf
    /* XXX register timer? */
256 3b989d49 Alexander Graf
    ppc_emb_timers_init(env, 400000000, PPC_INTERRUPT_DECR);
257 3b989d49 Alexander Graf
    ppc_dcr_init(env, NULL, NULL);
258 3b989d49 Alexander Graf
259 3b989d49 Alexander Graf
    /* Register reset handler */
260 3b989d49 Alexander Graf
    qemu_register_reset(mpc8544ds_cpu_reset, env);
261 3b989d49 Alexander Graf
262 1db09b84 aurel32
    /* Fixup Memory size on a alignment boundary */
263 1db09b84 aurel32
    ram_size &= ~(RAM_SIZES_ALIGN - 1);
264 1db09b84 aurel32
265 1db09b84 aurel32
    /* Register Memory */
266 1724f049 Alex Williamson
    cpu_register_physical_memory(0, ram_size, qemu_ram_alloc(NULL,
267 1724f049 Alex Williamson
                                 "mpc8544ds.ram", ram_size));
268 1db09b84 aurel32
269 1db09b84 aurel32
    /* MPIC */
270 7267c094 Anthony Liguori
    irqs = g_malloc0(sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
271 1db09b84 aurel32
    irqs[OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_INT];
272 1db09b84 aurel32
    irqs[OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPCE500_INPUT_CINT];
273 1db09b84 aurel32
    mpic = mpic_init(MPC8544_MPIC_REGS_BASE, 1, &irqs, NULL);
274 1db09b84 aurel32
275 1db09b84 aurel32
    /* Serial */
276 2d48377a Blue Swirl
    if (serial_hds[0]) {
277 49a2942d Blue Swirl
        serial_mm_init(MPC8544_SERIAL0_REGS_BASE,
278 49a2942d Blue Swirl
                       0, mpic[12+26], 399193,
279 49a2942d Blue Swirl
                       serial_hds[0], 1, 1);
280 2d48377a Blue Swirl
    }
281 1db09b84 aurel32
282 2d48377a Blue Swirl
    if (serial_hds[1]) {
283 49a2942d Blue Swirl
        serial_mm_init(MPC8544_SERIAL1_REGS_BASE,
284 49a2942d Blue Swirl
                       0, mpic[12+26], 399193,
285 49a2942d Blue Swirl
                       serial_hds[0], 1, 1);
286 2d48377a Blue Swirl
    }
287 1db09b84 aurel32
288 b0fb8423 Alexander Graf
    /* General Utility device */
289 b0fb8423 Alexander Graf
    sysbus_create_simple("mpc8544-guts", MPC8544_UTIL_BASE, NULL);
290 b0fb8423 Alexander Graf
291 1db09b84 aurel32
    /* PCI */
292 be13cc7a Alexander Graf
    dev = sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE,
293 be13cc7a Alexander Graf
                                mpic[pci_irq_nrs[0]], mpic[pci_irq_nrs[1]],
294 be13cc7a Alexander Graf
                                mpic[pci_irq_nrs[2]], mpic[pci_irq_nrs[3]],
295 be13cc7a Alexander Graf
                                NULL);
296 d461e3b9 Alexander Graf
    pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
297 1db09b84 aurel32
    if (!pci_bus)
298 1db09b84 aurel32
        printf("couldn't create PCI controller!\n");
299 1db09b84 aurel32
300 968d683c Alexander Graf
    isa_mmio_init(MPC8544_PCI_IO, MPC8544_PCI_IOLEN);
301 1db09b84 aurel32
302 1db09b84 aurel32
    if (pci_bus) {
303 1db09b84 aurel32
        /* Register network interfaces. */
304 1db09b84 aurel32
        for (i = 0; i < nb_nics; i++) {
305 07caea31 Markus Armbruster
            pci_nic_init_nofail(&nd_table[i], "virtio", NULL);
306 1db09b84 aurel32
        }
307 1db09b84 aurel32
    }
308 1db09b84 aurel32
309 1db09b84 aurel32
    /* Load kernel. */
310 1db09b84 aurel32
    if (kernel_filename) {
311 1db09b84 aurel32
        kernel_size = load_uimage(kernel_filename, &entry, &loadaddr, NULL);
312 1db09b84 aurel32
        if (kernel_size < 0) {
313 409dbce5 Aurelien Jarno
            kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
314 409dbce5 Aurelien Jarno
                                   &elf_lowaddr, NULL, 1, ELF_MACHINE, 0);
315 1db09b84 aurel32
            entry = elf_entry;
316 1db09b84 aurel32
            loadaddr = elf_lowaddr;
317 1db09b84 aurel32
        }
318 1db09b84 aurel32
        /* XXX try again as binary */
319 1db09b84 aurel32
        if (kernel_size < 0) {
320 1db09b84 aurel32
            fprintf(stderr, "qemu: could not load kernel '%s'\n",
321 1db09b84 aurel32
                    kernel_filename);
322 1db09b84 aurel32
            exit(1);
323 1db09b84 aurel32
        }
324 1db09b84 aurel32
    }
325 1db09b84 aurel32
326 1db09b84 aurel32
    /* Load initrd. */
327 1db09b84 aurel32
    if (initrd_filename) {
328 75bb6589 Liu Yu
        initrd_base = (kernel_size + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK;
329 d7585251 pbrook
        initrd_size = load_image_targphys(initrd_filename, initrd_base,
330 d7585251 pbrook
                                          ram_size - initrd_base);
331 1db09b84 aurel32
332 1db09b84 aurel32
        if (initrd_size < 0) {
333 1db09b84 aurel32
            fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
334 1db09b84 aurel32
                    initrd_filename);
335 1db09b84 aurel32
            exit(1);
336 1db09b84 aurel32
        }
337 1db09b84 aurel32
    }
338 1db09b84 aurel32
339 7267c094 Anthony Liguori
    boot_info = g_malloc0(sizeof(struct boot_info));
340 3b989d49 Alexander Graf
341 1db09b84 aurel32
    /* If we're loading a kernel directly, we must load the device tree too. */
342 1db09b84 aurel32
    if (kernel_filename) {
343 3b989d49 Alexander Graf
#ifndef CONFIG_FDT
344 3b989d49 Alexander Graf
        cpu_abort(env, "Compiled without FDT support - can't load kernel\n");
345 3b989d49 Alexander Graf
#endif
346 75bb6589 Liu Yu
        dt_base = (kernel_size + DTC_LOAD_PAD) & ~DTC_PAD_MASK;
347 5de6b46d Alexander Graf
        if (mpc8544_load_device_tree(env, dt_base, ram_size,
348 04088adb Liu Yu
                    initrd_base, initrd_size, kernel_cmdline) < 0) {
349 1db09b84 aurel32
            fprintf(stderr, "couldn't load device tree\n");
350 1db09b84 aurel32
            exit(1);
351 1db09b84 aurel32
        }
352 1db09b84 aurel32
353 3b989d49 Alexander Graf
        boot_info->entry = entry;
354 3b989d49 Alexander Graf
        boot_info->dt_base = dt_base;
355 1db09b84 aurel32
    }
356 3b989d49 Alexander Graf
    env->load_info = boot_info;
357 1db09b84 aurel32
358 3b989d49 Alexander Graf
    if (kvm_enabled()) {
359 1db09b84 aurel32
        kvmppc_init();
360 3b989d49 Alexander Graf
    }
361 1db09b84 aurel32
}
362 1db09b84 aurel32
363 f80f9ec9 Anthony Liguori
static QEMUMachine mpc8544ds_machine = {
364 1db09b84 aurel32
    .name = "mpc8544ds",
365 1db09b84 aurel32
    .desc = "mpc8544ds",
366 1db09b84 aurel32
    .init = mpc8544ds_init,
367 1db09b84 aurel32
};
368 f80f9ec9 Anthony Liguori
369 f80f9ec9 Anthony Liguori
static void mpc8544ds_machine_init(void)
370 f80f9ec9 Anthony Liguori
{
371 f80f9ec9 Anthony Liguori
    qemu_register_machine(&mpc8544ds_machine);
372 f80f9ec9 Anthony Liguori
}
373 f80f9ec9 Anthony Liguori
374 f80f9ec9 Anthony Liguori
machine_init(mpc8544ds_machine_init);