summaryrefslogtreecommitdiff
path: root/hw/acpi
AgeCommit message (Collapse)AuthorFilesLines
2015-07-29hw/acpi/aml-build: Fix memory leakShannon Zhao1-0/+1
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> (cherry picked from commit afcf905cff7971324c2706600ead35a1f41f417a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2015-03-25acpi: Add missing GCC_FMT_ATTR to local functionStefan Weil1-1/+1
This fixes these gcc warnings (not enabled in default build): hw/acpi/aml-build.c:83:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] hw/acpi/aml-build.c:88:5: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-03-11acpi: specify format for build_append_namestringMichael S. Tsirkin1-0/+1
Will catch users if we misused it. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-03-10acpi: fix aml_equal term implementationMarcel Apfelbaum1-1/+0
The DefLEqual op does not have a target operand. Remove it. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-03-10aml-build: append opcodes using build_append_byteMichael S. Tsirkin1-3/+3
Opcodes are raw bytes, they shouldn't be added using build_append_int. This only happens to work with 0 and 1 opcodes. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-03-10aml-build: don't modify childMichael S. Tsirkin1-6/+10
this code: aml_append(foo, bar); might, non-intuitively, modify bar, which means that e.g. the following might not DTRT: c = ....; aml_append(a, c); aml_append(b, c); to fix, simply allocate an intermediate array, and always modify that. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2015-03-03aml-build: fix build for glib < 2.22Michael S. Tsirkin1-2/+3
g_ptr_array_new_with_free_func is there since glib 2.22, use the older g_ptr_array_foreach instead. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-03-01acpi, mem-hotplug: use PC_DIMM_SLOT_PROP in acpi_memory_plug_cb().Tang Chen1-1/+2
Replace string "slot" in acpi_memory_plug_cb() with macro PC_DIMM_SLOT_PROP. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-03-01acpi: make build_*() routines static to aml-build.cIgor Mammedov1-10/+10
build_*() routines were used for composing AML structures manually in acpi-build.c but after conversion to AML API they are not used outside of aml-build.c anymore, so hide them from external users. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-03-01acpi: add acpi_irq_no_flags() termIgor Mammedov1-0/+21
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26pc: pcihp: expose MMIO base and len as propertiesIgor Mammedov2-7/+13
it will be used later to dynamically reserve MMIO region instead of manually punching holes in PCI0._CRS Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_word_bus_number(), aml_word_io(), aml_dword_memory(), ↵Igor Mammedov1-0/+161
aml_qword_memory() terms Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_reserved_field() termIgor Mammedov1-0/+10
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_eisaid() termIgor Mammedov1-0/+29
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_processor() termIgor Mammedov1-0/+15
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_equal() termIgor Mammedov1-0/+10
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_varpackage() termIgor Mammedov1-0/+8
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_string() termIgor Mammedov1-0/+25
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_local() termIgor Mammedov1-0/+11
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_field() & aml_named_field() termsIgor Mammedov1-0/+28
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_operation_region() termIgor Mammedov1-0/+14
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: include PkgLength size only when requestedIgor Mammedov1-5/+15
Named/Reserved{Field} definition uses PkgLength [1] encoding to specify field length, however it doesn't include size of PkgLength field itself, while other block objects that have explicit length of its body account for PkgLength size while encoding it [2]. This special casing isn't mentioned in ACPI spec, but that's what 'iasl' compiles NamedField to so add extra argument to build_prepend_pkg_length() to allow it handle the case. -- 1. ACPI Spec 5.0, 20.2.5.2 Named Objects Encoding, page 822 2. ACPI Spec 5.0, 5.4 Definition Block Encoding Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_io() helperIgor Mammedov1-0/+16
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_resource_template() helperIgor Mammedov1-0/+8
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_buffer() termIgor Mammedov1-0/+7
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_package() termIgor Mammedov1-0/+8
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_call1(), aml_call2(), aml_call3(), aml_call4() helpersIgor Mammedov1-0/+42
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_notify() termIgor Mammedov1-0/+9
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_and() termIgor Mammedov1-0/+10
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_store() termIgor Mammedov1-0/+9
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_arg() termIgor Mammedov1-0/+11
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_return() termIgor Mammedov1-0/+8
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_int() termIgor Mammedov1-21/+22
* factor out ACPI const int packing out of build_append_value() and rename build_append_value() to build_append_int_noprefix() it will be reused for adding a plain integer value into AML. will be used by is aml_processor() and CRS macro helpers * extend build_append_int{_noprefix}() to support 64-bit values it will be used PCI for generating 64bit _CRS entries Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_name() & aml_name_decl() termIgor Mammedov1-0/+32
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_if() termIgor Mammedov1-0/+8
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_method() termIgor Mammedov1-0/+9
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_device() termIgor Mammedov1-0/+11
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add aml_scope() termIgor Mammedov1-0/+20
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: introduce AML composer aml_append()Igor Mammedov1-0/+78
Adds for dynamic AML creation, which will be used for piecing ASL/AML primitives together and hiding from user/caller details about how nested context should be closed/packed leaving less space for mistakes and necessity to know how AML should be encoded, allowing user to concentrate on ASL representation instead. For example it will allow to create AML like this: init_aml_allocator(); ... Aml *scope = aml_scope("PCI0") Aml *dev = aml_device("PM") aml_append(dev, aml_name_decl("_ADR", aml_int(addr))) aml_append(scope, dev); ... free_aml_allocator(); Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi, piix4: Add unplug cb for piix4.Tang Chen1-0/+8
Memory and CPU hot unplug are both asynchronous procedures. When the unplug operation happens, unplug request cb is called first. And when guest OS finished handling unplug, unplug cb will be called to do the real removal of device. This patch adds hotunplug cb to piix4, which memory and CPU hot unplug will use it. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi, ich9: Add unplug cb for ich9.Tang Chen1-0/+7
Memory and CPU hot unplug are both asynchronous procedures. When the unplug operation happens, unplug request cb is called first. And when guest OS finished handling unplug, unplug cb will be called to do the real removal of device. This patch adds hotunplug cb to ich9, which memory and CPU hot unplug will use it. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi, ich9: Add hotunplug request cb for ich9.Tang Chen1-0/+7
Memory and CPU hot unplug are both asynchronous procedures. They both need unplug request cb when the unplug operation happens. This patch adds hotunplug request cb for ich9, and memory and CPU hot unplug will share it. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Zhu Guihua <zhugh.fnst@cn.fujitsu.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26pci: Trivial device model conversions to realizeMarkus Armbruster1-3/+2
Convert the device models where initialization obviously can't fail. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com>
2015-02-26acpi: drop min-bytes in build_package()Igor Mammedov1-10/+4
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: add build_append_namestring() helperIgor Mammedov1-9/+87
Use build_append_namestring() instead of build_append_nameseg() So user won't have to care whether name is NameSeg, NamePath or NameString. See for reference ACPI 5.0: 20.2.2 Name Objects Encoding Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26acpi: move generic aml building helpers into dedictated fileIgor Mammedov2-0/+188
the will be later used for composing AML primitives and all that could be reused later for ARM machines as well. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-02-26bios linker: validate pointer within tableMichael S. Tsirkin1-1/+3
buios linker assumes pointer parameter it gets is within table, validate this. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-01-27Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell3-1/+255
pci, pc, virtio fixes and cleanups A bunch of fixes all over the place. Also, beginning to generalize acpi build code for reuse by ARM. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Tue 27 Jan 2015 13:12:25 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: pc-dimm: Add Error argument to pc_existing_dimms_capacity pc-dimm: Make pc_existing_dimms_capacity global pc: Fix DIMMs capacity calculation smbios: Don't report unknown CPU speed (fix SVVP regression) smbios: Fix dimm size calculation when RAM is multiple of 16GB bios-linker-loader: move source to common location bios-linker-loader: move header to common location virtio: fix feature bit checks bios-tables-test: split piix4 and q35 tests acpi: build_append_nameseg(): add padding if necessary acpi: update generated hex files acpi-test: update expected DSDT pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled pci: Split pcie_host_mmcfg_map() Add some trace calls to pci.c. ich9: add disable_s3, disable_s4, s4_val properties Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-01-27bios-linker-loader: move source to common locationMichael S. Tsirkin2-0/+158
There are plans to use bios linker by MIPS, ARM. It's only used by ACPI ATM, so put it in hw/acpi and make it depend on CONFIG_ACPI. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2015-01-26ich9: add disable_s3, disable_s4, s4_val propertiesAmit Shah1-1/+97
PIIX4 has disable_s3 and disable_s4 properties to enable or disable PM functions. Add such properties to the ICH9 chipset as well for the Q35 machine type. S3 / S4 are not guaranteed to always work (needs work in the guest as well as QEMU for things to work properly), and disabling advertising of these features ensures guests don't go into zombie state if something isn't working right. The defaults are kept the same as in PIIX4: both S3 and S4 are enabled by default. These can be disabled via the cmdline: ... -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 Note: some guests can fake hibernation by writing a hibernate image and doing a shutdown instead of S4 if S4 isn't available; there's nothing we can do guests to stop doing this, and this patch can't affect that functionality. Signed-off-by: Amit Shah <amit.shah@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>