Browse Source

ACPI: have boot start up with irq interrupts if acpiirq is set

If you add acpiirq=anyvalue, where anyvalue is any value, e.g. 1,
to the command line, then boot will run the acpiirq function.

I had to make this optional as it currently panics (!!) my thinkpad.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 7 years ago
parent
commit
860ddd0d07
1 changed files with 10 additions and 8 deletions
  1. 10 8
      sys/src/9/boot/boot.c

+ 10 - 8
sys/src/9/boot/boot.c

@@ -32,7 +32,7 @@ static void acpiirq(void)
 {
 	static char *devs[] = {"#Z", "#$", "#P"};
 	int i, pid, irqmap;
-	static char msg[128];
+	Waitmsg *w;
 
 	for (i = 0; i < nelem(devs); i++){
 		if(bind(devs[i], "/dev", MAFTER) < 0){
@@ -54,8 +54,9 @@ static void acpiirq(void)
 	}
 	if (pid > 0) {
 		close(irqmap);
-		if (await(msg, sizeof(msg)))
-			warning(msg);
+		w = wait();
+		if (w && w->msg && w->msg[0])
+			warning(w->msg);
 		return;
 	}
 	dup(irqmap, 0);
@@ -81,11 +82,6 @@ boot(int argc, char *argv[])
 
 	fmtinstall('r', errfmt);
 
-	/* Do the initial ACPI interrupt setup work.
-	 * If we don't do this we may not get needed
-	 * interfaces. */
-	acpiirq();
-
 	/*
 	 *  start /dev/cons
 	 */
@@ -121,6 +117,12 @@ boot(int argc, char *argv[])
 	readfile("#e/cputype", cputype, sizeof(cputype));
 	readfile("#e/service", service, sizeof(service));
 
+	/* Do the initial ACPI interrupt setup work.
+	 * If we don't do this we may not get needed
+	 * interfaces. */
+	if (getenv("acpiirq"))
+		acpiirq();
+
 	/*
 	 *  set up usb keyboard, mouse and disk, if any.
 	 */