8 #include <linux/string.h>
9 #include <linux/types.h>
10 #include <linux/kernel.h>
11 #include <linux/sched.h>
12 #include <linux/ctype.h>
13 #include <linux/module.h>
15 #include <asm/openprom.h>
16 #include <asm/oplib.h>
20 static char promlib_buf[128];
31 spin_unlock_irqrestore(&prom_lock, flags);
47 if (cnode == 0 || (
s32)cnode == -1)
63 spin_unlock_irqrestore(&prom_lock, flags);
79 if (sibnode == 0 || (
s32)sibnode == -1)
94 if((!node) || (!prop))
100 spin_unlock_irqrestore(&
prom_lock, flags);
115 if((plen > bufsize) || (plen == 0) || (plen == -1))
121 spin_unlock_irqrestore(&
prom_lock, flags);
148 if(retval == -1)
return deflt;
160 if(retval == -1)
return 0;
174 if(len != -1)
return;
189 for(thisnode = node_start; thisnode;
192 sizeof(promlib_buf));
194 if(error == -1)
continue;
195 if(
strcmp(nodename, promlib_buf)==0)
return thisnode;
203 static char *__prom_nextprop(
phandle node,
char * oprop)
211 spin_unlock_irqrestore(&prom_lock, flags);
222 if (node == 0 || (
s32)node == -1)
225 return __prom_nextprop(node, oprop);
238 if (!*s)
return node;
241 for (d = nbuf; *s != 0 && *s !=
'@' && *s !=
'/';)
250 if (
isxdigit(s[1]) && s[2] ==
',') {
253 if (d != s + 3 && (!*d || *d ==
'/')
256 while (node2 && (
s32)node2 != -1) {
258 if (which_io == reg[0].which_io && phys_addr == reg[0].phys_addr) {
264 if (!node2 || (
s32)node2 == -1)
270 while (*s != 0 && *s !=
'/') s++;
287 if ((pname ==
NULL) || (value ==
NULL))
290 ret =
prom_nodeops->no_setprop(node, pname, value, size);
292 spin_unlock_irqrestore(&
prom_lock, flags);
303 node = (*
romvec->pv_v2devops.v2_inst2pkg)(inst);
305 spin_unlock_irqrestore(&
prom_lock, flags);