Skip to content

Commit b294fba

Browse files
GuEe-GUIRbb666
authored andcommitted
[DM/PIC] Support AMP mode
Only support on >= ARM GICv2 Signed-off-by: GuEe-GUI <[email protected]>
1 parent c9ab55f commit b294fba

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

components/drivers/pic/pic-gicv2.c

+7
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ static void gicv2_dist_init(struct gicv2 *gic)
8383

8484
LOG_D("Max irq = %d", gic->max_irq);
8585

86+
if (gic->skip_init)
87+
{
88+
return;
89+
}
90+
8691
HWREG32(base + GIC_DIST_CTRL) = GICD_DISABLE;
8792

8893
/* Set all global (unused) interrupts to this CPU only. */
@@ -620,6 +625,8 @@ static rt_err_t gicv2_ofw_init(struct rt_ofw_node *np, const struct rt_ofw_node_
620625
break;
621626
}
622627

628+
gic->skip_init = rt_ofw_prop_read_bool(np, "skip-init");
629+
623630
gic_common_init_quirk_ofw(np, _gicv2_quirks, gic);
624631
gicv2_init(gic);
625632

components/drivers/pic/pic-gicv2.h

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ struct gicv2
7878
rt_size_t hyp_size;
7979
void *vcpu_base;
8080
rt_size_t vcpu_size;
81+
82+
rt_bool_t skip_init;
8183
};
8284

8385
#endif /* __IRQ_GICV2_H__ */

components/drivers/pic/pic-gicv3.c

+7
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ static void gicv3_dist_init(void)
216216
LOG_D("%d SPIs implemented", _gic.line_nr - 32);
217217
LOG_D("%d Extended SPIs implemented", _gic.espi_nr);
218218

219+
if (_gic.skip_init)
220+
{
221+
goto _get_max_irq;
222+
}
223+
219224
/* Disable the distributor */
220225
HWREG32(base + GICD_CTLR) = 0;
221226
gicv3_dist_wait_for_rwp();
@@ -266,6 +271,7 @@ static void gicv3_dist_init(void)
266271
HWREG64(base + GICD_IROUTERnE + i * 8) = affinity;
267272
}
268273

274+
_get_max_irq:
269275
if (GICD_TYPER_NUM_LPIS(_gic.gicd_typer) > 1)
270276
{
271277
/* Max LPI = 8192 + Math.pow(2, num_LPIs + 1) - 1 */
@@ -1063,6 +1069,7 @@ static rt_err_t gicv3_ofw_init(struct rt_ofw_node *np, const struct rt_ofw_node_
10631069
redist_stride = 0;
10641070
}
10651071
_gic.redist_stride = redist_stride;
1072+
_gic.skip_init = rt_ofw_prop_read_bool(np, "skip-init");
10661073

10671074
gic_common_init_quirk_ofw(np, _gicv3_quirks, &_gic.parent);
10681075
gicv3_init();

components/drivers/pic/pic-gicv3.h

+2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ struct gicv3
385385
rt_uint64_t redist_flags;
386386
rt_size_t redist_stride;
387387
rt_size_t redist_regions_nr;
388+
389+
rt_bool_t skip_init;
388390
};
389391

390392
#endif /* __PIC_GICV3_H__ */

0 commit comments

Comments
 (0)