[PATCH] s390: cleanup Kconfig
[linux-2.6/linux-2.6-openrd.git] / drivers / s390 / cio / ioasm.h
blob95a9462f9a911ccc74faea8b9a39235f4b6cebc3
1 #ifndef S390_CIO_IOASM_H
2 #define S390_CIO_IOASM_H
4 #include "schid.h"
6 /*
7 * TPI info structure
8 */
9 struct tpi_info {
10 struct subchannel_id schid;
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));
22 * Some S390 specific IO instructions as inline
25 static inline int stsch(struct subchannel_id schid,
26 volatile struct schib *addr)
28 int ccode;
30 __asm__ __volatile__(
31 " lr 1,%1\n"
32 " stsch 0(%2)\n"
33 " ipm %0\n"
34 " srl %0,28"
35 : "=d" (ccode)
36 : "d" (schid), "a" (addr), "m" (*addr)
37 : "cc", "1" );
38 return ccode;
41 static inline int stsch_err(struct subchannel_id schid,
42 volatile struct schib *addr)
44 int ccode;
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"
53 #ifdef CONFIG_64BIT
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;
70 static inline int msch(struct subchannel_id schid,
71 volatile struct schib *addr)
73 int ccode;
75 __asm__ __volatile__(
76 " lr 1,%1\n"
77 " msch 0(%2)\n"
78 " ipm %0\n"
79 " srl %0,28"
80 : "=d" (ccode)
81 : "d" (schid), "a" (addr), "m" (*addr)
82 : "cc", "1" );
83 return ccode;
86 static inline int msch_err(struct subchannel_id schid,
87 volatile struct schib *addr)
89 int ccode;
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"
98 #ifdef CONFIG_64BIT
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)
110 : "d" (schid), "a" (addr), "K" (-EIO), "m" (*addr)
111 : "cc", "1" );
112 return ccode;
115 static inline int tsch(struct subchannel_id schid,
116 volatile struct irb *addr)
118 int ccode;
120 __asm__ __volatile__(
121 " lr 1,%1\n"
122 " tsch 0(%2)\n"
123 " ipm %0\n"
124 " srl %0,28"
125 : "=d" (ccode)
126 : "d" (schid), "a" (addr), "m" (*addr)
127 : "cc", "1" );
128 return ccode;
131 static inline int tpi( volatile struct tpi_info *addr)
133 int ccode;
135 __asm__ __volatile__(
136 " tpi 0(%1)\n"
137 " ipm %0\n"
138 " srl %0,28"
139 : "=d" (ccode)
140 : "a" (addr), "m" (*addr)
141 : "cc", "1" );
142 return ccode;
145 static inline int ssch(struct subchannel_id schid,
146 volatile struct orb *addr)
148 int ccode;
150 __asm__ __volatile__(
151 " lr 1,%1\n"
152 " ssch 0(%2)\n"
153 " ipm %0\n"
154 " srl %0,28"
155 : "=d" (ccode)
156 : "d" (schid), "a" (addr), "m" (*addr)
157 : "cc", "1" );
158 return ccode;
161 static inline int rsch(struct subchannel_id schid)
163 int ccode;
165 __asm__ __volatile__(
166 " lr 1,%1\n"
167 " rsch\n"
168 " ipm %0\n"
169 " srl %0,28"
170 : "=d" (ccode)
171 : "d" (schid)
172 : "cc", "1" );
173 return ccode;
176 static inline int csch(struct subchannel_id schid)
178 int ccode;
180 __asm__ __volatile__(
181 " lr 1,%1\n"
182 " csch\n"
183 " ipm %0\n"
184 " srl %0,28"
185 : "=d" (ccode)
186 : "d" (schid)
187 : "cc", "1" );
188 return ccode;
191 static inline int hsch(struct subchannel_id schid)
193 int ccode;
195 __asm__ __volatile__(
196 " lr 1,%1\n"
197 " hsch\n"
198 " ipm %0\n"
199 " srl %0,28"
200 : "=d" (ccode)
201 : "d" (schid)
202 : "cc", "1" );
203 return ccode;
206 static inline int xsch(struct subchannel_id schid)
208 int ccode;
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)
216 : "d" (schid)
217 : "cc", "1" );
218 return ccode;
221 static inline int chsc(void *chsc_area)
223 typedef struct { char _[4096]; } addr_type;
224 int cc;
226 __asm__ __volatile__ (
227 ".insn rre,0xb25f0000,%2,0 \n\t"
228 "ipm %0 \n\t"
229 "srl %0,28 \n\t"
230 : "=d" (cc), "=m" (*(addr_type *) chsc_area)
231 : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
232 : "cc" );
234 return cc;
237 static inline int iac( void)
239 int ccode;
241 __asm__ __volatile__(
242 " iac 1\n"
243 " ipm %0\n"
244 " srl %0,28"
245 : "=d" (ccode) : : "cc", "1" );
246 return ccode;
249 static inline int rchp(int chpid)
251 int ccode;
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;
264 #endif