brintos

brintos / linux-shallow public Read only

0
0
Text · 42.9 KiB · 81cfb5c Raw
1466 lines · c
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, 20098 */9 10#ifndef DASD_INT_H11#define DASD_INT_H12 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, clear35 *                   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	  041#define DASD_STATE_KNOWN  142#define DASD_STATE_BASIC  243#define DASD_STATE_UNFMT  344#define DASD_STATE_READY  445#define DASD_STATE_ONLINE 546 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>56#include <asm/dasd.h>57#include <asm/idals.h>58#include <linux/bitops.h>59#include <linux/blk-mq.h>60 61/* DASD discipline magic */62#define DASD_ECKD_MAGIC 0xC5C3D2C463#define DASD_DIAG_MAGIC 0xC4C9C1C764#define DASD_FBA_MAGIC 0xC6C2C14065 66/*67 * SECTION: Type definitions68 */69struct dasd_device;70struct dasd_block;71 72/* BIT DEFINITIONS FOR SENSE DATA */73#define DASD_SENSE_BIT_0 0x8074#define DASD_SENSE_BIT_1 0x4075#define DASD_SENSE_BIT_2 0x2076#define DASD_SENSE_BIT_3 0x1077 78/* BIT DEFINITIONS FOR SIM SENSE */79#define DASD_SIM_SENSE 0x0F80#define DASD_SIM_MSG_TO_OP 0x0381#define DASD_SIM_LOG 0x0C82 83/* lock class for nested cdev lock */84#define CDEV_NESTED_FIRST 185#define CDEV_NESTED_SECOND 286 87/*88 * SECTION: MACROs for klogd and s390 debug feature (dbf)89 */90#define DBF_DEV_EVENT(d_level, d_device, d_str, d_data...) \91do { \92	debug_sprintf_event(d_device->debug_area, \93			    d_level, \94			    d_str "\n", \95			    d_data); \96} while(0)97 98#define DBF_EVENT(d_level, d_str, d_data...)\99do { \100	debug_sprintf_event(dasd_debug_area, \101			    d_level,\102			    d_str "\n", \103			    d_data); \104} while(0)105 106#define DBF_EVENT_DEVID(d_level, d_cdev, d_str, d_data...)	\107do { \108	struct ccw_dev_id __dev_id;			\109	ccw_device_get_id(d_cdev, &__dev_id);		\110	debug_sprintf_event(dasd_debug_area,		\111			    d_level,					\112			    "0.%x.%04x " d_str "\n",			\113			    __dev_id.ssid, __dev_id.devno, d_data);	\114} while (0)115 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			*/125 126/* Macro to calculate number of blocks per page */127#define BLOCKS_PER_PAGE(blksize) (PAGE_SIZE / blksize)128 129struct 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 */151	void *mem_chunk;152 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 */157 158	void (*callback)(struct dasd_ccw_req *, void *data);159	void *callback_data;160	unsigned int proc_bytes;	/* bytes for partial completion */161	unsigned int trkcount;		/* count formatted tracks */162};163 164/*165 * dasd_ccw_req -> status can be:166 */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 */173 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 */180 181/* default expiration time*/182#define DASD_EXPIRES	  300183#define DASD_EXPIRES_MAX  40000000184#define DASD_RETRIES	  256185#define DASD_RETRIES_MAX  32768186 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 was192					 * stolen. Should not be combined with193					 * DASD_CQR_FLAGS_USE_ERP194					 */195/*196 * The following flags are used to suppress output of certain errors.197 */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 */202 203#define DASD_REQ_PER_DEV 4204 205/* Signature for error recovery functions. */206typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *);207 208/*209 * A single CQR can only contain a maximum of 255 CCWs. It is limited by210 * the locate record and locate record extended count value which can only hold211 * 1 Byte max.212 */213#define DASD_CQR_MAX_CCW 255214 215/*216 * Unique identifier for dasd device.217 */218#define UA_NOT_CONFIGURED  0x00219#define UA_BASE_DEVICE	   0x01220#define UA_BASE_PAV_ALIAS  0x02221#define UA_HYPER_PAV_ALIAS 0x03222 223struct dasd_uid {224	__u8 type;225	char vendor[4];226	char serial[15];227	__u16 ssid;228	__u8 real_unit_addr;229	__u8 base_unit_addr;230	char vduit[33];231};232 233#define DASD_UID_STRLEN ( /* vendor */ 3 + 1 + /* serial    */ 14 + 1 +	\234			  /* SSID   */ 4 + 1 + /* unit addr */ 2 + 1 +	\235			  /* vduit */ 32 + 1)236 237/*238 * PPRC Status data239 */240struct 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 */245} __packed;246 247struct 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 */261} __packed;262 263struct dasd_pprc_data_sc4 {264	struct dasd_pprc_header header;265	struct dasd_pprc_dev_info dev_info[5];266} __packed;267 268#define DASD_BUS_ID_SIZE 20269#define DASD_CP_ENTRIES 5270 271struct dasd_copy_entry {272	char busid[DASD_BUS_ID_SIZE];273	struct dasd_device *device;274	bool primary;275	bool configured;276};277 278struct dasd_copy_relation {279	struct dasd_copy_entry entry[DASD_CP_ENTRIES];280	struct dasd_copy_entry *active;281};282 283int dasd_devmap_set_device_copy_relation(struct ccw_device *,284					 bool pprc_enabled);285 286/*287 * the struct dasd_discipline is288 * sth like a table of virtual functions, if you think of dasd_eckd289 * inheriting dasd...290 * no, currently we are not planning to reimplement the driver in C++291 */292struct 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 */296	bool has_discard;297 298	struct list_head list;	/* used for list of disciplines */299 300	/*301	 * Device recognition functions. check_device is used to verify302	 * the sense data and the information returned by read device303	 * characteristics. It returns 0 if the discipline can be used304	 * for the device in question. uncheck_device is called during305	 * device shutdown to deregister a device from its discipline.306	 */307	int (*check_device) (struct dasd_device *);308	void (*uncheck_device) (struct dasd_device *);309 310	/*311	 * do_analysis is used in the step from device state "basic" to312	 * state "accept". It returns 0 if the device can be made ready,313	 * it returns -EMEDIUMTYPE if the device can't be made ready or314	 * -EAGAIN if do_analysis started a ccw that needs to complete315	 * before the analysis may be repeated.316	 */317	int (*do_analysis) (struct dasd_block *);318 319	/*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 current323	 * configuration.324	 */325	int (*pe_handler)(struct dasd_device *, __u8, __u8);326 327	/*328	 * Last things to do when a device is set online, and first things329	 * when it is set offline.330	 */331	int (*basic_to_ready) (struct dasd_device *);332	int (*online_to_ready) (struct dasd_device *);333	int (*basic_to_known)(struct dasd_device *);334 335	unsigned int (*max_sectors)(struct dasd_block *);336	/* (struct dasd_device *);337	 * Device operation functions. build_cp creates a ccw chain for338	 * a block device request, start_io starts the request and339	 * term_IO cancels it (e.g. in case of a timeout). format_device340	 * formats the device and check_device_format compares the format of341	 * a device with the expected format_data.342	 * handle_terminated_request allows to examine a cqr and prepare343	 * it for retry.344	 */345	struct dasd_ccw_req *(*build_cp) (struct dasd_device *,346					  struct dasd_block *,347					  struct request *);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 *);356 357	/*358	 * Error recovery functions. examine_error() returns a value that359	 * indicates what to do for an error condition. If examine_error()360	 * returns 'dasd_era_recover' erp_action() is called to create a361	 * special error recovery ccw. erp_postaction() is called after362	 * an error recovery ccw has finished its execution. dump_sense363	 * is called for every error condition to print the sense data364	 * to the console.365	 */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 *,369			    struct irb *);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 *,373					 struct irb *);374 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 *);379 380	/* reload device after state change */381	int (*reload) (struct dasd_device *);382 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);392 393	/*394	 * Extent Space Efficient (ESE) relevant functions395	 */396	int (*is_ese)(struct dasd_device *);397	/* Capacity */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 *);402	/* Extent Pool */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 *);416};417 418extern struct dasd_discipline *dasd_diag_discipline_pointer;419 420/* Trigger IDs for extended error reporting DASD EER and autoquiesce */421enum eer_trigger {422	DASD_EER_FATALERROR = 1,423	DASD_EER_NOPATH,424	DASD_EER_STATECHANGE,425	DASD_EER_PPRCSUSPEND,426	DASD_EER_NOSPC,427	DASD_EER_TIMEOUTS,428	DASD_EER_STARTIO,429 430	/* enum end marker, only add new trigger above */431	DASD_EER_MAX,432	DASD_EER_AUTOQUIESCE = 31, /* internal only */433};434 435#define DASD_EER_VALID ((1U << DASD_EER_MAX) - 1)436 437/* DASD path handling */438 439#define DASD_PATH_OPERATIONAL  1440#define DASD_PATH_TBV	       2441#define DASD_PATH_PP	       3442#define DASD_PATH_NPP	       4443#define DASD_PATH_MISCABLED    5444#define DASD_PATH_NOHPF        6445#define DASD_PATH_CUIR	       7446#define DASD_PATH_IFCC	       8447#define DASD_PATH_FCSEC	       9448 449#define DASD_THRHLD_MAX		4294967295U450#define DASD_INTERVAL_MAX	4294967295U451 452/* FC Endpoint Security Capabilities */453#define DASD_FC_SECURITY_UNSUP		0454#define DASD_FC_SECURITY_AUTH		1455#define DASD_FC_SECURITY_ENC_FCSP2	2456#define DASD_FC_SECURITY_ENC_ERAS	3457 458#define DASD_FC_SECURITY_ENC_STR	"Encryption"459static const struct {460	u8 value;461	char *name;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 },467};468 469static inline char *dasd_path_get_fcs_str(int val)470{471	int i;472 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;476	}477 478	return dasd_path_fcs_mnemonics[0].name;479}480 481struct dasd_path {482	unsigned long flags;483	u8 cssid;484	u8 ssid;485	u8 chpid;486	struct dasd_conf_data *conf_data;487	atomic_t error_count;488	unsigned long errorclk;489	u8 fc_security;490	struct kobject kobj;491	bool in_sysfs;492};493 494#define to_dasd_path(path) container_of(path, struct dasd_path, kobj)495 496static inline void dasd_path_release(struct kobject *kobj)497{498/* Memory for the dasd_path kobject is freed when dasd_free_device() is called */499}500 501 502struct 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 */514 515	/* new data */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 */533};534 535struct dasd_profile {536	struct dentry *dentry;537	struct dasd_profile_info *data;538	spinlock_t lock;539};540 541struct dasd_format_entry {542	struct list_head list;543	sector_t track;544};545 546struct dasd_device {547	/* Block device stuff. */548	struct dasd_block *block;549 550        unsigned int devindex;551	unsigned long flags;	   /* per device flags */552	unsigned short features;   /* copy of devmap-features (read-only!) */553 554	/* extended error reporting stuff (eer) */555	struct dasd_ccw_req *eer_cqr;556 557	/* Device discipline stuff. */558	struct dasd_discipline *discipline;559	struct dasd_discipline *base_discipline;560	void *private;561	struct dasd_path path[8];562	__u8 opm;563 564	/* Device state and target state. */565	int state, target;566	struct mutex state_mutex;567	int stopped;		/* device (ccw_device_start) was stopped */568 569	/* reference count. */570        atomic_t ref_count;571 572	/* ccw queue and memory for static ccw/erp buffers. */573	struct list_head ccw_queue;574	spinlock_t mem_lock;575	void *ccw_mem;576	void *erp_mem;577	void *ese_mem;578	struct list_head ccw_chunks;579	struct list_head erp_chunks;580	struct list_head ese_chunks;581 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;590 591	debug_info_t *debug_area;592 593	struct ccw_device *cdev;594 595	/* hook for alias management */596	struct list_head alias_list;597 598	/* default expiration time in s */599	unsigned long default_expires;600	unsigned long default_retries;601 602	unsigned long blk_timeout;603 604	unsigned long path_thrhld;605	unsigned long path_interval;606 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;615};616 617struct dasd_block {618	/* Block device stuff. */619	struct gendisk *gdp;620	spinlock_t request_queue_lock;621	struct blk_mq_tag_set tag_set;622	struct file *bdev_file;623	atomic_t open_count;624 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) */628 629	struct dasd_device *base;630	struct list_head ccw_queue;631	spinlock_t queue_lock;632 633	atomic_t tasklet_scheduled;634	struct tasklet_struct tasklet;635	struct timer_list timer;636 637	struct dentry *debugfs_dentry;638	struct dasd_profile profile;639 640	struct list_head format_list;641	spinlock_t format_lock;642	atomic_t trkcount;643};644 645struct dasd_attention_data {646	struct dasd_device *device;647	__u8 lpum;648};649 650struct dasd_queue {651	spinlock_t lock;652};653 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 */662 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't668					 * confuse this with the user specified669					 * read-only feature.670					 */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 */679 680#define DASD_SLEEPON_START_TAG	((void *) 1)681#define DASD_SLEEPON_END_TAG	((void *) 2)682 683void dasd_put_device_wake(struct dasd_device *);684 685/*686 * return values to be returned from the copy pair swap function687 * 0x00: swap successful688 * 0x01: swap data invalid689 * 0x02: no active device found690 * 0x03: wrong primary specified691 * 0x04: secondary device not found692 * 0x05: swap already running693 */694#define DASD_COPYPAIRSWAP_SUCCESS	0695#define DASD_COPYPAIRSWAP_INVALID	1696#define DASD_COPYPAIRSWAP_NOACTIVE	2697#define DASD_COPYPAIRSWAP_PRIMARY	3698#define DASD_COPYPAIRSWAP_SECONDARY	4699#define DASD_COPYPAIRSWAP_MULTIPLE	5700 701/*702 * Reference count inliners703 */704static inline void705dasd_get_device(struct dasd_device *device)706{707	atomic_inc(&device->ref_count);708}709 710static inline void711dasd_put_device(struct dasd_device *device)712{713	if (atomic_dec_return(&device->ref_count) == 0)714		dasd_put_device_wake(device);715}716 717/*718 * The static memory in ccw_mem and erp_mem is managed by a sorted719 * list of free memory chunks.720 */721struct dasd_mchunk722{723	struct list_head list;724	unsigned long size;725} __attribute__ ((aligned(8)));726 727static inline void728dasd_init_chunklist(struct list_head *chunk_list, void *mem,729		    unsigned long size)730{731	struct dasd_mchunk *chunk;732 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);737}738 739static inline void *740dasd_alloc_chunk(struct list_head *chunk_list, unsigned long size)741{742	struct dasd_mchunk *chunk, *tmp;743 744	size = (size + 7L) & -8L;745	list_for_each_entry(chunk, chunk_list, list) {746		if (chunk->size < size)747			continue;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;751			tmp->size = size;752			chunk->size -= size + sizeof(struct dasd_mchunk);753			chunk = tmp;754		} else755			list_del(&chunk->list);756		return (void *) (chunk + 1);757	}758	return NULL;759}760 761static inline void762dasd_free_chunk(struct list_head *chunk_list, void *mem)763{764	struct dasd_mchunk *chunk, *tmp;765	struct list_head *p, *left;766 767	chunk = (struct dasd_mchunk *)768		((char *) mem - sizeof(struct dasd_mchunk));769	/* Find out the left neighbour in chunk_list. */770	left = chunk_list;771	list_for_each(p, chunk_list) {772		if (list_entry(p, struct dasd_mchunk, list) > chunk)773			break;774		left = p;775	}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);782		}783	}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);789			return;790		}791	}792	__list_add(&chunk->list, left, left->next);793}794 795/*796 * Check if bsize is in { 512, 1024, 2048, 4096 }797 */798static inline int799dasd_check_blocksize(int bsize)800{801	if (bsize < 512 || bsize > 4096 || !is_power_of_2(bsize))802		return -EMEDIUMTYPE;803	return 0;804}805 806/*807 * return the callback data of the original request in case there are808 * ERP requests build on top of it809 */810static inline void *dasd_get_callback_data(struct dasd_ccw_req *cqr)811{812	while (cqr->refers)813		cqr = cqr->refers;814 815	return cqr->callback_data;816}817 818/* externals in dasd.c */819#define DASD_PROFILE_OFF	 0820#define DASD_PROFILE_ON 	 1821#define DASD_PROFILE_GLOBAL_ONLY 2822 823extern debug_info_t *dasd_debug_area;824extern struct dasd_profile dasd_global_profile;825extern unsigned int dasd_global_profile_level;826extern const struct block_device_operations dasd_device_operations;827extern struct blk_mq_ops dasd_mq_ops;828 829extern struct kmem_cache *dasd_page_cache;830 831struct dasd_ccw_req *832dasd_smalloc_request(int, int, int, struct dasd_device *, struct dasd_ccw_req *);833struct dasd_ccw_req *dasd_fmalloc_request(int, int, int, struct dasd_device *);834void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *);835void dasd_ffree_request(struct dasd_ccw_req *, struct dasd_device *);836void dasd_wakeup_cb(struct dasd_ccw_req *, void *);837 838struct dasd_device *dasd_alloc_device(void);839void dasd_free_device(struct dasd_device *);840 841struct dasd_block *dasd_alloc_block(void);842void dasd_free_block(struct dasd_block *);843 844enum blk_eh_timer_return dasd_times_out(struct request *req);845 846void dasd_enable_device(struct dasd_device *);847void dasd_set_target_state(struct dasd_device *, int);848void dasd_kick_device(struct dasd_device *);849void dasd_reload_device(struct dasd_device *);850void dasd_schedule_requeue(struct dasd_device *);851 852void dasd_add_request_head(struct dasd_ccw_req *);853void dasd_add_request_tail(struct dasd_ccw_req *);854int  dasd_start_IO(struct dasd_ccw_req *);855int  dasd_term_IO(struct dasd_ccw_req *);856void dasd_schedule_device_bh(struct dasd_device *);857void dasd_schedule_block_bh(struct dasd_block *);858int  dasd_sleep_on(struct dasd_ccw_req *);859int  dasd_sleep_on_queue(struct list_head *);860int  dasd_sleep_on_immediatly(struct dasd_ccw_req *);861int  dasd_sleep_on_queue_interruptible(struct list_head *);862int  dasd_sleep_on_interruptible(struct dasd_ccw_req *);863void dasd_device_set_timer(struct dasd_device *, int);864void dasd_device_clear_timer(struct dasd_device *);865void dasd_block_set_timer(struct dasd_block *, int);866void dasd_block_clear_timer(struct dasd_block *);867int  dasd_cancel_req(struct dasd_ccw_req *);868int dasd_flush_device_queue(struct dasd_device *);869int dasd_generic_probe(struct ccw_device *);870void dasd_generic_free_discipline(struct dasd_device *);871void dasd_generic_remove (struct ccw_device *cdev);872int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *);873int dasd_generic_set_offline (struct ccw_device *cdev);874int dasd_generic_notify(struct ccw_device *, int);875int dasd_generic_last_path_gone(struct dasd_device *);876int dasd_generic_path_operational(struct dasd_device *);877void dasd_generic_shutdown(struct ccw_device *);878 879void dasd_generic_handle_state_change(struct dasd_device *);880enum uc_todo dasd_generic_uc_handler(struct ccw_device *, struct irb *);881void dasd_generic_path_event(struct ccw_device *, int *);882int dasd_generic_verify_path(struct dasd_device *, __u8);883void dasd_generic_space_exhaust(struct dasd_device *, struct dasd_ccw_req *);884void dasd_generic_space_avail(struct dasd_device *);885 886int dasd_generic_requeue_all_requests(struct dasd_device *);887 888int dasd_generic_read_dev_chars(struct dasd_device *, int, void *, int);889char *dasd_get_sense(struct irb *);890 891void dasd_device_set_stop_bits(struct dasd_device *, int);892void dasd_device_remove_stop_bits(struct dasd_device *, int);893 894int dasd_device_is_ro(struct dasd_device *);895 896void dasd_profile_reset(struct dasd_profile *);897int dasd_profile_on(struct dasd_profile *);898void dasd_profile_off(struct dasd_profile *);899char *dasd_get_user_string(const char __user *, size_t);900 901/* externals in dasd_devmap.c */902extern int dasd_max_devindex;903extern int dasd_probeonly;904extern int dasd_autodetect;905extern int dasd_nopav;906extern int dasd_nofcx;907 908int dasd_devmap_init(void);909void dasd_devmap_exit(void);910 911struct dasd_device *dasd_create_device(struct ccw_device *);912void dasd_delete_device(struct dasd_device *);913 914int dasd_get_feature(struct ccw_device *, int);915int dasd_set_feature(struct ccw_device *, int, int);916 917extern const struct attribute_group *dasd_dev_groups[];918void dasd_path_create_kobj(struct dasd_device *, int);919void dasd_path_create_kobjects(struct dasd_device *);920void dasd_path_remove_kobjects(struct dasd_device *);921 922struct dasd_device *dasd_device_from_cdev(struct ccw_device *);923struct dasd_device *dasd_device_from_cdev_locked(struct ccw_device *);924struct dasd_device *dasd_device_from_devindex(int);925 926void dasd_add_link_to_gendisk(struct gendisk *, struct dasd_device *);927struct dasd_device *dasd_device_from_gendisk(struct gendisk *);928 929int dasd_parse(void) __init;930int dasd_busid_known(const char *);931 932/* externals in dasd_gendisk.c */933int  dasd_gendisk_init(void);934void dasd_gendisk_exit(void);935int dasd_gendisk_alloc(struct dasd_block *);936void dasd_gendisk_free(struct dasd_block *);937int dasd_scan_partitions(struct dasd_block *);938void dasd_destroy_partitions(struct dasd_block *);939 940/* externals in dasd_ioctl.c */941int dasd_ioctl(struct block_device *bdev, blk_mode_t mode, unsigned int cmd,942		unsigned long arg);943int dasd_set_read_only(struct block_device *bdev, bool ro);944 945/* externals in dasd_proc.c */946int dasd_proc_init(void);947void dasd_proc_exit(void);948 949/* externals in dasd_erp.c */950struct dasd_ccw_req *dasd_default_erp_action(struct dasd_ccw_req *);951struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *);952struct dasd_ccw_req *dasd_alloc_erp_request(unsigned int, int, int,953					    struct dasd_device *);954void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *);955void dasd_log_sense(struct dasd_ccw_req *, struct irb *);956void dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb);957 958/* externals in dasd_3990_erp.c */959struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *);960void dasd_3990_erp_handle_sim(struct dasd_device *, char *);961 962/* externals in dasd_eer.c */963#ifdef CONFIG_DASD_EER964int dasd_eer_init(void);965void dasd_eer_exit(void);966int dasd_eer_enable(struct dasd_device *);967void dasd_eer_disable(struct dasd_device *);968void dasd_eer_write(struct dasd_device *, struct dasd_ccw_req *cqr,969		    unsigned int id);970void dasd_eer_snss(struct dasd_device *);971 972static inline int dasd_eer_enabled(struct dasd_device *device)973{974	return device->eer_cqr != NULL;975}976#else977#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 */985 986 987/* DASD path handling functions */988 989/*990 * helper functions to modify bit masks for a given channel path for a device991 */992static inline int dasd_path_is_operational(struct dasd_device *device, int chp)993{994	return test_bit(DASD_PATH_OPERATIONAL, &device->path[chp].flags);995}996 997static inline int dasd_path_need_verify(struct dasd_device *device, int chp)998{999	return test_bit(DASD_PATH_TBV, &device->path[chp].flags);1000}1001 1002static inline void dasd_path_verify(struct dasd_device *device, int chp)1003{1004	__set_bit(DASD_PATH_TBV, &device->path[chp].flags);1005}1006 1007static inline void dasd_path_clear_verify(struct dasd_device *device, int chp)1008{1009	__clear_bit(DASD_PATH_TBV, &device->path[chp].flags);1010}1011 1012static inline void dasd_path_clear_all_verify(struct dasd_device *device)1013{1014	int chp;1015 1016	for (chp = 0; chp < 8; chp++)1017		dasd_path_clear_verify(device, chp);1018}1019 1020static inline void dasd_path_fcsec(struct dasd_device *device, int chp)1021{1022	__set_bit(DASD_PATH_FCSEC, &device->path[chp].flags);1023}1024 1025static inline void dasd_path_clear_fcsec(struct dasd_device *device, int chp)1026{1027	__clear_bit(DASD_PATH_FCSEC, &device->path[chp].flags);1028}1029 1030static inline int dasd_path_need_fcsec(struct dasd_device *device, int chp)1031{1032	return test_bit(DASD_PATH_FCSEC, &device->path[chp].flags);1033}1034 1035static inline void dasd_path_clear_all_fcsec(struct dasd_device *device)1036{1037	int chp;1038 1039	for (chp = 0; chp < 8; chp++)1040		dasd_path_clear_fcsec(device, chp);1041}1042 1043static inline void dasd_path_operational(struct dasd_device *device, int chp)1044{1045	__set_bit(DASD_PATH_OPERATIONAL, &device->path[chp].flags);1046	device->opm |= (0x80 >> chp);1047}1048 1049static inline void dasd_path_nonpreferred(struct dasd_device *device, int chp)1050{1051	__set_bit(DASD_PATH_NPP, &device->path[chp].flags);1052}1053 1054static inline int dasd_path_is_nonpreferred(struct dasd_device *device, int chp)1055{1056	return test_bit(DASD_PATH_NPP, &device->path[chp].flags);1057}1058 1059static inline void dasd_path_clear_nonpreferred(struct dasd_device *device,1060						int chp)1061{1062	__clear_bit(DASD_PATH_NPP, &device->path[chp].flags);1063}1064 1065static inline void dasd_path_preferred(struct dasd_device *device, int chp)1066{1067	__set_bit(DASD_PATH_PP, &device->path[chp].flags);1068}1069 1070static inline int dasd_path_is_preferred(struct dasd_device *device, int chp)1071{1072	return test_bit(DASD_PATH_PP, &device->path[chp].flags);1073}1074 1075static inline void dasd_path_clear_preferred(struct dasd_device *device,1076					     int chp)1077{1078	__clear_bit(DASD_PATH_PP, &device->path[chp].flags);1079}1080 1081static inline void dasd_path_clear_oper(struct dasd_device *device, int chp)1082{1083	__clear_bit(DASD_PATH_OPERATIONAL, &device->path[chp].flags);1084	device->opm &= ~(0x80 >> chp);1085}1086 1087static inline void dasd_path_clear_cable(struct dasd_device *device, int chp)1088{1089	__clear_bit(DASD_PATH_MISCABLED, &device->path[chp].flags);1090}1091 1092static inline void dasd_path_cuir(struct dasd_device *device, int chp)1093{1094	__set_bit(DASD_PATH_CUIR, &device->path[chp].flags);1095}1096 1097static inline int dasd_path_is_cuir(struct dasd_device *device, int chp)1098{1099	return test_bit(DASD_PATH_CUIR, &device->path[chp].flags);1100}1101 1102static inline void dasd_path_clear_cuir(struct dasd_device *device, int chp)1103{1104	__clear_bit(DASD_PATH_CUIR, &device->path[chp].flags);1105}1106 1107static inline void dasd_path_ifcc(struct dasd_device *device, int chp)1108{1109	set_bit(DASD_PATH_IFCC, &device->path[chp].flags);1110}1111 1112static inline int dasd_path_is_ifcc(struct dasd_device *device, int chp)1113{1114	return test_bit(DASD_PATH_IFCC, &device->path[chp].flags);1115}1116 1117static inline void dasd_path_clear_ifcc(struct dasd_device *device, int chp)1118{1119	clear_bit(DASD_PATH_IFCC, &device->path[chp].flags);1120}1121 1122static inline void dasd_path_clear_nohpf(struct dasd_device *device, int chp)1123{1124	__clear_bit(DASD_PATH_NOHPF, &device->path[chp].flags);1125}1126 1127static inline void dasd_path_miscabled(struct dasd_device *device, int chp)1128{1129	__set_bit(DASD_PATH_MISCABLED, &device->path[chp].flags);1130}1131 1132static inline int dasd_path_is_miscabled(struct dasd_device *device, int chp)1133{1134	return test_bit(DASD_PATH_MISCABLED, &device->path[chp].flags);1135}1136 1137static inline void dasd_path_nohpf(struct dasd_device *device, int chp)1138{1139	__set_bit(DASD_PATH_NOHPF, &device->path[chp].flags);1140}1141 1142static inline int dasd_path_is_nohpf(struct dasd_device *device, int chp)1143{1144	return test_bit(DASD_PATH_NOHPF, &device->path[chp].flags);1145}1146 1147/*1148 * get functions for path masks1149 * will return a path masks for the given device1150 */1151 1152static inline __u8 dasd_path_get_opm(struct dasd_device *device)1153{1154	return device->opm;1155}1156 1157static inline __u8 dasd_path_get_tbvpm(struct dasd_device *device)1158{1159	int chp;1160	__u8 tbvpm = 0x00;1161 1162	for (chp = 0; chp < 8; chp++)1163		if (dasd_path_need_verify(device, chp))1164			tbvpm |= 0x80 >> chp;1165	return tbvpm;1166}1167 1168static inline int dasd_path_get_fcsecpm(struct dasd_device *device)1169{1170	int chp;1171 1172	for (chp = 0; chp < 8; chp++)1173		if (dasd_path_need_fcsec(device, chp))1174			return 1;1175 1176	return 0;1177}1178 1179static inline __u8 dasd_path_get_nppm(struct dasd_device *device)1180{1181	int chp;1182	__u8 npm = 0x00;1183 1184	for (chp = 0; chp < 8; chp++) {1185		if (dasd_path_is_nonpreferred(device, chp))1186			npm |= 0x80 >> chp;1187	}1188	return npm;1189}1190 1191static inline __u8 dasd_path_get_ppm(struct dasd_device *device)1192{1193	int chp;1194	__u8 ppm = 0x00;1195 1196	for (chp = 0; chp < 8; chp++)1197		if (dasd_path_is_preferred(device, chp))1198			ppm |= 0x80 >> chp;1199	return ppm;1200}1201 1202static inline __u8 dasd_path_get_cablepm(struct dasd_device *device)1203{1204	int chp;1205	__u8 cablepm = 0x00;1206 1207	for (chp = 0; chp < 8; chp++)1208		if (dasd_path_is_miscabled(device, chp))1209			cablepm |= 0x80 >> chp;1210	return cablepm;1211}1212 1213static inline __u8 dasd_path_get_cuirpm(struct dasd_device *device)1214{1215	int chp;1216	__u8 cuirpm = 0x00;1217 1218	for (chp = 0; chp < 8; chp++)1219		if (dasd_path_is_cuir(device, chp))1220			cuirpm |= 0x80 >> chp;1221	return cuirpm;1222}1223 1224static inline __u8 dasd_path_get_ifccpm(struct dasd_device *device)1225{1226	int chp;1227	__u8 ifccpm = 0x00;1228 1229	for (chp = 0; chp < 8; chp++)1230		if (dasd_path_is_ifcc(device, chp))1231			ifccpm |= 0x80 >> chp;1232	return ifccpm;1233}1234 1235static inline __u8 dasd_path_get_hpfpm(struct dasd_device *device)1236{1237	int chp;1238	__u8 hpfpm = 0x00;1239 1240	for (chp = 0; chp < 8; chp++)1241		if (dasd_path_is_nohpf(device, chp))1242			hpfpm |= 0x80 >> chp;1243	return hpfpm;1244}1245 1246static inline u8 dasd_path_get_fcs_path(struct dasd_device *device, int chp)1247{1248	return device->path[chp].fc_security;1249}1250 1251static inline int dasd_path_get_fcs_device(struct dasd_device *device)1252{1253	u8 fc_sec = 0;1254	int chp;1255 1256	for (chp = 0; chp < 8; chp++) {1257		if (device->opm & (0x80 >> chp)) {1258			fc_sec = device->path[chp].fc_security;1259			break;1260		}1261	}1262	for (; chp < 8; chp++) {1263		if (device->opm & (0x80 >> chp))1264			if (device->path[chp].fc_security != fc_sec)1265				return -EINVAL;1266	}1267 1268	return fc_sec;1269}1270 1271/*1272 * add functions for path masks1273 * the existing path mask will be extended by the given path mask1274 */1275static inline void dasd_path_add_tbvpm(struct dasd_device *device, __u8 pm)1276{1277	int chp;1278 1279	for (chp = 0; chp < 8; chp++)1280		if (pm & (0x80 >> chp))1281			dasd_path_verify(device, chp);1282}1283 1284static inline __u8 dasd_path_get_notoperpm(struct dasd_device *device)1285{1286	int chp;1287	__u8 nopm = 0x00;1288 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;1295	return nopm;1296}1297 1298static inline void dasd_path_add_opm(struct dasd_device *device, __u8 pm)1299{1300	int chp;1301 1302	for (chp = 0; chp < 8; chp++)1303		if (pm & (0x80 >> chp)) {1304			dasd_path_operational(device, chp);1305			/*1306			 * if the path is used1307			 * it should not be in one of the negative lists1308			 */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);1313		}1314}1315 1316static inline void dasd_path_add_cablepm(struct dasd_device *device, __u8 pm)1317{1318	int chp;1319 1320	for (chp = 0; chp < 8; chp++)1321		if (pm & (0x80 >> chp))1322			dasd_path_miscabled(device, chp);1323}1324 1325static inline void dasd_path_add_cuirpm(struct dasd_device *device, __u8 pm)1326{1327	int chp;1328 1329	for (chp = 0; chp < 8; chp++)1330		if (pm & (0x80 >> chp))1331			dasd_path_cuir(device, chp);1332}1333 1334static inline void dasd_path_add_ifccpm(struct dasd_device *device, __u8 pm)1335{1336	int chp;1337 1338	for (chp = 0; chp < 8; chp++)1339		if (pm & (0x80 >> chp))1340			dasd_path_ifcc(device, chp);1341}1342 1343static inline void dasd_path_add_nppm(struct dasd_device *device, __u8 pm)1344{1345	int chp;1346 1347	for (chp = 0; chp < 8; chp++)1348		if (pm & (0x80 >> chp))1349			dasd_path_nonpreferred(device, chp);1350}1351 1352static inline void dasd_path_add_nohpfpm(struct dasd_device *device, __u8 pm)1353{1354	int chp;1355 1356	for (chp = 0; chp < 8; chp++)1357		if (pm & (0x80 >> chp))1358			dasd_path_nohpf(device, chp);1359}1360 1361static inline void dasd_path_add_ppm(struct dasd_device *device, __u8 pm)1362{1363	int chp;1364 1365	for (chp = 0; chp < 8; chp++)1366		if (pm & (0x80 >> chp))1367			dasd_path_preferred(device, chp);1368}1369 1370static inline void dasd_path_add_fcsecpm(struct dasd_device *device, __u8 pm)1371{1372	int chp;1373 1374	for (chp = 0; chp < 8; chp++)1375		if (pm & (0x80 >> chp))1376			dasd_path_fcsec(device, chp);1377}1378 1379/*1380 * set functions for path masks1381 * the existing path mask will be replaced by the given path mask1382 */1383static inline void dasd_path_set_tbvpm(struct dasd_device *device, __u8 pm)1384{1385	int chp;1386 1387	for (chp = 0; chp < 8; chp++)1388		if (pm & (0x80 >> chp))1389			dasd_path_verify(device, chp);1390		else1391			dasd_path_clear_verify(device, chp);1392}1393 1394static inline void dasd_path_set_opm(struct dasd_device *device, __u8 pm)1395{1396	int chp;1397 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);1402			/*1403			 * if the path is used1404			 * it should not be in one of the negative lists1405			 */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);1410		}1411	}1412}1413 1414/*1415 * remove functions for path masks1416 * the existing path mask will be cleared with the given path mask1417 */1418static inline void dasd_path_remove_opm(struct dasd_device *device, __u8 pm)1419{1420	int chp;1421 1422	for (chp = 0; chp < 8; chp++) {1423		if (pm & (0x80 >> chp))1424			dasd_path_clear_oper(device, chp);1425	}1426}1427 1428/*1429 * add the newly available path to the to be verified pm and remove it from1430 * normal operation until it is verified1431 */1432static inline void dasd_path_available(struct dasd_device *device, int chp)1433{1434	dasd_path_clear_oper(device, chp);1435	dasd_path_verify(device, chp);1436}1437 1438static inline void dasd_path_notoper(struct dasd_device *device, int chp)1439{1440	dasd_path_clear_oper(device, chp);1441	dasd_path_clear_preferred(device, chp);1442	dasd_path_clear_nonpreferred(device, chp);1443}1444 1445static inline void dasd_path_fcsec_update(struct dasd_device *device, int chp)1446{1447	dasd_path_fcsec(device, chp);1448}1449 1450/*1451 * remove all paths from normal operation1452 */1453static inline void dasd_path_no_path(struct dasd_device *device)1454{1455	int chp;1456 1457	for (chp = 0; chp < 8; chp++)1458		dasd_path_notoper(device, chp);1459 1460	dasd_path_clear_all_verify(device);1461}1462 1463/* end - path handling */1464 1465#endif				/* DASD_H */1466