Lines Matching +full:mbi +full:- +full:ranges

1 // SPDX-License-Identifier: GPL-2.0
19 #include <linux/irqchip/arm-gic-v3.h>
21 #include "irq-msi-lib.h"
35 .name = "MBI",
52 * Using ACPI? There is no MBI support in the spec, you in mbi_irq_gic_domain_alloc()
55 if (!is_of_node(domain->parent->fwnode)) in mbi_irq_gic_domain_alloc()
56 return -EINVAL; in mbi_irq_gic_domain_alloc()
63 fwspec.fwnode = domain->parent->fwnode; in mbi_irq_gic_domain_alloc()
66 fwspec.param[1] = hwirq - 32; in mbi_irq_gic_domain_alloc()
73 d = irq_domain_get_irq_data(domain->parent, virq); in mbi_irq_gic_domain_alloc()
74 return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING); in mbi_irq_gic_domain_alloc()
77 static void mbi_free_msi(struct mbi_range *mbi, unsigned int hwirq, in mbi_free_msi() argument
81 bitmap_release_region(mbi->bm, hwirq - mbi->spi_start, in mbi_free_msi()
90 struct mbi_range *mbi = NULL; in mbi_irq_domain_alloc() local
99 mbi = &mbi_ranges[i]; in mbi_irq_domain_alloc()
105 if (!mbi) in mbi_irq_domain_alloc()
106 return -ENOSPC; in mbi_irq_domain_alloc()
108 hwirq = mbi->spi_start + offset; in mbi_irq_domain_alloc()
110 err = iommu_dma_prepare_msi(info->desc, in mbi_irq_domain_alloc()
121 &mbi_irq_chip, mbi); in mbi_irq_domain_alloc()
128 mbi_free_msi(mbi, hwirq, nr_irqs); in mbi_irq_domain_alloc()
136 struct mbi_range *mbi = irq_data_get_irq_chip_data(d); in mbi_irq_domain_free() local
138 mbi_free_msi(mbi, d->hwirq, nr_irqs); in mbi_irq_domain_free()
152 msg[0].data = data->parent_data->hwirq; in mbi_compose_msi_msg()
163 msg[1].data = data->parent_data->hwirq; in mbi_compose_mbi_msg()
174 switch (info->bus_token) { in mbi_init_dev_msi_info()
177 info->chip->irq_compose_msi_msg = mbi_compose_msi_msg; in mbi_init_dev_msi_info()
181 info->chip->irq_compose_msi_msg = mbi_compose_mbi_msg; in mbi_init_dev_msi_info()
182 info->chip->irq_set_type = irq_chip_set_type_parent; in mbi_init_dev_msi_info()
183 info->chip->flags |= IRQCHIP_SUPPORTS_LEVEL_MSI; in mbi_init_dev_msi_info()
184 info->flags |= MSI_FLAG_LEVEL_CAPABLE; in mbi_init_dev_msi_info()
206 .prefix = "MBI-",
214 nexus_domain = irq_domain_create_hierarchy(parent, 0, 0, parent->fwnode, in mbi_allocate_domain()
217 return -ENOMEM; in mbi_allocate_domain()
220 nexus_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT; in mbi_allocate_domain()
221 nexus_domain->msi_parent_ops = &gic_v3_mbi_msi_parent_ops; in mbi_allocate_domain()
233 if (!of_property_read_bool(np, "msi-controller")) in mbi_init()
236 n = of_property_count_elems_of_size(np, "mbi-ranges", sizeof(u32)); in mbi_init()
238 return -EINVAL; in mbi_init()
243 return -ENOMEM; in mbi_init()
246 ret = of_property_read_u32_index(np, "mbi-ranges", n * 2, in mbi_init()
250 ret = of_property_read_u32_index(np, "mbi-ranges", n * 2 + 1, in mbi_init()
257 ret = -ENOMEM; in mbi_init()
260 pr_info("MBI range [%d:%d]\n", mbi_ranges[n].spi_start, in mbi_init()
261 mbi_ranges[n].spi_start + mbi_ranges[n].nr_spis - 1); in mbi_init()
264 reg = of_get_property(np, "mbi-alias", NULL); in mbi_init()
268 ret = -ENXIO; in mbi_init()
275 ret = -ENXIO; in mbi_init()
282 pr_info("Using MBI frame %pa\n", &mbi_phys_base); in mbi_init()