Skip to content

Commit

Permalink
of: implement pci_address_to_pio as weak function
Browse files Browse the repository at this point in the history
Implement pci_address_to_pio as weak function to remove the dependency on
asm/prom.h. This is in preparation to make prom.h optional.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Grant Likely <grant.likely@linaro.org>
  • Loading branch information
Rob Herring committed Oct 10, 2013
1 parent ba904f0 commit 25ff794
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 43 deletions.
9 changes: 0 additions & 9 deletions arch/microblaze/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,4 @@ enum early_consoles {

extern int of_early_console(void *version);

/*
* OF address retreival & translation
*/

#ifdef CONFIG_PCI
extern unsigned long pci_address_to_pio(phys_addr_t address);
#define pci_address_to_pio pci_address_to_pio
#endif /* CONFIG_PCI */

#endif /* _ASM_MICROBLAZE_PROM_H */
11 changes: 0 additions & 11 deletions arch/mips/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@

extern void device_tree_init(void);

static inline unsigned long pci_address_to_pio(phys_addr_t address)
{
/*
* The ioport address can be directly used by inX() / outX()
*/
BUG_ON(address > IO_SPACE_LIMIT);

return (unsigned long) address;
}
#define pci_address_to_pio pci_address_to_pio

struct boot_param_header;

extern void __dt_setup_arch(struct boot_param_header *bph);
Expand Down
5 changes: 0 additions & 5 deletions arch/powerpc/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
extern u64 of_translate_dma_address(struct device_node *dev,
const __be32 *in_addr);

#ifdef CONFIG_PCI
extern unsigned long pci_address_to_pio(phys_addr_t address);
#define pci_address_to_pio pci_address_to_pio
#endif /* CONFIG_PCI */

/* Parse the ibm,dma-window property of an OF node into the busno, phys and
* size parameters.
*/
Expand Down
3 changes: 0 additions & 3 deletions arch/x86/include/asm/prom.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ static inline void x86_dtb_init(void) { }

extern char cmd_line[COMMAND_LINE_SIZE];

#define pci_address_to_pio pci_address_to_pio
unsigned long pci_address_to_pio(phys_addr_t addr);

#define HAVE_ARCH_DEVTREE_FIXUPS

#endif /* __ASSEMBLY__ */
Expand Down
10 changes: 0 additions & 10 deletions arch/x86/kernel/devicetree.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ char __initdata cmd_line[COMMAND_LINE_SIZE];

int __initdata of_ioapic;

unsigned long pci_address_to_pio(phys_addr_t address)
{
/*
* The ioport address can be directly used by inX / outX
*/
BUG_ON(address >= (1 << 16));
return (unsigned long)address;
}
EXPORT_SYMBOL_GPL(pci_address_to_pio);

void __init early_init_dt_scan_chosen_arch(unsigned long node)
{
BUG();
Expand Down
8 changes: 8 additions & 0 deletions drivers/of/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,14 @@ const __be32 *of_get_address(struct device_node *dev, int index, u64 *size,
}
EXPORT_SYMBOL(of_get_address);

unsigned long __weak pci_address_to_pio(phys_addr_t address)
{
if (address > IO_SPACE_LIMIT)
return (unsigned long)-1;

return (unsigned long) address;
}

static int __of_address_to_resource(struct device_node *dev,
const __be32 *addrp, u64 size, unsigned int flags,
const char *name, struct resource *r)
Expand Down
1 change: 0 additions & 1 deletion drivers/of/of_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <linux/export.h>
#include <linux/of.h>
#include <linux/of_pci.h>
#include <asm/prom.h>

static inline int __of_pci_pci_compare(struct device_node *node,
unsigned int data)
Expand Down
5 changes: 1 addition & 4 deletions include/linux/of_address.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
extern const __be32 *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
extern unsigned long pci_address_to_pio(phys_addr_t addr);

extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
struct device_node *node);
Expand Down

0 comments on commit 25ff794

Please sign in to comment.