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>
This commit is contained in:
parent
7f4c30c1d5
commit
61fcb7e965
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 }) */
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue