aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/pci/pci-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/pci/pci-common.c')
-rw-r--r--arch/microblaze/pci/pci-common.c95
1 files changed, 43 insertions, 52 deletions
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 96416553cb36..bdb8ea100e73 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -33,7 +33,7 @@
33#include <linux/export.h> 33#include <linux/export.h>
34 34
35#include <asm/processor.h> 35#include <asm/processor.h>
36#include <asm/io.h> 36#include <linux/io.h>
37#include <asm/pci-bridge.h> 37#include <asm/pci-bridge.h>
38#include <asm/byteorder.h> 38#include <asm/byteorder.h>
39 39
@@ -552,11 +552,10 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
552 */ 552 */
553 if ((offset + size) > hose->isa_mem_size) { 553 if ((offset + size) > hose->isa_mem_size) {
554#ifdef CONFIG_MMU 554#ifdef CONFIG_MMU
555 printk(KERN_DEBUG 555 pr_debug("Process %s (pid:%d) mapped non-existing PCI",
556 "Process %s (pid:%d) mapped non-existing PCI" 556 current->comm, current->pid);
557 "legacy memory for 0%04x:%02x\n", 557 pr_debug("legacy memory for 0%04x:%02x\n",
558 current->comm, current->pid, pci_domain_nr(bus), 558 pci_domain_nr(bus), bus->number);
559 bus->number);
560#endif 559#endif
561 if (vma->vm_flags & VM_SHARED) 560 if (vma->vm_flags & VM_SHARED)
562 return shmem_zero_setup(vma); 561 return shmem_zero_setup(vma);
@@ -564,7 +563,7 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
564 } 563 }
565 offset += hose->isa_mem_phys; 564 offset += hose->isa_mem_phys;
566 } else { 565 } else {
567 unsigned long io_offset = (unsigned long)hose->io_base_virt - \ 566 unsigned long io_offset = (unsigned long)hose->io_base_virt -
568 _IO_BASE; 567 _IO_BASE;
569 unsigned long roffset = offset + io_offset; 568 unsigned long roffset = offset + io_offset;
570 rp = &hose->io_resource; 569 rp = &hose->io_resource;
@@ -668,7 +667,7 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
668 unsigned long long isa_mb = 0; 667 unsigned long long isa_mb = 0;
669 struct resource *res; 668 struct resource *res;
670 669
671 printk(KERN_INFO "PCI host bridge %s %s ranges:\n", 670 pr_info("PCI host bridge %s %s ranges:\n",
672 dev->full_name, primary ? "(primary)" : ""); 671 dev->full_name, primary ? "(primary)" : "");
673 672
674 /* Get ranges property */ 673 /* Get ranges property */
@@ -685,9 +684,10 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
685 cpu_addr = of_translate_address(dev, ranges + 3); 684 cpu_addr = of_translate_address(dev, ranges + 3);
686 size = of_read_number(ranges + pna + 3, 2); 685 size = of_read_number(ranges + pna + 3, 2);
687 686
688 pr_debug("pci_space: 0x%08x pci_addr:0x%016llx " 687 pr_debug("pci_space: 0x%08x pci_addr:0x%016llx ",
689 "cpu_addr:0x%016llx size:0x%016llx\n", 688 pci_space, pci_addr);
690 pci_space, pci_addr, cpu_addr, size); 689 pr_debug("cpu_addr:0x%016llx size:0x%016llx\n",
690 cpu_addr, size);
691 691
692 ranges += np; 692 ranges += np;
693 693
@@ -716,14 +716,12 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
716 res = NULL; 716 res = NULL;
717 switch ((pci_space >> 24) & 0x3) { 717 switch ((pci_space >> 24) & 0x3) {
718 case 1: /* PCI IO space */ 718 case 1: /* PCI IO space */
719 printk(KERN_INFO 719 pr_info(" IO 0x%016llx..0x%016llx -> 0x%016llx\n",
720 " IO 0x%016llx..0x%016llx -> 0x%016llx\n",
721 cpu_addr, cpu_addr + size - 1, pci_addr); 720 cpu_addr, cpu_addr + size - 1, pci_addr);
722 721
723 /* We support only one IO range */ 722 /* We support only one IO range */
724 if (hose->pci_io_size) { 723 if (hose->pci_io_size) {
725 printk(KERN_INFO 724 pr_info(" \\--> Skipped (too many) !\n");
726 " \\--> Skipped (too many) !\n");
727 continue; 725 continue;
728 } 726 }
729 /* On 32 bits, limit I/O space to 16MB */ 727 /* On 32 bits, limit I/O space to 16MB */
@@ -750,15 +748,13 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
750 break; 748 break;
751 case 2: /* PCI Memory space */ 749 case 2: /* PCI Memory space */
752 case 3: /* PCI 64 bits Memory space */ 750 case 3: /* PCI 64 bits Memory space */
753 printk(KERN_INFO 751 pr_info(" MEM 0x%016llx..0x%016llx -> 0x%016llx %s\n",
754 " MEM 0x%016llx..0x%016llx -> 0x%016llx %s\n",
755 cpu_addr, cpu_addr + size - 1, pci_addr, 752 cpu_addr, cpu_addr + size - 1, pci_addr,
756 (pci_space & 0x40000000) ? "Prefetch" : ""); 753 (pci_space & 0x40000000) ? "Prefetch" : "");
757 754
758 /* We support only 3 memory ranges */ 755 /* We support only 3 memory ranges */
759 if (memno >= 3) { 756 if (memno >= 3) {
760 printk(KERN_INFO 757 pr_info(" \\--> Skipped (too many) !\n");
761 " \\--> Skipped (too many) !\n");
762 continue; 758 continue;
763 } 759 }
764 /* Handles ISA memory hole space here */ 760 /* Handles ISA memory hole space here */
@@ -781,8 +777,7 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
781 hose->pci_mem_offset = cpu_addr - pci_addr; 777 hose->pci_mem_offset = cpu_addr - pci_addr;
782 else if (pci_addr != 0 && 778 else if (pci_addr != 0 &&
783 hose->pci_mem_offset != cpu_addr - pci_addr) { 779 hose->pci_mem_offset != cpu_addr - pci_addr) {
784 printk(KERN_INFO 780 pr_info(" \\--> Skipped (offset mismatch) !\n");
785 " \\--> Skipped (offset mismatch) !\n");
786 continue; 781 continue;
787 } 782 }
788 783
@@ -809,7 +804,7 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
809 */ 804 */
810 if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) { 805 if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) {
811 unsigned int next = isa_hole + 1; 806 unsigned int next = isa_hole + 1;
812 printk(KERN_INFO " Removing ISA hole at 0x%016llx\n", isa_mb); 807 pr_info(" Removing ISA hole at 0x%016llx\n", isa_mb);
813 if (next < memno) 808 if (next < memno)
814 memmove(&hose->mem_resources[isa_hole], 809 memmove(&hose->mem_resources[isa_hole],
815 &hose->mem_resources[next], 810 &hose->mem_resources[next],
@@ -833,7 +828,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
833 int i; 828 int i;
834 829
835 if (!hose) { 830 if (!hose) {
836 printk(KERN_ERR "No host bridge for PCI dev %s !\n", 831 pr_err("No host bridge for PCI dev %s !\n",
837 pci_name(dev)); 832 pci_name(dev));
838 return; 833 return;
839 } 834 }
@@ -842,12 +837,12 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
842 if (!res->flags) 837 if (!res->flags)
843 continue; 838 continue;
844 if (res->start == 0) { 839 if (res->start == 0) {
845 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]" \ 840 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]",
846 "is unassigned\n",
847 pci_name(dev), i, 841 pci_name(dev), i,
848 (unsigned long long)res->start, 842 (unsigned long long)res->start,
849 (unsigned long long)res->end, 843 (unsigned long long)res->end,
850 (unsigned int)res->flags); 844 (unsigned int)res->flags);
845 pr_debug("is unassigned\n");
851 res->end -= res->start; 846 res->end -= res->start;
852 res->start = 0; 847 res->start = 0;
853 res->flags |= IORESOURCE_UNSET; 848 res->flags |= IORESOURCE_UNSET;
@@ -856,7 +851,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
856 851
857 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n", 852 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n",
858 pci_name(dev), i, 853 pci_name(dev), i,
859 (unsigned long long)res->start,\ 854 (unsigned long long)res->start,
860 (unsigned long long)res->end, 855 (unsigned long long)res->end,
861 (unsigned int)res->flags); 856 (unsigned int)res->flags);
862 } 857 }
@@ -947,7 +942,7 @@ static void pcibios_fixup_bridge(struct pci_bus *bus)
947 942
948 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n", 943 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x] fixup...\n",
949 pci_name(dev), i, 944 pci_name(dev), i,
950 (unsigned long long)res->start,\ 945 (unsigned long long)res->start,
951 (unsigned long long)res->end, 946 (unsigned long long)res->end,
952 (unsigned int)res->flags); 947 (unsigned int)res->flags);
953 948
@@ -1154,12 +1149,12 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1154 } 1149 }
1155 } 1150 }
1156 1151
1157 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx " 1152 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx ",
1158 "[0x%x], parent %p (%s)\n",
1159 bus->self ? pci_name(bus->self) : "PHB", 1153 bus->self ? pci_name(bus->self) : "PHB",
1160 bus->number, i, 1154 bus->number, i,
1161 (unsigned long long)res->start, 1155 (unsigned long long)res->start,
1162 (unsigned long long)res->end, 1156 (unsigned long long)res->end);
1157 pr_debug("[0x%x], parent %p (%s)\n",
1163 (unsigned int)res->flags, 1158 (unsigned int)res->flags,
1164 pr, (pr && pr->name) ? pr->name : "nil"); 1159 pr, (pr && pr->name) ? pr->name : "nil");
1165 1160
@@ -1174,9 +1169,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1174 if (reparent_resources(pr, res) == 0) 1169 if (reparent_resources(pr, res) == 0)
1175 continue; 1170 continue;
1176 } 1171 }
1177 printk(KERN_WARNING "PCI: Cannot allocate resource region " 1172 pr_warn("PCI: Cannot allocate resource region ");
1178 "%d of PCI bridge %d, will remap\n", i, bus->number); 1173 pr_cont("%d of PCI bridge %d, will remap\n", i, bus->number);
1179
1180 res->start = res->end = 0; 1174 res->start = res->end = 0;
1181 res->flags = 0; 1175 res->flags = 0;
1182 } 1176 }
@@ -1198,8 +1192,8 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
1198 pr = pci_find_parent_resource(dev, r); 1192 pr = pci_find_parent_resource(dev, r);
1199 if (!pr || (pr->flags & IORESOURCE_UNSET) || 1193 if (!pr || (pr->flags & IORESOURCE_UNSET) ||
1200 request_resource(pr, r) < 0) { 1194 request_resource(pr, r) < 0) {
1201 printk(KERN_WARNING "PCI: Cannot allocate resource region %d" 1195 pr_warn("PCI: Cannot allocate resource region %d ", idx);
1202 " of device %s, will remap\n", idx, pci_name(dev)); 1196 pr_cont("of device %s, will remap\n", pci_name(dev));
1203 if (pr) 1197 if (pr)
1204 pr_debug("PCI: parent is %p: %016llx-%016llx [%x]\n", 1198 pr_debug("PCI: parent is %p: %016llx-%016llx [%x]\n",
1205 pr, 1199 pr,
@@ -1282,8 +1276,7 @@ static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus)
1282 res->end = (offset + 0xfff) & 0xfffffffful; 1276 res->end = (offset + 0xfff) & 0xfffffffful;
1283 pr_debug("Candidate legacy IO: %pR\n", res); 1277 pr_debug("Candidate legacy IO: %pR\n", res);
1284 if (request_resource(&hose->io_resource, res)) { 1278 if (request_resource(&hose->io_resource, res)) {
1285 printk(KERN_DEBUG 1279 pr_debug("PCI %04x:%02x Cannot reserve Legacy IO %pR\n",
1286 "PCI %04x:%02x Cannot reserve Legacy IO %pR\n",
1287 pci_domain_nr(bus), bus->number, res); 1280 pci_domain_nr(bus), bus->number, res);
1288 kfree(res); 1281 kfree(res);
1289 } 1282 }
@@ -1311,8 +1304,7 @@ static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus)
1311 res->end = 0xbffff + offset; 1304 res->end = 0xbffff + offset;
1312 pr_debug("Candidate VGA memory: %pR\n", res); 1305 pr_debug("Candidate VGA memory: %pR\n", res);
1313 if (request_resource(pres, res)) { 1306 if (request_resource(pres, res)) {
1314 printk(KERN_DEBUG 1307 pr_debug("PCI %04x:%02x Cannot reserve VGA memory %pR\n",
1315 "PCI %04x:%02x Cannot reserve VGA memory %pR\n",
1316 pci_domain_nr(bus), bus->number, res); 1308 pci_domain_nr(bus), bus->number, res);
1317 kfree(res); 1309 kfree(res);
1318 } 1310 }
@@ -1362,10 +1354,9 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1362 if (r->parent || !r->start || !r->flags) 1354 if (r->parent || !r->start || !r->flags)
1363 continue; 1355 continue;
1364 1356
1365 pr_debug("PCI: Claiming %s: " 1357 pr_debug("PCI: Claiming %s: ", pci_name(dev));
1366 "Resource %d: %016llx..%016llx [%x]\n", 1358 pr_debug("Resource %d: %016llx..%016llx [%x]\n",
1367 pci_name(dev), i, 1359 i, (unsigned long long)r->start,
1368 (unsigned long long)r->start,
1369 (unsigned long long)r->end, 1360 (unsigned long long)r->end,
1370 (unsigned int)r->flags); 1361 (unsigned int)r->flags);
1371 1362
@@ -1423,9 +1414,9 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1423 res->end = (res->end + io_offset) & 0xffffffffu; 1414 res->end = (res->end + io_offset) & 0xffffffffu;
1424 1415
1425 if (!res->flags) { 1416 if (!res->flags) {
1426 printk(KERN_WARNING "PCI: I/O resource not set for host" 1417 pr_warn("PCI: I/O resource not set for host ");
1427 " bridge %s (domain %d)\n", 1418 pr_cont("bridge %s (domain %d)\n",
1428 hose->dn->full_name, hose->global_number); 1419 hose->dn->full_name, hose->global_number);
1429 /* Workaround for lack of IO resource only on 32-bit */ 1420 /* Workaround for lack of IO resource only on 32-bit */
1430 res->start = (unsigned long)hose->io_base_virt - isa_io_base; 1421 res->start = (unsigned long)hose->io_base_virt - isa_io_base;
1431 res->end = res->start + IO_SPACE_LIMIT; 1422 res->end = res->start + IO_SPACE_LIMIT;
@@ -1445,9 +1436,9 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1445 if (!res->flags) { 1436 if (!res->flags) {
1446 if (i > 0) 1437 if (i > 0)
1447 continue; 1438 continue;
1448 printk(KERN_ERR "PCI: Memory resource 0 not set for " 1439 pr_err("PCI: Memory resource 0 not set for ");
1449 "host bridge %s (domain %d)\n", 1440 pr_cont("host bridge %s (domain %d)\n",
1450 hose->dn->full_name, hose->global_number); 1441 hose->dn->full_name, hose->global_number);
1451 1442
1452 /* Workaround for lack of MEM resource only on 32-bit */ 1443 /* Workaround for lack of MEM resource only on 32-bit */
1453 res->start = hose->pci_mem_offset; 1444 res->start = hose->pci_mem_offset;
@@ -1489,7 +1480,7 @@ static void pcibios_scan_phb(struct pci_controller *hose)
1489 bus = pci_scan_root_bus(hose->parent, hose->first_busno, 1480 bus = pci_scan_root_bus(hose->parent, hose->first_busno,
1490 hose->ops, hose, &resources); 1481 hose->ops, hose, &resources);
1491 if (bus == NULL) { 1482 if (bus == NULL) {
1492 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", 1483 pr_err("Failed to create bus for PCI domain %04x\n",
1493 hose->global_number); 1484 hose->global_number);
1494 pci_free_resource_list(&resources); 1485 pci_free_resource_list(&resources);
1495 return; 1486 return;
@@ -1505,7 +1496,7 @@ static int __init pcibios_init(void)
1505 struct pci_controller *hose, *tmp; 1496 struct pci_controller *hose, *tmp;
1506 int next_busno = 0; 1497 int next_busno = 0;
1507 1498
1508 printk(KERN_INFO "PCI: Probing PCI hardware\n"); 1499 pr_info("PCI: Probing PCI hardware\n");
1509 1500
1510 /* Scan all of the recorded PCI controllers. */ 1501 /* Scan all of the recorded PCI controllers. */
1511 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 1502 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
@@ -1605,7 +1596,7 @@ fake_pci_bus(struct pci_controller *hose, int busnr)
1605 static struct pci_bus bus; 1596 static struct pci_bus bus;
1606 1597
1607 if (!hose) 1598 if (!hose)
1608 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr); 1599 pr_err("Can't find hose for PCI bus %d!\n", busnr);
1609 1600
1610 bus.number = busnr; 1601 bus.number = busnr;
1611 bus.sysdata = hose; 1602 bus.sysdata = hose;