APM88xx and gicv3_mmio: use correct addresses
authorLukas Humbel <lukas.humbel@inf.ethz.ch>
Thu, 30 Mar 2017 11:22:20 +0000 (13:22 +0200)
committerLukas Humbel <lukas.humbel@inf.ethz.ch>
Thu, 30 Mar 2017 11:22:20 +0000 (13:22 +0200)
Unfortunately, it still doesn't work. But this way, it gets correct values
in the identification registers IIDR.

Signed-off-by: Lukas Humbel <lukas.humbel@inf.ethz.ch>

kernel/arch/armv8/gic_v3_mmio.c
kernel/arch/armv8/plat_apm88xxxx_consts.c

index 8c01803..15a96c5 100644 (file)
@@ -31,13 +31,21 @@ errval_t gicv3_init(void)
 {
     printk(LOG_NOTE, "gicv3_init (mem-mapped CPU if) enter\n");
 
+    lvaddr_t gic_dist = local_phys_to_mem(platform_get_distributor_address());
+    gic_v3_initialize(&gic_v3_dev, (char *)gic_dist);
+
     lvaddr_t gic_cpu = local_phys_to_mem(platform_get_gic_cpu_address());
-    gic_v3_initialize(&gic_v3_dev, (char *)gic_cpu);
+    gic_v3_cpu_initialize(&gic_v3_cpu_dev, (char *)gic_cpu);
 
-    lvaddr_t gic_dist = local_phys_to_mem(platform_get_distributor_address());
-    gic_v3_cpu_initialize(&gic_v3_cpu_dev, (char *)gic_dist);
+    if(gic_v3_GICD_CTLR_secure_DS_rdf(&gic_v3_dev)){
+        printk(LOG_NOTE, "gicv3_init: GIC supports secure mode\n"); 
+    } else {
+        printk(LOG_NOTE, "gicv3_init: GIC does not support secure mode\n"); 
+    }
 
     printk(LOG_NOTE, "gicv3_init done\n");
+
+
     return SYS_ERR_OK;
 }
 
@@ -89,6 +97,14 @@ errval_t gicv3_cpu_interface_enable(void)
 {
     printk(LOG_NOTE, "gicv3_cpu_interface_enable: enabling group 1 int\n");
 
+    printk(LOG_NOTE, "GICC IIDR "
+            "implementer=0x%x, revision=0x%x, variant=0x%x, prodid=0x%x\n",
+            gic_v3_cpu_IIDR_Implementer_rdf(&gic_v3_cpu_dev),
+            gic_v3_cpu_IIDR_Revision_rdf(&gic_v3_cpu_dev),
+            gic_v3_cpu_IIDR_Variant_rdf(&gic_v3_cpu_dev),
+            gic_v3_cpu_IIDR_ProductID_rdf(&gic_v3_cpu_dev)
+            );
+
     // Linux does: 
     // sets priority mode: PMR to 0xf0
     gic_v3_cpu_PMR_wr(&gic_v3_cpu_dev, 0xf0);
index 4e2cfda..6f778bb 100644 (file)
@@ -24,9 +24,19 @@ lpaddr_t phys_memory_start= 0;
  * ----------------------------------------------------------------------------
  */
 
+// These values are from the APM88xx manual
+//lpaddr_t platform_gic_cpu_base  = 0x00000000781e2000;
+//lpaddr_t platform_gic_dist_base = 0x0000000078121000;
+
+// These values are from linux devicetree file
 lpaddr_t platform_gic_cpu_base  = 0x0000000078020000;
 lpaddr_t platform_gic_dist_base = 0x0000000078010000;
 
+/*
+lpaddr_t platform_gic_cpu_base  = 0x0000000078010000;
+lpaddr_t platform_gic_dist_base = 0x0000000078020000;
+*/
+
 
 /*
  * ----------------------------------------------------------------------------