8 #define KMSG_COMPONENT "cpcmd"
9 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/slab.h>
15 #include <linux/stddef.h>
16 #include <linux/string.h>
22 static char cpcmd_buf[241];
24 static int diag8_noresponse(
int cmdlen)
26 register unsigned long reg2 asm (
"2") = (
addr_t) cpcmd_buf;
27 register unsigned long reg3 asm (
"3") = cmdlen;
41 static int diag8_response(
int cmdlen,
char *
response,
int *rlen)
43 register unsigned long reg2 asm (
"2") = (
addr_t) cpcmd_buf;
45 register unsigned long reg4 asm (
"4") = cmdlen | 0x40000000L;
46 register unsigned long reg5
asm (
"5") = *rlen;
61 :
"+d" (
reg4),
"+d" (reg5)
62 :
"d" (
reg2),
"d" (
reg3),
"d" (*rlen) :
"cc");
80 memcpy(cpcmd_buf, cmd, cmdlen);
86 rc = diag8_response(cmdlen, response, &rlen);
87 EBCASC(response, response_len);
89 rc = diag8_noresponse(cmdlen);
103 if ((
virt_to_phys(response) != (
unsigned long) response) ||
104 (((
unsigned long)response + rlen) >> 31)) {
107 pr_warning(
"The cpcmd kernel function failed to "
108 "allocate a response buffer\n");
112 len =
__cpcmd(cmd, lowbuf, rlen, response_code);
113 spin_unlock_irqrestore(&cpcmd_lock, flags);
114 memcpy(response, lowbuf, rlen);
118 len =
__cpcmd(cmd, response, rlen, response_code);
119 spin_unlock_irqrestore(&cpcmd_lock, flags);