ppc405_boards.c 16.9 KB
Newer Older
J
j_mayer 已提交
1 2
/*
 * QEMU PowerPC 405 evaluation boards emulation
3
 *
J
j_mayer 已提交
4
 * Copyright (c) 2007 Jocelyn Mayer
5
 *
J
j_mayer 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
P
Peter Maydell 已提交
24
#include "qemu/osdep.h"
25
#include "qemu/units.h"
26
#include "qapi/error.h"
27 28
#include "qemu-common.h"
#include "cpu.h"
29
#include "hw/hw.h"
P
Paolo Bonzini 已提交
30
#include "hw/ppc/ppc.h"
31
#include "ppc405.h"
P
Paolo Bonzini 已提交
32 33
#include "hw/timer/m48t59.h"
#include "hw/block/flash.h"
34
#include "sysemu/sysemu.h"
35
#include "sysemu/qtest.h"
36
#include "sysemu/block-backend.h"
37
#include "hw/boards.h"
38
#include "qemu/log.h"
39
#include "qemu/error-report.h"
40
#include "hw/loader.h"
41
#include "exec/address-spaces.h"
J
j_mayer 已提交
42 43

#define BIOS_FILENAME "ppc405_rom.bin"
44
#define BIOS_SIZE (2 * MiB)
J
j_mayer 已提交
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

#define KERNEL_LOAD_ADDR 0x00000000
#define INITRD_LOAD_ADDR 0x01800000

#define USE_FLASH_BIOS

/*****************************************************************************/
/* PPC405EP reference board (IBM) */
/* Standalone board with:
 * - PowerPC 405EP CPU
 * - SDRAM (0x00000000)
 * - Flash (0xFFF80000)
 * - SRAM  (0xFFF00000)
 * - NVRAM (0xF0000000)
 * - FPGA  (0xF0300000)
 */
A
Anthony Liguori 已提交
61 62
typedef struct ref405ep_fpga_t ref405ep_fpga_t;
struct ref405ep_fpga_t {
J
j_mayer 已提交
63 64 65 66
    uint8_t reg0;
    uint8_t reg1;
};

67
static uint64_t ref405ep_fpga_readb(void *opaque, hwaddr addr, unsigned size)
J
j_mayer 已提交
68
{
A
Anthony Liguori 已提交
69
    ref405ep_fpga_t *fpga;
J
j_mayer 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
    uint32_t ret;

    fpga = opaque;
    switch (addr) {
    case 0x0:
        ret = fpga->reg0;
        break;
    case 0x1:
        ret = fpga->reg1;
        break;
    default:
        ret = 0;
        break;
    }

    return ret;
}

88 89
static void ref405ep_fpga_writeb(void *opaque, hwaddr addr, uint64_t value,
                                 unsigned size)
J
j_mayer 已提交
90
{
A
Anthony Liguori 已提交
91
    ref405ep_fpga_t *fpga;
J
j_mayer 已提交
92 93 94 95 96 97 98 99 100 101 102 103 104 105

    fpga = opaque;
    switch (addr) {
    case 0x0:
        /* Read only */
        break;
    case 0x1:
        fpga->reg1 = value;
        break;
    default:
        break;
    }
}

A
Avi Kivity 已提交
106
static const MemoryRegionOps ref405ep_fpga_ops = {
107 108 109 110 111 112 113
    .read = ref405ep_fpga_readb,
    .write = ref405ep_fpga_writeb,
    .impl.min_access_size = 1,
    .impl.max_access_size = 1,
    .valid.min_access_size = 1,
    .valid.max_access_size = 4,
    .endianness = DEVICE_BIG_ENDIAN,
J
j_mayer 已提交
114 115 116 117
};

static void ref405ep_fpga_reset (void *opaque)
{
A
Anthony Liguori 已提交
118
    ref405ep_fpga_t *fpga;
J
j_mayer 已提交
119 120 121 122 123 124

    fpga = opaque;
    fpga->reg0 = 0x00;
    fpga->reg1 = 0x0F;
}

