File: /usr/src/linux/arch/s390x/kernel/cpcmd.c

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     
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 ("   lrag  2,0(%0)\n"
27                                   "   lgr   4,%1\n"
28                                   "   o     4,%4\n"
29                                   "   lrag  3,0(%2)\n"
30                                   "   lgr   5,%3\n"
31                                   "   sam31\n"
32                                   "   .long 0x83240008 # Diagnose 83\n"
33                                   "   sam64"
34                                   : /* no output */
35                                   : "a" (obuffer), "d" (olen),
36                                     "a" (response), "d" (rlen), "m" (mask)
37                                   : "2", "3", "4", "5" );
38                     EBCASC(response, rlen);
39             } else {
40                     asm volatile ("   lrag  2,0(%0)\n"
41                                   "   lgr   3,%1\n"
42                                   "   sam31\n"
43                                   "   .long 0x83230008 # Diagnose 83\n"
44                                   "   sam64"
45                                   : /* no output */
46                                   : "a" (obuffer), "d" (olen)
47                                   : "2", "3"  );
48             }
49     }
50     
51