Fix byteswapping

This commit is contained in:
Jakub Čajka 2015-07-16 09:36:56 +02:00
parent f139fd9e73
commit b976ccd854
2 changed files with 59 additions and 2 deletions

View File

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

View File

@ -1,15 +1,18 @@
Summary: Libraries to provide access to RTAS calls and RTAS events
Name: librtas
Version: 1.3.13
Release: 2%{?dist}
Release: 3%{?dist}
URL: http://librtas.ozlabs.org
License: CPL
Group: System Environment/Libraries
Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
#Fedora specific patch
# Fedora specific patch
Patch0: %{name}-1.3.4-libdir.patch
Patch1: %{name}-1.3.6-ln.patch
# Fix byteswapping
# http://sourceforge.net/p/librtas/code/ci/4e46c718f42bf05e797c7fcfdd6cfc2a21fb4c91/
Patch2: 0001-PAPR-requires-that-the-status-word-is-the-first-para.patch
ExclusiveArch: ppc ppc64 ppc64le
@ -36,6 +39,7 @@ developing programs using librtas.
%setup
%patch0 -p1 -b .libdir
%patch1 -p1 -b .ln
%patch2 -p1 -b .papr
%build
# disable "-Werror=format-security" checking gcc option until we fix
@ -71,6 +75,9 @@ mkdir -p %{buildroot}/%{_libdir}
%{_libdir}/libofdt.so
%changelog
* Fri Jul 03 2015 Jakub Čajka - 1.3.13-3
- Fix byteswapping see http://sourceforge.net/p/librtas/code/ci/4e46c718f42bf05e797c7fcfdd6cfc2a21fb4c91/
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild