summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/acpi/gpio.md1
-rw-r--r--src/acpi/acpigen.c2
-rw-r--r--src/acpi/acpigen_dsm.c1
-rw-r--r--src/drivers/intel/usb4/retimer/retimer.c1
-rw-r--r--src/include/acpi/acpigen.h28
-rw-r--r--src/soc/amd/common/block/graphics/graphics.c2
-rw-r--r--src/soc/amd/picasso/pcie_gpp.c1
-rw-r--r--src/soc/amd/picasso/root_complex.c2
-rw-r--r--src/soc/amd/stoneyridge/acpi.c2
-rw-r--r--src/soc/intel/apollolake/acpi.c2
-rw-r--r--src/soc/intel/common/block/pcie/rtd3/rtd3.c1
-rw-r--r--src/southbridge/intel/common/acpi_pirq_gen.c1
-rw-r--r--src/superio/nuvoton/npcd378/superio.c2
13 files changed, 30 insertions, 16 deletions
diff --git a/Documentation/acpi/gpio.md b/Documentation/acpi/gpio.md
index abde3a0d3d..470a55fa45 100644
--- a/Documentation/acpi/gpio.md
+++ b/Documentation/acpi/gpio.md
@@ -159,7 +159,6 @@ for the GPIO.
*/
acpigen_write_if_and(Local5, TX_BIT);
acpigen_write_store_args(ONE_OP, LOCAL0_OP);
- acpigen_pop_len();
acpigen_write_else();
acpigen_write_store_args(ZERO_OP, LOCAL0_OP);
acpigen_pop_len();
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 }) */
diff --git a/src/drivers/intel/usb4/retimer/retimer.c b/src/drivers/intel/usb4/retimer/retimer.c
index 4e56d641f8..fad353bebe 100644
--- a/src/drivers/intel/usb4/retimer/retimer.c
+++ b/src/drivers/intel/usb4/retimer/retimer.c
@@ -77,7 +77,6 @@ static void usb4_retimer_cb_set_power_state(void *arg)
*/
acpigen_write_if_lequal_op_int(LOCAL0_OP, 0);
acpigen_disable_tx_gpio(power_gpio);
- acpigen_pop_len(); /* If */
/*
* Else {
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h
index f7974ebc55..c79828819d 100644
--- a/src/include/acpi/acpigen.h
+++ b/src/include/acpi/acpigen.h
@@ -293,6 +293,10 @@ void acpigen_pop_len(void);
void acpigen_set_current(char *curr);
char *acpigen_get_current(void);
char *acpigen_write_package(int nr_el);
+inline void acpigen_write_package_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_zero(void);
void acpigen_write_one(void);
void acpigen_write_ones(void);
@@ -319,9 +323,21 @@ void acpigen_write_name_byte(const char *name, uint8_t val);
void acpigen_write_name_integer(const char *name, uint64_t val);
void acpigen_write_coreboot_hid(enum coreboot_acpi_ids id);
void acpigen_write_scope(const char *name);
+inline void acpigen_write_scope_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_method(const char *name, int nargs);
void acpigen_write_method_serialized(const char *name, int nargs);
+inline void acpigen_write_method_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_device(const char *name);
+inline void acpigen_write_device_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_PPC(u8 nr);
void acpigen_write_PPC_NVS(void);
void acpigen_write_empty_PCT(void);
@@ -345,6 +361,10 @@ void acpigen_write_xpss_package(const struct acpi_xpss_sw_pstate *pstate_value);
void acpigen_write_xpss_object(const struct acpi_xpss_sw_pstate *pstate_values,
size_t nentries);
void acpigen_write_processor(u8 cpuindex, u32 pblock_addr, u8 pblock_len);
+inline void acpigen_write_processor_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_processor_package(const char *name,
unsigned int first_core,
unsigned int core_count);
@@ -362,6 +382,10 @@ void acpigen_write_irq(u16 mask);
void acpigen_write_uuid(const char *uuid);
void acpigen_write_power_res(const char *name, uint8_t level, uint16_t order,
const char * const dev_states[], size_t dev_states_count);
+inline void acpigen_write_power_res_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_sleep(uint64_t sleep_ms);
void acpigen_write_store(void);
void acpigen_write_store_int_to_namestr(uint64_t src, const char *dst);
@@ -381,6 +405,10 @@ void acpigen_write_if_and(uint8_t arg1, uint8_t arg2);
void acpigen_write_if_lequal_op_op(uint8_t op, uint8_t val);
void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val);
void acpigen_write_if_lequal_namestr_int(const char *namestr, uint64_t val);
+inline void acpigen_write_if_end(void)
+{
+ acpigen_pop_len();
+}
void acpigen_write_else(void);
void acpigen_write_shiftleft_op_int(uint8_t src_result, uint64_t count);
void acpigen_write_to_buffer(uint8_t src, uint8_t dst);
diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c
index 942a8034af..82b437b155 100644
--- a/src/soc/amd/common/block/graphics/graphics.c
+++ b/src/soc/amd/common/block/graphics/graphics.c
@@ -76,7 +76,6 @@ static void generate_atif(const struct device *dev)
/* Return (Buffer (0x0C) { ... } */
acpigen_write_return_byte_buffer((uint8_t *)(void *)&verify_output,
sizeof(verify_output));
- acpigen_pop_len(); /* if (LEqual(Local0, 0) */
/* ElseIf ((Local0 == 0x10)) */
acpigen_write_else();
@@ -92,7 +91,6 @@ static void generate_atif(const struct device *dev)
/* Return (Buffer (0x0A) { ... } */
acpigen_write_return_byte_buffer((uint8_t *)(void *)&brightness_out,
sizeof(brightness_out));
- acpigen_pop_len(); /* if (LEqual(Local2, ATIF_QBTC_REQUEST_LCD1) */
/* Else */
acpigen_write_else();
/* Return (Buffer (0x0A) */
diff --git a/src/soc/amd/picasso/pcie_gpp.c b/src/soc/amd/picasso/pcie_gpp.c
index baa9fa3d29..582e1287b7 100644
--- a/src/soc/amd/picasso/pcie_gpp.c
+++ b/src/soc/amd/picasso/pcie_gpp.c
@@ -149,7 +149,6 @@ static void acpigen_write_PRT(const struct device *dev)
acpigen_pop_len();
}
acpigen_pop_len(); /* Package - APIC Routing */
- acpigen_pop_len(); /* End If */
/* Else */
acpigen_write_else();
diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c
index c954701f74..292ee20af8 100644
--- a/src/soc/amd/picasso/root_complex.c
+++ b/src/soc/amd/picasso/root_complex.c
@@ -228,8 +228,6 @@ static void acipgen_dptci(void)
dptc_call_alib("TABB", (uint8_t *)(void *)&tablet_mode_input,
sizeof(tablet_mode_input));
- acpigen_pop_len(); /* If */
-
/* Else */
acpigen_write_else();
diff --git a/src/soc/amd/stoneyridge/acpi.c b/src/soc/amd/stoneyridge/acpi.c
index 8b97ace47e..de79ec36be 100644
--- a/src/soc/amd/stoneyridge/acpi.c
+++ b/src/soc/amd/stoneyridge/acpi.c
@@ -187,8 +187,6 @@ static int acpigen_soc_get_gpio_val(unsigned int gpio_num, uint32_t mask)
/* Store (One, Local0) */
acpigen_write_store_ops(ONE_OP, LOCAL0_OP);
- acpigen_pop_len(); /* If */
-
/* Else */
acpigen_write_else();
diff --git a/src/soc/intel/apollolake/acpi.c b/src/soc/intel/apollolake/acpi.c
index 219ea95f4a..34f760ff42 100644
--- a/src/soc/intel/apollolake/acpi.c
+++ b/src/soc/intel/apollolake/acpi.c
@@ -255,8 +255,6 @@ static int acpigen_soc_get_gpio_val(unsigned int gpio_num, uint32_t mask)
/* Store (One, Local0) */
acpigen_write_store_ops(ONE_OP, LOCAL0_OP);
- acpigen_pop_len(); /* If */
-
/* Else */
acpigen_write_else();
diff --git a/src/soc/intel/common/block/pcie/rtd3/rtd3.c b/src/soc/intel/common/block/pcie/rtd3/rtd3.c
index be412e7967..5a04333499 100644
--- a/src/soc/intel/common/block/pcie/rtd3/rtd3.c
+++ b/src/soc/intel/common/block/pcie/rtd3/rtd3.c
@@ -158,7 +158,6 @@ pcie_rtd3_acpi_method_status(int pcie_rp,
acpigen_write_if_lequal_op_op(LOCAL0_OP, LOCAL1_OP);
acpigen_write_return_op(ZERO_OP);
- acpigen_pop_len(); /* If */
acpigen_write_else();
acpigen_write_return_op(ONE_OP);
acpigen_pop_len(); /* Else */
diff --git a/src/southbridge/intel/common/acpi_pirq_gen.c b/src/southbridge/intel/common/acpi_pirq_gen.c
index 6100be850c..73d101955b 100644
--- a/src/southbridge/intel/common/acpi_pirq_gen.c
+++ b/src/southbridge/intel/common/acpi_pirq_gen.c
@@ -94,7 +94,6 @@ void intel_acpi_gen_def_acpi_pirq(const struct device *dev)
acpigen_write_package(num_devs);
gen_pirq_route(EMIT_APIC, lpcb_path, pci_int_mapping);
acpigen_pop_len(); /* package */
- acpigen_pop_len(); /* if PICM */
acpigen_write_else();
acpigen_emit_byte(RETURN_OP);
acpigen_write_package(num_devs);
diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c
index b7f98af66b..801592d234 100644
--- a/src/superio/nuvoton/npcd378/superio.c
+++ b/src/superio/nuvoton/npcd378/superio.c
@@ -248,7 +248,6 @@ static void npcd378_ssdt_pwr(const struct device *dev)
acpigen_write_integer(0xE8);
acpigen_emit_namestring("^GPE2");
- acpigen_pop_len(); /* Pop If */
acpigen_write_else();
acpigen_emit_byte(AND_OP);
@@ -268,7 +267,6 @@ static void npcd378_ssdt_pwr(const struct device *dev)
acpigen_write_integer(0x10);
acpigen_emit_namestring("^GPE2");
- acpigen_pop_len(); /* Pop If */
acpigen_write_else();
acpigen_emit_byte(AND_OP);