This source file includes following definitions.
- node_get_sibling
- node_get_child
- get_int_from_prom
- get_str_from_prom
- init_prom
1
2
3
4
5
6
7 #include <linux/kernel.h>
8
9 #include <asm/openprom.h>
10
11
12 #define MAX_PR_LEN 64
13
14 int prom_node_root;
15
16 extern struct linux_romvec *romvec;
17
18
19
20
21
22 int
23 node_get_sibling(int node)
24 {
25 return (*(romvec->pv_nodeops->no_nextnode))(node);
26 }
27
28 int
29 node_get_child(int node)
30 {
31 return (*(romvec->pv_nodeops->no_child))(node);
32 }
33
34
35
36
37
38
39
40 unsigned int prom_int_null;
41
42 unsigned int *
43 get_int_from_prom(int node, char *nd_prop, unsigned int *value)
44 {
45 unsigned int pr_len;
46
47 *value = &prom_int_null;
48
49 pr_len = romvec->pv_nodeops->no_proplen(node, nd_prop);
50 if(pr_len > MAX_PR_LEN)
51 {
52 #ifdef DEBUG_PROMOPS
53 printk("Bad pr_len in promops -- node: %d nd_prop: %s pr_len: %d",
54 node, nd_prop, (int) pr_len);
55 #endif
56 return value;
57 }
58
59 romvec->pv_nodeops->no_getprop(node, nd_prop, (char *) value);
60
61 return value;
62 }
63
64
65
66
67
68
69
70
71
72 char *
73 get_str_from_prom(int node, char *nd_prop, char *value)
74 {
75 unsigned int pr_len;
76
77 *value='\n';
78
79 pr_len = romvec->pv_nodeops->no_proplen(node, nd_prop);
80 if(pr_len > MAX_PR_LEN)
81 {
82 #ifdef DEBUG_PROMOPS
83 printk("Bad pr_len in promops -- node: %d nd_prop: %s pr_len: %d",
84 node, nd_prop, pr_len);
85 #endif
86 return value;
87 }
88
89 romvec->pv_nodeops->no_getprop(node, nd_prop, value);
90 value[pr_len] = 0;
91
92 return value;
93 }
94
95
96
97
98
99 void
100 init_prom(struct linux_romvec *r_ptr)
101 {
102 romvec = r_ptr;
103 prom_node_root = romvec->pv_nodeops->no_nextnode(0);
104 prom_int_null = 0;
105
106 return;
107 }