Module Name: src
Committed By: macallan
Date: Fri Nov 15 23:41:47 UTC 2019
Modified Files:
src/sys/arch/powerpc/powerpc: openfirm.c
Log Message:
stuff name parameters into OF_buf before calling OF
now things like ofctl work on my TiBook with FIRMWORKSBUGS
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/powerpc/openfirm.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/powerpc/openfirm.c
diff -u src/sys/arch/powerpc/powerpc/openfirm.c:1.27 src/sys/arch/powerpc/powerpc/openfirm.c:1.28
--- src/sys/arch/powerpc/powerpc/openfirm.c:1.27 Tue Jan 8 07:46:11 2019
+++ src/sys/arch/powerpc/powerpc/openfirm.c Fri Nov 15 23:41:47 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: openfirm.c,v 1.27 2019/01/08 07:46:11 mrg Exp $ */
+/* $NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.27 2019/01/08 07:46:11 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.28 2019/11/15 23:41:47 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -159,8 +159,9 @@ OF_getproplen(int handle, const char *pr
};
ofw_stack();
+ strncpy(OF_buf, prop, 32);
args.phandle = handle;
- args.prop = prop;
+ args.prop = OF_buf;
if (openfirmware(&args) == -1)
return -1;
return args.proplen;
@@ -187,16 +188,17 @@ OF_getprop(int handle, const char *prop,
ofw_stack();
if (buflen > PAGE_SIZE)
return -1;
+ strncpy(OF_buf, prop, 32);
args.phandle = handle;
- args.prop = prop;
- args.buf = OF_buf;
+ args.prop = OF_buf;
+ args.buf = &OF_buf[33];
args.buflen = buflen;
if (openfirmware(&args) == -1)
return -1;
if (args.size > buflen)
args.size = buflen;
if (args.size > 0)
- ofbcopy(OF_buf, buf, args.size);
+ ofbcopy(&OF_buf[33], buf, args.size);
return args.size;
}
@@ -250,12 +252,13 @@ OF_nextprop(int handle, const char *prop
};
ofw_stack();
+ strncpy(OF_buf, prop, 32);
args.phandle = handle;
- args.prop = prop;
- args.buf = OF_buf;
+ args.prop = OF_buf;
+ args.buf = &OF_buf[33];
if (openfirmware(&args) == -1)
return -1;
- strncpy(nextprop, OF_buf, 32);
+ strncpy(nextprop, &OF_buf[33], 32);
return args.flag;
}
@@ -275,7 +278,8 @@ OF_finddevice(const char *name)
};
ofw_stack();
- args.device = name;
+ strncpy(OF_buf, name, 32);
+ args.device = OF_buf;
if (openfirmware(&args) == -1)
return -1;
return args.phandle;