ARM: SAMSUNG: Fix for S3C2412 EBI memory mapping
[linux/fpc-iii.git] / drivers / s390 / cio / ioasm.h
blob4d80fc67a06b140639b6410f2668ff21e21e545f
1 #ifndef S390_CIO_IOASM_H
2 #define S390_CIO_IOASM_H
4 #include <asm/chpid.h>
5 #include <asm/schid.h>
6 #include "orb.h"
7 #include "cio.h"
9 /*
10 * TPI info structure
12 struct tpi_info {
13 struct subchannel_id schid;
14 __u32 intparm; /* interruption parameter */
15 __u32 adapter_IO : 1;
16 __u32 reserved2 : 1;
17 __u32 isc : 3;
18 __u32 reserved3 : 12;
19 __u32 int_type : 3;
20 __u32 reserved4 : 12;
21 } __attribute__ ((packed));
25 * Some S390 specific IO instructions as inline
28 static inline int stsch_err(struct subchannel_id schid, struct schib *addr)
30 register struct subchannel_id reg1 asm ("1") = schid;
31 int ccode = -EIO;
33 asm volatile(
34 " stsch 0(%3)\n"
35 "0: ipm %0\n"
36 " srl %0,28\n"
37 "1:\n"
38 EX_TABLE(0b,1b)
39 : "+d" (ccode), "=m" (*addr)
40 : "d" (reg1), "a" (addr)
41 : "cc");
42 return ccode;
45 static inline int msch(struct subchannel_id schid, struct schib *addr)
47 register struct subchannel_id reg1 asm ("1") = schid;
48 int ccode;
50 asm volatile(
51 " msch 0(%2)\n"
52 " ipm %0\n"
53 " srl %0,28"
54 : "=d" (ccode)
55 : "d" (reg1), "a" (addr), "m" (*addr)
56 : "cc");
57 return ccode;
60 static inline int msch_err(struct subchannel_id schid, struct schib *addr)
62 register struct subchannel_id reg1 asm ("1") = schid;
63 int ccode = -EIO;
65 asm volatile(
66 " msch 0(%2)\n"
67 "0: ipm %0\n"
68 " srl %0,28\n"
69 "1:\n"
70 EX_TABLE(0b,1b)
71 : "+d" (ccode)
72 : "d" (reg1), "a" (addr), "m" (*addr)
73 : "cc");
74 return ccode;
77 static inline int tsch(struct subchannel_id schid, struct irb *addr)
79 register struct subchannel_id reg1 asm ("1") = schid;
80 int ccode;
82 asm volatile(
83 " tsch 0(%3)\n"
84 " ipm %0\n"
85 " srl %0,28"
86 : "=d" (ccode), "=m" (*addr)
87 : "d" (reg1), "a" (addr)
88 : "cc");
89 return ccode;
92 static inline int ssch(struct subchannel_id schid, union orb *addr)
94 register struct subchannel_id reg1 asm("1") = schid;
95 int ccode = -EIO;
97 asm volatile(
98 " ssch 0(%2)\n"
99 "0: ipm %0\n"
100 " srl %0,28\n"
101 "1:\n"
102 EX_TABLE(0b, 1b)
103 : "+d" (ccode)
104 : "d" (reg1), "a" (addr), "m" (*addr)
105 : "cc", "memory");
106 return ccode;
109 static inline int csch(struct subchannel_id schid)
111 register struct subchannel_id reg1 asm("1") = schid;
112 int ccode;
114 asm volatile(
115 " csch\n"
116 " ipm %0\n"
117 " srl %0,28"
118 : "=d" (ccode)
119 : "d" (reg1)
120 : "cc");
121 return ccode;
124 static inline int tpi(struct tpi_info *addr)
126 int ccode;
128 asm volatile(
129 " tpi 0(%2)\n"
130 " ipm %0\n"
131 " srl %0,28"
132 : "=d" (ccode), "=m" (*addr)
133 : "a" (addr)
134 : "cc");
135 return ccode;
138 static inline int chsc(void *chsc_area)
140 typedef struct { char _[4096]; } addr_type;
141 int cc;
143 asm volatile(
144 " .insn rre,0xb25f0000,%2,0\n"
145 " ipm %0\n"
146 " srl %0,28\n"
147 : "=d" (cc), "=m" (*(addr_type *) chsc_area)
148 : "d" (chsc_area), "m" (*(addr_type *) chsc_area)
149 : "cc");
150 return cc;
153 static inline int rchp(struct chp_id chpid)
155 register struct chp_id reg1 asm ("1") = chpid;
156 int ccode;
158 asm volatile(
159 " lr 1,%1\n"
160 " rchp\n"
161 " ipm %0\n"
162 " srl %0,28"
163 : "=d" (ccode) : "d" (reg1) : "cc");
164 return ccode;
167 #endif