Skip to content

Commit 3d503e9

Browse files
GuEe-GUIRbb666
authored andcommitted
[DRIVER/PIC] Add ARM GICv2/v3 V2M, ITS support.
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]>
1 parent 94e4975 commit 3d503e9

File tree

8 files changed

+2159
-56
lines changed

8 files changed

+2159
-56
lines changed

components/drivers/pic/Kconfig

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
menuconfig RT_USING_PIC
22
bool "Using Programmable Interrupt Controller (PIC)"
3-
select RT_USING_BITMAP
3+
select RT_USING_ADT
4+
select RT_USING_ADT_BITMAP
45
depends on RT_USING_DM
56
default n
67

@@ -22,12 +23,31 @@ config RT_PIC_ARM_GIC
2223
select RT_USING_OFW
2324
default n
2425

26+
config RT_PIC_ARM_GIC_V2M
27+
bool "ARM GIC V2M" if RT_PIC_ARM_GIC && RT_PCI_MSI
28+
depends on RT_USING_OFW
29+
default n
30+
2531
config RT_PIC_ARM_GIC_V3
2632
bool "ARM GICv3"
2733
depends on RT_USING_PIC
2834
select RT_USING_OFW
2935
default n
3036

37+
config RT_PIC_ARM_GIC_V3_ITS
38+
bool "ARM GICv3 ITS (Interrupt Translation Service)" if RT_PIC_ARM_GIC_V3 && RT_PCI_MSI
39+
depends on RT_USING_OFW
40+
select RT_USING_ADT_REF
41+
default n
42+
43+
config RT_PIC_ARM_GIC_V3_ITS_IRQ_MAX
44+
int "IRQ maximum used"
45+
depends on RT_PIC_ARM_GIC_V3_ITS
46+
default 127 if ARCH_CPU_64BIT
47+
default 63
48+
help
49+
Recommended to be based on the bit length (full bits) of maximum usage.
50+
3151
config RT_PIC_ARM_GIC_MAX_NR
3252
int
3353
depends on RT_USING_PIC

components/drivers/pic/SConscript

+6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ if GetDepend(['RT_PIC_ARM_GIC']) or GetDepend(['RT_PIC_ARM_GIC_V3']):
1616
if GetDepend(['RT_PIC_ARM_GIC']):
1717
src += ['pic-gicv2.c']
1818

19+
if GetDepend(['RT_PIC_ARM_GIC_V2M']):
20+
src += ['pic-gicv2m.c']
21+
1922
if GetDepend(['RT_PIC_ARM_GIC_V3']):
2023
src += ['pic-gicv3.c']
2124

25+
if GetDepend(['RT_PIC_ARM_GIC_V3_ITS']):
26+
src += ['pic-gicv3-its.c']
27+
2228
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
2329

2430
Return('group')

components/drivers/pic/pic-gic-common.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
* 2023-01-30 GuEe-GUI first version
99
*/
1010

11-
#ifndef __IRQ_GIC_COMMON_H__
12-
#define __IRQ_GIC_COMMON_H__
11+
#ifndef __PIC_GIC_COMMON_H__
12+
#define __PIC_GIC_COMMON_H__
1313

1414
#include <rtdef.h>
15+
16+
#ifdef RT_PCI_MSI
17+
#include <drivers/pci_msi.h>
18+
#endif
1519
#include <drivers/ofw.h>
1620

1721
#define GIC_SGI_NR 16
@@ -52,4 +56,4 @@ rt_err_t gicv2m_ofw_probe(struct rt_ofw_node *ic_np, const struct rt_ofw_node_id
5256
rt_err_t gicv3_its_ofw_probe(struct rt_ofw_node *ic_np, const struct rt_ofw_node_id *id);
5357
#endif
5458

55-
#endif /* __IRQ_GIC_COMMON_H__ */
59+
#endif /* __PIC_GIC_COMMON_H__ */

components/drivers/pic/pic-gicv2.c

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ static void gicv2_cpu_init(struct gicv2 *gic)
128128

129129
#ifdef ARCH_SUPPORT_HYP
130130
_gicv2_eoi_mode_ns = RT_TRUE;
131+
#else
132+
_gicv2_eoi_mode_ns = !!rt_ofw_bootargs_select("pic.gicv2_eoimode", 0);
131133
#endif
132134

133135
if (_gicv2_eoi_mode_ns)

0 commit comments

Comments
 (0)