diff options
author | Jakub Czapiga <jacz@semihalf.com> | 2021-02-19 11:44:22 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-03-22 11:21:55 +0000 |
commit | 61fcb7e9654634cfe0c8a7bf56581fb54d943bd8 (patch) | |
tree | b65b1a743c85294bc37e1ca7fe8160eeab741073 /src/acpi | |
parent | 7f4c30c1d5c16539faf564d38ebbc695bca8836a (diff) | |
download | coreboot-61fcb7e9654634cfe0c8a7bf56581fb54d943bd8.tar.xz |
acpi/acpigen.h: Add more intuitive AML package closing functions
Until now every AML package had to be closed using acpigen_pop_len().
This commit introduces set of package closing functions corresponding
with their opening function names. For example acpigen_write_if()
opens if-statement package, acpigen_write_if_end() closes it.
Now acpigen_write_else() closes previously opened acpigen_write_if(),
so acpigen_pop_len() is not required before it.
Signed-off-by: Jakub Czapiga <jacz@semihalf.com>
Change-Id: Icfdc3804cd93bde049cd11dec98758b3a639eafd
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50910
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lance Zhao
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/acpi')
-rw-r--r-- | src/acpi/acpigen.c | 2 | ||||
-rw-r--r-- | src/acpi/acpigen_dsm.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index b3e112d800..1131729da5 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -1422,8 +1422,10 @@ void acpigen_write_if_lequal_namestr_int(const char *namestr, uint64_t val) acpigen_write_integer(val); } +/* Closes previously opened if statement and generates ACPI code for else statement. */ void acpigen_write_else(void) { + acpigen_pop_len(); acpigen_emit_byte(ELSE_OP); acpigen_write_len_f(); } diff --git a/src/acpi/acpigen_dsm.c b/src/acpi/acpigen_dsm.c index fc53ddff4d..734fbd5cfb 100644 --- a/src/acpi/acpigen_dsm.c +++ b/src/acpi/acpigen_dsm.c @@ -22,7 +22,6 @@ static void i2c_hid_func0_cb(void *arg) acpigen_write_if_lequal_op_int(LOCAL2_OP, 0x1); /* Return (Buffer (One) { 0x3 }) */ acpigen_write_return_singleton_buffer(0x3); - acpigen_pop_len(); /* Pop : If */ /* Else */ acpigen_write_else(); /* Return (Buffer (One) { 0x0 }) */ |