Lines Matching +full:io +full:- +full:domains
1 // SPDX-License-Identifier: GPL-2.0-or-later
25 #include <asm/io.h>
26 #include <asm/pci-bridge.h>
29 #include <asm/ppc-pci.h>
31 /* pci_io_base -- the base address from which io bars are offsets.
35 * is mapped on the first 64K of IO space
51 /* On ppc64, we always enable PCI domains and we keep domain 0 in pcibios_init()
65 pci_bus_add_devices(hose->bus); in pcibios_init()
86 * mappings since we might have to deal with sub-page alignments in pcibios_unmap_io_space()
94 if (bus->self) { in pcibios_unmap_io_space()
96 struct resource *res = bus->resource[0]; in pcibios_unmap_io_space()
99 pr_debug("IO unmapping for PCI-PCI bridge %s\n", in pcibios_unmap_io_space()
100 pci_name(bus->self)); in pcibios_unmap_io_space()
103 __flush_hash_table_range(res->start + _IO_BASE, in pcibios_unmap_io_space()
104 res->end + _IO_BASE + 1); in pcibios_unmap_io_space()
112 pr_debug("IO unmapping for PHB %pOF\n", hose->dn); in pcibios_unmap_io_space()
113 pr_debug(" alloc=0x%p\n", hose->io_base_alloc); in pcibios_unmap_io_space()
115 iounmap(hose->io_base_alloc); in pcibios_unmap_io_space()
129 * Let's allocate some IO space for that guy. We don't pass VM_IOREMAP in ioremap_phb()
140 addr = (unsigned long)area->addr; in ioremap_phb()
157 phys_page = ALIGN_DOWN(hose->io_base_phys, PAGE_SIZE); in pcibios_map_phb_io_space()
158 size_page = ALIGN(hose->pci_io_size, PAGE_SIZE); in pcibios_map_phb_io_space()
160 /* Make sure IO area address is clear */ in pcibios_map_phb_io_space()
161 hose->io_base_alloc = NULL; in pcibios_map_phb_io_space()
163 /* If there's no IO to map on that bus, get away too */ in pcibios_map_phb_io_space()
164 if (hose->pci_io_size == 0 || hose->io_base_phys == 0) in pcibios_map_phb_io_space()
167 /* Let's allocate some IO space for that guy. We don't pass in pcibios_map_phb_io_space()
173 hose->io_base_alloc = ioremap_phb(phys_page, size_page); in pcibios_map_phb_io_space()
174 if (!hose->io_base_alloc) in pcibios_map_phb_io_space()
175 return -ENOMEM; in pcibios_map_phb_io_space()
176 hose->io_base_virt = hose->io_base_alloc + in pcibios_map_phb_io_space()
177 hose->io_base_phys - phys_page; in pcibios_map_phb_io_space()
179 pr_debug("IO mapping for PHB %pOF\n", hose->dn); in pcibios_map_phb_io_space()
181 hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc); in pcibios_map_phb_io_space()
183 hose->pci_io_size, size_page); in pcibios_map_phb_io_space()
185 /* Fixup hose IO resource */ in pcibios_map_phb_io_space()
187 hose->io_resource.start += io_virt_offset; in pcibios_map_phb_io_space()
188 hose->io_resource.end += io_virt_offset; in pcibios_map_phb_io_space()
190 pr_debug(" hose->io_resource=%pR\n", &hose->io_resource); in pcibios_map_phb_io_space()
202 if (bus->self) { in pcibios_map_io_space()
203 pr_debug("IO mapping for PCI-PCI bridge %s\n", in pcibios_map_io_space()
204 pci_name(bus->self)); in pcibios_map_io_space()
206 bus->resource[0]->start + _IO_BASE, in pcibios_map_io_space()
207 bus->resource[0]->end + _IO_BASE); in pcibios_map_io_space()
235 * G5 machines... So when something asks for bus 0 io base in SYSCALL_DEFINE3()
241 agp = of_find_compatible_node(NULL, NULL, "u3-agp"); in SYSCALL_DEFINE3()
247 /* That syscall isn't quite compatible with PCI domains, but it's in SYSCALL_DEFINE3()
248 * used on pre-domains setup. We return the first match in SYSCALL_DEFINE3()
252 if (in_bus >= tmp_bus->number && in SYSCALL_DEFINE3()
253 in_bus <= tmp_bus->busn_res.end) { in SYSCALL_DEFINE3()
258 if (bus == NULL || bus->dev.of_node == NULL) in SYSCALL_DEFINE3()
259 return -ENODEV; in SYSCALL_DEFINE3()
261 hose_node = bus->dev.of_node; in SYSCALL_DEFINE3()
262 hose = PCI_DN(hose_node)->phb; in SYSCALL_DEFINE3()
266 return (long)hose->first_busno; in SYSCALL_DEFINE3()
268 return (long)hose->mem_offset[0]; in SYSCALL_DEFINE3()
270 return (long)hose->io_base_phys; in SYSCALL_DEFINE3()
274 return -EINVAL; in SYSCALL_DEFINE3()
277 return -EOPNOTSUPP; in SYSCALL_DEFINE3()
284 return phb->node; in pcibus_to_node()
293 return -ENODEV; in pci_device_from_OF_node()
294 *bus = PCI_DN(np)->busno; in pci_device_from_OF_node()
295 *devfn = PCI_DN(np)->devfn; in pci_device_from_OF_node()