Statistics
| Branch: | Revision:

root / hw / ppc_oldworld.c @ 771124e1

History | View | Annotate | Download (11.4 kB)

1 ae0bfb79 Blue Swirl
2 3cbee15b j_mayer
/*
3 4d7ca41e aurel32
 * QEMU OldWorld PowerMac (currently ~G3 Beige) hardware System Emulator
4 3cbee15b j_mayer
 *
5 3cbee15b j_mayer
 * Copyright (c) 2004-2007 Fabrice Bellard
6 3cbee15b j_mayer
 * Copyright (c) 2007 Jocelyn Mayer
7 3cbee15b j_mayer
 *
8 3cbee15b j_mayer
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 3cbee15b j_mayer
 * of this software and associated documentation files (the "Software"), to deal
10 3cbee15b j_mayer
 * in the Software without restriction, including without limitation the rights
11 3cbee15b j_mayer
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 3cbee15b j_mayer
 * copies of the Software, and to permit persons to whom the Software is
13 3cbee15b j_mayer
 * furnished to do so, subject to the following conditions:
14 3cbee15b j_mayer
 *
15 3cbee15b j_mayer
 * The above copyright notice and this permission notice shall be included in
16 3cbee15b j_mayer
 * all copies or substantial portions of the Software.
17 3cbee15b j_mayer
 *
18 3cbee15b j_mayer
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 3cbee15b j_mayer
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 3cbee15b j_mayer
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 3cbee15b j_mayer
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 3cbee15b j_mayer
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 3cbee15b j_mayer
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 3cbee15b j_mayer
 * THE SOFTWARE.
25 3cbee15b j_mayer
 */
26 87ecb68b pbrook
#include "hw.h"
27 87ecb68b pbrook
#include "ppc.h"
28 3cbee15b j_mayer
#include "ppc_mac.h"
29 7a880d93 Laurent Vivier
#include "adb.h"
30 28ce5ce6 aurel32
#include "mac_dbdma.h"
31 87ecb68b pbrook
#include "nvram.h"
32 87ecb68b pbrook
#include "pc.h"
33 87ecb68b pbrook
#include "sysemu.h"
34 87ecb68b pbrook
#include "net.h"
35 87ecb68b pbrook
#include "isa.h"
36 87ecb68b pbrook
#include "pci.h"
37 18e08a55 Michael S. Tsirkin
#include "usb-ohci.h"
38 87ecb68b pbrook
#include "boards.h"
39 271dd5e0 blueswir1
#include "fw_cfg.h"
40 7fa9ae1a blueswir1
#include "escc.h"
41 977e1244 Gerd Hoffmann
#include "ide.h"
42 ca20cf32 Blue Swirl
#include "loader.h"
43 ca20cf32 Blue Swirl
#include "elf.h"
44 dc702288 Alexander Graf
#include "kvm.h"
45 dc333cd6 Alexander Graf
#include "kvm_ppc.h"
46 2446333c Blue Swirl
#include "blockdev.h"
47 1e39101c Avi Kivity
#include "exec-memory.h"
48 3cbee15b j_mayer
49 e4bcb14c ths
#define MAX_IDE_BUS 2
50 271dd5e0 blueswir1
#define CFG_ADDR 0xf0000510
51 271dd5e0 blueswir1
52 513f789f blueswir1
static int fw_cfg_boot_set(void *opaque, const char *boot_device)
53 513f789f blueswir1
{
54 513f789f blueswir1
    fw_cfg_add_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
55 513f789f blueswir1
    return 0;
56 513f789f blueswir1
}
57 513f789f blueswir1
58 409dbce5 Aurelien Jarno
59 409dbce5 Aurelien Jarno
static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
60 409dbce5 Aurelien Jarno
{
61 409dbce5 Aurelien Jarno
    return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
62 409dbce5 Aurelien Jarno
}
63 409dbce5 Aurelien Jarno
64 b9e17a34 Alexander Graf
static target_phys_addr_t round_page(target_phys_addr_t addr)
65 b9e17a34 Alexander Graf
{
66 b9e17a34 Alexander Graf
    return (addr + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
67 b9e17a34 Alexander Graf
}
68 b9e17a34 Alexander Graf
69 c227f099 Anthony Liguori
static void ppc_heathrow_init (ram_addr_t ram_size,
70 3023f332 aliguori
                               const char *boot_device,
71 3cbee15b j_mayer
                               const char *kernel_filename,
72 3cbee15b j_mayer
                               const char *kernel_cmdline,
73 3cbee15b j_mayer
                               const char *initrd_filename,
74 3cbee15b j_mayer
                               const char *cpu_model)
75 3cbee15b j_mayer
{
76 c92bb2c7 Avi Kivity
    MemoryRegion *sysmem = get_system_memory();
77 49a2942d Blue Swirl
    CPUState *env = NULL;
78 5cea8590 Paul Brook
    char *filename;
79 3cbee15b j_mayer
    qemu_irq *pic, **heathrow_irqs;
80 3cbee15b j_mayer
    int linux_boot, i;
81 c92bb2c7 Avi Kivity
    MemoryRegion *ram = g_new(MemoryRegion, 1);
82 c92bb2c7 Avi Kivity
    MemoryRegion *bios = g_new(MemoryRegion, 1);
83 b9e17a34 Alexander Graf
    uint32_t kernel_base, initrd_base, cmdline_base = 0;
84 7373048c blueswir1
    int32_t kernel_size, initrd_size;
85 3cbee15b j_mayer
    PCIBus *pci_bus;
86 3cbee15b j_mayer
    MacIONVRAMState *nvr;
87 ae0bfb79 Blue Swirl
    int bios_size;
88 23c5e4ca Avi Kivity
    MemoryRegion *pic_mem, *dbdma_mem, *cuda_mem;
89 5b15f275 Avi Kivity
    MemoryRegion *escc_mem, *escc_bar = g_new(MemoryRegion, 1), *ide_mem[2];
90 513f789f blueswir1
    uint16_t ppc_boot_device;
91 f455e98c Gerd Hoffmann
    DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
92 271dd5e0 blueswir1
    void *fw_cfg;
93 28ce5ce6 aurel32
    void *dbdma;
94 3cbee15b j_mayer
95 3cbee15b j_mayer
    linux_boot = (kernel_filename != NULL);
96 3cbee15b j_mayer
97 3cbee15b j_mayer
    /* init CPUs */
98 3cbee15b j_mayer
    if (cpu_model == NULL)
99 f2fde45a aurel32
        cpu_model = "G3";
100 3cbee15b j_mayer
    for (i = 0; i < smp_cpus; i++) {
101 aaed909a bellard
        env = cpu_init(cpu_model);
102 aaed909a bellard
        if (!env) {
103 aaed909a bellard
            fprintf(stderr, "Unable to find PowerPC CPU definition\n");
104 aaed909a bellard
            exit(1);
105 aaed909a bellard
        }
106 b0fb43d8 aurel32
        /* Set time-base frequency to 16.6 Mhz */
107 b0fb43d8 aurel32
        cpu_ppc_tb_init(env,  16600000UL);
108 d84bda46 Blue Swirl
        qemu_register_reset((QEMUResetHandler*)&cpu_reset, env);
109 3cbee15b j_mayer
    }
110 3cbee15b j_mayer
111 3cbee15b j_mayer
    /* allocate RAM */
112 6b4079f8 aurel32
    if (ram_size > (2047 << 20)) {
113 6b4079f8 aurel32
        fprintf(stderr,
114 6b4079f8 aurel32
                "qemu: Too much memory for this machine: %d MB, maximum 2047 MB\n",
115 6b4079f8 aurel32
                ((unsigned int)ram_size / (1 << 20)));
116 6b4079f8 aurel32
        exit(1);
117 6b4079f8 aurel32
    }
118 6b4079f8 aurel32
119 c5705a77 Avi Kivity
    memory_region_init_ram(ram, "ppc_heathrow.ram", ram_size);
120 c5705a77 Avi Kivity
    vmstate_register_ram_global(ram);
121 c92bb2c7 Avi Kivity
    memory_region_add_subregion(sysmem, 0, ram);
122 a748ab6d aurel32
123 3cbee15b j_mayer
    /* allocate and load BIOS */
124 c5705a77 Avi Kivity
    memory_region_init_ram(bios, "ppc_heathrow.bios", BIOS_SIZE);
125 c5705a77 Avi Kivity
    vmstate_register_ram_global(bios);
126 3cbee15b j_mayer
    if (bios_name == NULL)
127 992e5acd blueswir1
        bios_name = PROM_FILENAME;
128 5cea8590 Paul Brook
    filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
129 c92bb2c7 Avi Kivity
    memory_region_set_readonly(bios, true);
130 c92bb2c7 Avi Kivity
    memory_region_add_subregion(sysmem, PROM_ADDR, bios);
131 992e5acd blueswir1
132 992e5acd blueswir1
    /* Load OpenBIOS (ELF) */
133 5cea8590 Paul Brook
    if (filename) {
134 409dbce5 Aurelien Jarno
        bios_size = load_elf(filename, 0, NULL, NULL, NULL, NULL,
135 409dbce5 Aurelien Jarno
                             1, ELF_MACHINE, 0);
136 7267c094 Anthony Liguori
        g_free(filename);
137 5cea8590 Paul Brook
    } else {
138 5cea8590 Paul Brook
        bios_size = -1;
139 5cea8590 Paul Brook
    }
140 3cbee15b j_mayer
    if (bios_size < 0 || bios_size > BIOS_SIZE) {
141 5cea8590 Paul Brook
        hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name);
142 3cbee15b j_mayer
        exit(1);
143 3cbee15b j_mayer
    }
144 3cbee15b j_mayer
145 3cbee15b j_mayer
    if (linux_boot) {
146 36bee1e3 aurel32
        uint64_t lowaddr = 0;
147 ca20cf32 Blue Swirl
        int bswap_needed;
148 ca20cf32 Blue Swirl
149 ca20cf32 Blue Swirl
#ifdef BSWAP_NEEDED
150 ca20cf32 Blue Swirl
        bswap_needed = 1;
151 ca20cf32 Blue Swirl
#else
152 ca20cf32 Blue Swirl
        bswap_needed = 0;
153 ca20cf32 Blue Swirl
#endif
154 3cbee15b j_mayer
        kernel_base = KERNEL_LOAD_ADDR;
155 409dbce5 Aurelien Jarno
        kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL,
156 409dbce5 Aurelien Jarno
                               NULL, &lowaddr, NULL, 1, ELF_MACHINE, 0);
157 52f163b7 blueswir1
        if (kernel_size < 0)
158 52f163b7 blueswir1
            kernel_size = load_aout(kernel_filename, kernel_base,
159 ca20cf32 Blue Swirl
                                    ram_size - kernel_base, bswap_needed,
160 ca20cf32 Blue Swirl
                                    TARGET_PAGE_SIZE);
161 52f163b7 blueswir1
        if (kernel_size < 0)
162 52f163b7 blueswir1
            kernel_size = load_image_targphys(kernel_filename,
163 52f163b7 blueswir1
                                              kernel_base,
164 52f163b7 blueswir1
                                              ram_size - kernel_base);
165 3cbee15b j_mayer
        if (kernel_size < 0) {
166 2ac71179 Paul Brook
            hw_error("qemu: could not load kernel '%s'\n",
167 3cbee15b j_mayer
                      kernel_filename);
168 3cbee15b j_mayer
            exit(1);
169 3cbee15b j_mayer
        }
170 3cbee15b j_mayer
        /* load initrd */
171 3cbee15b j_mayer
        if (initrd_filename) {
172 b9e17a34 Alexander Graf
            initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
173 dcac9679 pbrook
            initrd_size = load_image_targphys(initrd_filename, initrd_base,
174 dcac9679 pbrook
                                              ram_size - initrd_base);
175 3cbee15b j_mayer
            if (initrd_size < 0) {
176 2ac71179 Paul Brook
                hw_error("qemu: could not load initial ram disk '%s'\n",
177 2ac71179 Paul Brook
                         initrd_filename);
178 3cbee15b j_mayer
                exit(1);
179 3cbee15b j_mayer
            }
180 b9e17a34 Alexander Graf
            cmdline_base = round_page(initrd_base + initrd_size);
181 3cbee15b j_mayer
        } else {
182 3cbee15b j_mayer
            initrd_base = 0;
183 3cbee15b j_mayer
            initrd_size = 0;
184 b9e17a34 Alexander Graf
            cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP);
185 3cbee15b j_mayer
        }
186 6ac0e82d balrog
        ppc_boot_device = 'm';
187 3cbee15b j_mayer
    } else {
188 3cbee15b j_mayer
        kernel_base = 0;
189 3cbee15b j_mayer
        kernel_size = 0;
190 3cbee15b j_mayer
        initrd_base = 0;
191 3cbee15b j_mayer
        initrd_size = 0;
192 28c5af54 j_mayer
        ppc_boot_device = '\0';
193 0d913fdb j_mayer
        for (i = 0; boot_device[i] != '\0'; i++) {
194 28c5af54 j_mayer
            /* TOFIX: for now, the second IDE channel is not properly
195 0d913fdb j_mayer
             *        used by OHW. The Mac floppy disk are not emulated.
196 28c5af54 j_mayer
             *        For now, OHW cannot boot from the network.
197 28c5af54 j_mayer
             */
198 28c5af54 j_mayer
#if 0
199 0d913fdb j_mayer
            if (boot_device[i] >= 'a' && boot_device[i] <= 'f') {
200 0d913fdb j_mayer
                ppc_boot_device = boot_device[i];
201 28c5af54 j_mayer
                break;
202 0d913fdb j_mayer
            }
203 28c5af54 j_mayer
#else
204 0d913fdb j_mayer
            if (boot_device[i] >= 'c' && boot_device[i] <= 'd') {
205 0d913fdb j_mayer
                ppc_boot_device = boot_device[i];
206 28c5af54 j_mayer
                break;
207 0d913fdb j_mayer
            }
208 28c5af54 j_mayer
#endif
209 28c5af54 j_mayer
        }
210 28c5af54 j_mayer
        if (ppc_boot_device == '\0') {
211 8a901def aurel32
            fprintf(stderr, "No valid boot device for G3 Beige machine\n");
212 28c5af54 j_mayer
            exit(1);
213 28c5af54 j_mayer
        }
214 3cbee15b j_mayer
    }
