]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/s390/cio/io_sch.h
Merge tag 'media/v4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[mirror_ubuntu-zesty-kernel.git] / drivers / s390 / cio / io_sch.h
CommitLineData
cd6b4f27
CH
1#ifndef S390_IO_SCH_H
2#define S390_IO_SCH_H
3
e1f0fbd6 4#include <linux/types.h>
9d92a7e1 5#include <asm/schid.h>
e1f0fbd6 6#include <asm/ccwdev.h>
de400d6b 7#include <asm/irq.h>
e1f0fbd6 8#include "css.h"
9e6f9f85 9#include "orb.h"
83262d63 10
cd6b4f27 11struct io_subchannel_private {
83262d63 12 union orb orb; /* operation request block */
cd6b4f27 13 struct ccw1 sense_ccw; /* static ccw for sense command */
97eb6bfc 14 struct ccw_device *cdev;/* pointer to the child ccw device */
c513d07a
SO
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);
cd6b4f27 21
f92519e8
SO
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))
97eb6bfc
SO
25
26static inline struct ccw_device *sch_get_cdev(struct subchannel *sch)
27{
28 struct io_subchannel_private *priv = to_io_private(sch);
29 return priv ? priv->cdev : NULL;
30}
31
32static inline void sch_set_cdev(struct subchannel *sch,
33 struct ccw_device *cdev)
34{
35 struct io_subchannel_private *priv = to_io_private(sch);
36 if (priv)
37 priv->cdev = cdev;
38}
cd6b4f27
CH
39
40#define MAX_CIWS 8
41
e1f0fbd6
PO
42/*
43 * Possible status values for a CCW request's I/O.
44 */
45enum io_status {
46 IO_DONE,
47 IO_RUNNING,
48 IO_STATUS_ERROR,
49 IO_PATH_ERROR,
50 IO_REJECTED,
51 IO_KILLED
52};
53
54/**
55 * ccw_request - Internal CCW request.
56 * @cp: channel program to start
57 * @timeout: maximum allowable time in jiffies between start I/O and interrupt
58 * @maxretries: number of retries per I/O operation and path
59 * @lpm: mask of paths to use
60 * @check: optional callback that determines if results are final
61 * @filter: optional callback to adjust request status based on IRB data
62 * @callback: final callback
63 * @data: user-defined pointer passed to all callbacks
982bdf81
SO
64 * @singlepath: if set, use only one path from @lpm per start I/O
65 * @cancel: non-zero if request was cancelled
66 * @done: non-zero if request was finished
e1f0fbd6
PO
67 * @mask: current path mask
68 * @retries: current number of retries
69 * @drc: delayed return code
e1f0fbd6
PO
70 */
71struct ccw_request {
72 struct ccw1 *cp;
73 unsigned long timeout;
74 u16 maxretries;
75 u8 lpm;
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;
982bdf81 81 unsigned int singlepath:1;
e1f0fbd6 82 /* These fields are used internally. */
982bdf81
SO
83 unsigned int cancel:1;
84 unsigned int done:1;
de1b0438 85 u16 mask;
e1f0fbd6
PO
86 u16 retries;
87 int drc;
e1f0fbd6
PO
88} __attribute__((packed));
89
cd6b4f27
CH
90/*
91 * sense-id response buffer layout
92 */
93struct 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)));
104
37de53bb
PO
105enum cdev_todo {
106 CDEV_TODO_NOTHING,
107 CDEV_TODO_ENABLE_CMF,
108 CDEV_TODO_REBIND,
109 CDEV_TODO_REGISTER,
110 CDEV_TODO_UNREG,
111 CDEV_TODO_UNREG_EVAL,
112};
113
50c8e31f
SO
114#define FAKE_CMD_IRB 1
115#define FAKE_TM_IRB 2
116
cd6b4f27
CH
117struct ccw_device_private {
118 struct ccw_device *cdev;
119 struct subchannel *sch;
120 int state; /* device state */
121 atomic_t onoff;
cd6b4f27 122 struct ccw_dev_id dev_id; /* device id */
e1f0fbd6 123 struct ccw_request req; /* internal I/O request */
9679baaf 124 int iretry;
585b954e
SO
125 u8 pgid_valid_mask; /* mask of valid PGIDs */
126 u8 pgid_todo_mask; /* mask of PGIDs to be adjusted */
127 u8 pgid_reset_mask; /* mask of PGIDs which were reset */
69f5576f
SO
128 u8 path_noirq_mask; /* mask of paths for which no irq was
129 received */
130 u8 path_notoper_mask; /* mask of paths which were found
131 not operable */
585b954e
SO
132 u8 path_gone_mask; /* mask of paths, that became unavailable */
133 u8 path_new_mask; /* mask of paths, that became available */
cd6b4f27
CH
134 struct {
135 unsigned int fast:1; /* post with "channel end" */
136 unsigned int repall:1; /* report every interrupt status */
137 unsigned int pgroup:1; /* do path grouping */
138 unsigned int force:1; /* allow forced online */
454e1fa1 139 unsigned int mpath:1; /* do multipathing */
cd6b4f27
CH
140 } __attribute__ ((packed)) options;
141 struct {
cd6b4f27
CH
142 unsigned int esid:1; /* Ext. SenseID supported by HW */
143 unsigned int dosense:1; /* delayed SENSE required */
144 unsigned int doverify:1; /* delayed path verification */
145 unsigned int donotify:1; /* call notify function */
146 unsigned int recog_done:1; /* dev. recog. complete */
50c8e31f 147 unsigned int fake_irb:2; /* deliver faked irb */
823d494a 148 unsigned int resuming:1; /* recognition while resume */
454e1fa1
PO
149 unsigned int pgroup:1; /* pathgroup is set up */
150 unsigned int mpath:1; /* multipathing is set up */
69f5576f 151 unsigned int pgid_unknown:1;/* unknown pgid state */
24a1872d 152 unsigned int initialized:1; /* set if initial reference held */
cd6b4f27
CH
153 } __attribute__((packed)) flags;
154 unsigned long intparm; /* user interruption parameter */
155 struct qdio_irq *qdio_data;
156 struct irb irb; /* device status */
157 struct senseid senseid; /* SenseID info */
158 struct pgid pgid[8]; /* path group IDs per chpid*/
159 struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
37de53bb
PO
160 struct work_struct todo_work;
161 enum cdev_todo todo;
cd6b4f27
CH
162 wait_queue_head_t wait_q;
163 struct timer_list timer;
164 void *cmb; /* measurement information */
165 struct list_head cmb_list; /* list of measured devices */
166 u64 cmb_start_time; /* clock value of cmb reset */
167 void *cmb_wait; /* deferred cmb enable/disable */
de400d6b 168 enum interruption_class int_class;
cd6b4f27
CH
169};
170
cd6b4f27 171#endif