Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/powerpc stuff name parameters into OF_buf b...



details:   https://anonhg.NetBSD.org/src/rev/88b70fcae5e8
branches:  trunk
changeset: 1004814:88b70fcae5e8
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Nov 15 23:41:47 2019 +0000

description:
stuff name parameters into OF_buf before calling OF
now things like ofctl work on my TiBook with FIRMWORKSBUGS

diffstat:

 sys/arch/powerpc/powerpc/openfirm.c |  24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diffs (77 lines):

diff -r bee1cfaa7ec1 -r 88b70fcae5e8 sys/arch/powerpc/powerpc/openfirm.c
--- a/sys/arch/powerpc/powerpc/openfirm.c       Fri Nov 15 15:51:57 2019 +0000
+++ b/sys/arch/powerpc/powerpc/openfirm.c       Fri Nov 15 23:41:47 2019 +0000
@@ -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 @@
        };
 
        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 @@
        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 @@
        };
 
        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 @@
        };
 
        ofw_stack();
-       args.device = name;
+       strncpy(OF_buf, name, 32);
+       args.device = OF_buf;
        if (openfirmware(&args) == -1)
                return -1;
        return args.phandle;



Home | Main Index | Thread Index | Old Index