Statistics
| Branch: | Revision:

root / hw / pc_piix.c @ 19857e62

History | View | Annotate | Download (16.1 kB)

1 845773ab Isaku Yamahata
/*
2 845773ab Isaku Yamahata
 * QEMU PC System Emulator
3 845773ab Isaku Yamahata
 *
4 845773ab Isaku Yamahata
 * Copyright (c) 2003-2004 Fabrice Bellard
5 845773ab Isaku Yamahata
 *
6 845773ab Isaku Yamahata
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 845773ab Isaku Yamahata
 * of this software and associated documentation files (the "Software"), to deal
8 845773ab Isaku Yamahata
 * in the Software without restriction, including without limitation the rights
9 845773ab Isaku Yamahata
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 845773ab Isaku Yamahata
 * copies of the Software, and to permit persons to whom the Software is
11 845773ab Isaku Yamahata
 * furnished to do so, subject to the following conditions:
12 845773ab Isaku Yamahata
 *
13 845773ab Isaku Yamahata
 * The above copyright notice and this permission notice shall be included in
14 845773ab Isaku Yamahata
 * all copies or substantial portions of the Software.
15 845773ab Isaku Yamahata
 *
16 845773ab Isaku Yamahata
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 845773ab Isaku Yamahata
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 845773ab Isaku Yamahata
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 845773ab Isaku Yamahata
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 845773ab Isaku Yamahata
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 845773ab Isaku Yamahata
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 845773ab Isaku Yamahata
 * THE SOFTWARE.
23 845773ab Isaku Yamahata
 */
24 845773ab Isaku Yamahata
25 ae0a5466 Avi Kivity
#include <glib.h>
26 ae0a5466 Avi Kivity
27 845773ab Isaku Yamahata
#include "hw.h"
28 845773ab Isaku Yamahata
#include "pc.h"
29 845773ab Isaku Yamahata
#include "apic.h"
30 845773ab Isaku Yamahata
#include "pci.h"
31 845773ab Isaku Yamahata
#include "usb-uhci.h"
32 845773ab Isaku Yamahata
#include "usb-ohci.h"
33 845773ab Isaku Yamahata
#include "net.h"
34 845773ab Isaku Yamahata
#include "boards.h"
35 845773ab Isaku Yamahata
#include "ide.h"
36 845773ab Isaku Yamahata
#include "kvm.h"
37 0ec329da Jan Kiszka
#include "kvmclock.h"
38 666daa68 Markus Armbruster
#include "sysemu.h"
39 96051119 Blue Swirl
#include "sysbus.h"
40 0dfa5ef9 Isaku Yamahata
#include "arch_init.h"
41 2446333c Blue Swirl
#include "blockdev.h"
42 a88df0b9 Isaku Yamahata
#include "smbus.h"
43 29d3ccde Anthony PERARD
#include "xen.h"
44 4aa63af1 Avi Kivity
#include "memory.h"
45 4aa63af1 Avi Kivity
#include "exec-memory.h"
46 29d3ccde Anthony PERARD
#ifdef CONFIG_XEN
47 29d3ccde Anthony PERARD
#  include <xen/hvm/hvm_info_table.h>
48 29d3ccde Anthony PERARD
#endif
49 845773ab Isaku Yamahata
50 845773ab Isaku Yamahata
#define MAX_IDE_BUS 2
51 845773ab Isaku Yamahata
52 845773ab Isaku Yamahata
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
53 845773ab Isaku Yamahata
static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
54 845773ab Isaku Yamahata
static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
55 845773ab Isaku Yamahata
56 b881fbe9 Jan Kiszka
static void ioapic_init(GSIState *gsi_state)
57 96051119 Blue Swirl
{
58 96051119 Blue Swirl
    DeviceState *dev;
59 96051119 Blue Swirl
    SysBusDevice *d;
60 96051119 Blue Swirl
    unsigned int i;
61 96051119 Blue Swirl
62 96051119 Blue Swirl
    dev = qdev_create(NULL, "ioapic");
63 96051119 Blue Swirl
    qdev_init_nofail(dev);
64 96051119 Blue Swirl
    d = sysbus_from_qdev(dev);
65 96051119 Blue Swirl
    sysbus_mmio_map(d, 0, 0xfec00000);
66 96051119 Blue Swirl
67 96051119 Blue Swirl
    for (i = 0; i < IOAPIC_NUM_PINS; i++) {
68 b881fbe9 Jan Kiszka
        gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i);
69 96051119 Blue Swirl
    }
