summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuEe-GUI <[email protected]>2024-12-09 19:35:46 +0800
committerRbb666 <[email protected]>2024-12-18 21:42:12 +0800
commitb294fba5657afcc7b18bac488d2554a74fa8cc82 (patch)
tree2c718fbe58516e6af9c51a8d8c0a097042d625c5
parentc9ab55f7a5c58915cad292d57be1aa9de24494a8 (diff)
[DM/PIC] Support AMP mode
Only support on >= ARM GICv2 Signed-off-by: GuEe-GUI <[email protected]>
-rw-r--r--components/drivers/pic/pic-gicv2.c7
-rw-r--r--components/drivers/pic/pic-gicv2.h2
-rw-r--r--components/drivers/pic/pic-gicv3.c7
-rw-r--r--components/drivers/pic/pic-gicv3.h2
4 files changed, 18 insertions, 0 deletions
diff --git a/components/drivers/pic/pic-gicv2.c b/components/drivers/pic/pic-gicv2.c
index c92172dd1c..dbfd443f9c 100644
--- a/components/drivers/pic/pic-gicv2.c
+++ b/components/drivers/pic/pic-gicv2.c
@@ -83,6 +83,11 @@ static void gicv2_dist_init(struct gicv2 *gic)
LOG_D("Max irq = %d", gic->max_irq);
+ if (gic->skip_init)
+ {
+ return;
+ }
+
HWREG32(base + GIC_DIST_CTRL) = GICD_DISABLE;
/* 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_
break;
}
+ gic->skip_init = rt_ofw_prop_read_bool(np, "skip-init");
+
gic_common_init_quirk_ofw(np, _gicv2_quirks, gic);
gicv2_init(gic);
diff --git a/components/drivers/pic/pic-gicv2.h b/components/drivers/pic/pic-gicv2.h
index 69f9651d1f..5fa9f2af99 100644
--- a/components/drivers/pic/pic-gicv2.h
+++ b/components/drivers/pic/pic-gicv2.h
@@ -78,6 +78,8 @@ struct gicv2
rt_size_t hyp_size;
void *vcpu_base;
rt_size_t vcpu_size;
+
+ rt_bool_t skip_init;
};
#endif /* __IRQ_GICV2_H__ */
diff --git a/components/drivers/pic/pic-gicv3.c b/components/drivers/pic/pic-gicv3.c
index cb8e0388e4..7a11f35dec 100644
--- a/components/drivers/pic/pic-gicv3.c
+++ b/components/drivers/pic/pic-gicv3.c
@@ -216,6 +216,11 @@ static void gicv3_dist_init(void)
LOG_D("%d SPIs implemented", _gic.line_nr - 32);
LOG_D("%d Extended SPIs implemented", _gic.espi_nr);
+ if (_gic.skip_init)
+ {
+ goto _get_max_irq;
+ }
+
/* Disable the distributor */
HWREG32(base + GICD_CTLR) = 0;
gicv3_dist_wait_for_rwp();
@@ -266,6 +271,7 @@ static void gicv3_dist_init(void)
HWREG64(base + GICD_IROUTERnE + i * 8) = affinity;
}
+_get_max_irq:
if (GICD_TYPER_NUM_LPIS(_gic.gicd_typer) > 1)
{
/* 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_
redist_stride = 0;
}
_gic.redist_stride = redist_stride;
+ _gic.skip_init = rt_ofw_prop_read_bool(np, "skip-init");
gic_common_init_quirk_ofw(np, _gicv3_quirks, &_gic.parent);
gicv3_init();
diff --git a/components/drivers/pic/pic-gicv3.h b/components/drivers/pic/pic-gicv3.h
index dcd64d6582..61c5ae1e38 100644
--- a/components/drivers/pic/pic-gicv3.h
+++ b/components/drivers/pic/pic-gicv3.h
@@ -385,6 +385,8 @@ struct gicv3
rt_uint64_t redist_flags;
rt_size_t redist_stride;
rt_size_t redist_regions_nr;
+
+ rt_bool_t skip_init;
};
#endif /* __PIC_GICV3_H__ */