Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
io_sch.h
Go to the documentation of this file.
1 #ifndef S390_IO_SCH_H
2 #define S390_IO_SCH_H
3 
4 #include <linux/types.h>
5 #include <asm/schid.h>
6 #include <asm/ccwdev.h>
7 #include <asm/irq.h>
8 #include "css.h"
9 #include "orb.h"
10 
12  union orb orb; /* operation request block */
13  struct ccw1 sense_ccw; /* static ccw for sense command */
14  struct ccw_device *cdev;/* pointer to the child ccw device */
15  struct {
16  unsigned int suspend:1; /* allow suspend */
17  unsigned int prefetch:1;/* deny prefetch */
18  unsigned int inter:1; /* suppress intermediate interrupts */
19  } __packed options;
20 } __aligned(8);
21 
22 #define to_io_private(n) ((struct io_subchannel_private *) \
23  dev_get_drvdata(&(n)->dev))
24 #define set_io_private(n, p) (dev_set_drvdata(&(n)->dev, p))
25 
26 static inline struct ccw_device *sch_get_cdev(struct subchannel *sch)
27 {
29  return priv ? priv->cdev : NULL;
30 }
31 
32 static inline void sch_set_cdev(struct subchannel *sch,
33  struct ccw_device *cdev)
34 {
36  if (priv)
37  priv->cdev = cdev;
38 }
39 
40 #define MAX_CIWS 8
41 
42 /*
43  * Possible status values for a CCW request's I/O.
44  */
45 enum io_status {
52 };
53 
71 struct ccw_request {
72  struct ccw1 *cp;
73  unsigned long timeout;
76  int (*check)(struct ccw_device *, void *);
77  enum io_status (*filter)(struct ccw_device *, void *, struct irb *,
78  enum io_status);
79  void (*callback)(struct ccw_device *, void *, int);
80  void *data;
81  unsigned int singlepath:1;
82  /* These fields are used internally. */
83  unsigned int cancel:1;
84  unsigned int done:1;
87  int drc;
88 } __attribute__((packed));
89 
90 /*
91  * sense-id response buffer layout
92  */
93 struct senseid {
94  /* common part */
95  u8 reserved; /* always 0x'FF' */
96  u16 cu_type; /* control unit type */
97  u8 cu_model; /* control unit model */
98  u16 dev_type; /* device type */
99  u8 dev_model; /* device model */
100  u8 unused; /* padding byte */
101  /* extended part */
102  struct ciw ciw[MAX_CIWS]; /* variable # of CIWs */
103 } __attribute__ ((packed, aligned(4)));
105 enum cdev_todo {
112 };
113 
114 #define FAKE_CMD_IRB 1
115 #define FAKE_TM_IRB 2
116 
118  struct ccw_device *cdev;
119  struct subchannel *sch;
120  int state; /* device state */
122  struct ccw_dev_id dev_id; /* device id */
123  struct subchannel_id schid; /* subchannel number */
124  struct ccw_request req; /* internal I/O request */
125  int iretry;
126  u8 pgid_valid_mask; /* mask of valid PGIDs */
127  u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */
128  u8 pgid_reset_mask; /* mask of PGIDs which were reset */
129  u8 path_gone_mask; /* mask of paths, that became unavailable */
130  u8 path_new_mask; /* mask of paths, that became available */
131  struct {
132  unsigned int fast:1; /* post with "channel end" */
133  unsigned int repall:1; /* report every interrupt status */
134  unsigned int pgroup:1; /* do path grouping */
135  unsigned int force:1; /* allow forced online */
136  unsigned int mpath:1; /* do multipathing */
137  } __attribute__ ((packed)) options;
139  unsigned int esid:1; /* Ext. SenseID supported by HW */
140  unsigned int dosense:1; /* delayed SENSE required */
141  unsigned int doverify:1; /* delayed path verification */
142  unsigned int donotify:1; /* call notify function */
143  unsigned int recog_done:1; /* dev. recog. complete */
144  unsigned int fake_irb:2; /* deliver faked irb */
145  unsigned int resuming:1; /* recognition while resume */
146  unsigned int pgroup:1; /* pathgroup is set up */
147  unsigned int mpath:1; /* multipathing is set up */
148  unsigned int initialized:1; /* set if initial reference held */
149  } __attribute__((packed)) flags;
150  unsigned long intparm; /* user interruption parameter */
152  struct irb irb; /* device status */
153  struct senseid senseid; /* SenseID info */
154  struct pgid pgid[8]; /* path group IDs per chpid*/
155  struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
160  void *cmb; /* measurement information */
161  struct list_head cmb_list; /* list of measured devices */
162  u64 cmb_start_time; /* clock value of cmb reset */
163  void *cmb_wait; /* deferred cmb enable/disable */
165 };
166 
167 static inline int rsch(struct subchannel_id schid)
168 {
169  register struct subchannel_id reg1 asm("1") = schid;
170  int ccode;
171 
172  asm volatile(
173  " rsch\n"
174  " ipm %0\n"
175  " srl %0,28"
176  : "=d" (ccode)
177  : "d" (reg1)
178  : "cc", "memory");
179  return ccode;
180 }
181 
182 static inline int hsch(struct subchannel_id schid)
183 {
184  register struct subchannel_id reg1 asm("1") = schid;
185  int ccode;
186 
187  asm volatile(
188  " hsch\n"
189  " ipm %0\n"
190  " srl %0,28"
191  : "=d" (ccode)
192  : "d" (reg1)
193  : "cc");
194  return ccode;
195 }
196 
197 static inline int xsch(struct subchannel_id schid)
198 {
199  register struct subchannel_id reg1 asm("1") = schid;
200  int ccode;
201 
202  asm volatile(
203  " .insn rre,0xb2760000,%1,0\n"
204  " ipm %0\n"
205  " srl %0,28"
206  : "=d" (ccode)
207  : "d" (reg1)
208  : "cc");
209  return ccode;
210 }
211 
212 #endif