libsel4vmmplatsupport: Updated vpci irq map Updated the generation of the vpci irq map to take into account the address cells value defined in the fdt interrupt controller node. This is an intermediate solution to resolving the number cells to insert into the parent interrupt specifier. Ideally we want to extract the '#address-cells' value out of the fdt irq controller node (or default to 1 if not defined).
diff --git a/libsel4vmmplatsupport/plat_include/exynos5/sel4vmmplatsupport/plat/vpci.h b/libsel4vmmplatsupport/plat_include/exynos5/sel4vmmplatsupport/plat/vpci.h index c9fad3f..5ee439e 100644 --- a/libsel4vmmplatsupport/plat_include/exynos5/sel4vmmplatsupport/plat/vpci.h +++ b/libsel4vmmplatsupport/plat_include/exynos5/sel4vmmplatsupport/plat/vpci.h
@@ -27,3 +27,6 @@ #define PCI_MEM_REGION_ADDR 0x3F000000 /* PCI memory space size */ #define PCI_MEM_REGION_SIZE 0x1000000 + +/* FDT IRQ controller address cells definition */ +#define GIC_ADDRESS_CELLS 0x1
diff --git a/libsel4vmmplatsupport/plat_include/qemu-arm-virt/sel4vmmplatsupport/plat/vpci.h b/libsel4vmmplatsupport/plat_include/qemu-arm-virt/sel4vmmplatsupport/plat/vpci.h index 441a419..c892ffa 100644 --- a/libsel4vmmplatsupport/plat_include/qemu-arm-virt/sel4vmmplatsupport/plat/vpci.h +++ b/libsel4vmmplatsupport/plat_include/qemu-arm-virt/sel4vmmplatsupport/plat/vpci.h
@@ -27,3 +27,6 @@ #define PCI_MEM_REGION_ADDR 0xDF000000 /* PCI memory space size */ #define PCI_MEM_REGION_SIZE 0x1000000 + +/* FDT IRQ controller address cells definition */ +#define GIC_ADDRESS_CELLS 0x2
diff --git a/libsel4vmmplatsupport/plat_include/tk1/sel4vmmplatsupport/plat/vpci.h b/libsel4vmmplatsupport/plat_include/tk1/sel4vmmplatsupport/plat/vpci.h index c9fad3f..5ee439e 100644 --- a/libsel4vmmplatsupport/plat_include/tk1/sel4vmmplatsupport/plat/vpci.h +++ b/libsel4vmmplatsupport/plat_include/tk1/sel4vmmplatsupport/plat/vpci.h
@@ -27,3 +27,6 @@ #define PCI_MEM_REGION_ADDR 0x3F000000 /* PCI memory space size */ #define PCI_MEM_REGION_SIZE 0x1000000 + +/* FDT IRQ controller address cells definition */ +#define GIC_ADDRESS_CELLS 0x1
diff --git a/libsel4vmmplatsupport/plat_include/tx1/sel4vmmplatsupport/plat/vpci.h b/libsel4vmmplatsupport/plat_include/tx1/sel4vmmplatsupport/plat/vpci.h index 8aa0974..1a3a8d1 100644 --- a/libsel4vmmplatsupport/plat_include/tx1/sel4vmmplatsupport/plat/vpci.h +++ b/libsel4vmmplatsupport/plat_include/tx1/sel4vmmplatsupport/plat/vpci.h
@@ -27,3 +27,6 @@ #define PCI_MEM_REGION_ADDR 0x3EF000000 /* PCI memory space size */ #define PCI_MEM_REGION_SIZE 0x1000000 + +/* FDT IRQ controller address cells definition */ +#define GIC_ADDRESS_CELLS 0x1
diff --git a/libsel4vmmplatsupport/plat_include/tx2/sel4vmmplatsupport/plat/vpci.h b/libsel4vmmplatsupport/plat_include/tx2/sel4vmmplatsupport/plat/vpci.h index 8aa0974..1a3a8d1 100644 --- a/libsel4vmmplatsupport/plat_include/tx2/sel4vmmplatsupport/plat/vpci.h +++ b/libsel4vmmplatsupport/plat_include/tx2/sel4vmmplatsupport/plat/vpci.h
@@ -27,3 +27,6 @@ #define PCI_MEM_REGION_ADDR 0x3EF000000 /* PCI memory space size */ #define PCI_MEM_REGION_SIZE 0x1000000 + +/* FDT IRQ controller address cells definition */ +#define GIC_ADDRESS_CELLS 0x1
diff --git a/libsel4vmmplatsupport/src/arch/arm/devices/vpci.c b/libsel4vmmplatsupport/src/arch/arm/devices/vpci.c index a947206..9ed1ce3 100644 --- a/libsel4vmmplatsupport/src/arch/arm/devices/vpci.c +++ b/libsel4vmmplatsupport/src/arch/arm/devices/vpci.c
@@ -59,8 +59,16 @@ struct pci_interrupt_map { struct pci_interrupt_map_mask pci_mask; uint32_t gic_phandle; +#if GIC_ADDRESS_CELLS == 0x1 + /* FIXME Ideally we want to extract the address cells value out of the irq controller fdt node */ uint32_t irq_type; uint32_t irq_num; +#elif GIC_ADDRESS_CELLS == 0x2 + uint64_t irq_type; + uint64_t irq_num; +#else +#error "Undefined GIC Address Cells" +#endif uint32_t irq_flags; } PACKED; @@ -292,7 +300,11 @@ irq_map.pci_mask.irq_pin = cpu_to_fdt32(pci_config->interrupt_pin); irq_map.gic_phandle = cpu_to_fdt32(gic_phandle); irq_map.irq_type = 0; +#if GIC_ADDRESS_CELLS == 0x1 irq_map.irq_num = cpu_to_fdt32(pci_config->interrupt_line - 32); +#else + irq_map.irq_num = cpu_to_fdt64(pci_config->interrupt_line - 32); +#endif irq_map.irq_flags = cpu_to_fdt32(0x4); FDT_OP(fdt_appendprop(fdt, pci_node, "interrupt-map", &irq_map, sizeof(irq_map))); is_irq_map = true;