|
@@ -14,6 +14,7 @@
|
|
|
#include <linux/spinlock.h>
|
|
|
#include <linux/stddef.h>
|
|
|
#include <linux/string.h>
|
|
|
+#include <linux/mm.h>
|
|
|
#include <asm/diag.h>
|
|
|
#include <asm/ebcdic.h>
|
|
|
#include <asm/cpcmd.h>
|
|
@@ -28,9 +29,7 @@ static int diag8_noresponse(int cmdlen)
|
|
|
register unsigned long reg3 asm ("3") = cmdlen;
|
|
|
|
|
|
asm volatile(
|
|
|
- " sam31\n"
|
|
|
" diag %1,%0,0x8\n"
|
|
|
- " sam64\n"
|
|
|
: "+d" (reg3) : "d" (reg2) : "cc");
|
|
|
return reg3;
|
|
|
}
|
|
@@ -43,9 +42,7 @@ static int diag8_response(int cmdlen, char *response, int *rlen)
|
|
|
register unsigned long reg5 asm ("5") = *rlen;
|
|
|
|
|
|
asm volatile(
|
|
|
- " sam31\n"
|
|
|
" diag %2,%0,0x8\n"
|
|
|
- " sam64\n"
|
|
|
" brc 8,1f\n"
|
|
|
" agr %1,%4\n"
|
|
|
"1:\n"
|
|
@@ -57,7 +54,6 @@ static int diag8_response(int cmdlen, char *response, int *rlen)
|
|
|
|
|
|
/*
|
|
|
* __cpcmd has some restrictions over cpcmd
|
|
|
- * - the response buffer must reside below 2GB (if any)
|
|
|
* - __cpcmd is unlocked and therefore not SMP-safe
|
|
|
*/
|
|
|
int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
|
|
@@ -88,13 +84,12 @@ EXPORT_SYMBOL(__cpcmd);
|
|
|
|
|
|
int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
|
|
|
{
|
|
|
+ unsigned long flags;
|
|
|
char *lowbuf;
|
|
|
int len;
|
|
|
- unsigned long flags;
|
|
|
|
|
|
- if ((virt_to_phys(response) != (unsigned long) response) ||
|
|
|
- (((unsigned long)response + rlen) >> 31)) {
|
|
|
- lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA);
|
|
|
+ if (is_vmalloc_or_module_addr(response)) {
|
|
|
+ lowbuf = kmalloc(rlen, GFP_KERNEL);
|
|
|
if (!lowbuf) {
|
|
|
pr_warn("The cpcmd kernel function failed to allocate a response buffer\n");
|
|
|
return -ENOMEM;
|