1baec1910SAndreas Färber 2baec1910SAndreas Färber /* 3baec1910SAndreas Färber * QEMU OldWorld PowerMac (currently ~G3 Beige) hardware System Emulator 4baec1910SAndreas Färber * 5baec1910SAndreas Färber * Copyright (c) 2004-2007 Fabrice Bellard 6baec1910SAndreas Färber * Copyright (c) 2007 Jocelyn Mayer 7baec1910SAndreas Färber * 8baec1910SAndreas Färber * Permission is hereby granted, free of charge, to any person obtaining a copy 9baec1910SAndreas Färber * of this software and associated documentation files (the "Software"), to deal 10baec1910SAndreas Färber * in the Software without restriction, including without limitation the rights 11baec1910SAndreas Färber * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12baec1910SAndreas Färber * copies of the Software, and to permit persons to whom the Software is 13baec1910SAndreas Färber * furnished to do so, subject to the following conditions: 14baec1910SAndreas Färber * 15baec1910SAndreas Färber * The above copyright notice and this permission notice shall be included in 16baec1910SAndreas Färber * all copies or substantial portions of the Software. 17baec1910SAndreas Färber * 18baec1910SAndreas Färber * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19baec1910SAndreas Färber * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20baec1910SAndreas Färber * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21baec1910SAndreas Färber * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22baec1910SAndreas Färber * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23baec1910SAndreas Färber * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24baec1910SAndreas Färber * THE SOFTWARE. 25baec1910SAndreas Färber */ 26baec1910SAndreas Färber #include "hw/hw.h" 270d09e41aSPaolo Bonzini #include "hw/ppc/ppc.h" 28baec1910SAndreas Färber #include "mac.h" 290d09e41aSPaolo Bonzini #include "hw/input/adb.h" 300d09e41aSPaolo Bonzini #include "hw/timer/m48t59.h" 31baec1910SAndreas Färber #include "sysemu/sysemu.h" 32baec1910SAndreas Färber #include "net/net.h" 330d09e41aSPaolo Bonzini #include "hw/isa/isa.h" 34baec1910SAndreas Färber #include "hw/pci/pci.h" 35baec1910SAndreas Färber #include "hw/boards.h" 360d09e41aSPaolo Bonzini #include "hw/nvram/fw_cfg.h" 370d09e41aSPaolo Bonzini #include "hw/char/escc.h" 38baec1910SAndreas Färber #include "hw/ide.h" 39baec1910SAndreas Färber #include "hw/loader.h" 40baec1910SAndreas Färber #include "elf.h" 41baec1910SAndreas Färber #include "sysemu/kvm.h" 42baec1910SAndreas Färber #include "kvm_ppc.h" 43baec1910SAndreas Färber #include "sysemu/blockdev.h" 44baec1910SAndreas Färber #include "exec/address-spaces.h" 45baec1910SAndreas Färber 46baec1910SAndreas Färber #define MAX_IDE_BUS 2 47baec1910SAndreas Färber #define CFG_ADDR 0xf0000510 48536d8cdaSAlexander Graf #define TBFREQ 16600000UL 49baec1910SAndreas Färber 50baec1910SAndreas Färber static int fw_cfg_boot_set(void *opaque, const char *boot_device) 51baec1910SAndreas Färber { 52baec1910SAndreas Färber fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]); 53baec1910SAndreas Färber return 0; 54baec1910SAndreas Färber } 55baec1910SAndreas Färber 56baec1910SAndreas Färber 57baec1910SAndreas Färber static uint64_t translate_kernel_address(void *opaque, uint64_t addr) 58baec1910SAndreas Färber { 59baec1910SAndreas Färber return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR; 60baec1910SAndreas Färber } 61baec1910SAndreas Färber 62baec1910SAndreas Färber static hwaddr round_page(hwaddr addr) 63baec1910SAndreas Färber { 64baec1910SAndreas Färber return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK; 65baec1910SAndreas Färber } 66baec1910SAndreas Färber 67baec1910SAndreas Färber static void ppc_heathrow_reset(void *opaque) 68baec1910SAndreas Färber { 69baec1910SAndreas Färber PowerPCCPU *cpu = opaque; 70baec1910SAndreas Färber 71baec1910SAndreas Färber cpu_reset(CPU(cpu)); 72baec1910SAndreas Färber } 73baec1910SAndreas Färber 74baec1910SAndreas Färber static void ppc_heathrow_init(QEMUMachineInitArgs *args) 75baec1910SAndreas Färber { 76baec1910SAndreas Färber ram_addr_t ram_size = args->ram_size; 77baec1910SAndreas Färber const char *cpu_model = args->cpu_model; 78baec1910SAndreas Färber const char *kernel_filename = args->kernel_filename; 79baec1910SAndreas Färber const char *kernel_cmdline = args->kernel_cmdline; 80baec1910SAndreas Färber const char *initrd_filename = args->initrd_filename; 81baec1910SAndreas Färber const char *boot_device = args->boot_device; 82baec1910SAndreas Färber MemoryRegion *sysmem = get_system_memory(); 83baec1910SAndreas Färber PowerPCCPU *cpu = NULL; 84baec1910SAndreas Färber CPUPPCState *env = NULL; 85baec1910SAndreas Färber char *filename; 86baec1910SAndreas Färber qemu_irq *pic, **heathrow_irqs; 87baec1910SAndreas Färber int linux_boot, i; 88baec1910SAndreas Färber MemoryRegion *ram = g_new(MemoryRegion, 1); 89baec1910SAndreas Färber MemoryRegion *bios = g_new(MemoryRegion, 1); 90*7d52857eSPaolo Bonzini MemoryRegion *isa = g_new(MemoryRegion, 1); 91baec1910SAndreas Färber uint32_t kernel_base, initrd_base, cmdline_base = 0; 92baec1910SAndreas Färber int32_t kernel_size, initrd_size; 93baec1910SAndreas Färber PCIBus *pci_bus; 94d037834aSAndreas Färber PCIDevice *macio; 9507a7484eSAndreas Färber MACIOIDEState *macio_ide; 9607a7484eSAndreas Färber DeviceState *dev; 97293c867dSAndreas Färber BusState *adb_bus; 98baec1910SAndreas Färber int bios_size; 9945fa67fbSAndreas Färber MemoryRegion *pic_mem; 10007a7484eSAndreas Färber MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1); 101baec1910SAndreas Färber uint16_t ppc_boot_device; 102baec1910SAndreas Färber DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; 103baec1910SAndreas Färber void *fw_cfg; 104baec1910SAndreas Färber 105baec1910SAndreas Färber linux_boot = (kernel_filename != NULL); 106baec1910SAndreas Färber 107baec1910SAndreas Färber /* init CPUs */ 108baec1910SAndreas Färber if (cpu_model == NULL) 109baec1910SAndreas Färber cpu_model = "G3"; 110baec1910SAndreas Färber for (i = 0; i < smp_cpus; i++) { 111baec1910SAndreas Färber cpu = cpu_ppc_init(cpu_model); 112baec1910SAndreas Färber if (cpu == NULL) { 113baec1910SAndreas Färber fprintf(stderr, "Unable to find PowerPC CPU definition\n"); 114baec1910SAndreas Färber exit(1); 115baec1910SAndreas Färber } 116baec1910SAndreas Färber env = &cpu->env; 117baec1910SAndreas Färber 118baec1910SAndreas Färber /* Set time-base frequency to 16.6 Mhz */ 119536d8cdaSAlexander Graf cpu_ppc_tb_init(env, TBFREQ); 120baec1910SAndreas Färber qemu_register_reset(ppc_heathrow_reset, cpu); 121baec1910SAndreas Färber } 122baec1910SAndreas Färber 123baec1910SAndreas Färber /* allocate RAM */ 124baec1910SAndreas Färber if (ram_size > (2047 << 20)) { 125baec1910SAndreas Färber fprintf(stderr, 126baec1910SAndreas Färber "qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n", 127baec1910SAndreas Färber ((unsigned int)ram_size / (1 << 20))); 128baec1910SAndreas Färber exit(1); 129baec1910SAndreas Färber } 130baec1910SAndreas Färber 1312c9b15caSPaolo Bonzini memory_region_init_ram(ram, NULL, "ppc_heathrow.ram", ram_size); 132baec1910SAndreas Färber vmstate_register_ram_global(ram); 133baec1910SAndreas Färber memory_region_add_subregion(sysmem, 0, ram); 134baec1910SAndreas Färber 135baec1910SAndreas Färber /* allocate and load BIOS */ 1362c9b15caSPaolo Bonzini memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE); 137baec1910SAndreas Färber vmstate_register_ram_global(bios); 138baec1910SAndreas Färber if (bios_name == NULL) 139baec1910SAndreas Färber bios_name = PROM_FILENAME; 140baec1910SAndreas Färber filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); 141baec1910SAndreas Färber memory_region_set_readonly(bios, true); 142baec1910SAndreas Färber memory_region_add_subregion(sysmem, PROM_ADDR, bios); 143baec1910SAndreas Färber 144baec1910SAndreas Färber /* Load OpenBIOS (ELF) */ 145baec1910SAndreas Färber if (filename) { 146baec1910SAndreas Färber bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL, 147baec1910SAndreas Färber 1, ELF_MACHINE, 0); 148baec1910SAndreas Färber g_free(filename); 149baec1910SAndreas Färber } else { 150baec1910SAndreas Färber bios_size = -1; 151baec1910SAndreas Färber } 152baec1910SAndreas Färber if (bios_size < 0 || bios_size > BIOS_SIZE) { 153baec1910SAndreas Färber hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name); 154baec1910SAndreas Färber exit(1); 155baec1910SAndreas Färber } 156baec1910SAndreas Färber 157baec1910SAndreas Färber if (linux_boot) { 158baec1910SAndreas Färber uint64_t lowaddr = 0; 159baec1910SAndreas Färber int bswap_needed; 160baec1910SAndreas Färber 161baec1910SAndreas Färber #ifdef BSWAP_NEEDED 162baec1910SAndreas Färber bswap_needed = 1; 163baec1910SAndreas Färber #else 164baec1910SAndreas Färber bswap_needed = 0; 165baec1910SAndreas Färber #endif 166baec1910SAndreas Färber kernel_base = KERNEL_LOAD_ADDR; 167baec1910SAndreas Färber kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, 168baec1910SAndreas Färber NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0); 169baec1910SAndreas Färber if (kernel_size < 0) 170baec1910SAndreas Färber kernel_size = load_aout(kernel_filename, kernel_base, 171baec1910SAndreas Färber ram_size - kernel_base, bswap_needed, 172baec1910SAndreas Färber TARGET_PAGE_SIZE); 173baec1910SAndreas Färber if (kernel_size < 0) 174baec1910SAndreas Färber kernel_size = load_image_targphys(kernel_filename, 175baec1910SAndreas Färber kernel_base, 176baec1910SAndreas Färber ram_size - kernel_base); 177baec1910SAndreas Färber if (kernel_size < 0) { 178baec1910SAndreas Färber hw_error("qemu: could not load kernel '%s'\n", 179baec1910SAndreas Färber kernel_filename); 180baec1910SAndreas Färber exit(1); 181baec1910SAndreas Färber } 182baec1910SAndreas Färber /* load initrd */ 183baec1910SAndreas Färber if (initrd_filename) { 184baec1910SAndreas Färber initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP); 185baec1910SAndreas Färber initrd_size = load_image_targphys(initrd_filename, initrd_base, 186baec1910SAndreas Färber ram_size - initrd_base); 187baec1910SAndreas Färber if (initrd_size < 0) { 188baec1910SAndreas Färber hw_error("qemu: could not load initial ram disk '%s'\n", 189baec1910SAndreas Färber initrd_filename); 190baec1910SAndreas Färber exit(1); 191baec1910SAndreas Färber } 192baec1910SAndreas Färber cmdline_base = round_page(initrd_base + initrd_size); 193baec1910SAndreas Färber } else { 194baec1910SAndreas Färber initrd_base = 0; 195baec1910SAndreas Färber initrd_size = 0; 196baec1910SAndreas Färber cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP); 197baec1910SAndreas Färber } 198baec1910SAndreas Färber ppc_boot_device = 'm'; 199baec1910SAndreas Färber } else { 200baec1910SAndreas Färber kernel_base = 0; 201baec1910SAndreas Färber kernel_size = 0; 202baec1910SAndreas Färber initrd_base = 0; 203baec1910SAndreas Färber initrd_size = 0; 204baec1910SAndreas Färber ppc_boot_device = '\0'; 205baec1910SAndreas Färber for (i = 0; boot_device[i] != '\0'; i++) { 206baec1910SAndreas Färber /* TOFIX: for now, the second IDE channel is not properly 207baec1910SAndreas Färber * used by OHW. The Mac floppy disk are not emulated. 208baec1910SAndreas Färber * For now, OHW cannot boot from the network. 209baec1910SAndreas Färber */ 210baec1910SAndreas Färber #if 0 211baec1910SAndreas Färber if (boot_device[i] >= 'a' && boot_device[i] <= 'f') { 212baec1910SAndreas Färber ppc_boot_device = boot_device[i]; 213baec1910SAndreas Färber break; 214baec1910SAndreas Färber } 215baec1910SAndreas Färber #else 216baec1910SAndreas Färber if (boot_device[i] >= 'c' && boot_device[i] <= 'd') { 217baec1910SAndreas Färber ppc_boot_device = boot_device[i]; 218baec1910SAndreas Färber break; 219baec1910SAndreas Färber } 220baec1910SAndreas Färber #endif 221baec1910SAndreas Färber } 222baec1910SAndreas Färber if (ppc_boot_device == '\0') { 223baec1910SAndreas Färber fprintf(stderr, "No valid boot device for G3 Beige machine\n"); 224baec1910SAndreas Färber exit(1); 225baec1910SAndreas Färber } 226baec1910SAndreas Färber } 227baec1910SAndreas Färber 228baec1910SAndreas Färber /* Register 2 MB of ISA IO space */ 229*7d52857eSPaolo Bonzini memory_region_init_alias(isa, NULL, "isa_mmio", 230*7d52857eSPaolo Bonzini get_system_io(), 0, 0x00200000); 231*7d52857eSPaolo Bonzini memory_region_add_subregion(sysmem, 0xfe000000, isa); 232baec1910SAndreas Färber 233baec1910SAndreas Färber /* XXX: we register only 1 output pin for heathrow PIC */ 234baec1910SAndreas Färber heathrow_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); 235baec1910SAndreas Färber heathrow_irqs[0] = 236baec1910SAndreas Färber g_malloc0(smp_cpus * sizeof(qemu_irq) * 1); 237baec1910SAndreas Färber /* Connect the heathrow PIC outputs to the 6xx bus */ 238baec1910SAndreas Färber for (i = 0; i < smp_cpus; i++) { 239baec1910SAndreas Färber switch (PPC_INPUT(env)) { 240baec1910SAndreas Färber case PPC_FLAGS_INPUT_6xx: 241baec1910SAndreas Färber heathrow_irqs[i] = heathrow_irqs[0] + (i * 1); 242baec1910SAndreas Färber heathrow_irqs[i][0] = 243baec1910SAndreas Färber ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; 244baec1910SAndreas Färber break; 245baec1910SAndreas Färber default: 246baec1910SAndreas Färber hw_error("Bus model not supported on OldWorld Mac machine\n"); 247baec1910SAndreas Färber } 248baec1910SAndreas Färber } 249baec1910SAndreas Färber 250baec1910SAndreas Färber /* init basic PC hardware */ 251baec1910SAndreas Färber if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { 252baec1910SAndreas Färber hw_error("Only 6xx bus is supported on heathrow machine\n"); 253baec1910SAndreas Färber } 254baec1910SAndreas Färber pic = heathrow_pic_init(&pic_mem, 1, heathrow_irqs); 255baec1910SAndreas Färber pci_bus = pci_grackle_init(0xfec00000, pic, 256baec1910SAndreas Färber get_system_memory(), 257baec1910SAndreas Färber get_system_io()); 258baec1910SAndreas Färber pci_vga_init(pci_bus); 259baec1910SAndreas Färber 260baec1910SAndreas Färber escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0], 261baec1910SAndreas Färber serial_hds[1], ESCC_CLOCK, 4); 2622c9b15caSPaolo Bonzini memory_region_init_alias(escc_bar, NULL, "escc-bar", 263baec1910SAndreas Färber escc_mem, 0, memory_region_size(escc_mem)); 264baec1910SAndreas Färber 265baec1910SAndreas Färber for(i = 0; i < nb_nics; i++) 26629b358f9SDavid Gibson pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); 267baec1910SAndreas Färber 268baec1910SAndreas Färber 269baec1910SAndreas Färber ide_drive_get(hd, MAX_IDE_BUS); 270baec1910SAndreas Färber 271d037834aSAndreas Färber macio = pci_create(pci_bus, -1, TYPE_OLDWORLD_MACIO); 27207a7484eSAndreas Färber dev = DEVICE(macio); 27345fa67fbSAndreas Färber qdev_connect_gpio_out(dev, 0, pic[0x12]); /* CUDA */ 27414eefd0eSAlexander Graf qdev_connect_gpio_out(dev, 1, pic[0x0D]); /* IDE-0 */ 27514eefd0eSAlexander Graf qdev_connect_gpio_out(dev, 2, pic[0x02]); /* IDE-0 DMA */ 27614eefd0eSAlexander Graf qdev_connect_gpio_out(dev, 3, pic[0x0E]); /* IDE-1 */ 27714eefd0eSAlexander Graf qdev_connect_gpio_out(dev, 4, pic[0x03]); /* IDE-1 DMA */ 27845fa67fbSAndreas Färber macio_init(macio, pic_mem, escc_bar); 27907a7484eSAndreas Färber 28007a7484eSAndreas Färber macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), 28114eefd0eSAlexander Graf "ide[0]")); 28207a7484eSAndreas Färber macio_ide_init_drives(macio_ide, hd); 28307a7484eSAndreas Färber 28414eefd0eSAlexander Graf macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), 28514eefd0eSAlexander Graf "ide[1]")); 28614eefd0eSAlexander Graf macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); 287baec1910SAndreas Färber 288293c867dSAndreas Färber dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); 289293c867dSAndreas Färber adb_bus = qdev_get_child_bus(dev, "adb.0"); 290293c867dSAndreas Färber dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD); 2912e4a7c9cSAndreas Färber qdev_init_nofail(dev); 292293c867dSAndreas Färber dev = qdev_create(adb_bus, TYPE_ADB_MOUSE); 2932e4a7c9cSAndreas Färber qdev_init_nofail(dev); 29445fa67fbSAndreas Färber 295baec1910SAndreas Färber if (usb_enabled(false)) { 296baec1910SAndreas Färber pci_create_simple(pci_bus, -1, "pci-ohci"); 297baec1910SAndreas Färber } 298baec1910SAndreas Färber 299baec1910SAndreas Färber if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) 300baec1910SAndreas Färber graphic_depth = 15; 301baec1910SAndreas Färber 302baec1910SAndreas Färber /* No PCI init: the BIOS will do it */ 303baec1910SAndreas Färber 304baec1910SAndreas Färber fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); 30570db9222SEduardo Habkost fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); 306baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); 307baec1910SAndreas Färber fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); 308baec1910SAndreas Färber fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW); 309baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); 310baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); 311baec1910SAndreas Färber if (kernel_cmdline) { 312baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base); 313baec1910SAndreas Färber pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); 314baec1910SAndreas Färber } else { 315baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); 316baec1910SAndreas Färber } 317baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base); 318baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); 319baec1910SAndreas Färber fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device); 320baec1910SAndreas Färber 321baec1910SAndreas Färber fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); 322baec1910SAndreas Färber fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); 323baec1910SAndreas Färber fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); 324baec1910SAndreas Färber 325baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); 326baec1910SAndreas Färber if (kvm_enabled()) { 327baec1910SAndreas Färber #ifdef CONFIG_KVM 328baec1910SAndreas Färber uint8_t *hypercall; 329baec1910SAndreas Färber 330baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq()); 331baec1910SAndreas Färber hypercall = g_malloc(16); 332baec1910SAndreas Färber kvmppc_get_hypercall(env, hypercall, 16); 333baec1910SAndreas Färber fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); 334baec1910SAndreas Färber fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); 335baec1910SAndreas Färber #endif 336baec1910SAndreas Färber } else { 337536d8cdaSAlexander Graf fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, TBFREQ); 338baec1910SAndreas Färber } 339a1014f25SAlexander Graf /* Mac OS X requires a "known good" clock-frequency value; pass it one. */ 340a1014f25SAlexander Graf fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, 266000000); 341baec1910SAndreas Färber 342baec1910SAndreas Färber qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); 343baec1910SAndreas Färber } 344baec1910SAndreas Färber 345baec1910SAndreas Färber static QEMUMachine heathrow_machine = { 346baec1910SAndreas Färber .name = "g3beige", 347baec1910SAndreas Färber .desc = "Heathrow based PowerMAC", 348baec1910SAndreas Färber .init = ppc_heathrow_init, 349baec1910SAndreas Färber .max_cpus = MAX_CPUS, 350baec1910SAndreas Färber #ifndef TARGET_PPC64 351baec1910SAndreas Färber .is_default = 1, 352baec1910SAndreas Färber #endif 353baec1910SAndreas Färber DEFAULT_MACHINE_OPTIONS, 354baec1910SAndreas Färber }; 355baec1910SAndreas Färber 356baec1910SAndreas Färber static void heathrow_machine_init(void) 357baec1910SAndreas Färber { 358baec1910SAndreas Färber qemu_register_machine(&heathrow_machine); 359baec1910SAndreas Färber } 360baec1910SAndreas Färber 361baec1910SAndreas Färber machine_init(heathrow_machine_init); 362