aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi/aml-build.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-03-12 09:13:06 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-03-12 09:13:07 +0000
commita195fdd028370faa54ba3d627f1add8401ac5193 (patch)
tree89f274e7ae160804655a69ef0e12cc13e2559b2c /hw/acpi/aml-build.c
parentee74801035b0b5f1fdfd4e31d3a53f511f91c804 (diff)
parent18bf9e2f379334306530cbfd44218748eceaf67d (diff)
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
misc fixes and cleanups A bunch of fixes all over the place, some of the bugs fixed are actually regressions. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Wed Mar 11 17:48:30 2015 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: (25 commits) virtio-scsi: remove empty wrapper for cmd virtio-scsi: clean out duplicate cdb field virtio-scsi: fix cdb/sense size uapi/virtio_scsi: allow overriding CDB/SENSE size virtio-scsi: drop duplicate CDB/SENSE SIZE exec: don't include hw/boards for linux-user acpi: specify format for build_append_namestring MAINTAINERS: drop aliguori@amazon.com tpm: Move memory subregion function into realize function virtio-pci: Convert to realize() pci: Convert pci_nic_init() to Error to avoid qdev_init() machine: query mem-merge machine property machine: query dump-guest-core machine property hw/boards: make it safe to include for linux-user machine: query phandle-start machine property machine: query kvm-shadow-mem machine property kvm: add machine state to kvm_arch_init machine: query kernel-irqchip property machine: allowed/required kernel-irqchip support machine: replace qemu opts with iommu property ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/acpi/aml-build.c')
-rw-r--r--hw/acpi/aml-build.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 876cada4b2..6242908d6c 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -112,7 +112,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
switch (seg_count) {
case 1:
if (!*s) {
- build_append_byte(array, 0x0); /* NullName */
+ build_append_byte(array, 0x00); /* NullName */
} else {
build_append_nameseg(array, s);
}
@@ -141,6 +141,7 @@ build_append_namestringv(GArray *array, const char *format, va_list ap)
g_strfreev(segs);
}
+GCC_FMT_ATTR(2, 3)
static void build_append_namestring(GArray *array, const char *format, ...)
{
va_list ap;
@@ -335,26 +336,29 @@ static void build_buffer(GArray *array, uint8_t op)
void aml_append(Aml *parent_ctx, Aml *child)
{
+ GArray *buf = build_alloc_array();
+ build_append_array(buf, child->buf);
+
switch (child->block_flags) {
case AML_OPCODE:
build_append_byte(parent_ctx->buf, child->op);
break;
case AML_EXT_PACKAGE:
- build_extop_package(child->buf, child->op);
+ build_extop_package(buf, child->op);
break;
case AML_PACKAGE:
- build_package(child->buf, child->op);
+ build_package(buf, child->op);
break;
case AML_RES_TEMPLATE:
- build_append_byte(child->buf, 0x79); /* EndTag */
+ build_append_byte(buf, 0x79); /* EndTag */
/*
* checksum operations are treated as succeeded if checksum
* field is zero. [ACPI Spec 1.0b, 6.4.2.8 End Tag]
*/
- build_append_byte(child->buf, 0);
+ build_append_byte(buf, 0);
/* fall through, to pack resources in buffer */
case AML_BUFFER:
- build_buffer(child->buf, child->op);
+ build_buffer(buf, child->op);
break;
case AML_NO_OPCODE:
break;
@@ -362,7 +366,8 @@ void aml_append(Aml *parent_ctx, Aml *child)
assert(0);
break;
}
- build_append_array(parent_ctx->buf, child->buf);
+ build_append_array(parent_ctx->buf, buf);
+ build_free_array(buf);
}
/* ACPI 1.0b: 16.2.5.1 Namespace Modifier Objects Encoding: DefScope */
@@ -444,7 +449,7 @@ Aml *aml_and(Aml *arg1, Aml *arg2)
Aml *var = aml_opcode(0x7B /* AndOp */);
aml_append(var, arg1);
aml_append(var, arg2);
- build_append_int(var->buf, 0x00 /* NullNameOp */);
+ build_append_byte(var->buf, 0x00 /* NullNameOp */);
return var;
}
@@ -542,7 +547,6 @@ Aml *aml_equal(Aml *arg1, Aml *arg2)
Aml *var = aml_opcode(0x93 /* LequalOp */);
aml_append(var, arg1);
aml_append(var, arg2);
- build_append_int(var->buf, 0x00); /* NullNameOp */
return var;
}