Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
acpigen: Add methods for mutex operations
Change-Id: I79310b0f9e2297cf8428d11598935164caf95968 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 2 files changed, 46 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/37637/1
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c index 1d75889..8272757 100644 --- a/src/arch/x86/acpigen.c +++ b/src/arch/x86/acpigen.c @@ -403,6 +403,37 @@ 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 int val) +{ + /* MutexOp */ + acpigen_emit_ext_op(MUTEX_OP); + /* NameString 4 chars only */ + acpigen_emit_simple_namestring(name); + acpigen_write_integer(val); +} + +void acpigen_write_acquire(const char *name, const int val) +{ + /* AcquireOp */ + acpigen_emit_ext_op(ACQUIRE_OP); + /* NameString 4 chars only */ + acpigen_emit_simple_namestring(name); + acpigen_write_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 6fd9f73..a97cf1d 100644 --- a/src/arch/x86/include/arch/acpigen.h +++ b/src/arch/x86/include/arch/acpigen.h @@ -411,6 +411,21 @@ */ 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 int val); +/* + * Generate ACPI AML code for Acquire + * This function takes mutex name and privilege value. + */ +void acpigen_write_acquire(const char *name, const int 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. */
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c@426 PS1, Line 426: acpigen_write_word(val); shouldn't this be acpigen_write_integer too? "TimeoutValue is evaluated as an Integer"
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c@426 PS1, Line 426: acpigen_write_word(val);
shouldn't this be acpigen_write_integer too? "TimeoutValue is evaluated as an Integer"
the spec says "WordConstExpr". I'll test it on real hardware.
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/37637
to look at the new patch set (#2).
Change subject: acpigen: Add methods for mutex operations ......................................................................
acpigen: Add methods for mutex operations
Tested on Linux 5.2: Dumped and decoded the ACPI tables using iasl.
Change-Id: I79310b0f9e2297cf8428d11598935164caf95968 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 2 files changed, 46 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/37637/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c@426 PS1, Line 426: acpigen_write_word(val);
the spec says "WordConstExpr". I'll test it on real hardware.
it has to be emit_word()
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
Patch Set 2: Code-Review+1
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
Patch Set 2: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/37637/1/src/arch/x86/acpigen.c@426 PS1, Line 426: acpigen_write_word(val);
it has to be emit_word()
hm, i got my information from ACPI 6_2_A_Sept29.pdf 19.6.2 Acquire (Acquire a Mutex), but since you've tested that, i'd say that your code is correct here
Patrick Rudolph has submitted this change. ( https://review.coreboot.org/c/coreboot/+/37637 )
Change subject: acpigen: Add methods for mutex operations ......................................................................
acpigen: Add methods for mutex operations
Tested on Linux 5.2: Dumped and decoded the ACPI tables using iasl.
Change-Id: I79310b0f9e2297cf8428d11598935164caf95968 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/37637 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 2 files changed, 46 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Paul Menzel: Looks good to me, but someone else must approve Felix Held: Looks good to me, approved
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c index 1d75889..cc724a0 100644 --- a/src/arch/x86/acpigen.c +++ b/src/arch/x86/acpigen.c @@ -403,6 +403,37 @@ 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 6fd9f73..8b8c873 100644 --- a/src/arch/x86/include/arch/acpigen.h +++ b/src/arch/x86/include/arch/acpigen.h @@ -411,6 +411,21 @@ */ 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. */