Lines Matching +full:bus +full:- +full:addr

1 // SPDX-License-Identifier: GPL-2.0
20 unsigned long bus, in config_out_of_range() argument
24 if (bus < pbm->pci_first_busno || in config_out_of_range()
25 bus > pbm->pci_last_busno) in config_out_of_range()
31 unsigned long bus, in sun4u_config_mkaddr() argument
35 unsigned long rbits = pbm->config_space_reg_bits; in sun4u_config_mkaddr()
37 if (config_out_of_range(pbm, bus, devfn, reg)) in sun4u_config_mkaddr()
40 reg = (reg & ((1 << rbits) - 1)); in sun4u_config_mkaddr()
42 bus <<= rbits + 8; in sun4u_config_mkaddr()
44 return (void *) (pbm->config_space | bus | devfn | reg); in sun4u_config_mkaddr()
49 * Strange but true, and I see no language in the UltraSPARC-IIi
53 unsigned char bus, unsigned int devfn, in sun4u_read_pci_cfg_host() argument
56 u32 tmp32, *addr; in sun4u_read_pci_cfg_host() local
60 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); in sun4u_read_pci_cfg_host()
61 if (!addr) in sun4u_read_pci_cfg_host()
67 unsigned long align = (unsigned long) addr; in sun4u_read_pci_cfg_host()
76 pci_config_read8((u8 *)addr, &tmp8); in sun4u_read_pci_cfg_host()
83 pci_config_read16((u16 *)addr, &tmp16); in sun4u_read_pci_cfg_host()
86 pci_config_read8((u8 *)addr, &tmp8); in sun4u_read_pci_cfg_host()
88 pci_config_read8(((u8 *)addr) + 1, &tmp8); in sun4u_read_pci_cfg_host()
95 sun4u_read_pci_cfg_host(pbm, bus, devfn, in sun4u_read_pci_cfg_host()
100 sun4u_read_pci_cfg_host(pbm, bus, devfn, in sun4u_read_pci_cfg_host()
111 struct pci_pbm_info *pbm = bus_dev->sysdata; in sun4u_read_pci_cfg()
112 unsigned char bus = bus_dev->number; in sun4u_read_pci_cfg() local
113 u32 *addr; in sun4u_read_pci_cfg() local
129 if (!bus_dev->number && !PCI_SLOT(devfn)) in sun4u_read_pci_cfg()
130 return sun4u_read_pci_cfg_host(pbm, bus, devfn, where, in sun4u_read_pci_cfg()
133 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); in sun4u_read_pci_cfg()
134 if (!addr) in sun4u_read_pci_cfg()
139 pci_config_read8((u8 *)addr, &tmp8); in sun4u_read_pci_cfg()
149 pci_config_read16((u16 *)addr, &tmp16); in sun4u_read_pci_cfg()
159 pci_config_read32(addr, value); in sun4u_read_pci_cfg()
166 unsigned char bus, unsigned int devfn, in sun4u_write_pci_cfg_host() argument
169 u32 *addr; in sun4u_write_pci_cfg_host() local
171 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); in sun4u_write_pci_cfg_host()
172 if (!addr) in sun4u_write_pci_cfg_host()
178 unsigned long align = (unsigned long) addr; in sun4u_write_pci_cfg_host()
192 pci_config_write8((u8 *)addr, value); in sun4u_write_pci_cfg_host()
196 pci_config_write16((u16 *)addr, value); in sun4u_write_pci_cfg_host()
198 pci_config_write8((u8 *)addr, value & 0xff); in sun4u_write_pci_cfg_host()
199 pci_config_write8(((u8 *)addr) + 1, value >> 8); in sun4u_write_pci_cfg_host()
203 sun4u_write_pci_cfg_host(pbm, bus, devfn, in sun4u_write_pci_cfg_host()
205 sun4u_write_pci_cfg_host(pbm, bus, devfn, in sun4u_write_pci_cfg_host()
215 struct pci_pbm_info *pbm = bus_dev->sysdata; in sun4u_write_pci_cfg()
216 unsigned char bus = bus_dev->number; in sun4u_write_pci_cfg() local
217 u32 *addr; in sun4u_write_pci_cfg() local
219 if (!bus_dev->number && !PCI_SLOT(devfn)) in sun4u_write_pci_cfg()
220 return sun4u_write_pci_cfg_host(pbm, bus, devfn, where, in sun4u_write_pci_cfg()
223 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); in sun4u_write_pci_cfg()
224 if (!addr) in sun4u_write_pci_cfg()
229 pci_config_write8((u8 *)addr, value); in sun4u_write_pci_cfg()
238 pci_config_write16((u16 *)addr, value); in sun4u_write_pci_cfg()
247 pci_config_write32(addr, value); in sun4u_write_pci_cfg()
260 struct pci_pbm_info *pbm = bus_dev->sysdata; in sun4v_read_pci_cfg()
261 u32 devhandle = pbm->devhandle; in sun4v_read_pci_cfg()
262 unsigned int bus = bus_dev->number; in sun4v_read_pci_cfg() local
267 if (config_out_of_range(pbm, bus, devfn, where)) { in sun4v_read_pci_cfg()
271 HV_PCI_DEVICE_BUILD(bus, device, func), in sun4v_read_pci_cfg()
293 struct pci_pbm_info *pbm = bus_dev->sysdata; in sun4v_write_pci_cfg()
294 u32 devhandle = pbm->devhandle; in sun4v_write_pci_cfg()
295 unsigned int bus = bus_dev->number; in sun4v_write_pci_cfg() local
299 if (config_out_of_range(pbm, bus, devfn, where)) { in sun4v_write_pci_cfg()
307 HV_PCI_DEVICE_BUILD(bus, device, func), in sun4v_write_pci_cfg()
320 const u32 *val = of_get_property(pbm->op->dev.of_node, "bus-range", NULL); in pci_get_pbm_props()
322 pbm->pci_first_busno = val[0]; in pci_get_pbm_props()
323 pbm->pci_last_busno = val[1]; in pci_get_pbm_props()
325 val = of_get_property(pbm->op->dev.of_node, "ino-bitmap", NULL); in pci_get_pbm_props()
327 pbm->ino_bitmap = (((u64)val[1] << 32UL) | in pci_get_pbm_props()
334 const u32 *vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", in pci_register_iommu_region()
342 pbm->name); in pci_register_iommu_region()
345 rp->name = "IOMMU"; in pci_register_iommu_region()
346 rp->start = pbm->mem_space.start + (unsigned long) vdma[0]; in pci_register_iommu_region()
347 rp->end = rp->start + (unsigned long) vdma[1] - 1UL; in pci_register_iommu_region()
348 rp->flags = IORESOURCE_BUSY; in pci_register_iommu_region()
349 if (request_resource(&pbm->mem_space, rp)) { in pci_register_iommu_region()
351 pbm->name); in pci_register_iommu_region()
366 pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i); in pci_determine_mem_io_space()
370 pbm->name); in pci_determine_mem_io_space()
375 memset(&pbm->mem64_space, 0, sizeof(struct resource)); in pci_determine_mem_io_space()
385 parent_phys_hi = pr->parent_phys_hi; in pci_determine_mem_io_space()
386 parent_phys_lo = pr->parent_phys_lo; in pci_determine_mem_io_space()
387 child_phys_mid = pr->child_phys_mid; in pci_determine_mem_io_space()
388 child_phys_lo = pr->child_phys_lo; in pci_determine_mem_io_space()
392 size_hi = pr->size_hi; in pci_determine_mem_io_space()
393 size_lo = pr->size_lo; in pci_determine_mem_io_space()
395 type = (pr->child_phys_hi >> 24) & 0x3; in pci_determine_mem_io_space()
406 pbm->config_space = a; in pci_determine_mem_io_space()
410 /* 16-bit IO space, 16MB */ in pci_determine_mem_io_space()
411 pbm->io_space.start = a; in pci_determine_mem_io_space()
412 pbm->io_space.end = a + size - 1UL; in pci_determine_mem_io_space()
413 pbm->io_space.flags = IORESOURCE_IO; in pci_determine_mem_io_space()
414 pbm->io_offset = a - region_a; in pci_determine_mem_io_space()
419 /* 32-bit MEM space, 2GB */ in pci_determine_mem_io_space()
420 pbm->mem_space.start = a; in pci_determine_mem_io_space()
421 pbm->mem_space.end = a + size - 1UL; in pci_determine_mem_io_space()
422 pbm->mem_space.flags = IORESOURCE_MEM; in pci_determine_mem_io_space()
423 pbm->mem_offset = a - region_a; in pci_determine_mem_io_space()
428 /* 64-bit MEM handling */ in pci_determine_mem_io_space()
429 pbm->mem64_space.start = a; in pci_determine_mem_io_space()
430 pbm->mem64_space.end = a + size - 1UL; in pci_determine_mem_io_space()
431 pbm->mem64_space.flags = IORESOURCE_MEM; in pci_determine_mem_io_space()
432 pbm->mem64_offset = a - region_a; in pci_determine_mem_io_space()
443 pbm->name, in pci_determine_mem_io_space()
448 if (pbm->io_space.flags) in pci_determine_mem_io_space()
450 pbm->name, &pbm->io_space, pbm->io_offset); in pci_determine_mem_io_space()
451 if (pbm->mem_space.flags) in pci_determine_mem_io_space()
453 pbm->name, &pbm->mem_space, pbm->mem_offset); in pci_determine_mem_io_space()
454 if (pbm->mem64_space.flags && pbm->mem_space.flags) { in pci_determine_mem_io_space()
455 if (pbm->mem64_space.start <= pbm->mem_space.end) in pci_determine_mem_io_space()
456 pbm->mem64_space.start = pbm->mem_space.end + 1; in pci_determine_mem_io_space()
457 if (pbm->mem64_space.start > pbm->mem64_space.end) in pci_determine_mem_io_space()
458 pbm->mem64_space.flags = 0; in pci_determine_mem_io_space()
461 if (pbm->mem64_space.flags) in pci_determine_mem_io_space()
463 pbm->name, &pbm->mem64_space, pbm->mem64_offset); in pci_determine_mem_io_space()
465 pbm->io_space.name = pbm->mem_space.name = pbm->name; in pci_determine_mem_io_space()
466 pbm->mem64_space.name = pbm->name; in pci_determine_mem_io_space()
468 request_resource(&ioport_resource, &pbm->io_space); in pci_determine_mem_io_space()
469 request_resource(&iomem_resource, &pbm->mem_space); in pci_determine_mem_io_space()
470 if (pbm->mem64_space.flags) in pci_determine_mem_io_space()
471 request_resource(&iomem_resource, &pbm->mem64_space); in pci_determine_mem_io_space()
481 struct pci_bus *bus; in pci_scan_for_target_abort() local
483 list_for_each_entry(pdev, &pbus->devices, bus_list) { in pci_scan_for_target_abort()
493 pbm->name, status); in pci_scan_for_target_abort()
497 list_for_each_entry(bus, &pbus->children, node) in pci_scan_for_target_abort()
498 pci_scan_for_target_abort(pbm, bus); in pci_scan_for_target_abort()
505 struct pci_bus *bus; in pci_scan_for_master_abort() local
507 list_for_each_entry(pdev, &pbus->devices, bus_list) { in pci_scan_for_master_abort()
516 "[%016x]\n", pbm->name, status); in pci_scan_for_master_abort()
520 list_for_each_entry(bus, &pbus->children, node) in pci_scan_for_master_abort()
521 pci_scan_for_master_abort(pbm, bus); in pci_scan_for_master_abort()
528 struct pci_bus *bus; in pci_scan_for_parity_error() local
530 list_for_each_entry(pdev, &pbus->devices, bus_list) { in pci_scan_for_parity_error()
540 pbm->name, status); in pci_scan_for_parity_error()
544 list_for_each_entry(bus, &pbus->children, node) in pci_scan_for_parity_error()
545 pci_scan_for_parity_error(pbm, bus); in pci_scan_for_parity_error()