diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2017-05-26 12:54:28 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-06-06 17:59:45 +1000 |
commit | bf06664368408d26c0af1dec7de80a5fdbf5bf98 (patch) | |
tree | 0502795f3e90511523de21d5d3bc0821c6b16ecc /external/opal-prd | |
parent | f15a0910edff4700797d85487cedbce6ae8768dd (diff) | |
download | skiboot-bf06664368408d26c0af1dec7de80a5fdbf5bf98.zip skiboot-bf06664368408d26c0af1dec7de80a5fdbf5bf98.tar.gz skiboot-bf06664368408d26c0af1dec7de80a5fdbf5bf98.tar.bz2 |
opal-prd: split prd message reading from handling
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'external/opal-prd')
-rw-r--r-- | external/opal-prd/opal-prd.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c index 68d9cbc..8077c67 100644 --- a/external/opal-prd/opal-prd.c +++ b/external/opal-prd/opal-prd.c @@ -1239,7 +1239,29 @@ static int handle_msg_occ_reset(struct opal_prd_ctx *ctx, return 0; } -static int handle_prd_msg(struct opal_prd_ctx *ctx) +static int handle_prd_msg(struct opal_prd_ctx *ctx, struct opal_prd_msg *msg) +{ + int rc = -1; + + switch (msg->hdr.type) { + case OPAL_PRD_MSG_TYPE_ATTN: + rc = handle_msg_attn(ctx, msg); + break; + case OPAL_PRD_MSG_TYPE_OCC_RESET: + rc = handle_msg_occ_reset(ctx, msg); + break; + case OPAL_PRD_MSG_TYPE_OCC_ERROR: + rc = handle_msg_occ_error(ctx, msg); + break; + default: + pr_log(LOG_WARNING, "Invalid incoming message type 0x%x", + msg->hdr.type); + } + + return rc; +} + +static int read_prd_msg(struct opal_prd_ctx *ctx) { struct opal_prd_msg *msg; int size; @@ -1304,22 +1326,6 @@ static int handle_prd_msg(struct opal_prd_ctx *ctx) } } - switch (msg->hdr.type) { - case OPAL_PRD_MSG_TYPE_ATTN: - rc = handle_msg_attn(ctx, msg); - break; - case OPAL_PRD_MSG_TYPE_OCC_RESET: - rc = handle_msg_occ_reset(ctx, msg); - break; - case OPAL_PRD_MSG_TYPE_OCC_ERROR: - rc = handle_msg_occ_error(ctx, msg); - break; - default: - pr_log(LOG_WARNING, "Invalid incoming message type 0x%x", - msg->hdr.type); - return -1; - } - return 0; } @@ -1614,8 +1620,11 @@ static int run_attn_loop(struct opal_prd_ctx *ctx) if (!rc) continue; - if (pollfds[0].revents & POLLIN) - handle_prd_msg(ctx); + if (pollfds[0].revents & POLLIN) { + rc = read_prd_msg(ctx); + if (!rc) + handle_prd_msg(ctx, ctx->msg); + } if (pollfds[1].revents & POLLIN) { fd = accept(ctx->socket, NULL, NULL); |