* [9front] [PATCH] aux/acpi: attempt to call _PTS and _TTS before shutdown
@ 2023-05-20 21:56 mia soweli
0 siblings, 0 replies; only message in thread
From: mia soweli @ 2023-05-20 21:56 UTC (permalink / raw)
To: 9front
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){
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-21 13:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-20 21:56 [9front] [PATCH] aux/acpi: attempt to call _PTS and _TTS before shutdown mia soweli
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).