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
4 changes: 4 additions & 0 deletions components/drivers/include/drivers/core/dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
extern int rt_hw_cpu_id(void);
#endif

#ifndef RT_MAX_IPI
#define RT_MAX_IPI 0
#endif

void rt_dm_secondary_cpu_init(void);

/* ID Allocation */
Expand Down
4 changes: 4 additions & 0 deletions components/drivers/pic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ config RT_PIC_ARM_GIC_MAX_NR
depends on RT_PIC_ARM_GIC
default 2 if SOC_REALVIEW
default 1

if RT_USING_PIC
osource "$(SOC_DM_PIC_DIR)/Kconfig"
endif
18 changes: 7 additions & 11 deletions components/drivers/pic/pic-gic-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,16 @@ void gic_common_init_quirk_hw(rt_uint32_t iidr, const struct gic_quirk *quirks,
void gic_common_sgi_config(void *base, void *data, int irq_base)
{
#ifdef RT_USING_SMP
if (irq_base < 2)
if (irq_base < RT_MAX_IPI)
{
struct rt_pic_irq *pirq;

#define DECLARE_GIC_IPI(ipi, hwirq) \
rt_pic_config_ipi(data, ipi, hwirq); \
pirq = rt_pic_find_ipi(data, ipi); \
pirq->mode = RT_IRQ_MODE_EDGE_RISING; \

DECLARE_GIC_IPI(RT_SCHEDULE_IPI, RT_SCHEDULE_IPI);
DECLARE_GIC_IPI(RT_STOP_IPI, RT_STOP_IPI);
DECLARE_GIC_IPI(RT_SMP_CALL_IPI, RT_SMP_CALL_IPI);

#undef DECLARE_GIC_IPI
for (int ipi = 0; ipi < RT_MAX_IPI; ++ipi)
{
rt_pic_config_ipi(data, ipi, ipi);
pirq = rt_pic_find_ipi(data, ipi);
pirq->mode = RT_IRQ_MODE_EDGE_RISING;
}
}
#endif /* RT_USING_SMP */
}
Expand Down
17 changes: 4 additions & 13 deletions components/drivers/pic/pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,8 @@ struct irq_traps
rt_bool_t (*handler)(void *);
};

static int _ipi_hash[] =
{
#ifdef RT_USING_SMP
[RT_SCHEDULE_IPI] = RT_SCHEDULE_IPI,
[RT_STOP_IPI] = RT_STOP_IPI,
[RT_SMP_CALL_IPI] = RT_SMP_CALL_IPI,
#endif
};

/* reserved ipi */
static int _pirq_hash_idx = RT_ARRAY_SIZE(_ipi_hash);
static int _pirq_hash_idx = RT_MAX_IPI;
static struct rt_pic_irq _pirq_hash[MAX_HANDLERS] =
{
[0 ... MAX_HANDLERS - 1] =
Expand Down Expand Up @@ -230,7 +221,7 @@ int rt_pic_config_ipi(struct rt_pic *pic, int ipi_index, int hwirq)
int ipi = ipi_index;
struct rt_pic_irq *pirq;

if (pic && ipi < RT_ARRAY_SIZE(_ipi_hash) && hwirq >= 0 && pic->ops->irq_send_ipi)
if (pic && ipi < RT_MAX_IPI && hwirq >= 0 && pic->ops->irq_send_ipi)
{
pirq = &_pirq_hash[ipi];
config_pirq(pic, pirq, ipi, hwirq);
Expand Down Expand Up @@ -281,7 +272,7 @@ struct rt_pic_irq *rt_pic_find_ipi(struct rt_pic *pic, int ipi_index)
{
struct rt_pic_irq *pirq = &_pirq_hash[ipi_index];

RT_ASSERT(ipi_index < RT_ARRAY_SIZE(_ipi_hash));
RT_ASSERT(ipi_index < RT_MAX_IPI);
RT_ASSERT(pirq->pic == pic);

return pirq;
Expand Down Expand Up @@ -1290,7 +1281,7 @@ static int list_irq(int argc, char**argv)
#ifdef RT_USING_SMP
rt_kputs(cpumask);
#endif
rt_kprintf("%-10d ", repeat_isr->action.counter);
rt_kprintf(" %-10d ", repeat_isr->action.counter);
rt_kprintf("%-*.s", 10, repeat_isr->action.name);
#ifdef RT_USING_SMP
for (int cpuid = 0; cpuid < RT_CPUS_NR; cpuid++)
Expand Down