Lines Matching refs:hose
78 static resource_size_t pcibios_io_size(const struct pci_controller *hose)
80 return resource_size(&hose->io_resource);
86 struct pci_controller *hose;
90 list_for_each_entry(hose, &hose_list, list_node) {
91 size = pcibios_io_size(hose);
92 if (address >= hose->io_base_virt &&
93 address < (hose->io_base_virt + size)) {
104 struct pci_controller *hose;
109 list_for_each_entry(hose, &hose_list, list_node) {
110 size = pcibios_io_size(hose);
111 if (address >= hose->io_base_phys &&
112 address < (hose->io_base_phys + size)) {
114 (unsigned long)hose->io_base_virt - _IO_BASE;
115 ret = base + (address - hose->io_base_phys);
135 struct pci_controller *hose, *tmp;
136 list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
137 if (hose->dn == node)
138 return hose;
155 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
158 if (!hose)
162 ioaddr -= (unsigned long)hose->io_base_virt - _IO_BASE;
164 vma->vm_pgoff += (ioaddr + hose->io_base_phys) >> PAGE_SHIFT;
221 struct pci_controller *hose = pci_bus_to_host(bus);
222 struct resource *rp = &hose->io_resource;
230 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
237 addr = hose->io_base_virt + port;
261 struct pci_controller *hose = pci_bus_to_host(bus);
262 struct resource *rp = &hose->io_resource;
270 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
277 addr = hose->io_base_virt + port;
307 struct pci_controller *hose = pci_bus_to_host(bus);
327 if ((offset + size) > hose->isa_mem_size) {
338 offset += hose->isa_mem_phys;
340 unsigned long io_offset = (unsigned long)hose->io_base_virt -
343 rp = &hose->io_resource;
348 offset += hose->io_base_phys;
386 * @hose: newly allocated pci_controller to be setup
417 void pci_process_bridge_OF_ranges(struct pci_controller *hose,
454 if (hose->pci_io_size) {
463 hose->io_base_virt = ioremap(range.cpu_addr,
469 (unsigned long)hose->io_base_virt;
473 hose->pci_io_size = range.pci_addr + range.size;
474 hose->io_base_phys = range.cpu_addr - range.pci_addr;
477 res = &hose->io_resource;
499 hose->isa_mem_phys = range.cpu_addr;
500 hose->isa_mem_size = range.size;
509 hose->pci_mem_offset == isa_mb))
510 hose->pci_mem_offset = range.cpu_addr -
513 hose->pci_mem_offset != range.cpu_addr -
520 res = &hose->mem_resources[memno++];
536 if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) {
540 memmove(&hose->mem_resources[isa_hole],
541 &hose->mem_resources[next],
543 hose->mem_resources[--memno].flags = 0;
558 struct pci_controller *hose = pci_bus_to_host(dev->bus);
561 if (!hose) {
818 struct pci_controller *hose = pci_bus_to_host(bus);
827 if (!(hose->io_resource.flags & IORESOURCE_IO))
829 offset = (unsigned long)hose->io_base_virt - _IO_BASE;
837 if (request_resource(&hose->io_resource, res)) {
845 offset = hose->pci_mem_offset;
846 pr_debug("hose mem offset: %016llx\n", (unsigned long long)offset);
848 pres = &hose->mem_resources[i];
851 pr_debug("hose mem res: %pR\n", pres);
897 static void pcibios_setup_phb_resources(struct pci_controller *hose,
905 res = &hose->io_resource;
908 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
915 hose->dn, hose->global_number);
917 res->start = (unsigned long)hose->io_base_virt - isa_io_base;
922 (__force resource_size_t)(hose->io_base_virt - _IO_BASE));
931 res = &hose->mem_resources[i];
937 hose->dn, hose->global_number);
940 res->start = hose->pci_mem_offset;
945 pci_add_resource_offset(resources, res, hose->pci_mem_offset);
954 (unsigned long long)hose->pci_mem_offset);
956 (unsigned long)hose->io_base_virt - _IO_BASE);
959 static void pcibios_scan_phb(struct pci_controller *hose)
963 struct device_node *node = hose->dn;
967 pcibios_setup_phb_resources(hose, &resources);
969 bus = pci_scan_root_bus(hose->parent, hose->first_busno,
970 hose->ops, hose, &resources);
973 hose->global_number);
977 bus->busn_res.start = hose->first_busno;
978 hose->bus = bus;
980 hose->last_busno = bus->busn_res.end;
985 struct pci_controller *hose, *tmp;
991 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
992 hose->last_busno = 0xff;
993 pcibios_scan_phb(hose);
994 if (next_busno <= hose->last_busno)
995 next_busno = hose->last_busno + 1;
1001 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
1002 if (hose->bus)
1003 pci_bus_add_devices(hose->bus);
1013 struct pci_controller *hose, *tmp;
1015 list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
1016 if (bus >= hose->first_busno && bus <= hose->last_busno)
1017 return hose;
1029 struct pci_controller *hose;
1032 hose = pci_bus_to_hose(bus);
1033 if (!hose)
1038 return (long)hose->first_busno;
1040 return (long)hose->pci_mem_offset;
1042 return (long)hose->io_base_phys;
1054 * find a hose.
1087 fake_pci_bus(struct pci_controller *hose, int busnr)
1091 if (!hose)
1092 pr_err("Can't find hose for PCI bus %d!\n", busnr);
1095 bus.sysdata = hose;
1096 bus.ops = hose ? hose->ops : &null_pci_ops;
1101 int early_##rw##_config_##size(struct pci_controller *hose, int bus, \
1104 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \
1115 int early_find_capability(struct pci_controller *hose, int bus, int devfn,
1118 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);