Signed-off-by: Ralf Ramsauer <[email protected]>
---
inmates/lib/arm-common/gic-v2.c | 5 -----
inmates/lib/arm-common/gic-v3.c | 5 -----
inmates/lib/arm-common/gic.c | 15 +++++++++++----
inmates/lib/arm-common/include/gic.h | 2 --
4 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/inmates/lib/arm-common/gic-v2.c b/inmates/lib/arm-common/gic-v2.c
index ab85fd27..51066fa9 100644
--- a/inmates/lib/arm-common/gic-v2.c
+++ b/inmates/lib/arm-common/gic-v2.c
@@ -36,7 +36,6 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <mach.h>
#include <gic.h>
#define GICC_CTLR 0x0000
@@ -87,7 +86,3 @@ const struct gic gic_v2 = {
.write_eoi = gic_v2_write_eoi,
.read_ack = gic_v2_read_ack,
};
-
-#if GIC_VERSION == 2
-extern const struct gic gic __attribute__((alias("gic_v2")));
-#endif
diff --git a/inmates/lib/arm-common/gic-v3.c b/inmates/lib/arm-common/gic-v3.c
index 530374c6..7ae2ac82 100644
--- a/inmates/lib/arm-common/gic-v3.c
+++ b/inmates/lib/arm-common/gic-v3.c
@@ -37,7 +37,6 @@
*/
#include <asm/sysregs.h>
-#include <mach.h>
#include <gic.h>
static void *gicd_v3_base;
@@ -132,7 +131,3 @@ const struct gic gic_v3 = {
.write_eoi = gic_v3_write_eoi,
.read_ack = gic_v3_read_ack,
};
-
-#if GIC_VERSION == 3
-extern const struct gic gic __attribute__((alias("gic_v3")));
-#endif
diff --git a/inmates/lib/arm-common/gic.c b/inmates/lib/arm-common/gic.c
index 4c7a884f..405984f9 100644
--- a/inmates/lib/arm-common/gic.c
+++ b/inmates/lib/arm-common/gic.c
@@ -39,7 +39,11 @@
#include <inmate.h>
#include <gic.h>
+extern const struct gic gic_v2;
+extern const struct gic gic_v3;
+
static irq_handler_t irq_handler = (irq_handler_t)NULL;
+static const struct gic *gic = &gic_v2;
/* Replaces the weak reference in header.S */
void vector_irq(void)
@@ -47,20 +51,23 @@ void vector_irq(void)
u32 irqn;
while (1) {
- irqn = gic.read_ack();
+ irqn = gic->read_ack();
if (irqn == 0x3ff)
break;
if (irq_handler)
irq_handler(irqn);
- gic.write_eoi(irqn);
+ gic->write_eoi(irqn);
}
}
void gic_setup(irq_handler_t handler)
{
- gic.init();
+ if (comm_region->gic_version == 3)
+ gic = &gic_v3;
+
+ gic->init();
irq_handler = handler;
@@ -69,5 +76,5 @@ void gic_setup(irq_handler_t handler)
void gic_enable_irq(unsigned int irq)
{
- gic.enable(irq);
+ gic->enable(irq);
}
diff --git a/inmates/lib/arm-common/include/gic.h
b/inmates/lib/arm-common/include/gic.h
index c96227b4..d1977af6 100644
--- a/inmates/lib/arm-common/include/gic.h
+++ b/inmates/lib/arm-common/include/gic.h
@@ -55,8 +55,6 @@ struct gic {
u32 (*read_ack)(void);
};
-extern const struct gic gic;
-
#endif /* !__ASSEMBLY__ */
#include <arch/gic.h>
--
2.17.0
--
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.