This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / pci / probe.c
index 1c70dd5..e88017d 100644 (file)
@@ -144,11 +144,9 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
                        pci_write_config_dword(dev, reg+4, ~0);
                        pci_read_config_dword(dev, reg+4, &sz);
                        pci_write_config_dword(dev, reg+4, l);
-                       sz = pci_size(l, sz, 0xffffffff);
-                       if (sz) {
-                               /* This BAR needs > 4GB?  Wow. */
-                               res->end |= (unsigned long)sz<<32;
-                       }
+                       if (~sz)
+                               res->end = res->start + 0xffffffff +
+                                               (((unsigned long) ~sz) << 32);
 #else
                        if (l) {
                                printk(KERN_ERR "PCI: Unable to handle 64-bit address for device %s\n", pci_name(dev));
@@ -172,7 +170,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
                if (sz && sz != 0xffffffff) {
                        sz = pci_size(l, sz, PCI_ROM_ADDRESS_MASK);
                        if (sz) {
-                               res->flags = (l & IORESOURCE_ROM_ENABLE) |
+                               res->flags = (l & PCI_ROM_ADDRESS_ENABLE) |
                                  IORESOURCE_MEM | IORESOURCE_PREFETCH |
                                  IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
                                res->start = l & PCI_ROM_ADDRESS_MASK;
@@ -245,23 +243,15 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
                u32 mem_base_hi, mem_limit_hi;
                pci_read_config_dword(dev, PCI_PREF_BASE_UPPER32, &mem_base_hi);
                pci_read_config_dword(dev, PCI_PREF_LIMIT_UPPER32, &mem_limit_hi);
-
-               /*
-                * Some bridges set the base > limit by default, and some
-                * (broken) BIOSes do not initialize them.  If we find
-                * this, just assume they are not being used.
-                */
-               if (mem_base_hi <= mem_limit_hi) {
 #if BITS_PER_LONG == 64
-                       base |= ((long) mem_base_hi) << 32;
-                       limit |= ((long) mem_limit_hi) << 32;
+               base |= ((long) mem_base_hi) << 32;
+               limit |= ((long) mem_limit_hi) << 32;
 #else
-                       if (mem_base_hi || mem_limit_hi) {
-                               printk(KERN_ERR "PCI: Unable to handle 64-bit address space for bridge %s\n", pci_name(dev));
-                               return;
-                       }
-#endif
+               if (mem_base_hi || mem_limit_hi) {
+                       printk(KERN_ERR "PCI: Unable to handle 64-bit address space for %s\n", child->name);
+                       return;
                }
+#endif
        }
        if (base <= limit) {
                res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
@@ -488,9 +478,6 @@ static int pci_setup_device(struct pci_dev * dev)
        /* "Unknown power state" */
        dev->current_state = 4;
 
-       /* Early fixups, before probing the BARs */
-       pci_fixup_device(pci_fixup_early, dev);
-
        switch (dev->hdr_type) {                    /* header type */
        case PCI_HEADER_TYPE_NORMAL:                /* standard header */
                if (class == PCI_CLASS_BRIDGE_PCI)
@@ -766,7 +753,6 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
 
 struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata)
 {
-       int error;
        struct pci_bus *b;
        struct device *dev;
 
@@ -786,7 +772,9 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
        if (pci_find_bus(pci_domain_nr(b), bus)) {
                /* If we already got to this bus through a different bridge, ignore it */
                DBG("PCI: Bus %02x already known\n", bus);
-               goto err_out;
+               kfree(dev);
+               kfree(b);
+               return NULL;
        }
        list_add_tail(&b->node, &pci_root_buses);
 
@@ -794,23 +782,15 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
        dev->parent = parent;
        dev->release = pci_release_bus_bridge_dev;
        sprintf(dev->bus_id, "pci%04x:%02x", pci_domain_nr(b), bus);
-       error = device_register(dev);
-       if (error)
-               goto dev_reg_err;
+       device_register(dev);
        b->bridge = get_device(dev);
 
        b->class_dev.class = &pcibus_class;
        sprintf(b->class_dev.class_id, "%04x:%02x", pci_domain_nr(b), bus);
-       error = class_device_register(&b->class_dev);
-       if (error)
-               goto class_dev_reg_err;
-       error = class_device_create_file(&b->class_dev, &class_device_attr_cpuaffinity);
-       if (error)
-               goto class_dev_create_file_err;
+       class_device_register(&b->class_dev);
+       class_device_create_file(&b->class_dev, &class_device_attr_cpuaffinity);
 
-       error = sysfs_create_link(&b->class_dev.kobj, &b->bridge->kobj, "bridge");
-       if (error)
-               goto sys_create_link_err;
+       sysfs_create_link(&b->class_dev.kobj, &b->bridge->kobj, "bridge");
 
        b->number = b->secondary = bus;
        b->resource[0] = &ioport_resource;
@@ -821,19 +801,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
        pci_bus_add_devices(b);
 
        return b;
-
-sys_create_link_err:
-       class_device_remove_file(&b->class_dev, &class_device_attr_cpuaffinity);
-class_dev_create_file_err:
-       class_device_unregister(&b->class_dev);
-class_dev_reg_err:
-       device_unregister(dev);
-dev_reg_err:
-       list_del(&b->node);
-err_out:
-       kfree(dev);
-       kfree(b);
-       return NULL;
 }
 EXPORT_SYMBOL(pci_scan_bus_parented);