[parisc-linux-cvs] Elroy fixups

Matthew Wilcox willy@debian.org
Mon, 3 Sep 2001 23:56:20 +0100


 * Do fixups for each device's IO port space.  Fixes a bug on
   non-PAT machines.
 * Don't subtract 1 from the IO port space that elroy can claim.

Index: arch/parisc/kernel/lba_pci.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/lba_pci.c,v
retrieving revision 1.34
diff -u -p -r1.34 lba_pci.c
--- lba_pci.c	2001/08/28 08:15:09	1.34
+++ lba_pci.c	2001/09/03 21:22:47
@@ -707,9 +707,8 @@ lba_fixup_bus(struct pci_bus *bus)
 	u16 status;
 #endif
 	struct lba_device *ldev = LBA_DEV(bus->sysdata);
-#ifdef __LP64__
-	int i;
-#endif
+	int lba_portbase = HBA_PORT_BASE(ldev->hba.hba_num);
+
 	DBG("lba_fixup_bus(0x%p) bus %d sysdata 0x%p\n",
 		bus, bus->secondary, bus->sysdata);
 
@@ -788,26 +787,28 @@ lba_fixup_bus(struct pci_bus *bus)
 
 
 	list_for_each(ln, &bus->devices) {
+		int i;
 		struct pci_dev *dev = pci_dev_b(ln);
 
-#ifdef __LP64__
-		/*
-		** Virtualize Device/Bridge Resources.
-		*/
+		/* Virtualize Device/Bridge Resources. */
 		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
-			struct resource *res = &(dev->resource[i]);
+			struct resource *res = &dev->resource[i];
 
 			/* If resource not allocated - skip it */
 			if (!res->start)
 				continue;
 
-			if (res->flags & IORESOURCE_MEM) {
+			if (res->flags & IORESOURCE_IO) {
+				res->start |= lba_portbase;
+				res->end   |= lba_portbase;
+#ifdef __LP64__
+			} else if (res->flags & IORESOURCE_MEM) {
 				/* "Globalize" PCI address */
 				res->start |= ldev->lmmio_base;
 				res->end   |= ldev->lmmio_base;
+#endif
 			}
 		}
-#endif
 
 #ifdef FBB_SUPPORT
 		/*
@@ -1189,8 +1190,7 @@ lba_legacy_resources(struct parisc_devic
 	r->name  = "LBA PCI I/O Ports";
 	r->flags = IORESOURCE_IO;
 	r->start = READ_REG32(pa_dev->hpa + LBA_IOS_BASE) & ~1L;
-	r->end   = r->start +
-	    (READ_REG32(pa_dev->hpa + LBA_IOS_MASK) ^ (HBA_PORT_SPACE_SIZE - 1)) - 1;
+	r->end   = r->start + (READ_REG32(pa_dev->hpa + LBA_IOS_MASK) ^ (HBA_PORT_SPACE_SIZE - 1));
 
 	/* Virtualize the I/O Port space ranges */
 	lba_num = HBA_PORT_BASE(lba_dev->hba.hba_num);

-- 
Revolutions do not require corporate support.