summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/acpigen.c53
-rw-r--r--src/arch/x86/include/arch/acpigen.h10
2 files changed, 63 insertions, 0 deletions
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 0a572630a1..35735b5cc9 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -987,12 +987,65 @@ void acpigen_write_if_and(uint8_t arg1, uint8_t arg2)
acpigen_emit_byte(arg2);
}
+void acpigen_write_if_lequal(uint8_t arg1, uint8_t arg2)
+{
+ acpigen_write_if();
+ acpigen_emit_byte(LEQUAL_OP);
+ acpigen_emit_byte(arg1);
+ acpigen_emit_byte(arg2);
+}
+
void acpigen_write_else(void)
{
acpigen_emit_byte(ELSE_OP);
acpigen_write_len_f();
}
+void acpigen_write_to_buffer(uint8_t src, uint8_t dst)
+{
+ acpigen_emit_byte(TO_BUFFER_OP);
+ acpigen_emit_byte(src);
+ acpigen_emit_byte(dst);
+}
+
+void acpigen_write_to_integer(uint8_t src, uint8_t dst)
+{
+ acpigen_emit_byte(TO_INTEGER_OP);
+ acpigen_emit_byte(src);
+ acpigen_emit_byte(dst);
+}
+
+void acpigen_write_byte_buffer(uint8_t *arr, uint8_t size)
+{
+ uint8_t i;
+
+ acpigen_emit_byte(BUFFER_OP);
+ acpigen_write_len_f();
+ acpigen_emit_byte(size);
+
+ for (i = 0; i < size; i++)
+ acpigen_emit_byte(arr[i]);
+
+ acpigen_pop_len();
+}
+
+void acpigen_write_return_byte_buffer(uint8_t *arr, uint8_t size)
+{
+ acpigen_emit_byte(RETURN_OP);
+ acpigen_write_byte_buffer(arr, size);
+}
+
+void acpigen_write_return_singleton_buffer(uint8_t arg)
+{
+ acpigen_write_return_byte_buffer(&arg, 1);
+}
+
+void acpigen_write_return_byte(uint8_t arg)
+{
+ acpigen_emit_byte(RETURN_OP);
+ acpigen_write_byte(arg);
+}
+
/* Soc-implemented functions -- weak definitions. */
int __attribute__((weak)) acpigen_soc_read_rx_gpio(unsigned int gpio_num)
{
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 0c515da242..dd83db85a1 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -75,6 +75,9 @@ enum {
AND_OP = 0x7B,
OR_OP = 0x7D,
NOT_OP = 0x80,
+ LEQUAL_OP = 0x93,
+ TO_BUFFER_OP = 0x96,
+ TO_INTEGER_OP = 0x99,
IF_OP = 0xA0,
ELSE_OP = 0xA1,
RETURN_OP = 0xA4,
@@ -156,7 +159,14 @@ void acpigen_write_debug_integer(uint64_t val);
void acpigen_write_debug_op(uint8_t op);
void acpigen_write_if(void);
void acpigen_write_if_and(uint8_t arg1, uint8_t arg2);
+void acpigen_write_if_lequal(uint8_t arg1, uint8_t arg2);
void acpigen_write_else(void);
+void acpigen_write_to_buffer(uint8_t src, uint8_t dst);
+void acpigen_write_to_integer(uint8_t src, uint8_t dst);
+void acpigen_write_byte_buffer(uint8_t *arr, uint8_t size);
+void acpigen_write_return_byte_buffer(uint8_t *arr, uint8_t size);
+void acpigen_write_return_singleton_buffer(uint8_t arg);
+void acpigen_write_return_byte(uint8_t arg);
int get_cst_entries(acpi_cstate_t **);