215 3cbee15b j_mayer
216 3cbee15b j_mayer
    /* Register 2 MB of ISA IO space */
217 968d683c Alexander Graf
    isa_mmio_init(0xfe000000, 0x00200000);
218 3cbee15b j_mayer
219 3cbee15b j_mayer
    /* XXX: we register only 1 output pin for heathrow PIC */
220 7267c094 Anthony Liguori
    heathrow_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
221 3cbee15b j_mayer
    heathrow_irqs[0] =
222 7267c094 Anthony Liguori
        g_malloc0(smp_cpus * sizeof(qemu_irq) * 1);
223 3cbee15b j_mayer
    /* Connect the heathrow PIC outputs to the 6xx bus */
224 3cbee15b j_mayer
    for (i = 0; i < smp_cpus; i++) {
225 3cbee15b j_mayer
        switch (PPC_INPUT(env)) {
226 3cbee15b j_mayer
        case PPC_FLAGS_INPUT_6xx:
227 3cbee15b j_mayer
            heathrow_irqs[i] = heathrow_irqs[0] + (i * 1);
228 3cbee15b j_mayer
            heathrow_irqs[i][0] =
229 3cbee15b j_mayer
                ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT];
230 3cbee15b j_mayer
            break;
231 3cbee15b j_mayer
        default:
232 2ac71179 Paul Brook
            hw_error("Bus model not supported on OldWorld Mac machine\n");
233 3cbee15b j_mayer
        }
