1 /*
2  *  arch/s390/kernel/cpcmd.c
3  *
4  *  S390 version
5  *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7  */
8 
9 #include <linux/stddef.h>
10 #include <linux/kernel.h>
11 #include <linux/string.h>
12 #include <asm/ebcdic.h>
13 #include <asm/cpcmd.h>
14 
cpcmd(char * cmd,char * response,int rlen)15 void cpcmd(char *cmd, char *response, int rlen)
16 {
17         const int mask = 0x40000000L;
18         char obuffer[128];
19         int olen;
20 
21         olen = strlen(cmd);
22         strcpy(obuffer, cmd);
23         ASCEBC(obuffer,olen);
24 
25         if (response != NULL && rlen > 0) {
26                 asm volatile ("LRA   2,0(%0)\n\t"
27                               "LR    4,%1\n\t"
28                               "O     4,%4\n\t"
29                               "LRA   3,0(%2)\n\t"
30                               "LR    5,%3\n\t"
31                               ".long 0x83240008 # Diagnose 83\n\t"
32                               : /* no output */
33                               : "a" (obuffer), "d" (olen),
34                                 "a" (response), "d" (rlen), "m" (mask)
35                               : "2", "3", "4", "5" );
36                 EBCASC(response, rlen);
37         } else {
38                 asm volatile ("LRA   2,0(%0)\n\t"
39                               "LR    3,%1\n\t"
40                               ".long 0x83230008 # Diagnose 83\n\t"
41                               : /* no output */
42                               : "a" (obuffer), "d" (olen)
43                               : "2", "3"  );
44         }
45 }
46 
47