diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-03-08 16:30:37 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2008-03-08 16:30:37 +0000 |
commit | f1576fd441a0b29d4fee63e459cfe2df1053e1a4 (patch) | |
tree | 2e75bf2e24c5ceb4ca728e063f97fd77ff4d1279 /sys/arch | |
parent | 1a3d17fd9d9f9e05be00e774dfadfb1be25cb20f (diff) |
Introduce a function to check the "status" property of an OFW node, and use it
to avoid attaching disabled or failed devices.
This should make it possible to manually deconfigure devices on mid-range and
high-end servers like the V880 using the "asr-disable" PROM command, and make
OpenBSD avoid using hardware that has been detected as faulty by the POST or
OpenBoot Diagnostics.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/sparc64/include/autoconf.h | 3 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/autoconf.c | 26 |
2 files changed, 26 insertions, 3 deletions
diff --git a/sys/arch/sparc64/include/autoconf.h b/sys/arch/sparc64/include/autoconf.h index a716ccd1541..e2b6ebf5239 100644 --- a/sys/arch/sparc64/include/autoconf.h +++ b/sys/arch/sparc64/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.16 2008/03/01 15:56:09 kettenis Exp $ */ +/* $OpenBSD: autoconf.h,v 1.17 2008/03/08 16:30:36 kettenis Exp $ */ /* $NetBSD: autoconf.h,v 1.10 2001/07/24 19:32:11 eeh Exp $ */ /*- @@ -165,5 +165,6 @@ void *findzs(int); int romgetcursoraddr(int **, int **); int findroot(void); int findnode(int, const char *); +int checkstatus(int); int node_has_property(int, const char *); void device_register(struct device *, void *); diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c index 6189475d056..024b22179cd 100644 --- a/sys/arch/sparc64/sparc64/autoconf.c +++ b/sys/arch/sparc64/sparc64/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.77 2008/03/01 15:56:09 kettenis Exp $ */ +/* $OpenBSD: autoconf.c,v 1.78 2008/03/08 16:30:36 kettenis Exp $ */ /* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */ /* @@ -767,6 +767,9 @@ extern bus_space_tag_t mainbus_space_tag; if (sp != NULL) continue; /* an "early" device already configured */ + if (!checkstatus(node)) + continue; + bzero(&ma, sizeof ma); ma.ma_bustag = mainbus_space_tag; ma.ma_dmatag = &mainbus_dma_tag; @@ -979,7 +982,26 @@ nextsibling(node) return OF_peer(node); } -/* The following are used primarily in consinit() */ +int +checkstatus(int node) +{ + char buf[32]; + + /* If there is no "status" property, assume everything is fine. */ + if (OF_getprop(node, "status", buf, sizeof(buf)) <= 0) + return 1; + + /* + * If OpenBoot Diagnostics discovers a problem with a device + * it will mark it with "fail" or "fail-xxx", where "xxx" is + * additional human-readable information about the particular + * fault-condition. + */ + if (strcmp(buf, "disabled") == 0 || strncmp(buf, "fail", 4) == 0) + return 0; + + return 1; +} int node_has_property(node, prop) /* returns 1 if node has given property */ |