summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/acpigen.c31
-rw-r--r--src/arch/x86/include/arch/acpigen.h15
2 files changed, 46 insertions, 0 deletions
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 1d75889018..cc724a0cc1 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -403,6 +403,37 @@ void acpigen_write_opregion(struct opregion *opreg)
acpigen_write_integer(opreg->regionlen);
}
+/*
+ * Generate ACPI AML code for Mutex
+ * Arg0: Pointer to name of mutex
+ * Arg1: Initial value of mutex
+ */
+void acpigen_write_mutex(const char *name, const uint8_t flags)
+{
+ /* MutexOp */
+ acpigen_emit_ext_op(MUTEX_OP);
+ /* NameString 4 chars only */
+ acpigen_emit_simple_namestring(name);
+ acpigen_emit_byte(flags);
+}
+
+void acpigen_write_acquire(const char *name, const uint16_t val)
+{
+ /* AcquireOp */
+ acpigen_emit_ext_op(ACQUIRE_OP);
+ /* NameString 4 chars only */
+ acpigen_emit_simple_namestring(name);
+ acpigen_emit_word(val);
+}
+
+void acpigen_write_release(const char *name)
+{
+ /* ReleaseOp */
+ acpigen_emit_ext_op(RELEASE_OP);
+ /* NameString 4 chars only */
+ acpigen_emit_simple_namestring(name);
+}
+
static void acpigen_write_field_length(uint32_t len)
{
uint8_t i, j;
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 6fd9f73e05..8b8c873fb5 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -411,6 +411,21 @@ void acpigen_write_rom(void *bios, const size_t length);
*/
void acpigen_write_opregion(struct opregion *opreg);
/*
+ * Generate ACPI AML code for Mutex
+ * This function takes mutex name and initial value.
+ */
+void acpigen_write_mutex(const char *name, const uint8_t flags);
+/*
+ * Generate ACPI AML code for Acquire
+ * This function takes mutex name and privilege value.
+ */
+void acpigen_write_acquire(const char *name, const uint16_t val);
+/*
+ * Generate ACPI AML code for Release
+ * This function takes mutex name.
+ */
+void acpigen_write_release(const char *name);
+/*
* Generate ACPI AML code for Field
* This function takes input region name, fieldlist, count & flags.
*/