70 96051119 Blue Swirl
}
71 96051119 Blue Swirl
72 845773ab Isaku Yamahata
/* PC hardware initialisation */
73 6bd10515 Avi Kivity
static void pc_init1(MemoryRegion *system_memory,
74 aee97b84 Avi Kivity
                     MemoryRegion *system_io,
75 6bd10515 Avi Kivity
                     ram_addr_t ram_size,
76 845773ab Isaku Yamahata
                     const char *boot_device,
77 845773ab Isaku Yamahata
                     const char *kernel_filename,
78 845773ab Isaku Yamahata
                     const char *kernel_cmdline,
79 845773ab Isaku Yamahata
                     const char *initrd_filename,
80 845773ab Isaku Yamahata
                     const char *cpu_model,
81 0ec329da Jan Kiszka
                     int pci_enabled,
82 0ec329da Jan Kiszka
                     int kvmclock_enabled)
83 845773ab Isaku Yamahata
{
84 845773ab Isaku Yamahata
    int i;
85 845773ab Isaku Yamahata
    ram_addr_t below_4g_mem_size, above_4g_mem_size;
86 845773ab Isaku Yamahata
    PCIBus *pci_bus;
87 845773ab Isaku Yamahata
    PCII440FXState *i440fx_state;
88 845773ab Isaku Yamahata
    int piix3_devfn = -1;
89 845773ab Isaku Yamahata
    qemu_irq *cpu_irq;
90 b881fbe9 Jan Kiszka
    qemu_irq *gsi;
91 845773ab Isaku Yamahata
    qemu_irq *i8259;
92 845773ab Isaku Yamahata
    qemu_irq *cmos_s3;
93 845773ab Isaku Yamahata
    qemu_irq *smi_irq;
94 b881fbe9 Jan Kiszka
    GSIState *gsi_state;
95 845773ab Isaku Yamahata
    DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
96 c0897e0c Markus Armbruster
    BusState *idebus[MAX_IDE_BUS];
97 1d914fa0 Isaku Yamahata
    ISADevice *rtc_state;
98 34d4260e Kevin Wolf
    ISADevice *floppy;
99 ae0a5466 Avi Kivity
    MemoryRegion *ram_memory;
100 ae0a5466 Avi Kivity
    MemoryRegion *pci_memory;
101 4463aee6 Jan Kiszka
    MemoryRegion *rom_memory;
102 845773ab Isaku Yamahata
103 845773ab Isaku Yamahata
    pc_cpus_init(cpu_model);
104 845773ab Isaku Yamahata
105 0ec329da Jan Kiszka
    if (kvmclock_enabled) {
106 0ec329da Jan Kiszka
        kvmclock_create();
107 0ec329da Jan Kiszka
    }
108 0ec329da Jan Kiszka
109 e0e7e67b Anthony PERARD
    if (ram_size >= 0xe0000000 ) {
110 e0e7e67b Anthony PERARD
        above_4g_mem_size = ram_size - 0xe0000000;
111 e0e7e67b Anthony PERARD
        below_4g_mem_size = 0xe0000000;
112 e0e7e67b Anthony PERARD
    } else {
113 e0e7e67b Anthony PERARD
        above_4g_mem_size = 0;
114 e0e7e67b Anthony PERARD
        below_4g_mem_size = ram_size;
115 e0e7e67b Anthony PERARD
    }
116 e0e7e67b Anthony PERARD
117 4463aee6 Jan Kiszka
    if (pci_enabled) {
118 4463aee6 Jan Kiszka
        pci_memory = g_new(MemoryRegion, 1);
119 4463aee6 Jan Kiszka
        memory_region_init(pci_memory, "pci", INT64_MAX);
120 4463aee6 Jan Kiszka
        rom_memory = pci_memory;
121 4463aee6 Jan Kiszka
    } else {
122 4463aee6 Jan Kiszka
        pci_memory = NULL;
123 4463aee6 Jan Kiszka
        rom_memory = system_memory;
124 4463aee6 Jan Kiszka
    }
125 ae0a5466 Avi Kivity
126 845773ab Isaku Yamahata
    /* allocate ram and load rom/bios */
127 29d3ccde Anthony PERARD
    if (!xen_enabled()) {
128 4aa63af1 Avi Kivity
        pc_memory_init(system_memory,
129 4aa63af1 Avi Kivity
                       kernel_filename, kernel_cmdline, initrd_filename,
130 ae0a5466 Avi Kivity
                       below_4g_mem_size, above_4g_mem_size,
131 c1d23eac Hervé Poussineau
                       pci_enabled ? rom_memory : system_memory, &ram_memory);
132 29d3ccde Anthony PERARD
    }
133 845773ab Isaku Yamahata
134 b881fbe9 Jan Kiszka
    gsi_state = g_malloc0(sizeof(*gsi_state));
135 b881fbe9 Jan Kiszka
    gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
136 845773ab Isaku Yamahata
137 845773ab Isaku Yamahata
    if (pci_enabled) {
138 b881fbe9 Jan Kiszka
        pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, gsi,
139 ae0a5466 Avi Kivity
                              system_memory, system_io, ram_size,
140 ae0a5466 Avi Kivity
                              below_4g_mem_size,
141 ae0a5466 Avi Kivity
                              0x100000000ULL - below_4g_mem_size,
142 ae0a5466 Avi Kivity
                              0x100000000ULL + above_4g_mem_size,
143 ae0a5466 Avi Kivity
                              (sizeof(target_phys_addr_t) == 4
144 ae0a5466 Avi Kivity
                               ? 0
145 ae0a5466 Avi Kivity
                               : ((uint64_t)1 << 62)),
146 ae0a5466 Avi Kivity
                              pci_memory, ram_memory);
147 845773ab Isaku Yamahata
    } else {
148 845773ab Isaku Yamahata
        pci_bus = NULL;
149 02a89b21 Isaku Yamahata
        i440fx_state = NULL;
150 c2d0d012 Richard Henderson
        isa_bus_new(NULL, system_io);
151 57285cc3 Jan Kiszka
        no_hpet = 1;
152 845773ab Isaku Yamahata
    }
