aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_int.h
diff options
context:
space:
mode:
authorStefan Weinhuber <wein@de.ibm.com>2008-01-26 08:11:23 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-01-26 08:11:28 -0500
commit8e09f21574ea3028d5629e5de759e0b196c690c5 (patch)
treeced4feb1847ee6c2a7b7b4cec8f3118f83d3a386 /drivers/s390/block/dasd_int.h
parent0ac30be461084f30ad6e22c6b91347e880ed41aa (diff)
[S390] dasd: add hyper PAV support to DASD device driver, part 1
Parallel access volumes (PAV) is a storage server feature, that allows to start multiple channel programs on the same DASD in parallel. It defines alias devices which can be used as alternative paths to the same disk. With the old base PAV support we only needed rudimentary functionality in the DASD device driver. As the mapping between base and alias devices was static, we just had to export an identifier (uid) and could leave the combining of devices to external layers like a device mapper multipath. Now hyper PAV removes the requirement to dedicate alias devices to specific base devices. Instead each alias devices can be combined with multiple base device on a per request basis. This requires full support by the DASD device driver as now each channel program itself has to identify the target base device. The changes to the dasd device driver and the ECKD discipline are: - Separate subchannel device representation (dasd_device) from block device representation (dasd_block). Only base devices are block devices. - Gather information about base and alias devices and possible combinations. - For each request decide which dasd_device should be used (base or alias) and build specific channel program. - Support summary unit checks, which allow the storage server to upgrade / downgrade between base and hyper PAV at runtime (support is mandatory). Signed-off-by: Stefan Weinhuber <wein@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_int.h')
-rw-r--r--drivers/s390/block/dasd_int.h209
1 files changed, 127 insertions, 82 deletions
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index d427daeef511..44b2984dfbee 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -64,13 +64,7 @@
64 * SECTION: Type definitions 64 * SECTION: Type definitions
65 */ 65 */
66struct dasd_device; 66struct dasd_device;
67 67struct dasd_block;
68typedef enum {
69 dasd_era_fatal = -1, /* no chance to recover */
70 dasd_era_none = 0, /* don't recover, everything alright */
71 dasd_era_msg = 1, /* don't recover, just report... */
72 dasd_era_recover = 2 /* recovery action recommended */
73} dasd_era_t;
74 68
75/* BIT DEFINITIONS FOR SENSE DATA */ 69/* BIT DEFINITIONS FOR SENSE DATA */
76#define DASD_SENSE_BIT_0 0x80 70#define DASD_SENSE_BIT_0 0x80
@@ -151,19 +145,22 @@ do { \
151 145
152struct dasd_ccw_req { 146struct dasd_ccw_req {
153 unsigned int magic; /* Eye catcher */ 147 unsigned int magic; /* Eye catcher */
154 struct list_head list; /* list_head for request queueing. */ 148 struct list_head devlist; /* for dasd_device request queue */
149 struct list_head blocklist; /* for dasd_block request queue */
155 150
156 /* Where to execute what... */ 151 /* Where to execute what... */
157 struct dasd_device *device; /* device the request is for */ 152 struct dasd_block *block; /* the originating block device */
153 struct dasd_device *memdev; /* the device used to allocate this */
154 struct dasd_device *startdev; /* device the request is started on */
158 struct ccw1 *cpaddr; /* address of channel program */ 155 struct ccw1 *cpaddr; /* address of channel program */
159 char status; /* status of this request */ 156 char status; /* status of this request */
160 short retries; /* A retry counter */ 157 short retries; /* A retry counter */
161 unsigned long flags; /* flags of this request */ 158 unsigned long flags; /* flags of this request */
162 159
163 /* ... and how */ 160 /* ... and how */
164 unsigned long starttime; /* jiffies time of request start */ 161 unsigned long starttime; /* jiffies time of request start */
165 int expires; /* expiration period in jiffies */ 162 int expires; /* expiration period in jiffies */
166 char lpm; /* logical path mask */ 163 char lpm; /* logical path mask */
167 void *data; /* pointer to data area */ 164 void *data; /* pointer to data area */
168 165
169 /* these are important for recovering erroneous requests */ 166 /* these are important for recovering erroneous requests */
@@ -178,20 +175,27 @@ struct dasd_ccw_req {
178 unsigned long long endclk; /* TOD-clock of request termination */ 175 unsigned long long endclk; /* TOD-clock of request termination */
179 176
180 /* Callback that is called after reaching final status. */ 177 /* Callback that is called after reaching final status. */
181 void (*callback)(struct dasd_ccw_req *, void *data); 178 void (*callback)(struct dasd_ccw_req *, void *data);
182 void *callback_data; 179 void *callback_data;
183}; 180};
184 181
185/* 182/*
186 * dasd_ccw_req -> status can be: 183 * dasd_ccw_req -> status can be:
187 */ 184 */
188#define DASD_CQR_FILLED 0x00 /* request is ready to be processed */ 185#define DASD_CQR_FILLED 0x00 /* request is ready to be processed */
189#define DASD_CQR_QUEUED 0x01 /* request is queued to be processed */ 186#define DASD_CQR_DONE 0x01 /* request is completed successfully */
190#define DASD_CQR_IN_IO 0x02 /* request is currently in IO */ 187#define DASD_CQR_NEED_ERP 0x02 /* request needs recovery action */
191#define DASD_CQR_DONE 0x03 /* request is completed successfully */ 188#define DASD_CQR_IN_ERP 0x03 /* request is in recovery */
192#define DASD_CQR_ERROR 0x04 /* request is completed with error */ 189#define DASD_CQR_FAILED 0x04 /* request is finally failed */
193#define DASD_CQR_FAILED 0x05 /* request is finally failed */ 190#define DASD_CQR_TERMINATED 0x05 /* request was stopped by driver */
194#define DASD_CQR_CLEAR 0x06 /* request is clear pending */ 191
192#define DASD_CQR_QUEUED 0x80 /* request is queued to be processed */
193#define DASD_CQR_IN_IO 0x81 /* request is currently in IO */
194#define DASD_CQR_ERROR 0x82 /* request is completed with error */
195#define DASD_CQR_CLEAR_PENDING 0x83 /* request is clear pending */
196#define DASD_CQR_CLEARED 0x84 /* request was cleared */
197#define DASD_CQR_SUCCESS 0x85 /* request was successfull */
198
195 199
196/* per dasd_ccw_req flags */ 200/* per dasd_ccw_req flags */
197#define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */ 201#define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */
@@ -214,52 +218,71 @@ struct dasd_discipline {
214 218
215 struct list_head list; /* used for list of disciplines */ 219 struct list_head list; /* used for list of disciplines */
216 220
217 /* 221 /*
218 * Device recognition functions. check_device is used to verify 222 * Device recognition functions. check_device is used to verify
219 * the sense data and the information returned by read device 223 * the sense data and the information returned by read device
220 * characteristics. It returns 0 if the discipline can be used 224 * characteristics. It returns 0 if the discipline can be used
221 * for the device in question. 225 * for the device in question. uncheck_device is called during
222 * do_analysis is used in the step from device state "basic" to 226 * device shutdown to deregister a device from its discipline.
223 * state "accept". It returns 0 if the device can be made ready, 227 */
224 * it returns -EMEDIUMTYPE if the device can't be made ready or 228 int (*check_device) (struct dasd_device *);
225 * -EAGAIN if do_analysis started a ccw that needs to complete 229 void (*uncheck_device) (struct dasd_device *);
226 * before the analysis may be repeated. 230
227 */ 231 /*
228 int (*check_device)(struct dasd_device *); 232 * do_analysis is used in the step from device state "basic" to
229 int (*do_analysis) (struct dasd_device *); 233 * state "accept". It returns 0 if the device can be made ready,
230 234 * it returns -EMEDIUMTYPE if the device can't be made ready or
231 /* 235 * -EAGAIN if do_analysis started a ccw that needs to complete
232 * Device operation functions. build_cp creates a ccw chain for 236 * before the analysis may be repeated.
233 * a block device request, start_io starts the request and 237 */
234 * term_IO cancels it (e.g. in case of a timeout). format_device 238 int (*do_analysis) (struct dasd_block *);
235 * returns a ccw chain to be used to format the device. 239
236 */ 240 /*
241 * Last things to do when a device is set online, and first things
242 * when it is set offline.
243 */
244 int (*ready_to_online) (struct dasd_device *);
245 int (*online_to_ready) (struct dasd_device *);
246
247 /*
248 * Device operation functions. build_cp creates a ccw chain for
249 * a block device request, start_io starts the request and
250 * term_IO cancels it (e.g. in case of a timeout). format_device
251 * returns a ccw chain to be used to format the device.
252 * handle_terminated_request allows to examine a cqr and prepare
253 * it for retry.
254 */
237 struct dasd_ccw_req *(*build_cp) (struct dasd_device *, 255 struct dasd_ccw_req *(*build_cp) (struct dasd_device *,
256 struct dasd_block *,
238 struct request *); 257 struct request *);
239 int (*start_IO) (struct dasd_ccw_req *); 258 int (*start_IO) (struct dasd_ccw_req *);
240 int (*term_IO) (struct dasd_ccw_req *); 259 int (*term_IO) (struct dasd_ccw_req *);
260 void (*handle_terminated_request) (struct dasd_ccw_req *);
241 struct dasd_ccw_req *(*format_device) (struct dasd_device *, 261 struct dasd_ccw_req *(*format_device) (struct dasd_device *,
242 struct format_data_t *); 262 struct format_data_t *);
243 int (*free_cp) (struct dasd_ccw_req *, struct request *); 263 int (*free_cp) (struct dasd_ccw_req *, struct request *);
244 /* 264
245 * Error recovery functions. examine_error() returns a value that 265 /*
246 * indicates what to do for an error condition. If examine_error() 266 * Error recovery functions. examine_error() returns a value that
267 * indicates what to do for an error condition. If examine_error()
247 * returns 'dasd_era_recover' erp_action() is called to create a 268 * returns 'dasd_era_recover' erp_action() is called to create a
248 * special error recovery ccw. erp_postaction() is called after 269 * special error recovery ccw. erp_postaction() is called after
249 * an error recovery ccw has finished its execution. dump_sense 270 * an error recovery ccw has finished its execution. dump_sense
250 * is called for every error condition to print the sense data 271 * is called for every error condition to print the sense data
251 * to the console. 272 * to the console.
252 */ 273 */
253 dasd_era_t(*examine_error) (struct dasd_ccw_req *, struct irb *);
254 dasd_erp_fn_t(*erp_action) (struct dasd_ccw_req *); 274 dasd_erp_fn_t(*erp_action) (struct dasd_ccw_req *);
255 dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); 275 dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *);
256 void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, 276 void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *,
257 struct irb *); 277 struct irb *);
258 278
279 void (*handle_unsolicited_interrupt) (struct dasd_device *,
280 struct irb *);
281
259 /* i/o control functions. */ 282 /* i/o control functions. */
260 int (*fill_geometry) (struct dasd_device *, struct hd_geometry *); 283 int (*fill_geometry) (struct dasd_block *, struct hd_geometry *);
261 int (*fill_info) (struct dasd_device *, struct dasd_information2_t *); 284 int (*fill_info) (struct dasd_device *, struct dasd_information2_t *);
262 int (*ioctl) (struct dasd_device *, unsigned int, void __user *); 285 int (*ioctl) (struct dasd_block *, unsigned int, void __user *);
263}; 286};
264 287
265extern struct dasd_discipline *dasd_diag_discipline_pointer; 288extern struct dasd_discipline *dasd_diag_discipline_pointer;
@@ -267,12 +290,18 @@ extern struct dasd_discipline *dasd_diag_discipline_pointer;
267/* 290/*
268 * Unique identifier for dasd device. 291 * Unique identifier for dasd device.
269 */ 292 */
293#define UA_NOT_CONFIGURED 0x00
294#define UA_BASE_DEVICE 0x01
295#define UA_BASE_PAV_ALIAS 0x02
296#define UA_HYPER_PAV_ALIAS 0x03
297
270struct dasd_uid { 298struct dasd_uid {
271 __u8 alias; 299 __u8 type;
272 char vendor[4]; 300 char vendor[4];
273 char serial[15]; 301 char serial[15];
274 __u16 ssid; 302 __u16 ssid;
275 __u8 unit_addr; 303 __u8 real_unit_addr;
304 __u8 base_unit_addr;
276}; 305};
277 306
278/* 307/*
@@ -293,14 +322,9 @@ struct dasd_uid {
293 322
294struct dasd_device { 323struct dasd_device {
295 /* Block device stuff. */ 324 /* Block device stuff. */
296 struct gendisk *gdp; 325 struct dasd_block *block;
297 struct request_queue *request_queue; 326
298 spinlock_t request_queue_lock;
299 struct block_device *bdev;
300 unsigned int devindex; 327 unsigned int devindex;
301 unsigned long blocks; /* size of volume in blocks */
302 unsigned int bp_block; /* bytes per block */
303 unsigned int s2b_shift; /* log2 (bp_block/512) */
304 unsigned long flags; /* per device flags */ 328 unsigned long flags; /* per device flags */
305 unsigned short features; /* copy of devmap-features (read-only!) */ 329 unsigned short features; /* copy of devmap-features (read-only!) */
306 330
@@ -316,9 +340,8 @@ struct dasd_device {
316 int state, target; 340 int state, target;
317 int stopped; /* device (ccw_device_start) was stopped */ 341 int stopped; /* device (ccw_device_start) was stopped */
318 342
319 /* Open and reference count. */ 343 /* reference count. */
320 atomic_t ref_count; 344 atomic_t ref_count;
321 atomic_t open_count;
322 345
323 /* ccw queue and memory for static ccw/erp buffers. */ 346 /* ccw queue and memory for static ccw/erp buffers. */
324 struct list_head ccw_queue; 347 struct list_head ccw_queue;
@@ -337,20 +360,45 @@ struct dasd_device {
337 360
338 struct ccw_device *cdev; 361 struct ccw_device *cdev;
339 362
363 /* hook for alias management */
364 struct list_head alias_list;
365};
366
367struct dasd_block {
368 /* Block device stuff. */
369 struct gendisk *gdp;
370 struct request_queue *request_queue;
371 spinlock_t request_queue_lock;
372 struct block_device *bdev;
373 atomic_t open_count;
374
375 unsigned long blocks; /* size of volume in blocks */
376 unsigned int bp_block; /* bytes per block */
377 unsigned int s2b_shift; /* log2 (bp_block/512) */
378
379 struct dasd_device *base;
380 struct list_head ccw_queue;
381 spinlock_t queue_lock;
382
383 atomic_t tasklet_scheduled;
384 struct tasklet_struct tasklet;
385 struct timer_list timer;
386
340#ifdef CONFIG_DASD_PROFILE 387#ifdef CONFIG_DASD_PROFILE
341 struct dasd_profile_info_t profile; 388 struct dasd_profile_info_t profile;
342#endif 389#endif
343}; 390};
344 391
392
393
345/* reasons why device (ccw_device_start) was stopped */ 394/* reasons why device (ccw_device_start) was stopped */
346#define DASD_STOPPED_NOT_ACC 1 /* not accessible */ 395#define DASD_STOPPED_NOT_ACC 1 /* not accessible */
347#define DASD_STOPPED_QUIESCE 2 /* Quiesced */ 396#define DASD_STOPPED_QUIESCE 2 /* Quiesced */
348#define DASD_STOPPED_PENDING 4 /* long busy */ 397#define DASD_STOPPED_PENDING 4 /* long busy */
349#define DASD_STOPPED_DC_WAIT 8 /* disconnected, wait */ 398#define DASD_STOPPED_DC_WAIT 8 /* disconnected, wait */
350#define DASD_STOPPED_DC_EIO 16 /* disconnected, return -EIO */ 399#define DASD_STOPPED_SU 16 /* summary unit check handling */
351 400
352/* per device flags */ 401/* per device flags */
353#define DASD_FLAG_DSC_ERROR 2 /* return -EIO when disconnected */
354#define DASD_FLAG_OFFLINE 3 /* device is in offline processing */ 402#define DASD_FLAG_OFFLINE 3 /* device is in offline processing */
355#define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */ 403#define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */
356#define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */ 404#define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */
@@ -489,6 +537,9 @@ dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, struct dasd_device *device)
489struct dasd_device *dasd_alloc_device(void); 537struct dasd_device *dasd_alloc_device(void);
490void dasd_free_device(struct dasd_device *); 538void dasd_free_device(struct dasd_device *);
491 539
540struct dasd_block *dasd_alloc_block(void);
541void dasd_free_block(struct dasd_block *);
542
492void dasd_enable_device(struct dasd_device *); 543void dasd_enable_device(struct dasd_device *);
493void dasd_set_target_state(struct dasd_device *, int); 544void dasd_set_target_state(struct dasd_device *, int);
494void dasd_kick_device(struct dasd_device *); 545void dasd_kick_device(struct dasd_device *);
@@ -497,18 +548,23 @@ void dasd_add_request_head(struct dasd_ccw_req *);
497void dasd_add_request_tail(struct dasd_ccw_req *); 548void dasd_add_request_tail(struct dasd_ccw_req *);
498int dasd_start_IO(struct dasd_ccw_req *); 549int dasd_start_IO(struct dasd_ccw_req *);
499int dasd_term_IO(struct dasd_ccw_req *); 550int dasd_term_IO(struct dasd_ccw_req *);
500void dasd_schedule_bh(struct dasd_device *); 551void dasd_schedule_device_bh(struct dasd_device *);
552void dasd_schedule_block_bh(struct dasd_block *);
501int dasd_sleep_on(struct dasd_ccw_req *); 553int dasd_sleep_on(struct dasd_ccw_req *);
502int dasd_sleep_on_immediatly(struct dasd_ccw_req *); 554int dasd_sleep_on_immediatly(struct dasd_ccw_req *);
503int dasd_sleep_on_interruptible(struct dasd_ccw_req *); 555int dasd_sleep_on_interruptible(struct dasd_ccw_req *);
504void dasd_set_timer(struct dasd_device *, int); 556void dasd_device_set_timer(struct dasd_device *, int);
505void dasd_clear_timer(struct dasd_device *); 557void dasd_device_clear_timer(struct dasd_device *);
558void dasd_block_set_timer(struct dasd_block *, int);
559void dasd_block_clear_timer(struct dasd_block *);
506int dasd_cancel_req(struct dasd_ccw_req *); 560int dasd_cancel_req(struct dasd_ccw_req *);
561int dasd_flush_device_queue(struct dasd_device *);
507int dasd_generic_probe (struct ccw_device *, struct dasd_discipline *); 562int dasd_generic_probe (struct ccw_device *, struct dasd_discipline *);
508void dasd_generic_remove (struct ccw_device *cdev); 563void dasd_generic_remove (struct ccw_device *cdev);
509int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *); 564int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *);
510int dasd_generic_set_offline (struct ccw_device *cdev); 565int dasd_generic_set_offline (struct ccw_device *cdev);
511int dasd_generic_notify(struct ccw_device *, int); 566int dasd_generic_notify(struct ccw_device *, int);
567void dasd_generic_handle_state_change(struct dasd_device *);
512 568
513int dasd_generic_read_dev_chars(struct dasd_device *, char *, void **, int); 569int dasd_generic_read_dev_chars(struct dasd_device *, char *, void **, int);
514 570
@@ -542,10 +598,10 @@ int dasd_busid_known(char *);
542/* externals in dasd_gendisk.c */ 598/* externals in dasd_gendisk.c */
543int dasd_gendisk_init(void); 599int dasd_gendisk_init(void);
544void dasd_gendisk_exit(void); 600void dasd_gendisk_exit(void);
545int dasd_gendisk_alloc(struct dasd_device *); 601int dasd_gendisk_alloc(struct dasd_block *);
546void dasd_gendisk_free(struct dasd_device *); 602void dasd_gendisk_free(struct dasd_block *);
547int dasd_scan_partitions(struct dasd_device *); 603int dasd_scan_partitions(struct dasd_block *);
548void dasd_destroy_partitions(struct dasd_device *); 604void dasd_destroy_partitions(struct dasd_block *);
549 605
550/* externals in dasd_ioctl.c */ 606/* externals in dasd_ioctl.c */
551int dasd_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 607int dasd_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
@@ -563,20 +619,9 @@ struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int,
563void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *); 619void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *);
564void dasd_log_sense(struct dasd_ccw_req *, struct irb *); 620void dasd_log_sense(struct dasd_ccw_req *, struct irb *);
565 621
566/* externals in dasd_3370_erp.c */
567dasd_era_t dasd_3370_erp_examine(struct dasd_ccw_req *, struct irb *);
568
569/* externals in dasd_3990_erp.c */ 622/* externals in dasd_3990_erp.c */
570dasd_era_t dasd_3990_erp_examine(struct dasd_ccw_req *, struct irb *);
571struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *); 623struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *);
572 624
573/* externals in dasd_9336_erp.c */
574dasd_era_t dasd_9336_erp_examine(struct dasd_ccw_req *, struct irb *);
575
576/* externals in dasd_9336_erp.c */
577dasd_era_t dasd_9343_erp_examine(struct dasd_ccw_req *, struct irb *);
578struct dasd_ccw_req *dasd_9343_erp_action(struct dasd_ccw_req *);
579
580/* externals in dasd_eer.c */ 625/* externals in dasd_eer.c */
581#ifdef CONFIG_DASD_EER 626#ifdef CONFIG_DASD_EER
582int dasd_eer_init(void); 627int dasd_eer_init(void);