};
/* PowerPC Mac99 hardware initialisation */
-static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device,
- DisplayState *ds, const char **fd_filename,
- int snapshot,
+static void ppc_core99_init (int ram_size, int vga_ram_size,
+ const char *boot_device, DisplayState *ds,
+ const char **fd_filename, int snapshot,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *cpu_model)
{
- CPUState *env, *envs[MAX_CPUS];
+ CPUState *env = NULL, *envs[MAX_CPUS];
char buf[1024];
qemu_irq *pic, **openpic_irqs;
int unin_memory;
int linux_boot, i;
unsigned long bios_offset, vga_bios_offset;
uint32_t kernel_base, kernel_size, initrd_base, initrd_size;
- ppc_def_t *def;
PCIBus *pci_bus;
nvram_t nvram;
#if 0
qemu_irq *dummy_irq;
int pic_mem_index, dbdma_mem_index, cuda_mem_index;
int ide_mem_index[2];
+ int ppc_boot_device = boot_device[0];
linux_boot = (kernel_filename != NULL);
/* init CPUs */
- env = cpu_init();
if (cpu_model == NULL)
cpu_model = "default";
- ppc_find_by_name(cpu_model, &def);
- if (def == NULL) {
- cpu_abort(env, "Unable to find PowerPC CPU definition\n");
- }
for (i = 0; i < smp_cpus; i++) {
- cpu_ppc_register(env, def);
- cpu_ppc_reset(env);
+ env = cpu_init(cpu_model);
+ if (!env) {
+ fprintf(stderr, "Unable to find PowerPC CPU definition\n");
+ exit(1);
+ }
/* Set time-base frequency to 100 Mhz */
cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
#if 0
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
envs[i] = env;
}
+ if (env->nip < 0xFFF80000) {
+ /* Special test for PowerPC 601:
+ * the boot vector is at 0xFFF00100, then we need a 1MB BIOS.
+ * But the NVRAM is located at 0xFFF04000...
+ */
+ cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n");
+ }
/* allocate RAM */
cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
exit(1);
}
bios_size = (bios_size + 0xfff) & ~0xfff;
+ if (bios_size > 0x00080000) {
+ /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */
+ cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n");
+ }
cpu_register_physical_memory((uint32_t)(-bios_size),
bios_size, bios_offset | IO_MEM_ROM);
initrd_base = 0;
initrd_size = 0;
}
- boot_device = 'm';
+ ppc_boot_device = 'm';
} else {
kernel_base = 0;
kernel_size = 0;
dbdma_init(&dbdma_mem_index);
macio_init(pci_bus, 0x0022, 0, pic_mem_index, dbdma_mem_index,
- cuda_mem_index, -1, 2, ide_mem_index);
+ cuda_mem_index, NULL, 2, ide_mem_index);
if (usb_enabled) {
usb_ohci_init_pci(pci_bus, 3, -1);
graphic_depth = 15;
#if 0 /* XXX: this is ugly but needed for now, or OHW won't boot */
/* The NewWorld NVRAM is not located in the MacIO device */
- nvr = macio_nvram_init(&nvram_mem_index);
+ nvr = macio_nvram_init(&nvram_mem_index, 0x2000);
pmac_format_nvram_partition(nvr, 0x2000);
- cpu_register_physical_memory(0xFFF04000, 0x20000, nvram_mem_index);
+ macio_nvram_map(nvr, 0xFFF04000);
nvram.opaque = nvr;
nvram.read_fn = &macio_nvram_read;
nvram.write_fn = &macio_nvram_write;
nvram.read_fn = &m48t59_read;
nvram.write_fn = &m48t59_write;
#endif
- PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size, boot_device,
- kernel_base, kernel_size,
+ PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size,
+ ppc_boot_device, kernel_base, kernel_size,
kernel_cmdline,
initrd_base, initrd_size,
/* XXX: need an option to load a NVRAM image */