On 09/23/2015 09:52 AM, Marc Zyngier wrote:
On Tue, 22 Sep 2015 17:00:05 -0700
David Daney <ddaney.c...@gmail.com> wrote:
From: David Daney <david.da...@cavium.com>
The device tree property "msi-map" specifies how to create the PCI
requester id used in some MSI controllers. Add a new function
of_msi_map_rid() that finds the msi-map property and applies its
translation to a given requester id.
Signed-off-by: David Daney <david.da...@cavium.com>
---
drivers/of/irq.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/of_irq.h | 7 ++++
2 files changed, 93 insertions(+)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 55317fa..3f64d2e 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -598,3 +598,89 @@ void of_msi_configure(struct device *dev, struct
device_node *np)
[...]
+ while (!matched && msi_map_len >= 4 * sizeof(__be32)) {
+ rid_base = be32_to_cpup(msi_map + 0);
+ phandle = be32_to_cpup(msi_map + 1);
+ msi_base = be32_to_cpup(msi_map + 2);
+ rid_len = be32_to_cpup(msi_map + 3);
Rob did suggest to use of_property_read_u32_index() instead of these
be32_to_cpup(). Not sure if that'd be a major improvement though.
I did think about that, but the micro-optimizer in me didn't feel
comfortable with the overhead of rerunning of_find_property() for each
value. I decided to run of_find_property() once, and then iterate
through the individual values within the property.
If there are strong objections to doing it this way, we can change it.
David Daney
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/