]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: gic: Refactor the code for creating gic node
authorSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Thu, 23 Apr 2015 04:51:59 +0000 (23:51 -0500)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 8 May 2015 15:57:42 +0000 (16:57 +0100)
Since fdt_begin_node() is called by all gicXX_make_dt_node() to create
the interrupt-controller devicetree node, this patch refactors the call
and moves it inside make_gic_node(). This also matches the fdt_end_node()
call at the end of make_gic_node().

This patch also move the call to gic_make_node() wrapper to be after all
other generic properties are setup. This allows creating sub-node inside
gic_make_node() in order to support v2m sub-node.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/domain_build.c
xen/arch/arm/gic-hip04.c
xen/arch/arm/gic-v2.c
xen/arch/arm/gic-v3.c

index e9307f676c0e754898d6214f644f09ca09cf2a71..1e545fe560c1104fe1cc7de36ce5c175b4f4b556 100644 (file)
@@ -808,8 +808,8 @@ static int make_gic_node(const struct domain *d, void *fdt,
 {
     const struct dt_device_node *gic = dt_interrupt_controller;
     int res = 0;
-    const void *addrcells;
-    u32 addrcells_len;
+    const void *addrcells, *sizecells;
+    u32 addrcells_len, sizecells_len;
 
     /*
      * Xen currently supports only a single GIC. Discard any secondary
@@ -823,7 +823,7 @@ static int make_gic_node(const struct domain *d, void *fdt,
 
     DPRINT("Create gic node\n");
 
-    res = gic_make_node(d, node, fdt);
+    res = fdt_begin_node(fdt, "interrupt-controller");
     if ( res )
         return res;
 
@@ -847,6 +847,14 @@ static int make_gic_node(const struct domain *d, void *fdt,
             return res;
     }
 
+    sizecells = dt_get_property(gic, "#size-cells", &sizecells_len);
+    if ( sizecells )
+    {
+        res = fdt_property(fdt, "#size-cells", sizecells, sizecells_len);
+        if ( res )
+            return res;
+    }
+
     res = fdt_property_cell(fdt, "#interrupt-cells", 3);
     if ( res )
         return res;
@@ -855,6 +863,10 @@ static int make_gic_node(const struct domain *d, void *fdt,
     if ( res )
         return res;
 
+    res = gic_make_node(d, node, fdt);
+    if ( res )
+        return res;
+
     res = fdt_end_node(fdt);
 
     return res;
index 223c4149f1798fdef0dfb9170bdc68694ff0090d..6d527f146974184f4d6b193e455394e37a3b9b43 100644 (file)
@@ -628,10 +628,6 @@ static int hip04gic_make_dt_node(const struct domain *d,
     compatible = DT_COMPAT_GIC_CORTEX_A15;
     len = strlen((char*) compatible) + 1;
 
-    res = fdt_begin_node(fdt, "interrupt-controller");
-    if ( res )
-        return res;
-
     res = fdt_property(fdt, "compatible", compatible, len);
     if ( res )
         return res;
index 073fec2735fd83f4dbf4809488589adb95f9df44..80acc6227130b3c7bfd84e9acd08459b7d912649 100644 (file)
@@ -616,10 +616,6 @@ static int gicv2_make_dt_node(const struct domain *d,
         return -FDT_ERR_XEN(ENOENT);
     }
 
-    res = fdt_begin_node(fdt, "interrupt-controller");
-    if ( res )
-        return res;
-
     res = fdt_property(fdt, "compatible", compatible, len);
     if ( res )
         return res;
index e9a8edaa192945575a5562469509b546df35430e..db498edce47899c54acde3d460e79f86ed78342b 100644 (file)
@@ -1098,10 +1098,6 @@ static int gicv3_make_dt_node(const struct domain *d,
         return -FDT_ERR_XEN(ENOENT);
     }
 
-    res = fdt_begin_node(fdt, "interrupt-controller");
-    if ( res )
-        return res;
-
     res = fdt_property(fdt, "compatible", compatible, len);
     if ( res )
         return res;