xen/arm: gic-v3: Clean-up the GIC*_PIDR2_* definitions

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>
This commit is contained in:
Julien Grall authored and Ian Campbell committed 2015-09-24 11:47:52 +01:00
1 parent c57e6ebd8c
commit 55e8b12a5c
2 files changed
+8 -12

No files matched your search

+4 -4
View 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",
+4 -8
View File
@@ -40,6 +40,10 @@
#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)
@@ -59,14 +63,6 @@
#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?
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.