@@ -519,3 +519,17 @@ AcpiAml acpi_package(uint8_t num_elements)
build_append_byte(var.buf, num_elements);
return var;
}
+
+/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefOpRegion */
+AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
+ uint32_t offset, uint32_t len)
+{
+ AcpiAml var = aml_allocate_internal(0, NON_BLOCK);
+ build_append_byte(var.buf, 0x5B); /* ExtOpPrefix */
+ build_append_byte(var.buf, 0x80); /* OpRegionOp */
+ build_append_namestring(var.buf, "%s", name);
+ build_append_byte(var.buf, rs);
+ build_append_int(var.buf, offset);
+ build_append_int(var.buf, len);
+ return var;
+}
@@ -24,6 +24,11 @@ typedef enum {
acpi_decode16 = 1,
} acpiIODecode;
+typedef enum {
+ acpi_system_memory = 0x00,
+ acpi_system_io = 0x01,
+} acpiRegionSpace;
+
void aml_append(AcpiAml *parent_ctx, AcpiAml child);
/* non block ASL object primitives */
@@ -46,6 +51,8 @@ AcpiAml acpi_call4(const char *method, AcpiAml arg1, AcpiAml arg2,
AcpiAml arg3, AcpiAml arg4);
AcpiAml acpi_io(acpiIODecode dec, uint16_t min_base, uint16_t max_base,
uint8_t aln, uint8_t len);
+AcpiAml acpi_operation_region(const char *name, acpiRegionSpace rs,
+ uint32_t offset, uint32_t len);
/* Block ASL object primitives */
AcpiAml acpi_if(AcpiAml predicate);
Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/acpi/acpi_gen_utils.c | 14 ++++++++++++++ include/hw/acpi/acpi_gen_utils.h | 7 +++++++ 2 files changed, 21 insertions(+)