1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
7 #include <asm/ccwdev.h>
12 struct io_subchannel_private
{
13 union orb orb
; /* operation request block */
14 struct ccw1 sense_ccw
; /* static ccw for sense command */
15 struct ccw_device
*cdev
;/* pointer to the child ccw device */
17 unsigned int suspend
:1; /* allow suspend */
18 unsigned int prefetch
:1;/* deny prefetch */
19 unsigned int inter
:1; /* suppress intermediate interrupts */
23 #define to_io_private(n) ((struct io_subchannel_private *) \
24 dev_get_drvdata(&(n)->dev))
25 #define set_io_private(n, p) (dev_set_drvdata(&(n)->dev, p))
27 static inline struct ccw_device
*sch_get_cdev(struct subchannel
*sch
)
29 struct io_subchannel_private
*priv
= to_io_private(sch
);
30 return priv
? priv
->cdev
: NULL
;
33 static inline void sch_set_cdev(struct subchannel
*sch
,
34 struct ccw_device
*cdev
)
36 struct io_subchannel_private
*priv
= to_io_private(sch
);
44 * Possible status values for a CCW request's I/O.
56 * ccw_request - Internal CCW request.
57 * @cp: channel program to start
58 * @timeout: maximum allowable time in jiffies between start I/O and interrupt
59 * @maxretries: number of retries per I/O operation and path
60 * @lpm: mask of paths to use
61 * @check: optional callback that determines if results are final
62 * @filter: optional callback to adjust request status based on IRB data
63 * @callback: final callback
64 * @data: user-defined pointer passed to all callbacks
65 * @singlepath: if set, use only one path from @lpm per start I/O
66 * @cancel: non-zero if request was cancelled
67 * @done: non-zero if request was finished
68 * @mask: current path mask
69 * @retries: current number of retries
70 * @drc: delayed return code
74 unsigned long timeout
;
77 int (*check
)(struct ccw_device
*, void *);
78 enum io_status (*filter
)(struct ccw_device
*, void *, struct irb
*,
80 void (*callback
)(struct ccw_device
*, void *, int);
82 unsigned int singlepath
:1;
83 /* These fields are used internally. */
84 unsigned int cancel
:1;
89 } __attribute__((packed
));
92 * sense-id response buffer layout
96 u8 reserved
; /* always 0x'FF' */
97 u16 cu_type
; /* control unit type */
98 u8 cu_model
; /* control unit model */
99 u16 dev_type
; /* device type */
100 u8 dev_model
; /* device model */
101 u8 unused
; /* padding byte */
103 struct ciw ciw
[MAX_CIWS
]; /* variable # of CIWs */
104 } __attribute__ ((packed
, aligned(4)));
108 CDEV_TODO_ENABLE_CMF
,
112 CDEV_TODO_UNREG_EVAL
,
115 #define FAKE_CMD_IRB 1
116 #define FAKE_TM_IRB 2
118 struct ccw_device_private
{
119 struct ccw_device
*cdev
;
120 struct subchannel
*sch
;
121 int state
; /* device state */
123 struct ccw_dev_id dev_id
; /* device id */
124 struct ccw_request req
; /* internal I/O request */
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_noirq_mask
; /* mask of paths for which no irq was
131 u8 path_notoper_mask
; /* mask of paths which were found
133 u8 path_gone_mask
; /* mask of paths, that became unavailable */
134 u8 path_new_mask
; /* mask of paths, that became available */
135 u8 path_broken_mask
; /* mask of paths, which were found to be
138 unsigned int fast
:1; /* post with "channel end" */
139 unsigned int repall
:1; /* report every interrupt status */
140 unsigned int pgroup
:1; /* do path grouping */
141 unsigned int force
:1; /* allow forced online */
142 unsigned int mpath
:1; /* do multipathing */
143 } __attribute__ ((packed
)) options
;
145 unsigned int esid
:1; /* Ext. SenseID supported by HW */
146 unsigned int dosense
:1; /* delayed SENSE required */
147 unsigned int doverify
:1; /* delayed path verification */
148 unsigned int donotify
:1; /* call notify function */
149 unsigned int recog_done
:1; /* dev. recog. complete */
150 unsigned int fake_irb
:2; /* deliver faked irb */
151 unsigned int resuming
:1; /* recognition while resume */
152 unsigned int pgroup
:1; /* pathgroup is set up */
153 unsigned int mpath
:1; /* multipathing is set up */
154 unsigned int pgid_unknown
:1;/* unknown pgid state */
155 unsigned int initialized
:1; /* set if initial reference held */
156 } __attribute__((packed
)) flags
;
157 unsigned long intparm
; /* user interruption parameter */
158 struct qdio_irq
*qdio_data
;
159 struct irb irb
; /* device status */
160 int async_kill_io_rc
;
161 struct senseid senseid
; /* SenseID info */
162 struct pgid pgid
[8]; /* path group IDs per chpid*/
163 struct ccw1 iccws
[2]; /* ccws for SNID/SID/SPGID commands */
164 struct work_struct todo_work
;
166 wait_queue_head_t wait_q
;
167 struct timer_list timer
;
168 void *cmb
; /* measurement information */
169 struct list_head cmb_list
; /* list of measured devices */
170 u64 cmb_start_time
; /* clock value of cmb reset */
171 void *cmb_wait
; /* deferred cmb enable/disable */
172 enum interruption_class int_class
;