//#define DEBUG_UNIN
#ifdef DEBUG_UNIN
-#define UNIN_DPRINTF(fmt, args...) \
-do { printf("UNIN: " fmt , ##args); } while (0)
+#define UNIN_DPRINTF(fmt, ...) \
+ do { printf("UNIN: " fmt , ## __VA_ARGS__); } while (0)
#else
-#define UNIN_DPRINTF(fmt, args...)
+#define UNIN_DPRINTF(fmt, ...)
#endif
/* UniN device */
}
/* PowerPC Mac99 hardware initialisation */
-static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
+static void ppc_core99_init (ram_addr_t ram_size,
const char *boot_device,
const char *kernel_filename,
const char *kernel_cmdline,
const char *cpu_model)
{
CPUState *env = NULL, *envs[MAX_CPUS];
- char buf[1024];
+ char *filename;
qemu_irq *pic, **openpic_irqs;
int unin_memory;
int linux_boot, i;
#if 0
env->osi_call = vga_osi_call;
#endif
- qemu_register_reset(&cpu_ppc_reset, env);
+ qemu_register_reset(&cpu_ppc_reset, 0, env);
envs[i] = env;
}
bios_offset = qemu_ram_alloc(BIOS_SIZE);
if (bios_name == NULL)
bios_name = PROM_FILENAME;
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM);
/* Load OpenBIOS (ELF) */
- bios_size = load_elf(buf, 0, NULL, NULL, NULL);
+ if (filename) {
+ bios_size = load_elf(filename, 0, NULL, NULL, NULL);
+ qemu_free(filename);
+ } else {
+ bios_size = -1;
+ }
if (bios_size < 0 || bios_size > BIOS_SIZE) {
- cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
+ hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name);
exit(1);
}
/* allocate and load VGA BIOS */
vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
vga_bios_ptr = qemu_get_ram_ptr(vga_bios_offset);
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
- vga_bios_size = load_image(buf, vga_bios_ptr + 8);
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, VGABIOS_FILENAME);
+ if (filename) {
+ vga_bios_size = load_image(filename, vga_bios_ptr + 8);
+ qemu_free(filename);
+ } else {
+ vga_bios_size = -1;
+ }
if (vga_bios_size < 0) {
/* if no bios is present, we can still work */
- fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf);
+ fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n",
+ VGABIOS_FILENAME);
vga_bios_size = 0;
} else {
/* set a specific header (XXX: find real Apple format for NDRV
kernel_base,
ram_size - kernel_base);
if (kernel_size < 0) {
- cpu_abort(env, "qemu: could not load kernel '%s'\n",
- kernel_filename);
+ hw_error("qemu: could not load kernel '%s'\n", kernel_filename);
exit(1);
}
/* load initrd */
initrd_size = load_image_targphys(initrd_filename, initrd_base,
ram_size - initrd_base);
if (initrd_size < 0) {
- cpu_abort(env, "qemu: could not load initial ram disk '%s'\n",
- initrd_filename);
+ hw_error("qemu: could not load initial ram disk '%s'\n",
+ initrd_filename);
exit(1);
}
} else {
break;
#endif /* defined(TARGET_PPC64) */
default:
- cpu_abort(env, "Bus model not supported on mac99 machine\n");
+ hw_error("Bus model not supported on mac99 machine\n");
exit(1);
}
}
pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL);
pci_bus = pci_pmac_init(pic);
/* init basic PC hardware */
- pci_vga_init(pci_bus, vga_ram_size,
- vga_bios_offset, vga_bios_size);
+ pci_vga_init(pci_bus, vga_bios_offset, vga_bios_size);
/* XXX: suppress that */
dummy_irq = i8259_init(NULL);
qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
}
-QEMUMachine core99_machine = {
+static QEMUMachine core99_machine = {
.name = "mac99",
.desc = "Mac99 based PowerMAC",
.init = ppc_core99_init,
.max_cpus = MAX_CPUS,
};
+
+static void core99_machine_init(void)
+{
+ qemu_register_machine(&core99_machine);
+}
+
+machine_init(core99_machine_init);