125
static void ref405ep_fpga_init(MemoryRegion *sysmem, uint32_t base)
J
j_mayer 已提交
126
{
A
Anthony Liguori 已提交
127
    ref405ep_fpga_t *fpga;
A
Avi Kivity 已提交
128
    MemoryRegion *fpga_memory = g_new(MemoryRegion, 1);
J
j_mayer 已提交
129

130
    fpga = g_malloc0(sizeof(ref405ep_fpga_t));
131
    memory_region_init_io(fpga_memory, NULL, &ref405ep_fpga_ops, fpga,
A
Avi Kivity 已提交
132 133
                          "fpga", 0x00000100);
    memory_region_add_subregion(sysmem, base, fpga_memory);
134
    qemu_register_reset(&ref405ep_fpga_reset, fpga);
J
j_mayer 已提交
135 136
}

137
static void ref405ep_init(MachineState *machine)
J
j_mayer 已提交
138
{
139 140 141 142
    ram_addr_t ram_size = machine->ram_size;
    const char *kernel_filename = machine->kernel_filename;
    const char *kernel_cmdline = machine->kernel_cmdline;
    const char *initrd_filename = machine->initrd_filename;
P
Paul Brook 已提交
143
    char *filename;
A
Anthony Liguori 已提交
144
    ppc4xx_bd_info_t bd;
J
j_mayer 已提交
145 146
    CPUPPCState *env;
    qemu_irq *pic;
147
    MemoryRegion *bios;
A
Avi Kivity 已提交
148 149
    MemoryRegion *sram = g_new(MemoryRegion, 1);
    ram_addr_t bdloc;
150
    MemoryRegion *ram_memories = g_new(MemoryRegion, 2);
A
Avi Kivity 已提交
151
    hwaddr ram_bases[2], ram_sizes[2];
152 153
    target_ulong sram_size;
    long bios_size;
J
j_mayer 已提交
154 155
    //int phy_addr = 0;
    //static int phy_addr = 1;
156 157
    target_ulong kernel_base, initrd_base;
    long kernel_size, initrd_size;
J
j_mayer 已提交
158
    int linux_boot;
159
    int len;
G
Gerd Hoffmann 已提交
160
    DriveInfo *dinfo;
A
Avi Kivity 已提交
161
    MemoryRegion *sysmem = get_system_memory();
J
j_mayer 已提交
162 163

    /* XXX: fix this */
164 165
    memory_region_allocate_system_memory(&ram_memories[0], NULL, "ef405ep.ram",
                                         0x08000000);
A
Avi Kivity 已提交
166
    ram_bases[0] = 0;
J
j_mayer 已提交
167
    ram_sizes[0] = 0x08000000;
168
    memory_region_init(&ram_memories[1], NULL, "ef405ep.ram1", 0);
J
j_mayer 已提交
169 170
    ram_bases[1] = 0x00000000;
    ram_sizes[1] = 0x00000000;
171
    ram_size = 128 * MiB;
A
Avi Kivity 已提交
172
    env = ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes,
173
                        33333333, &pic, kernel_filename == NULL ? 0 : 1);
J
j_mayer 已提交
174
    /* allocate SRAM */
175
    sram_size = 512 * KiB;
176
    memory_region_init_ram(sram, NULL, "ef405ep.sram", sram_size,
177
                           &error_fatal);
A
Avi Kivity 已提交
178
    memory_region_add_subregion(sysmem, 0xFFF00000, sram);
J
j_mayer 已提交
179 180
    /* allocate and load BIOS */
#ifdef USE_FLASH_BIOS
181
    dinfo = drive_get(IF_PFLASH, 0, 0);
G
Gerd Hoffmann 已提交
182
    if (dinfo) {
183
        bios_size = 8 * MiB;
184
        pflash_cfi02_register((uint32_t)(-bios_size),
185
                              "ef405ep.bios", bios_size,
186
                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
187
                              64 * KiB, 1,
188 189
                              2, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
                              1);
J
j_mayer 已提交
190 191 192
    } else
