NO GICv3 support at the moment!

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 inmates/lib/arm-common/gic-v2.c         | 9 +++++++++
 inmates/lib/arm-common/gic.c            | 5 +++++
 inmates/lib/arm-common/include/gic.h    | 1 +
 inmates/lib/arm-common/include/inmate.h | 1 +
 4 files changed, 16 insertions(+)

diff --git a/inmates/lib/arm-common/gic-v2.c b/inmates/lib/arm-common/gic-v2.c
index 46999b0d..e0b590de 100644
--- a/inmates/lib/arm-common/gic-v2.c
+++ b/inmates/lib/arm-common/gic-v2.c
@@ -50,6 +50,7 @@
 #define GICC_EOIR              0x0010
 #define GICD_CTLR              0x0000
 #define  GICD_CTLR_ENABLE      (1 << 0)
+#define GICD_SGIR              0xf00
 
 #define GICC_CTLR_GRPEN1       (1 << 0)
 
@@ -80,9 +81,17 @@ static u32 gic_v2_read_ack(void)
        return mmio_read32(GICC_V2_BASE + GICC_IAR);
 }
 
+static void gic_v2_issue_sgi(u8 routing_mode, u8 target_list, u8 sgi)
+{
+       mmio_write32(GICD_V2_BASE + GICD_SGIR,
+                    ((routing_mode & 0x3) << 24) |
+                     (target_list << 16) | (sgi & 0xf));
+}
+
 const struct gic gic_v2 = {
        .init = gic_v2_init,
        .enable = gic_v2_enable,
        .write_eoi = gic_v2_write_eoi,
        .read_ack = gic_v2_read_ack,
+       .issue_sgi = gic_v2_issue_sgi,
 };
diff --git a/inmates/lib/arm-common/gic.c b/inmates/lib/arm-common/gic.c
index 475a38b6..0bd080de 100644
--- a/inmates/lib/arm-common/gic.c
+++ b/inmates/lib/arm-common/gic.c
@@ -81,3 +81,8 @@ void gic_enable_irq(unsigned int irq)
 {
        gic.enable(irq);
 }
+
+void gic_issue_sgi(u8 routing_mode, u8 target_list, u8 sgi)
+{
+       gic.issue_sgi(routing_mode, target_list, sgi);
+}
diff --git a/inmates/lib/arm-common/include/gic.h 
b/inmates/lib/arm-common/include/gic.h
index 86c1e389..09ca90e1 100644
--- a/inmates/lib/arm-common/include/gic.h
+++ b/inmates/lib/arm-common/include/gic.h
@@ -56,6 +56,7 @@ struct gic {
        void (*enable)(unsigned int irqn);
        void (*write_eoi)(u32 irqn);
        u32 (*read_ack)(void);
+       void (*issue_sgi)(u8 routing_mode, u8 target_list, u8 sgi);
 };
 
 extern const struct gic gic_v2, gic_v3;
diff --git a/inmates/lib/arm-common/include/inmate.h 
b/inmates/lib/arm-common/include/inmate.h
index 6611b311..c9ea6063 100644
--- a/inmates/lib/arm-common/include/inmate.h
+++ b/inmates/lib/arm-common/include/inmate.h
@@ -89,6 +89,7 @@ static inline unsigned long cpu_id(void)
 typedef void (*irq_handler_t)(unsigned int);
 void gic_setup(irq_handler_t handler, void *irq_stack);
 void gic_enable_irq(unsigned int irq);
+void gic_issue_sgi(u8 routing_mode, u8 target_list, u8 sgi);
 
 unsigned long timer_get_frequency(void);
 u64 timer_get_ticks(void);
-- 
2.14.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to