Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 210298
b: refs/heads/master
c: 93f68f1
h: refs/heads/master
v: v3
  • Loading branch information
Nathan Fontenot authored and Benjamin Herrenschmidt committed Sep 2, 2010
1 parent 71d6637 commit 7cd45ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a28dec2f26013aad89446b1f708f948617bc28a2
refs/heads/master: 93f68f1ef787d97ab688f78a01f446e85bb9a496
42 changes: 29 additions & 13 deletions trunk/arch/powerpc/platforms/pseries/dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,35 @@ struct device_node *dlpar_configure_connector(u32 drc_index)
struct property *property;
struct property *last_property = NULL;
struct cc_workarea *ccwa;
char *data_buf;
int cc_token;
int rc;
int rc = -1;

cc_token = rtas_token("ibm,configure-connector");
if (cc_token == RTAS_UNKNOWN_SERVICE)
return NULL;

spin_lock(&rtas_data_buf_lock);
ccwa = (struct cc_workarea *)&rtas_data_buf[0];
data_buf = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
if (!data_buf)
return NULL;

ccwa = (struct cc_workarea *)&data_buf[0];
ccwa->drc_index = drc_index;
ccwa->zero = 0;

rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL);
while (rc) {
do {
/* Since we release the rtas_data_buf lock between configure
* connector calls we want to re-populate the rtas_data_buffer
* with the contents of the previous call.
*/
spin_lock(&rtas_data_buf_lock);

memcpy(rtas_data_buf, data_buf, RTAS_DATA_BUF_SIZE);
rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL);
memcpy(data_buf, rtas_data_buf, RTAS_DATA_BUF_SIZE);

spin_unlock(&rtas_data_buf_lock);

switch (rc) {
case NEXT_SIBLING:
dn = dlpar_parse_cc_node(ccwa);
Expand Down Expand Up @@ -197,18 +212,19 @@ struct device_node *dlpar_configure_connector(u32 drc_index)
"returned from configure-connector\n", rc);
goto cc_error;
}
} while (rc);

rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL);
cc_error:
kfree(data_buf);

if (rc) {
if (first_dn)
dlpar_free_cc_nodes(first_dn);

return NULL;
}

spin_unlock(&rtas_data_buf_lock);
return first_dn;

cc_error:
if (first_dn)
dlpar_free_cc_nodes(first_dn);
spin_unlock(&rtas_data_buf_lock);
return NULL;
}

static struct device_node *derive_parent(const char *path)
Expand Down

0 comments on commit 7cd45ca

Please sign in to comment.