commit 1d54a4a346f9111e1326dfdec756fd78360add42
Author: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Date:   Fri Oct 17 10:18:40 2014 -0400

    When we pass _hi and _lo 32bits of a 64bit value, we
    should convert the host endian value carefully.
    
    i.e,
            X_hi = htobe32(BITS32_HI(X))
            X_lo = htobe32(BITS32_LO(X))
    
    and not :
            X_hi = BITS32_HI(htobe64(X))
    
    NOTE: This patch is untested, but I believe this patch
    is good to have than the current faulty conversion.
    
    This patch fixes all such occurrences in librtas.
    
    Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>

diff --git a/librtas.spec.in b/librtas.spec.in
index 54fef89..d35925c 100644
--- a/librtas.spec.in
+++ b/librtas.spec.in
@@ -34,36 +34,36 @@ the contents of RTAS events.
 
 %files
 %defattr(-, root, root)
-/usr/share/doc/packages/%{name}/COPYRIGHT
-/usr/share/doc/packages/%{name}/README
-/usr/include/common.h
-/usr/include/librtas.h
-@LIB_DIR@/librtas.so.%{version}
-@LIB_DIR@/libofdt.so
-@LIB_DIR@/librtas.so
-@LIB_DIR@/librtasevent.so
-@LIB_DIR@/librtasevent.so.1
-@LIB_DIR@/librtasevent.so.%{version}
-/usr/include/librtasevent.h
-/usr/include/librtasevent_v4.h
-/usr/include/librtasevent_v6.h
+%{_docdir}/%{name}/COPYRIGHT
+%{_docdir}/%{name}/README
+%{_includedir}/common.h
+%{_includedir}/librtas.h
+%{_libdir}/librtas.so.%{version}
+%{_libdir}/libofdt.so
+%{_libdir}/librtas.so
+%{_libdir}/librtasevent.so
+%{_libdir}/librtasevent.so.1
+%{_libdir}/librtasevent.so.%{version}
+%{_includedir}/librtasevent.h
+%{_includedir}/librtasevent_v4.h
+%{_includedir}/librtasevent_v6.h
 
-@LIB_DIR@/libofdt.so.%{version}
-/usr/include/libofdt.h
+%{_libdir}/libofdt.so.%{version}
+%{_includedir}/libofdt.h
 
 %post
 # Post-install script -------------------------------------------------
-ln -sf @LIB_DIR@/librtas.so.%{version} @LIB_DIR@/librtas.so
-ln -sf @LIB_DIR@/librtas.so.%{version} @LIB_DIR@/librtas.so.1
-ln -sf @LIB_DIR@/librtasevent.so.%{version} @LIB_DIR@/librtasevent.so
-ln -sf @LIB_DIR@/libofdt.so.%{version} @LIB_DIR@/libofdt.so
+ln -sf %{_libdir}/librtas.so.%{version} %{_libdir}/librtas.so
+ln -sf %{_libdir}/librtas.so.%{version} %{_libdir}/librtas.so.1
+ln -sf %{_libdir}/librtasevent.so.%{version} %{_libdir}/librtasevent.so
+ln -sf %{_libdir}/libofdt.so.%{version} %{_libdir}/libofdt.so
 ldconfig
 
 %postun
 # Post-uninstall script -----------------------------------------------
 if [ "$1" = "0" ] ; then        # last uninstall
-    rm -f @LIB_DIR@/librtas.so
-    rm -f @LIB_DIR@/librtasevent.so
-    rm -f @LIB_DIR@/libofdt.so
+    rm -f %{_libdir}/librtas.so
+    rm -f %{_libdir}/librtasevent.so
+    rm -f %{_libdir}/libofdt.so
 fi
 ldconfig
diff --git a/librtas_src/syscall_calls.c b/librtas_src/syscall_calls.c
index 29ab613..dc52370 100644
--- a/librtas_src/syscall_calls.c
+++ b/librtas_src/syscall_calls.c
@@ -532,8 +532,8 @@ int sc_get_config_addr_info2(int token, uint32_t config_addr,
 
 	do {
 		rc = sc_rtas_call(token, 4, 2, htobe32(config_addr),
-				  BITS32_HI(htobe64(phb_id)),
-				  BITS32_LO(htobe64(phb_id)),
+				  htobe32(BITS32_HI(phb_id)),
+				  htobe32(BITS32_LO(phb_id)),
 				  htobe32(func), &status, &be_info);
 		if (rc)
 			break;
@@ -1005,8 +1005,8 @@ sc_read_slot_reset(int token, uint32_t cfg_addr, uint64_t phbid, int *state,
 
 	do {
 		rc = sc_rtas_call(token, 3, 3, htobe32(cfg_addr),
-				  BITS32_HI(htobe64(phbid)),
-				  BITS32_LO(htobe64(phbid)), &status,
+				  htobe32(BITS32_HI(phbid)),
+				  htobe32(BITS32_LO(phbid)), &status,
 				  state, eeh);
 		if (rc)
 			return rc;
@@ -1123,8 +1123,8 @@ sc_set_eeh_option(int token, uint32_t cfg_addr, uint64_t phbid, int function)
 
 	do {
 		rc = sc_rtas_call(token, 4, 1, htobe32(cfg_addr),
-				  BITS32_HI(htobe64(phbid)),
-				  BITS32_LO(htobe64(phbid)),
+				  htobe32(BITS32_HI(phbid)),
+				  htobe32(BITS32_LO(phbid)),
 				  htobe32(function), &status);
 		if (rc)
 			return rc;
@@ -1321,8 +1321,8 @@ int sc_suspend_me(int token, uint64_t streamid)
 	int rc;
 
 	do {
-		rc = sc_rtas_call(token, 2, 1, BITS32_HI(htobe64(streamid)),
-				  BITS32_LO(htobe64(streamid)), &status);
+		rc = sc_rtas_call(token, 2, 1, htobe32(BITS32_HI(streamid)),
+				  htobe32(BITS32_LO(streamid)), &status);
 		if (rc)
 			return rc;
 