#endif
    {
193
        bios = g_new(MemoryRegion, 1);
194
        memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE,
195
                               &error_fatal);
H
Hu Tao 已提交
196

197 198
        if (bios_name == NULL)
            bios_name = BIOS_FILENAME;
P
Paul Brook 已提交
199 200
        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
        if (filename) {
201 202 203
            bios_size = load_image_size(filename,
                                        memory_region_get_ram_ptr(bios),
                                        BIOS_SIZE);
204
            g_free(filename);
205
            if (bios_size < 0) {
206 207 208 209 210 211 212 213
                error_report("Could not load PowerPC BIOS '%s'", bios_name);
                exit(1);
            }
            bios_size = (bios_size + 0xfff) & ~0xfff;
            memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
        } else if (!qtest_enabled() || kernel_filename != NULL) {
            error_report("Could not load PowerPC BIOS '%s'", bios_name);
            exit(1);
P
Paul Brook 已提交
214
        } else {
215
            /* Avoid an uninitialized variable warning */
P
Paul Brook 已提交
216 217
            bios_size = -1;
        }
218
        memory_region_set_readonly(bios, true);
J
j_mayer 已提交
219 220
    }
    /* Register FPGA */
A
Avi Kivity 已提交
221
    ref405ep_fpga_init(sysmem, 0xF0300000);
J
j_mayer 已提交
222
    /* Register NVRAM */
223
    m48t59_init(NULL, 0xF0000000, 0, 8192, 1968, 8);
J
j_mayer 已提交
224 225 226 227 228 229
    /* Load kernel */
    linux_boot = (kernel_filename != NULL);
    if (linux_boot) {
        memset(&bd, 0, sizeof(bd));
        bd.bi_memstart = 0x00000000;
        bd.bi_memsize = ram_size;
230
        bd.bi_flashstart = -bios_size;
J
j_mayer 已提交
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
        bd.bi_flashsize = -bios_size;
        bd.bi_flashoffset = 0;
        bd.bi_sramstart = 0xFFF00000;
        bd.bi_sramsize = sram_size;
        bd.bi_bootflags = 0;
        bd.bi_intfreq = 133333333;
        bd.bi_busfreq = 33333333;
        bd.bi_baudrate = 115200;
        bd.bi_s_version[0] = 'Q';
        bd.bi_s_version[1] = 'M';
        bd.bi_s_version[2] = 'U';
        bd.bi_s_version[3] = '\0';
        bd.bi_r_version[0] = 'Q';
        bd.bi_r_version[1] = 'E';
        bd.bi_r_version[2] = 'M';
        bd.bi_r_version[3] = 'U';
        bd.bi_r_version[4] = '\0';
        bd.bi_procfreq = 133333333;
        bd.bi_plb_busfreq = 33333333;
        bd.bi_pci_busfreq = 33333333;
        bd.bi_opbfreq = 33333333;
252
        bdloc = ppc405_set_bootinfo(env, &bd, 0x00000001);
J
j_mayer 已提交
253 254 255
        env->gpr[3] = bdloc;
        kernel_base = KERNEL_LOAD_ADDR;
        /* now we can load the kernel */
P
pbrook 已提交
256 257
        kernel_size = load_image_targphys(kernel_filename, kernel_base,
                                          ram_size - kernel_base);
J
j_mayer 已提交
258
        if (kernel_size < 0) {
259
            error_report("could not load kernel '%s'", kernel_filename);
J
j_mayer 已提交
260 261
            exit(1);
        }
262
        printf("Load kernel size %ld at " TARGET_FMT_lx,
P
pbrook 已提交
263
               kernel_size, kernel_base);
J
j_mayer 已提交
264 265 266
        /* load initrd */
        if (initrd_filename) {
            initrd_base = INITRD_LOAD_ADDR;
P
pbrook 已提交
267 268
            initrd_size = load_image_targphys(initrd_filename, initrd_base,
                                              ram_size - initrd_base);
J
j_mayer 已提交
269
            if (initrd_size < 0) {
270 271
                error_report("could not load initial ram disk '%s'",
                             initrd_filename);
J
j_mayer 已提交
272 273 274 275 276 277 278 279 280 281 282
                exit(1);
            }
        } else {
            initrd_base = 0;
            initrd_size = 0;
        }
        env->gpr[4] = initrd_base;
        env->gpr[5] = initrd_size;
        if (kernel_cmdline != NULL) {
            len = strlen(kernel_cmdline);
            bdloc -= ((len + 255) & ~255);
S
Stefan Weil 已提交
283
            cpu_physical_memory_write(bdloc, kernel_cmdline, len + 1);
J
j_mayer 已提交
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
            env->gpr[6] = bdloc;
            env->gpr[7] = bdloc + len;
        } else {
            env->gpr[6] = 0;
            env->gpr[7] = 0;
        }
        env->nip = KERNEL_LOAD_ADDR;
    } else {
        kernel_base = 0;
        kernel_size = 0;
        initrd_base = 0;
        initrd_size = 0;
        bdloc = 0;
    }
}

