Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/drivers/include/drivers/pic.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void rt_pic_default_name(struct rt_pic *pic);
struct rt_pic *rt_pic_dynamic_cast(void *ptr);

rt_err_t rt_pic_linear_irq(struct rt_pic *pic, rt_size_t irq_nr);
rt_err_t rt_pic_cancel_irq(struct rt_pic *pic);

int rt_pic_config_ipi(struct rt_pic *pic, int ipi_index, int hwirq);
int rt_pic_config_irq(struct rt_pic *pic, int irq_index, int hwirq);
Expand Down
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