Subject: [PATCH] PCI: cap resource allocation for 32bit bar for all archititures Should not limit to x86 platform, that is pci requirement. Add PCI_MAX_RESOURCE_32 and use that instead. Also kill PCIBIOS_MAX_MEM_32. Signed-off-by: Yinghai Lu --- arch/x86/include/asm/pci.h | 1 - drivers/pci/bus.c | 4 ++-- drivers/pci/pci.h | 3 +++ include/linux/pci.h | 4 ---- 4 files changed, 5 insertions(+), 7 deletions(-) Index: linux-2.6/drivers/pci/bus.c =================================================================== --- linux-2.6.orig/drivers/pci/bus.c +++ linux-2.6/drivers/pci/bus.c @@ -121,13 +121,13 @@ pci_bus_alloc_resource(struct pci_bus *b { int i, ret = -ENOMEM; struct resource *r; - resource_size_t max = -1; + resource_size_t max = PCI_MAX_RESOURCE; type_mask |= IORESOURCE_IO | IORESOURCE_MEM; /* don't allocate too high if the pref mem doesn't support 64bit*/ if (!(res->flags & IORESOURCE_MEM_64)) - max = PCIBIOS_MAX_MEM_32; + max = PCI_MAX_RESOURCE_32; pci_bus_for_each_resource(bus, r, i) { if (!r) Index: linux-2.6/drivers/pci/pci.h =================================================================== --- linux-2.6.orig/drivers/pci/pci.h +++ linux-2.6/drivers/pci/pci.h @@ -208,6 +208,9 @@ enum pci_bar_type { pci_bar_mem64, /* A 64-bit memory BAR */ }; +#define PCI_MAX_RESOURCE ((resource_size_t)~0) +#define PCI_MAX_RESOURCE_32 ((resource_size_t)0xffffffff) + bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *pl, int crs_timeout); extern int pci_setup_device(struct pci_dev *dev); Index: linux-2.6/arch/x86/include/asm/pci.h =================================================================== --- linux-2.6.orig/arch/x86/include/asm/pci.h +++ linux-2.6/arch/x86/include/asm/pci.h @@ -149,7 +149,6 @@ void default_restore_msi_irqs(struct pci /* generic pci stuff */ #include -#define PCIBIOS_MAX_MEM_32 0xffffffff #ifdef CONFIG_NUMA /* Returns the node based on pci bus */ Index: linux-2.6/include/linux/pci.h =================================================================== --- linux-2.6.orig/include/linux/pci.h +++ linux-2.6/include/linux/pci.h @@ -1340,10 +1340,6 @@ static inline int pci_domain_nr(struct p #include -#ifndef PCIBIOS_MAX_MEM_32 -#define PCIBIOS_MAX_MEM_32 (-1) -#endif - /* these helpers provide future and backwards compatibility * for accessing popular PCI BAR info */ #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)