Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

microblaze/pci: Move the remains of pci_32.c to pci-common.c

There's no point in keeping this separate. Even if microblaze grows
a 64-bit variant, it will probably be able to re-use that code as-is

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michal Simek <monstr@monstr.eu>
Acked-by: Grant Likely <grant.likely@secretlab.ca>

+113 -139
+1 -1
arch/microblaze/pci/Makefile
··· 2 2 # Makefile 3 3 # 4 4 5 - obj-$(CONFIG_PCI) += pci_32.o pci-common.o indirect_pci.o iomap.o 5 + obj-$(CONFIG_PCI) += pci-common.o indirect_pci.o iomap.o 6 6 obj-$(CONFIG_PCI_XILINX) += xilinx_pci.o
+112
arch/microblaze/pci/pci-common.c
··· 50 50 51 51 static struct dma_map_ops *pci_dma_ops = &dma_direct_ops; 52 52 53 + unsigned long isa_io_base; 54 + unsigned long pci_dram_offset; 55 + static int pci_bus_count; 56 + 57 + 53 58 void set_pci_dma_ops(struct dma_map_ops *dma_ops) 54 59 { 55 60 pci_dma_ops = dma_ops; ··· 1563 1558 (unsigned long)hose->io_base_virt - _IO_BASE); 1564 1559 } 1565 1560 1561 + struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) 1562 + { 1563 + struct pci_controller *hose = bus->sysdata; 1564 + 1565 + return of_node_get(hose->dn); 1566 + } 1567 + 1568 + static void __devinit pcibios_scan_phb(struct pci_controller *hose) 1569 + { 1570 + struct pci_bus *bus; 1571 + struct device_node *node = hose->dn; 1572 + unsigned long io_offset; 1573 + struct resource *res = &hose->io_resource; 1574 + 1575 + pr_debug("PCI: Scanning PHB %s\n", 1576 + node ? node->full_name : "<NO NAME>"); 1577 + 1578 + /* Create an empty bus for the toplevel */ 1579 + bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose); 1580 + if (bus == NULL) { 1581 + printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", 1582 + hose->global_number); 1583 + return; 1584 + } 1585 + bus->secondary = hose->first_busno; 1586 + hose->bus = bus; 1587 + 1588 + /* Fixup IO space offset */ 1589 + io_offset = (unsigned long)hose->io_base_virt - isa_io_base; 1590 + res->start = (res->start + io_offset) & 0xffffffffu; 1591 + res->end = (res->end + io_offset) & 0xffffffffu; 1592 + 1593 + /* Wire up PHB bus resources */ 1594 + pcibios_setup_phb_resources(hose); 1595 + 1596 + /* Scan children */ 1597 + hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); 1598 + } 1599 + 1600 + static int __init pcibios_init(void) 1601 + { 1602 + struct pci_controller *hose, *tmp; 1603 + int next_busno = 0; 1604 + 1605 + printk(KERN_INFO "PCI: Probing PCI hardware\n"); 1606 + 1607 + /* Scan all of the recorded PCI controllers. */ 1608 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 1609 + hose->last_busno = 0xff; 1610 + pcibios_scan_phb(hose); 1611 + printk(KERN_INFO "calling pci_bus_add_devices()\n"); 1612 + pci_bus_add_devices(hose->bus); 1613 + if (next_busno <= hose->last_busno) 1614 + next_busno = hose->last_busno + 1; 1615 + } 1616 + pci_bus_count = next_busno; 1617 + 1618 + /* Call common code to handle resource allocation */ 1619 + pcibios_resource_survey(); 1620 + 1621 + return 0; 1622 + } 1623 + 1624 + subsys_initcall(pcibios_init); 1625 + 1626 + static struct pci_controller *pci_bus_to_hose(int bus) 1627 + { 1628 + struct pci_controller *hose, *tmp; 1629 + 1630 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) 1631 + if (bus >= hose->first_busno && bus <= hose->last_busno) 1632 + return hose; 1633 + return NULL; 1634 + } 1635 + 1636 + /* Provide information on locations of various I/O regions in physical 1637 + * memory. Do this on a per-card basis so that we choose the right 1638 + * root bridge. 1639 + * Note that the returned IO or memory base is a physical address 1640 + */ 1641 + 1642 + long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) 1643 + { 1644 + struct pci_controller *hose; 1645 + long result = -EOPNOTSUPP; 1646 + 1647 + hose = pci_bus_to_hose(bus); 1648 + if (!hose) 1649 + return -ENODEV; 1650 + 1651 + switch (which) { 1652 + case IOBASE_BRIDGE_NUMBER: 1653 + return (long)hose->first_busno; 1654 + case IOBASE_MEMORY: 1655 + return (long)hose->pci_mem_offset; 1656 + case IOBASE_IO: 1657 + return (long)hose->io_base_phys; 1658 + case IOBASE_ISA_IO: 1659 + return (long)isa_io_base; 1660 + case IOBASE_ISA_MEM: 1661 + return (long)isa_mem_base; 1662 + } 1663 + 1664 + return result; 1665 + } 1666 + 1566 1667 /* 1567 1668 * Null PCI config access functions, for the case when we can't 1568 1669 * find a hose. ··· 1737 1626 { 1738 1627 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap); 1739 1628 } 1629 +
-138
arch/microblaze/pci/pci_32.c
··· 1 - /* 2 - * Common pmac/prep/chrp pci routines. -- Cort 3 - */ 4 - 5 - #include <linux/kernel.h> 6 - #include <linux/pci.h> 7 - #include <linux/delay.h> 8 - #include <linux/string.h> 9 - #include <linux/init.h> 10 - #include <linux/capability.h> 11 - #include <linux/sched.h> 12 - #include <linux/errno.h> 13 - #include <linux/bootmem.h> 14 - #include <linux/irq.h> 15 - #include <linux/list.h> 16 - #include <linux/of.h> 17 - #include <linux/slab.h> 18 - 19 - #include <asm/processor.h> 20 - #include <asm/io.h> 21 - #include <asm/prom.h> 22 - #include <asm/sections.h> 23 - #include <asm/pci-bridge.h> 24 - #include <asm/byteorder.h> 25 - #include <asm/uaccess.h> 26 - 27 - #undef DEBUG 28 - 29 - unsigned long isa_io_base; 30 - unsigned long pci_dram_offset; 31 - static int pci_bus_count; 32 - 33 - struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) 34 - { 35 - struct pci_controller *hose = bus->sysdata; 36 - 37 - return of_node_get(hose->dn); 38 - } 39 - 40 - static void __devinit pcibios_scan_phb(struct pci_controller *hose) 41 - { 42 - struct pci_bus *bus; 43 - struct device_node *node = hose->dn; 44 - unsigned long io_offset; 45 - struct resource *res = &hose->io_resource; 46 - 47 - pr_debug("PCI: Scanning PHB %s\n", 48 - node ? node->full_name : "<NO NAME>"); 49 - 50 - /* Create an empty bus for the toplevel */ 51 - bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose); 52 - if (bus == NULL) { 53 - printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", 54 - hose->global_number); 55 - return; 56 - } 57 - bus->secondary = hose->first_busno; 58 - hose->bus = bus; 59 - 60 - /* Fixup IO space offset */ 61 - io_offset = (unsigned long)hose->io_base_virt - isa_io_base; 62 - res->start = (res->start + io_offset) & 0xffffffffu; 63 - res->end = (res->end + io_offset) & 0xffffffffu; 64 - 65 - /* Wire up PHB bus resources */ 66 - pcibios_setup_phb_resources(hose); 67 - 68 - /* Scan children */ 69 - hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); 70 - } 71 - 72 - static int __init pcibios_init(void) 73 - { 74 - struct pci_controller *hose, *tmp; 75 - int next_busno = 0; 76 - 77 - printk(KERN_INFO "PCI: Probing PCI hardware\n"); 78 - 79 - /* Scan all of the recorded PCI controllers. */ 80 - list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 81 - hose->last_busno = 0xff; 82 - pcibios_scan_phb(hose); 83 - printk(KERN_INFO "calling pci_bus_add_devices()\n"); 84 - pci_bus_add_devices(hose->bus); 85 - if (next_busno <= hose->last_busno) 86 - next_busno = hose->last_busno + 1; 87 - } 88 - pci_bus_count = next_busno; 89 - 90 - /* Call common code to handle resource allocation */ 91 - pcibios_resource_survey(); 92 - 93 - return 0; 94 - } 95 - 96 - subsys_initcall(pcibios_init); 97 - 98 - static struct pci_controller* 99 - pci_bus_to_hose(int bus) 100 - { 101 - struct pci_controller *hose, *tmp; 102 - 103 - list_for_each_entry_safe(hose, tmp, &hose_list, list_node) 104 - if (bus >= hose->first_busno && bus <= hose->last_busno) 105 - return hose; 106 - return NULL; 107 - } 108 - 109 - /* Provide information on locations of various I/O regions in physical 110 - * memory. Do this on a per-card basis so that we choose the right 111 - * root bridge. 112 - * Note that the returned IO or memory base is a physical address 113 - */ 114 - 115 - long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) 116 - { 117 - struct pci_controller *hose; 118 - long result = -EOPNOTSUPP; 119 - 120 - hose = pci_bus_to_hose(bus); 121 - if (!hose) 122 - return -ENODEV; 123 - 124 - switch (which) { 125 - case IOBASE_BRIDGE_NUMBER: 126 - return (long)hose->first_busno; 127 - case IOBASE_MEMORY: 128 - return (long)hose->pci_mem_offset; 129 - case IOBASE_IO: 130 - return (long)hose->io_base_phys; 131 - case IOBASE_ISA_IO: 132 - return (long)isa_io_base; 133 - case IOBASE_ISA_MEM: 134 - return (long)isa_mem_base; 135 - } 136 - 137 - return result; 138 - }