[PATCH 1/4] prom writing primatives

Dustin Kirkland dustin.kirkland at us.ibm.com
Fri Mar 2 01:37:17 EST 2007


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>



diff --git a/include/prom.h b/include/prom.h
index 9700803..b3a3979 100644
--- a/include/prom.h
+++ b/include/prom.h
@@ -91,6 +91,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_get_devtype (char *device);
 
 /* misc */
@@ -106,6 +107,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 5ec06b8..657877e 100644
--- a/second/prom.c
+++ b/second/prom.c
@@ -154,6 +154,12 @@ prom_getprop (prom_handle pack, char *name, void *mem, int len)
 }
 
 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);
@@ -168,6 +174,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