Lines Matching +full:msi +full:- +full:base +full:- +full:vec

1 // SPDX-License-Identifier: GPL-2.0-or-later
20 #include <linux/msi.h>
34 void __iomem *base; member
40 static void __iomem *ics_native_xive(struct ics_native *in, unsigned int vec) in ics_native_xive() argument
42 return in->base + 0x800 + ((vec - in->ibase) << 2); in ics_native_xive()
47 unsigned int vec = (unsigned int)irqd_to_hwirq(d); in ics_native_unmask_irq() local
52 pr_devel("ics-native: unmask virq %d [hw 0x%x]\n", d->irq, vec); in ics_native_unmask_irq()
54 if (vec < in->ibase || vec >= (in->ibase + in->icount)) in ics_native_unmask_irq()
57 server = xics_get_irq_server(d->irq, irq_data_get_affinity_mask(d), 0); in ics_native_unmask_irq()
58 out_be32(ics_native_xive(in, vec), (server << 8) | DEFAULT_PRIORITY); in ics_native_unmask_irq()
65 * The generic MSI code returns with the interrupt disabled on the in ics_native_startup()
66 * card, using the MSI mask bits. Firmware doesn't appear to unmask in ics_native_startup()
78 static void ics_native_do_mask(struct ics_native *in, unsigned int vec) in ics_native_do_mask() argument
80 out_be32(ics_native_xive(in, vec), 0xff); in ics_native_do_mask()
85 unsigned int vec = (unsigned int)irqd_to_hwirq(d); in ics_native_mask_irq() local
89 pr_devel("ics-native: mask virq %d [hw 0x%x]\n", d->irq, vec); in ics_native_mask_irq()
91 if (vec < in->ibase || vec >= (in->ibase + in->icount)) in ics_native_mask_irq()
93 ics_native_do_mask(in, vec); in ics_native_mask_irq()
100 unsigned int vec = (unsigned int)irqd_to_hwirq(d); in ics_native_set_affinity() local
106 if (vec < in->ibase || vec >= (in->ibase + in->icount)) in ics_native_set_affinity()
107 return -EINVAL; in ics_native_set_affinity()
109 server = xics_get_irq_server(d->irq, cpumask, 1); in ics_native_set_affinity()
110 if (server == -1) { in ics_native_set_affinity()
112 __func__, cpumask_pr_args(cpumask), d->irq); in ics_native_set_affinity()
113 return -1; in ics_native_set_affinity()
116 xive = in_be32(ics_native_xive(in, vec)); in ics_native_set_affinity()
118 out_be32(ics_native_xive(in, vec), xive); in ics_native_set_affinity()
140 if (hw_irq < in->ibase || hw_irq >= (in->ibase + in->icount)) in ics_native_check()
141 return -EINVAL; in ics_native_check()
146 static void ics_native_mask_unknown(struct ics *ics, unsigned long vec) in ics_native_mask_unknown() argument
150 if (vec < in->ibase || vec >= (in->ibase + in->icount)) in ics_native_mask_unknown()
153 ics_native_do_mask(in, vec); in ics_native_mask_unknown()
156 static long ics_native_get_server(struct ics *ics, unsigned long vec) in ics_native_get_server() argument
161 if (vec < in->ibase || vec >= (in->ibase + in->icount)) in ics_native_get_server()
162 return -EINVAL; in ics_native_get_server()
164 xive = in_be32(ics_native_xive(in, vec)); in ics_native_get_server()
172 return in->node == node; in ics_native_host_match()
191 return -ENOMEM; in ics_native_add_one()
192 ics->node = of_node_get(np); in ics_native_add_one()
193 memcpy(&ics->ics, &ics_native_template, sizeof(struct ics)); in ics_native_add_one()
195 ics->base = of_iomap(np, 0); in ics_native_add_one()
196 if (!ics->base) { in ics_native_add_one()
198 rc = -ENOMEM; in ics_native_add_one()
202 count = of_property_count_u32_elems(np, "interrupt-ranges"); in ics_native_add_one()
204 pr_err("Failed to read interrupt-ranges of %pOFP\n", np); in ics_native_add_one()
205 rc = -EINVAL; in ics_native_add_one()
212 rc = of_property_read_u32_array(np, "interrupt-ranges", in ics_native_add_one()
215 pr_err("Failed to read interrupt-ranges of %pOFP\n", np); in ics_native_add_one()
218 ics->ibase = ranges[0]; in ics_native_add_one()
219 ics->icount = ranges[1]; in ics_native_add_one()
222 ics->ibase, ics->ibase + ics->icount - 1); in ics_native_add_one()
225 xics_register_ics(&ics->ics); in ics_native_add_one()
229 of_node_put(ics->node); in ics_native_add_one()
242 ics_native_irq_chip.irq_eoi = icp_ops->eoi; in ics_native_init()
244 /* Find native ICS in the device-tree */ in ics_native_init()
245 for_each_compatible_node(ics, NULL, "openpower,xics-sources") { in ics_native_init()
253 return found_one ? 0 : -ENODEV; in ics_native_init()