]> xenbits.xensource.com Git - people/julieng/xen-unstable.git/commitdiff
xen/arm: gic-v3: Clean-up the GIC*_PIDR2_* definitions
authorJulien Grall <julien.grall@citrix.com>
Mon, 14 Sep 2015 15:32:23 +0000 (16:32 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 24 Sep 2015 10:47:52 +0000 (11:47 +0100)
GICR_PIDR2 and GICD_PIDR2 use the same register layout. Rather than
define twice, one of which is an alias to the other, introduce GIC_PIDR2_*
defines.

Also:
    * Use the same prefix for the mask and the value
    * Integrate the shift in the value to avoid shifting in the code
    * Use GICv* to match the value name in the spec
    * Move them in a proper place

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/gic-v3.c
xen/include/asm-arm/gic_v3_defs.h

index d1db1ce18f32a6e1952ba531a1bbcfb36c1fea80..4d623bfcf6fc4be431d14ba0143d2d5baf4c85dc 100644 (file)
@@ -639,8 +639,8 @@ static int __init gicv3_populate_rdist(void)
     {
         void __iomem *ptr = gicv3.rdist_regions[i].map_base;
 
-        reg = readl_relaxed(ptr + GICR_PIDR2) & GICR_PIDR2_ARCH_REV_MASK;
-        if ( (reg >> GICR_PIDR2_ARCH_REV_SHIFT) != GICR_PIDR2_ARCH_GICV3 )
+        reg = readl_relaxed(ptr + GICR_PIDR2) & GIC_PIDR2_ARCH_MASK;
+        if ( reg != GIC_PIDR2_ARCH_GICv3 )
         {
             dprintk(XENLOG_ERR,
                     "GICv3: No redistributor present @%"PRIpaddr"\n",
@@ -1193,8 +1193,8 @@ static int __init gicv3_init(void)
     if ( !gicv3.map_dbase )
         panic("GICv3: Failed to ioremap for GIC distributor\n");
 
-    reg = readl_relaxed(GICD + GICD_PIDR2) & GICD_PIDR2_ARCH_REV_MASK;
-    if ( ((reg >> GICD_PIDR2_ARCH_REV_SHIFT) != GICD_PIDR2_ARCH_GICV3) )
+    reg = readl_relaxed(GICD + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK;
+    if ( reg != GIC_PIDR2_ARCH_GICv3 )
          panic("GICv3: no distributor detected\n");
 
     if ( !dt_property_read_u32(node, "#redistributor-regions",
index bf7b239918c0bd7e445548e47d56f76c44fc149c..b0ac6ff55b7f1a15a0b504a3d4227b9e7e8a939a 100644 (file)
 #define GICD_PIDR5                   (0xFFD4)
 #define GICD_PIDR7                   (0xFFDC)
 
+/* Common between GICD_PIDR2 and GICR_PIDR2 */
+#define GIC_PIDR2_ARCH_MASK         (0xf0)
+#define GIC_PIDR2_ARCH_GICv3        (0x30)
+
 #define GICC_SRE_EL2_SRE             (1UL << 0)
 #define GICC_SRE_EL2_DFB             (1UL << 1)
 #define GICC_SRE_EL2_DIB             (1UL << 2)
 #define GICR_WAKER_ProcessorSleep    (1U << 1)
 #define GICR_WAKER_ChildrenAsleep    (1U << 2)
 
-#define GICD_PIDR2_ARCH_REV_MASK     (0xf0)
-#define GICD_PIDR2_ARCH_REV_SHIFT    (0x4)
-#define GICD_PIDR2_ARCH_GICV3        (0x3)
-
-#define GICR_PIDR2_ARCH_REV_MASK     GICD_PIDR2_ARCH_REV_MASK
-#define GICR_PIDR2_ARCH_REV_SHIFT    GICD_PIDR2_ARCH_REV_SHIFT
-#define GICR_PIDR2_ARCH_GICV3        GICD_PIDR2_ARCH_GICV3
-
 #define GICR_SYNCR_NOT_BUSY          1
 /*
  * Implementation defined value JEP106?