300
static void ref405ep_class_init(ObjectClass *oc, void *data)
301
{
302 303
    MachineClass *mc = MACHINE_CLASS(oc);

304 305 306 307
    mc->desc = "ref405ep";
    mc->init = ref405ep_init;
}

308 309 310 311 312
static const TypeInfo ref405ep_type = {
    .name = MACHINE_TYPE_NAME("ref405ep"),
    .parent = TYPE_MACHINE,
    .class_init = ref405ep_class_init,
};
J
j_mayer 已提交
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338

/*****************************************************************************/
/* AMCC Taihu evaluation board */
/* - PowerPC 405EP processor
 * - SDRAM               128 MB at 0x00000000
 * - Boot flash          2 MB   at 0xFFE00000
 * - Application flash   32 MB  at 0xFC000000
 * - 2 serial ports
 * - 2 ethernet PHY
 * - 1 USB 1.1 device    0x50000000
 * - 1 LCD display       0x50100000
 * - 1 CPLD              0x50100000
 * - 1 I2C EEPROM
 * - 1 I2C thermal sensor
 * - a set of LEDs
 * - bit-bang SPI port using GPIOs
 * - 1 EBC interface connector 0 0x50200000
 * - 1 cardbus controller + expansion slot.
 * - 1 PCI expansion slot.
 */
typedef struct taihu_cpld_t taihu_cpld_t;
struct taihu_cpld_t {
    uint8_t reg0;
    uint8_t reg1;
};

339
static uint64_t taihu_cpld_read(void *opaque, hwaddr addr, unsigned size)
J
j_mayer 已提交
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
{
    taihu_cpld_t *cpld;
    uint32_t ret;

    cpld = opaque;
    switch (addr) {
    case 0x0:
        ret = cpld->reg0;
        break;
    case 0x1:
        ret = cpld->reg1;
        break;
    default:
        ret = 0;
        break;
    }

    return ret;
}

360 361
static void taihu_cpld_write(void *opaque, hwaddr addr,
                             uint64_t value, unsigned size)
J
j_mayer 已提交
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
{
    taihu_cpld_t *cpld;

    cpld = opaque;
    switch (addr) {
    case 0x0:
        /* Read only */
        break;
    case 0x1:
        cpld->reg1 = value;
        break;
    default:
        break;
    }
}

A
Avi Kivity 已提交
378
static const MemoryRegionOps taihu_cpld_ops = {
379 380 381 382 383
    .read = taihu_cpld_read,
    .write = taihu_cpld_write,
    .impl = {
        .min_access_size = 1,
        .max_access_size = 1,
A
Avi Kivity 已提交
384 385
    },
    .endianness = DEVICE_NATIVE_ENDIAN,
J
j_mayer 已提交
386 387 388 389 390 391 392 393 394 395 396
};

