* Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx> wrote: > diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c > index 5ead808..6e3f22c 100644 > --- a/arch/x86/pci/i386.c > +++ b/arch/x86/pci/i386.c > @@ -78,6 +78,47 @@ pcibios_align_resource(void *data, struct resource *res, > } > EXPORT_SYMBOL(pcibios_align_resource); > > +static struct resource mem64 = { > + .name = "PCI mem64", > + .start = (resource_size_t)(1 << 16) << 16, /* 4Gb */ > + .end = -1, > + .flags = IORESOURCE_MEM, > +}; > + > +static void pcibios_pci64_setup(void) > +{ > + struct resource *r64 = &mem64, *root = &iomem_resource; > + struct pci_bus *b; > + > + if (!r64->start) > + return; /* 32-bit phys. address, nothing to do */ > + > + if (insert_resource(root, r64)) { > + printk(KERN_WARNING "PCI: Failed to allocate PCI64 space\n"); > + return; > + } > + > + list_for_each_entry(b, &pci_root_buses, node) { > + /* Is this a "standard" root bus created by pci_create_bus? */ > + if (b->resource[1] != root || b->resource[2]) > + continue; > + b->resource[2] = r64; /* create DAC resource */ > + } > +} > + > +static void pcibios_pci64_verify(void) > +{ > + struct pci_bus *b; > + > + if (mem64.flags & IORESOURCE_MEM64) > + return; /* presumably DAC works */ > + list_for_each_entry(b, &pci_root_buses, node) { > + if (b->resource[2] == &mem64) > + b->resource[2] = NULL; > + } > + printk(KERN_INFO "PCI: allocations above 4G disabled\n"); > +} The principle of probing + tearing down the mem64 resource if no bridge is 64-bit looks worth trying, but i'd suggest a different code structure to better handle true 32-bit systems built with 32-bit resource_size_t: - move this new code into a new file, arch/x86/pci/dac_64bit.c - build this file only if CONFIG_PHYS_ADDR_T_64BIT is set - add inline functions for pcibios_pci64_setup() and pcibios_pci64_verify() in the !CONFIG_PHYS_ADDR_T_64BIT case. That way this code wont be built into the kernel on true 32-bit systems. This check can then go away as well. > + if (!r64->start) > + return; /* 32-bit phys. address, nothing to do */ Furthermore, the filenames are very confusing in the arch/x86/pci/ directory and should be cleaned up ASAP. At minimum we should do: git mv arch/x86/pci/pcbios.c arch/x86/pci/bios_32.c git mv arch/x86/pci/i386.c arch/x86/pci/bios.c (and fix up the Makefile.) There's nothing 32-bit about "i386.c", the 64-bit x86 platform code uses it too! Also, this one: > + if (insert_resource(root, r64)) { > + printk(KERN_WARNING "PCI: Failed to allocate PCI64 space\n"); > + return; > + } Should be a more prominent WARN(), not a printk. We can only hit this path if the x86 platform and the PCI probing code is buggy, and we want to fix such bugs. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html