diff --git a/sys/arch/arm/ofw/openfirm.c b/sys/arch/arm/ofw/openfirm.c index 4b29ff8202e4..a65411064e0a 100644 --- a/sys/arch/arm/ofw/openfirm.c +++ b/sys/arch/arm/ofw/openfirm.c @@ -1,4 +1,4 @@ -/* $NetBSD: openfirm.c,v 1.5 2005/12/11 12:16:51 christos Exp $ */ +/* $NetBSD: openfirm.c,v 1.6 2007/02/28 20:31:40 macallan Exp $ */ /* * Copyright 1997 @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.5 2005/12/11 12:16:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.6 2007/02/28 20:31:40 macallan Exp $"); #include @@ -237,6 +237,39 @@ OF_getprop(handle, prop, buf, buflen) return args.size; } +int +OF_setprop(handle, prop, buf, buflen) + int handle; + const char *prop; + const void *buf; + int buflen; +{ + static struct { + const char *name; + int nargs; + int nreturns; + int phandle; + const char *prop; + const void *buf; + int buflen; + int size; + } args = { + "setprop", + 4, + 1, + }; + + args.phandle = handle; + args.prop = prop; + args.buf = buf; + args.buflen = buflen; + + + if (openfirmware(&args) == -1) + return -1; + return args.size; +} + int OF_getproplen(handle, prop) int handle; diff --git a/sys/arch/powerpc/powerpc/openfirm.c b/sys/arch/powerpc/powerpc/openfirm.c index e4ca4b1a42f8..9038ac2224b5 100644 --- a/sys/arch/powerpc/powerpc/openfirm.c +++ b/sys/arch/powerpc/powerpc/openfirm.c @@ -1,4 +1,4 @@ -/* $NetBSD: openfirm.c,v 1.17 2006/01/22 22:53:56 ross Exp $ */ +/* $NetBSD: openfirm.c,v 1.18 2007/02/28 20:30:57 macallan Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.17 2006/01/22 22:53:56 ross Exp $"); +__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.18 2007/02/28 20:30:57 macallan Exp $"); #include #include @@ -195,6 +195,38 @@ OF_getprop(int handle, const char *prop, void *buf, int buflen) return args.size; } +int +OF_setprop(int handle, const char *prop, const void *buf, int buflen) +{ + struct { + const char *name; + int nargs; + int nreturns; + int phandle; + const char *prop; + const void *buf; + int buflen; + int size; + } args = { + "setprop", + 4, + 1 + }; + ofw_stack(); + + if (buflen > NBPG) + return -1; + + ofbcopy(buf, OF_buf, buflen); + args.phandle = handle; + args.prop = prop; + args.buf = OF_buf; + args.buflen = buflen; + if (openfirmware(&args) == -1) + return -1; + return args.size; +} + int OF_nextprop(int handle, const char *prop, void *nextprop) {