diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/prom.h | 43 | ||||
-rw-r--r-- | include/asm-sparc/prom.h | 46 | ||||
-rw-r--r-- | include/asm-sparc64/prom.h | 46 | ||||
-rw-r--r-- | include/linux/of.h | 61 |
4 files changed, 79 insertions, 117 deletions
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index 1632baa17dc6..1134aeab2327 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
@@ -97,10 +97,6 @@ struct device_node { | |||
97 | 97 | ||
98 | extern struct device_node *of_chosen; | 98 | extern struct device_node *of_chosen; |
99 | 99 | ||
100 | /* flag descriptions */ | ||
101 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
102 | #define OF_DETACHED 2 /* node has been detached from the device tree */ | ||
103 | |||
104 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) | 100 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) |
105 | { | 101 | { |
106 | return test_bit(flag, &n->_flags); | 102 | return test_bit(flag, &n->_flags); |
@@ -120,31 +116,7 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e | |||
120 | } | 116 | } |
121 | 117 | ||
122 | 118 | ||
123 | /* New style node lookup */ | ||
124 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
125 | const char *name); | ||
126 | #define for_each_node_by_name(dn, name) \ | ||
127 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
128 | dn = of_find_node_by_name(dn, name)) | ||
129 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
130 | const char *type); | ||
131 | #define for_each_node_by_type(dn, type) \ | ||
132 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
133 | dn = of_find_node_by_type(dn, type)) | ||
134 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
135 | const char *type, const char *compat); | ||
136 | #define for_each_compatible_node(dn, type, compatible) \ | ||
137 | for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ | ||
138 | dn = of_find_compatible_node(dn, type, compatible)) | ||
139 | extern struct device_node *of_find_node_by_path(const char *path); | ||
140 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
141 | extern struct device_node *of_find_all_nodes(struct device_node *prev); | 119 | extern struct device_node *of_find_all_nodes(struct device_node *prev); |
142 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
143 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
144 | struct device_node *prev); | ||
145 | extern struct property *of_find_property(const struct device_node *np, | ||
146 | const char *name, | ||
147 | int *lenp); | ||
148 | extern struct device_node *of_node_get(struct device_node *node); | 120 | extern struct device_node *of_node_get(struct device_node *node); |
149 | extern void of_node_put(struct device_node *node); | 121 | extern void of_node_put(struct device_node *node); |
150 | 122 | ||
@@ -166,17 +138,9 @@ extern void of_detach_node(const struct device_node *); | |||
166 | extern void finish_device_tree(void); | 138 | extern void finish_device_tree(void); |
167 | extern void unflatten_device_tree(void); | 139 | extern void unflatten_device_tree(void); |
168 | extern void early_init_devtree(void *); | 140 | extern void early_init_devtree(void *); |
169 | extern int of_device_is_compatible(const struct device_node *device, | ||
170 | const char *); | ||
171 | #define device_is_compatible(d, c) of_device_is_compatible((d), (c)) | 141 | #define device_is_compatible(d, c) of_device_is_compatible((d), (c)) |
172 | extern int machine_is_compatible(const char *compat); | 142 | extern int machine_is_compatible(const char *compat); |
173 | extern const void *of_get_property(const struct device_node *node, | ||
174 | const char *name, | ||
175 | int *lenp); | ||
176 | #define get_property(a, b, c) of_get_property((a), (b), (c)) | ||
177 | extern void print_properties(struct device_node *node); | 143 | extern void print_properties(struct device_node *node); |
178 | extern int of_n_addr_cells(struct device_node* np); | ||
179 | extern int of_n_size_cells(struct device_node* np); | ||
180 | extern int prom_n_intr_cells(struct device_node* np); | 144 | extern int prom_n_intr_cells(struct device_node* np); |
181 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); | 145 | extern void prom_get_irq_senses(unsigned char *senses, int off, int max); |
182 | extern int prom_add_property(struct device_node* np, struct property* prop); | 146 | extern int prom_add_property(struct device_node* np, struct property* prop); |
@@ -230,7 +194,6 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size) | |||
230 | 194 | ||
231 | /* Translate an OF address block into a CPU physical address | 195 | /* Translate an OF address block into a CPU physical address |
232 | */ | 196 | */ |
233 | #define OF_BAD_ADDR ((u64)-1) | ||
234 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); | 197 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); |
235 | 198 | ||
236 | /* Extract an address from a device, returns the region size and | 199 | /* Extract an address from a device, returns the region size and |
@@ -357,5 +320,11 @@ extern int of_irq_to_resource(struct device_node *dev, int index, | |||
357 | */ | 320 | */ |
358 | extern void __iomem *of_iomap(struct device_node *device, int index); | 321 | extern void __iomem *of_iomap(struct device_node *device, int index); |
359 | 322 | ||
323 | /* | ||
324 | * NB: This is here while we transition from using asm/prom.h | ||
325 | * to linux/of.h | ||
326 | */ | ||
327 | #include <linux/of.h> | ||
328 | |||
360 | #endif /* __KERNEL__ */ | 329 | #endif /* __KERNEL__ */ |
361 | #endif /* _POWERPC_PROM_H */ | 330 | #endif /* _POWERPC_PROM_H */ |
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h index 9ea105ebe2ff..d67af08abb43 100644 --- a/include/asm-sparc/prom.h +++ b/include/asm-sparc/prom.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _SPARC_PROM_H | 2 | #define _SPARC_PROM_H |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | |||
6 | /* | 5 | /* |
7 | * Definitions for talking to the Open Firmware PROM on | 6 | * Definitions for talking to the Open Firmware PROM on |
8 | * Power Macintosh computers. | 7 | * Power Macintosh computers. |
@@ -17,7 +16,6 @@ | |||
17 | * as published by the Free Software Foundation; either version | 16 | * as published by the Free Software Foundation; either version |
18 | * 2 of the License, or (at your option) any later version. | 17 | * 2 of the License, or (at your option) any later version. |
19 | */ | 18 | */ |
20 | |||
21 | #include <linux/types.h> | 19 | #include <linux/types.h> |
22 | #include <linux/proc_fs.h> | 20 | #include <linux/proc_fs.h> |
23 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
@@ -55,53 +53,21 @@ struct device_node { | |||
55 | unsigned int unique_id; | 53 | unsigned int unique_id; |
56 | }; | 54 | }; |
57 | 55 | ||
58 | /* flag descriptions */ | ||
59 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
60 | |||
61 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 56 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
62 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 57 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
63 | 58 | ||
64 | #define OF_BAD_ADDR ((u64)-1) | ||
65 | |||
66 | static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | ||
67 | { | ||
68 | dn->pde = de; | ||
69 | } | ||
70 | |||
71 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
72 | const char *name); | ||
73 | #define for_each_node_by_name(dn, name) \ | ||
74 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
75 | dn = of_find_node_by_name(dn, name)) | ||
76 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
77 | const char *type); | ||
78 | #define for_each_node_by_type(dn, type) \ | ||
79 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
80 | dn = of_find_node_by_type(dn, type)) | ||
81 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
82 | const char *type, const char *compat); | ||
83 | extern struct device_node *of_find_node_by_path(const char *path); | ||
84 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
85 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
86 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
87 | struct device_node *prev); | ||
88 | extern struct property *of_find_property(const struct device_node *np, | ||
89 | const char *name, | ||
90 | int *lenp); | ||
91 | extern int of_device_is_compatible(const struct device_node *device, | ||
92 | const char *); | ||
93 | extern const void *of_get_property(const struct device_node *node, | ||
94 | const char *name, | ||
95 | int *lenp); | ||
96 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | ||
97 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 59 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
98 | extern int of_getintprop_default(struct device_node *np, | 60 | extern int of_getintprop_default(struct device_node *np, |
99 | const char *name, | 61 | const char *name, |
100 | int def); | 62 | int def); |
101 | extern int of_n_addr_cells(struct device_node *np); | ||
102 | extern int of_n_size_cells(struct device_node *np); | ||
103 | 63 | ||
104 | extern void prom_build_devicetree(void); | 64 | extern void prom_build_devicetree(void); |
105 | 65 | ||
66 | /* | ||
67 | * NB: This is here while we transition from using asm/prom.h | ||
68 | * to linux/of.h | ||
69 | */ | ||
70 | #include <linux/of.h> | ||
71 | |||
106 | #endif /* __KERNEL__ */ | 72 | #endif /* __KERNEL__ */ |
107 | #endif /* _SPARC_PROM_H */ | 73 | #endif /* _SPARC_PROM_H */ |
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index b4df3042add0..9905ed057d93 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define _SPARC64_PROM_H | 2 | #define _SPARC64_PROM_H |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | |||
6 | /* | 5 | /* |
7 | * Definitions for talking to the Open Firmware PROM on | 6 | * Definitions for talking to the Open Firmware PROM on |
8 | * Power Macintosh computers. | 7 | * Power Macintosh computers. |
@@ -17,7 +16,6 @@ | |||
17 | * as published by the Free Software Foundation; either version | 16 | * as published by the Free Software Foundation; either version |
18 | * 2 of the License, or (at your option) any later version. | 17 | * 2 of the License, or (at your option) any later version. |
19 | */ | 18 | */ |
20 | |||
21 | #include <linux/types.h> | 19 | #include <linux/types.h> |
22 | #include <linux/proc_fs.h> | 20 | #include <linux/proc_fs.h> |
23 | #include <asm/atomic.h> | 21 | #include <asm/atomic.h> |
@@ -63,54 +61,22 @@ struct of_irq_controller { | |||
63 | void *data; | 61 | void *data; |
64 | }; | 62 | }; |
65 | 63 | ||
66 | /* flag descriptions */ | ||
67 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
68 | |||
69 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) | 64 | #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) |
70 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) | 65 | #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) |
71 | 66 | ||
72 | #define OF_BAD_ADDR ((u64)-1) | ||
73 | |||
74 | static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | ||
75 | { | ||
76 | dn->pde = de; | ||
77 | } | ||
78 | |||
79 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
80 | const char *name); | ||
81 | #define for_each_node_by_name(dn, name) \ | ||
82 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
83 | dn = of_find_node_by_name(dn, name)) | ||
84 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
85 | const char *type); | ||
86 | #define for_each_node_by_type(dn, type) \ | ||
87 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
88 | dn = of_find_node_by_type(dn, type)) | ||
89 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
90 | const char *type, const char *compat); | ||
91 | extern struct device_node *of_find_node_by_path(const char *path); | ||
92 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
93 | extern struct device_node *of_find_node_by_cpuid(int cpuid); | 67 | extern struct device_node *of_find_node_by_cpuid(int cpuid); |
94 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
95 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
96 | struct device_node *prev); | ||
97 | extern struct property *of_find_property(const struct device_node *np, | ||
98 | const char *name, | ||
99 | int *lenp); | ||
100 | extern int of_device_is_compatible(const struct device_node *device, | ||
101 | const char *); | ||
102 | extern const void *of_get_property(const struct device_node *node, | ||
103 | const char *name, | ||
104 | int *lenp); | ||
105 | #define get_property(node,name,lenp) of_get_property(node,name,lenp) | ||
106 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); | 68 | extern int of_set_property(struct device_node *node, const char *name, void *val, int len); |
107 | extern int of_getintprop_default(struct device_node *np, | 69 | extern int of_getintprop_default(struct device_node *np, |
108 | const char *name, | 70 | const char *name, |
109 | int def); | 71 | int def); |
110 | extern int of_n_addr_cells(struct device_node *np); | ||
111 | extern int of_n_size_cells(struct device_node *np); | ||
112 | 72 | ||
113 | extern void prom_build_devicetree(void); | 73 | extern void prom_build_devicetree(void); |
114 | 74 | ||
75 | /* | ||
76 | * NB: This is here while we transition from using asm/prom.h | ||
77 | * to linux/of.h | ||
78 | */ | ||
79 | #include <linux/of.h> | ||
80 | |||
115 | #endif /* __KERNEL__ */ | 81 | #endif /* __KERNEL__ */ |
116 | #endif /* _SPARC64_PROM_H */ | 82 | #endif /* _SPARC64_PROM_H */ |
diff --git a/include/linux/of.h b/include/linux/of.h new file mode 100644 index 000000000000..47734ffd9745 --- /dev/null +++ b/include/linux/of.h | |||
@@ -0,0 +1,61 @@ | |||
1 | #ifndef _LINUX_OF_H | ||
2 | #define _LINUX_OF_H | ||
3 | /* | ||
4 | * Definitions for talking to the Open Firmware PROM on | ||
5 | * Power Macintosh and other computers. | ||
6 | * | ||
7 | * Copyright (C) 1996-2005 Paul Mackerras. | ||
8 | * | ||
9 | * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. | ||
10 | * Updates for SPARC64 by David S. Miller | ||
11 | * Derived from PowerPC and Sparc prom.h files by Stephen Rothwell, IBM Corp. | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version | ||
16 | * 2 of the License, or (at your option) any later version. | ||
17 | */ | ||
18 | #include <linux/types.h> | ||
19 | |||
20 | #include <asm/bitops.h> | ||
21 | #include <asm/prom.h> | ||
22 | |||
23 | /* flag descriptions */ | ||
24 | #define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ | ||
25 | #define OF_DETACHED 2 /* node has been detached from the device tree */ | ||
26 | |||
27 | #define OF_BAD_ADDR ((u64)-1) | ||
28 | |||
29 | extern struct device_node *of_find_node_by_name(struct device_node *from, | ||
30 | const char *name); | ||
31 | #define for_each_node_by_name(dn, name) \ | ||
32 | for (dn = of_find_node_by_name(NULL, name); dn; \ | ||
33 | dn = of_find_node_by_name(dn, name)) | ||
34 | extern struct device_node *of_find_node_by_type(struct device_node *from, | ||
35 | const char *type); | ||
36 | #define for_each_node_by_type(dn, type) \ | ||
37 | for (dn = of_find_node_by_type(NULL, type); dn; \ | ||
38 | dn = of_find_node_by_type(dn, type)) | ||
39 | extern struct device_node *of_find_compatible_node(struct device_node *from, | ||
40 | const char *type, const char *compat); | ||
41 | #define for_each_compatible_node(dn, type, compatible) \ | ||
42 | for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ | ||
43 | dn = of_find_compatible_node(dn, type, compatible)) | ||
44 | extern struct device_node *of_find_node_by_path(const char *path); | ||
45 | extern struct device_node *of_find_node_by_phandle(phandle handle); | ||
46 | extern struct device_node *of_get_parent(const struct device_node *node); | ||
47 | extern struct device_node *of_get_next_child(const struct device_node *node, | ||
48 | struct device_node *prev); | ||
49 | extern struct property *of_find_property(const struct device_node *np, | ||
50 | const char *name, | ||
51 | int *lenp); | ||
52 | extern int of_device_is_compatible(const struct device_node *device, | ||
53 | const char *); | ||
54 | extern const void *of_get_property(const struct device_node *node, | ||
55 | const char *name, | ||
56 | int *lenp); | ||
57 | #define get_property(a, b, c) of_get_property((a), (b), (c)) | ||
58 | extern int of_n_addr_cells(struct device_node *np); | ||
59 | extern int of_n_size_cells(struct device_node *np); | ||
60 | |||
61 | #endif /* _LINUX_OF_H */ | ||