Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85197?usp=email )
Change subject: acpi/acpigen: generate Create*Field() from name string directly ......................................................................
acpi/acpigen: generate Create*Field() from name string directly
The following functions are added:
_create_buffer_field acpigen_write_create_buffer_byte_field acpigen_write_create_buffer_word_field acpigen_write_create_buffer_dword_field acpigen_write_create_buffer_qword_field
These functions are to generate: CreateByteField (<namestring> , offset, <field name>) CreateWordField (<namestring> , offset, <field name>) CreateDWordField (<namestring> , offset, <field name>) CreateQWordField (<namestring> , offset, <field name>)
NOTE: There are set of acpigen_write_create_[byte/word/dword/qword]_field functions already, but the field can only be created from Arg[n] or Local[n] variable objects. A Name object must be first assigned to such variable. The new functions here will allow us to create field directly from Name object.
BUG=none
Signed-off-by: Cliff Huang cliff.huang@intel.com Change-Id: I725f17329c501c80d42034e0f6a2fccb2cef5915 Reviewed-on: https://review.coreboot.org/c/coreboot/+/85197 Reviewed-by: Subrata Banik subratabanik@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/acpi/acpigen.c M src/include/acpi/acpigen.h 2 files changed, 33 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Subrata Banik: Looks good to me, approved
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index 4049df0..f682522 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -2424,6 +2424,35 @@ _create_field(CREATE_QWORD_OP, op, byte_offset, name); }
+static void _create_buffer_field(uint8_t aml_op, const char *src_buf, size_t byte_offset, + const char *field) +{ + acpigen_emit_byte(aml_op); + acpigen_emit_namestring(src_buf); + acpigen_write_integer(byte_offset); + acpigen_emit_namestring(field); +} + +void acpigen_write_create_buffer_byte_field(const char *src_buf, size_t byte_offset, const char *field) +{ + _create_buffer_field(CREATE_BYTE_OP, src_buf, byte_offset, field); +} + +void acpigen_write_create_buffer_word_field(const char *src_buf, size_t byte_offset, const char *field) +{ + _create_buffer_field(CREATE_WORD_OP, src_buf, byte_offset, field); +} + +void acpigen_write_create_buffer_dword_field(const char *src_buf, size_t byte_offset, const char *field) +{ + _create_buffer_field(CREATE_DWORD_OP, src_buf, byte_offset, field); +} + +void acpigen_write_create_buffer_qword_field(const char *src_buf, size_t byte_offset, const char *field) +{ + _create_buffer_field(CREATE_QWORD_OP, src_buf, byte_offset, field); +} + void acpigen_write_pct_package(const acpi_addr_t *perf_ctrl, const acpi_addr_t *perf_sts) { acpigen_write_name("_PCT"); diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h index d2e669f..8129263 100644 --- a/src/include/acpi/acpigen.h +++ b/src/include/acpi/acpigen.h @@ -536,6 +536,10 @@ void acpigen_write_create_word_field(uint8_t op, size_t byte_offset, const char *name); void acpigen_write_create_dword_field(uint8_t op, size_t byte_offset, const char *name); void acpigen_write_create_qword_field(uint8_t op, size_t byte_offset, const char *name); +void acpigen_write_create_buffer_byte_field(const char *src_buf, size_t byte_offset, const char *name); +void acpigen_write_create_buffer_word_field(const char *src_buf, size_t byte_offset, const char *name); +void acpigen_write_create_buffer_dword_field(const char *src_buf, size_t byte_offset, const char *name); +void acpigen_write_create_buffer_qword_field(const char *src_buf, size_t byte_offset, const char *name); void acpigen_write_field_name(const char *name, uint32_t size); /* * Generate ACPI AML code for _DSM method.