From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=DATE_IN_PAST_12_24, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 32031 invoked from network); 21 May 2023 13:53:01 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 21 May 2023 13:53:01 -0000 Received: from one.net.tachibana-labs.org ([78.141.198.89]) by 9front; Sun May 21 09:51:24 -0400 2023 Received: from kijetesantakalu (cpc99362-croy26-2-0-cust24.19-2.cable.virginm.net [80.195.49.25]) by one.net.tachibana-labs.org (OpenSMTPD) with ESMTPSA id 90be1634 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO) for <9front@9front.org>; Sun, 21 May 2023 13:51:17 +0000 (UTC) Message-ID: <72BE6183527E30F06A9F0045886A1C3B@tachibana-labs.org> From: mia soweli Date: Sat, 20 May 2023 21:56:51 +0000 To: 9front@9front.org MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: browser STM component-based controller Subject: [9front] [PATCH] aux/acpi: attempt to call _PTS and _TTS before shutdown Reply-To: 9front@9front.org Precedence: bulk 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){