diff options
author | Hanjun Guo <hanjun.guo@linaro.org> | 2017-03-07 07:40:00 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2017-04-07 05:52:18 -0400 |
commit | 9ab460c2289dda9c5b37463f1509553f4b4b0215 (patch) | |
tree | 936331325484ac24d0da8ca2576d2a8c0266ae64 /drivers/irqchip | |
parent | 8d3554b84af909549f0197ec6e68f24006a9d3f2 (diff) |
irqchip/gicv3-its: platform-msi: Refactor its_pmsi_prepare()
By adding ACPI support for platform MSI, the gicv3 driver has to
provide code to retrieve the dev id through ACPI instead of device
tree bindings; given that its_pmsi_prepare() allows already to get
the dev id but it is OF dependent, factor OF related code out into
a single function to make its_pmsi_prepare() ready to be used with
other firmware interfaces.
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
[lorenzo.pieralisi@arm.com: rewrote commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Tested-by: Ming Lei <ming.lei@canonical.com>
Tested-by: Wei Xu <xuwei5@hisilicon.com>
Tested-by: Sinan Kaya <okaya@codeaurora.org>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r-- | drivers/irqchip/irq-gic-v3-its-platform-msi.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its-platform-msi.c b/drivers/irqchip/irq-gic-v3-its-platform-msi.c index 470b4aa7d62c..3c94278fc867 100644 --- a/drivers/irqchip/irq-gic-v3-its-platform-msi.c +++ b/drivers/irqchip/irq-gic-v3-its-platform-msi.c | |||
@@ -24,15 +24,11 @@ static struct irq_chip its_pmsi_irq_chip = { | |||
24 | .name = "ITS-pMSI", | 24 | .name = "ITS-pMSI", |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, | 27 | static int of_pmsi_get_dev_id(struct irq_domain *domain, struct device *dev, |
28 | int nvec, msi_alloc_info_t *info) | 28 | u32 *dev_id) |
29 | { | 29 | { |
30 | struct msi_domain_info *msi_info; | ||
31 | u32 dev_id; | ||
32 | int ret, index = 0; | 30 | int ret, index = 0; |
33 | 31 | ||
34 | msi_info = msi_get_domain_info(domain->parent); | ||
35 | |||
36 | /* Suck the DeviceID out of the msi-parent property */ | 32 | /* Suck the DeviceID out of the msi-parent property */ |
37 | do { | 33 | do { |
38 | struct of_phandle_args args; | 34 | struct of_phandle_args args; |
@@ -43,11 +39,24 @@ static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, | |||
43 | if (args.np == irq_domain_get_of_node(domain)) { | 39 | if (args.np == irq_domain_get_of_node(domain)) { |
44 | if (WARN_ON(args.args_count != 1)) | 40 | if (WARN_ON(args.args_count != 1)) |
45 | return -EINVAL; | 41 | return -EINVAL; |
46 | dev_id = args.args[0]; | 42 | *dev_id = args.args[0]; |
47 | break; | 43 | break; |
48 | } | 44 | } |
49 | } while (!ret); | 45 | } while (!ret); |
50 | 46 | ||
47 | return ret; | ||
48 | } | ||
49 | |||
50 | static int its_pmsi_prepare(struct irq_domain *domain, struct device *dev, | ||
51 | int nvec, msi_alloc_info_t *info) | ||
52 | { | ||
53 | struct msi_domain_info *msi_info; | ||
54 | u32 dev_id; | ||
55 | int ret; | ||
56 | |||
57 | msi_info = msi_get_domain_info(domain->parent); | ||
58 | |||
59 | ret = of_pmsi_get_dev_id(domain, dev, &dev_id); | ||
51 | if (ret) | 60 | if (ret) |
52 | return ret; | 61 | return ret; |
53 | 62 | ||