xref: /openbmc/qemu/hw/ppc/mac_oldworld.c (revision 2e4a7c9c5df442d4223e738f7e8f73192b8b2a65)
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"
27baec1910SAndreas Färber #include "hw/ppc.h"
28baec1910SAndreas Färber #include "mac.h"
29baec1910SAndreas Färber #include "hw/adb.h"
30baec1910SAndreas Färber #include "hw/nvram.h"
31baec1910SAndreas Färber #include "sysemu/sysemu.h"
32baec1910SAndreas Färber #include "net/net.h"
33baec1910SAndreas Färber #include "hw/isa.h"
34baec1910SAndreas Färber #include "hw/pci/pci.h"
35baec1910SAndreas Färber #include "hw/boards.h"
36baec1910SAndreas Färber #include "hw/fw_cfg.h"
37baec1910SAndreas Färber #include "hw/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
48baec1910SAndreas Färber 
49baec1910SAndreas Färber static int fw_cfg_boot_set(void *opaque, const char *boot_device)
50baec1910SAndreas Färber {
51baec1910SAndreas Färber     fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
52baec1910SAndreas Färber     return 0;
53baec1910SAndreas Färber }
54baec1910SAndreas Färber 
55baec1910SAndreas Färber 
56baec1910SAndreas Färber static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
57baec1910SAndreas Färber {
58baec1910SAndreas Färber     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
59baec1910SAndreas Färber }
60baec1910SAndreas Färber 
61baec1910SAndreas Färber static hwaddr round_page(hwaddr addr)
62baec1910SAndreas Färber {
63baec1910SAndreas Färber     return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
64baec1910SAndreas Färber }
65baec1910SAndreas Färber 
66baec1910SAndreas Färber static void ppc_heathrow_reset(void *opaque)
67baec1910SAndreas Färber {
68baec1910SAndreas Färber     PowerPCCPU *cpu = opaque;
69baec1910SAndreas Färber 
70baec1910SAndreas Färber     cpu_reset(CPU(cpu));
71baec1910SAndreas Färber }
72baec1910SAndreas Färber 
73baec1910SAndreas Färber static void ppc_heathrow_init(QEMUMachineInitArgs *args)
74baec1910SAndreas Färber {
75baec1910SAndreas Färber     ram_addr_t ram_size = args->ram_size;
76baec1910SAndreas Färber     const char *cpu_model = args->cpu_model;
77baec1910SAndreas Färber     const char *kernel_filename = args->kernel_filename;
78baec1910SAndreas Färber     const char *kernel_cmdline = args->kernel_cmdline;
79baec1910SAndreas Färber     const char *initrd_filename = args->initrd_filename;
80baec1910SAndreas Färber     const char *boot_device = args->boot_device;
81baec1910SAndreas Färber     MemoryRegion *sysmem = get_system_memory();
82baec1910SAndreas Färber     PowerPCCPU *cpu = NULL;
83baec1910SAndreas Färber     CPUPPCState *env = NULL;
84baec1910SAndreas Färber     char *filename;
85baec1910SAndreas Färber     qemu_irq *pic, **heathrow_irqs;
86baec1910SAndreas Färber     int linux_boot, i;
87baec1910SAndreas Färber     MemoryRegion *ram = g_new(MemoryRegion, 1);
88baec1910SAndreas Färber     MemoryRegion *bios = g_new(MemoryRegion, 1);
89baec1910SAndreas Färber     uint32_t kernel_base, initrd_base, cmdline_base = 0;
90baec1910SAndreas Färber     int32_t kernel_size, initrd_size;
91baec1910SAndreas Färber     PCIBus *pci_bus;
92d037834aSAndreas Färber     PCIDevice *macio;
9307a7484eSAndreas Färber     MACIOIDEState *macio_ide;
9407a7484eSAndreas Färber     DeviceState *dev;
95baec1910SAndreas Färber     int bios_size;
9645fa67fbSAndreas Färber     MemoryRegion *pic_mem;
9707a7484eSAndreas Färber     MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1);
98baec1910SAndreas Färber     uint16_t ppc_boot_device;
99baec1910SAndreas Färber     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
100baec1910SAndreas Färber     void *fw_cfg;
101baec1910SAndreas Färber 
102baec1910SAndreas Färber     linux_boot = (kernel_filename != NULL);
103baec1910SAndreas Färber 
104baec1910SAndreas Färber     /* init CPUs */
105baec1910SAndreas Färber     if (cpu_model == NULL)
106baec1910SAndreas Färber         cpu_model = "G3";
107baec1910SAndreas Färber     for (i = 0; i < smp_cpus; i++) {
108baec1910SAndreas Färber         cpu = cpu_ppc_init(cpu_model);
109baec1910SAndreas Färber         if (cpu == NULL) {
110baec1910SAndreas Färber             fprintf(stderr, "Unable to find PowerPC CPU definition\n");
111baec1910SAndreas Färber             exit(1);
112baec1910SAndreas Färber         }
113baec1910SAndreas Färber         env = &cpu->env;
114baec1910SAndreas Färber 
115baec1910SAndreas Färber         /* Set time-base frequency to 16.6 Mhz */
116baec1910SAndreas Färber         cpu_ppc_tb_init(env,  16600000UL);
117baec1910SAndreas Färber         qemu_register_reset(ppc_heathrow_reset, cpu);
118baec1910SAndreas Färber     }
119baec1910SAndreas Färber 
120baec1910SAndreas Färber     /* allocate RAM */
121baec1910SAndreas Färber     if (ram_size > (2047 << 20)) {
122baec1910SAndreas Färber         fprintf(stderr,
123baec1910SAndreas Färber                 "qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n",
124baec1910SAndreas Färber                 ((unsigned int)ram_size / (1 << 20)));
125baec1910SAndreas Färber         exit(1);
126baec1910SAndreas Färber     }
127baec1910SAndreas Färber 
128baec1910SAndreas Färber     memory_region_init_ram(ram, "ppc_heathrow.ram", ram_size);
129baec1910SAndreas Färber     vmstate_register_ram_global(ram);
130baec1910SAndreas Färber     memory_region_add_subregion(sysmem, 0, ram);
131baec1910SAndreas Färber 
132baec1910SAndreas Färber     /* allocate and load BIOS */
133baec1910SAndreas Färber     memory_region_init_ram(bios, "ppc_heathrow.bios", BIOS_SIZE);
134baec1910SAndreas Färber     vmstate_register_ram_global(bios);
135baec1910SAndreas Färber     if (bios_name == NULL)
136baec1910SAndreas Färber         bios_name = PROM_FILENAME;
137baec1910SAndreas Färber     filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
138baec1910SAndreas Färber     memory_region_set_readonly(bios, true);
139baec1910SAndreas Färber     memory_region_add_subregion(sysmem, PROM_ADDR, bios);
140baec1910SAndreas Färber 
141baec1910SAndreas Färber     /* Load OpenBIOS (ELF) */
142baec1910SAndreas Färber     if (filename) {
143baec1910SAndreas Färber         bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL,
144baec1910SAndreas Färber                              1, ELF_MACHINE, 0);
145baec1910SAndreas Färber         g_free(filename);
146baec1910SAndreas Färber     } else {
147baec1910SAndreas Färber         bios_size = -1;
148baec1910SAndreas Färber     }
149baec1910SAndreas Färber     if (bios_size < 0 || bios_size > BIOS_SIZE) {
150baec1910SAndreas Färber         hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name);
151baec1910SAndreas Färber         exit(1);
152baec1910SAndreas Färber     }
153baec1910SAndreas Färber 
154baec1910SAndreas Färber     if (linux_boot) {
155baec1910SAndreas Färber         uint64_t lowaddr = 0;
156baec1910SAndreas Färber         int bswap_needed;
157baec1910SAndreas Färber 
158baec1910SAndreas Färber #ifdef BSWAP_NEEDED
159baec1910SAndreas Färber         bswap_needed = 1;
160baec1910SAndreas Färber #else
161baec1910SAndreas Färber         bswap_needed = 0;
162baec1910SAndreas Färber #endif
163baec1910SAndreas Färber         kernel_base = KERNEL_LOAD_ADDR;
164baec1910SAndreas Färber         kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
165baec1910SAndreas Färber                                NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
166baec1910SAndreas Färber         if (kernel_size < 0)
167baec1910SAndreas Färber             kernel_size = load_aout(kernel_filename, kernel_base,
168baec1910SAndreas Färber                                     ram_size - kernel_base, bswap_needed,
169baec1910SAndreas Färber                                     TARGET_PAGE_SIZE);
170baec1910SAndreas Färber         if (kernel_size < 0)
171baec1910SAndreas Färber             kernel_size = load_image_targphys(kernel_filename,
172baec1910SAndreas Färber                                               kernel_base,
173baec1910SAndreas Färber                                               ram_size - kernel_base);
174baec1910SAndreas Färber         if (kernel_size < 0) {
175baec1910SAndreas Färber             hw_error("qemu: could not load kernel '%s'\n",
176baec1910SAndreas Färber                       kernel_filename);
177baec1910SAndreas Färber             exit(1);
178baec1910SAndreas Färber         }
179baec1910SAndreas Färber         /* load initrd */
180baec1910SAndreas Färber         if (initrd_filename) {
181baec1910SAndreas Färber             initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
182baec1910SAndreas Färber             initrd_size = load_image_targphys(initrd_filename, initrd_base,
183baec1910SAndreas Färber                                               ram_size - initrd_base);
184baec1910SAndreas Färber             if (initrd_size < 0) {
185baec1910SAndreas Färber                 hw_error("qemu: could not load initial ram disk '%s'\n",
186baec1910SAndreas Färber                          initrd_filename);
187baec1910SAndreas Färber                 exit(1);
188baec1910SAndreas Färber             }
189baec1910SAndreas Färber             cmdline_base = round_page(initrd_base + initrd_size);
190baec1910SAndreas Färber         } else {
191baec1910SAndreas Färber             initrd_base = 0;
192baec1910SAndreas Färber             initrd_size = 0;
193baec1910SAndreas Färber             cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
194baec1910SAndreas Färber         }
195baec1910SAndreas Färber         ppc_boot_device = 'm';
196baec1910SAndreas Färber     } else {
197baec1910SAndreas Färber         kernel_base = 0;
198baec1910SAndreas Färber         kernel_size = 0;
199baec1910SAndreas Färber         initrd_base = 0;
200baec1910SAndreas Färber         initrd_size = 0;
201baec1910SAndreas Färber         ppc_boot_device = '\0';
202baec1910SAndreas Färber         for (i = 0; boot_device[i] != '\0'; i++) {
203baec1910SAndreas Färber             /* TOFIX: for now, the second IDE channel is not properly
204baec1910SAndreas Färber              *        used by OHW. The Mac floppy disk are not emulated.
205baec1910SAndreas Färber              *        For now, OHW cannot boot from the network.
206baec1910SAndreas Färber              */
207baec1910SAndreas Färber #if 0
208baec1910SAndreas Färber             if (boot_device[i] >= 'a' && boot_device[i] <= 'f') {
209baec1910SAndreas Färber                 ppc_boot_device = boot_device[i];
210baec1910SAndreas Färber                 break;
211baec1910SAndreas Färber             }
212baec1910SAndreas Färber #else
213baec1910SAndreas Färber             if (boot_device[i] >= 'c' && boot_device[i] <= 'd') {
214baec1910SAndreas Färber                 ppc_boot_device = boot_device[i];
215baec1910SAndreas Färber                 break;
216baec1910SAndreas Färber             }
217baec1910SAndreas Färber #endif
218baec1910SAndreas Färber         }
219baec1910SAndreas Färber         if (ppc_boot_device == '\0') {
220baec1910SAndreas Färber             fprintf(stderr, "No valid boot device for G3 Beige machine\n");
221baec1910SAndreas Färber             exit(1);
222baec1910SAndreas Färber         }
223baec1910SAndreas Färber     }
224baec1910SAndreas Färber 
225baec1910SAndreas Färber     /* Register 2 MB of ISA IO space */
226baec1910SAndreas Färber     isa_mmio_init(0xfe000000, 0x00200000);
227baec1910SAndreas Färber 
228baec1910SAndreas Färber     /* XXX: we register only 1 output pin for heathrow PIC */
229baec1910SAndreas Färber     heathrow_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
230baec1910SAndreas Färber     heathrow_irqs[0] =
231baec1910SAndreas Färber         g_malloc0(smp_cpus * sizeof(qemu_irq) * 1);
232baec1910SAndreas Färber     /* Connect the heathrow PIC outputs to the 6xx bus */
233baec1910SAndreas Färber     for (i = 0; i < smp_cpus; i++) {
234baec1910SAndreas Färber         switch (PPC_INPUT(env)) {
235baec1910SAndreas Färber         case PPC_FLAGS_INPUT_6xx:
236baec1910SAndreas Färber             heathrow_irqs[i] = heathrow_irqs[0] + (i * 1);
237baec1910SAndreas Färber             heathrow_irqs[i][0] =
238baec1910SAndreas Färber                 ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT];
239baec1910SAndreas Färber             break;
240baec1910SAndreas Färber         default:
241baec1910SAndreas Färber             hw_error("Bus model not supported on OldWorld Mac machine\n");
242baec1910SAndreas Färber         }
243baec1910SAndreas Färber     }
244baec1910SAndreas Färber 
245baec1910SAndreas Färber     /* init basic PC hardware */
246baec1910SAndreas Färber     if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {
247baec1910SAndreas Färber         hw_error("Only 6xx bus is supported on heathrow machine\n");
248baec1910SAndreas Färber     }
249baec1910SAndreas Färber     pic = heathrow_pic_init(&pic_mem, 1, heathrow_irqs);
250baec1910SAndreas Färber     pci_bus = pci_grackle_init(0xfec00000, pic,
251baec1910SAndreas Färber                                get_system_memory(),
252baec1910SAndreas Färber                                get_system_io());
253baec1910SAndreas Färber     pci_vga_init(pci_bus);
254baec1910SAndreas Färber 
255baec1910SAndreas Färber     escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
256baec1910SAndreas Färber                                serial_hds[1], ESCC_CLOCK, 4);
257baec1910SAndreas Färber     memory_region_init_alias(escc_bar, "escc-bar",
258baec1910SAndreas Färber                              escc_mem, 0, memory_region_size(escc_mem));
259baec1910SAndreas Färber 
260baec1910SAndreas Färber     for(i = 0; i < nb_nics; i++)
261baec1910SAndreas Färber         pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
262baec1910SAndreas Färber 
263baec1910SAndreas Färber 
264baec1910SAndreas Färber     ide_drive_get(hd, MAX_IDE_BUS);
265baec1910SAndreas Färber 
266d037834aSAndreas Färber     macio = pci_create(pci_bus, -1, TYPE_OLDWORLD_MACIO);
26707a7484eSAndreas Färber     dev = DEVICE(macio);
26845fa67fbSAndreas Färber     qdev_connect_gpio_out(dev, 0, pic[0x12]); /* CUDA */
26945fa67fbSAndreas Färber     qdev_connect_gpio_out(dev, 1, pic[0x0D]); /* IDE */
27045fa67fbSAndreas Färber     qdev_connect_gpio_out(dev, 2, pic[0x02]); /* IDE DMA */
27145fa67fbSAndreas Färber     macio_init(macio, pic_mem, escc_bar);
27207a7484eSAndreas Färber 
27307a7484eSAndreas Färber     /* First IDE channel is a MAC IDE on the MacIO bus */
27407a7484eSAndreas Färber     macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio),
27507a7484eSAndreas Färber                                                         "ide"));
27607a7484eSAndreas Färber     macio_ide_init_drives(macio_ide, hd);
27707a7484eSAndreas Färber 
27807a7484eSAndreas Färber     /* Second IDE channel is a CMD646 on the PCI bus */
27907a7484eSAndreas Färber     hd[0] = hd[MAX_IDE_DEVS];
28007a7484eSAndreas Färber     hd[1] = hd[MAX_IDE_DEVS + 1];
28107a7484eSAndreas Färber     hd[3] = hd[2] = NULL;
28207a7484eSAndreas Färber     pci_cmd646_ide_init(pci_bus, hd, 0);
283baec1910SAndreas Färber 
284*2e4a7c9cSAndreas Färber     dev = qdev_create(BUS(&adb_bus), TYPE_ADB_KEYBOARD);
285*2e4a7c9cSAndreas Färber     qdev_init_nofail(dev);
286*2e4a7c9cSAndreas Färber     dev = qdev_create(BUS(&adb_bus), TYPE_ADB_MOUSE);
287*2e4a7c9cSAndreas Färber     qdev_init_nofail(dev);
28845fa67fbSAndreas Färber 
289baec1910SAndreas Färber     if (usb_enabled(false)) {
290baec1910SAndreas Färber         pci_create_simple(pci_bus, -1, "pci-ohci");
291baec1910SAndreas Färber     }
292baec1910SAndreas Färber 
293baec1910SAndreas Färber     if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
294baec1910SAndreas Färber         graphic_depth = 15;
295baec1910SAndreas Färber 
296baec1910SAndreas Färber     /* No PCI init: the BIOS will do it */
297baec1910SAndreas Färber 
298baec1910SAndreas Färber     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
299baec1910SAndreas Färber     fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
300baec1910SAndreas Färber     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
301baec1910SAndreas Färber     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW);
302baec1910SAndreas Färber     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
303baec1910SAndreas Färber     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
304baec1910SAndreas Färber     if (kernel_cmdline) {
305baec1910SAndreas Färber         fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base);
306baec1910SAndreas Färber         pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline);
307baec1910SAndreas Färber     } else {
308baec1910SAndreas Färber         fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
309baec1910SAndreas Färber     }
310baec1910SAndreas Färber     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base);
311baec1910SAndreas Färber     fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
312baec1910SAndreas Färber     fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
313baec1910SAndreas Färber 
314baec1910SAndreas Färber     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
315baec1910SAndreas Färber     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
316baec1910SAndreas Färber     fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
317baec1910SAndreas Färber 
318baec1910SAndreas Färber     fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
319baec1910SAndreas Färber     if (kvm_enabled()) {
320baec1910SAndreas Färber #ifdef CONFIG_KVM
321baec1910SAndreas Färber         uint8_t *hypercall;
322baec1910SAndreas Färber 
323baec1910SAndreas Färber         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq());
324baec1910SAndreas Färber         hypercall = g_malloc(16);
325baec1910SAndreas Färber         kvmppc_get_hypercall(env, hypercall, 16);
326baec1910SAndreas Färber         fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16);
327baec1910SAndreas Färber         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid());
328baec1910SAndreas Färber #endif
329baec1910SAndreas Färber     } else {
330baec1910SAndreas Färber         fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, get_ticks_per_sec());
331baec1910SAndreas Färber     }
332baec1910SAndreas Färber 
333baec1910SAndreas Färber     qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
334baec1910SAndreas Färber }
335baec1910SAndreas Färber 
336baec1910SAndreas Färber static QEMUMachine heathrow_machine = {
337baec1910SAndreas Färber     .name = "g3beige",
338baec1910SAndreas Färber     .desc = "Heathrow based PowerMAC",
339baec1910SAndreas Färber     .init = ppc_heathrow_init,
340baec1910SAndreas Färber     .max_cpus = MAX_CPUS,
341baec1910SAndreas Färber #ifndef TARGET_PPC64
342baec1910SAndreas Färber     .is_default = 1,
343baec1910SAndreas Färber #endif
344baec1910SAndreas Färber     DEFAULT_MACHINE_OPTIONS,
345baec1910SAndreas Färber };
346baec1910SAndreas Färber 
347baec1910SAndreas Färber static void heathrow_machine_init(void)
348baec1910SAndreas Färber {
349baec1910SAndreas Färber     qemu_register_machine(&heathrow_machine);
350baec1910SAndreas Färber }
351baec1910SAndreas Färber 
352baec1910SAndreas Färber machine_init(heathrow_machine_init);
353