Module Name:    src
Committed By:   bouyer
Date:           Thu Dec  5 16:53:06 UTC 2019

Modified Files:
        src/sys/arch/powerpc/oea [netbsd-8]: ofw_autoconf.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #1465):
        sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.24
Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.22.1 src/sys/arch/powerpc/oea/ofw_autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/oea/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20.22.1
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.20	Tue Feb 18 12:27:15 2014
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Thu Dec  5 16:53:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.20.22.1 2019/12/05 16:53:06 bouyer Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20 2014/02/18 12:27:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.20.22.1 2019/12/05 16:53:06 bouyer Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -137,10 +137,17 @@ canonicalize_bootpath(void)
 	 *   /pci/mac-io/ata-3@2000/disk@0:0/netbsd.new		(OF-3.x)
 	 */
 	strcpy(cbootpath, bootpath);
-	while ((node = OF_finddevice(cbootpath)) == -1) {
-		if ((p = strrchr(cbootpath, '/')) == NULL)
-			break;
-		*p = '\0';
+
+	if ((node = OF_finddevice("/options")) == -1 ||
+	    OF_getprop(node, "qemu_boot_hack", type, sizeof(type) - 1) == -1 ||
+	    type[0] != 'y') {
+		while ((node = OF_finddevice(cbootpath)) == -1) {
+			if ((p = strrchr(cbootpath, '/')) == NULL)
+				break;
+			*p = '\0';
+		}
+	} else {
+		node = -1;
 	}
 
 	printf("bootpath: %s\n", bootpath);

Reply via email to