[PATCH 1/3] powerpc: Updated remove io_page_mask

Michael Neuling mikey at neuling.org
Tue Nov 1 18:14:41 EST 2005


From: Anton Blanchard <anton at samba.org>

Retransmit of Anton's patch from here:

http://ozlabs.org/pipermail/linuxppc64-dev/2005-May/003922.html

Updated for merge tree.

Signed-off-by: Michael Neuling <mikey at neuling.org>

 arch/powerpc/platforms/iseries/pci.c  |    3 ---
 arch/powerpc/platforms/maple/pci.c    |    3 ---
 arch/powerpc/platforms/powermac/pci.c |    3 ---
 arch/ppc64/kernel/iomap.c             |    2 --
 arch/ppc64/kernel/pci.c               |   30 +++---------------------------
 include/asm-ppc64/eeh.h               |   15 +++------------
 include/asm-ppc64/io.h                |    6 ------
 7 files changed, 6 insertions(+), 56 deletions(-)

Index: linux-2.6/arch/powerpc/platforms/iseries/pci.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/iseries/pci.c	2005-11-01 10:30:35.000000000 +1100
+++ linux-2.6/arch/powerpc/platforms/iseries/pci.c	2005-11-01 11:04:27.000000000 +1100
@@ -45,8 +45,6 @@
 #include "pci.h"
 #include "call_pci.h"
 
-extern unsigned long io_page_mask;
-
 /*
  * Forward declares of prototypes.
  */
@@ -288,7 +286,6 @@
 	PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Entry.\n");
 	iomm_table_initialize();
 	find_and_init_phbs();
-	io_page_mask = -1;
 	PPCDBG(PPCDBG_BUSWALK, "iSeries_pcibios_init Exit.\n");
 }
 
Index: linux-2.6/arch/powerpc/platforms/maple/pci.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/maple/pci.c	2005-11-01 10:30:35.000000000 +1100
+++ linux-2.6/arch/powerpc/platforms/maple/pci.c	2005-11-01 11:06:30.000000000 +1100
@@ -455,9 +455,6 @@
 
 	/* Tell pci.c to use the common resource allocation mecanism */
 	pci_probe_only = 0;
-	
-	/* Allow all IO */
-	io_page_mask = -1;
 }
 
 int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
Index: linux-2.6/arch/powerpc/platforms/powermac/pci.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/powermac/pci.c	2005-11-01 10:30:35.000000000 +1100
+++ linux-2.6/arch/powerpc/platforms/powermac/pci.c	2005-11-01 11:10:07.000000000 +1100
@@ -926,9 +926,6 @@
 	/* Tell pci.c to not use the common resource allocation mechanism */
 	pci_probe_only = 1;
 
-	/* Allow all IO */
-	io_page_mask = -1;
-
 #else /* CONFIG_PPC64 */
 	init_p2pbridge();
 	fixup_nec_usb2();
Index: linux-2.6/arch/ppc64/kernel/iomap.c
===================================================================
--- linux-2.6.orig/arch/ppc64/kernel/iomap.c	2005-11-01 10:30:32.000000000 +1100
+++ linux-2.6/arch/ppc64/kernel/iomap.c	2005-11-01 11:05:01.000000000 +1100
@@ -108,8 +108,6 @@
 
 void __iomem *ioport_map(unsigned long port, unsigned int len)
 {
-	if (!_IO_IS_VALID(port))
-		return NULL;
 	return (void __iomem *) (port+pci_io_base);
 }
 
Index: linux-2.6/arch/ppc64/kernel/pci.c
===================================================================
--- linux-2.6.orig/arch/ppc64/kernel/pci.c	2005-11-01 10:30:35.000000000 +1100
+++ linux-2.6/arch/ppc64/kernel/pci.c	2005-11-01 11:08:44.000000000 +1100
@@ -42,14 +42,6 @@
 unsigned long pci_probe_only = 1;
 unsigned long pci_assign_all_buses = 0;
 
-/*
- * legal IO pages under MAX_ISA_PORT.  This is to ensure we don't touch
- * devices we don't have access to.
- */
-unsigned long io_page_mask;
-
-EXPORT_SYMBOL(io_page_mask);
-
 #ifdef CONFIG_PPC_MULTIPLATFORM
 static void fixup_resource(struct resource *res, struct pci_dev *dev);
 static void do_bus_setup(struct pci_bus *bus);
@@ -995,8 +987,6 @@
 			pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys,
 						hose->io_base_virt);
 			of_node_put(isa_dn);
