Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / s390 / cio / ioasm.h
1 #ifndef S390_CIO_IOASM_H
2 #define S390_CIO_IOASM_H
3
4 #include <asm/chpid.h>
5 #include <asm/schid.h>
6
7 /*
8  * TPI info structure
9  */
10 struct tpi_info {
11         struct subchannel_id schid;
12         __u32 intparm;           /* interruption parameter */
13         __u32 adapter_IO : 1;
14         __u32 reserved2  : 1;
15         __u32 isc        : 3;
16         __u32 reserved3  : 12;
17         __u32 int_type   : 3;
18         __u32 reserved4  : 12;
19 } __attribute__ ((packed));
20
21
22 /*
23  * Some S390 specific IO instructions as inline
24  */
25
26 static inline int stsch_err(struct subchannel_id schid, struct schib *addr)
27 {
28         register struct subchannel_id reg1 asm ("1") = schid;
29         int ccode = -EIO;
30
31         asm volatile(
32                 "       stsch   0(%3)\n"
33                 "0:     ipm     %0\n"
34                 "       srl     %0,28\n"
35                 "1:\n"
36                 EX_TABLE(0b,1b)
37                 : "+d" (ccode), "=m" (*addr)
38                 : "d" (reg1), "a" (addr)
39                 : "cc");
40         return ccode;
41 }
42
43 static inline int msch(struct subchannel_id schid, struct schib *addr)
44 {
45         register struct subchannel_id reg1 asm ("1") = schid;
46         int ccode;
47
48         asm volatile(
49                 "       msch    0(%2)\n"
50                 "       ipm     %0\n"
51                 "       srl     %0,28"
52                 : "=d" (ccode)
53                 : "d" (reg1), "a" (addr), "m" (*addr)
54                 : "cc");
55         return ccode;
56 }
57
58 static inline int msch_err(struct subchannel_id schid, struct schib *addr)
59 {
60         register struct subchannel_id reg1 asm ("1") = schid;
61         int ccode = -EIO;
62
63         asm volatile(
64                 "       msch    0(%2)\n"
65                 "0:     ipm     %0\n"
66                 "       srl     %0,28\n"
67                 "1:\n"
68                 EX_TABLE(0b,1b)
69                 : "+d" (ccode)
70                 : "d" (reg1), "a" (addr), "m" (*addr)
71                 : "cc");
72         return ccode;
73 }
74
75 static inline int tsch(struct subchannel_id schid, struct irb *addr)
76 {
77         register struct subchannel_id reg1 asm ("1") = schid;
78         int ccode;
79
80         asm volatile(
81                 "       tsch    0(%3)\n"
82                 "       ipm     %0\n"
83                 "       srl     %0,28"
84                 : "=d" (ccode), "=m" (*addr)
85                 : "d" (reg1), "a" (addr)
86                 : "cc");
87         return ccode;
88 }
89
90 static inline int tpi(struct tpi_info *addr)
91 {
92         int ccode;
93
94         asm volatile(
95                 "       tpi     0(%2)\n"
96                 "       ipm     %0\n"
97                 "       srl     %0,28"
98                 : "=d" (ccode), "=m" (*addr)
99                 : "a" (addr)
100                 : "cc");
101         return ccode;
102 }
103
104 static inline int chsc(void *chsc_area)
105 {
106         typedef struct { char _[4096]; } addr_type;
107         int cc;
108
109         asm volatile(
110                 "       .insn   rre,0xb25f0000,%2,0\n"
111                 "       ipm     %0\n"
112                 "       srl     %0,28\n"
113                 : "=d" (cc), "=m" (*(addr_type *) chsc_area)
114                 : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
115                 : "cc");
116         return cc;
117 }
118
119 static inline int rchp(struct chp_id chpid)
120 {
121         register struct chp_id reg1 asm ("1") = chpid;
122         int ccode;
123
124         asm volatile(
125                 "       lr      1,%1\n"
126                 "       rchp\n"
127                 "       ipm     %0\n"
128                 "       srl     %0,28"
129                 : "=d" (ccode) : "d" (reg1) : "cc");
130         return ccode;
131 }
132
133 #endif