diff options
Diffstat (limited to 'arch/powerpc/kernel/pci_64.c')
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 62 |
1 files changed, 23 insertions, 39 deletions
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 4c4449be81ce..5ad87c426bed 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -42,14 +42,6 @@ | |||
42 | unsigned long pci_probe_only = 1; | 42 | unsigned long pci_probe_only = 1; |
43 | int pci_assign_all_buses = 0; | 43 | int pci_assign_all_buses = 0; |
44 | 44 | ||
45 | /* | ||
46 | * legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch | ||
47 | * devices we don't have access to. | ||
48 | */ | ||
49 | unsigned long io_page_mask; | ||
50 | |||
51 | EXPORT_SYMBOL(io_page_mask); | ||
52 | |||
53 | #ifdef CONFIG_PPC_MULTIPLATFORM | 45 | #ifdef CONFIG_PPC_MULTIPLATFORM |
54 | static void fixup_resource(struct resource *res, struct pci_dev *dev); | 46 | static void fixup_resource(struct resource *res, struct pci_dev *dev); |
55 | static void do_bus_setup(struct pci_bus *bus); | 47 | static void do_bus_setup(struct pci_bus *bus); |
@@ -235,8 +227,10 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev) | |||
235 | pci_setup_pci_controller(phb); | 227 | pci_setup_pci_controller(phb); |
236 | phb->arch_data = dev; | 228 | phb->arch_data = dev; |
237 | phb->is_dynamic = mem_init_done; | 229 | phb->is_dynamic = mem_init_done; |
238 | if (dev) | 230 | if (dev) { |
231 | PHB_SET_NODE(phb, of_node_to_nid(dev)); | ||
239 | add_linux_pci_domain(dev, phb); | 232 | add_linux_pci_domain(dev, phb); |
233 | } | ||
240 | return phb; | 234 | return phb; |
241 | } | 235 | } |
242 | 236 | ||
@@ -396,7 +390,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, | |||
396 | 390 | ||
397 | dev->current_state = 4; /* unknown power state */ | 391 | dev->current_state = 4; /* unknown power state */ |
398 | 392 | ||
399 | if (!strcmp(type, "pci")) { | 393 | if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { |
400 | /* a PCI-PCI bridge */ | 394 | /* a PCI-PCI bridge */ |
401 | dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; | 395 | dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; |
402 | dev->rom_base_reg = PCI_ROM_ADDRESS1; | 396 | dev->rom_base_reg = PCI_ROM_ADDRESS1; |
@@ -605,7 +599,7 @@ static int __init pcibios_init(void) | |||
605 | iSeries_pcibios_init(); | 599 | iSeries_pcibios_init(); |
606 | #endif | 600 | #endif |
607 | 601 | ||
608 | printk("PCI: Probing PCI hardware\n"); | 602 | printk(KERN_DEBUG "PCI: Probing PCI hardware\n"); |
609 | 603 | ||
610 | /* Scan all of the recorded PCI controllers. */ | 604 | /* Scan all of the recorded PCI controllers. */ |
611 | list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { | 605 | list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { |
@@ -630,14 +624,14 @@ static int __init pcibios_init(void) | |||
630 | /* Cache the location of the ISA bridge (if we have one) */ | 624 | /* Cache the location of the ISA bridge (if we have one) */ |
631 | ppc64_isabridge_dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); | 625 | ppc64_isabridge_dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); |
632 | if (ppc64_isabridge_dev != NULL) | 626 | if (ppc64_isabridge_dev != NULL) |
633 | printk("ISA bridge at %s\n", pci_name(ppc64_isabridge_dev)); | 627 | printk(KERN_DEBUG "ISA bridge at %s\n", pci_name(ppc64_isabridge_dev)); |
634 | 628 | ||
635 | #ifdef CONFIG_PPC_MULTIPLATFORM | 629 | #ifdef CONFIG_PPC_MULTIPLATFORM |
636 | /* map in PCI I/O space */ | 630 | /* map in PCI I/O space */ |
637 | phbs_remap_io(); | 631 | phbs_remap_io(); |
638 | #endif | 632 | #endif |
639 | 633 | ||
640 | printk("PCI: Probing PCI hardware done\n"); | 634 | printk(KERN_DEBUG "PCI: Probing PCI hardware done\n"); |
641 | 635 | ||
642 | return 0; | 636 | return 0; |
643 | } | 637 | } |
@@ -804,7 +798,7 @@ static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp, | |||
804 | else | 798 | else |
805 | prot |= _PAGE_GUARDED; | 799 | prot |= _PAGE_GUARDED; |
806 | 800 | ||
807 | printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, | 801 | printk(KERN_DEBUG "PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start, |
808 | prot); | 802 | prot); |
809 | 803 | ||
810 | return __pgprot(prot); | 804 | return __pgprot(prot); |
@@ -894,8 +888,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
894 | return ret; | 888 | return ret; |
895 | } | 889 | } |
896 | 890 | ||
897 | #ifdef CONFIG_PPC_MULTIPLATFORM | 891 | static ssize_t pci_show_devspec(struct device *dev, |
898 | static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf) | 892 | struct device_attribute *attr, char *buf) |
899 | { | 893 | { |
900 | struct pci_dev *pdev; | 894 | struct pci_dev *pdev; |
901 | struct device_node *np; | 895 | struct device_node *np; |
@@ -907,13 +901,10 @@ static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *att | |||
907 | return sprintf(buf, "%s", np->full_name); | 901 | return sprintf(buf, "%s", np->full_name); |
908 | } | 902 | } |
909 | static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); | 903 | static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); |
910 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
911 | 904 | ||
912 | void pcibios_add_platform_entries(struct pci_dev *pdev) | 905 | void pcibios_add_platform_entries(struct pci_dev *pdev) |
913 | { | 906 | { |
914 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
915 | device_create_file(&pdev->dev, &dev_attr_devspec); | 907 | device_create_file(&pdev->dev, &dev_attr_devspec); |
916 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | ||
917 | } | 908 | } |
918 | 909 | ||
919 | #ifdef CONFIG_PPC_MULTIPLATFORM | 910 | #ifdef CONFIG_PPC_MULTIPLATFORM |
@@ -1104,8 +1095,6 @@ void __init pci_setup_phb_io(struct pci_controller *hose, int primary) | |||
1104 | pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys, | 1095 | pci_process_ISA_OF_ranges(isa_dn, hose->io_base_phys, |
1105 | hose->io_base_virt); | 1096 | hose->io_base_virt); |
1106 | of_node_put(isa_dn); | 1097 | of_node_put(isa_dn); |
1107 | /* Allow all IO */ | ||
1108 | io_page_mask = -1; | ||
1109 | } | 1098 | } |
1110 | } | 1099 | } |
1111 | 1100 | ||
@@ -1212,7 +1201,7 @@ int remap_bus_range(struct pci_bus *bus) | |||
1212 | return 1; | 1201 | return 1; |
1213 | if (start_phys == 0) | 1202 | if (start_phys == 0) |
1214 | return 1; | 1203 | return 1; |
1215 | printk("mapping IO %lx -> %lx, size: %lx\n", start_phys, start_virt, size); | 1204 | printk(KERN_DEBUG "mapping IO %lx -> %lx, size: %lx\n", start_phys, start_virt, size); |
1216 | if (__ioremap_explicit(start_phys, start_virt, size, | 1205 | if (__ioremap_explicit(start_phys, start_virt, size, |
1217 | _PAGE_NO_CACHE | _PAGE_GUARDED)) | 1206 | _PAGE_NO_CACHE | _PAGE_GUARDED)) |
1218 | return 1; | 1207 | return 1; |
@@ -1232,27 +1221,13 @@ static void phbs_remap_io(void) | |||
1232 | static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) | 1221 | static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) |
1233 | { | 1222 | { |
1234 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | 1223 | struct pci_controller *hose = pci_bus_to_host(dev->bus); |
1235 | unsigned long start, end, mask, offset; | 1224 | unsigned long offset; |
1236 | 1225 | ||
1237 | if (res->flags & IORESOURCE_IO) { | 1226 | if (res->flags & IORESOURCE_IO) { |
1238 | offset = (unsigned long)hose->io_base_virt - pci_io_base; | 1227 | offset = (unsigned long)hose->io_base_virt - pci_io_base; |
1239 | 1228 | ||
1240 | start = res->start += offset; | 1229 | res->start += offset; |
1241 | end = res->end += offset; | 1230 | res->end += offset; |
1242 | |||
1243 | /* Need to allow IO access to pages that are in the | ||
1244 | ISA range */ | ||
1245 | if (start < MAX_ISA_PORT) { | ||
1246 | if (end > MAX_ISA_PORT) | ||
1247 | end = MAX_ISA_PORT; | ||
1248 | |||
1249 | start >>= PAGE_SHIFT; | ||
1250 | end >>= PAGE_SHIFT; | ||
1251 | |||
1252 | /* get the range of pages for the map */ | ||
1253 | mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1); | ||
1254 | io_page_mask |= mask; | ||
1255 | } | ||
1256 | } else if (res->flags & IORESOURCE_MEM) { | 1231 | } else if (res->flags & IORESOURCE_MEM) { |
1257 | res->start += hose->pci_mem_offset; | 1232 | res->start += hose->pci_mem_offset; |
1258 | res->end += hose->pci_mem_offset; | 1233 | res->end += hose->pci_mem_offset; |
@@ -1442,3 +1417,12 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, | |||
1442 | 1417 | ||
1443 | return -EOPNOTSUPP; | 1418 | return -EOPNOTSUPP; |
1444 | } | 1419 | } |
1420 | |||
1421 | #ifdef CONFIG_NUMA | ||
1422 | int pcibus_to_node(struct pci_bus *bus) | ||
1423 | { | ||
1424 | struct pci_controller *phb = pci_bus_to_host(bus); | ||
1425 | return phb->node; | ||
1426 | } | ||
1427 | EXPORT_SYMBOL(pcibus_to_node); | ||
1428 | #endif | ||