asm-generic/io.h: Fix ioport_map() for !CONFIG_GENERIC_IOMAP
authorLiviu Dudau <Liviu.Dudau@arm.com>
Mon, 29 Sep 2014 14:29:20 +0000 (15:29 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 30 Sep 2014 15:42:44 +0000 (09:42 -0600)
The !CONFIG_GENERIC_IOMAP version of ioport_map() is wrong.  It returns a
mapped, i.e., virtual, address that can start from zero and completely
ignores the PCI_IOBASE and IO_SPACE_LIMIT that most architectures that use
!CONFIG_GENERIC_MAP define.

Tested-by: Tanmay Inamdar <tinamdar@apm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
include/asm-generic/io.h

index 975e1cc75edb55f9dcd19530eb08912b220e2641..b8fdc57a733515b8b0b031da68ac5a9f8eda74ae 100644 (file)
@@ -331,7 +331,7 @@ static inline void iounmap(void __iomem *addr)
 #ifndef CONFIG_GENERIC_IOMAP
 static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
 {
-       return (void __iomem *) port;
+       return PCI_IOBASE + (port & IO_SPACE_LIMIT);
 }
 
 static inline void ioport_unmap(void __iomem *p)