153 b881fbe9 Jan Kiszka
    isa_bus_irqs(gsi);
154 845773ab Isaku Yamahata
155 4bae1efe Richard Henderson
    if (!xen_enabled()) {
156 4bae1efe Richard Henderson
        cpu_irq = pc_allocate_cpu_irq();
157 4bae1efe Richard Henderson
        i8259 = i8259_init(cpu_irq[0]);
158 4bae1efe Richard Henderson
    } else {
159 4bae1efe Richard Henderson
        i8259 = xen_interrupt_controller_init();
160 4bae1efe Richard Henderson
    }
161 4bae1efe Richard Henderson
162 43a0db35 Jan Kiszka
    for (i = 0; i < ISA_NUM_IRQS; i++) {
163 43a0db35 Jan Kiszka
        gsi_state->i8259_irq[i] = i8259[i];
164 43a0db35 Jan Kiszka
    }
165 4bae1efe Richard Henderson
    if (pci_enabled) {
166 b881fbe9 Jan Kiszka
        ioapic_init(gsi_state);
167 4bae1efe Richard Henderson
    }
168 4bae1efe Richard Henderson
169 b881fbe9 Jan Kiszka
    pc_register_ferr_irq(gsi[13]);
170 845773ab Isaku Yamahata
171 845773ab Isaku Yamahata
    pc_vga_init(pci_enabled? pci_bus: NULL);
172 845773ab Isaku Yamahata
173 01195b73 Steven Smith
    if (xen_enabled()) {
174 01195b73 Steven Smith
        pci_create_simple(pci_bus, -1, "xen-platform");
175 01195b73 Steven Smith
    }
176 01195b73 Steven Smith
177 845773ab Isaku Yamahata
    /* init basic PC hardware */
178 34d4260e Kevin Wolf
    pc_basic_device_init(gsi, &rtc_state, &floppy, xen_enabled());
179 845773ab Isaku Yamahata
180 845773ab Isaku Yamahata
    for(i = 0; i < nb_nics; i++) {
181 845773ab Isaku Yamahata
        NICInfo *nd = &nd_table[i];
182 845773ab Isaku Yamahata
183 845773ab Isaku Yamahata
        if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
184 845773ab Isaku Yamahata
            pc_init_ne2k_isa(nd);
185 845773ab Isaku Yamahata
        else
186 845773ab Isaku Yamahata
            pci_nic_init_nofail(nd, "e1000", NULL);
187 845773ab Isaku Yamahata
    }
188 845773ab Isaku Yamahata
189 75717903 Isaku Yamahata
    ide_drive_get(hd, MAX_IDE_BUS);