234 3cbee15b j_mayer
    }
235 3cbee15b j_mayer
236 3cbee15b j_mayer
    /* init basic PC hardware */
237 3cbee15b j_mayer
    if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {
238 2ac71179 Paul Brook
        hw_error("Only 6xx bus is supported on heathrow machine\n");
239 3cbee15b j_mayer
    }
240 23c5e4ca Avi Kivity
    pic = heathrow_pic_init(&pic_mem, 1, heathrow_irqs);
241 aee97b84 Avi Kivity
    pci_bus = pci_grackle_init(0xfec00000, pic,
242 aee97b84 Avi Kivity
                               get_system_memory(),
243 aee97b84 Avi Kivity
                               get_system_io());
244 78895427 Gerd Hoffmann
    pci_vga_init(pci_bus);
245 aae9366a j_mayer
246 b39491a8 Alexander Graf
    escc_mem = escc_init(0, pic[0x0f], pic[0x10], serial_hds[0],
247 7fa9ae1a blueswir1
                               serial_hds[1], ESCC_CLOCK, 4);
248 5b15f275 Avi Kivity
    memory_region_init_alias(escc_bar, "escc-bar",
249 5b15f275 Avi Kivity
                             escc_mem, 0, memory_region_size(escc_mem));
250 aae9366a j_mayer
251 cb457d76 aliguori
    for(i = 0; i < nb_nics; i++)
252 07caea31 Markus Armbruster
        pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
253 0d913fdb j_mayer
254 e4bcb14c ths
255 75717903 Isaku Yamahata
    ide_drive_get(hd, MAX_IDE_BUS);
256 bd4524ed aurel32
257 bd4524ed aurel32
    /* First IDE channel is a MAC IDE on the MacIO bus */
258 23c5e4ca Avi Kivity
    dbdma = DBDMA_init(&dbdma_mem);
259 23c5e4ca Avi Kivity
    ide_mem[0] = NULL;
260 23c5e4ca Avi Kivity
    ide_mem[1] = pmac_ide_init(hd, pic[0x0D], dbdma, 0x16, pic[0x02]);
261 e4bcb14c ths
262 bd4524ed aurel32
    /* Second IDE channel is a CMD646 on the PCI bus */
263 75717903 Isaku Yamahata
    hd[0] = hd[MAX_IDE_DEVS];
264 75717903 Isaku Yamahata
    hd[1] = hd[MAX_IDE_DEVS + 1];
265 bd4524ed aurel32
    hd[3] = hd[2] = NULL;
266 bd4524ed aurel32
    pci_cmd646_ide_init(pci_bus, hd, 0);
267 3cbee15b j_mayer
268 3cbee15b j_mayer
    /* cuda also initialize ADB */
269 23c5e4ca Avi Kivity
    cuda_init(&cuda_mem, pic[0x12]);
270 3cbee15b j_mayer
271 3cbee15b j_mayer
    adb_kbd_init(&adb_bus);
272 3cbee15b j_mayer
    adb_mouse_init(&adb_bus);
273 aae9366a j_mayer
274 23c5e4ca Avi Kivity
    nvr = macio_nvram_init(0x2000, 4);
275 3cbee15b j_mayer
    pmac_format_nvram_partition(nvr, 0x2000);
