Skip to content

Commit

Permalink
[DRIVER/PIC] Add ARM GICv2/v3 V2M, ITS support.
Browse files Browse the repository at this point in the history
Fix some code style and init for V2M, ITS.

V2M is the PCI MSI/MSI-X for GICv2.
ITS is the PCI MSI/MSI-X for GICv3/v4.

Signed-off-by: GuEe-GUI <[email protected]>
  • Loading branch information
GuEe-GUI authored and Rbb666 committed Sep 19, 2024
1 parent 94e4975 commit 3d503e9
Show file tree
Hide file tree
Showing 8 changed files with 2,159 additions and 56 deletions.
22 changes: 21 additions & 1 deletion components/drivers/pic/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
menuconfig RT_USING_PIC
bool "Using Programmable Interrupt Controller (PIC)"
select RT_USING_BITMAP
select RT_USING_ADT
select RT_USING_ADT_BITMAP
depends on RT_USING_DM
default n

Expand All @@ -22,12 +23,31 @@ config RT_PIC_ARM_GIC
select RT_USING_OFW
default n

config RT_PIC_ARM_GIC_V2M
bool "ARM GIC V2M" if RT_PIC_ARM_GIC && RT_PCI_MSI
depends on RT_USING_OFW
default n

config RT_PIC_ARM_GIC_V3
bool "ARM GICv3"
depends on RT_USING_PIC
select RT_USING_OFW
default n

config RT_PIC_ARM_GIC_V3_ITS
bool "ARM GICv3 ITS (Interrupt Translation Service)" if RT_PIC_ARM_GIC_V3 && RT_PCI_MSI
depends on RT_USING_OFW
select RT_USING_ADT_REF
default n

config RT_PIC_ARM_GIC_V3_ITS_IRQ_MAX
int "IRQ maximum used"
depends on RT_PIC_ARM_GIC_V3_ITS
default 127 if ARCH_CPU_64BIT
default 63
help
Recommended to be based on the bit length (full bits) of maximum usage.

config RT_PIC_ARM_GIC_MAX_NR
int
depends on RT_USING_PIC
Expand Down
6 changes: 6 additions & 0 deletions components/drivers/pic/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ if GetDepend(['RT_PIC_ARM_GIC']) or GetDepend(['RT_PIC_ARM_GIC_V3']):
if GetDepend(['RT_PIC_ARM_GIC']):
src += ['pic-gicv2.c']

if GetDepend(['RT_PIC_ARM_GIC_V2M']):
src += ['pic-gicv2m.c']

if GetDepend(['RT_PIC_ARM_GIC_V3']):
src += ['pic-gicv3.c']

if GetDepend(['RT_PIC_ARM_GIC_V3_ITS']):
src += ['pic-gicv3-its.c']

group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)

Return('group')
10 changes: 7 additions & 3 deletions components/drivers/pic/pic-gic-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
* 2023-01-30 GuEe-GUI first version
*/

#ifndef __IRQ_GIC_COMMON_H__
#define __IRQ_GIC_COMMON_H__
#ifndef __PIC_GIC_COMMON_H__
#define __PIC_GIC_COMMON_H__

#include <rtdef.h>

#ifdef RT_PCI_MSI
#include <drivers/pci_msi.h>
#endif
#include <drivers/ofw.h>

#define GIC_SGI_NR 16
Expand Down Expand Up @@ -52,4 +56,4 @@ rt_err_t gicv2m_ofw_probe(struct rt_ofw_node *ic_np, const struct rt_ofw_node_id
rt_err_t gicv3_its_ofw_probe(struct rt_ofw_node *ic_np, const struct rt_ofw_node_id *id);
#endif

#endif /* __IRQ_GIC_COMMON_H__ */
#endif /* __PIC_GIC_COMMON_H__ */
2 changes: 2 additions & 0 deletions components/drivers/pic/pic-gicv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ static void gicv2_cpu_init(struct gicv2 *gic)

#ifdef ARCH_SUPPORT_HYP
_gicv2_eoi_mode_ns = RT_TRUE;
#else
_gicv2_eoi_mode_ns = !!rt_ofw_bootargs_select("pic.gicv2_eoimode", 0);
#endif

if (_gicv2_eoi_mode_ns)
Expand Down
Loading

0 comments on commit 3d503e9

Please sign in to comment.