1 /* 2 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> 3 * Horst Hummel <Horst.Hummel@de.ibm.com> 4 * Martin Schwidefsky <schwidefsky@de.ibm.com> 5 * Bugreports.to..: <Linux390@de.ibm.com> 6 * Copyright IBM Corp. 1999, 2009 7 */ 8 9 #ifndef DASD_INT_H 10 #define DASD_INT_H 11 12 /* we keep old device allocation scheme; IOW, minors are still in 0..255 */ 13 #define DASD_PER_MAJOR (1U << (MINORBITS - DASD_PARTN_BITS)) 14 #define DASD_PARTN_MASK ((1 << DASD_PARTN_BITS) - 1) 15 16 /* 17 * States a dasd device can have: 18 * new: the dasd_device structure is allocated. 19 * known: the discipline for the device is identified. 20 * basic: the device can do basic i/o. 21 * unfmt: the device could not be analyzed (format is unknown). 22 * ready: partition detection is done and the device is can do block io. 23 * online: the device accepts requests from the block device queue. 24 * 25 * Things to do for startup state transitions: 26 * new -> known: find discipline for the device and create devfs entries. 27 * known -> basic: request irq line for the device. 28 * basic -> ready: do the initial analysis, e.g. format detection, 29 * do block device setup and detect partitions. 30 * ready -> online: schedule the device tasklet. 31 * Things to do for shutdown state transitions: 32 * online -> ready: just set the new device state. 33 * ready -> basic: flush requests from the block device layer, clear 34 * partition information and reset format information. 35 * basic -> known: terminate all requests and free irq. 36 * known -> new: remove devfs entries and forget discipline. 37 */ 38 39 #define DASD_STATE_NEW 0 40 #define DASD_STATE_KNOWN 1 41 #define DASD_STATE_BASIC 2 42 #define DASD_STATE_UNFMT 3 43 #define DASD_STATE_READY 4 44 #define DASD_STATE_ONLINE 5 45 46 #include <linux/module.h> 47 #include <linux/wait.h> 48 #include <linux/blkdev.h> 49 #include <linux/genhd.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> 56 #include <asm/dasd.h> 57 #include <asm/idals.h> 58 #include <linux/bitops.h> 59 60 /* DASD discipline magic */ 61 #define DASD_ECKD_MAGIC 0xC5C3D2C4 62 #define DASD_DIAG_MAGIC 0xC4C9C1C7 63 #define DASD_FBA_MAGIC 0xC6C2C140 64 65 /* 66 * SECTION: Type definitions 67 */ 68 struct dasd_device; 69 struct dasd_block; 70 71 /* BIT DEFINITIONS FOR SENSE DATA */ 72 #define DASD_SENSE_BIT_0 0x80 73 #define DASD_SENSE_BIT_1 0x40 74 #define DASD_SENSE_BIT_2 0x20 75 #define DASD_SENSE_BIT_3 0x10 76 77 /* BIT DEFINITIONS FOR SIM SENSE */ 78 #define DASD_SIM_SENSE 0x0F 79 #define DASD_SIM_MSG_TO_OP 0x03 80 #define DASD_SIM_LOG 0x0C 81 82 /* lock class for nested cdev lock */ 83 #define CDEV_NESTED_FIRST 1 84 #define CDEV_NESTED_SECOND 2 85 86 /* 87 * SECTION: MACROs for klogd and s390 debug feature (dbf) 88 */ 89 #define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \ 90 do { \ 91 debug_sprintf_event(d_device->debug_area, \ 92 d_level, \ 93 d_str "\n", \ 94 d_data); \ 95 } while(0) 96 97 #define DBF_DEV_EXC(d_level, d_device, d_str, d_data...) \ 98 do { \ 99 debug_sprintf_exception(d_device->debug_area, \ 100 d_level, \ 101 d_str "\n", \ 102 d_data); \ 103 } while(0) 104 105 #define DBF_EVENT(d_level, d_str, d_data...)\ 106 do { \ 107 debug_sprintf_event(dasd_debug_area, \ 108 d_level,\ 109 d_str "\n", \ 110 d_data); \ 111 } while(0) 112 113 #define DBF_EVENT_DEVID(d_level, d_cdev, d_str, d_data...) \ 114 do { \ 115 struct ccw_dev_id __dev_id; \ 116 ccw_device_get_id(d_cdev, &__dev_id); \ 117 debug_sprintf_event(dasd_debug_area, \ 118 d_level, \ 119 "0.%x.%04x " d_str "\n", \ 120 __dev_id.ssid, __dev_id.devno, d_data); \ 121 } while (0) 122 123 #define DBF_EXC(d_level, d_str, d_data...)\ 124 do { \ 125 debug_sprintf_exception(dasd_debug_area, \ 126 d_level,\ 127 d_str "\n", \ 128 d_data); \ 129 } while(0) 130 131 /* limit size for an errorstring */ 132 #define ERRORLENGTH 30 133 134 /* definition of dbf debug levels */ 135 #define DBF_EMERG 0 /* system is unusable */ 136 #define DBF_ALERT 1 /* action must be taken immediately */ 137 #define DBF_CRIT 2 /* critical conditions */ 138 #define DBF_ERR 3 /* error conditions */ 139 #define DBF_WARNING 4 /* warning conditions */ 140 #define DBF_NOTICE 5 /* normal but significant condition */ 141 #define DBF_INFO 6 /* informational */ 142 #define DBF_DEBUG 6 /* debug-level messages */ 143 144 /* messages to be written via klogd and dbf */ 145 #define DEV_MESSAGE(d_loglevel,d_device,d_string,d_args...)\ 146 do { \ 147 printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \ 148 dev_name(&d_device->cdev->dev), d_args); \ 149 DBF_DEV_EVENT(DBF_ALERT, d_device, d_string, d_args); \ 150 } while(0) 151 152 #define MESSAGE(d_loglevel,d_string,d_args...)\ 153 do { \ 154 printk(d_loglevel PRINTK_HEADER " " d_string "\n", d_args); \ 155 DBF_EVENT(DBF_ALERT, d_string, d_args); \ 156 } while(0) 157 158 /* messages to be written via klogd only */ 159 #define DEV_MESSAGE_LOG(d_loglevel,d_device,d_string,d_args...)\ 160 do { \ 161 printk(d_loglevel PRINTK_HEADER " %s: " d_string "\n", \ 162 dev_name(&d_device->cdev->dev), d_args); \ 163 } while(0) 164 165 #define MESSAGE_LOG(d_loglevel,d_string,d_args...)\ 166 do { \ 167 printk(d_loglevel PRINTK_HEADER " " d_string "\n", d_args); \ 168 } while(0) 169 170 /* Macro to calculate number of blocks per page */ 171 #define BLOCKS_PER_PAGE(blksize) (PAGE_SIZE / blksize) 172 173 struct dasd_ccw_req { 174 unsigned int magic; /* Eye catcher */ 175 struct list_head devlist; /* for dasd_device request queue */ 176 struct list_head blocklist; /* for dasd_block request queue */ 177 178 /* Where to execute what... */ 179 struct dasd_block *block; /* the originating block device */ 180 struct dasd_device *memdev; /* the device used to allocate this */ 181 struct dasd_device *startdev; /* device the request is started on */ 182 struct dasd_device *basedev; /* base device if no block->base */ 183 void *cpaddr; /* address of ccw or tcw */ 184 unsigned char cpmode; /* 0 = cmd mode, 1 = itcw */ 185 char status; /* status of this request */ 186 short retries; /* A retry counter */ 187 unsigned long flags; /* flags of this request */ 188 189 /* ... and how */ 190 unsigned long starttime; /* jiffies time of request start */ 191 unsigned long expires; /* expiration period in jiffies */ 192 char lpm; /* logical path mask */ 193 void *data; /* pointer to data area */ 194 195 /* these are important for recovering erroneous requests */ 196 int intrc; /* internal error, e.g. from start_IO */ 197 struct irb irb; /* device status in case of an error */ 198 struct dasd_ccw_req *refers; /* ERP-chain queueing. */ 199 void *function; /* originating ERP action */ 200 201 /* these are for statistics only */ 202 unsigned long buildclk; /* TOD-clock of request generation */ 203 unsigned long startclk; /* TOD-clock of request start */ 204 unsigned long stopclk; /* TOD-clock of request interrupt */ 205 unsigned long endclk; /* TOD-clock of request termination */ 206 207 /* Callback that is called after reaching final status. */ 208 void (*callback)(struct dasd_ccw_req *, void *data); 209 void *callback_data; 210 }; 211 212 /* 213 * dasd_ccw_req -> status can be: 214 */ 215 #define DASD_CQR_FILLED 0x00 /* request is ready to be processed */ 216 #define DASD_CQR_DONE 0x01 /* request is completed successfully */ 217 #define DASD_CQR_NEED_ERP 0x02 /* request needs recovery action */ 218 #define DASD_CQR_IN_ERP 0x03 /* request is in recovery */ 219 #define DASD_CQR_FAILED 0x04 /* request is finally failed */ 220 #define DASD_CQR_TERMINATED 0x05 /* request was stopped by driver */ 221 222 #define DASD_CQR_QUEUED 0x80 /* request is queued to be processed */ 223 #define DASD_CQR_IN_IO 0x81 /* request is currently in IO */ 224 #define DASD_CQR_ERROR 0x82 /* request is completed with error */ 225 #define DASD_CQR_CLEAR_PENDING 0x83 /* request is clear pending */ 226 #define DASD_CQR_CLEARED 0x84 /* request was cleared */ 227 #define DASD_CQR_SUCCESS 0x85 /* request was successful */ 228 229 /* default expiration time*/ 230 #define DASD_EXPIRES 300 231 #define DASD_EXPIRES_MAX 40000000 232 #define DASD_RETRIES 256 233 #define DASD_RETRIES_MAX 32768 234 235 /* per dasd_ccw_req flags */ 236 #define DASD_CQR_FLAGS_USE_ERP 0 /* use ERP for this request */ 237 #define DASD_CQR_FLAGS_FAILFAST 1 /* FAILFAST */ 238 #define DASD_CQR_VERIFY_PATH 2 /* path verification request */ 239 #define DASD_CQR_ALLOW_SLOCK 3 /* Try this request even when lock was 240 * stolen. Should not be combined with 241 * DASD_CQR_FLAGS_USE_ERP 242 */ 243 /* 244 * The following flags are used to suppress output of certain errors. 245 */ 246 #define DASD_CQR_SUPPRESS_NRF 4 /* Suppress 'No Record Found' error */ 247 #define DASD_CQR_SUPPRESS_FP 5 /* Suppress 'File Protected' error*/ 248 #define DASD_CQR_SUPPRESS_IL 6 /* Suppress 'Incorrect Length' error */ 249 #define DASD_CQR_SUPPRESS_CR 7 /* Suppress 'Command Reject' error */ 250 251 /* Signature for error recovery functions. */ 252 typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *); 253 254 /* 255 * A single CQR can only contain a maximum of 255 CCWs. It is limited by 256 * the locate record and locate record extended count value which can only hold 257 * 1 Byte max. 258 */ 259 #define DASD_CQR_MAX_CCW 255 260 261 /* 262 * Unique identifier for dasd device. 263 */ 264 #define UA_NOT_CONFIGURED 0x00 265 #define UA_BASE_DEVICE 0x01 266 #define UA_BASE_PAV_ALIAS 0x02 267 #define UA_HYPER_PAV_ALIAS 0x03 268 269 struct dasd_uid { 270 __u8 type; 271 char vendor[4]; 272 char serial[15]; 273 __u16 ssid; 274 __u8 real_unit_addr; 275 __u8 base_unit_addr; 276 char vduit[33]; 277 }; 278 279 /* 280 * the struct dasd_discipline is 281 * sth like a table of virtual functions, if you think of dasd_eckd 282 * inheriting dasd... 283 * no, currently we are not planning to reimplement the driver in C++ 284 */ 285 struct dasd_discipline { 286 struct module *owner; 287 char ebcname[8]; /* a name used for tagging and printks */ 288 char name[8]; /* a name used for tagging and printks */ 289 int max_blocks; /* maximum number of blocks to be chained */ 290 291 struct list_head list; /* used for list of disciplines */ 292 293 /* 294 * Device recognition functions. check_device is used to verify 295 * the sense data and the information returned by read device 296 * characteristics. It returns 0 if the discipline can be used 297 * for the device in question. uncheck_device is called during 298 * device shutdown to deregister a device from its discipline. 299 */ 300 int (*check_device) (struct dasd_device *); 301 void (*uncheck_device) (struct dasd_device *); 302 303 /* 304 * do_analysis is used in the step from device state "basic" to 305 * state "accept". It returns 0 if the device can be made ready, 306 * it returns -EMEDIUMTYPE if the device can't be made ready or 307 * -EAGAIN if do_analysis started a ccw that needs to complete 308 * before the analysis may be repeated. 309 */ 310 int (*do_analysis) (struct dasd_block *); 311 312 /* 313 * This function is called, when new paths become available. 314 * Disciplins may use this callback to do necessary setup work, 315 * e.g. verify that new path is compatible with the current 316 * configuration. 317 */ 318 int (*verify_path)(struct dasd_device *, __u8); 319 320 /* 321 * Last things to do when a device is set online, and first things 322 * when it is set offline. 323 */ 324 int (*basic_to_ready) (struct dasd_device *); 325 int (*online_to_ready) (struct dasd_device *); 326 int (*basic_to_known)(struct dasd_device *); 327 328 /* (struct dasd_device *); 329 * Device operation functions. build_cp creates a ccw chain for 330 * a block device request, start_io starts the request and 331 * term_IO cancels it (e.g. in case of a timeout). format_device 332 * formats the device and check_device_format compares the format of 333 * a device with the expected format_data. 334 * handle_terminated_request allows to examine a cqr and prepare 335 * it for retry. 336 */ 337 struct dasd_ccw_req *(*build_cp) (struct dasd_device *, 338 struct dasd_block *, 339 struct request *); 340 int (*start_IO) (struct dasd_ccw_req *); 341 int (*term_IO) (struct dasd_ccw_req *); 342 void (*handle_terminated_request) (struct dasd_ccw_req *); 343 int (*format_device) (struct dasd_device *, 344 struct format_data_t *, int); 345 int (*check_device_format)(struct dasd_device *, 346 struct format_check_t *, int); 347 int (*free_cp) (struct dasd_ccw_req *, struct request *); 348 349 /* 350 * Error recovery functions. examine_error() returns a value that 351 * indicates what to do for an error condition. If examine_error() 352 * returns 'dasd_era_recover' erp_action() is called to create a 353 * special error recovery ccw. erp_postaction() is called after 354 * an error recovery ccw has finished its execution. dump_sense 355 * is called for every error condition to print the sense data 356 * to the console. 357 */ 358 dasd_erp_fn_t(*erp_action) (struct dasd_ccw_req *); 359 dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); 360 void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, 361 struct irb *); 362 void (*dump_sense_dbf) (struct dasd_device *, struct irb *, char *); 363 void (*check_for_device_change) (struct dasd_device *, 364 struct dasd_ccw_req *, 365 struct irb *); 366 367 /* i/o control functions. */ 368 int (*fill_geometry) (struct dasd_block *, struct hd_geometry *); 369 int (*fill_info) (struct dasd_device *, struct dasd_information2_t *); 370 int (*ioctl) (struct dasd_block *, unsigned int, void __user *); 371 372 /* suspend/resume functions */ 373 int (*freeze) (struct dasd_device *); 374 int (*restore) (struct dasd_device *); 375 376 /* reload device after state change */ 377 int (*reload) (struct dasd_device *); 378 379 int (*get_uid) (struct dasd_device *, struct dasd_uid *); 380 void (*kick_validate) (struct dasd_device *); 381 int (*check_attention)(struct dasd_device *, __u8); 382 int (*host_access_count)(struct dasd_device *); 383 int (*hosts_print)(struct dasd_device *, struct seq_file *); 384 void (*handle_hpf_error)(struct dasd_device *, struct irb *); 385 void (*disable_hpf)(struct dasd_device *); 386 int (*hpf_enabled)(struct dasd_device *); 387 void (*reset_path)(struct dasd_device *, __u8); 388 }; 389 390 extern struct dasd_discipline *dasd_diag_discipline_pointer; 391 392 /* 393 * Notification numbers for extended error reporting notifications: 394 * The DASD_EER_DISABLE notification is sent before a dasd_device (and it's 395 * eer pointer) is freed. The error reporting module needs to do all necessary 396 * cleanup steps. 397 * The DASD_EER_TRIGGER notification sends the actual error reports (triggers). 398 */ 399 #define DASD_EER_DISABLE 0 400 #define DASD_EER_TRIGGER 1 401 402 /* Trigger IDs for extended error reporting DASD_EER_TRIGGER notification */ 403 #define DASD_EER_FATALERROR 1 404 #define DASD_EER_NOPATH 2 405 #define DASD_EER_STATECHANGE 3 406 #define DASD_EER_PPRCSUSPEND 4 407 408 /* DASD path handling */ 409 410 #define DASD_PATH_OPERATIONAL 1 411 #define DASD_PATH_TBV 2 412 #define DASD_PATH_PP 3 413 #define DASD_PATH_NPP 4 414 #define DASD_PATH_MISCABLED 5 415 #define DASD_PATH_NOHPF 6 416 #define DASD_PATH_CUIR 7 417 #define DASD_PATH_IFCC 8 418 419 #define DASD_THRHLD_MAX 4294967295U 420 #define DASD_INTERVAL_MAX 4294967295U 421 422 struct dasd_path { 423 unsigned long flags; 424 u8 cssid; 425 u8 ssid; 426 u8 chpid; 427 struct dasd_conf_data *conf_data; 428 atomic_t error_count; 429 unsigned long errorclk; 430 }; 431 432 433 struct dasd_profile_info { 434 /* legacy part of profile data, as in dasd_profile_info_t */ 435 unsigned int dasd_io_reqs; /* number of requests processed */ 436 unsigned int dasd_io_sects; /* number of sectors processed */ 437 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */ 438 unsigned int dasd_io_times[32]; /* histogram of requests's times */ 439 unsigned int dasd_io_timps[32]; /* h. of requests's times per sector */ 440 unsigned int dasd_io_time1[32]; /* hist. of time from build to start */ 441 unsigned int dasd_io_time2[32]; /* hist. of time from start to irq */ 442 unsigned int dasd_io_time2ps[32]; /* hist. of time from start to irq */ 443 unsigned int dasd_io_time3[32]; /* hist. of time from irq to end */ 444 unsigned int dasd_io_nr_req[32]; /* hist. of # of requests in chanq */ 445 446 /* new data */ 447 struct timespec starttod; /* time of start or last reset */ 448 unsigned int dasd_io_alias; /* requests using an alias */ 449 unsigned int dasd_io_tpm; /* requests using transport mode */ 450 unsigned int dasd_read_reqs; /* total number of read requests */ 451 unsigned int dasd_read_sects; /* total number read sectors */ 452 unsigned int dasd_read_alias; /* read request using an alias */ 453 unsigned int dasd_read_tpm; /* read requests in transport mode */ 454 unsigned int dasd_read_secs[32]; /* histogram of request's sizes */ 455 unsigned int dasd_read_times[32]; /* histogram of requests's times */ 456 unsigned int dasd_read_time1[32]; /* hist. time from build to start */ 457 unsigned int dasd_read_time2[32]; /* hist. of time from start to irq */ 458 unsigned int dasd_read_time3[32]; /* hist. of time from irq to end */ 459 unsigned int dasd_read_nr_req[32]; /* hist. of # of requests in chanq */ 460 unsigned long dasd_sum_times; /* sum of request times */ 461 unsigned long dasd_sum_time_str; /* sum of time from build to start */ 462 unsigned long dasd_sum_time_irq; /* sum of time from start to irq */ 463 unsigned long dasd_sum_time_end; /* sum of time from irq to end */ 464 }; 465 466 struct dasd_profile { 467 struct dentry *dentry; 468 struct dasd_profile_info *data; 469 spinlock_t lock; 470 }; 471 472 struct dasd_device { 473 /* Block device stuff. */ 474 struct dasd_block *block; 475 476 unsigned int devindex; 477 unsigned long flags; /* per device flags */ 478 unsigned short features; /* copy of devmap-features (read-only!) */ 479 480 /* extended error reporting stuff (eer) */ 481 struct dasd_ccw_req *eer_cqr; 482 483 /* Device discipline stuff. */ 484 struct dasd_discipline *discipline; 485 struct dasd_discipline *base_discipline; 486 void *private; 487 struct dasd_path path[8]; 488 __u8 opm; 489 490 /* Device state and target state. */ 491 int state, target; 492 struct mutex state_mutex; 493 int stopped; /* device (ccw_device_start) was stopped */ 494 495 /* reference count. */ 496 atomic_t ref_count; 497 498 /* ccw queue and memory for static ccw/erp buffers. */ 499 struct list_head ccw_queue; 500 spinlock_t mem_lock; 501 void *ccw_mem; 502 void *erp_mem; 503 struct list_head ccw_chunks; 504 struct list_head erp_chunks; 505 506 atomic_t tasklet_scheduled; 507 struct tasklet_struct tasklet; 508 struct work_struct kick_work; 509 struct work_struct restore_device; 510 struct work_struct reload_device; 511 struct work_struct kick_validate; 512 struct work_struct suc_work; 513 struct work_struct requeue_requests; 514 struct timer_list timer; 515 516 debug_info_t *debug_area; 517 518 struct ccw_device *cdev; 519 520 /* hook for alias management */ 521 struct list_head alias_list; 522 523 /* default expiration time in s */ 524 unsigned long default_expires; 525 unsigned long default_retries; 526 527 unsigned long blk_timeout; 528 529 unsigned long path_thrhld; 530 unsigned long path_interval; 531 532 struct dentry *debugfs_dentry; 533 struct dentry *hosts_dentry; 534 struct dasd_profile profile; 535 }; 536 537 struct dasd_block { 538 /* Block device stuff. */ 539 struct gendisk *gdp; 540 struct request_queue *request_queue; 541 spinlock_t request_queue_lock; 542 struct block_device *bdev; 543 atomic_t open_count; 544 545 unsigned long blocks; /* size of volume in blocks */ 546 unsigned int bp_block; /* bytes per block */ 547 unsigned int s2b_shift; /* log2 (bp_block/512) */ 548 549 struct dasd_device *base; 550 struct list_head ccw_queue; 551 spinlock_t queue_lock; 552 553 atomic_t tasklet_scheduled; 554 struct tasklet_struct tasklet; 555 struct timer_list timer; 556 557 struct dentry *debugfs_dentry; 558 struct dasd_profile profile; 559 }; 560 561 struct dasd_attention_data { 562 struct dasd_device *device; 563 __u8 lpum; 564 }; 565 566 /* reasons why device (ccw_device_start) was stopped */ 567 #define DASD_STOPPED_NOT_ACC 1 /* not accessible */ 568 #define DASD_STOPPED_QUIESCE 2 /* Quiesced */ 569 #define DASD_STOPPED_PENDING 4 /* long busy */ 570 #define DASD_STOPPED_DC_WAIT 8 /* disconnected, wait */ 571 #define DASD_STOPPED_SU 16 /* summary unit check handling */ 572 #define DASD_STOPPED_PM 32 /* pm state transition */ 573 #define DASD_UNRESUMED_PM 64 /* pm resume failed state */ 574 575 /* per device flags */ 576 #define DASD_FLAG_OFFLINE 3 /* device is in offline processing */ 577 #define DASD_FLAG_EER_SNSS 4 /* A SNSS is required */ 578 #define DASD_FLAG_EER_IN_USE 5 /* A SNSS request is running */ 579 #define DASD_FLAG_DEVICE_RO 6 /* The device itself is read-only. Don't 580 * confuse this with the user specified 581 * read-only feature. 582 */ 583 #define DASD_FLAG_IS_RESERVED 7 /* The device is reserved */ 584 #define DASD_FLAG_LOCK_STOLEN 8 /* The device lock was stolen */ 585 #define DASD_FLAG_SUSPENDED 9 /* The device was suspended */ 586 #define DASD_FLAG_SAFE_OFFLINE 10 /* safe offline processing requested*/ 587 #define DASD_FLAG_SAFE_OFFLINE_RUNNING 11 /* safe offline running */ 588 #define DASD_FLAG_ABORTALL 12 /* Abort all noretry requests */ 589 #define DASD_FLAG_PATH_VERIFY 13 /* Path verification worker running */ 590 #define DASD_FLAG_SUC 14 /* unhandled summary unit check */ 591 592 #define DASD_SLEEPON_START_TAG ((void *) 1) 593 #define DASD_SLEEPON_END_TAG ((void *) 2) 594 595 void dasd_put_device_wake(struct dasd_device *); 596 597 /* 598 * Reference count inliners 599 */ 600 static inline void 601 dasd_get_device(struct dasd_device *device) 602 { 603 atomic_inc(&device->ref_count); 604 } 605 606 static inline void 607 dasd_put_device(struct dasd_device *device) 608 { 609 if (atomic_dec_return(&device->ref_count) == 0) 610 dasd_put_device_wake(device); 611 } 612 613 /* 614 * The static memory in ccw_mem and erp_mem is managed by a sorted 615 * list of free memory chunks. 616 */ 617 struct dasd_mchunk 618 { 619 struct list_head list; 620 unsigned long size; 621 } __attribute__ ((aligned(8))); 622 623 static inline void 624 dasd_init_chunklist(struct list_head *chunk_list, void *mem, 625 unsigned long size) 626 { 627 struct dasd_mchunk *chunk; 628 629 INIT_LIST_HEAD(chunk_list); 630 chunk = (struct dasd_mchunk *) mem; 631 chunk->size = size - sizeof(struct dasd_mchunk); 632 list_add(&chunk->list, chunk_list); 633 } 634 635 static inline void * 636 dasd_alloc_chunk(struct list_head *chunk_list, unsigned long size) 637 { 638 struct dasd_mchunk *chunk, *tmp; 639 640 size = (size + 7L) & -8L; 641 list_for_each_entry(chunk, chunk_list, list) { 642 if (chunk->size < size) 643 continue; 644 if (chunk->size > size + sizeof(struct dasd_mchunk)) { 645 char *endaddr = (char *) (chunk + 1) + chunk->size; 646 tmp = (struct dasd_mchunk *) (endaddr - size) - 1; 647 tmp->size = size; 648 chunk->size -= size + sizeof(struct dasd_mchunk); 649 chunk = tmp; 650 } else 651 list_del(&chunk->list); 652 return (void *) (chunk + 1); 653 } 654 return NULL; 655 } 656 657 static inline void 658 dasd_free_chunk(struct list_head *chunk_list, void *mem) 659 { 660 struct dasd_mchunk *chunk, *tmp; 661 struct list_head *p, *left; 662 663 chunk = (struct dasd_mchunk *) 664 ((char *) mem - sizeof(struct dasd_mchunk)); 665 /* Find out the left neighbour in chunk_list. */ 666 left = chunk_list; 667 list_for_each(p, chunk_list) { 668 if (list_entry(p, struct dasd_mchunk, list) > chunk) 669 break; 670 left = p; 671 } 672 /* Try to merge with right neighbour = next element from left. */ 673 if (left->next != chunk_list) { 674 tmp = list_entry(left->next, struct dasd_mchunk, list); 675 if ((char *) (chunk + 1) + chunk->size == (char *) tmp) { 676 list_del(&tmp->list); 677 chunk->size += tmp->size + sizeof(struct dasd_mchunk); 678 } 679 } 680 /* Try to merge with left neighbour. */ 681 if (left != chunk_list) { 682 tmp = list_entry(left, struct dasd_mchunk, list); 683 if ((char *) (tmp + 1) + tmp->size == (char *) chunk) { 684 tmp->size += chunk->size + sizeof(struct dasd_mchunk); 685 return; 686 } 687 } 688 __list_add(&chunk->list, left, left->next); 689 } 690 691 /* 692 * Check if bsize is in { 512, 1024, 2048, 4096 } 693 */ 694 static inline int 695 dasd_check_blocksize(int bsize) 696 { 697 if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize)) 698 return -EMEDIUMTYPE; 699 return 0; 700 } 701 702 /* externals in dasd.c */ 703 #define DASD_PROFILE_OFF 0 704 #define DASD_PROFILE_ON 1 705 #define DASD_PROFILE_GLOBAL_ONLY 2 706 707 extern debug_info_t *dasd_debug_area; 708 extern struct dasd_profile dasd_global_profile; 709 extern unsigned int dasd_global_profile_level; 710 extern const struct block_device_operations dasd_device_operations; 711 712 extern struct kmem_cache *dasd_page_cache; 713 714 struct dasd_ccw_req * 715 dasd_kmalloc_request(int , int, int, struct dasd_device *); 716 struct dasd_ccw_req * 717 dasd_smalloc_request(int , int, int, struct dasd_device *); 718 void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *); 719 void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *); 720 void dasd_wakeup_cb(struct dasd_ccw_req *, void *); 721 722 static inline int 723 dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, struct dasd_device *device) 724 { 725 return set_normalized_cda(ccw, cda); 726 } 727 728 struct dasd_device *dasd_alloc_device(void); 729 void dasd_free_device(struct dasd_device *); 730 731 struct dasd_block *dasd_alloc_block(void); 732 void dasd_free_block(struct dasd_block *); 733 734 enum blk_eh_timer_return dasd_times_out(struct request *req); 735 736 void dasd_enable_device(struct dasd_device *); 737 void dasd_set_target_state(struct dasd_device *, int); 738 void dasd_kick_device(struct dasd_device *); 739 void dasd_restore_device(struct dasd_device *); 740 void dasd_reload_device(struct dasd_device *); 741 void dasd_schedule_requeue(struct dasd_device *); 742 743 void dasd_add_request_head(struct dasd_ccw_req *); 744 void dasd_add_request_tail(struct dasd_ccw_req *); 745 int dasd_start_IO(struct dasd_ccw_req *); 746 int dasd_term_IO(struct dasd_ccw_req *); 747 void dasd_schedule_device_bh(struct dasd_device *); 748 void dasd_schedule_block_bh(struct dasd_block *); 749 int dasd_sleep_on(struct dasd_ccw_req *); 750 int dasd_sleep_on_queue(struct list_head *); 751 int dasd_sleep_on_immediatly(struct dasd_ccw_req *); 752 int dasd_sleep_on_interruptible(struct dasd_ccw_req *); 753 void dasd_device_set_timer(struct dasd_device *, int); 754 void dasd_device_clear_timer(struct dasd_device *); 755 void dasd_block_set_timer(struct dasd_block *, int); 756 void dasd_block_clear_timer(struct dasd_block *); 757 int dasd_cancel_req(struct dasd_ccw_req *); 758 int dasd_flush_device_queue(struct dasd_device *); 759 int dasd_generic_probe (struct ccw_device *, struct dasd_discipline *); 760 void dasd_generic_free_discipline(struct dasd_device *); 761 void dasd_generic_remove (struct ccw_device *cdev); 762 int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *); 763 int dasd_generic_set_offline (struct ccw_device *cdev); 764 int dasd_generic_notify(struct ccw_device *, int); 765 int dasd_generic_last_path_gone(struct dasd_device *); 766 int dasd_generic_path_operational(struct dasd_device *); 767 void dasd_generic_shutdown(struct ccw_device *); 768 769 void dasd_generic_handle_state_change(struct dasd_device *); 770 int dasd_generic_pm_freeze(struct ccw_device *); 771 int dasd_generic_restore_device(struct ccw_device *); 772 enum uc_todo dasd_generic_uc_handler(struct ccw_device *, struct irb *); 773 void dasd_generic_path_event(struct ccw_device *, int *); 774 int dasd_generic_verify_path(struct dasd_device *, __u8); 775 776 int dasd_generic_read_dev_chars(struct dasd_device *, int, void *, int); 777 char *dasd_get_sense(struct irb *); 778 779 void dasd_device_set_stop_bits(struct dasd_device *, int); 780 void dasd_device_remove_stop_bits(struct dasd_device *, int); 781 782 int dasd_device_is_ro(struct dasd_device *); 783 784 void dasd_profile_reset(struct dasd_profile *); 785 int dasd_profile_on(struct dasd_profile *); 786 void dasd_profile_off(struct dasd_profile *); 787 char *dasd_get_user_string(const char __user *, size_t); 788 789 /* externals in dasd_devmap.c */ 790 extern int dasd_max_devindex; 791 extern int dasd_probeonly; 792 extern int dasd_autodetect; 793 extern int dasd_nopav; 794 extern int dasd_nofcx; 795 796 int dasd_devmap_init(void); 797 void dasd_devmap_exit(void); 798 799 struct dasd_device *dasd_create_device(struct ccw_device *); 800 void dasd_delete_device(struct dasd_device *); 801 802 int dasd_get_feature(struct ccw_device *, int); 803 int dasd_set_feature(struct ccw_device *, int, int); 804 805 int dasd_add_sysfs_files(struct ccw_device *); 806 void dasd_remove_sysfs_files(struct ccw_device *); 807 808 struct dasd_device *dasd_device_from_cdev(struct ccw_device *); 809 struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *); 810 struct dasd_device *dasd_device_from_devindex(int); 811 812 void dasd_add_link_to_gendisk(struct gendisk *, struct dasd_device *); 813 struct dasd_device *dasd_device_from_gendisk(struct gendisk *); 814 815 int dasd_parse(void) __init; 816 int dasd_busid_known(const char *); 817 818 /* externals in dasd_gendisk.c */ 819 int dasd_gendisk_init(void); 820 void dasd_gendisk_exit(void); 821 int dasd_gendisk_alloc(struct dasd_block *); 822 void dasd_gendisk_free(struct dasd_block *); 823 int dasd_scan_partitions(struct dasd_block *); 824 void dasd_destroy_partitions(struct dasd_block *); 825 826 /* externals in dasd_ioctl.c */ 827 int dasd_ioctl(struct block_device *, fmode_t, unsigned int, unsigned long); 828 829 /* externals in dasd_proc.c */ 830 int dasd_proc_init(void); 831 void dasd_proc_exit(void); 832 833 /* externals in dasd_erp.c */ 834 struct dasd_ccw_req *dasd_default_erp_action(struct dasd_ccw_req *); 835 struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *); 836 struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int, 837 struct dasd_device *); 838 void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *); 839 void dasd_log_sense(struct dasd_ccw_req *, struct irb *); 840 void dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb); 841 842 /* externals in dasd_3990_erp.c */ 843 struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *); 844 void dasd_3990_erp_handle_sim(struct dasd_device *, char *); 845 846 /* externals in dasd_eer.c */ 847 #ifdef CONFIG_DASD_EER 848 int dasd_eer_init(void); 849 void dasd_eer_exit(void); 850 int dasd_eer_enable(struct dasd_device *); 851 void dasd_eer_disable(struct dasd_device *); 852 void dasd_eer_write(struct dasd_device *, struct dasd_ccw_req *cqr, 853 unsigned int id); 854 void dasd_eer_snss(struct dasd_device *); 855 856 static inline int dasd_eer_enabled(struct dasd_device *device) 857 { 858 return device->eer_cqr != NULL; 859 } 860 #else 861 #define dasd_eer_init() (0) 862 #define dasd_eer_exit() do { } while (0) 863 #define dasd_eer_enable(d) (0) 864 #define dasd_eer_disable(d) do { } while (0) 865 #define dasd_eer_write(d,c,i) do { } while (0) 866 #define dasd_eer_snss(d) do { } while (0) 867 #define dasd_eer_enabled(d) (0) 868 #endif /* CONFIG_DASD_ERR */ 869 870 871 /* DASD path handling functions */ 872 873 /* 874 * helper functions to modify bit masks for a given channel path for a device 875 */ 876 static inline int dasd_path_is_operational(struct dasd_device *device, int chp) 877 { 878 return test_bit(DASD_PATH_OPERATIONAL, &device->path[chp].flags); 879 } 880 881 static inline int dasd_path_need_verify(struct dasd_device *device, int chp) 882 { 883 return test_bit(DASD_PATH_TBV, &device->path[chp].flags); 884 } 885 886 static inline void dasd_path_verify(struct dasd_device *device, int chp) 887 { 888 __set_bit(DASD_PATH_TBV, &device->path[chp].flags); 889 } 890 891 static inline void dasd_path_clear_verify(struct dasd_device *device, int chp) 892 { 893 __clear_bit(DASD_PATH_TBV, &device->path[chp].flags); 894 } 895 896 static inline void dasd_path_clear_all_verify(struct dasd_device *device) 897 { 898 int chp; 899 900 for (chp = 0; chp < 8; chp++) 901 dasd_path_clear_verify(device, chp); 902 } 903 904 static inline void dasd_path_operational(struct dasd_device *device, int chp) 905 { 906 __set_bit(DASD_PATH_OPERATIONAL, &device->path[chp].flags); 907 device->opm |= (0x80 >> chp); 908 } 909 910 static inline void dasd_path_nonpreferred(struct dasd_device *device, int chp) 911 { 912 __set_bit(DASD_PATH_NPP, &device->path[chp].flags); 913 } 914 915 static inline int dasd_path_is_nonpreferred(struct dasd_device *device, int chp) 916 { 917 return test_bit(DASD_PATH_NPP, &device->path[chp].flags); 918 } 919 920 static inline void dasd_path_clear_nonpreferred(struct dasd_device *device, 921 int chp) 922 { 923 __clear_bit(DASD_PATH_NPP, &device->path[chp].flags); 924 } 925 926 static inline void dasd_path_preferred(struct dasd_device *device, int chp) 927 { 928 __set_bit(DASD_PATH_PP, &device->path[chp].flags); 929 } 930 931 static inline int dasd_path_is_preferred(struct dasd_device *device, int chp) 932 { 933 return test_bit(DASD_PATH_PP, &device->path[chp].flags); 934 } 935 936 static inline void dasd_path_clear_preferred(struct dasd_device *device, 937 int chp) 938 { 939 __clear_bit(DASD_PATH_PP, &device->path[chp].flags); 940 } 941 942 static inline void dasd_path_clear_oper(struct dasd_device *device, int chp) 943 { 944 __clear_bit(DASD_PATH_OPERATIONAL, &device->path[chp].flags); 945 device->opm &= ~(0x80 >> chp); 946 } 947 948 static inline void dasd_path_clear_cable(struct dasd_device *device, int chp) 949 { 950 __clear_bit(DASD_PATH_MISCABLED, &device->path[chp].flags); 951 } 952 953 static inline void dasd_path_cuir(struct dasd_device *device, int chp) 954 { 955 __set_bit(DASD_PATH_CUIR, &device->path[chp].flags); 956 } 957 958 static inline int dasd_path_is_cuir(struct dasd_device *device, int chp) 959 { 960 return test_bit(DASD_PATH_CUIR, &device->path[chp].flags); 961 } 962 963 static inline void dasd_path_clear_cuir(struct dasd_device *device, int chp) 964 { 965 __clear_bit(DASD_PATH_CUIR, &device->path[chp].flags); 966 } 967 968 static inline void dasd_path_ifcc(struct dasd_device *device, int chp) 969 { 970 set_bit(DASD_PATH_IFCC, &device->path[chp].flags); 971 } 972 973 static inline int dasd_path_is_ifcc(struct dasd_device *device, int chp) 974 { 975 return test_bit(DASD_PATH_IFCC, &device->path[chp].flags); 976 } 977 978 static inline void dasd_path_clear_ifcc(struct dasd_device *device, int chp) 979 { 980 clear_bit(DASD_PATH_IFCC, &device->path[chp].flags); 981 } 982 983 static inline void dasd_path_clear_nohpf(struct dasd_device *device, int chp) 984 { 985 __clear_bit(DASD_PATH_NOHPF, &device->path[chp].flags); 986 } 987 988 static inline void dasd_path_miscabled(struct dasd_device *device, int chp) 989 { 990 __set_bit(DASD_PATH_MISCABLED, &device->path[chp].flags); 991 } 992 993 static inline int dasd_path_is_miscabled(struct dasd_device *device, int chp) 994 { 995 return test_bit(DASD_PATH_MISCABLED, &device->path[chp].flags); 996 } 997 998 static inline void dasd_path_nohpf(struct dasd_device *device, int chp) 999 { 1000 __set_bit(DASD_PATH_NOHPF, &device->path[chp].flags); 1001 } 1002 1003 static inline int dasd_path_is_nohpf(struct dasd_device *device, int chp) 1004 { 1005 return test_bit(DASD_PATH_NOHPF, &device->path[chp].flags); 1006 } 1007 1008 /* 1009 * get functions for path masks 1010 * will return a path masks for the given device 1011 */ 1012 1013 static inline __u8 dasd_path_get_opm(struct dasd_device *device) 1014 { 1015 return device->opm; 1016 } 1017 1018 static inline __u8 dasd_path_get_tbvpm(struct dasd_device *device) 1019 { 1020 int chp; 1021 __u8 tbvpm = 0x00; 1022 1023 for (chp = 0; chp < 8; chp++) 1024 if (dasd_path_need_verify(device, chp)) 1025 tbvpm |= 0x80 >> chp; 1026 return tbvpm; 1027 } 1028 1029 static inline __u8 dasd_path_get_nppm(struct dasd_device *device) 1030 { 1031 int chp; 1032 __u8 npm = 0x00; 1033 1034 for (chp = 0; chp < 8; chp++) { 1035 if (dasd_path_is_nonpreferred(device, chp)) 1036 npm |= 0x80 >> chp; 1037 } 1038 return npm; 1039 } 1040 1041 static inline __u8 dasd_path_get_ppm(struct dasd_device *device) 1042 { 1043 int chp; 1044 __u8 ppm = 0x00; 1045 1046 for (chp = 0; chp < 8; chp++) 1047 if (dasd_path_is_preferred(device, chp)) 1048 ppm |= 0x80 >> chp; 1049 return ppm; 1050 } 1051 1052 static inline __u8 dasd_path_get_cablepm(struct dasd_device *device) 1053 { 1054 int chp; 1055 __u8 cablepm = 0x00; 1056 1057 for (chp = 0; chp < 8; chp++) 1058 if (dasd_path_is_miscabled(device, chp)) 1059 cablepm |= 0x80 >> chp; 1060 return cablepm; 1061 } 1062 1063 static inline __u8 dasd_path_get_cuirpm(struct dasd_device *device) 1064 { 1065 int chp; 1066 __u8 cuirpm = 0x00; 1067 1068 for (chp = 0; chp < 8; chp++) 1069 if (dasd_path_is_cuir(device, chp)) 1070 cuirpm |= 0x80 >> chp; 1071 return cuirpm; 1072 } 1073 1074 static inline __u8 dasd_path_get_ifccpm(struct dasd_device *device) 1075 { 1076 int chp; 1077 __u8 ifccpm = 0x00; 1078 1079 for (chp = 0; chp < 8; chp++) 1080 if (dasd_path_is_ifcc(device, chp)) 1081 ifccpm |= 0x80 >> chp; 1082 return ifccpm; 1083 } 1084 1085 static inline __u8 dasd_path_get_hpfpm(struct dasd_device *device) 1086 { 1087 int chp; 1088 __u8 hpfpm = 0x00; 1089 1090 for (chp = 0; chp < 8; chp++) 1091 if (dasd_path_is_nohpf(device, chp)) 1092 hpfpm |= 0x80 >> chp; 1093 return hpfpm; 1094 } 1095 1096 /* 1097 * add functions for path masks 1098 * the existing path mask will be extended by the given path mask 1099 */ 1100 static inline void dasd_path_add_tbvpm(struct dasd_device *device, __u8 pm) 1101 { 1102 int chp; 1103 1104 for (chp = 0; chp < 8; chp++) 1105 if (pm & (0x80 >> chp)) 1106 dasd_path_verify(device, chp); 1107 } 1108 1109 static inline __u8 dasd_path_get_notoperpm(struct dasd_device *device) 1110 { 1111 int chp; 1112 __u8 nopm = 0x00; 1113 1114 for (chp = 0; chp < 8; chp++) 1115 if (dasd_path_is_nohpf(device, chp) || 1116 dasd_path_is_ifcc(device, chp) || 1117 dasd_path_is_cuir(device, chp) || 1118 dasd_path_is_miscabled(device, chp)) 1119 nopm |= 0x80 >> chp; 1120 return nopm; 1121 } 1122 1123 static inline void dasd_path_add_opm(struct dasd_device *device, __u8 pm) 1124 { 1125 int chp; 1126 1127 for (chp = 0; chp < 8; chp++) 1128 if (pm & (0x80 >> chp)) { 1129 dasd_path_operational(device, chp); 1130 /* 1131 * if the path is used 1132 * it should not be in one of the negative lists 1133 */ 1134 dasd_path_clear_nohpf(device, chp); 1135 dasd_path_clear_cuir(device, chp); 1136 dasd_path_clear_cable(device, chp); 1137 dasd_path_clear_ifcc(device, chp); 1138 } 1139 } 1140 1141 static inline void dasd_path_add_cablepm(struct dasd_device *device, __u8 pm) 1142 { 1143 int chp; 1144 1145 for (chp = 0; chp < 8; chp++) 1146 if (pm & (0x80 >> chp)) 1147 dasd_path_miscabled(device, chp); 1148 } 1149 1150 static inline void dasd_path_add_cuirpm(struct dasd_device *device, __u8 pm) 1151 { 1152 int chp; 1153 1154 for (chp = 0; chp < 8; chp++) 1155 if (pm & (0x80 >> chp)) 1156 dasd_path_cuir(device, chp); 1157 } 1158 1159 static inline void dasd_path_add_ifccpm(struct dasd_device *device, __u8 pm) 1160 { 1161 int chp; 1162 1163 for (chp = 0; chp < 8; chp++) 1164 if (pm & (0x80 >> chp)) 1165 dasd_path_ifcc(device, chp); 1166 } 1167 1168 static inline void dasd_path_add_nppm(struct dasd_device *device, __u8 pm) 1169 { 1170 int chp; 1171 1172 for (chp = 0; chp < 8; chp++) 1173 if (pm & (0x80 >> chp)) 1174 dasd_path_nonpreferred(device, chp); 1175 } 1176 1177 static inline void dasd_path_add_nohpfpm(struct dasd_device *device, __u8 pm) 1178 { 1179 int chp; 1180 1181 for (chp = 0; chp < 8; chp++) 1182 if (pm & (0x80 >> chp)) 1183 dasd_path_nohpf(device, chp); 1184 } 1185 1186 static inline void dasd_path_add_ppm(struct dasd_device *device, __u8 pm) 1187 { 1188 int chp; 1189 1190 for (chp = 0; chp < 8; chp++) 1191 if (pm & (0x80 >> chp)) 1192 dasd_path_preferred(device, chp); 1193 } 1194 1195 /* 1196 * set functions for path masks 1197 * the existing path mask will be replaced by the given path mask 1198 */ 1199 static inline void dasd_path_set_tbvpm(struct dasd_device *device, __u8 pm) 1200 { 1201 int chp; 1202 1203 for (chp = 0; chp < 8; chp++) 1204 if (pm & (0x80 >> chp)) 1205 dasd_path_verify(device, chp); 1206 else 1207 dasd_path_clear_verify(device, chp); 1208 } 1209 1210 static inline void dasd_path_set_opm(struct dasd_device *device, __u8 pm) 1211 { 1212 int chp; 1213 1214 for (chp = 0; chp < 8; chp++) { 1215 dasd_path_clear_oper(device, chp); 1216 if (pm & (0x80 >> chp)) { 1217 dasd_path_operational(device, chp); 1218 /* 1219 * if the path is used 1220 * it should not be in one of the negative lists 1221 */ 1222 dasd_path_clear_nohpf(device, chp); 1223 dasd_path_clear_cuir(device, chp); 1224 dasd_path_clear_cable(device, chp); 1225 dasd_path_clear_ifcc(device, chp); 1226 } 1227 } 1228 } 1229 1230 /* 1231 * remove functions for path masks 1232 * the existing path mask will be cleared with the given path mask 1233 */ 1234 static inline void dasd_path_remove_opm(struct dasd_device *device, __u8 pm) 1235 { 1236 int chp; 1237 1238 for (chp = 0; chp < 8; chp++) { 1239 if (pm & (0x80 >> chp)) 1240 dasd_path_clear_oper(device, chp); 1241 } 1242 } 1243 1244 /* 1245 * add the newly available path to the to be verified pm and remove it from 1246 * normal operation until it is verified 1247 */ 1248 static inline void dasd_path_available(struct dasd_device *device, int chp) 1249 { 1250 dasd_path_clear_oper(device, chp); 1251 dasd_path_verify(device, chp); 1252 } 1253 1254 static inline void dasd_path_notoper(struct dasd_device *device, int chp) 1255 { 1256 dasd_path_clear_oper(device, chp); 1257 dasd_path_clear_preferred(device, chp); 1258 dasd_path_clear_nonpreferred(device, chp); 1259 } 1260 1261 /* 1262 * remove all paths from normal operation 1263 */ 1264 static inline void dasd_path_no_path(struct dasd_device *device) 1265 { 1266 int chp; 1267 1268 for (chp = 0; chp < 8; chp++) 1269 dasd_path_notoper(device, chp); 1270 1271 dasd_path_clear_all_verify(device); 1272 } 1273 1274 /* end - path handling */ 1275 1276 #endif /* DASD_H */ 1277