powerpc: Merge 32 and 64 bits asm-powerpc/io.h
Subsystems (2)
PATCH 1/1 powerpc: Merge 32 and 64 bits asm-powerpc/io.h
powerpc: Merge 32 and 64 bits asm-powerpc/io.h
The rework on io.h done for the new hookable accessors made it easier, so I just finished the work and merged 32 and 64 bits io.h for arch/powerpc.
arch/ppc still uses the old version in asm-ppc, there is just too much gunk in there that I really can't be bothered trying to cleanup.
Signed-off-by Benjamin Herrenschmidt <[email protected]>
---
Fixes a typo causing various problems mostly with PCI IO space. Change from previous version is in io.h, near the top,
#ifdef CONFIG_PCI -> #ifndef CONFIG_PCI
Thanks to Guennadi Liakhovetski for spotting it.
arch/powerpc/kernel/Makefile +1 -1
@@ -73,7 +73,7 @@ obj64-$(CONFIG_AUDIT) += compat_audit.o ifneq ($(CONFIG_PPC_INDIRECT_IO),y) -pci64-$(CONFIG_PPC64) += iomap.o +obj-y += iomap.o endif ifeq ($(CONFIG_PPC_ISERIES),y)
arch/powerpc/kernel/io.c +87 -0
90 lines not on this page · raw message
include/asm-powerpc/eeh.h +5 -90
109 lines not on this page · raw message
include/asm-powerpc/io-defs.h +6 -3
@@ -3,17 +3,20 @@ DEF_PCI_AC_RET(readb, u8, (const PCI_IO_ADDR addr), (addr)) DEF_PCI_AC_RET(readw, u16, (const PCI_IO_ADDR addr), (addr)) DEF_PCI_AC_RET(readl, u32, (const PCI_IO_ADDR addr), (addr)) -DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr)) DEF_PCI_AC_RET(readw_be, u16, (const PCI_IO_ADDR addr), (addr)) DEF_PCI_AC_RET(readl_be, u32, (const PCI_IO_ADDR addr), (addr)) -DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr)) DEF_PCI_AC_NORET(writeb, (u8 val, PCI_IO_ADDR addr), (val, addr)) DEF_PCI_AC_NORET(writew, (u16 val, PCI_IO_ADDR addr), (val, addr)) DEF_PCI_AC_NORET(writel, (u32 val, PCI_IO_ADDR addr), (val, addr)) -DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr)) DEF_PCI_AC_NORET(writew_be, (u16 val, PCI_IO_ADDR addr), (val, addr)) DEF_PCI_AC_NORET(writel_be, (u32 val, PCI_IO_ADDR addr), (val, addr)) + +#ifdef __powerpc64__ +DEF_PCI_AC_RET(readq, u64, (const PCI_IO_ADDR addr), (addr)) +DEF_PCI_AC_RET(readq_be, u64, (const PCI_IO_ADDR addr), (addr)) +DEF_PCI_AC_NORET(writeq, (u64 val, PCI_IO_ADDR addr), (val, addr)) DEF_PCI_AC_NORET(writeq_be, (u64 val, PCI_IO_ADDR addr), (val, addr)) +#endif /* __powerpc64__ */ DEF_PCI_AC_RET(inb, u8, (unsigned long port), (port)) DEF_PCI_AC_RET(inw, u16, (unsigned long port), (port))
include/asm-powerpc/io.h +240 -44
445 lines not on this page · raw message
arch/powerpc/kernel/traps.c +2 -6
@@ -53,10 +53,6 @@#endif #include <asm/kexec.h> -#ifdef CONFIG_PPC64 /* XXX */ -#define _IO_BASE pci_io_base -#endif -#ifdef CONFIG_DEBUGGER int (*__debugger)(struct pt_regs *regs);int (*__debugger_ipi)(struct pt_regs *regs);
@@ -241,7 +237,7 @@*/ static inline int check_io_access (struct pt_regs *regs) { -#if defined(CONFIG_PPC_PMAC ) && defined(CONFIG_PPC32 ) +#ifdef CONFIG_PPC32 unsigned long msr = regs->msr;const struct exception_table_entry *entry;unsigned int *nip = (unsigned int *)regs->nip;
@@ -274,7 +270,7 @@ return 1; } } -#endif /* CONFIG_PPC_PMAC && CONFIG_PPC32 */ +#endif /* CONFIG_PPC32 */ return 0 ; }
arch/powerpc/kernel/rtas_pci.c +1 -0
@@ -38,6 +38,7 @@#include <asm/rtas.h> #include <asm/mpic.h> #include <asm/ppc-pci.h> +#include <asm/eeh.h> /* RTAS tokens */ static int read_pci_config;
arch/powerpc/platforms/chrp/setup.c +0 -1
@@ -588,7 +588,6 @@ISA_DMA_THRESHOLD = ~0L ;DMA_MODE_READ =0x44 ;DMA_MODE_WRITE =0x48 ; - isa_io_base =CHRP_ISA_IO_BASE ;/* default value */ return 1 ; }
arch/powerpc/platforms/powermac/setup.c +0 -2
@@ -677,8 +677,6 @@#ifdef CONFIG_PPC32 /* isa_io_base gets set in pmac_pci_init */ - isa_mem_base =PMAC_ISA_MEM_BASE ; - pci_dram_offset =PMAC_PCI_DRAM_OFFSET ;ISA_DMA_THRESHOLD = ~0L ;DMA_MODE_READ =1 ;DMA_MODE_WRITE =2 ;
arch/powerpc/mm/pgtable_32.c +8 -14
@@ -149,6 +149,13 @@EXPORT_SYMBOL (ioremap);void __iomem * +ioremap_flags (phys_addr_t addr,unsigned long size,unsigned long flags) +{ +return __ioremap (addr, size, flags); +} +EXPORT_SYMBOL (ioremap_flags); + +void __iomem *__ioremap (phys_addr_t addr,unsigned long size,unsigned long flags) {unsigned long v, i;
@@ -247,20 +254,7 @@ }EXPORT_SYMBOL (iounmap); -void __iomem *ioport_map (unsigned long port,unsigned int len) -{ -return (void __iomem *) (port + _IO_BASE); -} - -void ioport_unmap (void __iomem *addr) -{ -/* Nothing to do */ -} -EXPORT_SYMBOL (ioport_map); -EXPORT_SYMBOL (ioport_unmap); - -int -map_page (unsigned long va,phys_addr_t pa,int flags) +int map_page (unsigned long va,phys_addr_t pa,int flags) {pmd_t *pd;pte_t *pg;
arch/powerpc/mm/pgtable_64.c +8 -8
@@ -113,7 +113,7 @@ } -static void __iomem *__ioremap_com (unsigned long addr,unsigned long pa, +static void __iomem *__ioremap_com (phys_addr_t addr,unsigned long pa,unsigned long ea,unsigned long size,unsigned long flags) {
@@ -129,7 +129,7 @@return (void __iomem *) (ea + (addr & ~PAGE_MASK )); } -void __iomem *__ioremap (unsigned long addr,unsigned long size, +void __iomem *__ioremap (phys_addr_t addr,unsigned long size,unsigned long flags) {unsigned long pa, ea;
@@ -169,7 +169,7 @@ } -void __iomem *ioremap (unsigned long addr,unsigned long size) +void __iomem *ioremap (phys_addr_t addr,unsigned long size) {unsigned long flags = _PAGE_NO_CACHE | _PAGE_GUARDED;
@@ -178,7 +178,7 @@return __ioremap (addr, size, flags); } -void __iomem *ioremap_flags (unsigned long addr,unsigned long size, +void __iomem *ioremap_flags (phys_addr_t addr,unsigned long size,unsigned long flags) {if (ppc_md.ioremap)
@@ -189,7 +189,7 @@#define IS_PAGE_ALIGNED (_val) ((_val) == ((_val) & PAGE_MASK)) -int __ioremap_explicit (unsigned long pa,unsigned long ea, +int __ioremap_explicit (phys_addr_t pa,unsigned long ea,unsigned long size,unsigned long flags) {struct vm_struct *area;
@@ -244,7 +244,7 @@* * XXX what about calls before mem_init_done (ie python_countermeasures()) */ -void __iounmap (void __iomem *token) +void __iounmap (volatile void __iomem *token) {void *addr;
@@ -256,7 +256,7 @@im_free (addr); } -void iounmap (void __iomem *token) +void iounmap (volatile void __iomem *token) {if (ppc_md.iounmap) ppc_md.iounmap (token);
@@ -282,7 +282,7 @@return 0 ; } -int __iounmap_explicit (void __iomem *start,unsigned long size) +int __iounmap_explicit (volatile void __iomem *start,unsigned long size) {struct vm_struct *area;unsigned long addr;
arch/powerpc/platforms/iseries/setup.c +2 -2
@@ -649,13 +649,13 @@void __init iSeries_init_IRQ (void ) { }#endif -static void __iomem *iseries_ioremap (unsigned long address,unsigned long size, +static void __iomem *iseries_ioremap (phys_addr_t address,unsigned long size,unsigned long flags) {return (void __iomem *)address; } -static void iseries_iounmap (void __iomem *token) +static void iseries_iounmap (volatile void __iomem *token) { }
include/asm-powerpc/machdep.h +2 -2
@@ -88,9 +88,9 @@void (*pci_dma_dev_setup)(struct pci_dev *dev);void (*pci_dma_bus_setup)(struct pci_bus *bus); -void __iomem * (*ioremap)(unsigned long addr,unsigned long size, +void __iomem * (*ioremap)(phys_addr_t addr,unsigned long size,unsigned long flags); -void (*iounmap)(void __iomem *token); +void (*iounmap)(volatile void __iomem *token);#endif /* CONFIG_PPC64 */ int (*probe)(void );
arch/powerpc/kernel/pci_32.c +3 -31
@@ -1561,7 +1561,7 @@ *offset += hose->pci_mem_offset; res_bit =IORESOURCE_MEM ; }else { - io_offset = hose->io_base_virt - ___IO_BASE; + io_offset = hose->io_base_virt - (void __iomem *)_IO_BASE; *offset += io_offset; res_bit =IORESOURCE_IO ; }
@@ -1816,7 +1816,8 @@return ;if (rsrc->flags &IORESOURCE_IO ) - offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys; + offset = (void __iomem *)_IO_BASE - hose->io_base_virt + + hose->io_base_phys; *start = rsrc->start + offset; *end = rsrc->end + offset;
@@ -1835,35 +1836,6 @@ res->child =NULL ; } -void __iomem *pci_iomap (struct pci_dev *dev,int bar,unsigned long max) -{ -unsigned long start =pci_resource_start (dev, bar); -unsigned long len =pci_resource_len (dev, bar); -unsigned long flags =pci_resource_flags (dev, bar); - -if (!len) -return NULL ; -if (max && len > max) - len = max; -if (flags &IORESOURCE_IO ) -return ioport_map (start, len); -if (flags &IORESOURCE_MEM ) -/* Not checking IORESOURCE_CACHEABLE because PPC does -* not currently distinguish between ioremap and -* ioremap_nocache. -*/ -return ioremap (start, len); -/* What? */ -return NULL ; -} - -void pci_iounmap (struct pci_dev *dev,void __iomem *addr) -{ -/* Nothing to do */ -} -EXPORT_SYMBOL (pci_iomap); -EXPORT_SYMBOL (pci_iounmap); -unsigned long pci_address_to_pio (phys_addr_t address) {struct pci_controller * hose = hose_head;
arch/powerpc/kernel/iomap.c +1 -1
@@ -106,7 +106,7 @@void __iomem *ioport_map (unsigned long port,unsigned int len) { -return (void __iomem *) (port+pci_io_base); +return (void __iomem *) (port + _IO_BASE); }void ioport_unmap (void __iomem *addr)
include/asm-powerpc/ide.h +0 -7
@@ -22,17 +22,10 @@#endif #endif -#ifdef __powerpc64__#define __ide_mm_insw (p, a, c) readsw((void __iomem *)(p), (a), (c))#define __ide_mm_insl (p, a, c) readsl((void __iomem *)(p), (a), (c))#define __ide_mm_outsw (p, a, c) writesw((void __iomem *)(p), (a), (c))#define __ide_mm_outsl (p, a, c) writesl((void __iomem *)(p), (a), (c)) -#else -#define __ide_mm_insw (p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) -#define __ide_mm_insl (p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) -#define __ide_mm_outsw (p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) -#define __ide_mm_outsl (p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) -#endif #ifndef __powerpc64__#include <linux/hdreg.h>