src/acpigen: implement acpigen_write_create[_buffer]_bit_field

Implement functions to write the AML bytes corresponding to
CreateBitField for both OP buffers and named buffers.

TEST=Calling 'acpigen_write_create_buffer_bit_field' results in the AML
code sequence being written which decompiles to ASL as expected.

Change-Id: Ia5c06c2e8564b64de386871b2faf79c433e5a1da
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86630
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2025-02-26 19:05:59 +01:00
commit 92d75be20b
2 changed files with 12 additions and 0 deletions

View file

@ -2461,6 +2461,11 @@ static void _create_field(uint8_t aml_op, uint8_t srcop, size_t byte_offset, con
acpigen_emit_namestring(name);
}
void acpigen_write_create_bit_field(uint8_t op, size_t bit_offset, const char *name)
{
_create_field(CREATE_BIT_OP, op, bit_offset, name);
}
void acpigen_write_create_byte_field(uint8_t op, size_t byte_offset, const char *name)
{
_create_field(CREATE_BYTE_OP, op, byte_offset, name);
@ -2490,6 +2495,11 @@ static void _create_buffer_field(uint8_t aml_op, const char *src_buf, size_t byt
acpigen_emit_namestring(field);
}
void acpigen_write_create_buffer_bit_field(const char *src_buf, size_t bit_offset, const char *field)
{
_create_buffer_field(CREATE_BIT_OP, src_buf, bit_offset, 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);

View file

@ -535,10 +535,12 @@ void acpigen_write_pld(const struct acpi_pld *pld);
void acpigen_write_ADR(uint64_t adr);
struct soundwire_address;
void acpigen_write_ADR_soundwire_device(const struct soundwire_address *address);
void acpigen_write_create_bit_field(uint8_t op, size_t bit_offset, const char *name);
void acpigen_write_create_byte_field(uint8_t op, size_t byte_offset, const char *name);
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_bit_field(const char *src_buf, size_t bit_offset, const char *field);
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);