aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-powerpc/prom.h43
-rw-r--r--include/asm-sparc/prom.h46
-rw-r--r--include/asm-sparc64/prom.h46
-rw-r--r--include/linux/of.h61
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
98extern struct device_node *of_chosen; 98extern 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
104static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 100static 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 */
124extern 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))
129extern 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))
134extern 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))
139extern struct device_node *of_find_node_by_path(const char *path);
140extern struct device_node *of_find_node_by_phandle(phandle handle);
141extern struct device_node *of_find_all_nodes(struct device_node *prev); 119extern struct device_node *of_find_all_nodes(struct device_node *prev);
142extern struct device_node *of_get_parent(const struct device_node *node);
143extern struct device_node *of_get_next_child(const struct device_node *node,
144 struct device_node *prev);
145extern struct property *of_find_property(const struct device_node *np,
146 const char *name,
147 int *lenp);
148extern struct device_node *of_node_get(struct device_node *node); 120extern struct device_node *of_node_get(struct device_node *node);
149extern void of_node_put(struct device_node *node); 121extern void of_node_put(struct device_node *node);
150 122
@@ -166,17 +138,9 @@ extern void of_detach_node(const struct device_node *);
166extern void finish_device_tree(void); 138extern void finish_device_tree(void);
167extern void unflatten_device_tree(void); 139extern void unflatten_device_tree(void);
168extern void early_init_devtree(void *); 140extern void early_init_devtree(void *);
169extern 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))
172extern int machine_is_compatible(const char *compat); 142extern int machine_is_compatible(const char *compat);
173extern 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))
177extern void print_properties(struct device_node *node); 143extern void print_properties(struct device_node *node);
178extern int of_n_addr_cells(struct device_node* np);
179extern int of_n_size_cells(struct device_node* np);
180extern int prom_n_intr_cells(struct device_node* np); 144extern int prom_n_intr_cells(struct device_node* np);
181extern void prom_get_irq_senses(unsigned char *senses, int off, int max); 145extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
182extern int prom_add_property(struct device_node* np, struct property* prop); 146extern 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)
234extern u64 of_translate_address(struct device_node *np, const u32 *addr); 197extern 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 */
358extern void __iomem *of_iomap(struct device_node *device, int index); 321extern 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
66static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
67{
68 dn->pde = de;
69}
70
71extern 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))
76extern 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))
81extern struct device_node *of_find_compatible_node(struct device_node *from,
82 const char *type, const char *compat);
83extern struct device_node *of_find_node_by_path(const char *path);
84extern struct device_node *of_find_node_by_phandle(phandle handle);
85extern struct device_node *of_get_parent(const struct device_node *node);
86extern struct device_node *of_get_next_child(const struct device_node *node,
87 struct device_node *prev);
88extern struct property *of_find_property(const struct device_node *np,
89 const char *name,
90 int *lenp);
91extern int of_device_is_compatible(const struct device_node *device,
92 const char *);
93extern 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)
97extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 59extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
98extern int of_getintprop_default(struct device_node *np, 60extern int of_getintprop_default(struct device_node *np,
99 const char *name, 61 const char *name,
100 int def); 62 int def);
101extern int of_n_addr_cells(struct device_node *np);
102extern int of_n_size_cells(struct device_node *np);
103 63
104extern void prom_build_devicetree(void); 64extern 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
74static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
75{
76 dn->pde = de;
77}
78
79extern 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))
84extern 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))
89extern struct device_node *of_find_compatible_node(struct device_node *from,
90 const char *type, const char *compat);
91extern struct device_node *of_find_node_by_path(const char *path);
92extern struct device_node *of_find_node_by_phandle(phandle handle);
93extern struct device_node *of_find_node_by_cpuid(int cpuid); 67extern struct device_node *of_find_node_by_cpuid(int cpuid);
94extern struct device_node *of_get_parent(const struct device_node *node);
95extern struct device_node *of_get_next_child(const struct device_node *node,
96 struct device_node *prev);
97extern struct property *of_find_property(const struct device_node *np,
98 const char *name,
99 int *lenp);
100extern int of_device_is_compatible(const struct device_node *device,
101 const char *);
102extern 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)
106extern int of_set_property(struct device_node *node, const char *name, void *val, int len); 68extern int of_set_property(struct device_node *node, const char *name, void *val, int len);
107extern int of_getintprop_default(struct device_node *np, 69extern int of_getintprop_default(struct device_node *np,
108 const char *name, 70 const char *name,
109 int def); 71 int def);
110extern int of_n_addr_cells(struct device_node *np);
111extern int of_n_size_cells(struct device_node *np);
112 72
113extern void prom_build_devicetree(void); 73extern 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
29extern 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))
34extern 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))
39extern 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))
44extern struct device_node *of_find_node_by_path(const char *path);
45extern struct device_node *of_find_node_by_phandle(phandle handle);
46extern struct device_node *of_get_parent(const struct device_node *node);
47extern struct device_node *of_get_next_child(const struct device_node *node,
48 struct device_node *prev);
49extern struct property *of_find_property(const struct device_node *np,
50 const char *name,
51 int *lenp);
52extern int of_device_is_compatible(const struct device_node *device,
53 const char *);
54extern 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))
58extern int of_n_addr_cells(struct device_node *np);
59extern int of_n_size_cells(struct device_node *np);
60
61#endif /* _LINUX_OF_H */