diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-10-14 17:27:00 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2007-10-14 17:27:00 +0000 |
commit | a352065ac76f1e1267b49e14deb7a4ce053ad237 (patch) | |
tree | a492ddfc1a22097faba04a70707ea4c99ec1205f | |
parent | 8c70f7e623aec7cd09c9478d4dac69b9e42c1a48 (diff) |
Implement OF_getproplen().
ok deraadt@
-rw-r--r-- | sys/arch/macppc/macppc/openfirm.c | 26 | ||||
-rw-r--r-- | sys/dev/ofw/openfirm.h | 3 |
2 files changed, 27 insertions, 2 deletions
diff --git a/sys/arch/macppc/macppc/openfirm.c b/sys/arch/macppc/macppc/openfirm.c index 770a08eab74..3d1837ffaf9 100644 --- a/sys/arch/macppc/macppc/openfirm.c +++ b/sys/arch/macppc/macppc/openfirm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openfirm.c,v 1.8 2004/02/16 04:57:50 drahn Exp $ */ +/* $OpenBSD: openfirm.c,v 1.9 2007/10/14 17:26:59 kettenis Exp $ */ /* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -108,6 +108,30 @@ OF_parent(int phandle) } int +OF_getproplen(int handle, char *prop) +{ + static struct { + char *name; + int nargs; + int nreturns; + int phandle; + char *prop; + int size; + } args = { + "getproplen", + 2, + 1, + }; + + ofw_stack(); + args.phandle = handle; + args.prop = prop; + if (openfirmware(&args) == -1) + return -1; + return args.size; +} + +int OF_getprop(int handle, char *prop, void *buf, int buflen) { static struct { diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h index c045963ed1a..5affb5fcfa4 100644 --- a/sys/dev/ofw/openfirm.h +++ b/sys/dev/ofw/openfirm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: openfirm.h,v 1.9 2004/01/11 16:20:01 drahn Exp $ */ +/* $OpenBSD: openfirm.h,v 1.10 2007/10/14 17:26:59 kettenis Exp $ */ /* $NetBSD: openfirm.h,v 1.1 1996/09/30 16:35:10 ws Exp $ */ /* @@ -46,6 +46,7 @@ int OF_peer(int phandle); int OF_child(int phandle); int OF_parent(int phandle); int OF_instance_to_package(int ihandle); +int OF_getproplen(int handle, char *prop); int OF_getprop(int handle, char *prop, void *buf, int buflen); int OF_setprop(int, char *, const void *, int); int OF_nextprop(int, char *, void *); |