190 845773ab Isaku Yamahata
    if (pci_enabled) {
191 c0897e0c Markus Armbruster
        PCIDevice *dev;
192 679f4f8b Stefano Stabellini
        if (xen_enabled()) {
193 679f4f8b Stefano Stabellini
            dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
194 679f4f8b Stefano Stabellini
        } else {
195 679f4f8b Stefano Stabellini
            dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
196 679f4f8b Stefano Stabellini
        }
197 c0897e0c Markus Armbruster
        idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
198 c0897e0c Markus Armbruster
        idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
199 845773ab Isaku Yamahata
    } else {
200 845773ab Isaku Yamahata
        for(i = 0; i < MAX_IDE_BUS; i++) {
201 c0897e0c Markus Armbruster
            ISADevice *dev;
202 c0897e0c Markus Armbruster
            dev = isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
203 c0897e0c Markus Armbruster
                               hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
204 c0897e0c Markus Armbruster
            idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0");
205 845773ab Isaku Yamahata
        }
206 845773ab Isaku Yamahata
    }
207 845773ab Isaku Yamahata
208 b881fbe9 Jan Kiszka
    audio_init(gsi, pci_enabled ? pci_bus : NULL);
209 845773ab Isaku Yamahata
210 c0897e0c Markus Armbruster
    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
211 34d4260e Kevin Wolf
                 floppy, idebus[0], idebus[1], rtc_state);
212 845773ab Isaku Yamahata
213 845773ab Isaku Yamahata
    if (pci_enabled && usb_enabled) {
214 845773ab Isaku Yamahata
        usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
215 845773ab Isaku Yamahata
    }
216 845773ab Isaku Yamahata
217 845773ab Isaku Yamahata
    if (pci_enabled && acpi_enabled) {
218 845773ab Isaku Yamahata
        i2c_bus *smbus;
219 845773ab Isaku Yamahata
220 c9622478 Anthony PERARD
        if (!xen_enabled()) {
221 c9622478 Anthony PERARD
            cmos_s3 = qemu_allocate_irqs(pc_cmos_set_s3_resume, rtc_state, 1);
222 c9622478 Anthony PERARD
        } else {
223 c9622478 Anthony PERARD
            cmos_s3 = qemu_allocate_irqs(xen_cmos_set_s3_resume, rtc_state, 1);
224 c9622478 Anthony PERARD
        }
225 845773ab Isaku Yamahata
        smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
226 845773ab Isaku Yamahata
        /* TODO: Populate SPD eeprom data.  */
227 845773ab Isaku Yamahata
        smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
228 b881fbe9 Jan Kiszka
                              gsi[9], *cmos_s3, *smi_irq,
229 845773ab Isaku Yamahata
                              kvm_enabled());
230 a88df0b9 Isaku Yamahata
        smbus_eeprom_init(smbus, 8, NULL, 0);
231 845773ab Isaku Yamahata
    }
232 845773ab Isaku Yamahata
233 845773ab Isaku Yamahata
    if (pci_enabled) {
234 845773ab Isaku Yamahata
        pc_pci_device_init(pci_bus);
235 845773ab Isaku Yamahata
    }
236 845773ab Isaku Yamahata
}
237 845773ab Isaku Yamahata
238 845773ab Isaku Yamahata
static void pc_init_pci(ram_addr_t ram_size,
239 845773ab Isaku Yamahata
                        const char *boot_device,
240 845773ab Isaku Yamahata
                        const char *kernel_filename,
241 845773ab Isaku Yamahata
                        const char *kernel_cmdline,
242 845773ab Isaku Yamahata
                        const char *initrd_filename,
243 845773ab Isaku Yamahata
                        const char *cpu_model)
244 845773ab Isaku Yamahata
{
245 6bd10515 Avi Kivity
    pc_init1(get_system_memory(),
246 aee97b84 Avi Kivity
             get_system_io(),
247 6bd10515 Avi Kivity
             ram_size, boot_device,
248 845773ab Isaku Yamahata
             kernel_filename, kernel_cmdline,
249 0ec329da Jan Kiszka
             initrd_filename, cpu_model, 1, 1);
250 0ec329da Jan Kiszka
}
251 0ec329da Jan Kiszka
252 0ec329da Jan Kiszka
static void pc_init_pci_no_kvmclock(ram_addr_t ram_size,
253 0ec329da Jan Kiszka
                                    const char *boot_device,
254 0ec329da Jan Kiszka
                                    const char *kernel_filename,
255 0ec329da Jan Kiszka
                                    const char *kernel_cmdline,
256 0ec329da Jan Kiszka
                                    const char *initrd_filename,
257 0ec329da Jan Kiszka
                                    const char *cpu_model)
