patch-2.4.0-test7 linux/arch/arm/kernel/bios32.c

Next file: linux/arch/arm/kernel/calls.S
Previous file: linux/arch/arm/kernel/armksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/arch/arm/kernel/bios32.c linux/arch/arm/kernel/bios32.c
@@ -11,7 +11,7 @@
 #include <linux/init.h>
 
 #include <asm/irq.h>
-#include <asm/system.h>
+#include <asm/mach-types.h>
 
 #include "bios32.h"
 
@@ -198,20 +198,35 @@
 pcibios_update_resource(struct pci_dev *dev, struct resource *root,
 			struct resource *res, int resource)
 {
-	unsigned long where, size;
-	u32 reg;
+	u32 val, check;
+	int reg;
 
 	if (debug_pci)
 		printk("PCI: Assigning %3s %08lx to %s\n",
 			res->flags & IORESOURCE_IO ? "IO" : "MEM",
 			res->start, dev->name);
 
-	where = PCI_BASE_ADDRESS_0 + resource * 4;
-	size  = res->end - res->start;
-
-	pci_read_config_dword(dev, where, &reg);
-	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
-	pci_write_config_dword(dev, where, reg);
+	val = res->start | (res->flags & PCI_REGION_FLAG_MASK);
+	if (resource < 6) {
+		reg = PCI_BASE_ADDRESS_0 + 4*resource;
+	} else if (resource == PCI_ROM_RESOURCE) {
+		res->flags |= PCI_ROM_ADDRESS_ENABLE;
+		val |= PCI_ROM_ADDRESS_ENABLE;
+		reg = dev->rom_base_reg;
+	} else {
+		/* Somebody might have asked allocation of a
+		 * non-standard resource.
+		 */
+		return;
+	}
+	pci_write_config_dword(dev, reg, val);
+	pci_read_config_dword(dev, reg, &check);
+	if ((val ^ check) & ((val & PCI_BASE_ADDRESS_SPACE_IO) ?
+	    PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
+		printk(KERN_ERR "PCI: Error while updating region "
+			"%s/%d (%08x != %08x)\n", dev->slot_name,
+			resource, val, check);
+	}
 }
 
 void __init pcibios_update_irq(struct pci_dev *dev, int irq)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)