#include "qemu-log.h"
#define BIOS_FILENAME "ppc405_rom.bin"
-#undef BIOS_SIZE
#define BIOS_SIZE (2048 * 1024)
#define KERNEL_LOAD_ADDR 0x00000000
ref405ep_fpga_write, fpga);
cpu_register_physical_memory(base, 0x00000100, fpga_memory);
ref405ep_fpga_reset(fpga);
- qemu_register_reset(&ref405ep_fpga_reset, fpga);
+ qemu_register_reset(&ref405ep_fpga_reset, 0, fpga);
}
static void ref405ep_init (ram_addr_t ram_size,
const char *initrd_filename,
const char *cpu_model)
{
- char buf[1024];
+ char *filename;
ppc4xx_bd_info_t bd;
CPUPPCState *env;
qemu_irq *pic;
#ifdef DEBUG_BOARD_INIT
printf("Load BIOS from file\n");
#endif
+ bios_offset = qemu_ram_alloc(BIOS_SIZE);
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
- bios_offset = qemu_ram_alloc(BIOS_SIZE);
- bios_size = load_image(buf, qemu_get_ram_ptr(bios_offset));
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ if (filename) {
+ bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset));
+ qemu_free(filename);
+ } else {
+ bios_size = -1;
+ }
if (bios_size < 0 || bios_size > BIOS_SIZE) {
- fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
+ fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
+ bios_name);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
printf("bdloc %016lx\n", (unsigned long)bdloc);
}
-QEMUMachine ref405ep_machine = {
+static QEMUMachine ref405ep_machine = {
.name = "ref405ep",
.desc = "ref405ep",
.init = ref405ep_init,
taihu_cpld_write, cpld);
cpu_register_physical_memory(base, 0x00000100, cpld_memory);
taihu_cpld_reset(cpld);
- qemu_register_reset(&taihu_cpld_reset, cpld);
+ qemu_register_reset(&taihu_cpld_reset, 0, cpld);
}
static void taihu_405ep_init(ram_addr_t ram_size,
const char *initrd_filename,
const char *cpu_model)
{
- char buf[1024];
+ char *filename;
CPUPPCState *env;
qemu_irq *pic;
ram_addr_t bios_offset;
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
bios_offset = qemu_ram_alloc(BIOS_SIZE);
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
- bios_size = load_image(buf, qemu_get_ram_ptr(bios_offset));
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ if (filename) {
+ bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset));
+ } else {
+ bios_size = -1;
+ }
if (bios_size < 0 || bios_size > BIOS_SIZE) {
- fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf);
+ fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
+ bios_name);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
#endif
}
-QEMUMachine taihu_machine = {
+static QEMUMachine taihu_machine = {
.name = "taihu",
.desc = "taihu",
.init = taihu_405ep_init,
};
+
+static void ppc405_machine_init(void)
+{
+ qemu_register_machine(&ref405ep_machine);
+ qemu_register_machine(&taihu_machine);
+}
+
+machine_init(ppc405_machine_init);