summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-01-22 19:01:20 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-01-22 19:01:20 +0000
commit4a4babd2f42be332fc8f494e653e8c50156ab36b (patch)
tree02afb69c32dd9c99aabdc108d1c325a0c20a6128 /sys
parente07920d33473fd0e54b5d4c03a1d16f558838b50 (diff)
Correctly handle the case where the "address" property of a zs node is
multivalued, as on the Voyager. This makes the zs probe work correctly on these machines, and do not change behaviour on others. Adapted from a similar fix in NetBSD. Tested on Voyager by Takeshi Morimoto.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc/sparc/autoconf.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c
index 47faf351f00..ecbc297655c 100644
--- a/sys/arch/sparc/sparc/autoconf.c
+++ b/sys/arch/sparc/sparc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.54 2002/09/03 23:20:42 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.55 2003/01/22 19:01:19 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */
/*
@@ -1342,7 +1342,7 @@ findzs(zs)
#if defined(SUN4C) || defined(SUN4M)
if (CPU_ISSUN4COR4M) {
- register int node;
+ int node;
node = firstchild(findroot());
if (CPU_ISSUN4M) { /* zs is in "obio" tree on Sun4M */
@@ -1352,9 +1352,20 @@ findzs(zs)
node = firstchild(node);
}
while ((node = findnode(node, "zs")) != 0) {
- if (getpropint(node, "slave", -1) == zs)
- return ((void *)getpropint(node, "address", 0));
- node = nextsibling(node);
+ int vaddrs[10];
+
+ if (getpropint(node, "slave", -1) != zs) {
+ node = nextsibling(node);
+ continue;
+ }
+
+ /*
+ * On some machines (e.g. the Voyager), the zs
+ * device has multi-valued register properties.
+ */
+ if (getprop(node, "address",
+ (void *)vaddrs, sizeof(vaddrs)) != 0)
+ return ((void *)vaddrs[0]);
}
return (NULL);
}