[PATCH 2/5] hw/acpi/aml-build.c: add AML functions for StartDependentFn/EndDependentFn

Mark Cave-Ayland posted 5 patches 2 days, 19 hours ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>
[PATCH 2/5] hw/acpi/aml-build.c: add AML functions for StartDependentFn/EndDependentFn
Posted by Mark Cave-Ayland 2 days, 19 hours ago
These functions are required to generate a suitable _PRS entry for the
ISA serial ports.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
 include/hw/acpi/aml-build.h |  2 ++
 hw/acpi/aml-build-stub.c    | 10 ++++++++++
 hw/acpi/aml-build.c         | 15 +++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 3394253b9e..6043eeee41 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -415,6 +415,8 @@ Aml *aml_derefof(Aml *arg);
 Aml *aml_sizeof(Aml *arg);
 Aml *aml_concatenate(Aml *source1, Aml *source2, Aml *target);
 Aml *aml_object_type(Aml *object);
+Aml *aml_start_dependent_function(uint8_t compat, uint8_t config);
+Aml *aml_end_dependent_function(void);
 
 void build_append_int_noprefix(GArray *table, uint64_t value, int size);
 
diff --git a/hw/acpi/aml-build-stub.c b/hw/acpi/aml-build-stub.c
index 3180c7c962..cf2f34ddb1 100644
--- a/hw/acpi/aml-build-stub.c
+++ b/hw/acpi/aml-build-stub.c
@@ -107,3 +107,13 @@ Aml *aml_buffer(int buffer_size, uint8_t *byte_list)
 {
     return NULL;
 }
+
+Aml *aml_start_dependent_function(uint8_t compat, uint8_t config)
+{
+    return NULL;
+}
+
+Aml *aml_end_dependent_function(void)
+{
+    return NULL;
+}
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index b07b0133c2..0b9498a4e9 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1729,6 +1729,21 @@ Aml *aml_object_type(Aml *object)
     return var;
 }
 
+/* ACPI 1.0b: 6.4.2.3.1 ASL Macro for StartDependentFn */
+Aml *aml_start_dependent_function(uint8_t compat, uint8_t config)
+{
+    Aml *var = aml_opcode(0x031 /* StartDependentFn */);
+    build_append_byte(var->buf, 0); /* Good compat, Good config */
+    return var;
+}
+
+/* ACPI 1.0b: 6.4.2.4.1 ASL Macro for EndDependentFn */
+Aml *aml_end_dependent_function(void)
+{
+    Aml *var = aml_opcode(0x038 /* StartDependentFn */);
+    return var;
+}
+
 void acpi_table_begin(AcpiTable *desc, GArray *array)
 {
 
-- 
2.43.0