[PATCH] remove io_page_mask

Anton Blanchard anton at samba.org
Wed May 4 14:37:45 EST 2005


Hi Jake,

I found an issue with the io_page_mask code when pci_probe_only is not
set (we dont initialise io_page_mask and bad things happen). I was 
about to fix it up when I wondered if we can remove it now.

Ben changed the serial code to check before it goes pounding on
addresses. Im not sure if there were other issues with badly behaving
drivers but my js20 boots here with the following removal patch.

Thoughts?

Anton

Index: foobar2/include/asm-ppc64/io.h
===================================================================
--- foobar2.orig/include/asm-ppc64/io.h	2005-05-04 13:51:41.245647479 +1000
+++ foobar2/include/asm-ppc64/io.h	2005-05-04 13:55:14.823405718 +1000
@@ -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 */
Index: foobar2/include/asm-ppc64/eeh.h
===================================================================
--- foobar2.orig/include/asm-ppc64/eeh.h	2005-05-04 13:51:41.246647403 +1000
+++ foobar2/include/asm-ppc64/eeh.h	2005-05-04 13:55:14.825405566 +1000
@@ -310,8 +310,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);
@@ -320,15 +318,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);
@@ -337,15 +332,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);
@@ -354,8 +346,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: foobar2/arch/ppc64/kernel/iSeries_pci.c
===================================================================
--- foobar2.orig/arch/ppc64/kernel/iSeries_pci.c	2005-05-04 13:55:12.042223389 +1000
+++ foobar2/arch/ppc64/kernel/iSeries_pci.c	2005-05-04 13:55:52.221213083 +1000
@@ -47,8 +47,6 @@
 
 #include "pci.h"
 
-extern unsigned long io_page_mask;
-
 /*
  * Forward declares of prototypes. 
  */
@@ -291,7 +289,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: foobar2/arch/ppc64/kernel/pci.c
===================================================================
--- foobar2.orig/arch/ppc64/kernel/pci.c	2005-05-04 13:55:12.047223007 +1000
+++ foobar2/arch/ppc64/kernel/pci.c	2005-05-04 13:55:52.226212702 +1000
@@ -42,15 +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);
-
-
 unsigned int pcibios_assign_all_busses(void)
 {
 	return pci_assign_all_buses;
@@ -674,8 +665,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;
 		}
 	}
 
@@ -837,24 +826,9 @@
 		if (dev->resource[i].flags & IORESOURCE_IO) {
 			unsigned long offset = (unsigned long)hose->io_base_virt
 				- pci_io_base;
-                        unsigned long start, end, mask;
-
-                        start = dev->resource[i].start += offset;
-                        end = dev->resource[i].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;
-                        }
+                        dev->resource[i].start += offset;
+                        dev->resource[i].end += offset;
 		}
                 else if (dev->resource[i].flags & IORESOURCE_MEM) {
 			dev->resource[i].start += hose->pci_mem_offset;
Index: foobar2/arch/ppc64/kernel/maple_pci.c
===================================================================
--- foobar2.orig/arch/ppc64/kernel/maple_pci.c	2005-05-04 13:55:12.044223236 +1000
+++ foobar2/arch/ppc64/kernel/maple_pci.c	2005-05-04 13:55:52.223212931 +1000
@@ -454,9 +454,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: foobar2/arch/ppc64/kernel/pmac_pci.c
===================================================================
--- foobar2.orig/arch/ppc64/kernel/pmac_pci.c	2005-05-04 13:55:12.050222778 +1000
+++ foobar2/arch/ppc64/kernel/pmac_pci.c	2005-05-04 13:55:52.228212549 +1000
@@ -755,9 +755,6 @@
 
 	/* Tell pci.c to not use the common resource allocation mecanism */
 	pci_probe_only = 1;
-	
-	/* Allow all IO */
-	io_page_mask = -1;
 }
 
 /*
Index: foobar2/arch/ppc64/kernel/iomap.c
===================================================================
--- foobar2.orig/arch/ppc64/kernel/iomap.c	2005-05-04 13:16:13.000000000 +1000
+++ foobar2/arch/ppc64/kernel/iomap.c	2005-05-04 14:02:43.887671757 +1000
@@ -88,8 +88,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);
 }
 



More information about the Linuxppc64-dev mailing list