]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/pseries: Fix parsing of initial node path in update_dt_node
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Thu, 15 Aug 2013 05:23:48 +0000 (22:23 -0700)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 27 Aug 2013 04:45:13 +0000 (14:45 +1000)
On the first call to ibm,update-properties for a node the first property
returned is the full node path. Currently this is not parsed correctly by the
update_dt_node function. Commit 2e9b7b0 attempted to fix this, but was
incorrect as it made a wrong assumption about the layout of the first
property in the work area. Further, if ibm,update-properties must be called
multiple times for the same node this special property should only be skipped
after the initial call. The first property descriptor returned consists of
the property name, property value length, and property value. The property
name is an empty string, property length is encoded in 4 byte integer, and
the property value is the node path.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/pseries/mobility.c

index 023e35470760c55997dd6a3d5d8f15c2b02b8f0b..ed5426f5b03cf176866c6df638057ec4e8347182 100644 (file)
@@ -161,18 +161,19 @@ static int update_dt_node(u32 phandle, s32 scope)
 
                prop_data = rtas_buf + sizeof(*upwa);
 
-               /* The first element of the buffer is the path of the node
-                * being updated in the form of a 8 byte string length
-                * followed by the string. Skip past this to get to the
-                * properties being updated.
+               /* On the first call to ibm,update-properties for a node the
+                * the first property value descriptor contains an empty
+                * property name, the property value length encoded as u32,
+                * and the property value is the node path being updated.
                 */
-               vd = *prop_data++;
-               prop_data += vd;
+               if (*prop_data == 0) {
+                       prop_data++;
+                       vd = *(u32 *)prop_data;
+                       prop_data += vd + sizeof(vd);
+                       upwa->nprops--;
+               }
 
-               /* The path we skipped over is counted as one of the elements
-                * returned so start counting at one.
-                */
-               for (i = 1; i < upwa->nprops; i++) {
+               for (i = 0; i < upwa->nprops; i++) {
                        char *prop_name;
 
                        prop_name = prop_data;