ioasm.h (2ab59de7c5ce7c5ed6db07278554901d43fe80a0) ioasm.h (42248979d5705e056b509cdcfb548e40f708cba8)
1#ifndef S390_CIO_IOASM_H
2#define S390_CIO_IOASM_H
3
4#include <asm/chpid.h>
5#include <asm/schid.h>
6#include <asm/crw.h>
7#include "orb.h"
8#include "cio.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#include <asm/crw.h>
7#include "orb.h"
8#include "cio.h"
9#include "trace.h"
9
10/*
11 * Some S390 specific IO instructions as inline
12 */
13
14static inline int stsch(struct subchannel_id schid, struct schib *addr)
15{
16 register struct subchannel_id reg1 asm ("1") = schid;
17 int ccode = -EIO;
18
19 asm volatile(
20 " stsch 0(%3)\n"
21 "0: ipm %0\n"
22 " srl %0,28\n"
23 "1:\n"
24 EX_TABLE(0b,1b)
25 : "+d" (ccode), "=m" (*addr)
26 : "d" (reg1), "a" (addr)
27 : "cc");
10
11/*
12 * Some S390 specific IO instructions as inline
13 */
14
15static inline int stsch(struct subchannel_id schid, struct schib *addr)
16{
17 register struct subchannel_id reg1 asm ("1") = schid;
18 int ccode = -EIO;
19
20 asm volatile(
21 " stsch 0(%3)\n"
22 "0: ipm %0\n"
23 " srl %0,28\n"
24 "1:\n"
25 EX_TABLE(0b,1b)
26 : "+d" (ccode), "=m" (*addr)
27 : "d" (reg1), "a" (addr)
28 : "cc");
29 trace_s390_cio_stsch(schid, addr, ccode);
30
28 return ccode;
29}
30
31static inline int msch(struct subchannel_id schid, struct schib *addr)
32{
33 register struct subchannel_id reg1 asm ("1") = schid;
34 int ccode = -EIO;
35
36 asm volatile(
37 " msch 0(%2)\n"
38 "0: ipm %0\n"
39 " srl %0,28\n"
40 "1:\n"
41 EX_TABLE(0b,1b)
42 : "+d" (ccode)
43 : "d" (reg1), "a" (addr), "m" (*addr)
44 : "cc");
31 return ccode;
32}
33
34static inline int msch(struct subchannel_id schid, struct schib *addr)
35{
36 register struct subchannel_id reg1 asm ("1") = schid;
37 int ccode = -EIO;
38
39 asm volatile(
40 " msch 0(%2)\n"
41 "0: ipm %0\n"
42 " srl %0,28\n"
43 "1:\n"
44 EX_TABLE(0b,1b)
45 : "+d" (ccode)
46 : "d" (reg1), "a" (addr), "m" (*addr)
47 : "cc");
48 trace_s390_cio_msch(schid, addr, ccode);
49
45 return ccode;
46}
47
48static inline int tsch(struct subchannel_id schid, struct irb *addr)
49{
50 register struct subchannel_id reg1 asm ("1") = schid;
51 int ccode;
52
53 asm volatile(
54 " tsch 0(%3)\n"
55 " ipm %0\n"
56 " srl %0,28"
57 : "=d" (ccode), "=m" (*addr)
58 : "d" (reg1), "a" (addr)
59 : "cc");
50 return ccode;
51}
52
53static inline int tsch(struct subchannel_id schid, struct irb *addr)
54{
55 register struct subchannel_id reg1 asm ("1") = schid;
56 int ccode;
57
58 asm volatile(
59 " tsch 0(%3)\n"
60 " ipm %0\n"
61 " srl %0,28"
62 : "=d" (ccode), "=m" (*addr)
63 : "d" (reg1), "a" (addr)
64 : "cc");
65 trace_s390_cio_tsch(schid, addr, ccode);
66
60 return ccode;
61}
62
63static inline int ssch(struct subchannel_id schid, union orb *addr)
64{
65 register struct subchannel_id reg1 asm("1") = schid;
66 int ccode = -EIO;
67
68 asm volatile(
69 " ssch 0(%2)\n"
70 "0: ipm %0\n"
71 " srl %0,28\n"
72 "1:\n"
73 EX_TABLE(0b, 1b)
74 : "+d" (ccode)
75 : "d" (reg1), "a" (addr), "m" (*addr)
76 : "cc", "memory");
67 return ccode;
68}
69
70static inline int ssch(struct subchannel_id schid, union orb *addr)
71{
72 register struct subchannel_id reg1 asm("1") = schid;
73 int ccode = -EIO;
74
75 asm volatile(
76 " ssch 0(%2)\n"
77 "0: ipm %0\n"
78 " srl %0,28\n"
79 "1:\n"
80 EX_TABLE(0b, 1b)
81 : "+d" (ccode)
82 : "d" (reg1), "a" (addr), "m" (*addr)
83 : "cc", "memory");
84 trace_s390_cio_ssch(schid, addr, ccode);
85
77 return ccode;
78}
79
80static inline int csch(struct subchannel_id schid)
81{
82 register struct subchannel_id reg1 asm("1") = schid;
83 int ccode;
84
85 asm volatile(
86 " csch\n"
87 " ipm %0\n"
88 " srl %0,28"
89 : "=d" (ccode)
90 : "d" (reg1)
91 : "cc");
86 return ccode;
87}
88
89static inline int csch(struct subchannel_id schid)
90{
91 register struct subchannel_id reg1 asm("1") = schid;
92 int ccode;
93
94 asm volatile(
95 " csch\n"
96 " ipm %0\n"
97 " srl %0,28"
98 : "=d" (ccode)
99 : "d" (reg1)
100 : "cc");
101 trace_s390_cio_csch(schid, ccode);
102
92 return ccode;
93}
94
95static inline int tpi(struct tpi_info *addr)
96{
97 int ccode;
98
99 asm volatile(
100 " tpi 0(%2)\n"
101 " ipm %0\n"
102 " srl %0,28"
103 : "=d" (ccode), "=m" (*addr)
104 : "a" (addr)
105 : "cc");
103 return ccode;
104}
105
106static inline int tpi(struct tpi_info *addr)
107{
108 int ccode;
109
110 asm volatile(
111 " tpi 0(%2)\n"
112 " ipm %0\n"
113 " srl %0,28"
114 : "=d" (ccode), "=m" (*addr)
115 : "a" (addr)
116 : "cc");
117 trace_s390_cio_tpi(addr, ccode);
118
106 return ccode;
107}
108
109static inline int chsc(void *chsc_area)
110{
111 typedef struct { char _[4096]; } addr_type;
112 int cc;
113
114 asm volatile(
115 " .insn rre,0xb25f0000,%2,0\n"
116 " ipm %0\n"
117 " srl %0,28\n"
118 : "=d" (cc), "=m" (*(addr_type *) chsc_area)
119 : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
120 : "cc");
119 return ccode;
120}
121
122static inline int chsc(void *chsc_area)
123{
124 typedef struct { char _[4096]; } addr_type;
125 int cc;
126
127 asm volatile(
128 " .insn rre,0xb25f0000,%2,0\n"
129 " ipm %0\n"
130 " srl %0,28\n"
131 : "=d" (cc), "=m" (*(addr_type *) chsc_area)
132 : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
133 : "cc");
134 trace_s390_cio_chsc(chsc_area, cc);
135
121 return cc;
122}
123
124static inline int rchp(struct chp_id chpid)
125{
126 register struct chp_id reg1 asm ("1") = chpid;
127 int ccode;
128
129 asm volatile(
130 " lr 1,%1\n"
131 " rchp\n"
132 " ipm %0\n"
133 " srl %0,28"
134 : "=d" (ccode) : "d" (reg1) : "cc");
136 return cc;
137}
138
139static inline int rchp(struct chp_id chpid)
140{
141 register struct chp_id reg1 asm ("1") = chpid;
142 int ccode;
143
144 asm volatile(
145 " lr 1,%1\n"
146 " rchp\n"
147 " ipm %0\n"
148 " srl %0,28"
149 : "=d" (ccode) : "d" (reg1) : "cc");
150 trace_s390_cio_rchp(chpid, ccode);
151
135 return ccode;
136}
137
138static inline int rsch(struct subchannel_id schid)
139{
140 register struct subchannel_id reg1 asm("1") = schid;
141 int ccode;
142
143 asm volatile(
144 " rsch\n"
145 " ipm %0\n"
146 " srl %0,28"
147 : "=d" (ccode)
148 : "d" (reg1)
149 : "cc", "memory");
152 return ccode;
153}
154
155static inline int rsch(struct subchannel_id schid)
156{
157 register struct subchannel_id reg1 asm("1") = schid;
158 int ccode;
159
160 asm volatile(
161 " rsch\n"
162 " ipm %0\n"
163 " srl %0,28"
164 : "=d" (ccode)
165 : "d" (reg1)
166 : "cc", "memory");
167 trace_s390_cio_rsch(schid, ccode);
168
150 return ccode;
151}
152
153static inline int hsch(struct subchannel_id schid)
154{
155 register struct subchannel_id reg1 asm("1") = schid;
156 int ccode;
157
158 asm volatile(
159 " hsch\n"
160 " ipm %0\n"
161 " srl %0,28"
162 : "=d" (ccode)
163 : "d" (reg1)
164 : "cc");
169 return ccode;
170}
171
172static inline int hsch(struct subchannel_id schid)
173{
174 register struct subchannel_id reg1 asm("1") = schid;
175 int ccode;
176
177 asm volatile(
178 " hsch\n"
179 " ipm %0\n"
180 " srl %0,28"
181 : "=d" (ccode)
182 : "d" (reg1)
183 : "cc");
184 trace_s390_cio_hsch(schid, ccode);
185
165 return ccode;
166}
167
168static inline int xsch(struct subchannel_id schid)
169{
170 register struct subchannel_id reg1 asm("1") = schid;
171 int ccode;
172
173 asm volatile(
174 " xsch\n"
175 " ipm %0\n"
176 " srl %0,28"
177 : "=d" (ccode)
178 : "d" (reg1)
179 : "cc");
186 return ccode;
187}
188
189static inline int xsch(struct subchannel_id schid)
190{
191 register struct subchannel_id reg1 asm("1") = schid;
192 int ccode;
193
194 asm volatile(
195 " xsch\n"
196 " ipm %0\n"
197 " srl %0,28"
198 : "=d" (ccode)
199 : "d" (reg1)
200 : "cc");
201 trace_s390_cio_xsch(schid, ccode);
202
180 return ccode;
181}
182
183static inline int stcrw(struct crw *crw)
184{
185 int ccode;
186
187 asm volatile(
188 " stcrw 0(%2)\n"
189 " ipm %0\n"
190 " srl %0,28\n"
191 : "=d" (ccode), "=m" (*crw)
192 : "a" (crw)
193 : "cc");
203 return ccode;
204}
205
206static inline int stcrw(struct crw *crw)
207{
208 int ccode;
209
210 asm volatile(
211 " stcrw 0(%2)\n"
212 " ipm %0\n"
213 " srl %0,28\n"
214 : "=d" (ccode), "=m" (*crw)
215 : "a" (crw)
216 : "cc");
217 trace_s390_cio_stcrw(crw, ccode);
218
194 return ccode;
195}
196
197#endif
219 return ccode;
220}
221
222#endif