From: mia soweli <inbox@tachibana-labs.org>
To: 9front@9front.org
Subject: [9front] [PATCH] aux/acpi: attempt to call _PTS and _TTS before shutdown
Date: Sat, 20 May 2023 21:56:51 +0000 [thread overview]
Message-ID: <72BE6183527E30F06A9F0045886A1C3B@tachibana-labs.org> (raw)
The ACPI specification requires us to call _PTS (prepare to sleep)
and _TTS (transition to state) before we write to PM1a_CNT_BLK
and PM1b_CNT_BLK.
---
diff e3cd2bf512fee93d44d1f48c9813f15f81b21938 f72335db09b994351eed11ec537b329903b6731a
--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -256,6 +256,7 @@
poweroff(void)
{
int n;
+ void *tts, *pts;
if(facp == 0){
werrstr("no FACP");
@@ -263,6 +264,16 @@
}
wirecpu0();
+
+ /* The ACPI spec requires we call _TTS and _PTS to prepare
+ * the system to go to _S5 state. If they fail, too bad,
+ * try to go to _S5 state anyway. */
+ pts = amlval(amlwalk(amlroot, "_PTS"));
+ tts = amlval(amlwalk(amlroot, "_TTS"));
+ if(pts)
+ amleval(pts, "i", 5, nil);
+ if(tts)
+ amleval(tts, "i", 5, nil);
/* disable GPEs */
for(n = 0; GPE0_BLK > 0 && n < GPE0_BLK_LEN/2; n += 2){
reply other threads:[~2023-05-21 13:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=72BE6183527E30F06A9F0045886A1C3B@tachibana-labs.org \
--to=inbox@tachibana-labs.org \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).