276 3cbee15b j_mayer
277 23c5e4ca Avi Kivity
    macio_init(pci_bus, PCI_DEVICE_ID_APPLE_343S1201, 1, pic_mem,
278 5b15f275 Avi Kivity
               dbdma_mem, cuda_mem, nvr, 2, ide_mem, escc_bar);
279 3cbee15b j_mayer
280 3cbee15b j_mayer
    if (usb_enabled) {
281 a67ba3b6 Paul Brook
        usb_ohci_init_pci(pci_bus, -1);
282 3cbee15b j_mayer
    }
283 3cbee15b j_mayer
284 3cbee15b j_mayer
    if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8)
285 3cbee15b j_mayer
        graphic_depth = 15;
286 3cbee15b j_mayer
287 3cbee15b j_mayer
    /* No PCI init: the BIOS will do it */
288 3cbee15b j_mayer
289 271dd5e0 blueswir1
    fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
290 271dd5e0 blueswir1
    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
291 271dd5e0 blueswir1
    fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
292 271dd5e0 blueswir1
    fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW);
293 513f789f blueswir1
    fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
294 513f789f blueswir1
    fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size);
295 513f789f blueswir1
    if (kernel_cmdline) {
296 b9e17a34 Alexander Graf
        fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base);
297 b9e17a34 Alexander Graf
        pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline);
298 513f789f blueswir1
    } else {
299 513f789f blueswir1
        fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0);
300 513f789f blueswir1
    }
301 513f789f blueswir1
    fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base);
302 513f789f blueswir1
    fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size);
303 513f789f blueswir1
    fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device);
304 7f1aec5f Laurent Vivier
305 7f1aec5f Laurent Vivier
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width);
306 7f1aec5f Laurent Vivier
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height);
307 7f1aec5f Laurent Vivier
    fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth);
308 7f1aec5f Laurent Vivier
309 45024f09 Alexander Graf
    fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled());
310 dc333cd6 Alexander Graf
    if (kvm_enabled()) {
311 dc333cd6 Alexander Graf
#ifdef CONFIG_KVM
312 45024f09 Alexander Graf
        uint8_t *hypercall;
313 45024f09 Alexander Graf
314 dc333cd6 Alexander Graf
        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, kvmppc_get_tbfreq());
315 7267c094 Anthony Liguori
        hypercall = g_malloc(16);
316 45024f09 Alexander Graf
        kvmppc_get_hypercall(env, hypercall, 16);
317 45024f09 Alexander Graf
        fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16);
318 45024f09 Alexander Graf
        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid());
319 dc333cd6 Alexander Graf
#endif
320 dc333cd6 Alexander Graf
    } else {
321 dc333cd6 Alexander Graf
        fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, get_ticks_per_sec());
322 dc333cd6 Alexander Graf
    }
323 dc333cd6 Alexander Graf
324 513f789f blueswir1
    qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
325 3cbee15b j_mayer
}
326 3cbee15b j_mayer
327 f80f9ec9 Anthony Liguori
static QEMUMachine heathrow_machine = {
328 4d7ca41e aurel32
    .name = "g3beige",
329 4b32e168 aliguori
    .desc = "Heathrow based PowerMAC",
330 4b32e168 aliguori
    .init = ppc_heathrow_init,
331 3d878caa balrog
    .max_cpus = MAX_CPUS,
332 46214a27 Andreas Färber
#ifndef TARGET_PPC64
333 0c257437 Anthony Liguori
    .is_default = 1,
334 46214a27 Andreas Färber
#endif
335 3cbee15b j_mayer
};
336 f80f9ec9 Anthony Liguori
337 f80f9ec9 Anthony Liguori
static void heathrow_machine_init(void)
338 f80f9ec9 Anthony Liguori
{
339 f80f9ec9 Anthony Liguori
    qemu_register_machine(&heathrow_machine);
340 f80f9ec9 Anthony Liguori
}
341 f80f9ec9 Anthony Liguori
342 f80f9ec9 Anthony Liguori
machine_init(heathrow_machine_init);