aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>2013-08-15 01:23:48 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-27 00:45:13 -0400
commitc8f5a57c62fcf821c435fc657f430a64205f3e99 (patch)
treed1fd3a798d05e125c3b7c36a4ea3d9289fe9b1f3 /arch/powerpc
parentd0ef440350ff9d1c72e52c837302df090c4d2725 (diff)
powerpc/pseries: Fix parsing of initial node path in update_dt_node
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>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/pseries/mobility.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 023e35470760..ed5426f5b03c 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -161,18 +161,19 @@ static int update_dt_node(u32 phandle, s32 scope)
161 161
162 prop_data = rtas_buf + sizeof(*upwa); 162 prop_data = rtas_buf + sizeof(*upwa);
163 163
164 /* The first element of the buffer is the path of the node 164 /* On the first call to ibm,update-properties for a node the
165 * being updated in the form of a 8 byte string length 165 * the first property value descriptor contains an empty
166 * followed by the string. Skip past this to get to the 166 * property name, the property value length encoded as u32,
167 * properties being updated. 167 * and the property value is the node path being updated.
168 */ 168 */
169 vd = *prop_data++; 169 if (*prop_data == 0) {
170 prop_data += vd; 170 prop_data++;
171 vd = *(u32 *)prop_data;
172 prop_data += vd + sizeof(vd);
173 upwa->nprops--;
174 }
171 175
172 /* The path we skipped over is counted as one of the elements 176 for (i = 0; i < upwa->nprops; i++) {
173 * returned so start counting at one.
174 */
175 for (i = 1; i < upwa->nprops; i++) {
176 char *prop_name; 177 char *prop_name;
177 178
178 prop_name = prop_data; 179 prop_name = prop_data;