static void taihu_cpld_reset (void *opaque)
{
    taihu_cpld_t *cpld;

    cpld = opaque;
    cpld->reg0 = 0x01;
    cpld->reg1 = 0x80;
}

397
static void taihu_cpld_init(MemoryRegion *sysmem, uint32_t base)
J
j_mayer 已提交
398 399
{
    taihu_cpld_t *cpld;
A
Avi Kivity 已提交
400
    MemoryRegion *cpld_memory = g_new(MemoryRegion, 1);
J
j_mayer 已提交
401

402
    cpld = g_malloc0(sizeof(taihu_cpld_t));
403
    memory_region_init_io(cpld_memory, NULL, &taihu_cpld_ops, cpld, "cpld", 0x100);
A
Avi Kivity 已提交
404
    memory_region_add_subregion(sysmem, base, cpld_memory);
405
    qemu_register_reset(&taihu_cpld_reset, cpld);
J
j_mayer 已提交
406 407
}

408
static void taihu_405ep_init(MachineState *machine)
J
j_mayer 已提交
409
{
410 411 412
    ram_addr_t ram_size = machine->ram_size;
    const char *kernel_filename = machine->kernel_filename;
    const char *initrd_filename = machine->initrd_filename;
P
Paul Brook 已提交
413
    char *filename;
J
j_mayer 已提交
414
    qemu_irq *pic;
A
Avi Kivity 已提交
415
    MemoryRegion *sysmem = get_system_memory();
416
    MemoryRegion *bios;
417
    MemoryRegion *ram_memories = g_new(MemoryRegion, 2);
H
Hu Tao 已提交
418
    MemoryRegion *ram = g_malloc0(sizeof(*ram));
A
Avi Kivity 已提交
419
    hwaddr ram_bases[2], ram_sizes[2];
420 421 422
    long bios_size;
    target_ulong kernel_base, initrd_base;
    long kernel_size, initrd_size;
J
j_mayer 已提交
423
    int linux_boot;
424
    int fl_idx;
G
Gerd Hoffmann 已提交
425
    DriveInfo *dinfo;
426

J
j_mayer 已提交
427
    /* RAM is soldered to the board so the size cannot be changed */
H
Hu Tao 已提交
428 429 430 431
    ram_size = 0x08000000;
    memory_region_allocate_system_memory(ram, NULL, "taihu_405ep.ram",
                                         ram_size);

A
Avi Kivity 已提交
432
    ram_bases[0] = 0;
J
j_mayer 已提交
433
    ram_sizes[0] = 0x04000000;
H
Hu Tao 已提交
434 435 436
    memory_region_init_alias(&ram_memories[0], NULL,
                             "taihu_405ep.ram-0", ram, ram_bases[0],
                             ram_sizes[0]);
A
Avi Kivity 已提交
437
    ram_bases[1] = 0x04000000;
J
j_mayer 已提交
438
    ram_sizes[1] = 0x04000000;
H
Hu Tao 已提交
439 440 441
    memory_region_init_alias(&ram_memories[1], NULL,
                             "taihu_405ep.ram-1", ram, ram_bases[1],
                             ram_sizes[1]);
A
Avi Kivity 已提交
442
    ppc405ep_init(sysmem, ram_memories, ram_bases, ram_sizes,
443
                  33333333, &pic, kernel_filename == NULL ? 0 : 1);
J
j_mayer 已提交
444 445 446
    /* allocate and load BIOS */
    fl_idx = 0;
#if defined(USE_FLASH_BIOS)
G
Gerd Hoffmann 已提交
447 448
    dinfo = drive_get(IF_PFLASH, 0, fl_idx);
    if (dinfo) {
449 450
        bios_size = 2 * MiB;
        pflash_cfi02_register(0xFFE00000,
451
                              "taihu_405ep.bios", bios_size,
452
                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
453
                              64 * KiB, 1,
454 455
                              4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
                              1);
J
j_mayer 已提交
456 457 458 459
        fl_idx++;
    } else
#endif
    {
460 461
        if (bios_name == NULL)
            bios_name = BIOS_FILENAME;
462
        bios = g_new(MemoryRegion, 1);
463
        memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE,
464
                               &error_fatal);
P
Paul Brook 已提交
465 466
        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
        if (filename) {
467 468 469
            bios_size = load_image_size(filename,
                                        memory_region_get_ram_ptr(bios),
                                        BIOS_SIZE);
470
            g_free(filename);
471
            if (bios_size < 0) {
472 473 474 475 476 477 478
                error_report("Could not load PowerPC BIOS '%s'", bios_name);
                exit(1);
            }
            bios_size = (bios_size + 0xfff) & ~0xfff;
            memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
        } else if (!qtest_enabled()) {
            error_report("Could not load PowerPC BIOS '%s'", bios_name);
J
j_mayer 已提交
479 480
            exit(1);
        }
481
        memory_region_set_readonly(bios, true);
J
j_mayer 已提交
482 483
    }
    /* Register Linux flash */
