16 #include <linux/kernel.h>
17 #include <linux/pci.h>
18 #include <linux/string.h>
21 #include <linux/export.h>
23 #include <linux/list.h>
28 #include <asm/processor.h>
31 #include <asm/pci-bridge.h>
32 #include <asm/byteorder.h>
33 #include <asm/machdep.h>
59 pci_add_flags(PCI_ENABLE_PROC_DOMAINS | PCI_COMPAT_DOMAIN_0);
79 int pcibios_unmap_io_space(
struct pci_bus *
bus)
96 #ifdef CONFIG_PPC_STD_MMU_64
100 pr_debug(
"IO unmapping for PCI-PCI bridge %s\n",
101 pci_name(bus->
self));
103 #ifdef CONFIG_PPC_STD_MMU_64
111 hose = pci_bus_to_host(bus);
114 if (hose->io_base_alloc == 0)
117 pr_debug(
"IO unmapping for PHB %s\n", hose->dn->full_name);
118 pr_debug(
" alloc=0x%p\n", hose->io_base_alloc);
121 vunmap(hose->io_base_alloc);
132 unsigned long phys_page;
133 unsigned long size_page;
134 unsigned long io_virt_offset;
140 hose->io_base_alloc =
NULL;
143 if (hose->pci_io_size == 0 || hose->io_base_phys == 0)
155 hose->io_base_alloc = area->
addr;
157 hose->io_base_phys - phys_page);
159 pr_debug(
"IO mapping for PHB %s\n", hose->dn->full_name);
160 pr_debug(
" phys=0x%016llx, virt=0x%p (alloc=0x%p)\n",
161 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
162 pr_debug(
" size=0x%016llx (alloc=0x%016lx)\n",
163 hose->pci_io_size, size_page);
172 hose->io_resource.start += io_virt_offset;
173 hose->io_resource.end += io_virt_offset;
175 pr_debug(
" hose->io_resource=%pR\n", &hose->io_resource);
188 pr_debug(
"IO mapping for PCI-PCI bridge %s\n",
189 pci_name(bus->
self));
190 pr_debug(
" virt=0x%016llx...0x%016llx\n",
196 return pcibios_map_phb_io_space(pci_bus_to_host(bus));
202 pcibios_map_phb_io_space(hose);
205 #define IOBASE_BRIDGE_NUMBER 0
206 #define IOBASE_MEMORY 1
208 #define IOBASE_ISA_IO 3
209 #define IOBASE_ISA_MEM 4
212 unsigned long in_devfn)
237 for (ln = pci_root_buses.
next; ln != &pci_root_buses; ln = ln->
next) {
239 if (in_bus >= bus->
number && in_bus <= bus->busn_res.end)
246 hose_node = bus->
dev.of_node;
247 hose = PCI_DN(hose_node)->phb;
253 return (
long)hose->pci_mem_offset;
255 return (
long)hose->io_base_phys;