9 #include <linux/string.h>
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
13 #include <linux/module.h>
15 #include <asm/openprom.h>
16 #include <asm/oplib.h>
21 unsigned long args[5];
23 args[0] = (
unsigned long) type;
26 args[3] = (
unsigned int) node;
27 args[4] = (
unsigned long) -1;
39 return prom_node_to_node(
"child", node);
61 cnode = prom_node_to_node(
"parent", node);
82 if ((
s32)sibnode == -1)
94 unsigned long args[6];
99 args[0] = (
unsigned long)
"getproplen";
102 args[3] = (
unsigned int) node;
103 args[4] = (
unsigned long) prop;
104 args[5] = (
unsigned long) -1;
108 return (
int) args[5];
119 unsigned long args[8];
123 if ((plen > bufsize) || (plen == 0) || (plen == -1))
129 args[3] = (
unsigned int) node;
130 args[4] = (
unsigned long) prop;
131 args[5] = (
unsigned long) buffer;
133 args[7] = (
unsigned long) -1;
137 return (
int) args[7];
206 if (
strcmp(namebuf, name) == 0)
218 char promlib_buf[128];
220 for(thisnode = node_start; thisnode;
223 sizeof(promlib_buf));
225 if(error == -1)
continue;
226 if(
strcmp(nodename, promlib_buf)==0)
return thisnode;
233 static const char *prom_nextprop_name =
"nextprop";
240 unsigned long args[7];
246 args[0] = (
unsigned long) prom_nextprop_name;
249 args[3] = (
unsigned int) node;
251 args[5] = (
unsigned long) buffer;
252 args[6] = (
unsigned long) -1;
266 unsigned long args[7];
269 if ((
s32)node == -1) {
273 if (oprop == buffer) {
278 args[0] = (
unsigned long) prom_nextprop_name;
281 args[3] = (
unsigned int) node;
282 args[4] = (
unsigned long) oprop;
283 args[5] = (
unsigned long) buffer;
284 args[6] = (
unsigned long) -1;
294 unsigned long args[5];
298 args[0] = (
unsigned long)
"finddevice";
301 args[3] = (
unsigned long) name;
302 args[4] = (
unsigned long) -1;
306 return (
int) args[4];
330 unsigned long args[8];
334 if ((pname == 0) || (value == 0))
337 #ifdef CONFIG_SUN_LDOMS
343 args[0] = (
unsigned long)
"setprop";
346 args[3] = (
unsigned int) node;
347 args[4] = (
unsigned long) pname;
348 args[5] = (
unsigned long) value;
350 args[7] = (
unsigned long) -1;
354 return (
int) args[7];
360 unsigned long args[5];
363 args[0] = (
unsigned long)
"instance-to-package";
366 args[3] = (
unsigned int) inst;
367 args[4] = (
unsigned long) -1;
371 node = (
int) args[4];
379 unsigned long args[7];
381 args[0] = (
unsigned long)
"instance-to-path";
384 args[3] = (
unsigned int) handle;
385 args[4] = (
unsigned long) buffer;
387 args[6] = (
unsigned long) -1;
391 return (
int) args[6];