-			/* Allow all IO */
-			io_page_mask = -1;
 		}
 	}
 
@@ -1132,27 +1122,13 @@
 static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
 {
 	struct pci_controller *hose = pci_bus_to_host(dev->bus);
-	unsigned long start, end, mask, offset;
+	unsigned long offset;
 
 	if (res->flags & IORESOURCE_IO) {
 		offset = (unsigned long)hose->io_base_virt - pci_io_base;
 
-		start = res->start += offset;
-		end = res->end += offset;
-
-		/* Need to allow IO access to pages that are in the
-		   ISA range */
-		if (start < MAX_ISA_PORT) {
-			if (end > MAX_ISA_PORT)
-				end = MAX_ISA_PORT;
-
-			start >>= PAGE_SHIFT;
-			end >>= PAGE_SHIFT;
-
-			/* get the range of pages for the map */
-			mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1);
-			io_page_mask |= mask;
-		}
+		res->start += offset;
+		res->end += offset;
 	} else if (res->flags & IORESOURCE_MEM) {
 		res->start += hose->pci_mem_offset;
 		res->end += hose->pci_mem_offset;
Index: linux-2.6/include/asm-ppc64/eeh.h
===================================================================
--- linux-2.6.orig/include/asm-ppc64/eeh.h	2005-11-01 10:30:32.000000000 +1100
+++ linux-2.6/include/asm-ppc64/eeh.h	2005-11-01 11:13:05.000000000 +1100
@@ -311,8 +311,6 @@
 static inline u8 eeh_inb(unsigned long port)
 {
 	u8 val;
-	if (!_IO_IS_VALID(port))
-		return ~0;
 	val = in_8((u8 __iomem *)(port+pci_io_base));
 	if (EEH_POSSIBLE_ERROR(val, u8))
 		return eeh_check_failure((void __iomem *)(port), val);
@@ -321,15 +319,12 @@
 
 static inline void eeh_outb(u8 val, unsigned long port)
 {
-	if (_IO_IS_VALID(port))
-		out_8((u8 __iomem *)(port+pci_io_base), val);
+	out_8((u8 __iomem *)(port+pci_io_base), val);
 }
 
 static inline u16 eeh_inw(unsigned long port)
 {
 	u16 val;
-	if (!_IO_IS_VALID(port))
-		return ~0;
 	val = in_le16((u16 __iomem *)(port+pci_io_base));
 	if (EEH_POSSIBLE_ERROR(val, u16))
 		return eeh_check_failure((void __iomem *)(port), val);
@@ -338,15 +333,12 @@
 
 static inline void eeh_outw(u16 val, unsigned long port)
 {
-	if (_IO_IS_VALID(port))
-		out_le16((u16 __iomem *)(port+pci_io_base), val);
+	out_le16((u16 __iomem *)(port+pci_io_base), val);
 }
 
 static inline u32 eeh_inl(unsigned long port)
 {
 	u32 val;
-	if (!_IO_IS_VALID(port))
-		return ~0;
 	val = in_le32((u32 __iomem *)(port+pci_io_base));
 	if (EEH_POSSIBLE_ERROR(val, u32))
 		return eeh_check_failure((void __iomem *)(port), val);
@@ -355,8 +347,7 @@
 
 static inline void eeh_outl(u32 val, unsigned long port)
 {
-	if (_IO_IS_VALID(port))
-		out_le32((u32 __iomem *)(port+pci_io_base), val);
+	out_le32((u32 __iomem *)(port+pci_io_base), val);
 }
 
 /* in-string eeh macros */
Index: linux-2.6/include/asm-ppc64/io.h
===================================================================
--- linux-2.6.orig/include/asm-ppc64/io.h	2005-11-01 10:30:35.000000000 +1100
+++ linux-2.6/include/asm-ppc64/io.h	2005-11-01 11:13:40.000000000 +1100
@@ -33,12 +33,6 @@
 
 extern unsigned long isa_io_base;
 extern unsigned long pci_io_base;
-extern unsigned long io_page_mask;
-
-#define MAX_ISA_PORT 0x10000
-
-#define _IO_IS_VALID(port) ((port) >= MAX_ISA_PORT || (1 << (port>>PAGE_SHIFT)) \
-			    & io_page_mask)
 
 #ifdef CONFIG_PPC_ISERIES
 /* __raw_* accessors aren't supported on iSeries */



More information about the Linuxppc64-dev mailing list