Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- hw/acpi/acpi_gen_utils.c | 20 ++++++++++++++++++++ include/hw/acpi/acpi_gen_utils.h | 3 +++ 2 files changed, 23 insertions(+)
diff --git a/hw/acpi/acpi_gen_utils.c b/hw/acpi/acpi_gen_utils.c index 2de1ea6..4606d1e 100644 --- a/hw/acpi/acpi_gen_utils.c +++ b/hw/acpi/acpi_gen_utils.c @@ -613,3 +613,23 @@ AcpiAml acpi_varpackage(uint32_t num_elements) build_append_int(var.buf, num_elements); return var; } + +/* ACPI 5.0: 20.2.5.2 Named Objects Encoding: DefProcessor */ +AcpiAml GCC_FMT_ATTR(4, 5) +acpi_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len, + const char *name_format, ...) +{ + va_list ap; + AcpiAml var = aml_allocate_internal(0x83 /* ProcessorOp */, EXT_PACKAGE); + va_start(ap, name_format); + build_append_namestringv(var.buf, name_format, ap); + va_end(ap); + build_append_byte(var.buf, proc_id); /* ProcID */ + /* PblkAddr */ + build_append_byte(var.buf, pblk_addr & 0xFF); + build_append_byte(var.buf, (pblk_addr >> 8) & 0xFF); + build_append_byte(var.buf, (pblk_addr >> 16) & 0xFF); + build_append_byte(var.buf, (pblk_addr >> 24) & 0xFF); + build_append_byte(var.buf, pblk_len); /* PblkLen */ + return var; +} diff --git a/include/hw/acpi/acpi_gen_utils.h b/include/hw/acpi/acpi_gen_utils.h index 76b8d9f..753171f 100644 --- a/include/hw/acpi/acpi_gen_utils.h +++ b/include/hw/acpi/acpi_gen_utils.h @@ -61,6 +61,9 @@ AcpiAml acpi_named_field(const char *name, unsigned length); AcpiAml GCC_FMT_ATTR(1, 2) acpi_string(const char *name_format, ...); AcpiAml acpi_local0(void); AcpiAml acpi_equal(AcpiAml arg1, AcpiAml arg2); +AcpiAml GCC_FMT_ATTR(4, 5) +acpi_processor(uint8_t proc_id, uint32_t pblk_addr, uint8_t pblk_len, + const char *name_format, ...); /* Block ASL object primitives */ AcpiAml acpi_if(AcpiAml predicate); -- 1.8.3.1