G
Gerd Hoffmann 已提交
484 485
    dinfo = drive_get(IF_PFLASH, 0, fl_idx);
    if (dinfo) {
486
        bios_size = 32 * MiB;
487
        pflash_cfi02_register(0xfc000000, "taihu_405ep.flash", bios_size,
488
                              dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
489
                              64 * KiB, 1,
490 491
                              4, 0x0001, 0x22DA, 0x0000, 0x0000, 0x555, 0x2AA,
                              1);
J
j_mayer 已提交
492 493 494
        fl_idx++;
    }
    /* Register CLPD & LCD display */
A
Avi Kivity 已提交
495
    taihu_cpld_init(sysmem, 0x50100000);
J
j_mayer 已提交
496 497 498 499 500
    /* Load kernel */
    linux_boot = (kernel_filename != NULL);
    if (linux_boot) {
        kernel_base = KERNEL_LOAD_ADDR;
        /* now we can load the kernel */
P
pbrook 已提交
501 502
        kernel_size = load_image_targphys(kernel_filename, kernel_base,
                                          ram_size - kernel_base);
J
j_mayer 已提交
503
        if (kernel_size < 0) {
504
            error_report("could not load kernel '%s'", kernel_filename);
J
j_mayer 已提交
505 506 507 508 509
            exit(1);
        }
        /* load initrd */
        if (initrd_filename) {
            initrd_base = INITRD_LOAD_ADDR;
P
pbrook 已提交
510 511
            initrd_size = load_image_targphys(initrd_filename, initrd_base,
                                              ram_size - initrd_base);
J
j_mayer 已提交
512
            if (initrd_size < 0) {
513 514
                error_report("could not load initial ram disk '%s'",
                             initrd_filename);
J
j_mayer 已提交
515 516 517 518 519 520 521 522 523 524 525 526 527 528
                exit(1);
            }
        } else {
            initrd_base = 0;
            initrd_size = 0;
        }
    } else {
        kernel_base = 0;
        kernel_size = 0;
        initrd_base = 0;
        initrd_size = 0;
    }
}

529
static void taihu_class_init(ObjectClass *oc, void *data)
530
{
531 532
    MachineClass *mc = MACHINE_CLASS(oc);

533 534
    mc->desc = "taihu";
    mc->init = taihu_405ep_init;
535 536
}

537 538 539 540 541 542 543 544 545 546 547 548
static const TypeInfo taihu_type = {
    .name = MACHINE_TYPE_NAME("taihu"),
    .parent = TYPE_MACHINE,
    .class_init = taihu_class_init,
};

static void ppc405_machine_init(void)
{
    type_register_static(&ref405ep_type);
    type_register_static(&taihu_type);
}

549
type_init(ppc405_machine_init)