diff options
Diffstat (limited to 'include/asm-powerpc/prom.h')
-rw-r--r-- | include/asm-powerpc/prom.h | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index d0fa1b9aed35..524629769336 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h | |||
@@ -72,8 +72,8 @@ struct property { | |||
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct device_node { | 74 | struct device_node { |
75 | char *name; | 75 | const char *name; |
76 | char *type; | 76 | const char *type; |
77 | phandle node; | 77 | phandle node; |
78 | phandle linux_phandle; | 78 | phandle linux_phandle; |
79 | char *full_name; | 79 | char *full_name; |
@@ -160,7 +160,7 @@ extern void unflatten_device_tree(void); | |||
160 | extern void early_init_devtree(void *); | 160 | extern void early_init_devtree(void *); |
161 | extern int device_is_compatible(struct device_node *device, const char *); | 161 | extern int device_is_compatible(struct device_node *device, const char *); |
162 | extern int machine_is_compatible(const char *compat); | 162 | extern int machine_is_compatible(const char *compat); |
163 | extern void *get_property(struct device_node *node, const char *name, | 163 | extern const void *get_property(struct device_node *node, const char *name, |
164 | int *lenp); | 164 | int *lenp); |
165 | extern void print_properties(struct device_node *node); | 165 | extern void print_properties(struct device_node *node); |
166 | extern int prom_n_addr_cells(struct device_node* np); | 166 | extern int prom_n_addr_cells(struct device_node* np); |
@@ -197,8 +197,8 @@ extern int release_OF_resource(struct device_node* node, int index); | |||
197 | */ | 197 | */ |
198 | 198 | ||
199 | 199 | ||
200 | /* Helper to read a big number */ | 200 | /* Helper to read a big number; size is in cells (not bytes) */ |
201 | static inline u64 of_read_number(u32 *cell, int size) | 201 | static inline u64 of_read_number(const u32 *cell, int size) |
202 | { | 202 | { |
203 | u64 r = 0; | 203 | u64 r = 0; |
204 | while (size--) | 204 | while (size--) |
@@ -206,18 +206,28 @@ static inline u64 of_read_number(u32 *cell, int size) | |||
206 | return r; | 206 | return r; |
207 | } | 207 | } |
208 | 208 | ||
209 | /* Like of_read_number, but we want an unsigned long result */ | ||
210 | #ifdef CONFIG_PPC32 | ||
211 | static inline unsigned long of_read_ulong(const u32 *cell, int size) | ||
212 | { | ||
213 | return cell[size-1]; | ||
214 | } | ||
215 | #else | ||
216 | #define of_read_ulong(cell, size) of_read_number(cell, size) | ||
217 | #endif | ||
218 | |||
209 | /* Translate an OF address block into a CPU physical address | 219 | /* Translate an OF address block into a CPU physical address |
210 | */ | 220 | */ |
211 | #define OF_BAD_ADDR ((u64)-1) | 221 | #define OF_BAD_ADDR ((u64)-1) |
212 | extern u64 of_translate_address(struct device_node *np, u32 *addr); | 222 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); |
213 | 223 | ||
214 | /* Extract an address from a device, returns the region size and | 224 | /* Extract an address from a device, returns the region size and |
215 | * the address space flags too. The PCI version uses a BAR number | 225 | * the address space flags too. The PCI version uses a BAR number |
216 | * instead of an absolute index | 226 | * instead of an absolute index |
217 | */ | 227 | */ |
218 | extern u32 *of_get_address(struct device_node *dev, int index, | 228 | extern const u32 *of_get_address(struct device_node *dev, int index, |
219 | u64 *size, unsigned int *flags); | 229 | u64 *size, unsigned int *flags); |
220 | extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, | 230 | extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, |
221 | u64 *size, unsigned int *flags); | 231 | u64 *size, unsigned int *flags); |
222 | 232 | ||
223 | /* Get an address as a resource. Note that if your address is | 233 | /* Get an address as a resource. Note that if your address is |
@@ -234,7 +244,7 @@ extern int of_pci_address_to_resource(struct device_node *dev, int bar, | |||
234 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and | 244 | /* Parse the ibm,dma-window property of an OF node into the busno, phys and |
235 | * size parameters. | 245 | * size parameters. |
236 | */ | 246 | */ |
237 | void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, | 247 | void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, |
238 | unsigned long *busno, unsigned long *phys, unsigned long *size); | 248 | unsigned long *busno, unsigned long *phys, unsigned long *size); |
239 | 249 | ||
240 | extern void kdump_move_device_tree(void); | 250 | extern void kdump_move_device_tree(void); |
@@ -259,7 +269,7 @@ struct of_irq { | |||
259 | u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ | 269 | u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ |
260 | }; | 270 | }; |
261 | 271 | ||
262 | /*** | 272 | /** |
263 | * of_irq_map_init - Initialize the irq remapper | 273 | * of_irq_map_init - Initialize the irq remapper |
264 | * @flags: flags defining workarounds to enable | 274 | * @flags: flags defining workarounds to enable |
265 | * | 275 | * |
@@ -272,7 +282,7 @@ struct of_irq { | |||
272 | 282 | ||
273 | extern void of_irq_map_init(unsigned int flags); | 283 | extern void of_irq_map_init(unsigned int flags); |
274 | 284 | ||
275 | /*** | 285 | /** |
276 | * of_irq_map_raw - Low level interrupt tree parsing | 286 | * of_irq_map_raw - Low level interrupt tree parsing |
277 | * @parent: the device interrupt parent | 287 | * @parent: the device interrupt parent |
278 | * @intspec: interrupt specifier ("interrupts" property of the device) | 288 | * @intspec: interrupt specifier ("interrupts" property of the device) |
@@ -289,12 +299,12 @@ extern void of_irq_map_init(unsigned int flags); | |||
289 | * | 299 | * |
290 | */ | 300 | */ |
291 | 301 | ||
292 | extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, | 302 | extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, |
293 | u32 ointsize, u32 *addr, | 303 | u32 ointsize, const u32 *addr, |
294 | struct of_irq *out_irq); | 304 | struct of_irq *out_irq); |
295 | 305 | ||
296 | 306 | ||
297 | /*** | 307 | /** |
298 | * of_irq_map_one - Resolve an interrupt for a device | 308 | * of_irq_map_one - Resolve an interrupt for a device |
299 | * @device: the device whose interrupt is to be resolved | 309 | * @device: the device whose interrupt is to be resolved |
300 | * @index: index of the interrupt to resolve | 310 | * @index: index of the interrupt to resolve |
@@ -307,7 +317,7 @@ extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, | |||
307 | extern int of_irq_map_one(struct device_node *device, int index, | 317 | extern int of_irq_map_one(struct device_node *device, int index, |
308 | struct of_irq *out_irq); | 318 | struct of_irq *out_irq); |
309 | 319 | ||
310 | /*** | 320 | /** |
311 | * of_irq_map_pci - Resolve the interrupt for a PCI device | 321 | * of_irq_map_pci - Resolve the interrupt for a PCI device |
312 | * @pdev: the device whose interrupt is to be resolved | 322 | * @pdev: the device whose interrupt is to be resolved |
313 | * @out_irq: structure of_irq filled by this function | 323 | * @out_irq: structure of_irq filled by this function |