Commit 22ae782f authored by Grant Likely's avatar Grant Likely

of/address: Clean up function declarations

This patch moves the declaration of of_get_address(), of_get_pci_address(),
and of_pci_address_to_resource() out of arch code and into the common
linux/of_address header file.

This patch also fixes some of the asm/prom.h ordering issues.  It still
includes some header files that it ideally shouldn't be, but at least the
ordering is consistent now so that of_* overrides work.
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 12b15e83
...@@ -20,11 +20,6 @@ ...@@ -20,11 +20,6 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/types.h> #include <linux/types.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_fdt.h>
#include <linux/proc_fs.h>
#include <linux/platform_device.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -52,25 +47,9 @@ extern void pci_create_OF_bus_map(void); ...@@ -52,25 +47,9 @@ extern void pci_create_OF_bus_map(void);
* OF address retreival & translation * OF address retreival & translation
*/ */
/* Extract an address from a device, returns the region size and
* the address space flags too. The PCI version uses a BAR number
* instead of an absolute index
*/
extern const u32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags);
extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
u64 *size, unsigned int *flags);
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
extern unsigned long pci_address_to_pio(phys_addr_t address); extern unsigned long pci_address_to_pio(phys_addr_t address);
#else #define pci_address_to_pio pci_address_to_pio
static inline unsigned long pci_address_to_pio(phys_addr_t address)
{
return (unsigned long)-1;
}
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
/* Parse the ibm,dma-window property of an OF node into the busno, phys and /* Parse the ibm,dma-window property of an OF node into the busno, phys and
...@@ -99,8 +78,18 @@ extern const void *of_get_mac_address(struct device_node *np); ...@@ -99,8 +78,18 @@ extern const void *of_get_mac_address(struct device_node *np);
* resolving using the OF tree walking. * resolving using the OF tree walking.
*/ */
struct pci_dev; struct pci_dev;
struct of_irq;
extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* These includes are put at the bottom because they may contain things
* that are overridden by this file. Ideally they shouldn't be included
* by this file, but there are a bunch of .c files that currently depend
* on it. Eventually they will be cleaned up. */
#include <linux/of_fdt.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#endif /* _ASM_MICROBLAZE_PROM_H */ #endif /* _ASM_MICROBLAZE_PROM_H */
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/of_fdt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/proc_fs.h>
#include <linux/platform_device.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -49,41 +44,9 @@ extern void pci_create_OF_bus_map(void); ...@@ -49,41 +44,9 @@ extern void pci_create_OF_bus_map(void);
extern u64 of_translate_dma_address(struct device_node *dev, extern u64 of_translate_dma_address(struct device_node *dev,
const u32 *in_addr); const u32 *in_addr);
/* Extract an address from a device, returns the region size and
* the address space flags too. The PCI version uses a BAR number
* instead of an absolute index
*/
extern const u32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags);
#ifdef CONFIG_PCI
extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
u64 *size, unsigned int *flags);
#else
static inline const u32 *of_get_pci_address(struct device_node *dev,
int bar_no, u64 *size, unsigned int *flags)
{
return NULL;
}
#endif /* CONFIG_PCI */
#ifdef CONFIG_PCI
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r);
#else
static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r)
{
return -ENOSYS;
}
#endif /* CONFIG_PCI */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
extern unsigned long pci_address_to_pio(phys_addr_t address); extern unsigned long pci_address_to_pio(phys_addr_t address);
#else #define pci_address_to_pio pci_address_to_pio
static inline unsigned long pci_address_to_pio(phys_addr_t address)
{
return (unsigned long)-1;
}
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
/* Parse the ibm,dma-window property of an OF node into the busno, phys and /* Parse the ibm,dma-window property of an OF node into the busno, phys and
...@@ -122,9 +85,19 @@ static inline int of_node_to_nid(struct device_node *device) { return 0; } ...@@ -122,9 +85,19 @@ static inline int of_node_to_nid(struct device_node *device) { return 0; }
* resolving using the OF tree walking. * resolving using the OF tree walking.
*/ */
struct pci_dev; struct pci_dev;
struct of_irq;
extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
extern void of_instantiate_rtc(void); extern void of_instantiate_rtc(void);
/* These includes are put at the bottom because they may contain things
* that are overridden by this file. Ideally they shouldn't be included
* by this file, but there are a bunch of .c files that currently depend
* on it. Eventually they will be cleaned up. */
#include <linux/of_fdt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _POWERPC_PROM_H */ #endif /* _POWERPC_PROM_H */
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/mmu.h> #include <asm/mmu.h>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/of_address.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <asm/time.h> #include <asm/time.h>
......
...@@ -13,12 +13,13 @@ ...@@ -13,12 +13,13 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <generated/utsrelease.h> #include <generated/utsrelease.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/prom.h>
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
#include <asm/i8259.h> #include <asm/i8259.h>
#include <asm/time.h> #include <asm/time.h>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/bcd.h> #include <linux/bcd.h>
#include <linux/rtc.h> #include <linux/rtc.h>
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/adb.h> #include <linux/adb.h>
#include <linux/pmu.h> #include <linux/pmu.h>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* kind, whether express or implied. * kind, whether express or implied.
*/ */
#include <linux/err.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/err.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/io.h> #include <linux/io.h>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/fs.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/cdev.h> #include <linux/cdev.h>
#include <linux/list.h> #include <linux/list.h>
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/io.h> #include <asm/io.h>
#if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE)) #if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE))
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/completion.h> #include <linux/completion.h>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/completion.h> #include <linux/completion.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_spi.h> #include <linux/of_spi.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/usb/ch9.h> #include <linux/usb/ch9.h>
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
......
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/prom.h>
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
......
...@@ -8,5 +8,37 @@ extern int of_address_to_resource(struct device_node *dev, int index, ...@@ -8,5 +8,37 @@ extern int of_address_to_resource(struct device_node *dev, int index,
struct resource *r); struct resource *r);
extern void __iomem *of_iomap(struct device_node *device, int index); extern void __iomem *of_iomap(struct device_node *device, int index);
/* Extract an address from a device, returns the region size and
* the address space flags too. The PCI version uses a BAR number
* instead of an absolute index
*/
extern const u32 *of_get_address(struct device_node *dev, int index,
u64 *size, unsigned int *flags);
#ifndef pci_address_to_pio
static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
#define pci_address_to_pio pci_address_to_pio
#endif
#ifdef CONFIG_PCI
extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
u64 *size, unsigned int *flags);
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r);
#else /* CONFIG_PCI */
static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r)
{
return -ENOSYS;
}
static inline const u32 *of_get_pci_address(struct device_node *dev,
int bar_no, u64 *size, unsigned int *flags)
{
return NULL;
}
#endif /* CONFIG_PCI */
#endif /* __OF_ADDRESS_H */ #endif /* __OF_ADDRESS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment