patch-2.4.13 linux/arch/s390x/kernel/cpcmd.c
Next file: linux/arch/s390x/kernel/debug.c
Previous file: linux/arch/s390x/kernel/Makefile
Back to the patch index
Back to the overall index
- Lines: 54
- Date:
Thu Oct 11 09:04:57 2001
- Orig file:
v2.4.12/linux/arch/s390x/kernel/cpcmd.c
- Orig date:
Wed Apr 11 19:02:29 2001
diff -u --recursive --new-file v2.4.12/linux/arch/s390x/kernel/cpcmd.c linux/arch/s390x/kernel/cpcmd.c
@@ -6,21 +6,25 @@
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
*/
-#include <linux/stddef.h>
-#include <linux/kernel.h>
#include <linux/string.h>
-#include <asm/ebcdic.h>
+#include <linux/spinlock.h>
#include <asm/cpcmd.h>
+#include <asm/ebcdic.h>
+#include <asm/system.h>
+
+static spinlock_t cpcmd_lock = SPIN_LOCK_UNLOCKED;
+static char cpcmd_buf[128];
void cpcmd(char *cmd, char *response, int rlen)
{
const int mask = 0x40000000L;
- char obuffer[128];
- int olen;
+ unsigned long flags;
+ int cmdlen;
- olen = strlen(cmd);
- strcpy(obuffer, cmd);
- ASCEBC(obuffer,olen);
+ spin_lock_irqsave(&cpcmd_lock, flags);
+ cmdlen = strlen(cmd);
+ strcpy(cpcmd_buf, cmd);
+ ASCEBC(cpcmd_buf, cmdlen);
if (response != NULL && rlen > 0) {
asm volatile (" lrag 2,0(%0)\n"
@@ -32,7 +36,7 @@
" .long 0x83240008 # Diagnose 83\n"
" sam64"
: /* no output */
- : "a" (obuffer), "d" (olen),
+ : "a" (cpcmd_buf), "d" (cmdlen),
"a" (response), "d" (rlen), "m" (mask)
: "2", "3", "4", "5" );
EBCASC(response, rlen);
@@ -43,8 +47,9 @@
" .long 0x83230008 # Diagnose 83\n"
" sam64"
: /* no output */
- : "a" (obuffer), "d" (olen)
+ : "a" (cpcmd_buf), "d" (cmdlen)
: "2", "3" );
}
+ spin_unlock_irqrestore(&cpcmd_lock, flags);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)