1212 (ns) > 0)
1313
1414static struct of_bus * of_match_bus (struct device_node * np );
15- static int __of_address_to_resource (struct device_node * dev , const u32 * addrp ,
16- u64 size , unsigned int flags ,
15+ static int __of_address_to_resource (struct device_node * dev ,
16+ const __be32 * addrp , u64 size , unsigned int flags ,
1717 struct resource * r );
1818
1919/* Debug utility */
2020#ifdef DEBUG
21- static void of_dump_addr (const char * s , const u32 * addr , int na )
21+ static void of_dump_addr (const char * s , const __be32 * addr , int na )
2222{
2323 printk (KERN_DEBUG "%s" , s );
2424 while (na -- )
2525 printk (" %08x" , be32_to_cpu (* (addr ++ )));
2626 printk ("\n" );
2727}
2828#else
29- static void of_dump_addr (const char * s , const u32 * addr , int na ) { }
29+ static void of_dump_addr (const char * s , const __be32 * addr , int na ) { }
3030#endif
3131
3232/* Callbacks for bus specific translators */
@@ -36,10 +36,10 @@ struct of_bus {
3636 int (* match )(struct device_node * parent );
3737 void (* count_cells )(struct device_node * child ,
3838 int * addrc , int * sizec );
39- u64 (* map )(u32 * addr , const u32 * range ,
39+ u64 (* map )(u32 * addr , const __be32 * range ,
4040 int na , int ns , int pna );
4141 int (* translate )(u32 * addr , u64 offset , int na );
42- unsigned int (* get_flags )(const u32 * addr );
42+ unsigned int (* get_flags )(const __be32 * addr );
4343};
4444
4545/*
@@ -55,7 +55,7 @@ static void of_bus_default_count_cells(struct device_node *dev,
5555 * sizec = of_n_size_cells (dev );
5656}
5757
58- static u64 of_bus_default_map (u32 * addr , const u32 * range ,
58+ static u64 of_bus_default_map (u32 * addr , const __be32 * range ,
5959 int na , int ns , int pna )
6060{
6161 u64 cp , s , da ;
@@ -85,7 +85,7 @@ static int of_bus_default_translate(u32 *addr, u64 offset, int na)
8585 return 0 ;
8686}
8787
88- static unsigned int of_bus_default_get_flags (const u32 * addr )
88+ static unsigned int of_bus_default_get_flags (const __be32 * addr )
8989{
9090 return IORESOURCE_MEM ;
9191}
@@ -110,10 +110,10 @@ static void of_bus_pci_count_cells(struct device_node *np,
110110 * sizec = 2 ;
111111}
112112
113- static unsigned int of_bus_pci_get_flags (const u32 * addr )
113+ static unsigned int of_bus_pci_get_flags (const __be32 * addr )
114114{
115115 unsigned int flags = 0 ;
116- u32 w = addr [ 0 ] ;
116+ u32 w = be32_to_cpup ( addr ) ;
117117
118118 switch ((w >> 24 ) & 0x03 ) {
119119 case 0x01 :
@@ -129,7 +129,8 @@ static unsigned int of_bus_pci_get_flags(const u32 *addr)
129129 return flags ;
130130}
131131
132- static u64 of_bus_pci_map (u32 * addr , const u32 * range , int na , int ns , int pna )
132+ static u64 of_bus_pci_map (u32 * addr , const __be32 * range , int na , int ns ,
133+ int pna )
133134{
134135 u64 cp , s , da ;
135136 unsigned int af , rf ;
@@ -160,7 +161,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
160161 return of_bus_default_translate (addr + 1 , offset , na - 1 );
161162}
162163
163- const u32 * of_get_pci_address (struct device_node * dev , int bar_no , u64 * size ,
164+ const __be32 * of_get_pci_address (struct device_node * dev , int bar_no , u64 * size ,
164165 unsigned int * flags )
165166{
166167 const __be32 * prop ;
@@ -207,7 +208,7 @@ EXPORT_SYMBOL(of_get_pci_address);
207208int of_pci_address_to_resource (struct device_node * dev , int bar ,
208209 struct resource * r )
209210{
210- const u32 * addrp ;
211+ const __be32 * addrp ;
211212 u64 size ;
212213 unsigned int flags ;
213214
@@ -237,12 +238,13 @@ static void of_bus_isa_count_cells(struct device_node *child,
237238 * sizec = 1 ;
238239}
239240
240- static u64 of_bus_isa_map (u32 * addr , const u32 * range , int na , int ns , int pna )
241+ static u64 of_bus_isa_map (u32 * addr , const __be32 * range , int na , int ns ,
242+ int pna )
241243{
242244 u64 cp , s , da ;
243245
244246 /* Check address type match */
245- if ((addr [0 ] ^ range [0 ]) & 0x00000001 )
247+ if ((addr [0 ] ^ range [0 ]) & cpu_to_be32 ( 1 ) )
246248 return OF_BAD_ADDR ;
247249
248250 /* Read address values, skipping high cell */
@@ -264,10 +266,10 @@ static int of_bus_isa_translate(u32 *addr, u64 offset, int na)
264266 return of_bus_default_translate (addr + 1 , offset , na - 1 );
265267}
266268
267- static unsigned int of_bus_isa_get_flags (const u32 * addr )
269+ static unsigned int of_bus_isa_get_flags (const __be32 * addr )
268270{
269271 unsigned int flags = 0 ;
270- u32 w = addr [ 0 ] ;
272+ u32 w = be32_to_cpup ( addr ) ;
271273
272274 if (w & 1 )
273275 flags |= IORESOURCE_IO ;
@@ -330,7 +332,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
330332 struct of_bus * pbus , u32 * addr ,
331333 int na , int ns , int pna , const char * rprop )
332334{
333- const u32 * ranges ;
335+ const __be32 * ranges ;
334336 unsigned int rlen ;
335337 int rone ;
336338 u64 offset = OF_BAD_ADDR ;
@@ -398,7 +400,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
398400 * that can be mapped to a cpu physical address). This is not really specified
399401 * that way, but this is traditionally the way IBM at least do things
400402 */
401- u64 __of_translate_address (struct device_node * dev , const u32 * in_addr ,
403+ u64 __of_translate_address (struct device_node * dev , const __be32 * in_addr ,
402404 const char * rprop )
403405{
404406 struct device_node * parent = NULL ;
@@ -475,22 +477,22 @@ u64 __of_translate_address(struct device_node *dev, const u32 *in_addr,
475477 return result ;
476478}
477479
478- u64 of_translate_address (struct device_node * dev , const u32 * in_addr )
480+ u64 of_translate_address (struct device_node * dev , const __be32 * in_addr )
479481{
480482 return __of_translate_address (dev , in_addr , "ranges" );
481483}
482484EXPORT_SYMBOL (of_translate_address );
483485
484- u64 of_translate_dma_address (struct device_node * dev , const u32 * in_addr )
486+ u64 of_translate_dma_address (struct device_node * dev , const __be32 * in_addr )
485487{
486488 return __of_translate_address (dev , in_addr , "dma-ranges" );
487489}
488490EXPORT_SYMBOL (of_translate_dma_address );
489491
490- const u32 * of_get_address (struct device_node * dev , int index , u64 * size ,
492+ const __be32 * of_get_address (struct device_node * dev , int index , u64 * size ,
491493 unsigned int * flags )
492494{
493- const u32 * prop ;
495+ const __be32 * prop ;
494496 unsigned int psize ;
495497 struct device_node * parent ;
496498 struct of_bus * bus ;
@@ -525,8 +527,8 @@ const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
525527}
526528EXPORT_SYMBOL (of_get_address );
527529
528- static int __of_address_to_resource (struct device_node * dev , const u32 * addrp ,
529- u64 size , unsigned int flags ,
530+ static int __of_address_to_resource (struct device_node * dev ,
531+ const __be32 * addrp , u64 size , unsigned int flags ,
530532 struct resource * r )
531533{
532534 u64 taddr ;
@@ -564,7 +566,7 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
564566int of_address_to_resource (struct device_node * dev , int index ,
565567 struct resource * r )
566568{
567- const u32 * addrp ;
569+ const __be32 * addrp ;
568570 u64 size ;
569571 unsigned int flags ;
570572
0 commit comments