Message ID | 1425813387-31231-10-git-send-email-marcel@redhat.com |
---|---|
State | New |
Headers | show |
On 2015/3/8 19:16, Marcel Apfelbaum wrote: > Add encoding for ACPI DefWhile Opcode. > > Reviewed-by: Igor Mammedov <imammedo@redhat.com> > Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Shannon Zhao <zhaoshenglong@huawei.com> > --- > hw/acpi/aml-build.c | 8 ++++++++ > include/hw/acpi/aml-build.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c > index 6315ea0..f85a0fb 100644 > --- a/hw/acpi/aml-build.c > +++ b/hw/acpi/aml-build.c > @@ -623,6 +623,14 @@ Aml *aml_if(Aml *predicate) > return var; > } > > +/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefWhile */ > +Aml *aml_while(Aml *predicate) > +{ > + Aml *var = aml_bundle(0xA2 /* WhileOp */, AML_PACKAGE); > + aml_append(var, predicate); > + return var; > +} > + > /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ > Aml *aml_method(const char *name, int arg_count) > { > diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h > index c41f400..4f695a2 100644 > --- a/include/hw/acpi/aml-build.h > +++ b/include/hw/acpi/aml-build.h > @@ -189,6 +189,7 @@ Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); > Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); > Aml *aml_method(const char *name, int arg_count); > Aml *aml_if(Aml *predicate); > +Aml *aml_while(Aml *predicate); > Aml *aml_package(uint8_t num_elements); > Aml *aml_buffer(void); > Aml *aml_resource_template(void); >
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 6315ea0..f85a0fb 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -623,6 +623,14 @@ Aml *aml_if(Aml *predicate) return var; } +/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefWhile */ +Aml *aml_while(Aml *predicate) +{ + Aml *var = aml_bundle(0xA2 /* WhileOp */, AML_PACKAGE); + aml_append(var, predicate); + return var; +} + /* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefMethod */ Aml *aml_method(const char *name, int arg_count) { diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index c41f400..4f695a2 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -189,6 +189,7 @@ Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_device(const char *name_format, ...) GCC_FMT_ATTR(1, 2); Aml *aml_method(const char *name, int arg_count); Aml *aml_if(Aml *predicate); +Aml *aml_while(Aml *predicate); Aml *aml_package(uint8_t num_elements); Aml *aml_buffer(void); Aml *aml_resource_template(void);