[PATCH] s390: cleanup Kconfig
[linux-block.git] / drivers / s390 / cio / ioasm.h
CommitLineData
1da177e4
LT
1#ifndef S390_CIO_IOASM_H
2#define S390_CIO_IOASM_H
3
a8237fc4
CH
4#include "schid.h"
5
1da177e4
LT
6/*
7 * TPI info structure
8 */
9struct tpi_info {
a8237fc4 10 struct subchannel_id schid;
1da177e4
LT
11 __u32 intparm; /* interruption parameter */
12 __u32 adapter_IO : 1;
13 __u32 reserved2 : 1;
14 __u32 isc : 3;
15 __u32 reserved3 : 12;
16 __u32 int_type : 3;
17 __u32 reserved4 : 12;
18} __attribute__ ((packed));
19
20
21/*
22 * Some S390 specific IO instructions as inline
23 */
24
a8237fc4
CH
25static inline int stsch(struct subchannel_id schid,
26 volatile struct schib *addr)
1da177e4
LT
27{
28 int ccode;
29
30 __asm__ __volatile__(
31 " lr 1,%1\n"
32 " stsch 0(%2)\n"
33 " ipm %0\n"
34 " srl %0,28"
35 : "=d" (ccode)
a8237fc4 36 : "d" (schid), "a" (addr), "m" (*addr)
1da177e4
LT
37 : "cc", "1" );
38 return ccode;
39}
40
fb6958a5
CH
41static inline int stsch_err(struct subchannel_id schid,
42 volatile struct schib *addr)
43{
44 int ccode;
45
46 __asm__ __volatile__(
47 " lhi %0,%3\n"
48 " lr 1,%1\n"
49 " stsch 0(%2)\n"
50 "0: ipm %0\n"
51 " srl %0,28\n"
52 "1:\n"
347a8dc3 53#ifdef CONFIG_64BIT
fb6958a5
CH
54 ".section __ex_table,\"a\"\n"
55 " .align 8\n"
56 " .quad 0b,1b\n"
57 ".previous"
58#else
59 ".section __ex_table,\"a\"\n"
60 " .align 4\n"
61 " .long 0b,1b\n"
62 ".previous"
63#endif
64 : "=&d" (ccode)
65 : "d" (schid), "a" (addr), "K" (-EIO), "m" (*addr)
66 : "cc", "1" );
67 return ccode;
68}
69
a8237fc4
CH
70static inline int msch(struct subchannel_id schid,
71 volatile struct schib *addr)
1da177e4
LT
72{
73 int ccode;
74
75 __asm__ __volatile__(
76 " lr 1,%1\n"
77 " msch 0(%2)\n"
78 " ipm %0\n"
79 " srl %0,28"
80 : "=d" (ccode)
a8237fc4 81 : "d" (schid), "a" (addr), "m" (*addr)
1da177e4
LT
82 : "cc", "1" );
83 return ccode;
84}
85
a8237fc4
CH
86static inline int msch_err(struct subchannel_id schid,
87 volatile struct schib *addr)
1da177e4
LT
88{
89 int ccode;
90
91 __asm__ __volatile__(
92 " lhi %0,%3\n"
93 " lr 1,%1\n"
94 " msch 0(%2)\n"
95 "0: ipm %0\n"
96 " srl %0,28\n"
97 "1:\n"
347a8dc3 98#ifdef CONFIG_64BIT
1da177e4
LT
99 ".section __ex_table,\"a\"\n"
100 " .align 8\n"
101 " .quad 0b,1b\n"
102 ".previous"
103#else
104 ".section __ex_table,\"a\"\n"
105 " .align 4\n"
106 " .long 0b,1b\n"
107 ".previous"
108#endif
109 : "=&d" (ccode)
a8237fc4 110 : "d" (schid), "a" (addr), "K" (-EIO), "m" (*addr)
1da177e4
LT
111 : "cc", "1" );
112 return ccode;
113}
114
a8237fc4
CH
115static inline int tsch(struct subchannel_id schid,
116 volatile struct irb *addr)
1da177e4
LT
117{
118 int ccode;
119
120 __asm__ __volatile__(
121 " lr 1,%1\n"
122 " tsch 0(%2)\n"
123 " ipm %0\n"
124 " srl %0,28"
125 : "=d" (ccode)
a8237fc4 126 : "d" (schid), "a" (addr), "m" (*addr)
1da177e4
LT
127 : "cc", "1" );
128 return ccode;
129}
130
4c24da79 131static inline int tpi( volatile struct tpi_info *addr)
1da177e4
LT
132{
133 int ccode;
134
135 __asm__ __volatile__(
136 " tpi 0(%1)\n"
137 " ipm %0\n"
138 " srl %0,28"
139 : "=d" (ccode)
a8237fc4 140 : "a" (addr), "m" (*addr)
1da177e4
LT
141 : "cc", "1" );
142 return ccode;
143}
144
a8237fc4
CH
145static inline int ssch(struct subchannel_id schid,
146 volatile struct orb *addr)
1da177e4
LT
147{
148 int ccode;
149
150 __asm__ __volatile__(
151 " lr 1,%1\n"
152 " ssch 0(%2)\n"
153 " ipm %0\n"
154 " srl %0,28"
155 : "=d" (ccode)
a8237fc4 156 : "d" (schid), "a" (addr), "m" (*addr)
1da177e4
LT
157 : "cc", "1" );
158 return ccode;
159}
160
a8237fc4 161static inline int rsch(struct subchannel_id schid)
1da177e4
LT
162{
163 int ccode;
164
165 __asm__ __volatile__(
166 " lr 1,%1\n"
167 " rsch\n"
168 " ipm %0\n"
169 " srl %0,28"
170 : "=d" (ccode)
a8237fc4 171 : "d" (schid)
1da177e4
LT
172 : "cc", "1" );
173 return ccode;
174}
175
a8237fc4 176static inline int csch(struct subchannel_id schid)
1da177e4
LT
177{
178 int ccode;
179
180 __asm__ __volatile__(
181 " lr 1,%1\n"
182 " csch\n"
183 " ipm %0\n"
184 " srl %0,28"
185 : "=d" (ccode)
a8237fc4 186 : "d" (schid)
1da177e4
LT
187 : "cc", "1" );
188 return ccode;
189}
190
a8237fc4 191static inline int hsch(struct subchannel_id schid)
1da177e4
LT
192{
193 int ccode;
194
195 __asm__ __volatile__(
196 " lr 1,%1\n"
197 " hsch\n"
198 " ipm %0\n"
199 " srl %0,28"
200 : "=d" (ccode)
a8237fc4 201 : "d" (schid)
1da177e4
LT
202 : "cc", "1" );
203 return ccode;
204}
205
a8237fc4 206static inline int xsch(struct subchannel_id schid)
1da177e4
LT
207{
208 int ccode;
209
210 __asm__ __volatile__(
211 " lr 1,%1\n"
212 " .insn rre,0xb2760000,%1,0\n"
213 " ipm %0\n"
214 " srl %0,28"
215 : "=d" (ccode)
a8237fc4 216 : "d" (schid)
1da177e4
LT
217 : "cc", "1" );
218 return ccode;
219}
220
4c24da79 221static inline int chsc(void *chsc_area)
1da177e4 222{
a8237fc4 223 typedef struct { char _[4096]; } addr_type;
1da177e4
LT
224 int cc;
225
226 __asm__ __volatile__ (
a8237fc4 227 ".insn rre,0xb25f0000,%2,0 \n\t"
1da177e4
LT
228 "ipm %0 \n\t"
229 "srl %0,28 \n\t"
a8237fc4
CH
230 : "=d" (cc), "=m" (*(addr_type *) chsc_area)
231 : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
1da177e4
LT
232 : "cc" );
233
234 return cc;
235}
236
4c24da79 237static inline int iac( void)
1da177e4
LT
238{
239 int ccode;
240
241 __asm__ __volatile__(
242 " iac 1\n"
243 " ipm %0\n"
244 " srl %0,28"
245 : "=d" (ccode) : : "cc", "1" );
246 return ccode;
247}
248
4c24da79 249static inline int rchp(int chpid)
1da177e4
LT
250{
251 int ccode;
252
253 __asm__ __volatile__(
254 " lr 1,%1\n"
255 " rchp\n"
256 " ipm %0\n"
257 " srl %0,28"
258 : "=d" (ccode)
259 : "d" (chpid)
260 : "cc", "1" );
261 return ccode;
262}
263
264#endif