1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Horst Hummel <Horst.Hummel@de.ibm.com>
5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Bugreports.to..: <Linux390@de.ibm.com>
7 * Copyright IBM Corp. 1999, 2009
13 /* we keep old device allocation scheme; IOW, minors are still in 0..255 */
14 #define DASD_PER_MAJOR (1U << (MINORBITS - DASD_PARTN_BITS))
15 #define DASD_PARTN_MASK ((1 << DASD_PARTN_BITS) - 1)
18 * States a dasd device can have:
19 * new: the dasd_device structure is allocated.
20 * known: the discipline for the device is identified.
21 * basic: the device can do basic i/o.
22 * unfmt: the device could not be analyzed (format is unknown).
23 * ready: partition detection is done and the device is can do block io.
24 * online: the device accepts requests from the block device queue.
26 * Things to do for startup state transitions:
27 * new -> known: find discipline for the device and create devfs entries.
28 * known -> basic: request irq line for the device.
29 * basic -> ready: do the initial analysis, e.g. format detection,
30 * do block device setup and detect partitions.
31 * ready -> online: schedule the device tasklet.
32 * Things to do for shutdown state transitions:
33 * online -> ready: just set the new device state.
34 * ready -> basic: flush requests from the block device layer, clear
35 * partition information and reset format information.
36 * basic -> known: terminate all requests and free irq.
37 * known -> new: remove devfs entries and forget discipline.
40 #define DASD_STATE_NEW 0
41 #define DASD_STATE_KNOWN 1
42 #define DASD_STATE_BASIC 2
43 #define DASD_STATE_UNFMT 3
44 #define DASD_STATE_READY 4
45 #define DASD_STATE_ONLINE 5
47 #include <linux/module.h>
48 #include <linux/wait.h>
49 #include <linux/blkdev.h>
50 #include <linux/hdreg.h>
51 #include <linux/interrupt.h>
52 #include <linux/log2.h>
53 #include <asm/ccwdev.h>
54 #include <linux/workqueue.h>
55 #include <asm/debug.h>
57 #include <asm/idals.h>
58 #include <linux/bitops.h>
59 #include <linux/blk-mq.h>
61 /* DASD discipline magic */
62 #define DASD_ECKD_MAGIC 0xC5C3D2C4
63 #define DASD_DIAG_MAGIC 0xC4C9C1C7
64 #define DASD_FBA_MAGIC 0xC6C2C140
67 * SECTION: Type definitions
72 /* BIT DEFINITIONS FOR SENSE DATA */
73 #define DASD_SENSE_BIT_0 0x80
74 #define DASD_SENSE_BIT_1 0x40
75 #define DASD_SENSE_BIT_2 0x20
76 #define DASD_SENSE_BIT_3 0x10
78 /* BIT DEFINITIONS FOR SIM SENSE */
79 #define DASD_SIM_SENSE 0x0F
80 #define DASD_SIM_MSG_TO_OP 0x03
81 #define DASD_SIM_LOG 0x0C
83 /* lock class for nested cdev lock */
84 #define CDEV_NESTED_FIRST 1
85 #define CDEV_NESTED_SECOND 2
88 * SECTION: MACROs for klogd and s390 debug feature (dbf)
90 #define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \
92 debug_sprintf_event(d_device->debug_area, \
98 #define DBF_EVENT(d_level, d_str, d_data...)\
100 debug_sprintf_event(dasd_debug_area, \
106 #define DBF_EVENT_DEVID(d_level, d_cdev, d_str, d_data...) \
108 struct ccw_dev_id __dev_id; \
109 ccw_device_get_id(d_cdev, &__dev_id); \
110 debug_sprintf_event(dasd_debug_area, \
112 "0.%x.%04x " d_str "\n", \
113 __dev_id.ssid, __dev_id.devno, d_data); \
116 /* definition of dbf debug levels */
117 #define DBF_EMERG 0 /* system is unusable */
118 #define DBF_ALERT 1 /* action must be taken immediately */
119 #define DBF_CRIT 2 /* critical conditions */
120 #define DBF_ERR 3 /* error conditions */
121 #define DBF_WARNING 4 /* warning conditions */
122 #define DBF_NOTICE 5 /* normal but significant condition */
123 #define DBF_INFO 6 /* informational */
124 #define DBF_DEBUG 6 /* debug-level messages */
126 /* Macro to calculate number of blocks per page */
127 #define BLOCKS_PER_PAGE(blksize) (PAGE_SIZE / blksize)
129 struct dasd_ccw_req
{
130 unsigned int magic
; /* Eye catcher */
131 int intrc
; /* internal error, e.g. from start_IO */
132 struct list_head devlist
; /* for dasd_device request queue */
133 struct list_head blocklist
; /* for dasd_block request queue */
134 struct dasd_block
*block
; /* the originating block device */
135 struct dasd_device
*memdev
; /* the device used to allocate this */
136 struct dasd_device
*startdev
; /* device the request is started on */
137 struct dasd_device
*basedev
; /* base device if no block->base */
138 void *cpaddr
; /* address of ccw or tcw */
139 short retries
; /* A retry counter */
140 unsigned char cpmode
; /* 0 = cmd mode, 1 = itcw */
141 char status
; /* status of this request */
142 char lpm
; /* logical path mask */
143 unsigned long flags
; /* flags of this request */
144 struct dasd_queue
*dq
;
145 unsigned long starttime
; /* jiffies time of request start */
146 unsigned long expires
; /* expiration period in jiffies */
147 void *data
; /* pointer to data area */
148 struct irb irb
; /* device status in case of an error */
149 struct dasd_ccw_req
*refers
; /* ERP-chain queueing. */
150 void *function
; /* originating ERP action */
153 unsigned long buildclk
; /* TOD-clock of request generation */
154 unsigned long startclk
; /* TOD-clock of request start */
155 unsigned long stopclk
; /* TOD-clock of request interrupt */
156 unsigned long endclk
; /* TOD-clock of request termination */
158 void (*callback
)(struct dasd_ccw_req
*, void *data
);
160 unsigned int proc_bytes
; /* bytes for partial completion */
161 unsigned int trkcount
; /* count formatted tracks */
165 * dasd_ccw_req -> status can be:
167 #define DASD_CQR_FILLED 0x00 /* request is ready to be processed */
168 #define DASD_CQR_DONE 0x01 /* request is completed successfully */
169 #define DASD_CQR_NEED_ERP 0x02 /* request needs recovery action */
170 #define DASD_CQR_IN_ERP 0x03 /* request is in recovery */
171 #define DASD_CQR_FAILED 0x04 /* request is finally failed */
172 #define DASD_CQR_TERMINATED 0x05 /* request was stopped by driver */
174 #define DASD_CQR_QUEUED 0x80 /* request is queued to be processed */
175 #define DASD_CQR_IN_IO 0x81 /* request is currently in IO */
176 #define DASD_CQR_ERROR 0x82 /* request is completed with error */
177 #define DASD_CQR_CLEAR_PENDING 0x83 /* request is clear pending */
178 #define DASD_CQR_CLEARED 0x84 /* request was cleared */
179 #define DASD_CQR_SUCCESS 0x85 /* request was successful */
181 /* default expiration time*/
182 #define DASD_EXPIRES 300
183 #define DASD_EXPIRES_MAX 40000000
184 #define DASD_RETRIES 256
185 #define DASD_RETRIES_MAX 32768
187 /* per dasd_ccw_req flags */
188 #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */
189 #define DASD_CQR_FLAGS_FAILFAST 1 /* FAILFAST */
190 #define DASD_CQR_VERIFY_PATH 2 /* path verification request */
191 #define DASD_CQR_ALLOW_SLOCK 3 /* Try this request even when lock was
192 * stolen. Should not be combined with
193 * DASD_CQR_FLAGS_USE_ERP
196 * The following flags are used to suppress output of certain errors.
198 #define DASD_CQR_SUPPRESS_NRF 4 /* Suppress 'No Record Found' error */
199 #define DASD_CQR_SUPPRESS_IT 5 /* Suppress 'Invalid Track' error*/
200 #define DASD_CQR_SUPPRESS_IL 6 /* Suppress 'Incorrect Length' error */
201 #define DASD_CQR_SUPPRESS_CR 7 /* Suppress 'Command Reject' error */
203 #define DASD_REQ_PER_DEV 4
205 /* Signature for error recovery functions. */
206 typedef struct dasd_ccw_req
*(*dasd_erp_fn_t
) (struct dasd_ccw_req
*);
209 * A single CQR can only contain a maximum of 255 CCWs. It is limited by
210 * the locate record and locate record extended count value which can only hold
213 #define DASD_CQR_MAX_CCW 255
216 * Unique identifier for dasd device.
218 #define UA_NOT_CONFIGURED 0x00
219 #define UA_BASE_DEVICE 0x01
220 #define UA_BASE_PAV_ALIAS 0x02
221 #define UA_HYPER_PAV_ALIAS 0x03
233 #define DASD_UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 + \
234 /* SSID */ 4 + 1 + /* unit addr */ 2 + 1 + \
240 struct dasd_pprc_header
{
241 __u8 entries
; /* 0 Number of device entries */
242 __u8 unused
; /* 1 unused */
243 __u16 entry_length
; /* 2-3 Length of device entry */
244 __u32 unused2
; /* 4-7 unused */
247 struct dasd_pprc_dev_info
{
248 __u8 state
; /* 0 Copy State */
249 __u8 flags
; /* 1 Flags */
250 __u8 reserved1
[2]; /* 2-3 reserved */
251 __u8 prim_lss
; /* 4 Primary device LSS */
252 __u8 primary
; /* 5 Primary device address */
253 __u8 sec_lss
; /* 6 Secondary device LSS */
254 __u8 secondary
; /* 7 Secondary device address */
255 __u16 pprc_id
; /* 8-9 Peer-to-Peer Remote Copy ID */
256 __u8 reserved2
[12]; /* 10-21 reserved */
257 __u16 prim_cu_ssid
; /* 22-23 Primary Control Unit SSID */
258 __u8 reserved3
[12]; /* 24-35 reserved */
259 __u16 sec_cu_ssid
; /* 36-37 Secondary Control Unit SSID */
260 __u8 reserved4
[90]; /* 38-127 reserved */
263 struct dasd_pprc_data_sc4
{
264 struct dasd_pprc_header header
;
265 struct dasd_pprc_dev_info dev_info
[5];
268 #define DASD_BUS_ID_SIZE 20
269 #define DASD_CP_ENTRIES 5
271 struct dasd_copy_entry
{
272 char busid
[DASD_BUS_ID_SIZE
];
273 struct dasd_device
*device
;
278 struct dasd_copy_relation
{
279 struct dasd_copy_entry entry
[DASD_CP_ENTRIES
];
280 struct dasd_copy_entry
*active
;
283 int dasd_devmap_set_device_copy_relation(struct ccw_device
*,
287 * the struct dasd_discipline is
288 * sth like a table of virtual functions, if you think of dasd_eckd
290 * no, currently we are not planning to reimplement the driver in C++
292 struct dasd_discipline
{
293 struct module
*owner
;
294 char ebcname
[8]; /* a name used for tagging and printks */
295 char name
[8]; /* a name used for tagging and printks */
298 struct list_head list
; /* used for list of disciplines */
301 * Device recognition functions. check_device is used to verify
302 * the sense data and the information returned by read device
303 * characteristics. It returns 0 if the discipline can be used
304 * for the device in question. uncheck_device is called during
305 * device shutdown to deregister a device from its discipline.
307 int (*check_device
) (struct dasd_device
*);
308 void (*uncheck_device
) (struct dasd_device
*);
311 * do_analysis is used in the step from device state "basic" to
312 * state "accept". It returns 0 if the device can be made ready,
313 * it returns -EMEDIUMTYPE if the device can't be made ready or
314 * -EAGAIN if do_analysis started a ccw that needs to complete
315 * before the analysis may be repeated.
317 int (*do_analysis
) (struct dasd_block
*);
320 * This function is called, when new paths become available.
321 * Disciplins may use this callback to do necessary setup work,
322 * e.g. verify that new path is compatible with the current
325 int (*pe_handler
)(struct dasd_device
*, __u8
, __u8
);
328 * Last things to do when a device is set online, and first things
329 * when it is set offline.
331 int (*basic_to_ready
) (struct dasd_device
*);
332 int (*online_to_ready
) (struct dasd_device
*);
333 int (*basic_to_known
)(struct dasd_device
*);
335 unsigned int (*max_sectors
)(struct dasd_block
*);
336 /* (struct dasd_device *);
337 * Device operation functions. build_cp creates a ccw chain for
338 * a block device request, start_io starts the request and
339 * term_IO cancels it (e.g. in case of a timeout). format_device
340 * formats the device and check_device_format compares the format of
341 * a device with the expected format_data.
342 * handle_terminated_request allows to examine a cqr and prepare
345 struct dasd_ccw_req
*(*build_cp
) (struct dasd_device
*,
348 int (*start_IO
) (struct dasd_ccw_req
*);
349 int (*term_IO
) (struct dasd_ccw_req
*);
350 void (*handle_terminated_request
) (struct dasd_ccw_req
*);
351 int (*format_device
) (struct dasd_device
*,
352 struct format_data_t
*, int);
353 int (*check_device_format
)(struct dasd_device
*,
354 struct format_check_t
*, int);
355 int (*free_cp
) (struct dasd_ccw_req
*, struct request
*);
358 * Error recovery functions. examine_error() returns a value that
359 * indicates what to do for an error condition. If examine_error()
360 * returns 'dasd_era_recover' erp_action() is called to create a
361 * special error recovery ccw. erp_postaction() is called after
362 * an error recovery ccw has finished its execution. dump_sense
363 * is called for every error condition to print the sense data
366 dasd_erp_fn_t(*erp_action
) (struct dasd_ccw_req
*);
367 dasd_erp_fn_t(*erp_postaction
) (struct dasd_ccw_req
*);
368 void (*dump_sense
) (struct dasd_device
*, struct dasd_ccw_req
*,
370 void (*dump_sense_dbf
) (struct dasd_device
*, struct irb
*, char *);
371 void (*check_for_device_change
) (struct dasd_device
*,
372 struct dasd_ccw_req
*,
375 /* i/o control functions. */
376 int (*fill_geometry
) (struct dasd_block
*, struct hd_geometry
*);
377 int (*fill_info
) (struct dasd_device
*, struct dasd_information2_t
*);
378 int (*ioctl
) (struct dasd_block
*, unsigned int, void __user
*);
380 /* reload device after state change */
381 int (*reload
) (struct dasd_device
*);
383 int (*get_uid
) (struct dasd_device
*, struct dasd_uid
*);
384 void (*kick_validate
) (struct dasd_device
*);
385 int (*check_attention
)(struct dasd_device
*, __u8
);
386 int (*host_access_count
)(struct dasd_device
*);
387 int (*hosts_print
)(struct dasd_device
*, struct seq_file
*);
388 void (*handle_hpf_error
)(struct dasd_device
*, struct irb
*);
389 void (*disable_hpf
)(struct dasd_device
*);
390 int (*hpf_enabled
)(struct dasd_device
*);
391 void (*reset_path
)(struct dasd_device
*, __u8
);
394 * Extent Space Efficient (ESE) relevant functions
396 int (*is_ese
)(struct dasd_device
*);
398 int (*space_allocated
)(struct dasd_device
*);
399 int (*space_configured
)(struct dasd_device
*);
400 int (*logical_capacity
)(struct dasd_device
*);
401 int (*release_space
)(struct dasd_device
*, struct format_data_t
*);
403 int (*ext_pool_id
)(struct dasd_device
*);
404 int (*ext_size
)(struct dasd_device
*);
405 int (*ext_pool_cap_at_warnlevel
)(struct dasd_device
*);
406 int (*ext_pool_warn_thrshld
)(struct dasd_device
*);
407 int (*ext_pool_oos
)(struct dasd_device
*);
408 int (*ext_pool_exhaust
)(struct dasd_device
*, struct dasd_ccw_req
*);
409 struct dasd_ccw_req
*(*ese_format
)(struct dasd_device
*,
410 struct dasd_ccw_req
*, struct irb
*);
411 int (*ese_read
)(struct dasd_ccw_req
*, struct irb
*);
412 int (*pprc_status
)(struct dasd_device
*, struct dasd_pprc_data_sc4
*);
413 bool (*pprc_enabled
)(struct dasd_device
*);
414 int (*copy_pair_swap
)(struct dasd_device
*, char *, char *);
415 int (*device_ping
)(struct dasd_device
*);
418 extern struct dasd_discipline
*dasd_diag_discipline_pointer
;
420 /* Trigger IDs for extended error reporting DASD EER and autoquiesce */
422 DASD_EER_FATALERROR
= 1,
424 DASD_EER_STATECHANGE
,
425 DASD_EER_PPRCSUSPEND
,
430 /* enum end marker, only add new trigger above */
432 DASD_EER_AUTOQUIESCE
= 31, /* internal only */
435 #define DASD_EER_VALID ((1U << DASD_EER_MAX) - 1)
437 /* DASD path handling */
439 #define DASD_PATH_OPERATIONAL 1
440 #define DASD_PATH_TBV 2
441 #define DASD_PATH_PP 3
442 #define DASD_PATH_NPP 4
443 #define DASD_PATH_MISCABLED 5
444 #define DASD_PATH_NOHPF 6
445 #define DASD_PATH_CUIR 7
446 #define DASD_PATH_IFCC 8
447 #define DASD_PATH_FCSEC 9
449 #define DASD_THRHLD_MAX 4294967295U
450 #define DASD_INTERVAL_MAX 4294967295U
452 /* FC Endpoint Security Capabilities */
453 #define DASD_FC_SECURITY_UNSUP 0
454 #define DASD_FC_SECURITY_AUTH 1
455 #define DASD_FC_SECURITY_ENC_FCSP2 2
456 #define DASD_FC_SECURITY_ENC_ERAS 3
458 #define DASD_FC_SECURITY_ENC_STR "Encryption"
459 static const struct {
462 } dasd_path_fcs_mnemonics
[] = {
463 { DASD_FC_SECURITY_UNSUP
, "Unsupported" },
464 { DASD_FC_SECURITY_AUTH
, "Authentication" },
465 { DASD_FC_SECURITY_ENC_FCSP2
, DASD_FC_SECURITY_ENC_STR
},
466 { DASD_FC_SECURITY_ENC_ERAS
, DASD_FC_SECURITY_ENC_STR
},
469 static inline char *dasd_path_get_fcs_str(int val
)
473 for (i
= 0; i
< ARRAY_SIZE(dasd_path_fcs_mnemonics
); i
++) {
474 if (dasd_path_fcs_mnemonics
[i
].value
== val
)
475 return dasd_path_fcs_mnemonics
[i
].name
;
478 return dasd_path_fcs_mnemonics
[0].name
;
486 struct dasd_conf_data
*conf_data
;
487 atomic_t error_count
;
488 unsigned long errorclk
;
494 #define to_dasd_path(path) container_of(path, struct dasd_path, kobj)
496 static inline void dasd_path_release(struct kobject
*kobj
)
498 /* Memory for the dasd_path kobject is freed when dasd_free_device() is called */
502 struct dasd_profile_info
{
503 /* legacy part of profile data, as in dasd_profile_info_t */
504 unsigned int dasd_io_reqs
; /* number of requests processed */
505 unsigned int dasd_io_sects
; /* number of sectors processed */
506 unsigned int dasd_io_secs
[32]; /* histogram of request's sizes */
507 unsigned int dasd_io_times
[32]; /* histogram of requests's times */
508 unsigned int dasd_io_timps
[32]; /* h. of requests's times per sector */
509 unsigned int dasd_io_time1
[32]; /* hist. of time from build to start */
510 unsigned int dasd_io_time2
[32]; /* hist. of time from start to irq */
511 unsigned int dasd_io_time2ps
[32]; /* hist. of time from start to irq */
512 unsigned int dasd_io_time3
[32]; /* hist. of time from irq to end */
513 unsigned int dasd_io_nr_req
[32]; /* hist. of # of requests in chanq */
516 struct timespec64 starttod
; /* time of start or last reset */
517 unsigned int dasd_io_alias
; /* requests using an alias */
518 unsigned int dasd_io_tpm
; /* requests using transport mode */
519 unsigned int dasd_read_reqs
; /* total number of read requests */
520 unsigned int dasd_read_sects
; /* total number read sectors */
521 unsigned int dasd_read_alias
; /* read request using an alias */
522 unsigned int dasd_read_tpm
; /* read requests in transport mode */
523 unsigned int dasd_read_secs
[32]; /* histogram of request's sizes */
524 unsigned int dasd_read_times
[32]; /* histogram of requests's times */
525 unsigned int dasd_read_time1
[32]; /* hist. time from build to start */
526 unsigned int dasd_read_time2
[32]; /* hist. of time from start to irq */
527 unsigned int dasd_read_time3
[32]; /* hist. of time from irq to end */
528 unsigned int dasd_read_nr_req
[32]; /* hist. of # of requests in chanq */
529 unsigned long dasd_sum_times
; /* sum of request times */
530 unsigned long dasd_sum_time_str
; /* sum of time from build to start */
531 unsigned long dasd_sum_time_irq
; /* sum of time from start to irq */
532 unsigned long dasd_sum_time_end
; /* sum of time from irq to end */
535 struct dasd_profile
{
536 struct dentry
*dentry
;
537 struct dasd_profile_info
*data
;
541 struct dasd_format_entry
{
542 struct list_head list
;
547 /* Block device stuff. */
548 struct dasd_block
*block
;
550 unsigned int devindex
;
551 unsigned long flags
; /* per device flags */
552 unsigned short features
; /* copy of devmap-features (read-only!) */
554 /* extended error reporting stuff (eer) */
555 struct dasd_ccw_req
*eer_cqr
;
557 /* Device discipline stuff. */
558 struct dasd_discipline
*discipline
;
559 struct dasd_discipline
*base_discipline
;
561 struct dasd_path path
[8];
564 /* Device state and target state. */
566 struct mutex state_mutex
;
567 int stopped
; /* device (ccw_device_start) was stopped */
569 /* reference count. */
572 /* ccw queue and memory for static ccw/erp buffers. */
573 struct list_head ccw_queue
;
578 struct list_head ccw_chunks
;
579 struct list_head erp_chunks
;
580 struct list_head ese_chunks
;
582 atomic_t tasklet_scheduled
;
583 struct tasklet_struct tasklet
;
584 struct work_struct kick_work
;
585 struct work_struct reload_device
;
586 struct work_struct kick_validate
;
587 struct work_struct suc_work
;
588 struct work_struct requeue_requests
;
589 struct timer_list timer
;
591 debug_info_t
*debug_area
;
593 struct ccw_device
*cdev
;
595 /* hook for alias management */
596 struct list_head alias_list
;
598 /* default expiration time in s */
599 unsigned long default_expires
;
600 unsigned long default_retries
;
602 unsigned long blk_timeout
;
604 unsigned long path_thrhld
;
605 unsigned long path_interval
;
607 struct dentry
*debugfs_dentry
;
608 struct dentry
*hosts_dentry
;
609 struct dasd_profile profile
;
610 struct dasd_format_entry format_entry
;
611 struct kset
*paths_info
;
612 struct dasd_copy_relation
*copy
;
613 unsigned long aq_mask
;
614 unsigned int aq_timeouts
;
618 /* Block device stuff. */
620 spinlock_t request_queue_lock
;
621 struct blk_mq_tag_set tag_set
;
622 struct file
*bdev_file
;
625 unsigned long blocks
; /* size of volume in blocks */
626 unsigned int bp_block
; /* bytes per block */
627 unsigned int s2b_shift
; /* log2 (bp_block/512) */
629 struct dasd_device
*base
;
630 struct list_head ccw_queue
;
631 spinlock_t queue_lock
;
633 atomic_t tasklet_scheduled
;
634 struct tasklet_struct tasklet
;
635 struct timer_list timer
;
637 struct dentry
*debugfs_dentry
;
638 struct dasd_profile profile
;
640 struct list_head format_list
;
641 spinlock_t format_lock
;
645 struct dasd_attention_data
{
646 struct dasd_device
*device
;
654 /* reasons why device (ccw_device_start) was stopped */
655 #define DASD_STOPPED_NOT_ACC 1 /* not accessible */
656 #define DASD_STOPPED_QUIESCE 2 /* Quiesced */
657 #define DASD_STOPPED_PENDING 4 /* long busy */
658 #define DASD_STOPPED_DC_WAIT 8 /* disconnected, wait */
659 #define DASD_STOPPED_SU 16 /* summary unit check handling */
660 #define DASD_STOPPED_PPRC 32 /* PPRC swap */
661 #define DASD_STOPPED_NOSPC 128 /* no space left */
663 /* per device flags */
664 #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */
665 #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */
666 #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */
667 #define DASD_FLAG_DEVICE_RO 6 /* The device itself is read-only. Don't
668 * confuse this with the user specified
671 #define DASD_FLAG_IS_RESERVED 7 /* The device is reserved */
672 #define DASD_FLAG_LOCK_STOLEN 8 /* The device lock was stolen */
673 #define DASD_FLAG_SUSPENDED 9 /* The device was suspended */
674 #define DASD_FLAG_SAFE_OFFLINE 10 /* safe offline processing requested*/
675 #define DASD_FLAG_SAFE_OFFLINE_RUNNING 11 /* safe offline running */
676 #define DASD_FLAG_ABORTALL 12 /* Abort all noretry requests */
677 #define DASD_FLAG_PATH_VERIFY 13 /* Path verification worker running */
678 #define DASD_FLAG_SUC 14 /* unhandled summary unit check */
680 #define DASD_SLEEPON_START_TAG ((void *) 1)
681 #define DASD_SLEEPON_END_TAG ((void *) 2)
683 void dasd_put_device_wake(struct dasd_device
*);
686 * return values to be returned from the copy pair swap function
687 * 0x00: swap successful
688 * 0x01: swap data invalid
689 * 0x02: no active device found
690 * 0x03: wrong primary specified
691 * 0x04: secondary device not found
692 * 0x05: swap already running
694 #define DASD_COPYPAIRSWAP_SUCCESS 0
695 #define DASD_COPYPAIRSWAP_INVALID 1
696 #define DASD_COPYPAIRSWAP_NOACTIVE 2
697 #define DASD_COPYPAIRSWAP_PRIMARY 3
698 #define DASD_COPYPAIRSWAP_SECONDARY 4
699 #define DASD_COPYPAIRSWAP_MULTIPLE 5
702 * Reference count inliners
705 dasd_get_device(struct dasd_device
*device
)
707 atomic_inc(&device
->ref_count
);
711 dasd_put_device(struct dasd_device
*device
)
713 if (atomic_dec_return(&device
->ref_count
) == 0)
714 dasd_put_device_wake(device
);
718 * The static memory in ccw_mem and erp_mem is managed by a sorted
719 * list of free memory chunks.
723 struct list_head list
;
725 } __attribute__ ((aligned(8)));
728 dasd_init_chunklist(struct list_head
*chunk_list
, void *mem
,
731 struct dasd_mchunk
*chunk
;
733 INIT_LIST_HEAD(chunk_list
);
734 chunk
= (struct dasd_mchunk
*) mem
;
735 chunk
->size
= size
- sizeof(struct dasd_mchunk
);
736 list_add(&chunk
->list
, chunk_list
);
740 dasd_alloc_chunk(struct list_head
*chunk_list
, unsigned long size
)
742 struct dasd_mchunk
*chunk
, *tmp
;
744 size
= (size
+ 7L) & -8L;
745 list_for_each_entry(chunk
, chunk_list
, list
) {
746 if (chunk
->size
< size
)
748 if (chunk
->size
> size
+ sizeof(struct dasd_mchunk
)) {
749 char *endaddr
= (char *) (chunk
+ 1) + chunk
->size
;
750 tmp
= (struct dasd_mchunk
*) (endaddr
- size
) - 1;
752 chunk
->size
-= size
+ sizeof(struct dasd_mchunk
);
755 list_del(&chunk
->list
);
756 return (void *) (chunk
+ 1);
762 dasd_free_chunk(struct list_head
*chunk_list
, void *mem
)
764 struct dasd_mchunk
*chunk
, *tmp
;
765 struct list_head
*p
, *left
;
767 chunk
= (struct dasd_mchunk
*)
768 ((char *) mem
- sizeof(struct dasd_mchunk
));
769 /* Find out the left neighbour in chunk_list. */
771 list_for_each(p
, chunk_list
) {
772 if (list_entry(p
, struct dasd_mchunk
, list
) > chunk
)
776 /* Try to merge with right neighbour = next element from left. */
777 if (left
->next
!= chunk_list
) {
778 tmp
= list_entry(left
->next
, struct dasd_mchunk
, list
);
779 if ((char *) (chunk
+ 1) + chunk
->size
== (char *) tmp
) {
780 list_del(&tmp
->list
);
781 chunk
->size
+= tmp
->size
+ sizeof(struct dasd_mchunk
);
784 /* Try to merge with left neighbour. */
785 if (left
!= chunk_list
) {
786 tmp
= list_entry(left
, struct dasd_mchunk
, list
);
787 if ((char *) (tmp
+ 1) + tmp
->size
== (char *) chunk
) {
788 tmp
->size
+= chunk
->size
+ sizeof(struct dasd_mchunk
);
792 __list_add(&chunk
->list
, left
, left
->next
);
796 * Check if bsize is in { 512, 1024, 2048, 4096 }
799 dasd_check_blocksize(int bsize
)
801 if (bsize
< 512 || bsize
> 4096 || !is_power_of_2(bsize
))
807 * return the callback data of the original request in case there are
808 * ERP requests build on top of it
810 static inline void *dasd_get_callback_data(struct dasd_ccw_req
*cqr
)
815 return cqr
->callback_data
;
818 /* externals in dasd.c */
819 #define DASD_PROFILE_OFF 0
820 #define DASD_PROFILE_ON 1
821 #define DASD_PROFILE_GLOBAL_ONLY 2
823 extern debug_info_t
*dasd_debug_area
;
824 extern struct dasd_profile dasd_global_profile
;
825 extern unsigned int dasd_global_profile_level
;
826 extern const struct block_device_operations dasd_device_operations
;
827 extern struct blk_mq_ops dasd_mq_ops
;
829 extern struct kmem_cache
*dasd_page_cache
;
831 struct dasd_ccw_req
*
832 dasd_smalloc_request(int, int, int, struct dasd_device
*, struct dasd_ccw_req
*);
833 struct dasd_ccw_req
*dasd_fmalloc_request(int, int, int, struct dasd_device
*);
834 void dasd_sfree_request(struct dasd_ccw_req
*, struct dasd_device
*);
835 void dasd_ffree_request(struct dasd_ccw_req
*, struct dasd_device
*);
836 void dasd_wakeup_cb(struct dasd_ccw_req
*, void *);
838 struct dasd_device
*dasd_alloc_device(void);
839 void dasd_free_device(struct dasd_device
*);
841 struct dasd_block
*dasd_alloc_block(void);
842 void dasd_free_block(struct dasd_block
*);
844 enum blk_eh_timer_return
dasd_times_out(struct request
*req
);
846 void dasd_enable_device(struct dasd_device
*);
847 void dasd_set_target_state(struct dasd_device
*, int);
848 void dasd_kick_device(struct dasd_device
*);
849 void dasd_reload_device(struct dasd_device
*);
850 void dasd_schedule_requeue(struct dasd_device
*);
852 void dasd_add_request_head(struct dasd_ccw_req
*);
853 void dasd_add_request_tail(struct dasd_ccw_req
*);
854 int dasd_start_IO(struct dasd_ccw_req
*);
855 int dasd_term_IO(struct dasd_ccw_req
*);
856 void dasd_schedule_device_bh(struct dasd_device
*);
857 void dasd_schedule_block_bh(struct dasd_block
*);
858 int dasd_sleep_on(struct dasd_ccw_req
*);
859 int dasd_sleep_on_queue(struct list_head
*);
860 int dasd_sleep_on_immediatly(struct dasd_ccw_req
*);
861 int dasd_sleep_on_queue_interruptible(struct list_head
*);
862 int dasd_sleep_on_interruptible(struct dasd_ccw_req
*);
863 void dasd_device_set_timer(struct dasd_device
*, int);
864 void dasd_device_clear_timer(struct dasd_device
*);
865 void dasd_block_set_timer(struct dasd_block
*, int);
866 void dasd_block_clear_timer(struct dasd_block
*);
867 int dasd_cancel_req(struct dasd_ccw_req
*);
868 int dasd_flush_device_queue(struct dasd_device
*);
869 int dasd_generic_probe(struct ccw_device
*);
870 void dasd_generic_free_discipline(struct dasd_device
*);
871 void dasd_generic_remove (struct ccw_device
*cdev
);
872 int dasd_generic_set_online(struct ccw_device
*, struct dasd_discipline
*);
873 int dasd_generic_set_offline (struct ccw_device
*cdev
);
874 int dasd_generic_notify(struct ccw_device
*, int);
875 int dasd_generic_last_path_gone(struct dasd_device
*);
876 int dasd_generic_path_operational(struct dasd_device
*);
877 void dasd_generic_shutdown(struct ccw_device
*);
879 void dasd_generic_handle_state_change(struct dasd_device
*);
880 enum uc_todo
dasd_generic_uc_handler(struct ccw_device
*, struct irb
*);
881 void dasd_generic_path_event(struct ccw_device
*, int *);
882 int dasd_generic_verify_path(struct dasd_device
*, __u8
);
883 void dasd_generic_space_exhaust(struct dasd_device
*, struct dasd_ccw_req
*);
884 void dasd_generic_space_avail(struct dasd_device
*);
886 int dasd_generic_requeue_all_requests(struct dasd_device
*);
888 int dasd_generic_read_dev_chars(struct dasd_device
*, int, void *, int);
889 char *dasd_get_sense(struct irb
*);
891 void dasd_device_set_stop_bits(struct dasd_device
*, int);
892 void dasd_device_remove_stop_bits(struct dasd_device
*, int);
894 int dasd_device_is_ro(struct dasd_device
*);
896 void dasd_profile_reset(struct dasd_profile
*);
897 int dasd_profile_on(struct dasd_profile
*);
898 void dasd_profile_off(struct dasd_profile
*);
899 char *dasd_get_user_string(const char __user
*, size_t);
901 /* externals in dasd_devmap.c */
902 extern int dasd_max_devindex
;
903 extern int dasd_probeonly
;
904 extern int dasd_autodetect
;
905 extern int dasd_nopav
;
906 extern int dasd_nofcx
;
908 int dasd_devmap_init(void);
909 void dasd_devmap_exit(void);
911 struct dasd_device
*dasd_create_device(struct ccw_device
*);
912 void dasd_delete_device(struct dasd_device
*);
914 int dasd_get_feature(struct ccw_device
*, int);
915 int dasd_set_feature(struct ccw_device
*, int, int);
917 extern const struct attribute_group
*dasd_dev_groups
[];
918 void dasd_path_create_kobj(struct dasd_device
*, int);
919 void dasd_path_create_kobjects(struct dasd_device
*);
920 void dasd_path_remove_kobjects(struct dasd_device
*);
922 struct dasd_device
*dasd_device_from_cdev(struct ccw_device
*);
923 struct dasd_device
*dasd_device_from_cdev_locked(struct ccw_device
*);
924 struct dasd_device
*dasd_device_from_devindex(int);
926 void dasd_add_link_to_gendisk(struct gendisk
*, struct dasd_device
*);
927 struct dasd_device
*dasd_device_from_gendisk(struct gendisk
*);
929 int dasd_parse(void) __init
;
930 int dasd_busid_known(const char *);
932 /* externals in dasd_gendisk.c */
933 int dasd_gendisk_init(void);
934 void dasd_gendisk_exit(void);
935 int dasd_gendisk_alloc(struct dasd_block
*);
936 void dasd_gendisk_free(struct dasd_block
*);
937 int dasd_scan_partitions(struct dasd_block
*);
938 void dasd_destroy_partitions(struct dasd_block
*);
940 /* externals in dasd_ioctl.c */
941 int dasd_ioctl(struct block_device
*bdev
, blk_mode_t mode
, unsigned int cmd
,
943 int dasd_set_read_only(struct block_device
*bdev
, bool ro
);
945 /* externals in dasd_proc.c */
946 int dasd_proc_init(void);
947 void dasd_proc_exit(void);
949 /* externals in dasd_erp.c */
950 struct dasd_ccw_req
*dasd_default_erp_action(struct dasd_ccw_req
*);
951 struct dasd_ccw_req
*dasd_default_erp_postaction(struct dasd_ccw_req
*);
952 struct dasd_ccw_req
*dasd_alloc_erp_request(unsigned int, int, int,
953 struct dasd_device
*);
954 void dasd_free_erp_request(struct dasd_ccw_req
*, struct dasd_device
*);
955 void dasd_log_sense(struct dasd_ccw_req
*, struct irb
*);
956 void dasd_log_sense_dbf(struct dasd_ccw_req
*cqr
, struct irb
*irb
);
958 /* externals in dasd_3990_erp.c */
959 struct dasd_ccw_req
*dasd_3990_erp_action(struct dasd_ccw_req
*);
960 void dasd_3990_erp_handle_sim(struct dasd_device
*, char *);
962 /* externals in dasd_eer.c */
963 #ifdef CONFIG_DASD_EER
964 int dasd_eer_init(void);
965 void dasd_eer_exit(void);
966 int dasd_eer_enable(struct dasd_device
*);
967 void dasd_eer_disable(struct dasd_device
*);
968 void dasd_eer_write(struct dasd_device
*, struct dasd_ccw_req
*cqr
,
970 void dasd_eer_snss(struct dasd_device
*);
972 static inline int dasd_eer_enabled(struct dasd_device
*device
)
974 return device
->eer_cqr
!= NULL
;
977 #define dasd_eer_init() (0)
978 #define dasd_eer_exit() do { } while (0)
979 #define dasd_eer_enable(d) (0)
980 #define dasd_eer_disable(d) do { } while (0)
981 #define dasd_eer_write(d,c,i) do { } while (0)
982 #define dasd_eer_snss(d) do { } while (0)
983 #define dasd_eer_enabled(d) (0)
984 #endif /* CONFIG_DASD_ERR */
987 /* DASD path handling functions */
990 * helper functions to modify bit masks for a given channel path for a device
992 static inline int dasd_path_is_operational(struct dasd_device
*device
, int chp
)
994 return test_bit(DASD_PATH_OPERATIONAL
, &device
->path
[chp
].flags
);
997 static inline int dasd_path_need_verify(struct dasd_device
*device
, int chp
)
999 return test_bit(DASD_PATH_TBV
, &device
->path
[chp
].flags
);
1002 static inline void dasd_path_verify(struct dasd_device
*device
, int chp
)
1004 __set_bit(DASD_PATH_TBV
, &device
->path
[chp
].flags
);
1007 static inline void dasd_path_clear_verify(struct dasd_device
*device
, int chp
)
1009 __clear_bit(DASD_PATH_TBV
, &device
->path
[chp
].flags
);
1012 static inline void dasd_path_clear_all_verify(struct dasd_device
*device
)
1016 for (chp
= 0; chp
< 8; chp
++)
1017 dasd_path_clear_verify(device
, chp
);
1020 static inline void dasd_path_fcsec(struct dasd_device
*device
, int chp
)
1022 __set_bit(DASD_PATH_FCSEC
, &device
->path
[chp
].flags
);
1025 static inline void dasd_path_clear_fcsec(struct dasd_device
*device
, int chp
)
1027 __clear_bit(DASD_PATH_FCSEC
, &device
->path
[chp
].flags
);
1030 static inline int dasd_path_need_fcsec(struct dasd_device
*device
, int chp
)
1032 return test_bit(DASD_PATH_FCSEC
, &device
->path
[chp
].flags
);
1035 static inline void dasd_path_clear_all_fcsec(struct dasd_device
*device
)
1039 for (chp
= 0; chp
< 8; chp
++)
1040 dasd_path_clear_fcsec(device
, chp
);
1043 static inline void dasd_path_operational(struct dasd_device
*device
, int chp
)
1045 __set_bit(DASD_PATH_OPERATIONAL
, &device
->path
[chp
].flags
);
1046 device
->opm
|= (0x80 >> chp
);
1049 static inline void dasd_path_nonpreferred(struct dasd_device
*device
, int chp
)
1051 __set_bit(DASD_PATH_NPP
, &device
->path
[chp
].flags
);
1054 static inline int dasd_path_is_nonpreferred(struct dasd_device
*device
, int chp
)
1056 return test_bit(DASD_PATH_NPP
, &device
->path
[chp
].flags
);
1059 static inline void dasd_path_clear_nonpreferred(struct dasd_device
*device
,
1062 __clear_bit(DASD_PATH_NPP
, &device
->path
[chp
].flags
);
1065 static inline void dasd_path_preferred(struct dasd_device
*device
, int chp
)
1067 __set_bit(DASD_PATH_PP
, &device
->path
[chp
].flags
);
1070 static inline int dasd_path_is_preferred(struct dasd_device
*device
, int chp
)
1072 return test_bit(DASD_PATH_PP
, &device
->path
[chp
].flags
);
1075 static inline void dasd_path_clear_preferred(struct dasd_device
*device
,
1078 __clear_bit(DASD_PATH_PP
, &device
->path
[chp
].flags
);
1081 static inline void dasd_path_clear_oper(struct dasd_device
*device
, int chp
)
1083 __clear_bit(DASD_PATH_OPERATIONAL
, &device
->path
[chp
].flags
);
1084 device
->opm
&= ~(0x80 >> chp
);
1087 static inline void dasd_path_clear_cable(struct dasd_device
*device
, int chp
)
1089 __clear_bit(DASD_PATH_MISCABLED
, &device
->path
[chp
].flags
);
1092 static inline void dasd_path_cuir(struct dasd_device
*device
, int chp
)
1094 __set_bit(DASD_PATH_CUIR
, &device
->path
[chp
].flags
);
1097 static inline int dasd_path_is_cuir(struct dasd_device
*device
, int chp
)
1099 return test_bit(DASD_PATH_CUIR
, &device
->path
[chp
].flags
);
1102 static inline void dasd_path_clear_cuir(struct dasd_device
*device
, int chp
)
1104 __clear_bit(DASD_PATH_CUIR
, &device
->path
[chp
].flags
);
1107 static inline void dasd_path_ifcc(struct dasd_device
*device
, int chp
)
1109 set_bit(DASD_PATH_IFCC
, &device
->path
[chp
].flags
);
1112 static inline int dasd_path_is_ifcc(struct dasd_device
*device
, int chp
)
1114 return test_bit(DASD_PATH_IFCC
, &device
->path
[chp
].flags
);
1117 static inline void dasd_path_clear_ifcc(struct dasd_device
*device
, int chp
)
1119 clear_bit(DASD_PATH_IFCC
, &device
->path
[chp
].flags
);
1122 static inline void dasd_path_clear_nohpf(struct dasd_device
*device
, int chp
)
1124 __clear_bit(DASD_PATH_NOHPF
, &device
->path
[chp
].flags
);
1127 static inline void dasd_path_miscabled(struct dasd_device
*device
, int chp
)
1129 __set_bit(DASD_PATH_MISCABLED
, &device
->path
[chp
].flags
);
1132 static inline int dasd_path_is_miscabled(struct dasd_device
*device
, int chp
)
1134 return test_bit(DASD_PATH_MISCABLED
, &device
->path
[chp
].flags
);
1137 static inline void dasd_path_nohpf(struct dasd_device
*device
, int chp
)
1139 __set_bit(DASD_PATH_NOHPF
, &device
->path
[chp
].flags
);
1142 static inline int dasd_path_is_nohpf(struct dasd_device
*device
, int chp
)
1144 return test_bit(DASD_PATH_NOHPF
, &device
->path
[chp
].flags
);
1148 * get functions for path masks
1149 * will return a path masks for the given device
1152 static inline __u8
dasd_path_get_opm(struct dasd_device
*device
)
1157 static inline __u8
dasd_path_get_tbvpm(struct dasd_device
*device
)
1162 for (chp
= 0; chp
< 8; chp
++)
1163 if (dasd_path_need_verify(device
, chp
))
1164 tbvpm
|= 0x80 >> chp
;
1168 static inline int dasd_path_get_fcsecpm(struct dasd_device
*device
)
1172 for (chp
= 0; chp
< 8; chp
++)
1173 if (dasd_path_need_fcsec(device
, chp
))
1179 static inline __u8
dasd_path_get_nppm(struct dasd_device
*device
)
1184 for (chp
= 0; chp
< 8; chp
++) {
1185 if (dasd_path_is_nonpreferred(device
, chp
))
1191 static inline __u8
dasd_path_get_ppm(struct dasd_device
*device
)
1196 for (chp
= 0; chp
< 8; chp
++)
1197 if (dasd_path_is_preferred(device
, chp
))
1202 static inline __u8
dasd_path_get_cablepm(struct dasd_device
*device
)
1205 __u8 cablepm
= 0x00;
1207 for (chp
= 0; chp
< 8; chp
++)
1208 if (dasd_path_is_miscabled(device
, chp
))
1209 cablepm
|= 0x80 >> chp
;
1213 static inline __u8
dasd_path_get_cuirpm(struct dasd_device
*device
)
1218 for (chp
= 0; chp
< 8; chp
++)
1219 if (dasd_path_is_cuir(device
, chp
))
1220 cuirpm
|= 0x80 >> chp
;
1224 static inline __u8
dasd_path_get_ifccpm(struct dasd_device
*device
)
1229 for (chp
= 0; chp
< 8; chp
++)
1230 if (dasd_path_is_ifcc(device
, chp
))
1231 ifccpm
|= 0x80 >> chp
;
1235 static inline __u8
dasd_path_get_hpfpm(struct dasd_device
*device
)
1240 for (chp
= 0; chp
< 8; chp
++)
1241 if (dasd_path_is_nohpf(device
, chp
))
1242 hpfpm
|= 0x80 >> chp
;
1246 static inline u8
dasd_path_get_fcs_path(struct dasd_device
*device
, int chp
)
1248 return device
->path
[chp
].fc_security
;
1251 static inline int dasd_path_get_fcs_device(struct dasd_device
*device
)
1256 for (chp
= 0; chp
< 8; chp
++) {
1257 if (device
->opm
& (0x80 >> chp
)) {
1258 fc_sec
= device
->path
[chp
].fc_security
;
1262 for (; chp
< 8; chp
++) {
1263 if (device
->opm
& (0x80 >> chp
))
1264 if (device
->path
[chp
].fc_security
!= fc_sec
)
1272 * add functions for path masks
1273 * the existing path mask will be extended by the given path mask
1275 static inline void dasd_path_add_tbvpm(struct dasd_device
*device
, __u8 pm
)
1279 for (chp
= 0; chp
< 8; chp
++)
1280 if (pm
& (0x80 >> chp
))
1281 dasd_path_verify(device
, chp
);
1284 static inline __u8
dasd_path_get_notoperpm(struct dasd_device
*device
)
1289 for (chp
= 0; chp
< 8; chp
++)
1290 if (dasd_path_is_nohpf(device
, chp
) ||
1291 dasd_path_is_ifcc(device
, chp
) ||
1292 dasd_path_is_cuir(device
, chp
) ||
1293 dasd_path_is_miscabled(device
, chp
))
1294 nopm
|= 0x80 >> chp
;
1298 static inline void dasd_path_add_opm(struct dasd_device
*device
, __u8 pm
)
1302 for (chp
= 0; chp
< 8; chp
++)
1303 if (pm
& (0x80 >> chp
)) {
1304 dasd_path_operational(device
, chp
);
1306 * if the path is used
1307 * it should not be in one of the negative lists
1309 dasd_path_clear_nohpf(device
, chp
);
1310 dasd_path_clear_cuir(device
, chp
);
1311 dasd_path_clear_cable(device
, chp
);
1312 dasd_path_clear_ifcc(device
, chp
);
1316 static inline void dasd_path_add_cablepm(struct dasd_device
*device
, __u8 pm
)
1320 for (chp
= 0; chp
< 8; chp
++)
1321 if (pm
& (0x80 >> chp
))
1322 dasd_path_miscabled(device
, chp
);
1325 static inline void dasd_path_add_cuirpm(struct dasd_device
*device
, __u8 pm
)
1329 for (chp
= 0; chp
< 8; chp
++)
1330 if (pm
& (0x80 >> chp
))
1331 dasd_path_cuir(device
, chp
);
1334 static inline void dasd_path_add_ifccpm(struct dasd_device
*device
, __u8 pm
)
1338 for (chp
= 0; chp
< 8; chp
++)
1339 if (pm
& (0x80 >> chp
))
1340 dasd_path_ifcc(device
, chp
);
1343 static inline void dasd_path_add_nppm(struct dasd_device
*device
, __u8 pm
)
1347 for (chp
= 0; chp
< 8; chp
++)
1348 if (pm
& (0x80 >> chp
))
1349 dasd_path_nonpreferred(device
, chp
);
1352 static inline void dasd_path_add_nohpfpm(struct dasd_device
*device
, __u8 pm
)
1356 for (chp
= 0; chp
< 8; chp
++)
1357 if (pm
& (0x80 >> chp
))
1358 dasd_path_nohpf(device
, chp
);
1361 static inline void dasd_path_add_ppm(struct dasd_device
*device
, __u8 pm
)
1365 for (chp
= 0; chp
< 8; chp
++)
1366 if (pm
& (0x80 >> chp
))
1367 dasd_path_preferred(device
, chp
);
1370 static inline void dasd_path_add_fcsecpm(struct dasd_device
*device
, __u8 pm
)
1374 for (chp
= 0; chp
< 8; chp
++)
1375 if (pm
& (0x80 >> chp
))
1376 dasd_path_fcsec(device
, chp
);
1380 * set functions for path masks
1381 * the existing path mask will be replaced by the given path mask
1383 static inline void dasd_path_set_tbvpm(struct dasd_device
*device
, __u8 pm
)
1387 for (chp
= 0; chp
< 8; chp
++)
1388 if (pm
& (0x80 >> chp
))
1389 dasd_path_verify(device
, chp
);
1391 dasd_path_clear_verify(device
, chp
);
1394 static inline void dasd_path_set_opm(struct dasd_device
*device
, __u8 pm
)
1398 for (chp
= 0; chp
< 8; chp
++) {
1399 dasd_path_clear_oper(device
, chp
);
1400 if (pm
& (0x80 >> chp
)) {
1401 dasd_path_operational(device
, chp
);
1403 * if the path is used
1404 * it should not be in one of the negative lists
1406 dasd_path_clear_nohpf(device
, chp
);
1407 dasd_path_clear_cuir(device
, chp
);
1408 dasd_path_clear_cable(device
, chp
);
1409 dasd_path_clear_ifcc(device
, chp
);
1415 * remove functions for path masks
1416 * the existing path mask will be cleared with the given path mask
1418 static inline void dasd_path_remove_opm(struct dasd_device
*device
, __u8 pm
)
1422 for (chp
= 0; chp
< 8; chp
++) {
1423 if (pm
& (0x80 >> chp
))
1424 dasd_path_clear_oper(device
, chp
);
1429 * add the newly available path to the to be verified pm and remove it from
1430 * normal operation until it is verified
1432 static inline void dasd_path_available(struct dasd_device
*device
, int chp
)
1434 dasd_path_clear_oper(device
, chp
);
1435 dasd_path_verify(device
, chp
);
1438 static inline void dasd_path_notoper(struct dasd_device
*device
, int chp
)
1440 dasd_path_clear_oper(device
, chp
);
1441 dasd_path_clear_preferred(device
, chp
);
1442 dasd_path_clear_nonpreferred(device
, chp
);
1445 static inline void dasd_path_fcsec_update(struct dasd_device
*device
, int chp
)
1447 dasd_path_fcsec(device
, chp
);
1451 * remove all paths from normal operation
1453 static inline void dasd_path_no_path(struct dasd_device
*device
)
1457 for (chp
= 0; chp
< 8; chp
++)
1458 dasd_path_notoper(device
, chp
);
1460 dasd_path_clear_all_verify(device
);
1463 /* end - path handling */