[PATCH 1/4] prom writing primatives
Dustin Kirkland
dustin.kirkland at us.ibm.com
Thu Apr 19 11:07:30 EST 2007
On Thu, 2007-03-01 at 08:37 -0600, Dustin Kirkland wrote:
> prom setprop primatives
>
> This patch creates the prom_set_options() and prom_setprop()
> functions.
> These are precise mirrors of their read-only brothers,
> prom_get_options() and prom_getprop(), implemented as defined in the
> Open Firmware 1275 spec.
>
> The prom_set_options() function will be used to zero out the boot-once
> label unconditionally after reading it.
>
>
> --
> Signed-off-by: Dustin Kirkland <dustin.kirkland at us.ibm.com>
Patch updated against current git. No functional changes.
diff --git a/include/prom.h b/include/prom.h
index a0f277c..e7ee4a9 100644
--- a/include/prom.h
+++ b/include/prom.h
@@ -93,6 +93,7 @@ void prom_map (void *phys, void *virt, int size);
prom_handle prom_finddevice (char *name);
prom_handle prom_findpackage (char *path);
int prom_getprop (prom_handle dev, char *name, void *buf, int len);
+int prom_setprop (prom_handle dev, char *name, void *buf, int len);
int prom_getproplen(prom_handle, const char *);
int prom_get_devtype (char *device);
@@ -109,6 +110,7 @@ int prom_interpret (char *forth);
int prom_get_chosen (char *name, void *mem, int len);
int prom_get_options (char *name, void *mem, int len);
+int prom_set_options (char *name, void *mem, int len);
extern int prom_getms(void);
extern void prom_pause(void);
diff --git a/second/prom.c b/second/prom.c
index d23b8a6..3407e5a 100644
--- a/second/prom.c
+++ b/second/prom.c
@@ -160,6 +160,12 @@ prom_getproplen(prom_handle pack, const char *name)
}
int
+prom_setprop (prom_handle pack, char *name, void *mem, int len)
+{
+ return (int)call_prom ("setprop", 4, 1, pack, name, mem, len);
+}
+
+int
prom_get_chosen (char *name, void *mem, int len)
{
return prom_getprop (prom_chosen, name, mem, len);
@@ -174,6 +180,14 @@ prom_get_options (char *name, void *mem, int len)
}
int
+prom_set_options (char *name, void *mem, int len)
+{
+ if (prom_options == (void *)-1)
+ return -1;
+ return prom_setprop (prom_options, name, mem, len);
+}
+
+int
prom_get_devtype (char *device)
{
phandle dev;
More information about the Yaboot-devel
mailing list