258 0ec329da Jan Kiszka
{
259 6bd10515 Avi Kivity
    pc_init1(get_system_memory(),
260 aee97b84 Avi Kivity
             get_system_io(),
261 6bd10515 Avi Kivity
             ram_size, boot_device,
262 0ec329da Jan Kiszka
             kernel_filename, kernel_cmdline,
263 0ec329da Jan Kiszka
             initrd_filename, cpu_model, 1, 0);
264 845773ab Isaku Yamahata
}
265 845773ab Isaku Yamahata
266 845773ab Isaku Yamahata
static void pc_init_isa(ram_addr_t ram_size,
267 845773ab Isaku Yamahata
                        const char *boot_device,
268 845773ab Isaku Yamahata
                        const char *kernel_filename,
269 845773ab Isaku Yamahata
                        const char *kernel_cmdline,
270 845773ab Isaku Yamahata
                        const char *initrd_filename,
271 845773ab Isaku Yamahata
                        const char *cpu_model)
272 845773ab Isaku Yamahata
{
273 845773ab Isaku Yamahata
    if (cpu_model == NULL)
274 845773ab Isaku Yamahata
        cpu_model = "486";
275 6bd10515 Avi Kivity
    pc_init1(get_system_memory(),
276 aee97b84 Avi Kivity
             get_system_io(),
277 6bd10515 Avi Kivity
             ram_size, boot_device,
278 845773ab Isaku Yamahata
             kernel_filename, kernel_cmdline,
279 0ec329da Jan Kiszka
             initrd_filename, cpu_model, 0, 1);
280 845773ab Isaku Yamahata
}
281 845773ab Isaku Yamahata
282 29d3ccde Anthony PERARD
#ifdef CONFIG_XEN
283 29d3ccde Anthony PERARD
static void pc_xen_hvm_init(ram_addr_t ram_size,
284 29d3ccde Anthony PERARD
                            const char *boot_device,
285 29d3ccde Anthony PERARD
                            const char *kernel_filename,
286 29d3ccde Anthony PERARD
                            const char *kernel_cmdline,
287 29d3ccde Anthony PERARD
                            const char *initrd_filename,
288 29d3ccde Anthony PERARD
                            const char *cpu_model)
