Lines Matching +full:irqs +full:- +full:map +full:- +full:range
1 // SPDX-License-Identifier: GPL-2.0
4 #include <linux/dma-mapping.h>
20 unsigned long ret = res->start + offset; in of_ioremap()
23 if (res->flags & IORESOURCE_MEM) in of_ioremap()
36 if (res->flags & IORESOURCE_MEM) in of_iounmap()
58 * parent as-is, not with the PCI translate in of_bus_pci_match()
88 static int of_bus_simba_map(u32 *addr, const u32 *range, in of_bus_simba_map() argument
103 static int of_bus_pci_map(u32 *addr, const u32 *range, in of_bus_pci_map() argument
110 if (!((addr[0] ^ range[0]) & 0x03000000)) in of_bus_pci_map()
113 /* Special exception, we can map a 64-bit address into in of_bus_pci_map()
114 * a 32-bit range. in of_bus_pci_map()
117 (range[0] & 0x03000000) == 0x02000000) in of_bus_pci_map()
120 return -EINVAL; in of_bus_pci_map()
123 if (of_out_of_range(addr + 1, range + 1, range + na + pna, in of_bus_pci_map()
124 na - 1, ns)) in of_bus_pci_map()
125 return -EINVAL; in of_bus_pci_map()
127 /* Start with the parent range base. */ in of_bus_pci_map()
128 memcpy(result, range + na, pna * 4); in of_bus_pci_map()
131 for (i = 0; i < na - 1; i++) in of_bus_pci_map()
132 result[pna - 1 - i] += in of_bus_pci_map()
133 (addr[na - 1 - i] - in of_bus_pci_map()
134 range[na - 1 - i]); in of_bus_pci_map()
165 * This is just needed to hard-code the address and size cell
166 * counts. 'fhc' and 'central' nodes lack the #address-cells and
167 * #size-cells properties, and if you walk to the root on such
168 * Enterprise boxes all you'll get is a #size-cells of 2 which is
187 .addr_prop_name = "assigned-addresses",
190 .map = of_bus_pci_map,
196 .addr_prop_name = "assigned-addresses",
199 .map = of_bus_simba_map,
208 .map = of_bus_default_map,
217 .map = of_bus_default_map,
226 .map = of_bus_default_map,
258 result[pna - 1 - i] = in build_one_resource()
259 addr[na - 1 - i]; in build_one_resource()
268 for (; rlen >= rone; rlen -= rone, ranges += rone) { in build_one_resource()
269 if (!bus->map(addr, ranges, na, ns, pna)) in build_one_resource()
276 if (!strcmp(bus->name, "pci") && in build_one_resource()
329 bus = of_match_bus(p_op->dev.of_node); in build_device_resources()
330 bus->count_cells(op->dev.of_node, &na, &ns); in build_device_resources()
332 preg = of_get_property(op->dev.of_node, bus->addr_prop_name, &num_reg); in build_device_resources()
336 /* Convert to num-cells. */ in build_device_resources()
339 /* Convert to num-entries. */ in build_device_resources()
342 /* Prevent overrunning the op->resources[] array. */ in build_device_resources()
346 op->dev.of_node, num_reg, PROMREG_MAX); in build_device_resources()
350 op->resource = op->archdata.resource; in build_device_resources()
351 op->num_resources = num_reg; in build_device_resources()
353 struct resource *r = &op->resource[index]; in build_device_resources()
356 struct device_node *dp = op->dev.of_node; in build_device_resources()
357 struct device_node *pp = p_op->dev.of_node; in build_device_resources()
367 flags = bus->get_flags(addr, 0); in build_device_resources()
380 pp = dp->parent; in build_device_resources()
387 pbus->count_cells(dp, &pna, &pns); in build_device_resources()
393 flags = pbus->get_flags(addr, flags); in build_device_resources()
404 printk("%pOF reg[%d] -> %llx\n", in build_device_resources()
405 op->dev.of_node, index, in build_device_resources()
412 r->start = result; in build_device_resources()
413 r->end = result + size - 1; in build_device_resources()
414 r->flags = flags; in build_device_resources()
416 r->name = op->dev.of_node->full_name; in build_device_resources()
433 bus->count_cells(dp, &na, NULL); in apply_interrupt_map()
458 /* Psycho and Sabre PCI controllers can have 'interrupt-map' in apply_interrupt_map()
459 * properties that do not include the on-board device in apply_interrupt_map()
464 * match in the parent's 'interrupt-map', and the in apply_interrupt_map()
468 if (pp->irq_trans) in apply_interrupt_map()
494 bus = (regs->phys_hi >> 16) & 0xff; in pci_irq_swizzle()
495 devfn = (regs->phys_hi >> 8) & 0xff; in pci_irq_swizzle()
498 if (pp->irq_trans) { in pci_irq_swizzle()
499 /* Derived from Table 8-3, U2P User's Manual. This branch in pci_irq_swizzle()
501 * interrupt-map and interrupt-map-mask properties. The in pci_irq_swizzle()
502 * Ultra-E450 is one example. in pci_irq_swizzle()
506 * D: 2-bit slot number, derived from PCI device number as in pci_irq_swizzle()
507 * (dev - 1) for bus A, or (dev - 2) for bus B in pci_irq_swizzle()
508 * L: 2-bit line number in pci_irq_swizzle()
511 /* PBM-A */ in pci_irq_swizzle()
513 slot = (slot - 1) << 2; in pci_irq_swizzle()
515 /* PBM-B */ in pci_irq_swizzle()
517 slot = (slot - 2) << 2; in pci_irq_swizzle()
519 irq -= 1; in pci_irq_swizzle()
523 /* Going through a PCI-PCI bridge that lacks a set of in pci_irq_swizzle()
524 * interrupt-map and interrupt-map-mask properties. in pci_irq_swizzle()
526 ret = ((irq - 1 + (slot & 3)) & 3) + 1; in pci_irq_swizzle()
538 struct device_node *dp = op->dev.of_node; in build_one_device_irq()
546 if (dp->irq_trans) { in build_one_device_irq()
547 irq = dp->irq_trans->irq_build(dp, irq, in build_one_device_irq()
548 dp->irq_trans->data); in build_one_device_irq()
551 printk("%pOF: direct translate %x --> %x\n", in build_one_device_irq()
558 * interrupt-map or bus specific translations, until we hit in build_one_device_irq()
565 pp = dp->parent; in build_one_device_irq()
571 imap = of_get_property(pp, "interrupt-map", &imlen); in build_one_device_irq()
572 imsk = of_get_property(pp, "interrupt-map-mask", NULL); in build_one_device_irq()
582 printk("%pOF: Apply [%pOF:%x] imap --> [%pOF:%x]\n", in build_one_device_irq()
583 op->dev.of_node, in build_one_device_irq()
589 if (iret->irq_trans) { in build_one_device_irq()
600 "%x --> %x\n", in build_one_device_irq()
601 op->dev.of_node, in build_one_device_irq()
607 if (pp->irq_trans) { in build_one_device_irq()
613 pp = pp->parent; in build_one_device_irq()
618 irq = ip->irq_trans->irq_build(op->dev.of_node, irq, in build_one_device_irq()
619 ip->irq_trans->data); in build_one_device_irq()
621 printk("%pOF: Apply IRQ trans [%pOF] %x --> %x\n", in build_one_device_irq()
622 op->dev.of_node, ip, orig_irq, irq); in build_one_device_irq()
626 if (nid != -1) { in build_one_device_irq()
644 sd = &op->dev.archdata; in scan_one_device()
645 sd->op = op; in scan_one_device()
647 op->dev.of_node = dp; in scan_one_device()
651 op->archdata.num_irqs = len / 4; in scan_one_device()
653 /* Prevent overrunning the op->irqs[] array. */ in scan_one_device()
654 if (op->archdata.num_irqs > PROMINTR_MAX) { in scan_one_device()
655 printk(KERN_WARNING "%pOF: Too many irqs (%d), " in scan_one_device()
657 dp, op->archdata.num_irqs, PROMINTR_MAX); in scan_one_device()
658 op->archdata.num_irqs = PROMINTR_MAX; in scan_one_device()
660 memcpy(op->archdata.irqs, irq, op->archdata.num_irqs * 4); in scan_one_device()
662 op->archdata.num_irqs = 0; in scan_one_device()
666 for (i = 0; i < op->archdata.num_irqs; i++) in scan_one_device()
667 op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]); in scan_one_device()
669 op->dev.parent = parent; in scan_one_device()
670 op->dev.bus = &platform_bus_type; in scan_one_device()
672 dev_set_name(&op->dev, "root"); in scan_one_device()
674 dev_set_name(&op->dev, "%08x", dp->phandle); in scan_one_device()
675 op->dev.coherent_dma_mask = DMA_BIT_MASK(32); in scan_one_device()
676 op->dev.dma_mask = &op->dev.coherent_dma_mask; in scan_one_device()
693 scan_tree(dp->child, &op->dev); in scan_tree()
695 dp = dp->sibling; in scan_tree()
708 scan_tree(root->child, &parent->dev); in scan_of_devices()