415051
From 4e46c718f42bf05e797c7fcfdd6cfc2a21fb4c91 Mon Sep 17 00:00:00 2001
415051
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
415051
Date: Wed, 7 Jan 2015 14:26:15 -0500
415051
Subject: [PATCH] PAPR requires that the status word is the first parameter in
415051
 the return buffer for rtas calls. Due to this requirement the librtas
415051
 sc_rtas_call function always performs a be32toh operation on the first
415051
 parameter in the return buffer. However, the ibm,open-errinjct rtas is
415051
 special in that its return buffer is switched. The "Open Token" is the first
415051
 return parameter while the "Status" word is second.
415051
415051
This patch fixes this special case in the sc_errinjct_open function such
415051
that the byteswapping of "status" and "otoken" are handled correctly.
415051
415051
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
415051
---
415051
 librtas_src/syscall_calls.c | 8 ++++----
415051
 1 file changed, 4 insertions(+), 4 deletions(-)
415051
415051
diff --git a/librtas_src/syscall_calls.c b/librtas_src/syscall_calls.c
415051
index dc52370..a81c25c 100644
415051
--- a/librtas_src/syscall_calls.c
415051
+++ b/librtas_src/syscall_calls.c
415051
@@ -493,20 +493,20 @@ int sc_errinjct_close(int token, int otoken)
415051
 int sc_errinjct_open(int token, int *otoken)
415051
 {
415051
 	uint64_t elapsed = 0;
415051
-	__be32 be_otoken;
415051
+	__be32 be_status;
415051
 	int status;
415051
 	int rc;
415051
 
415051
 	do {
415051
-		rc = sc_rtas_call(token, 0, 2, &be_otoken, &status);
415051
+		rc = sc_rtas_call(token, 0, 2, otoken, &be_status);
415051
 		if (rc)
415051
 			return rc;
415051
 
415051
+		status = be32toh(be_status);
415051
+
415051
 		rc = handle_delay(status, &elapsed);
415051
 	} while (rc == CALL_AGAIN);
415051
 
415051
-	*otoken = be32toh(be_otoken);
415051
-
415051
 	dbg1("(%p) = %d, %d\n", otoken, rc ? rc : status, *otoken);
415051
 	return rc ? rc : status;
415051
 }
415051
-- 
415051
1.9.3
415051