vserver 1.9.5.x5
[linux-2.6.git] / arch / i386 / pci / i386.c
index 2ebc7c6..7a7b35a 100644 (file)
@@ -96,15 +96,13 @@ pcibios_align_resource(void *data, struct resource *res,
 
 static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
 {
-       struct list_head *ln;
        struct pci_bus *bus;
        struct pci_dev *dev;
        int idx;
        struct resource *r, *pr;
 
        /* Depth-First Search on bus tree */
-       for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
-               bus = pci_bus_b(ln);
+       list_for_each_entry(bus, bus_list, node) {
                if ((dev = bus->self)) {
                        for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
                                r = &dev->resource[idx];
@@ -126,7 +124,7 @@ static void __init pcibios_allocate_resources(int pass)
        u16 command;
        struct resource *r, *pr;
 
-       while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+       while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
                pci_read_config_word(dev, PCI_COMMAND, &command);
                for(idx = 0; idx < 6; idx++) {
                        r = &dev->resource[idx];
@@ -164,13 +162,13 @@ static void __init pcibios_allocate_resources(int pass)
        }
 }
 
-static void __init pcibios_assign_resources(void)
+static int __init pcibios_assign_resources(void)
 {
        struct pci_dev *dev = NULL;
        int idx;
        struct resource *r;
 
-       while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+       while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
                int class = dev->class >> 8;
 
                /* Don't touch classless devices and host bridges */
@@ -204,6 +202,7 @@ static void __init pcibios_assign_resources(void)
                                pci_assign_resource(dev, PCI_ROM_RESOURCE);
                }
        }
+       return 0;
 }
 
 void __init pcibios_resource_survey(void)
@@ -212,9 +211,14 @@ void __init pcibios_resource_survey(void)
        pcibios_allocate_bus_resources(&pci_root_buses);
        pcibios_allocate_resources(0);
        pcibios_allocate_resources(1);
-       pcibios_assign_resources();
 }
 
+/**
+ * called in fs_initcall (one below subsys_initcall),
+ * give a chance for motherboard reserve resources
+ */
+fs_initcall(pcibios_assign_resources);
+
 int pcibios_enable_resources(struct pci_dev *dev, int mask)
 {
        u16 cmd, old_cmd;
@@ -291,7 +295,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
        /* Write-combine setting is ignored, it is changed via the mtrr
         * interfaces on this platform.
         */
-       if (remap_page_range(vma, vma->vm_start, vma->vm_pgoff << PAGE_SHIFT,
+       if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
                             vma->vm_end - vma->vm_start,
                             vma->vm_page_prot))
                return -EAGAIN;