diff options
Diffstat (limited to 'hw/i386/pc_q35.c')
-rw-r--r-- | hw/i386/pc_q35.c | 237 |
1 files changed, 91 insertions, 146 deletions
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index e67f2de..66220b3 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -89,6 +89,7 @@ static void pc_q35_init(MachineState *machine) PcGuestInfo *guest_info; ram_addr_t lowmem; DriveInfo *hd[MAX_SATA_PORTS]; + MachineClass *mc = MACHINE_GET_CLASS(machine); /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping @@ -163,7 +164,6 @@ static void pc_q35_init(MachineState *machine) guest_info->legacy_acpi_table_size = 0; if (smbios_defaults) { - MachineClass *mc = MACHINE_GET_CLASS(machine); /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", mc->name, smbios_legacy_mode, smbios_uuid_encoded); @@ -250,7 +250,7 @@ static void pc_q35_init(MachineState *machine) } /* init basic PC hardware */ - pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, + pc_basic_device_init(isa_bus, gsi, &rtc_state, !mc->no_floppy, &floppy, (pc_machine->vmport != ON_OFF_AUTO_ON), 0xff0104); /* connect pm stuff to lpc */ @@ -366,174 +366,119 @@ static void pc_compat_1_4(MachineState *machine) x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ); } -static void pc_q35_init_2_3(MachineState *machine) +#define DEFINE_Q35_MACHINE(suffix, name, compatfn, optionfn) \ + static void pc_init_##suffix(MachineState *machine) \ + { \ + void (*compat)(MachineState *m) = (compatfn); \ + if (compat) { \ + compat(machine); \ + } \ + pc_q35_init(machine); \ + } \ + DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn) + + +static void pc_q35_machine_options(MachineClass *m) { - pc_compat_2_3(machine); - pc_q35_init(machine); + pc_default_machine_options(m); + m->family = "pc_q35"; + m->desc = "Standard PC (Q35 + ICH9, 2009)"; + m->hot_add_cpu = pc_hot_add_cpu; + m->units_per_default_bus = 1; } -static void pc_q35_init_2_2(MachineState *machine) +static void pc_q35_2_4_machine_options(MachineClass *m) { - pc_compat_2_2(machine); - pc_q35_init(machine); + pc_q35_machine_options(m); + m->default_machine_opts = "firmware=bios-256k.bin"; + m->default_display = "std"; + m->no_floppy = 1; + m->alias = "q35"; } -static void pc_q35_init_2_1(MachineState *machine) +DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL, + pc_q35_2_4_machine_options); + + +static void pc_q35_2_3_machine_options(MachineClass *m) { - pc_compat_2_1(machine); - pc_q35_init(machine); + pc_q35_2_4_machine_options(m); + m->alias = NULL; + SET_MACHINE_COMPAT(m, PC_COMPAT_2_3); } -static void pc_q35_init_2_0(MachineState *machine) +DEFINE_Q35_MACHINE(v2_3, "pc-q35-2.3", pc_compat_2_3, + pc_q35_2_3_machine_options); + + +static void pc_q35_2_2_machine_options(MachineClass *m) { - pc_compat_2_0(machine); - pc_q35_init(machine); + pc_q35_2_3_machine_options(m); + SET_MACHINE_COMPAT(m, PC_COMPAT_2_2); } -static void pc_q35_init_1_7(MachineState *machine) +DEFINE_Q35_MACHINE(v2_2, "pc-q35-2.2", pc_compat_2_2, + pc_q35_2_2_machine_options); + + +static void pc_q35_2_1_machine_options(MachineClass *m) { - pc_compat_1_7(machine); - pc_q35_init(machine); + pc_q35_2_2_machine_options(m); + m->default_display = NULL; + SET_MACHINE_COMPAT(m, PC_COMPAT_2_1); +} + +DEFINE_Q35_MACHINE(v2_1, "pc-q35-2.1", pc_compat_2_1, + pc_q35_2_1_machine_options); + + +static void pc_q35_2_0_machine_options(MachineClass *m) +{ + pc_q35_2_1_machine_options(m); + SET_MACHINE_COMPAT(m, PC_COMPAT_2_0); } -static void pc_q35_init_1_6(MachineState *machine) +DEFINE_Q35_MACHINE(v2_0, "pc-q35-2.0", pc_compat_2_0, + pc_q35_2_0_machine_options); + + +static void pc_q35_1_7_machine_options(MachineClass *m) { - pc_compat_1_6(machine); - pc_q35_init(machine); + pc_q35_2_0_machine_options(m); + m->default_machine_opts = NULL; + SET_MACHINE_COMPAT(m, PC_COMPAT_1_7); } -static void pc_q35_init_1_5(MachineState *machine) +DEFINE_Q35_MACHINE(v1_7, "pc-q35-1.7", pc_compat_1_7, + pc_q35_1_7_machine_options); + + +static void pc_q35_1_6_machine_options(MachineClass *m) { - pc_compat_1_5(machine); - pc_q35_init(machine); + pc_q35_machine_options(m); + SET_MACHINE_COMPAT(m, PC_COMPAT_1_6); } -static void pc_q35_init_1_4(MachineState *machine) +DEFINE_Q35_MACHINE(v1_6, "pc-q35-1.6", pc_compat_1_6, + pc_q35_1_6_machine_options); + + +static void pc_q35_1_5_machine_options(MachineClass *m) { - pc_compat_1_4(machine); - pc_q35_init(machine); + pc_q35_1_6_machine_options(m); + SET_MACHINE_COMPAT(m, PC_COMPAT_1_5); } -#define PC_Q35_MACHINE_OPTIONS \ - PC_DEFAULT_MACHINE_OPTIONS, \ - .family = "pc_q35", \ - .desc = "Standard PC (Q35 + ICH9, 2009)", \ - .hot_add_cpu = pc_hot_add_cpu, \ - .units_per_default_bus = 1 - -#define PC_Q35_2_4_MACHINE_OPTIONS \ - PC_Q35_MACHINE_OPTIONS, \ - .default_machine_opts = "firmware=bios-256k.bin", \ - .default_display = "std" - -static QEMUMachine pc_q35_machine_v2_4 = { - PC_Q35_2_4_MACHINE_OPTIONS, - .name = "pc-q35-2.4", - .alias = "q35", - .init = pc_q35_init, -}; - -#define PC_Q35_2_3_MACHINE_OPTIONS PC_Q35_2_4_MACHINE_OPTIONS - -static QEMUMachine pc_q35_machine_v2_3 = { - PC_Q35_2_3_MACHINE_OPTIONS, - .name = "pc-q35-2.3", - .init = pc_q35_init_2_3, -}; - -#define PC_Q35_2_2_MACHINE_OPTIONS PC_Q35_2_3_MACHINE_OPTIONS - -static QEMUMachine pc_q35_machine_v2_2 = { - PC_Q35_2_2_MACHINE_OPTIONS, - .name = "pc-q35-2.2", - .init = pc_q35_init_2_2, -}; - -#define PC_Q35_2_1_MACHINE_OPTIONS \ - PC_Q35_MACHINE_OPTIONS, \ - .default_machine_opts = "firmware=bios-256k.bin" - -static QEMUMachine pc_q35_machine_v2_1 = { - PC_Q35_2_1_MACHINE_OPTIONS, - .name = "pc-q35-2.1", - .init = pc_q35_init_2_1, - .compat_props = (GlobalProperty[]) { - HW_COMPAT_2_1, - { /* end of list */ } - }, -}; - -#define PC_Q35_2_0_MACHINE_OPTIONS PC_Q35_2_1_MACHINE_OPTIONS - -static QEMUMachine pc_q35_machine_v2_0 = { - PC_Q35_2_0_MACHINE_OPTIONS, - .name = "pc-q35-2.0", - .init = pc_q35_init_2_0, - .compat_props = (GlobalProperty[]) { - PC_COMPAT_2_0, - { /* end of list */ } - }, -}; - -#define PC_Q35_1_7_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS - -static QEMUMachine pc_q35_machine_v1_7 = { - PC_Q35_1_7_MACHINE_OPTIONS, - .name = "pc-q35-1.7", - .init = pc_q35_init_1_7, - .compat_props = (GlobalProperty[]) { - PC_COMPAT_1_7, - { /* end of list */ } - }, -}; - -#define PC_Q35_1_6_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS - -static QEMUMachine pc_q35_machine_v1_6 = { - PC_Q35_1_6_MACHINE_OPTIONS, - .name = "pc-q35-1.6", - .init = pc_q35_init_1_6, - .compat_props = (GlobalProperty[]) { - PC_COMPAT_1_6, - { /* end of list */ } - }, -}; - -static QEMUMachine pc_q35_machine_v1_5 = { - PC_Q35_1_6_MACHINE_OPTIONS, - .name = "pc-q35-1.5", - .init = pc_q35_init_1_5, - .compat_props = (GlobalProperty[]) { - PC_COMPAT_1_5, - { /* end of list */ } - }, -}; - -#define PC_Q35_1_4_MACHINE_OPTIONS \ - PC_Q35_1_6_MACHINE_OPTIONS, \ - .hot_add_cpu = NULL - -static QEMUMachine pc_q35_machine_v1_4 = { - PC_Q35_1_4_MACHINE_OPTIONS, - .name = "pc-q35-1.4", - .init = pc_q35_init_1_4, - .compat_props = (GlobalProperty[]) { - PC_COMPAT_1_4, - { /* end of list */ } - }, -}; - -static void pc_q35_machine_init(void) +DEFINE_Q35_MACHINE(v1_5, "pc-q35-1.5", pc_compat_1_5, + pc_q35_1_5_machine_options); + + +static void pc_q35_1_4_machine_options(MachineClass *m) { - qemu_register_pc_machine(&pc_q35_machine_v2_4); - qemu_register_pc_machine(&pc_q35_machine_v2_3); - qemu_register_pc_machine(&pc_q35_machine_v2_2); - qemu_register_pc_machine(&pc_q35_machine_v2_1); - qemu_register_pc_machine(&pc_q35_machine_v2_0); - qemu_register_pc_machine(&pc_q35_machine_v1_7); - qemu_register_pc_machine(&pc_q35_machine_v1_6); - qemu_register_pc_machine(&pc_q35_machine_v1_5); - qemu_register_pc_machine(&pc_q35_machine_v1_4); + pc_q35_1_5_machine_options(m); + m->hot_add_cpu = NULL; + SET_MACHINE_COMPAT(m, PC_COMPAT_1_4); } -machine_init(pc_q35_machine_init); +DEFINE_Q35_MACHINE(v1_4, "pc-q35-1.4", pc_compat_1_4, + pc_q35_1_4_machine_options); |