@@ -230,6 +230,7 @@ Aml *aml_data_table_region(const char *name, Aml *sig, Aml *oem_id,
Aml *aml_irq_no_flags(uint8_t irq);
Aml *aml_named_field(const char *name, unsigned length);
Aml *aml_reserved_field(unsigned length);
+Aml *aml_access_field(AmlAccessType type);
Aml *aml_local(int num);
Aml *aml_string(const char *name_format, ...) GCC_FMT_ATTR(1, 2);
Aml *aml_lnot(Aml *arg);
@@ -821,6 +821,17 @@ Aml *aml_reserved_field(unsigned length)
return var;
}
+/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: AccessField */
+Aml *aml_access_field(AmlAccessType type)
+{
+ Aml *var = aml_alloc();
+ /* AccessField := 0x01 AccessType AccessAttrib */
+ build_append_byte(var->buf, 0x01);
+ build_append_byte(var->buf, type);
+ build_append_byte(var->buf, 0x00 /* reserved outside SMBus dev space */);
+ return var;
+}
+
/* ACPI 1.0b: 16.2.5.2 Named Objects Encoding: DefField */
Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule)
{
The AccessAs(AccessType) macro can be used inside the Field() operator in ASL, for diverging from the Field's default access type, for the fields that follow AccessAs(). The new helper function allows us to generate the matching AML. The AccessAttribute parameter of the macro (described in the spec) is not exposed because it is reserved for all spaces except SMBus device space, and we don't use that. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Gal Hammer <ghammer@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> --- include/hw/acpi/aml-build.h | 1 + hw/acpi/aml-build.c | 11 +++++++++++ 2 files changed, 12 insertions(+)