Module Name: src
Committed By: martin
Date: Mon Aug 11 11:51:45 UTC 2014
Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c
Log Message:
Match firmware paths for the boot device in Mac style, as used by
QEMU/OpenBIOS.
To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.198 src/sys/arch/sparc64/sparc64/autoconf.c:1.199
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.198 Fri Jul 25 17:21:32 2014
+++ src/sys/arch/sparc64/sparc64/autoconf.c Mon Aug 11 11:51:45 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.198 2014/07/25 17:21:32 nakayama Exp $ */
+/* $NetBSD: autoconf.c,v 1.199 2014/08/11 11:51:45 martin Exp $ */
/*
* Copyright (c) 1996
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.198 2014/07/25 17:21:32 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.199 2014/08/11 11:51:45 martin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -775,7 +775,7 @@ static void
dev_path_drive_match(device_t dev, int ctrlnode, int target,
uint64_t wwn, int lun)
{
- int child = 0;
+ int child = 0, ide_node = 0;
char buf[OFPATHLEN];
DPRINTF(ACDB_BOOTDEV, ("dev_path_drive_match: %s, controller %x, "
@@ -791,6 +791,27 @@ dev_path_drive_match(device_t dev, int c
if (child == ofbootpackage)
break;
+ if (child != ofbootpackage) {
+ /*
+ * Try Mac firmware style (also used by QEMU/OpenBIOS):
+ * below the controller there is an intermediate node
+ * for each IDE channel, and individual targets always
+ * are "@0"
+ */
+ for (ide_node = prom_firstchild(ctrlnode); ide_node != 0;
+ ide_node = prom_nextsibling(ide_node)) {
+ const char * name = prom_getpropstring(ide_node,
+ "device_type");
+ if (strcmp(name, "ide") != 0) continue;
+ for (child = prom_firstchild(ide_node); child != 0;
+ child = prom_nextsibling(child))
+ if (child == ofbootpackage)
+ break;
+ if (child == ofbootpackage)
+ break;
+ }
+ }
+
if (child == ofbootpackage) {
const char * name = prom_getpropstring(child, "name");
@@ -805,6 +826,8 @@ dev_path_drive_match(device_t dev, int c
if (wwn)
snprintf(buf, sizeof(buf), "%s@w%016" PRIx64 ",%d",
name, wwn, lun);
+ else if (ide_node)
+ snprintf(buf, sizeof(buf), "%s@0", name);
else
snprintf(buf, sizeof(buf), "%s@%d,%d",
name, target, lun);