Staging: hv: mousevsc: Change the allocation flags to reflect interrupt context
[zen-stable.git] / arch / s390 / kernel / diag.c
blob8237fc07ac79ef27c2794c5367b9c0e05e37af6b
1 /*
2 * Implementation of s390 diagnose codes
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
8 #include <linux/module.h>
9 #include <asm/diag.h>
12 * Diagnose 14: Input spool file manipulation
14 int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode)
16 register unsigned long _ry1 asm("2") = ry1;
17 register unsigned long _ry2 asm("3") = subcode;
18 int rc = 0;
20 asm volatile(
21 #ifdef CONFIG_64BIT
22 " sam31\n"
23 " diag %2,2,0x14\n"
24 " sam64\n"
25 #else
26 " diag %2,2,0x14\n"
27 #endif
28 " ipm %0\n"
29 " srl %0,28\n"
30 : "=d" (rc), "+d" (_ry2)
31 : "d" (rx), "d" (_ry1)
32 : "cc");
34 return rc;
36 EXPORT_SYMBOL(diag14);
39 * Diagnose 210: Get information about a virtual device
41 int diag210(struct diag210 *addr)
44 * diag 210 needs its data below the 2GB border, so we
45 * use a static data area to be sure
47 static struct diag210 diag210_tmp;
48 static DEFINE_SPINLOCK(diag210_lock);
49 unsigned long flags;
50 int ccode;
52 spin_lock_irqsave(&diag210_lock, flags);
53 diag210_tmp = *addr;
55 #ifdef CONFIG_64BIT
56 asm volatile(
57 " lhi %0,-1\n"
58 " sam31\n"
59 " diag %1,0,0x210\n"
60 "0: ipm %0\n"
61 " srl %0,28\n"
62 "1: sam64\n"
63 EX_TABLE(0b, 1b)
64 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
65 #else
66 asm volatile(
67 " lhi %0,-1\n"
68 " diag %1,0,0x210\n"
69 "0: ipm %0\n"
70 " srl %0,28\n"
71 "1:\n"
72 EX_TABLE(0b, 1b)
73 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
74 #endif
76 *addr = diag210_tmp;
77 spin_unlock_irqrestore(&diag210_lock, flags);
79 return ccode;
81 EXPORT_SYMBOL(diag210);