Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- hw/acpi/aml-build.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/acpi/aml-build.h | 2 ++ 2 files changed, 37 insertions(+)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 0d4b324..ba7c92e 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -672,6 +672,17 @@ Aml *aml_equal(Aml *arg1, Aml *arg2) return var; } +/* ACPI 1.0b: 16.2.5.4 Type 2 Opcodes Encoding: DefLGreaterEqual */ +Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2) +{ + /* LGreaterEqualOp := LNotOp LLessOp */ + Aml *var = aml_opcode(0x92 /* LNotOp */); + build_append_byte(var->buf, 0x95 /* LLessOp */); + aml_append(var, arg1); + aml_append(var, arg2); + return var; +} + /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefIfElse */ Aml *aml_if(Aml *predicate) { @@ -1135,6 +1146,30 @@ Aml *aml_unicode(const char *str) return var; } +/* + * ACPI 2.0a: 16.2.3.4.2.28 LoadTable (Load Definition Block From XSDT) + */ +Aml *aml_load_table(const char *signature) +{ + Aml *var = aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x1F); /* LoadTableOp */ + aml_append(var, aml_string("%s", signature)); /* SignatureString */ + aml_append(var, aml_string(ACPI_BUILD_APPNAME6)); /* OEMIDString */ + aml_append(var, + aml_string("%s%s", + ACPI_BUILD_APPNAME4, + signature)); /* OEMTableIDString */ + /* load at current context */ + build_append_byte(var->buf, 0x0D); /* empty RootPathString */ + build_append_byte(var->buf, 0x0); + build_append_byte(var->buf, 0x0D); /* empty ParameterPathString */ + build_append_byte(var->buf, 0x0); + /* don't store anything into ParameterPathString since it's empty */ + build_append_byte(var->buf, 0); /* ParameterData */ + 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 1b632dc..148bf3e 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -229,6 +229,7 @@ Aml *aml_local(int num); Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_lnot(Aml *arg); Aml *aml_equal(Aml *arg1, Aml *arg2); +Aml *aml_lgreater_equal(Aml *arg1, Aml *arg2); Aml *aml_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len, const char *name_format, ...) GCC_FMT_ATTR(4, 5); Aml *aml_eisaid(const char *str); @@ -274,6 +275,7 @@ Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name); Aml *aml_varpackage(uint32_t num_elements); Aml *aml_touuid(const char *uuid); Aml *aml_unicode(const char *str); +Aml *aml_load_table(const char *signature); void build_header(GArray *linker, GArray *table_data, -- 1.8.3.1