From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 29/39] hw/acpi/aml-build: Add ToUUID macro
Date: Fri, 29 May 2015 14:10:35 +0100 [thread overview]
Message-ID: <1432905045-22138-30-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org>
From: Shannon Zhao <shannon.zhao@linaro.org>
Add ToUUID macro, this is useful for generating PCIe ACPI table.
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1432522520-8068-16-git-send-email-zhaoshenglong@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/acpi/aml-build.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
include/hw/acpi/aml-build.h | 1 +
2 files changed, 54 insertions(+)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 22478c2..ebce504 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -962,6 +962,59 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed,
addr_trans, len, flags);
}
+static uint8_t Hex2Byte(const char *src)
+{
+ int hi, lo;
+
+ hi = Hex2Digit(src[0]);
+ assert(hi >= 0);
+ assert(hi <= 15);
+
+ lo = Hex2Digit(src[1]);
+ assert(lo >= 0);
+ assert(lo <= 15);
+ return (hi << 4) | lo;
+}
+
+/*
+ * ACPI 3.0: 17.5.124 ToUUID (Convert String to UUID Macro)
+ * e.g. UUID: aabbccdd-eeff-gghh-iijj-kkllmmnnoopp
+ * call aml_touuid("aabbccdd-eeff-gghh-iijj-kkllmmnnoopp");
+ */
+Aml *aml_touuid(const char *uuid)
+{
+ Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER);
+
+ assert(strlen(uuid) == 36);
+ assert(uuid[8] == '-');
+ assert(uuid[13] == '-');
+ assert(uuid[18] == '-');
+ assert(uuid[23] == '-');
+
+ build_append_byte(var->buf, Hex2Byte(uuid + 6)); /* dd - at offset 00 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 4)); /* cc - at offset 01 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 2)); /* bb - at offset 02 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 0)); /* aa - at offset 03 */
+
+ build_append_byte(var->buf, Hex2Byte(uuid + 11)); /* ff - at offset 04 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 9)); /* ee - at offset 05 */
+
+ build_append_byte(var->buf, Hex2Byte(uuid + 16)); /* hh - at offset 06 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 14)); /* gg - at offset 07 */
+
+ build_append_byte(var->buf, Hex2Byte(uuid + 19)); /* ii - at offset 08 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 21)); /* jj - at offset 09 */
+
+ build_append_byte(var->buf, Hex2Byte(uuid + 24)); /* kk - at offset 10 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 26)); /* ll - at offset 11 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 28)); /* mm - at offset 12 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 30)); /* nn - at offset 13 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 32)); /* oo - at offset 14 */
+ build_append_byte(var->buf, Hex2Byte(uuid + 34)); /* pp - at offset 15 */
+
+ return var;
+}
+
void
build_header(GArray *linker, GArray *table_data,
AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index fac70ea..a873b46 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -257,6 +257,7 @@ Aml *aml_buffer(int buffer_size, uint8_t *byte_list);
Aml *aml_resource_template(void);
Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
Aml *aml_varpackage(uint32_t num_elements);
+Aml *aml_touuid(const char *uuid);
void
build_header(GArray *linker, GArray *table_data,
--
1.9.1
next prev parent reply other threads:[~2015-05-29 13:11 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 13:10 [Qemu-devel] [PULL 00/39] target-arm queue Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 01/39] target-arm: Add exception target el infrastructure Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 02/39] target-arm: Extend helpers to route exceptions Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 03/39] target-arm: Set correct syndrome for faults on MSR DAIF*, imm Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 04/39] target-arm: Move setting of exception info into tlb_fill Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 05/39] target-arm: Set exception target EL in tlb_fill Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 06/39] target-arm: Make raise_exception() take syndrome and target EL Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 07/39] target-arm: Update interrupt handling to use " Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 08/39] target-arm: Allow cp access functions to indicate traps to EL2 or EL3 Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 09/39] target-arm: Add AArch64 CPTR registers Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 10/39] target-arm: Make singlestate TB flags common between AArch32/64 Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 11/39] target-arm: Extend FP checks to use an EL Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 12/39] target-arm: Move TB flags down to fill gap Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 13/39] target-arm: Don't halt on WFI unless we don't have any work Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 14/39] target-arm: Add WFx instruction trap support Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 15/39] hw/acpi/aml-build: Make enum values to be upper case to match coding style Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 16/39] hw/arm/virt: Move common definitions to virt.h Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 17/39] hw/arm/virt: Record PCIe ranges in MemMapEntry array Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 18/39] hw/arm/virt-acpi-build: Basic framework for building ACPI tables on ARM Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 19/39] hw/acpi/aml-build: Add aml_memory32_fixed() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 20/39] hw/acpi/aml-build: Add aml_interrupt() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 21/39] hw/arm/virt-acpi-build: Generation of DSDT table for virt devices Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 22/39] hw/arm/virt-acpi-build: Generate FADT table and update ACPI headers Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 23/39] hw/arm/virt-acpi-build: Generate MADT table Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 24/39] hw/arm/virt-acpi-build: Generate GTDT table Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 25/39] hw/arm/virt-acpi-build: Generate RSDT table Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 26/39] hw/arm/virt-acpi-build: Generate RSDP table Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 27/39] hw/arm/virt-acpi-build: Generate MCFG table Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 28/39] hw/acpi/aml-build: Make aml_buffer() definition consistent with the spec Peter Maydell
2015-05-29 13:10 ` Peter Maydell [this message]
2015-05-29 13:10 ` [Qemu-devel] [PULL 30/39] hw/acpi/aml-build: Add aml_or() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 31/39] hw/acpi/aml-build: Add aml_lnot() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 32/39] hw/acpi/aml-build: Add aml_else() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 33/39] hw/acpi/aml-build: Add aml_create_dword_field() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 34/39] hw/acpi/aml-build: Add aml_dword_io() term Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 35/39] hw/acpi/aml-build: Add Unicode macro Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 36/39] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 37/39] ACPI: split CONFIG_ACPI into 4 pieces Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 38/39] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables Peter Maydell
2015-05-29 13:10 ` [Qemu-devel] [PULL 39/39] target-arm: Avoid buffer overrun on UNPREDICTABLE ldrd/strd Peter Maydell
2015-05-29 17:46 ` [Qemu-devel] [PULL 00/39] target-arm queue Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432905045-22138-30-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).