aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/dlpar.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/dlpar.c')
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 227c1c3d585e..72d8054fa739 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -129,20 +129,35 @@ struct device_node *dlpar_configure_connector(u32 drc_index)
129 struct property *property; 129 struct property *property;
130 struct property *last_property = NULL; 130 struct property *last_property = NULL;
131 struct cc_workarea *ccwa; 131 struct cc_workarea *ccwa;
132 char *data_buf;
132 int cc_token; 133 int cc_token;
133 int rc; 134 int rc = -1;
134 135
135 cc_token = rtas_token("ibm,configure-connector"); 136 cc_token = rtas_token("ibm,configure-connector");
136 if (cc_token == RTAS_UNKNOWN_SERVICE) 137 if (cc_token == RTAS_UNKNOWN_SERVICE)
137 return NULL; 138 return NULL;
138 139
139 spin_lock(&rtas_data_buf_lock); 140 data_buf = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
140 ccwa = (struct cc_workarea *)&rtas_data_buf[0]; 141 if (!data_buf)
142 return NULL;
143
144 ccwa = (struct cc_workarea *)&data_buf[0];
141 ccwa->drc_index = drc_index; 145 ccwa->drc_index = drc_index;
142 ccwa->zero = 0; 146 ccwa->zero = 0;
143 147
144 rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL); 148 do {
145 while (rc) { 149 /* Since we release the rtas_data_buf lock between configure
150 * connector calls we want to re-populate the rtas_data_buffer
151 * with the contents of the previous call.
152 */
153 spin_lock(&rtas_data_buf_lock);
154
155 memcpy(rtas_data_buf, data_buf, RTAS_DATA_BUF_SIZE);
156 rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL);
157 memcpy(data_buf, rtas_data_buf, RTAS_DATA_BUF_SIZE);
158
159 spin_unlock(&rtas_data_buf_lock);
160
146 switch (rc) { 161 switch (rc) {
147 case NEXT_SIBLING: 162 case NEXT_SIBLING:
148 dn = dlpar_parse_cc_node(ccwa); 163 dn = dlpar_parse_cc_node(ccwa);
@@ -197,18 +212,19 @@ struct device_node *dlpar_configure_connector(u32 drc_index)
197 "returned from configure-connector\n", rc); 212 "returned from configure-connector\n", rc);
198 goto cc_error; 213 goto cc_error;
199 } 214 }
215 } while (rc);
200 216
201 rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL); 217cc_error:
218 kfree(data_buf);
219
220 if (rc) {
221 if (first_dn)
222 dlpar_free_cc_nodes(first_dn);
223
224 return NULL;
202 } 225 }
203 226
204 spin_unlock(&rtas_data_buf_lock);
205 return first_dn; 227 return first_dn;
206
207cc_error:
208 if (first_dn)
209 dlpar_free_cc_nodes(first_dn);
210 spin_unlock(&rtas_data_buf_lock);
211 return NULL;
212} 228}
213 229
214static struct device_node *derive_parent(const char *path) 230static struct device_node *derive_parent(const char *path)