aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2015-03-26 15:07:58 +0800
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-03-31 10:00:59 +1100
commit5dea3e71fc7fd13d7a2aeb966d78043b74227394 (patch)
treeea3f86669f7d6657db8dfc493ab0e409bceb6849
parent0b6261e6bf2d11292536b105966079f7f64c6139 (diff)
downloadskiboot-5dea3e71fc7fd13d7a2aeb966d78043b74227394.zip
skiboot-5dea3e71fc7fd13d7a2aeb966d78043b74227394.tar.gz
skiboot-5dea3e71fc7fd13d7a2aeb966d78043b74227394.tar.bz2
external/opal-prd: Use "official" switch-endian syscall
The "fast endian switch" syscall was never fully supported - this change moves to the official switch-endian syscall, using __NR_switch_endian We also form the little-endian instructions using this prepreocessor define. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--external/opal-prd/thunk.S20
1 files changed, 14 insertions, 6 deletions
diff --git a/external/opal-prd/thunk.S b/external/opal-prd/thunk.S
index 9d97183..773df26 100644
--- a/external/opal-prd/thunk.S
+++ b/external/opal-prd/thunk.S
@@ -1,4 +1,12 @@
#include <endian.h>
+#include <asm/unistd.h>
+
+#ifndef __NR_switch_endian
+#define __NR_switch_endian 363
+#endif
+
+/* a constant to use in the SI field of a little-endian D-form instruction */
+#define le_si16(x) (((x & 0xff) << 24) | ((x & 0xff00) << 8))
.text
@@ -10,8 +18,6 @@
call_be:
-#define __NR_fast_endian_switch 0x1ebe
-
/* Before we switch, we need to perform some ABI
* conversion. We are currently running LE with the
* new ABI v2. The GPR content is the same, we do
@@ -45,14 +51,15 @@ call_be:
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* Switch to the "other endian" */
- li %r0,__NR_fast_endian_switch
+ li %r0,__NR_switch_endian
sc
/* Branch to CTR */
.long 0x2104804e /* (byteswapped bctrl) */
/* Switch endian back */
- .long 0xbe1e0038 /* byteswapped li %r0,__NR_fast_endian_switch */
+ .long 0x00000038 | le_si16(__NR_switch_endian)
+ /* byteswapped li %r0,__NR_switch_endian */
.long 0x02000044 /* byteswapped sc */
#else
bctrl
@@ -110,7 +117,7 @@ call_le:
mtlr %r0
/* Switch endian back to BE */
- li %r0,__NR_fast_endian_switch
+ li %r0,__NR_switch_endian
sc
/* Return to BE */
@@ -125,7 +132,8 @@ call_le:
.pushsection ".text","ax" ;\
.globl name##_thunk ;\
name##_thunk: ;\
- .long 0xbe1e0038 /* byteswapped li %r0,__NR_fast_endian_switch */ ;\
+ .long 0x00000038 | le_si16(__NR_switch_endian) ;\
+ /* byteswapped li %r0,__NR_switch_endian */ ;\
.long 0x02000044 /* byteswapped sc */ ;\
ld %r11,name@got(%r2) ;\
b call_le ;\