aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/rtas.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/rtas.c')
-rw-r--r--arch/powerpc/kernel/rtas.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 21c45a2d0706..7a488c108410 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -401,7 +401,7 @@ static char *__fetch_rtas_last_error(char *altbuf)
401 buf = altbuf; 401 buf = altbuf;
402 } else { 402 } else {
403 buf = rtas_err_buf; 403 buf = rtas_err_buf;
404 if (mem_init_done) 404 if (slab_is_available())
405 buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC); 405 buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
406 } 406 }
407 if (buf) 407 if (buf)
@@ -461,7 +461,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
461 461
462 if (buff_copy) { 462 if (buff_copy) {
463 log_error(buff_copy, ERR_TYPE_RTAS_LOG, 0); 463 log_error(buff_copy, ERR_TYPE_RTAS_LOG, 0);
464 if (mem_init_done) 464 if (slab_is_available())
465 kfree(buff_copy); 465 kfree(buff_copy);
466 } 466 }
467 return ret; 467 return ret;
@@ -897,7 +897,7 @@ int rtas_offline_cpus_mask(cpumask_var_t cpus)
897} 897}
898EXPORT_SYMBOL(rtas_offline_cpus_mask); 898EXPORT_SYMBOL(rtas_offline_cpus_mask);
899 899
900int rtas_ibm_suspend_me(u64 handle, int *vasi_return) 900int rtas_ibm_suspend_me(u64 handle)
901{ 901{
902 long state; 902 long state;
903 long rc; 903 long rc;
@@ -919,13 +919,11 @@ int rtas_ibm_suspend_me(u64 handle, int *vasi_return)
919 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc); 919 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc);
920 return rc; 920 return rc;
921 } else if (state == H_VASI_ENABLED) { 921 } else if (state == H_VASI_ENABLED) {
922 *vasi_return = RTAS_NOT_SUSPENDABLE; 922 return -EAGAIN;
923 return 0;
924 } else if (state != H_VASI_SUSPENDING) { 923 } else if (state != H_VASI_SUSPENDING) {
925 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned state %ld\n", 924 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned state %ld\n",
926 state); 925 state);
927 *vasi_return = -1; 926 return -EIO;
928 return 0;
929 } 927 }
930 928
931 if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY)) 929 if (!alloc_cpumask_var(&offline_mask, GFP_TEMPORARY))
@@ -972,7 +970,7 @@ out:
972 return atomic_read(&data.error); 970 return atomic_read(&data.error);
973} 971}
974#else /* CONFIG_PPC_PSERIES */ 972#else /* CONFIG_PPC_PSERIES */
975int rtas_ibm_suspend_me(u64 handle, int *vasi_return) 973int rtas_ibm_suspend_me(u64 handle)
976{ 974{
977 return -ENOSYS; 975 return -ENOSYS;
978} 976}
@@ -1022,7 +1020,6 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
1022 unsigned long flags; 1020 unsigned long flags;
1023 char *buff_copy, *errbuf = NULL; 1021 char *buff_copy, *errbuf = NULL;
1024 int nargs, nret, token; 1022 int nargs, nret, token;
1025 int rc;
1026 1023
1027 if (!capable(CAP_SYS_ADMIN)) 1024 if (!capable(CAP_SYS_ADMIN))
1028 return -EPERM; 1025 return -EPERM;
@@ -1054,15 +1051,18 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
1054 if (token == ibm_suspend_me_token) { 1051 if (token == ibm_suspend_me_token) {
1055 1052
1056 /* 1053 /*
1057 * rtas_ibm_suspend_me assumes args are in cpu endian, or at least the 1054 * rtas_ibm_suspend_me assumes the streamid handle is in cpu
1058 * hcall within it requires it. 1055 * endian, or at least the hcall within it requires it.
1059 */ 1056 */
1060 int vasi_rc = 0; 1057 int rc = 0;
1061 u64 handle = ((u64)be32_to_cpu(args.args[0]) << 32) 1058 u64 handle = ((u64)be32_to_cpu(args.args[0]) << 32)
1062 | be32_to_cpu(args.args[1]); 1059 | be32_to_cpu(args.args[1]);
1063 rc = rtas_ibm_suspend_me(handle, &vasi_rc); 1060 rc = rtas_ibm_suspend_me(handle);
1064 args.rets[0] = cpu_to_be32(vasi_rc); 1061 if (rc == -EAGAIN)
1065 if (rc) 1062 args.rets[0] = cpu_to_be32(RTAS_NOT_SUSPENDABLE);
1063 else if (rc == -EIO)
1064 args.rets[0] = cpu_to_be32(-1);
1065 else if (rc)
1066 return rc; 1066 return rc;
1067 goto copy_return; 1067 goto copy_return;
1068 } 1068 }