diff options
-rw-r--r-- | arch/microblaze/include/asm/prom.h | 12 | ||||
-rw-r--r-- | arch/powerpc/include/asm/prom.h | 20 | ||||
-rw-r--r-- | include/linux/of.h | 23 |
3 files changed, 23 insertions, 32 deletions
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index 180d84481306..d4f57ffdae3f 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h | |||
@@ -82,18 +82,6 @@ extern int release_OF_resource(struct device_node *node, int index); | |||
82 | * OF address retreival & translation | 82 | * OF address retreival & translation |
83 | */ | 83 | */ |
84 | 84 | ||
85 | /* Helper to read a big number; size is in cells (not bytes) */ | ||
86 | static inline u64 of_read_number(const u32 *cell, int size) | ||
87 | { | ||
88 | u64 r = 0; | ||
89 | while (size--) | ||
90 | r = (r << 32) | *(cell++); | ||
91 | return r; | ||
92 | } | ||
93 | |||
94 | /* Like of_read_number, but we want an unsigned long result */ | ||
95 | #define of_read_ulong(cell, size) of_read_number(cell, size) | ||
96 | |||
97 | /* Translate an OF address block into a CPU physical address | 85 | /* Translate an OF address block into a CPU physical address |
98 | */ | 86 | */ |
99 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); | 87 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); |
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index 2cfd43288a3e..d8c0525c3139 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h | |||
@@ -89,26 +89,6 @@ extern int release_OF_resource(struct device_node* node, int index); | |||
89 | * OF address retreival & translation | 89 | * OF address retreival & translation |
90 | */ | 90 | */ |
91 | 91 | ||
92 | |||
93 | /* Helper to read a big number; size is in cells (not bytes) */ | ||
94 | static inline u64 of_read_number(const u32 *cell, int size) | ||
95 | { | ||
96 | u64 r = 0; | ||
97 | while (size--) | ||
98 | r = (r << 32) | *(cell++); | ||
99 | return r; | ||
100 | } | ||
101 | |||
102 | /* Like of_read_number, but we want an unsigned long result */ | ||
103 | #ifdef CONFIG_PPC32 | ||
104 | static inline unsigned long of_read_ulong(const u32 *cell, int size) | ||
105 | { | ||
106 | return cell[size-1]; | ||
107 | } | ||
108 | #else | ||
109 | #define of_read_ulong(cell, size) of_read_number(cell, size) | ||
110 | #endif | ||
111 | |||
112 | /* Translate an OF address block into a CPU physical address | 92 | /* Translate an OF address block into a CPU physical address |
113 | */ | 93 | */ |
114 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); | 94 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); |
diff --git a/include/linux/of.h b/include/linux/of.h index d5f666290f6b..18e4379b8b7f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -79,6 +79,29 @@ set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) | |||
79 | dn->pde = de; | 79 | dn->pde = de; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* | ||
83 | * OF address retreival & translation | ||
84 | */ | ||
85 | |||
86 | /* Helper to read a big number; size is in cells (not bytes) */ | ||
87 | static inline u64 of_read_number(const u32 *cell, int size) | ||
88 | { | ||
89 | u64 r = 0; | ||
90 | while (size--) | ||
91 | r = (r << 32) | *(cell++); | ||
92 | return r; | ||
93 | } | ||
94 | |||
95 | /* Like of_read_number, but we want an unsigned long result */ | ||
96 | #ifdef CONFIG_PPC32 | ||
97 | static inline unsigned long of_read_ulong(const u32 *cell, int size) | ||
98 | { | ||
99 | return cell[size-1]; | ||
100 | } | ||
101 | #else | ||
102 | #define of_read_ulong(cell, size) of_read_number(cell, size) | ||
103 | #endif | ||
104 | |||
82 | #include <asm/prom.h> | 105 | #include <asm/prom.h> |
83 | 106 | ||
84 | /* flag descriptions */ | 107 | /* flag descriptions */ |