aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/char/parallel-isa.c2
-rw-r--r--hw/char/parallel.c1
-rw-r--r--hw/i386/Kconfig2
-rw-r--r--hw/i386/pc.c3
-rw-r--r--hw/i386/pc_piix.c7
-rw-r--r--hw/i386/pc_q35.c8
-rw-r--r--hw/isa/isa-superio.c3
-rw-r--r--hw/ppc/e500.c3
-rw-r--r--hw/ppc/e500plat.c1
-rw-r--r--hw/ppc/mac_newworld.c4
-rw-r--r--hw/ppc/mac_oldworld.c4
-rw-r--r--hw/ppc/mpc8544ds.c1
-rw-r--r--hw/ppc/ppc440_bamboo.c4
-rw-r--r--hw/ppc/prep.c4
-rw-r--r--hw/s390x/s390-virtio-ccw.c4
-rw-r--r--hw/sh4/r2d.c4
-rw-r--r--hw/sparc64/sun4u.c11
17 files changed, 45 insertions, 21 deletions
diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c
index 1ccbb96..547ae69 100644
--- a/hw/char/parallel-isa.c
+++ b/hw/char/parallel-isa.c
@@ -21,7 +21,7 @@ static void parallel_init(ISABus *bus, int index, Chardev *chr)
DeviceState *dev;
ISADevice *isadev;
- isadev = isa_new("isa-parallel");
+ isadev = isa_new(TYPE_ISA_PARALLEL);
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "index", index);
qdev_prop_set_chr(dev, "chardev", chr);
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index af551e7..3d32589 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -93,7 +93,6 @@ typedef struct ParallelState {
PortioList portio_list;
} ParallelState;
-#define TYPE_ISA_PARALLEL "isa-parallel"
OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)
struct ISAParallelState {
diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index d40802d..9051083 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -80,10 +80,10 @@ config I440FX
config ISAPC
bool
+ imply VGA_ISA
select ISA_BUS
select PC
select IDE_ISA
- select VGA_ISA
# FIXME: it is in the same file as i440fx, and does not compile
# if separated
depends on I440FX
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b3d826a..bb62c99 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1364,12 +1364,13 @@ void pc_basic_device_init(struct PCMachineState *pcms,
void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus)
{
+ MachineClass *mc = MACHINE_CLASS(pcmc);
int i;
rom_set_order_override(FW_CFG_ORDER_OVERRIDE_NIC);
for (i = 0; i < nb_nics; i++) {
NICInfo *nd = &nd_table[i];
- const char *model = nd->model ? nd->model : pcmc->default_nic_model;
+ const char *model = nd->model ? nd->model : mc->default_nic;
if (g_str_equal(model, "ne2k_isa")) {
pc_init_ne2k_isa(isa_bus, nd);
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 10070ea..d5b0dcd 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -26,6 +26,7 @@
#include CONFIG_DEVICES
#include "qemu/units.h"
+#include "hw/char/parallel.h"
#include "hw/dma/i8257.h"
#include "hw/loader.h"
#include "hw/i386/x86.h"
@@ -450,7 +451,6 @@ static void pc_xen_hvm_init(MachineState *machine)
static void pc_i440fx_machine_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pcmc->default_nic_model = "e1000";
pcmc->pci_root_uid = 0;
pcmc->default_cpu_version = 1;
@@ -458,6 +458,8 @@ static void pc_i440fx_machine_options(MachineClass *m)
m->desc = "Standard PC (i440FX + PIIX, 1996)";
m->default_machine_opts = "firmware=bios-256k.bin";
m->default_display = "std";
+ m->default_nic = "e1000";
+ m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
}
@@ -884,8 +886,9 @@ static void isapc_machine_options(MachineClass *m)
pcmc->gigabyte_align = false;
pcmc->smbios_legacy_mode = true;
pcmc->has_reserved_memory = false;
- pcmc->default_nic_model = "ne2k_isa";
+ m->default_nic = "ne2k_isa";
m->default_cpu_type = X86_CPU_TYPE_NAME("486");
+ m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
}
DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 8030d53..6155427 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -30,6 +30,7 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
+#include "hw/char/parallel.h"
#include "hw/loader.h"
#include "hw/i2c/smbus_eeprom.h"
#include "hw/rtc/mc146818rtc.h"
@@ -356,7 +357,6 @@ static void pc_q35_init(MachineState *machine)
static void pc_q35_machine_options(MachineClass *m)
{
PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pcmc->default_nic_model = "e1000e";
pcmc->pci_root_uid = 0;
pcmc->default_cpu_version = 1;
@@ -365,8 +365,10 @@ static void pc_q35_machine_options(MachineClass *m)
m->units_per_default_bus = 1;
m->default_machine_opts = "firmware=bios-256k.bin";
m->default_display = "std";
+ m->default_nic = "e1000e";
m->default_kernel_irqchip_split = false;
m->no_floppy = 1;
+ m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
@@ -577,10 +579,8 @@ DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,
static void pc_q35_2_11_machine_options(MachineClass *m)
{
- PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
-
pc_q35_2_12_machine_options(m);
- pcmc->default_nic_model = "e1000";
+ m->default_nic = "e1000";
compat_props_add(m->compat_props, hw_compat_2_11, hw_compat_2_11_len);
compat_props_add(m->compat_props, pc_compat_2_11, pc_compat_2_11_len);
}
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index c81bfe5..9292ec3 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -16,6 +16,7 @@
#include "qapi/error.h"
#include "sysemu/blockdev.h"
#include "chardev/char.h"
+#include "hw/char/parallel.h"
#include "hw/block/fdc.h"
#include "hw/isa/superio.h"
#include "hw/qdev-properties.h"
@@ -51,7 +52,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
} else {
name = g_strdup_printf("parallel%d", i);
}
- isa = isa_new("isa-parallel");
+ isa = isa_new(TYPE_ISA_PARALLEL);
d = DEVICE(isa);
qdev_prop_set_uint32(d, "index", i);
if (k->parallel.get_iobase) {
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 117c9c0..b6eb599 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -898,6 +898,7 @@ void ppce500_init(MachineState *machine)
MemoryRegion *address_space_mem = get_system_memory();
PPCE500MachineState *pms = PPCE500_MACHINE(machine);
const PPCE500MachineClass *pmc = PPCE500_MACHINE_GET_CLASS(machine);
+ MachineClass *mc = MACHINE_CLASS(pmc);
PCIBus *pci_bus;
CPUPPCState *env = NULL;
uint64_t loadaddr;
@@ -1073,7 +1074,7 @@ void ppce500_init(MachineState *machine)
if (pci_bus) {
/* Register network interfaces. */
for (i = 0; i < nb_nics; i++) {
- pci_nic_init_nofail(&nd_table[i], pci_bus, "virtio-net-pci", NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
}
diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
index 3032bd3..7aa2f21 100644
--- a/hw/ppc/e500plat.c
+++ b/hw/ppc/e500plat.c
@@ -99,6 +99,7 @@ static void e500plat_machine_class_init(ObjectClass *oc, void *data)
mc->max_cpus = 32;
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30");
mc->default_ram_id = "mpc8544ds.ram";
+ mc->default_nic = "virtio-net-pci";
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_ETSEC_COMMON);
}
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 460c14b..5357103 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -132,6 +132,7 @@ static void ppc_core99_reset(void *opaque)
static void ppc_core99_init(MachineState *machine)
{
Core99MachineState *core99_machine = CORE99_MACHINE(machine);
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
PowerPCCPU *cpu = NULL;
CPUPPCState *env = NULL;
char *filename;
@@ -444,7 +445,7 @@ static void ppc_core99_init(MachineState *machine)
}
for (i = 0; i < nb_nics; i++) {
- pci_nic_init_nofail(&nd_table[i], pci_bus, "sungem", NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
/* The NewWorld NVRAM is not located in the MacIO device */
@@ -577,6 +578,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data)
mc->max_cpus = 1;
mc->default_boot_order = "cd";
mc->default_display = "std";
+ mc->default_nic = "sungem";
mc->kvm_type = core99_kvm_type;
#ifdef TARGET_PPC64
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 2e4cc3f..510ff0e 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -87,6 +87,7 @@ static void ppc_heathrow_reset(void *opaque)
static void ppc_heathrow_init(MachineState *machine)
{
const char *bios_name = machine->firmware ?: PROM_FILENAME;
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
PowerPCCPU *cpu = NULL;
CPUPPCState *env = NULL;
char *filename;
@@ -276,7 +277,7 @@ static void ppc_heathrow_init(MachineState *machine)
pci_vga_init(pci_bus);
for (i = 0; i < nb_nics; i++) {
- pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic, NULL);
}
/* MacIO IDE */
@@ -424,6 +425,7 @@ static void heathrow_class_init(ObjectClass *oc, void *data)
mc->kvm_type = heathrow_kvm_type;
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("750_v3.1");
mc->default_display = "std";
+ mc->default_nic = "ne2k_pci";
mc->ignore_boot_device_suffixes = true;
mc->default_ram_id = "ppc_heathrow.ram";
fwc->get_dev_path = heathrow_fw_dev_path;
diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c
index 7dd5219..b713090 100644
--- a/hw/ppc/mpc8544ds.c
+++ b/hw/ppc/mpc8544ds.c
@@ -61,6 +61,7 @@ static void mpc8544ds_machine_class_init(ObjectClass *oc, void *data)
mc->max_cpus = 15;
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30");
mc->default_ram_id = "mpc8544ds.ram";
+ mc->default_nic = "virtio-net-pci";
}
#define TYPE_MPC8544DS_MACHINE MACHINE_TYPE_NAME("mpc8544ds")
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index 2880c81..f969fa3 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -161,6 +161,7 @@ static void bamboo_init(MachineState *machine)
{
const char *kernel_filename = machine->kernel_filename;
const char *initrd_filename = machine->initrd_filename;
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 };
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *isa = g_new(MemoryRegion, 1);
@@ -246,7 +247,7 @@ static void bamboo_init(MachineState *machine)
* There are no PCI NICs on the Bamboo board, but there are
* PCI slots, so we can pick whatever default model we want.
*/
- pci_nic_init_nofail(&nd_table[i], pcibus, "e1000", NULL);
+ pci_nic_init_nofail(&nd_table[i], pcibus, mc->default_nic, NULL);
}
}
@@ -296,6 +297,7 @@ static void bamboo_machine_init(MachineClass *mc)
mc->init = bamboo_init;
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440epb");
mc->default_ram_id = "ppc4xx.sdram";
+ mc->default_nic = "e1000";
}
DEFINE_MACHINE("bamboo", bamboo_machine_init)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index d00280c..4610abd 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -229,6 +229,7 @@ static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)
static void ibm_40p_init(MachineState *machine)
{
const char *bios_name = machine->firmware ?: "openbios-ppc";
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
CPUPPCState *env = NULL;
uint16_t cmos_checksum;
PowerPCCPU *cpu;
@@ -323,7 +324,7 @@ static void ibm_40p_init(MachineState *machine)
pci_vga_init(pci_bus);
for (i = 0; i < nb_nics; i++) {
- pci_nic_init_nofail(&nd_table[i], pci_bus, "pcnet",
+ pci_nic_init_nofail(&nd_table[i], pci_bus, mc->default_nic,
i == 0 ? "3" : NULL);
}
}
@@ -427,6 +428,7 @@ static void ibm_40p_machine_init(MachineClass *mc)
mc->default_boot_order = "c";
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("604");
mc->default_display = "std";
+ mc->default_nic = "pcnet";
}
DEFINE_MACHINE("40p", ibm_40p_machine_init)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 2516b89..2dece8e 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -245,6 +245,7 @@ static void s390_create_sclpconsole(const char *type, Chardev *chardev)
static void ccw_init(MachineState *machine)
{
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
int ret;
VirtualCssBus *css_bus;
DeviceState *dev;
@@ -292,7 +293,7 @@ static void ccw_init(MachineState *machine)
}
/* Create VirtIO network adapters */
- s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
+ s390_create_virtio_net(BUS(css_bus), mc->default_nic);
/* init consoles */
if (serial_hd(0)) {
@@ -746,6 +747,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
hc->unplug_request = s390_machine_device_unplug_request;
nc->nmi_monitor_handler = s390_nmi;
mc->default_ram_id = "s390.ram";
+ mc->default_nic = "virtio-net-ccw";
object_class_property_add_bool(oc, "aes-key-wrap",
machine_get_aes_key_wrap,
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index 826a0a3..4944994 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -232,6 +232,7 @@ static void r2d_init(MachineState *machine)
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
SuperHCPU *cpu;
CPUSH4State *env;
ResetData *reset_info;
@@ -310,7 +311,7 @@ static void r2d_init(MachineState *machine)
/* NIC: rtl8139 on-board, and 2 slots. */
for (i = 0; i < nb_nics; i++)
pci_nic_init_nofail(&nd_table[i], pci_bus,
- "rtl8139", i == 0 ? "2" : NULL);
+ mc->default_nic, i == 0 ? "2" : NULL);
/* USB keyboard */
usb_create_simple(usb_bus_find(-1), "usb-kbd");
@@ -375,6 +376,7 @@ static void r2d_machine_init(MachineClass *mc)
mc->init = r2d_init;
mc->block_default_type = IF_IDE;
mc->default_cpu_type = TYPE_SH7751R_CPU;
+ mc->default_nic = "rtl8139";
}
DEFINE_MACHINE("r2d", r2d_machine_init)
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index eae7589..e2858a0 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -553,6 +553,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
MachineState *machine,
const struct hwdef *hwdef)
{
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
SPARCCPU *cpu;
Nvram *nvram;
unsigned int i;
@@ -645,15 +646,15 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
PCIBus *bus;
nd = &nd_table[i];
- if (!nd->model || strcmp(nd->model, "sunhme") == 0) {
+ if (!nd->model || strcmp(nd->model, mc->default_nic) == 0) {
if (!onboard_nic) {
pci_dev = pci_new_multifunction(PCI_DEVFN(1, 1),
- true, "sunhme");
+ true, mc->default_nic);
bus = pci_busA;
memcpy(&macaddr, &nd->macaddr.a, sizeof(MACAddr));
onboard_nic = true;
} else {
- pci_dev = pci_new(-1, "sunhme");
+ pci_dev = pci_new(-1, mc->default_nic);
bus = pci_busB;
}
} else {
@@ -816,6 +817,8 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
mc->ignore_boot_device_suffixes = true;
mc->default_display = "std";
+ mc->default_nic = "sunhme";
+ mc->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
fwc->get_dev_path = sun4u_fw_dev_path;
}
@@ -840,6 +843,8 @@ static void sun4v_class_init(ObjectClass *oc, void *data)
mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Sun-UltraSparc-T1");
mc->default_display = "std";
+ mc->default_nic = "sunhme";
+ mc->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
}
static const TypeInfo sun4v_type = {