Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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