Dynamic loading/unloading of tables. Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- include/hw/acpi/aml-build.h | 2 ++ hw/acpi/aml-build.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 7cf2cf64bf..f764f71e25 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -381,6 +381,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_load(const char *name, Aml *ddbhandle); +Aml *aml_unload(Aml *ddbhandle); void build_append_int_noprefix(GArray *table, uint64_t value, int size); void diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 7165f19585..ce691c1618 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1552,6 +1552,27 @@ Aml *aml_object_type(Aml *object) return var; } +/* ACPI 2.0: 17.2.4.3 Type 1 Opcodes Encoding: DefLoad */ +Aml *aml_load(const char *name, Aml *ddbhandle) +{ + Aml *var = aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x20); /* LoadOp */ + aml_append(var, aml_name("%s", name)); + aml_append(var, ddbhandle); + return var; +} + +/* ACPI 2.0: 17.2.4.3 Type 1 Opcodes Encoding: DefUnload */ +Aml *aml_unload(Aml *ddbhandle) +{ + Aml *var = aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x2A); /* UnloadOp */ + aml_append(var, ddbhandle); + return var; +} + void build_header(BIOSLinker *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev, -- MST