summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dickman <daniel@cvs.openbsd.org>2014-10-17 03:04:31 +0000
committerDaniel Dickman <daniel@cvs.openbsd.org>2014-10-17 03:04:31 +0000
commit77c9e4a7ffda1996768b6eb5b5a2a71dbe206ef2 (patch)
tree42d53f62c2d8fa80ed61908fd2e6d2762efd2503
parentcc7d3bdde1846de549aedbb4286961a08087f319 (diff)
Mark Cave-Ayland pointed out on tech@ that the OF_test_method was called
with an ihandle instead of a phandle. And also the comparison was the wrong way around. This bug was causing an exception. Because -1 is returned to indicate failure and because the comparison is the wrong way around, the bad logic led to believing that SUNW,retain exists which is why this currently works on some PROMs. On E250/E450 machines, this didn't work so there was a hack to detect these machines and work-around the problem. After this fix that hack is now removed. Tested on an E450 by sebastia@ and confirmed that his dmesg is now retained after a reboot. nick@ promises to complain if his E250 is any worse off. ok kettenis@
-rw-r--r--sys/arch/sparc64/sparc64/ofw_machdep.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/sys/arch/sparc64/sparc64/ofw_machdep.c b/sys/arch/sparc64/sparc64/ofw_machdep.c
index eb99f23d809..9f5c35b835a 100644
--- a/sys/arch/sparc64/sparc64/ofw_machdep.c
+++ b/sys/arch/sparc64/sparc64/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.31 2009/02/19 11:12:42 kettenis Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.32 2014/10/17 03:04:30 daniel Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */
/*
@@ -519,27 +519,13 @@ prom_get_msgbuf(len, align)
cell_t phys_lo;
} args;
paddr_t addr;
- int rooth;
- int is_e250 = 1;
-
- /* E250s tend to have buggy PROMs that break on test-method */
- if ((rooth = OF_finddevice("/")) != -1) {
- char name[80];
-
- if ((OF_getprop(rooth, "name", &name, sizeof(name))) != -1) {
- if (strcmp(name, "SUNW,Ultra-250") && strcmp(name, "SUNW,Ultra-4"))
- is_e250 = 0;
- } else prom_printf("prom_get_msgbuf: cannot get \"name\"\r\n");
- } else prom_printf("prom_get_msgbuf: cannot open root device \r\n");
if (memh == -1 && ((memh = get_memory_handle()) == -1)) {
prom_printf("prom_get_msgbuf: cannot get memh\r\n");
return -1;
}
- if (is_e250) {
- prom_printf("prom_get_msgbuf: Cannot recover msgbuf on E250/450\r\n");
- } else if (OF_test("test-method") == 0) {
- if (OF_test_method(memh, "SUNW,retain") != 0) {
+ if (OF_test("test-method") == 0) {
+ if (OF_test_method(OF_instance_to_package(memh), "SUNW,retain") == 0) {
args.name = ADR2CELL("call-method");
args.nargs = 5;
args.nreturns = 3;