|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCHv7 5/6] plat/common: Add a platform API to get IRQ from device tree
Hello, Please find the comment inline: Thanks & Regards Sharan On 7/24/19 12:05 PM, Jia He wrote: In the previous version of the implementation gic_irq_translate was called from gic_get_irq_from_dtb. Now since we have moved the implementation into the gic driver, we need a public interface in the gic driver which queries the device tree and translate the interrupt line.From: Jianyong Wu <jianyong.wu@xxxxxxx> When we get irq number from device tree, it contains more than one items, like irq type, hardware irq number. This function will help us to translate these items into one unique platform irq number. Signed-off-by: Wei Chen <wei.chen@xxxxxxx> Signed-off-by: Jianyong Wu <jianyong.wu@xxxxxxx> Signed-off-by: Jia He <justin.he@xxxxxxx> --- plat/drivers/gic/gic-v2.c | 30 ++++++++++++++++-- plat/drivers/include/ofw/gic_fdt.h | 51 ++++++++++++++++++++++++++++++ plat/drivers/ofw/fdt.c | 20 ++++++++++++ 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 plat/drivers/include/ofw/gic_fdt.h diff --git a/plat/drivers/gic/gic-v2.c b/plat/drivers/gic/gic-v2.c index 41f769c..d2857f8 100644 --- a/plat/drivers/gic/gic-v2.c +++ b/plat/drivers/gic/gic-v2.c @@ -49,10 +49,12 @@ /* Max CPU interface for GICv2 */ #define GIC_MAX_CPUIF 8-/* SPI interrupt base ID */+/* SPI interrupt definitions */ +#define GIC_SPI_TYPE 0 #define GIC_SPI_BASE 32-/* PPI interrupt base ID */+/* PPI interrupt definitions */ +#define GIC_PPI_TYPE 1 #define GIC_PPI_BASE 16/* Max support interrupt number for GICv2 */@@ -63,6 +65,7 @@ static uint64_t gic_dist_size, gic_cpuif_size;#define GIC_DIST_REG(r) ((void *)(gic_dist_addr + (r)))#define GIC_CPU_REG(r) ((void *)(gic_cpuif_addr + (r))) +#define IRQ_TYPE_MASK 0x0000000fstatic const char * const gic_device_list[] = { s/CMN/DRV A suggestion would be to move it to separate file gic_fdt.c. This can be done either in this patch series or as a part of the series where we split the gic and fdt driver from the kvm library. I will leave it upto you.+#define __PLAT_CMN_GIC_FDT_H__ + +/** + * Get an interrupt number of given index from device tree + * @param fdt Device tree blob + * @param nodeoffset device node offset + * @param index the index of interrupt we want to retrieve + * @param irq_type output the interrupt type e.g. SPI, PPI, SGI + * @param hwirq output the hardware irq number + * @param trigger_type. output to tell e.g. edge or level trigger + * @return 0 on success, a negative errno value on errors + */ +int gic_get_irq_from_dtb(const void *fdt, int nodeoffset, int index, + uint32_t *irq_type, uint32_t *hwirq, + uint32_t *trigger_type) +#endif /* __PLAT_CMN_GIC_FDT_H__ */ diff --git a/plat/drivers/ofw/fdt.c b/plat/drivers/ofw/fdt.c index 69e5e05..afe3f91 100644 --- a/plat/drivers/ofw/fdt.c +++ b/plat/drivers/ofw/fdt.c @@ -289,3 +289,23 @@ int fdt_get_interrupt(const void *fdt, int nodeoffset,return 0;} + +int gic_get_irq_from_dtb(const void *fdt, int nodeoffset, int index, + uint32_t *irq_type, uint32_t *hwirq, + uint32_t *trigger_type) _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |