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