[PATCH] PCI: remove CONFIG_PCI_NAMES
[safe/jmp/linux-2.6] / arch / ppc64 / kernel / pci.c
index be3cc38..b5ca7d8 100644 (file)
@@ -84,7 +84,6 @@ static void fixup_broken_pcnet32(struct pci_dev* dev)
        if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
                dev->vendor = PCI_VENDOR_ID_AMD;
                pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD);
-               pci_name_device(dev);
        }
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
@@ -108,8 +107,28 @@ void  pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region
        region->end = res->end - offset;
 }
 
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+                             struct pci_bus_region *region)
+{
+       unsigned long offset = 0;
+       struct pci_controller *hose = pci_bus_to_host(dev->bus);
+
+       if (!hose)
+               return;
+
+       if (res->flags & IORESOURCE_IO)
+               offset = (unsigned long)hose->io_base_virt - pci_io_base;
+
+       if (res->flags & IORESOURCE_MEM)
+               offset = hose->pci_mem_offset;
+
+       res->start = region->start + offset;
+       res->end = region->end + offset;
+}
+
 #ifdef CONFIG_HOTPLUG
 EXPORT_SYMBOL(pcibios_resource_to_bus);
+EXPORT_SYMBOL(pcibios_bus_to_resource);
 #endif
 
 /*
@@ -351,7 +370,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
                *offset += hose->pci_mem_offset;
                res_bit = IORESOURCE_MEM;
        } else {
-               io_offset = (unsigned long)hose->io_base_virt;
+               io_offset = (unsigned long)hose->io_base_virt - pci_io_base;
                *offset += io_offset;
                res_bit = IORESOURCE_IO;
        }
@@ -378,7 +397,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
 
                /* found it! construct the final physical address */
                if (mmap_state == pci_mmap_io)
-                       *offset += hose->io_base_phys - io_offset;
+                       *offset += hose->io_base_phys - io_offset;
                return rp;
        }
 
@@ -438,7 +457,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
        int i;
 
        if (page_is_ram(offset >> PAGE_SHIFT))
-               return prot;
+               return __pgprot(prot);
 
        prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
 
@@ -507,7 +526,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 }
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
-static ssize_t pci_show_devspec(struct device *dev, char *buf)
+static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct pci_dev *pdev;
        struct device_node *np;
@@ -902,6 +921,9 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
        list_for_each_entry(dev, &bus->devices, bus_list)
                ppc_md.iommu_dev_setup(dev);
 
+       if (ppc_md.irq_bus_setup)
+               ppc_md.irq_bus_setup(bus);
+
        if (!pci_probe_only)
                return;
 
@@ -941,4 +963,22 @@ int pci_read_irq_line(struct pci_dev *pci_dev)
 }
 EXPORT_SYMBOL(pci_read_irq_line);
 
+void pci_resource_to_user(const struct pci_dev *dev, int bar,
+                         const struct resource *rsrc,
+                         u64 *start, u64 *end)
+{
+       struct pci_controller *hose = pci_bus_to_host(dev->bus);
+       unsigned long offset = 0;
+
+       if (hose == NULL)
+               return;
+
+       if (rsrc->flags & IORESOURCE_IO)
+               offset = pci_io_base - (unsigned long)hose->io_base_virt +
+                       hose->io_base_phys;
+
+       *start = rsrc->start + offset;
+       *end = rsrc->end + offset;
+}
+
 #endif /* CONFIG_PPC_MULTIPLATFORM */