shithub: riscv

Download patch

ref: a67975c01dae9d67bc6349dab4e7a6e2956cf1da
parent: e8e8ee3cf1172bb2d6ae062447256e38f38c17c5
author: mia soweli <inbox@tachibana-labs.org>
date: Fri May 26 12:05:49 EDT 2023

aux/acpi: ignore bad acpi 2.0 shutdown access widths.

some machines have bad acpi tables with a zero access width.
fall back to acpi 1.0 shutdown in this case.

--- a/sys/src/cmd/aux/acpi.c
+++ b/sys/src/cmd/aux/acpi.c
@@ -516,19 +516,19 @@
 			}
 
 			/* fall back to the ACPI 1.0 io port method */
-			if(!facp.pm1a) {
+			if(facp.pm1a == 0 || facp.pm1awid == 0) {
 				facp.pm1aspace = IoSpace;
 				facp.pm1awid = 2;
 				facp.pm1a = get32(((uchar*)t) + 64);
 			}
 
-			if(!facp.pm1b) {
+			if(facp.pm1b == 0 || facp.pm1bwid == 0) {
 				facp.pm1bspace = IoSpace;
 				facp.pm1bwid = 2;
 				facp.pm1b = get32(((uchar*)t) + 68);
 			}
 
-			if(!facp.gpe0) {
+			if(facp.gpe0 == 0 || facp.gpe0wid == 0) {
 				facp.gpe0space = IoSpace;
 				facp.gpe0wid = 2;
 				facp.gpe0 = get32(((uchar*)t) + 80);
@@ -535,7 +535,7 @@
 				facp.gpe0len = *(((uchar*)t) + 92);
 			}
 
-			if(!facp.gpe1) {
+			if(facp.gpe1 == 0 || facp.gpe1wid == 0) {
 				facp.gpe1space = IoSpace;
 				facp.gpe1wid = 2;
 				facp.gpe1 = get32(((uchar*)t) + 84);