xref: /linux/drivers/s390/char/tape.h (revision 9c6c273aa4248c60569de6ef7e7e9c7bed3cd32e)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  *    tape device driver for 3480/3490E/3590 tapes.
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  *  S390 and zSeries version
53ef32e62SFrank Munzert  *    Copyright IBM Corp. 2001, 2009
61da177e4SLinus Torvalds  *    Author(s): Carsten Otte <cotte@de.ibm.com>
71da177e4SLinus Torvalds  *		 Tuan Ngo-Anh <ngoanh@de.ibm.com>
81da177e4SLinus Torvalds  *		 Martin Schwidefsky <schwidefsky@de.ibm.com>
94111796dSStefan Bader  *		 Stefan Bader <shbader@de.ibm.com>
101da177e4SLinus Torvalds  */
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds #ifndef _TAPE_H
131da177e4SLinus Torvalds #define _TAPE_H
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds #include <asm/ccwdev.h>
161da177e4SLinus Torvalds #include <asm/debug.h>
171da177e4SLinus Torvalds #include <asm/idals.h>
181da177e4SLinus Torvalds #include <linux/kernel.h>
191da177e4SLinus Torvalds #include <linux/module.h>
201da177e4SLinus Torvalds #include <linux/mtio.h>
211da177e4SLinus Torvalds #include <linux/interrupt.h>
221da177e4SLinus Torvalds #include <linux/workqueue.h>
231da177e4SLinus Torvalds 
241da177e4SLinus Torvalds struct gendisk;
251da177e4SLinus Torvalds 
261da177e4SLinus Torvalds /*
271da177e4SLinus Torvalds  * Define DBF_LIKE_HELL for lots of messages in the debug feature.
281da177e4SLinus Torvalds  */
291da177e4SLinus Torvalds #define DBF_LIKE_HELL
301da177e4SLinus Torvalds #ifdef  DBF_LIKE_HELL
311da177e4SLinus Torvalds #define DBF_LH(level, str, ...) \
321da177e4SLinus Torvalds do { \
331da177e4SLinus Torvalds 	debug_sprintf_event(TAPE_DBF_AREA, level, str, ## __VA_ARGS__); \
341da177e4SLinus Torvalds } while (0)
351da177e4SLinus Torvalds #else
361da177e4SLinus Torvalds #define DBF_LH(level, str, ...) do {} while(0)
371da177e4SLinus Torvalds #endif
381da177e4SLinus Torvalds 
391da177e4SLinus Torvalds /*
401da177e4SLinus Torvalds  * macros s390 debug feature (dbf)
411da177e4SLinus Torvalds  */
421da177e4SLinus Torvalds #define DBF_EVENT(d_level, d_str...) \
431da177e4SLinus Torvalds do { \
441da177e4SLinus Torvalds 	debug_sprintf_event(TAPE_DBF_AREA, d_level, d_str); \
451da177e4SLinus Torvalds } while (0)
461da177e4SLinus Torvalds 
471da177e4SLinus Torvalds #define DBF_EXCEPTION(d_level, d_str...) \
481da177e4SLinus Torvalds do { \
491da177e4SLinus Torvalds 	debug_sprintf_exception(TAPE_DBF_AREA, d_level, d_str); \
501da177e4SLinus Torvalds } while (0)
511da177e4SLinus Torvalds 
521da177e4SLinus Torvalds #define TAPE_VERSION_MAJOR 2
531da177e4SLinus Torvalds #define TAPE_VERSION_MINOR 0
541da177e4SLinus Torvalds #define TAPE_MAGIC "tape"
551da177e4SLinus Torvalds 
561da177e4SLinus Torvalds #define TAPE_MINORS_PER_DEV 2	    /* two minors per device */
571da177e4SLinus Torvalds #define TAPEBLOCK_HSEC_SIZE	2048
581da177e4SLinus Torvalds #define TAPEBLOCK_HSEC_S2B	2
591da177e4SLinus Torvalds #define TAPEBLOCK_RETRIES	5
601da177e4SLinus Torvalds 
611da177e4SLinus Torvalds enum tape_medium_state {
621da177e4SLinus Torvalds 	MS_UNKNOWN,
631da177e4SLinus Torvalds 	MS_LOADED,
641da177e4SLinus Torvalds 	MS_UNLOADED,
651da177e4SLinus Torvalds 	MS_SIZE
661da177e4SLinus Torvalds };
671da177e4SLinus Torvalds 
681da177e4SLinus Torvalds enum tape_state {
691da177e4SLinus Torvalds 	TS_UNUSED=0,
701da177e4SLinus Torvalds 	TS_IN_USE,
711da177e4SLinus Torvalds 	TS_BLKUSE,
721da177e4SLinus Torvalds 	TS_INIT,
731da177e4SLinus Torvalds 	TS_NOT_OPER,
741da177e4SLinus Torvalds 	TS_SIZE
751da177e4SLinus Torvalds };
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds enum tape_op {
781da177e4SLinus Torvalds 	TO_BLOCK,	/* Block read */
791da177e4SLinus Torvalds 	TO_BSB,		/* Backward space block */
801da177e4SLinus Torvalds 	TO_BSF,		/* Backward space filemark */
811da177e4SLinus Torvalds 	TO_DSE,		/* Data security erase */
821da177e4SLinus Torvalds 	TO_FSB,		/* Forward space block */
831da177e4SLinus Torvalds 	TO_FSF,		/* Forward space filemark */
841da177e4SLinus Torvalds 	TO_LBL,		/* Locate block label */
851da177e4SLinus Torvalds 	TO_NOP,		/* No operation */
861da177e4SLinus Torvalds 	TO_RBA,		/* Read backward */
871da177e4SLinus Torvalds 	TO_RBI,		/* Read block information */
881da177e4SLinus Torvalds 	TO_RFO,		/* Read forward */
891da177e4SLinus Torvalds 	TO_REW,		/* Rewind tape */
901da177e4SLinus Torvalds 	TO_RUN,		/* Rewind and unload tape */
911da177e4SLinus Torvalds 	TO_WRI,		/* Write block */
921da177e4SLinus Torvalds 	TO_WTM,		/* Write tape mark */
931da177e4SLinus Torvalds 	TO_MSEN,	/* Medium sense */
941da177e4SLinus Torvalds 	TO_LOAD,	/* Load tape */
951da177e4SLinus Torvalds 	TO_READ_CONFIG, /* Read configuration data */
961da177e4SLinus Torvalds 	TO_READ_ATTMSG, /* Read attention message */
971da177e4SLinus Torvalds 	TO_DIS,		/* Tape display */
981da177e4SLinus Torvalds 	TO_ASSIGN,	/* Assign tape to channel path */
991da177e4SLinus Torvalds 	TO_UNASSIGN,	/* Unassign tape from channel path */
100cced1dd4SMichael Holzheu 	TO_CRYPT_ON,	/* Enable encrpytion */
101cced1dd4SMichael Holzheu 	TO_CRYPT_OFF,	/* Disable encrpytion */
102cced1dd4SMichael Holzheu 	TO_KEKL_SET,	/* Set KEK label */
103cced1dd4SMichael Holzheu 	TO_KEKL_QUERY,	/* Query KEK label */
104e2963062SMichael Holzheu 	TO_RDC,		/* Read device characteristics */
105cced1dd4SMichael Holzheu 	TO_SIZE,	/* #entries in tape_op_t */
1061da177e4SLinus Torvalds };
1071da177e4SLinus Torvalds 
1081da177e4SLinus Torvalds /* Forward declaration */
1091da177e4SLinus Torvalds struct tape_device;
1101da177e4SLinus Torvalds 
1111da177e4SLinus Torvalds /* tape_request->status can be: */
1121da177e4SLinus Torvalds enum tape_request_status {
1131da177e4SLinus Torvalds 	TAPE_REQUEST_INIT,	/* request is ready to be processed */
1141da177e4SLinus Torvalds 	TAPE_REQUEST_QUEUED,	/* request is queued to be processed */
1151da177e4SLinus Torvalds 	TAPE_REQUEST_IN_IO,	/* request is currently in IO */
1161da177e4SLinus Torvalds 	TAPE_REQUEST_DONE,	/* request is completed. */
1174111796dSStefan Bader 	TAPE_REQUEST_CANCEL,	/* request should be canceled. */
118cced1dd4SMichael Holzheu 	TAPE_REQUEST_LONG_BUSY, /* request has to be restarted after long busy */
1191da177e4SLinus Torvalds };
1201da177e4SLinus Torvalds 
1211da177e4SLinus Torvalds /* Tape CCW request */
1221da177e4SLinus Torvalds struct tape_request {
1231da177e4SLinus Torvalds 	struct list_head list;		/* list head for request queueing. */
1241da177e4SLinus Torvalds 	struct tape_device *device;	/* tape device of this request */
1251da177e4SLinus Torvalds 	struct ccw1 *cpaddr;		/* address of the channel program. */
1261da177e4SLinus Torvalds 	void *cpdata;			/* pointer to ccw data. */
1271da177e4SLinus Torvalds 	enum tape_request_status status;/* status of this request */
1281da177e4SLinus Torvalds 	int options;			/* options for execution. */
1291da177e4SLinus Torvalds 	int retries;			/* retry counter for error recovery. */
1301da177e4SLinus Torvalds 	int rescnt;			/* residual count from devstat. */
131*9c6c273aSKees Cook 	struct timer_list timer;	/* timer for std_assign_timeout(). */
1321da177e4SLinus Torvalds 
1331da177e4SLinus Torvalds 	/* Callback for delivering final status. */
1341da177e4SLinus Torvalds 	void (*callback)(struct tape_request *, void *);
1351da177e4SLinus Torvalds 	void *callback_data;
1361da177e4SLinus Torvalds 
1371da177e4SLinus Torvalds 	enum tape_op op;
1381da177e4SLinus Torvalds 	int rc;
1391da177e4SLinus Torvalds };
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds /* Function type for magnetic tape commands */
1421da177e4SLinus Torvalds typedef int (*tape_mtop_fn)(struct tape_device *, int);
1431da177e4SLinus Torvalds 
1441da177e4SLinus Torvalds /* Size of the array containing the mtops for a discipline */
1451da177e4SLinus Torvalds #define TAPE_NR_MTOPS (MTMKPART+1)
1461da177e4SLinus Torvalds 
1471da177e4SLinus Torvalds /* Tape Discipline */
1481da177e4SLinus Torvalds struct tape_discipline {
1491da177e4SLinus Torvalds 	struct module *owner;
1501da177e4SLinus Torvalds 	int  (*setup_device)(struct tape_device *);
1511da177e4SLinus Torvalds 	void (*cleanup_device)(struct tape_device *);
1521da177e4SLinus Torvalds 	int (*irq)(struct tape_device *, struct tape_request *, struct irb *);
1531da177e4SLinus Torvalds 	struct tape_request *(*read_block)(struct tape_device *, size_t);
1541da177e4SLinus Torvalds 	struct tape_request *(*write_block)(struct tape_device *, size_t);
1551da177e4SLinus Torvalds 	void (*process_eov)(struct tape_device*);
1561da177e4SLinus Torvalds 	/* ioctl function for additional ioctls. */
1571da177e4SLinus Torvalds 	int (*ioctl_fn)(struct tape_device *, unsigned int, unsigned long);
1581da177e4SLinus Torvalds 	/* Array of tape commands with TAPE_NR_MTOPS entries */
1591da177e4SLinus Torvalds 	tape_mtop_fn *mtop_array;
1601da177e4SLinus Torvalds };
1611da177e4SLinus Torvalds 
1621da177e4SLinus Torvalds /*
1631da177e4SLinus Torvalds  * The discipline irq function either returns an error code (<0) which
1641da177e4SLinus Torvalds  * means that the request has failed with an error or one of the following:
1651da177e4SLinus Torvalds  */
1661da177e4SLinus Torvalds #define TAPE_IO_SUCCESS		0	/* request successful */
1671da177e4SLinus Torvalds #define TAPE_IO_PENDING		1	/* request still running */
1681da177e4SLinus Torvalds #define TAPE_IO_RETRY		2	/* retry to current request */
1691da177e4SLinus Torvalds #define TAPE_IO_STOP		3	/* stop the running request */
170cced1dd4SMichael Holzheu #define TAPE_IO_LONG_BUSY	4	/* delay the running request */
1711da177e4SLinus Torvalds 
1721da177e4SLinus Torvalds /* Char Frontend Data */
1731da177e4SLinus Torvalds struct tape_char_data {
1741da177e4SLinus Torvalds 	struct idal_buffer *idal_buf;	/* idal buffer for user char data */
1751da177e4SLinus Torvalds 	int block_size;			/*   of size block_size. */
1761da177e4SLinus Torvalds };
1771da177e4SLinus Torvalds 
1781da177e4SLinus Torvalds /* Tape Info */
1791da177e4SLinus Torvalds struct tape_device {
1801da177e4SLinus Torvalds 	/* entry in tape_device_list */
1811da177e4SLinus Torvalds 	struct list_head		node;
1821da177e4SLinus Torvalds 
1831da177e4SLinus Torvalds 	int				cdev_id;
1841da177e4SLinus Torvalds 	struct ccw_device *		cdev;
1851da177e4SLinus Torvalds 	struct tape_class_device *	nt;
1861da177e4SLinus Torvalds 	struct tape_class_device *	rt;
1871da177e4SLinus Torvalds 
188369a4632SMartin Schwidefsky 	/* Device mutex to serialize tape commands. */
189369a4632SMartin Schwidefsky 	struct mutex			mutex;
190369a4632SMartin Schwidefsky 
1911da177e4SLinus Torvalds 	/* Device discipline information. */
1921da177e4SLinus Torvalds 	struct tape_discipline *	discipline;
1931da177e4SLinus Torvalds 	void *				discdata;
1941da177e4SLinus Torvalds 
1951da177e4SLinus Torvalds 	/* Generic status flags */
1961da177e4SLinus Torvalds 	long				tape_generic_status;
1971da177e4SLinus Torvalds 
1981da177e4SLinus Torvalds 	/* Device state information. */
1991da177e4SLinus Torvalds 	wait_queue_head_t		state_change_wq;
2001da177e4SLinus Torvalds 	enum tape_state			tape_state;
2011da177e4SLinus Torvalds 	enum tape_medium_state		medium_state;
2021da177e4SLinus Torvalds 	unsigned char *			modeset_byte;
2031da177e4SLinus Torvalds 
2041da177e4SLinus Torvalds 	/* Reference count. */
2051da177e4SLinus Torvalds 	atomic_t			ref_count;
2061da177e4SLinus Torvalds 
2071da177e4SLinus Torvalds 	/* Request queue. */
2081da177e4SLinus Torvalds 	struct list_head		req_queue;
2091da177e4SLinus Torvalds 
2104657fb8aSMartin Schwidefsky 	/* Request wait queue. */
2114657fb8aSMartin Schwidefsky 	wait_queue_head_t		wait_queue;
2124657fb8aSMartin Schwidefsky 
2131da177e4SLinus Torvalds 	/* Each tape device has (currently) two minor numbers. */
2141da177e4SLinus Torvalds 	int				first_minor;
2151da177e4SLinus Torvalds 
2161da177e4SLinus Torvalds 	/* Number of tapemarks required for correct termination. */
2171da177e4SLinus Torvalds 	int				required_tapemarks;
2181da177e4SLinus Torvalds 
2191da177e4SLinus Torvalds 	/* Block ID of the BOF */
2201da177e4SLinus Torvalds 	unsigned int			bof;
2211da177e4SLinus Torvalds 
2221da177e4SLinus Torvalds 	/* Character device frontend data */
2231da177e4SLinus Torvalds 	struct tape_char_data		char_data;
2244111796dSStefan Bader 
2254111796dSStefan Bader 	/* Function to start or stop the next request later. */
226c1637532SMartin Schwidefsky 	struct delayed_work		tape_dnr;
227cced1dd4SMichael Holzheu 
228cced1dd4SMichael Holzheu 	/* Timer for long busy */
229cced1dd4SMichael Holzheu 	struct timer_list		lb_timeout;
230cced1dd4SMichael Holzheu 
2311da177e4SLinus Torvalds };
2321da177e4SLinus Torvalds 
2331da177e4SLinus Torvalds /* Externals from tape_core.c */
2341da177e4SLinus Torvalds extern struct tape_request *tape_alloc_request(int cplength, int datasize);
2351da177e4SLinus Torvalds extern void tape_free_request(struct tape_request *);
2361da177e4SLinus Torvalds extern int tape_do_io(struct tape_device *, struct tape_request *);
2371da177e4SLinus Torvalds extern int tape_do_io_async(struct tape_device *, struct tape_request *);
2381da177e4SLinus Torvalds extern int tape_do_io_interruptible(struct tape_device *, struct tape_request *);
2395f384338SMichael Holzheu extern int tape_cancel_io(struct tape_device *, struct tape_request *);
2401da177e4SLinus Torvalds void tape_hotplug_event(struct tape_device *, int major, int action);
2411da177e4SLinus Torvalds 
2421da177e4SLinus Torvalds static inline int
2431da177e4SLinus Torvalds tape_do_io_free(struct tape_device *device, struct tape_request *request)
2441da177e4SLinus Torvalds {
2451da177e4SLinus Torvalds 	int rc;
2461da177e4SLinus Torvalds 
2471da177e4SLinus Torvalds 	rc = tape_do_io(device, request);
2481da177e4SLinus Torvalds 	tape_free_request(request);
2491da177e4SLinus Torvalds 	return rc;
2501da177e4SLinus Torvalds }
2511da177e4SLinus Torvalds 
2520c2bd9b2SMartin Schwidefsky static inline void
2530c2bd9b2SMartin Schwidefsky tape_do_io_async_free(struct tape_device *device, struct tape_request *request)
2540c2bd9b2SMartin Schwidefsky {
2550c2bd9b2SMartin Schwidefsky 	request->callback = (void *) tape_free_request;
2560c2bd9b2SMartin Schwidefsky 	request->callback_data = NULL;
2570c2bd9b2SMartin Schwidefsky 	tape_do_io_async(device, request);
2580c2bd9b2SMartin Schwidefsky }
2590c2bd9b2SMartin Schwidefsky 
2601da177e4SLinus Torvalds extern int tape_oper_handler(int irq, int status);
2611da177e4SLinus Torvalds extern void tape_noper_handler(int irq, int status);
2621da177e4SLinus Torvalds extern int tape_open(struct tape_device *);
2631da177e4SLinus Torvalds extern int tape_release(struct tape_device *);
2641da177e4SLinus Torvalds extern int tape_mtop(struct tape_device *, int, int);
2651da177e4SLinus Torvalds extern void tape_state_set(struct tape_device *, enum tape_state);
2661da177e4SLinus Torvalds 
2671da177e4SLinus Torvalds extern int tape_generic_online(struct tape_device *, struct tape_discipline *);
2684d7a3cdfSFrank Munzert extern int tape_generic_offline(struct ccw_device *);
2693ef32e62SFrank Munzert extern int tape_generic_pm_suspend(struct ccw_device *);
2701da177e4SLinus Torvalds 
2711da177e4SLinus Torvalds /* Externals from tape_devmap.c */
2721da177e4SLinus Torvalds extern int tape_generic_probe(struct ccw_device *);
2731da177e4SLinus Torvalds extern void tape_generic_remove(struct ccw_device *);
2741da177e4SLinus Torvalds 
2758fd138c3SMartin Schwidefsky extern struct tape_device *tape_find_device(int devindex);
2768fd138c3SMartin Schwidefsky extern struct tape_device *tape_get_device(struct tape_device *);
2778fd138c3SMartin Schwidefsky extern void tape_put_device(struct tape_device *);
2781da177e4SLinus Torvalds 
2791da177e4SLinus Torvalds /* Externals from tape_char.c */
2801da177e4SLinus Torvalds extern int tapechar_init(void);
2811da177e4SLinus Torvalds extern void tapechar_exit(void);
2821da177e4SLinus Torvalds extern int  tapechar_setup_device(struct tape_device *);
2831da177e4SLinus Torvalds extern void tapechar_cleanup_device(struct tape_device *);
2841da177e4SLinus Torvalds 
2851da177e4SLinus Torvalds /* tape initialisation functions */
2861da177e4SLinus Torvalds #ifdef CONFIG_PROC_FS
2871da177e4SLinus Torvalds extern void tape_proc_init (void);
2881da177e4SLinus Torvalds extern void tape_proc_cleanup (void);
2891da177e4SLinus Torvalds #else
2901da177e4SLinus Torvalds static inline void tape_proc_init (void) {;}
2911da177e4SLinus Torvalds static inline void tape_proc_cleanup (void) {;}
2921da177e4SLinus Torvalds #endif
2931da177e4SLinus Torvalds 
2941da177e4SLinus Torvalds /* a function for dumping device sense info */
2951da177e4SLinus Torvalds extern void tape_dump_sense_dbf(struct tape_device *, struct tape_request *,
2961da177e4SLinus Torvalds 				struct irb *);
2971da177e4SLinus Torvalds 
2981da177e4SLinus Torvalds /* functions for handling the status of a device */
2991da177e4SLinus Torvalds extern void tape_med_state_set(struct tape_device *, enum tape_medium_state);
3001da177e4SLinus Torvalds 
3011da177e4SLinus Torvalds /* The debug area */
3021da177e4SLinus Torvalds extern debug_info_t *TAPE_DBF_AREA;
3031da177e4SLinus Torvalds 
3041da177e4SLinus Torvalds /* functions for building ccws */
3051da177e4SLinus Torvalds static inline struct ccw1 *
3061da177e4SLinus Torvalds tape_ccw_cc(struct ccw1 *ccw, __u8 cmd_code, __u16 memsize, void *cda)
3071da177e4SLinus Torvalds {
3081da177e4SLinus Torvalds 	ccw->cmd_code = cmd_code;
3091da177e4SLinus Torvalds 	ccw->flags = CCW_FLAG_CC;
3101da177e4SLinus Torvalds 	ccw->count = memsize;
3111da177e4SLinus Torvalds 	ccw->cda = (__u32)(addr_t) cda;
3121da177e4SLinus Torvalds 	return ccw + 1;
3131da177e4SLinus Torvalds }
3141da177e4SLinus Torvalds 
3151da177e4SLinus Torvalds static inline struct ccw1 *
3161da177e4SLinus Torvalds tape_ccw_end(struct ccw1 *ccw, __u8 cmd_code, __u16 memsize, void *cda)
3171da177e4SLinus Torvalds {
3181da177e4SLinus Torvalds 	ccw->cmd_code = cmd_code;
3191da177e4SLinus Torvalds 	ccw->flags = 0;
3201da177e4SLinus Torvalds 	ccw->count = memsize;
3211da177e4SLinus Torvalds 	ccw->cda = (__u32)(addr_t) cda;
3221da177e4SLinus Torvalds 	return ccw + 1;
3231da177e4SLinus Torvalds }
3241da177e4SLinus Torvalds 
3251da177e4SLinus Torvalds static inline struct ccw1 *
3261da177e4SLinus Torvalds tape_ccw_cmd(struct ccw1 *ccw, __u8 cmd_code)
3271da177e4SLinus Torvalds {
3281da177e4SLinus Torvalds 	ccw->cmd_code = cmd_code;
3291da177e4SLinus Torvalds 	ccw->flags = 0;
3301da177e4SLinus Torvalds 	ccw->count = 0;
3311da177e4SLinus Torvalds 	ccw->cda = (__u32)(addr_t) &ccw->cmd_code;
3321da177e4SLinus Torvalds 	return ccw + 1;
3331da177e4SLinus Torvalds }
3341da177e4SLinus Torvalds 
3351da177e4SLinus Torvalds static inline struct ccw1 *
3361da177e4SLinus Torvalds tape_ccw_repeat(struct ccw1 *ccw, __u8 cmd_code, int count)
3371da177e4SLinus Torvalds {
3381da177e4SLinus Torvalds 	while (count-- > 0) {
3391da177e4SLinus Torvalds 		ccw->cmd_code = cmd_code;
3401da177e4SLinus Torvalds 		ccw->flags = CCW_FLAG_CC;
3411da177e4SLinus Torvalds 		ccw->count = 0;
3421da177e4SLinus Torvalds 		ccw->cda = (__u32)(addr_t) &ccw->cmd_code;
3431da177e4SLinus Torvalds 		ccw++;
3441da177e4SLinus Torvalds 	}
3451da177e4SLinus Torvalds 	return ccw;
3461da177e4SLinus Torvalds }
3471da177e4SLinus Torvalds 
3481da177e4SLinus Torvalds static inline struct ccw1 *
3491da177e4SLinus Torvalds tape_ccw_cc_idal(struct ccw1 *ccw, __u8 cmd_code, struct idal_buffer *idal)
3501da177e4SLinus Torvalds {
3511da177e4SLinus Torvalds 	ccw->cmd_code = cmd_code;
3521da177e4SLinus Torvalds 	ccw->flags    = CCW_FLAG_CC;
3531da177e4SLinus Torvalds 	idal_buffer_set_cda(idal, ccw);
3541da177e4SLinus Torvalds 	return ccw++;
3551da177e4SLinus Torvalds }
3561da177e4SLinus Torvalds 
3571da177e4SLinus Torvalds static inline struct ccw1 *
3581da177e4SLinus Torvalds tape_ccw_end_idal(struct ccw1 *ccw, __u8 cmd_code, struct idal_buffer *idal)
3591da177e4SLinus Torvalds {
3601da177e4SLinus Torvalds 	ccw->cmd_code = cmd_code;
3611da177e4SLinus Torvalds 	ccw->flags    = 0;
3621da177e4SLinus Torvalds 	idal_buffer_set_cda(idal, ccw);
3631da177e4SLinus Torvalds 	return ccw++;
3641da177e4SLinus Torvalds }
3651da177e4SLinus Torvalds 
3661da177e4SLinus Torvalds /* Global vars */
3671da177e4SLinus Torvalds extern const char *tape_state_verbose[];
3681da177e4SLinus Torvalds extern const char *tape_op_verbose[];
3691da177e4SLinus Torvalds 
3701da177e4SLinus Torvalds #endif /* for ifdef tape.h */
371