289 29d3ccde Anthony PERARD
{
290 29d3ccde Anthony PERARD
    if (xen_hvm_init() != 0) {
291 29d3ccde Anthony PERARD
        hw_error("xen hardware virtual machine initialisation failed");
292 29d3ccde Anthony PERARD
    }
293 29d3ccde Anthony PERARD
    pc_init_pci_no_kvmclock(ram_size, boot_device,
294 29d3ccde Anthony PERARD
                            kernel_filename, kernel_cmdline,
295 29d3ccde Anthony PERARD
                            initrd_filename, cpu_model);
296 29d3ccde Anthony PERARD
    xen_vcpu_init();
297 29d3ccde Anthony PERARD
}
298 29d3ccde Anthony PERARD
#endif
299 29d3ccde Anthony PERARD
300 19857e62 Gerd Hoffmann
static QEMUMachine pc_machine_v1_0 = {
301 19857e62 Gerd Hoffmann
    .name = "pc-1.0",
302 845773ab Isaku Yamahata
    .alias = "pc",
303 845773ab Isaku Yamahata
    .desc = "Standard PC",
304 845773ab Isaku Yamahata
    .init = pc_init_pci,
305 845773ab Isaku Yamahata
    .max_cpus = 255,
306 845773ab Isaku Yamahata
    .is_default = 1,
307 845773ab Isaku Yamahata
};
308 845773ab Isaku Yamahata
309 19857e62 Gerd Hoffmann
static QEMUMachine pc_machine_v0_14 = {
310 19857e62 Gerd Hoffmann
    .name = "pc-0.14",
311 19857e62 Gerd Hoffmann
    .desc = "Standard PC",
312 19857e62 Gerd Hoffmann
    .init = pc_init_pci,
313 19857e62 Gerd Hoffmann
    .max_cpus = 255,
314 19857e62 Gerd Hoffmann
};
315 19857e62 Gerd Hoffmann
316 b903a0f7 Gerd Hoffmann
static QEMUMachine pc_machine_v0_13 = {
317 b903a0f7 Gerd Hoffmann
    .name = "pc-0.13",
318 b903a0f7 Gerd Hoffmann
    .desc = "Standard PC",
319 0ec329da Jan Kiszka
    .init = pc_init_pci_no_kvmclock,
320 b903a0f7 Gerd Hoffmann
    .max_cpus = 255,
321 9dbcca5a Gerd Hoffmann
    .compat_props = (GlobalProperty[]) {
322 9dbcca5a Gerd Hoffmann
        {
323 9dbcca5a Gerd Hoffmann
            .driver   = "virtio-9p-pci",
324 9dbcca5a Gerd Hoffmann
            .property = "vectors",
325 9dbcca5a Gerd Hoffmann
            .value    = stringify(0),
326 281a26b1 Gerd Hoffmann
        },{
327 281a26b1 Gerd Hoffmann
            .driver   = "VGA",
328 281a26b1 Gerd Hoffmann
            .property = "rombar",
329 281a26b1 Gerd Hoffmann
            .value    = stringify(0),
330 281a26b1 Gerd Hoffmann
        },{
331 281a26b1 Gerd Hoffmann
            .driver   = "vmware-svga",
332 281a26b1 Gerd Hoffmann
            .property = "rombar",
333 281a26b1 Gerd Hoffmann
            .value    = stringify(0),
334 362dd48c Isaku Yamahata
        },{
335 362dd48c Isaku Yamahata
            .driver   = "PCI",
336 362dd48c Isaku Yamahata
            .property = "command_serr_enable",
337 362dd48c Isaku Yamahata
            .value    = "off",
338 b91cb442 Michael S. Tsirkin
        },{
339 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-blk-pci",
340 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
341 b91cb442 Michael S. Tsirkin
            .value    = "off",
342 b91cb442 Michael S. Tsirkin
        },{
343 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-serial-pci",
344 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
345 b91cb442 Michael S. Tsirkin
            .value    = "off",
346 b91cb442 Michael S. Tsirkin
        },{
347 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-net-pci",
348 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
349 b91cb442 Michael S. Tsirkin
            .value    = "off",
350 9dbcca5a Gerd Hoffmann
        },
351 9dbcca5a Gerd Hoffmann
        { /* end of list */ }
352 9dbcca5a Gerd Hoffmann
    },
353 b903a0f7 Gerd Hoffmann
};
354 b903a0f7 Gerd Hoffmann
355 845773ab Isaku Yamahata
static QEMUMachine pc_machine_v0_12 = {
356 845773ab Isaku Yamahata
    .name = "pc-0.12",
357 845773ab Isaku Yamahata
    .desc = "Standard PC",
358 0ec329da Jan Kiszka
    .init = pc_init_pci_no_kvmclock,
359 845773ab Isaku Yamahata
    .max_cpus = 255,
360 845773ab Isaku Yamahata
    .compat_props = (GlobalProperty[]) {
361 845773ab Isaku Yamahata
        {
362 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
363 1e29a009 Amit Shah
            .property = "max_ports",
364 845773ab Isaku Yamahata
            .value    = stringify(1),
365 845773ab Isaku Yamahata
        },{
366 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
367 845773ab Isaku Yamahata
            .property = "vectors",
368 845773ab Isaku Yamahata
            .value    = stringify(0),
369 281a26b1 Gerd Hoffmann
        },{
370 281a26b1 Gerd Hoffmann
            .driver   = "VGA",
371 281a26b1 Gerd Hoffmann
            .property = "rombar",
372 281a26b1 Gerd Hoffmann
            .value    = stringify(0),
373 281a26b1 Gerd Hoffmann
        },{
374 281a26b1 Gerd Hoffmann
            .driver   = "vmware-svga",
375 281a26b1 Gerd Hoffmann
            .property = "rombar",
376 281a26b1 Gerd Hoffmann
            .value    = stringify(0),
377 b1aeb926 Isaku Yamahata
        },{
378 b1aeb926 Isaku Yamahata
            .driver   = "PCI",
379 b1aeb926 Isaku Yamahata
            .property = "command_serr_enable",
380 b1aeb926 Isaku Yamahata
            .value    = "off",
381 b91cb442 Michael S. Tsirkin
        },{
382 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-blk-pci",
383 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
384 b91cb442 Michael S. Tsirkin
            .value    = "off",
385 b91cb442 Michael S. Tsirkin
        },{
386 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-serial-pci",
387 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
388 b91cb442 Michael S. Tsirkin
            .value    = "off",
389 b91cb442 Michael S. Tsirkin
        },{
390 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-net-pci",
391 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
392 b91cb442 Michael S. Tsirkin
            .value    = "off",
393 845773ab Isaku Yamahata
        },
394 845773ab Isaku Yamahata
        { /* end of list */ }
395 845773ab Isaku Yamahata
    }
396 845773ab Isaku Yamahata
};
397 845773ab Isaku Yamahata
398 845773ab Isaku Yamahata
static QEMUMachine pc_machine_v0_11 = {
399 845773ab Isaku Yamahata
    .name = "pc-0.11",
400 845773ab Isaku Yamahata
    .desc = "Standard PC, qemu 0.11",
401 0ec329da Jan Kiszka
    .init = pc_init_pci_no_kvmclock,
402 845773ab Isaku Yamahata
    .max_cpus = 255,
403 845773ab Isaku Yamahata
    .compat_props = (GlobalProperty[]) {
404 845773ab Isaku Yamahata
        {
405 845773ab Isaku Yamahata
            .driver   = "virtio-blk-pci",
406 845773ab Isaku Yamahata
            .property = "vectors",
407 845773ab Isaku Yamahata
            .value    = stringify(0),
408 845773ab Isaku Yamahata
        },{
409 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
410 1e29a009 Amit Shah
            .property = "max_ports",
411 845773ab Isaku Yamahata
            .value    = stringify(1),
412 845773ab Isaku Yamahata
        },{
413 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
414 845773ab Isaku Yamahata
            .property = "vectors",
415 845773ab Isaku Yamahata
            .value    = stringify(0),
416 845773ab Isaku Yamahata
        },{
417 845773ab Isaku Yamahata
            .driver   = "ide-drive",
418 845773ab Isaku Yamahata
            .property = "ver",
419 845773ab Isaku Yamahata
            .value    = "0.11",
420 845773ab Isaku Yamahata
        },{
421 845773ab Isaku Yamahata
            .driver   = "scsi-disk",
422 845773ab Isaku Yamahata
            .property = "ver",
423 845773ab Isaku Yamahata
            .value    = "0.11",
424 845773ab Isaku Yamahata
        },{
425 845773ab Isaku Yamahata
            .driver   = "PCI",
426 845773ab Isaku Yamahata
            .property = "rombar",
427 845773ab Isaku Yamahata
            .value    = stringify(0),
428 b1aeb926 Isaku Yamahata
        },{
429 b1aeb926 Isaku Yamahata
            .driver   = "PCI",
430 b1aeb926 Isaku Yamahata
            .property = "command_serr_enable",
431 b1aeb926 Isaku Yamahata
            .value    = "off",
432 b91cb442 Michael S. Tsirkin
        },{
433 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-blk-pci",
434 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
435 b91cb442 Michael S. Tsirkin
            .value    = "off",
436 b91cb442 Michael S. Tsirkin
        },{
437 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-serial-pci",
438 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
439 b91cb442 Michael S. Tsirkin
            .value    = "off",
440 b91cb442 Michael S. Tsirkin
        },{
441 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-net-pci",
442 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
443 b91cb442 Michael S. Tsirkin
            .value    = "off",
444 845773ab Isaku Yamahata
        },
445 845773ab Isaku Yamahata
        { /* end of list */ }
446 845773ab Isaku Yamahata
    }
447 845773ab Isaku Yamahata
};
448 845773ab Isaku Yamahata
449 845773ab Isaku Yamahata
static QEMUMachine pc_machine_v0_10 = {
450 845773ab Isaku Yamahata
    .name = "pc-0.10",
451 845773ab Isaku Yamahata
    .desc = "Standard PC, qemu 0.10",
452 0ec329da Jan Kiszka
    .init = pc_init_pci_no_kvmclock,
453 845773ab Isaku Yamahata
    .max_cpus = 255,
454 845773ab Isaku Yamahata
    .compat_props = (GlobalProperty[]) {
455 845773ab Isaku Yamahata
        {
456 845773ab Isaku Yamahata
            .driver   = "virtio-blk-pci",
457 845773ab Isaku Yamahata
            .property = "class",
458 845773ab Isaku Yamahata
            .value    = stringify(PCI_CLASS_STORAGE_OTHER),
459 845773ab Isaku Yamahata
        },{
460 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
461 845773ab Isaku Yamahata
            .property = "class",
462 845773ab Isaku Yamahata
            .value    = stringify(PCI_CLASS_DISPLAY_OTHER),
463 845773ab Isaku Yamahata
        },{
464 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
465 1e29a009 Amit Shah
            .property = "max_ports",
466 845773ab Isaku Yamahata
            .value    = stringify(1),
467 845773ab Isaku Yamahata
        },{
468 845773ab Isaku Yamahata
            .driver   = "virtio-serial-pci",
469 845773ab Isaku Yamahata
            .property = "vectors",
470 845773ab Isaku Yamahata
            .value    = stringify(0),
471 845773ab Isaku Yamahata
        },{
472 845773ab Isaku Yamahata
            .driver   = "virtio-net-pci",
473 845773ab Isaku Yamahata
            .property = "vectors",
474 845773ab Isaku Yamahata
            .value    = stringify(0),
475 845773ab Isaku Yamahata
        },{
476 845773ab Isaku Yamahata
            .driver   = "virtio-blk-pci",
477 845773ab Isaku Yamahata
            .property = "vectors",
478 845773ab Isaku Yamahata
            .value    = stringify(0),
479 845773ab Isaku Yamahata
        },{
480 845773ab Isaku Yamahata
            .driver   = "ide-drive",
481 845773ab Isaku Yamahata
            .property = "ver",
482 845773ab Isaku Yamahata
            .value    = "0.10",
483 845773ab Isaku Yamahata
        },{
484 845773ab Isaku Yamahata
            .driver   = "scsi-disk",
485 845773ab Isaku Yamahata
            .property = "ver",
486 845773ab Isaku Yamahata
            .value    = "0.10",
487 845773ab Isaku Yamahata
        },{
488 845773ab Isaku Yamahata
            .driver   = "PCI",
489 845773ab Isaku Yamahata
            .property = "rombar",
490 845773ab Isaku Yamahata
            .value    = stringify(0),
491 b1aeb926 Isaku Yamahata
        },{
492 b1aeb926 Isaku Yamahata
            .driver   = "PCI",
493 b1aeb926 Isaku Yamahata
            .property = "command_serr_enable",
494 b1aeb926 Isaku Yamahata
            .value    = "off",
495 b91cb442 Michael S. Tsirkin
        },{
496 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-blk-pci",
497 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
498 b91cb442 Michael S. Tsirkin
            .value    = "off",
499 b91cb442 Michael S. Tsirkin
        },{
500 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-serial-pci",
501 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
502 b91cb442 Michael S. Tsirkin
            .value    = "off",
503 b91cb442 Michael S. Tsirkin
        },{
504 b91cb442 Michael S. Tsirkin
            .driver   = "virtio-net-pci",
505 b91cb442 Michael S. Tsirkin
            .property = "event_idx",
506 b91cb442 Michael S. Tsirkin
            .value    = "off",
507 845773ab Isaku Yamahata
        },
508 845773ab Isaku Yamahata
        { /* end of list */ }
509 845773ab Isaku Yamahata
    },
510 845773ab Isaku Yamahata
};
511 845773ab Isaku Yamahata
512 845773ab Isaku Yamahata
static QEMUMachine isapc_machine = {
513 845773ab Isaku Yamahata
    .name = "isapc",
514 845773ab Isaku Yamahata
    .desc = "ISA-only PC",
515 845773ab Isaku Yamahata
    .init = pc_init_isa,
516 845773ab Isaku Yamahata
    .max_cpus = 1,
517 845773ab Isaku Yamahata
};
518 845773ab Isaku Yamahata
519 29d3ccde Anthony PERARD
#ifdef CONFIG_XEN
520 29d3ccde Anthony PERARD
static QEMUMachine xenfv_machine = {
521 29d3ccde Anthony PERARD
    .name = "xenfv",
522 29d3ccde Anthony PERARD
    .desc = "Xen Fully-virtualized PC",
523 29d3ccde Anthony PERARD
    .init = pc_xen_hvm_init,
524 29d3ccde Anthony PERARD
    .max_cpus = HVM_MAX_VCPUS,
525 29d3ccde Anthony PERARD
    .default_machine_opts = "accel=xen",
526 29d3ccde Anthony PERARD
};
527 29d3ccde Anthony PERARD
#endif
528 29d3ccde Anthony PERARD
529 845773ab Isaku Yamahata
static void pc_machine_init(void)
530 845773ab Isaku Yamahata
{
531 19857e62 Gerd Hoffmann
    qemu_register_machine(&pc_machine_v1_0);
532 19857e62 Gerd Hoffmann
    qemu_register_machine(&pc_machine_v0_14);
533 b903a0f7 Gerd Hoffmann
    qemu_register_machine(&pc_machine_v0_13);
534 845773ab Isaku Yamahata
    qemu_register_machine(&pc_machine_v0_12);
535 845773ab Isaku Yamahata
    qemu_register_machine(&pc_machine_v0_11);
536 845773ab Isaku Yamahata
    qemu_register_machine(&pc_machine_v0_10);
537 845773ab Isaku Yamahata
    qemu_register_machine(&isapc_machine);
538 29d3ccde Anthony PERARD
#ifdef CONFIG_XEN
539 29d3ccde Anthony PERARD
    qemu_register_machine(&xenfv_machine);
540 29d3ccde Anthony PERARD
#endif
541 845773ab Isaku Yamahata
}
542 845773ab Isaku Yamahata
543 845773ab Isaku Yamahata
machine_init(pc_machine_init);