diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/audio/gus.c | 2 | ||||
-rw-r--r-- | hw/audio/hda-codec.c | 3 | ||||
-rw-r--r-- | hw/audio/intel-hda.c | 4 | ||||
-rw-r--r-- | hw/audio/sb16.c | 6 | ||||
-rw-r--r-- | hw/bt/l2cap.c | 2 | ||||
-rw-r--r-- | hw/i386/acpi-build.c | 2 | ||||
-rw-r--r-- | hw/i386/acpi-dsdt.dsl | 4 | ||||
-rw-r--r-- | hw/i386/acpi-dsdt.hex.generated | 8 | ||||
-rw-r--r-- | hw/i386/pc.c | 30 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 23 | ||||
-rw-r--r-- | hw/i386/pc_q35.c | 20 | ||||
-rw-r--r-- | hw/i386/q35-acpi-dsdt.dsl | 4 | ||||
-rw-r--r-- | hw/i386/ssdt-mem.dsl | 16 | ||||
-rw-r--r-- | hw/i386/ssdt-misc.dsl | 2 | ||||
-rw-r--r-- | hw/intc/apic.c | 2 | ||||
-rw-r--r-- | hw/intc/i8259.c | 2 | ||||
-rw-r--r-- | hw/intc/openpic.c | 2 | ||||
-rw-r--r-- | hw/isa/isa-bus.c | 2 | ||||
-rw-r--r-- | hw/isa/lpc_ich9.c | 2 | ||||
-rw-r--r-- | hw/mem/pc-dimm.c | 6 | ||||
-rw-r--r-- | hw/misc/ivshmem.c | 10 | ||||
-rw-r--r-- | hw/net/e1000.c | 60 | ||||
-rw-r--r-- | hw/net/vmxnet3.c | 16 | ||||
-rw-r--r-- | hw/pci-host/pam.c | 4 | ||||
-rw-r--r-- | hw/pci-host/q35.c | 2 | ||||
-rw-r--r-- | hw/pci/msi.c | 2 | ||||
-rw-r--r-- | hw/pci/msix.c | 2 | ||||
-rw-r--r-- | hw/ppc/e500.c | 2 | ||||
-rw-r--r-- | hw/ppc/mac_newworld.c | 2 | ||||
-rw-r--r-- | hw/ssi/xilinx_spi.c | 2 | ||||
-rw-r--r-- | hw/usb/dev-audio.c | 2 | ||||
-rw-r--r-- | hw/usb/dev-mtp.c | 4 | ||||
-rw-r--r-- | hw/usb/hcd-ehci.c | 2 |
33 files changed, 137 insertions, 115 deletions
diff --git a/hw/audio/gus.c b/hw/audio/gus.c index bba6840477..4a43ce7adf 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -212,7 +212,7 @@ static int GUS_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len) pos += copied; } - if (0 == ((mode >> 4) & 1)) { + if (((mode >> 4) & 1) == 0) { DMA_release_DREQ (s->emu.gusdma); } return dma_len; diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index cbcf521c5e..3c03ff5668 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -489,8 +489,9 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc) for (i = 0; i < a->desc->nnodes; i++) { node = a->desc->nodes + i; param = hda_codec_find_param(node, AC_PAR_AUDIO_WIDGET_CAP); - if (NULL == param) + if (param == NULL) { continue; + } type = (param->val & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; switch (type) { case AC_WID_AUD_OUT: diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index aa49b47482..0ac911eada 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -187,6 +187,7 @@ struct IntelHDAState { /* properties */ uint32_t debug; uint32_t msi; + bool old_msi_addr; }; #define TYPE_INTEL_HDA_GENERIC "intel-hda-generic" @@ -1141,7 +1142,7 @@ static int intel_hda_init(PCIDevice *pci) "intel-hda", 0x4000); pci_register_bar(&d->pci, 0, 0, &d->mmio); if (d->msi) { - msi_init(&d->pci, 0x50, 1, true, false); + msi_init(&d->pci, d->old_msi_addr ? 0x50 : 0x60, 1, true, false); } hda_codec_bus_init(DEVICE(pci), &d->codecs, sizeof(d->codecs), @@ -1236,6 +1237,7 @@ static const VMStateDescription vmstate_intel_hda = { static Property intel_hda_properties[] = { DEFINE_PROP_UINT32("debug", IntelHDAState, debug, 0), DEFINE_PROP_UINT32("msi", IntelHDAState, msi, 1), + DEFINE_PROP_BOOL("old_msi_addr", IntelHDAState, old_msi_addr, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 60c4b3b497..bda26d0123 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -928,7 +928,7 @@ static IO_WRITE_PROTO (dsp_write) /* if (s->highspeed) */ /* break; */ - if (0 == s->needed_bytes) { + if (s->needed_bytes == 0) { command (s, val); #if 0 if (0 == s->needed_bytes) { @@ -1212,7 +1212,7 @@ static int SB_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len) #endif if (till <= copy) { - if (0 == s->dma_auto) { + if (s->dma_auto == 0) { copy = till; } } @@ -1224,7 +1224,7 @@ static int SB_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len) if (s->left_till_irq <= 0) { s->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1; qemu_irq_raise (s->pic); - if (0 == s->dma_auto) { + if (s->dma_auto == 0) { control (s, 0); speaker (s, 0); } diff --git a/hw/bt/l2cap.c b/hw/bt/l2cap.c index 2301d6f87f..591e047781 100644 --- a/hw/bt/l2cap.c +++ b/hw/bt/l2cap.c @@ -429,7 +429,7 @@ static struct l2cap_chan_s *l2cap_channel_open(struct l2cap_instance_s *l2cap, status = L2CAP_CS_NO_INFO; } else { g_free(ch); - + ch = NULL; result = L2CAP_CR_NO_MEM; status = L2CAP_CS_NO_INFO; } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 816c6d9b47..10b84d039b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1393,7 +1393,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) { AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); - bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 1, + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, true /* fseg memory */); memcpy(&rsdp->signature, "RSD PTR ", 8); diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl index 6ba017014a..559f4b6653 100644 --- a/hw/i386/acpi-dsdt.dsl +++ b/hw/i386/acpi-dsdt.dsl @@ -302,7 +302,7 @@ DefinitionBlock ( /**************************************************************** * General purpose events ****************************************************************/ - External(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) Scope(\_GPE) { Name(_HID, "ACPI0006") @@ -321,7 +321,7 @@ DefinitionBlock ( } Method(_E03) { // Memory hotplug event - \_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD() + \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD() } Method(_L04) { } diff --git a/hw/i386/acpi-dsdt.hex.generated b/hw/i386/acpi-dsdt.hex.generated index 6c8a1fcdfb..a21bf410e5 100644 --- a/hw/i386/acpi-dsdt.hex.generated +++ b/hw/i386/acpi-dsdt.hex.generated @@ -8,7 +8,7 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x0, 0x0, 0x1, -0x2e, +0x1f, 0x42, 0x58, 0x50, @@ -31,9 +31,9 @@ static unsigned char AcpiDsdtAmlCode[] = { 0x4e, 0x54, 0x4c, -0x13, -0x9, -0x12, +0x28, +0x5, +0x10, 0x20, 0x10, 0x49, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9e589825f0..8fa8d2f781 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1066,35 +1066,6 @@ typedef struct PcRomPciInfo { uint64_t w64_max; } PcRomPciInfo; -static void pc_fw_cfg_guest_info(PcGuestInfo *guest_info) -{ - PcRomPciInfo *info; - Object *pci_info; - bool ambiguous = false; - - if (!guest_info->has_pci_info || !guest_info->fw_cfg) { - return; - } - pci_info = object_resolve_path_type("", TYPE_PCI_HOST_BRIDGE, &ambiguous); - g_assert(!ambiguous); - if (!pci_info) { - return; - } - - info = g_malloc(sizeof *info); - info->w32_min = cpu_to_le64(object_property_get_int(pci_info, - PCI_HOST_PROP_PCI_HOLE_START, NULL)); - info->w32_max = cpu_to_le64(object_property_get_int(pci_info, - PCI_HOST_PROP_PCI_HOLE_END, NULL)); - info->w64_min = cpu_to_le64(object_property_get_int(pci_info, - PCI_HOST_PROP_PCI_HOLE64_START, NULL)); - info->w64_max = cpu_to_le64(object_property_get_int(pci_info, - PCI_HOST_PROP_PCI_HOLE64_END, NULL)); - /* Pass PCI hole info to guest via a side channel. - * Required so guest PCI enumeration does the right thing. */ - fw_cfg_add_file(guest_info->fw_cfg, "etc/pci-info", info, sizeof *info); -} - typedef struct PcGuestInfoState { PcGuestInfo info; Notifier machine_done; @@ -1106,7 +1077,6 @@ void pc_guest_info_machine_done(Notifier *notifier, void *data) PcGuestInfoState *guest_info_state = container_of(notifier, PcGuestInfoState, machine_done); - pc_fw_cfg_guest_info(&guest_info_state->info); acpi_setup(&guest_info_state->info); } diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 4f22be85da..47ac1b528d 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -59,7 +59,6 @@ static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; -static bool has_pci_info; static bool has_acpi_build = true; static int legacy_acpi_table_size; static bool smbios_defaults = true; @@ -166,7 +165,6 @@ static void pc_init1(MachineState *machine, guest_info->has_acpi_build = has_acpi_build; guest_info->legacy_acpi_table_size = legacy_acpi_table_size; - guest_info->has_pci_info = has_pci_info; guest_info->isapc_ram_fw = !pci_enabled; guest_info->has_reserved_memory = has_reserved_memory; @@ -340,7 +338,6 @@ static void pc_compat_1_7(MachineState *machine) static void pc_compat_1_6(MachineState *machine) { pc_compat_1_7(machine); - has_pci_info = false; rom_file_has_mr = false; has_acpi_build = false; } @@ -422,7 +419,6 @@ static void pc_init_pci_no_kvmclock(MachineState *machine) static void pc_init_isa(MachineState *machine) { - has_pci_info = false; has_acpi_build = false; smbios_defaults = false; gigabyte_align = false; @@ -457,16 +453,28 @@ static void pc_xen_hvm_init(MachineState *machine) .desc = "Standard PC (i440FX + PIIX, 1996)", \ .hot_add_cpu = pc_hot_add_cpu -#define PC_I440FX_2_1_MACHINE_OPTIONS \ +#define PC_I440FX_2_2_MACHINE_OPTIONS \ PC_I440FX_MACHINE_OPTIONS, \ .default_machine_opts = "firmware=bios-256k.bin" +static QEMUMachine pc_i440fx_machine_v2_2 = { + PC_I440FX_2_2_MACHINE_OPTIONS, + .name = "pc-i440fx-2.2", + .alias = "pc", + .init = pc_init_pci, + .is_default = 1, +}; + +#define PC_I440FX_2_1_MACHINE_OPTIONS PC_I440FX_2_2_MACHINE_OPTIONS + static QEMUMachine pc_i440fx_machine_v2_1 = { PC_I440FX_2_1_MACHINE_OPTIONS, .name = "pc-i440fx-2.1", - .alias = "pc", .init = pc_init_pci, - .is_default = 1, + .compat_props = (GlobalProperty[]) { + PC_COMPAT_2_1, + { /* end of list */ } + }, }; #define PC_I440FX_2_0_MACHINE_OPTIONS PC_I440FX_2_1_MACHINE_OPTIONS @@ -903,6 +911,7 @@ static QEMUMachine xenfv_machine = { static void pc_machine_init(void) { + qemu_register_pc_machine(&pc_i440fx_machine_v2_2); qemu_register_pc_machine(&pc_i440fx_machine_v2_1); qemu_register_pc_machine(&pc_i440fx_machine_v2_0); qemu_register_pc_machine(&pc_i440fx_machine_v1_7); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 0dd7e02160..4b5a27404a 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -49,7 +49,6 @@ /* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6 -static bool has_pci_info; static bool has_acpi_build = true; static bool smbios_defaults = true; static bool smbios_legacy_mode; @@ -150,7 +149,6 @@ static void pc_q35_init(MachineState *machine) } guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size); - guest_info->has_pci_info = has_pci_info; guest_info->isapc_ram_fw = false; guest_info->has_acpi_build = has_acpi_build; guest_info->has_reserved_memory = has_reserved_memory; @@ -296,7 +294,6 @@ static void pc_compat_1_7(MachineState *machine) static void pc_compat_1_6(MachineState *machine) { pc_compat_1_7(machine); - has_pci_info = false; rom_file_has_mr = false; has_acpi_build = false; } @@ -348,15 +345,27 @@ static void pc_q35_init_1_4(MachineState *machine) .desc = "Standard PC (Q35 + ICH9, 2009)", \ .hot_add_cpu = pc_hot_add_cpu -#define PC_Q35_2_1_MACHINE_OPTIONS \ +#define PC_Q35_2_2_MACHINE_OPTIONS \ PC_Q35_MACHINE_OPTIONS, \ .default_machine_opts = "firmware=bios-256k.bin" +static QEMUMachine pc_q35_machine_v2_2 = { + PC_Q35_2_2_MACHINE_OPTIONS, + .name = "pc-q35-2.2", + .alias = "q35", + .init = pc_q35_init, +}; + +#define PC_Q35_2_1_MACHINE_OPTIONS PC_Q35_2_2_MACHINE_OPTIONS + static QEMUMachine pc_q35_machine_v2_1 = { PC_Q35_2_1_MACHINE_OPTIONS, .name = "pc-q35-2.1", - .alias = "q35", .init = pc_q35_init, + .compat_props = (GlobalProperty[]) { + PC_COMPAT_2_1, + { /* end of list */ } + }, }; #define PC_Q35_2_0_MACHINE_OPTIONS PC_Q35_2_1_MACHINE_OPTIONS @@ -421,6 +430,7 @@ static QEMUMachine pc_q35_machine_v1_4 = { static void pc_q35_machine_init(void) { + 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); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 8c3eae73bf..054b035b08 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -410,7 +410,7 @@ DefinitionBlock ( /**************************************************************** * General purpose events ****************************************************************/ - External(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD, MethodObj) Scope(\_GPE) { Name(_HID, "ACPI0006") @@ -425,7 +425,7 @@ DefinitionBlock ( } Method(_E03) { // Memory hotplug event - \_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD() + \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_SCAN_METHOD() } Method(_L04) { } diff --git a/hw/i386/ssdt-mem.dsl b/hw/i386/ssdt-mem.dsl index 8e17bd1f97..22ff5ddfc3 100644 --- a/hw/i386/ssdt-mem.dsl +++ b/hw/i386/ssdt-mem.dsl @@ -39,10 +39,10 @@ ACPI_EXTRACT_ALL_CODE ssdm_mem_aml DefinitionBlock ("ssdt-mem.aml", "SSDT", 0x02, "BXPC", "CSSDT", 0x1) { - External(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_CRS_METHOD, MethodObj) - External(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_STATUS_METHOD, MethodObj) - External(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_OST_METHOD, MethodObj) - External(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_PROXIMITY_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_CRS_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_STATUS_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_OST_METHOD, MethodObj) + External(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_PROXIMITY_METHOD, MethodObj) Scope(\_SB) { /* v------------------ DO NOT EDIT ------------------v */ @@ -58,19 +58,19 @@ DefinitionBlock ("ssdt-mem.aml", "SSDT", 0x02, "BXPC", "CSSDT", 0x1) Name(_HID, EISAID("PNP0C80")) Method(_CRS, 0) { - Return(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_CRS_METHOD(_UID)) + Return(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_CRS_METHOD(_UID)) } Method(_STA, 0) { - Return(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_STATUS_METHOD(_UID)) + Return(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_STATUS_METHOD(_UID)) } Method(_PXM, 0) { - Return(\_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_PROXIMITY_METHOD(_UID)) + Return(\_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_PROXIMITY_METHOD(_UID)) } Method(_OST, 3) { - \_SB.PCI0.MEMORY_HOPTLUG_DEVICE.MEMORY_SLOT_OST_METHOD(_UID, Arg0, Arg1, Arg2) + \_SB.PCI0.MEMORY_HOTPLUG_DEVICE.MEMORY_SLOT_OST_METHOD(_UID, Arg0, Arg1, Arg2) } } } diff --git a/hw/i386/ssdt-misc.dsl b/hw/i386/ssdt-misc.dsl index d329b8ba57..0fd448000b 100644 --- a/hw/i386/ssdt-misc.dsl +++ b/hw/i386/ssdt-misc.dsl @@ -120,7 +120,7 @@ DefinitionBlock ("ssdt-misc.aml", "SSDT", 0x01, "BXPC", "BXSSDTSUSP", 0x1) External(MEMORY_SLOT_NOTIFY_METHOD, MethodObj) Scope(\_SB.PCI0) { - Device(MEMORY_HOPTLUG_DEVICE) { + Device(MEMORY_HOTPLUG_DEVICE) { Name(_HID, "PNP0A06") Name(_UID, "Memory hotplug resources") diff --git a/hw/intc/apic.c b/hw/intc/apic.c index ef19e5515c..03ff9e94f2 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -698,7 +698,7 @@ static uint32_t apic_mem_readl(void *opaque, hwaddr addr) val = s->log_dest << 24; break; case 0x0e: - val = s->dest_mode << 28; + val = (s->dest_mode << 28) | 0xfffffff; break; case 0x0f: val = s->spurious_vec; diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index d0b0c52b97..a563b82c4e 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -472,7 +472,7 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq) ISADevice *isadev; int i; - irq_set = g_malloc(ISA_NUM_IRQS * sizeof(qemu_irq)); + irq_set = g_new0(qemu_irq, ISA_NUM_IRQS); isadev = i8259_init_chip(TYPE_I8259, bus, true); dev = DEVICE(isadev); diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c index 028529e13d..7d1f3b9497 100644 --- a/hw/intc/openpic.c +++ b/hw/intc/openpic.c @@ -1627,7 +1627,7 @@ static void openpic_realize(DeviceState *dev, Error **errp) } for (i = 0; i < opp->nb_cpus; i++) { - opp->dst[i].irqs = g_new(qemu_irq, OPENPIC_OUTPUT_NB); + opp->dst[i].irqs = g_new0(qemu_irq, OPENPIC_OUTPUT_NB); for (j = 0; j < OPENPIC_OUTPUT_NB; j++) { sysbus_init_irq(d, &opp->dst[i].irqs[j]); } diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index b28981bfde..cc85e538b1 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -50,7 +50,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io) fprintf(stderr, "Can't create a second ISA bus\n"); return NULL; } - if (NULL == dev) { + if (!dev) { dev = qdev_create(NULL, "isabus-bridge"); qdev_init_nofail(dev); } diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index b846d81990..177023bcaf 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -7,7 +7,7 @@ * VA Linux Systems Japan K.K. * Copyright (C) 2012 Jason Baron <jbaron@redhat.com> * - * This is based on piix_pci.c, but heavily modified. + * This is based on piix.c, but heavily modified. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 08f49ed53b..5bfc5b7483 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -252,6 +252,12 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp) error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set"); return; } + if (dimm->node >= nb_numa_nodes) { + error_setg(errp, "'DIMM property " PC_DIMM_NODE_PROP " has value %" + PRIu32 "' which exceeds the number of numa nodes: %d", + dimm->node, nb_numa_nodes); + return; + } } static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 768e5288bc..d3e1195066 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -324,7 +324,11 @@ static int check_shm_size(IVShmemState *s, int fd) { struct stat buf; - fstat(fd, &buf); + if (fstat(fd, &buf) < 0) { + fprintf(stderr, "ivshmem: exiting: fstat on fd %d failed: %s\n", + fd, strerror(errno)); + return -1; + } if (s->ivshmem_size > buf.st_size) { fprintf(stderr, @@ -479,8 +483,8 @@ static void ivshmem_read(void *opaque, const uint8_t * buf, int flags) "ivshmem.bar2", s->ivshmem_size, map_ptr); vmstate_register_ram(&s->ivshmem, DEVICE(s)); - IVSHMEM_DPRINTF("guest h/w addr = %" PRIu64 ", size = %" PRIu64 "\n", - s->ivshmem_offset, s->ivshmem_size); + IVSHMEM_DPRINTF("guest h/w addr = %p, size = %" PRIu64 "\n", + map_ptr, s->ivshmem_size); memory_region_add_subregion(&s->bar, 0, &s->ivshmem); diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 0fc29a0ae3..a2c4608601 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -186,21 +186,31 @@ e1000_link_up(E1000State *s) s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS; } +static bool +have_autoneg(E1000State *s) +{ + return (s->compat_flags & E1000_FLAG_AUTONEG) && + (s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN); +} + static void set_phy_ctrl(E1000State *s, int index, uint16_t val) { + /* bits 0-5 reserved; MII_CR_[RESTART_AUTO_NEG,RESET] are self clearing */ + s->phy_reg[PHY_CTRL] = val & ~(0x3f | + MII_CR_RESET | + MII_CR_RESTART_AUTO_NEG); + /* * QEMU 1.3 does not support link auto-negotiation emulation, so if we * migrate during auto negotiation, after migration the link will be * down. */ - if (!(s->compat_flags & E1000_FLAG_AUTONEG)) { - return; - } - if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) { + if (have_autoneg(s) && (val & MII_CR_RESTART_AUTO_NEG)) { e1000_link_down(s); DBGOUT(PHY, "Start link auto negotiation\n"); - timer_mod(s->autoneg_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500); + timer_mod(s->autoneg_timer, + qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 500); } } @@ -223,13 +233,30 @@ static const char phy_regcap[0x20] = { /* PHY_ID2 documented in 8254x_GBe_SDM.pdf, pp. 250 */ static const uint16_t phy_reg_init[] = { - [PHY_CTRL] = 0x1140, - [PHY_STATUS] = 0x794d, /* link initially up with not completed autoneg */ - [PHY_ID1] = 0x141, /* [PHY_ID2] configured per DevId, from e1000_reset() */ - [PHY_1000T_CTRL] = 0x0e00, [M88E1000_PHY_SPEC_CTRL] = 0x360, - [M88E1000_EXT_PHY_SPEC_CTRL] = 0x0d60, [PHY_AUTONEG_ADV] = 0xde1, - [PHY_LP_ABILITY] = 0x1e0, [PHY_1000T_STATUS] = 0x3c00, + [PHY_CTRL] = MII_CR_SPEED_SELECT_MSB | + MII_CR_FULL_DUPLEX | + MII_CR_AUTO_NEG_EN, + + [PHY_STATUS] = MII_SR_EXTENDED_CAPS | + MII_SR_LINK_STATUS | /* link initially up */ + MII_SR_AUTONEG_CAPS | + /* MII_SR_AUTONEG_COMPLETE: initially NOT completed */ + MII_SR_PREAMBLE_SUPPRESS | + MII_SR_EXTENDED_STATUS | + MII_SR_10T_HD_CAPS | + MII_SR_10T_FD_CAPS | + MII_SR_100X_HD_CAPS | + MII_SR_100X_FD_CAPS, + + [PHY_ID1] = 0x141, + /* [PHY_ID2] configured per DevId, from e1000_reset() */ + [PHY_AUTONEG_ADV] = 0xde1, + [PHY_LP_ABILITY] = 0x1e0, + [PHY_1000T_CTRL] = 0x0e00, + [PHY_1000T_STATUS] = 0x3c00, + [M88E1000_PHY_SPEC_CTRL] = 0x360, [M88E1000_PHY_SPEC_STATUS] = 0xac00, + [M88E1000_EXT_PHY_SPEC_CTRL] = 0x0d60, }; static const uint32_t mac_reg_init[] = { @@ -446,8 +473,9 @@ set_mdic(E1000State *s, int index, uint32_t val) } else { if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) { phyreg_writeops[addr](s, index, data); + } else { + s->phy_reg[addr] = data; } - s->phy_reg[addr] = data; } } s->mac_reg[MDIC] = val | E1000_MDIC_READY; @@ -848,14 +876,6 @@ receive_filter(E1000State *s, const uint8_t *buf, int size) return 0; } -static bool -have_autoneg(E1000State *s) -{ - return (s->compat_flags & E1000_FLAG_AUTONEG) && - (s->phy_reg[PHY_CTRL] & MII_CR_AUTO_NEG_EN) && - (s->phy_reg[PHY_CTRL] & MII_CR_RESTART_AUTO_NEG); -} - static void e1000_set_link_status(NetClientState *nc) { diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 77bea6f89f..588149d8b6 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -1009,7 +1009,7 @@ vmxnet3_indicate_packet(VMXNET3State *s) vmxnet3_dump_rx_descr(&rxd); - if (0 != ready_rxcd_pa) { + if (ready_rxcd_pa != 0) { cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd)); } @@ -1020,7 +1020,7 @@ vmxnet3_indicate_packet(VMXNET3State *s) rxcd.gen = new_rxcd_gen; rxcd.rqID = RXQ_IDX + rx_ridx * s->rxq_num; - if (0 == bytes_left) { + if (bytes_left == 0) { vmxnet3_rx_update_descr(s->rx_pkt, &rxcd); } @@ -1038,16 +1038,16 @@ vmxnet3_indicate_packet(VMXNET3State *s) num_frags++; } - if (0 != ready_rxcd_pa) { + if (ready_rxcd_pa != 0) { rxcd.eop = 1; - rxcd.err = (0 != bytes_left); + rxcd.err = (bytes_left != 0); cpu_physical_memory_write(ready_rxcd_pa, &rxcd, sizeof(rxcd)); /* Flush RX descriptor changes */ smp_wmb(); } - if (0 != new_rxcd_pa) { + if (new_rxcd_pa != 0) { vmxnet3_revert_rxc_descr(s, RXQ_IDX); } @@ -1190,8 +1190,8 @@ static void vmxnet3_update_mcast_filters(VMXNET3State *s) s->mcast_list_len = list_bytes / sizeof(s->mcast_list[0]); s->mcast_list = g_realloc(s->mcast_list, list_bytes); - if (NULL == s->mcast_list) { - if (0 == s->mcast_list_len) { + if (!s->mcast_list) { + if (s->mcast_list_len == 0) { VMW_CFPRN("Current multicast list is empty"); } else { VMW_ERPRN("Failed to allocate multicast list of %d elements", @@ -1667,7 +1667,7 @@ vmxnet3_io_bar1_write(void *opaque, * memory address. We save it to temp variable and set the * shared address only after we get the high part */ - if (0 == val) { + if (val == 0) { s->device_active = false; } s->temp_shared_guest_driver_memory = val; diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index e1e95aabcd..8272de3f28 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -1,12 +1,12 @@ /* - * QEMU i440FX/PIIX3 PCI Bridge Emulation + * QEMU Smram/pam logic implementation * * Copyright (c) 2006 Fabrice Bellard * Copyright (c) 2011 Isaku Yamahata <yamahata at valinux co jp> * VA Linux Systems Japan K.K. * Copyright (c) 2012 Jason Baron <jbaron@redhat.com> * - * Split out from piix_pci.c + * Split out from piix.c * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index a0a3068dd5..37f228e77e 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -7,7 +7,7 @@ * VA Linux Systems Japan K.K. * Copyright (C) 2012 Jason Baron <jbaron@redhat.com> * - * This is based on piix_pci.c, but heavily modified. + * This is based on piix.c, but heavily modified. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/hw/pci/msi.c b/hw/pci/msi.c index a4a3040d4d..52d23130d9 100644 --- a/hw/pci/msi.c +++ b/hw/pci/msi.c @@ -291,7 +291,7 @@ void msi_notify(PCIDevice *dev, unsigned int vector) "notify vector 0x%x" " address: 0x%"PRIx64" data: 0x%"PRIx32"\n", vector, msg.address, msg.data); - stl_le_phys(&address_space_memory, msg.address, msg.data); + stl_le_phys(&dev->bus_master_as, msg.address, msg.data); } /* Normally called by pci_default_write_config(). */ diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 5c49bfc304..20ae47632f 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -439,7 +439,7 @@ void msix_notify(PCIDevice *dev, unsigned vector) msg = msix_get_message(dev, vector); - stl_le_phys(&address_space_memory, msg.address, msg.data); + stl_le_phys(&dev->bus_master_as, msg.address, msg.data); } void msix_reset(PCIDevice *dev) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 1a5b30d3ce..16c85efab5 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -583,7 +583,7 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr, SysBusDevice *s; int i; - mpic = g_new(qemu_irq, 256); + mpic = g_new0(qemu_irq, 256); if (kvm_enabled()) { QemuOpts *machine_opts = qemu_get_machine_opts(); diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index f5bccd2ad5..1ec4bb490b 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -346,7 +346,7 @@ static void ppc_core99_init(MachineState *machine) } } - pic = g_new(qemu_irq, 64); + pic = g_new0(qemu_irq, 64); dev = qdev_create(NULL, TYPE_OPENPIC); qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN); diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c index 207f47a1c0..620573caca 100644 --- a/hw/ssi/xilinx_spi.c +++ b/hw/ssi/xilinx_spi.c @@ -329,7 +329,7 @@ static int xilinx_spi_init(SysBusDevice *sbd) s->spi = ssi_create_bus(dev, "spi"); sysbus_init_irq(sbd, &s->irq); - s->cs_lines = g_new(qemu_irq, s->num_cs); + s->cs_lines = g_new0(qemu_irq, s->num_cs); ssi_auto_connect_slaves(dev, s->cs_lines, s->spi); for (i = 0; i < s->num_cs; ++i) { sysbus_init_irq(sbd, &s->cs_lines[i]); diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index bfebfe90f3..7b9957b3c3 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -371,7 +371,7 @@ static void output_callback(void *opaque, int avail) return; } data = streambuf_get(&s->out.buf); - if (NULL == data) { + if (!data) { return; } AUD_write(s->out.voice, data, USBAUDIO_PACKET_SIZE); diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 384d4a5ac5..0820046906 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -832,7 +832,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c) return; } data_in = usb_mtp_get_object(s, c, o); - if (NULL == data_in) { + if (data_in == NULL) { usb_mtp_queue_result(s, RES_GENERAL_ERROR, c->trans, 0, 0, 0); return; @@ -851,7 +851,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c) return; } data_in = usb_mtp_get_partial_object(s, c, o); - if (NULL == data_in) { + if (data_in == NULL) { usb_mtp_queue_result(s, RES_GENERAL_ERROR, c->trans, 0, 0, 0); return; diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index a00a93c3eb..448e0073dd 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1596,7 +1596,7 @@ static EHCIQueue *ehci_state_fetchqh(EHCIState *ehci, int async) entry = ehci_get_fetch_addr(ehci, async); q = ehci_find_queue_by_qh(ehci, entry, async); - if (NULL == q) { + if (q == NULL) { q = ehci_alloc_queue(ehci, entry, async); } |