Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*
  2 * Linux driver for System z and s390 unit record devices
  3 * (z/VM virtual punch, reader, printer)
  4 *
  5 * Copyright IBM Corp. 2001, 2007
  6 * Authors: Malcolm Beattie <beattiem@uk.ibm.com>
  7 *	    Michael Holzheu <holzheu@de.ibm.com>
  8 *	    Frank Munzert <munzert@de.ibm.com>
  9 */
 10
 11#ifndef _VMUR_H_
 12#define _VMUR_H_
 13
 
 
 14#define DEV_CLASS_UR_I 0x20 /* diag210 unit record input device class */
 15#define DEV_CLASS_UR_O 0x10 /* diag210 unit record output device class */
 16/*
 17 * we only support z/VM's default unit record devices:
 18 * both in SPOOL directory control statement and in CP DEFINE statement
 19 *	RDR defaults to 2540 reader
 20 *	PUN defaults to 2540 punch
 21 *	PRT defaults to 1403 printer
 22 */
 23#define READER_PUNCH_DEVTYPE	0x2540
 24#define PRINTER_DEVTYPE		0x1403
 25
 26/* z/VM spool file control block SFBLOK */
 27struct file_control_block {
 28	char reserved_1[8];
 29	char user_owner[8];
 30	char user_orig[8];
 31	__s32 data_recs;
 32	__s16 rec_len;
 33	__s16 file_num;
 34	__u8  file_stat;
 35	__u8  dev_type;
 36	char  reserved_2[6];
 37	char  file_name[12];
 38	char  file_type[12];
 39	char  create_date[8];
 40	char  create_time[8];
 41	char  reserved_3[6];
 42	__u8  file_class;
 43	__u8  sfb_lok;
 44	__u64 distr_code;
 45	__u32 reserved_4;
 46	__u8  current_starting_copy_number;
 47	__u8  sfblock_cntrl_flags;
 48	__u8  reserved_5;
 49	__u8  more_status_flags;
 50	char  rest[200];
 51} __attribute__ ((packed));
 52
 53#define FLG_SYSTEM_HOLD	0x04
 54#define FLG_CP_DUMP	0x10
 55#define FLG_USER_HOLD	0x20
 56#define FLG_IN_USE	0x80
 57
 58/*
 59 * A struct urdev is created for each ur device that is made available
 60 * via the ccw_device driver model.
 61 */
 62struct urdev {
 63	struct ccw_device *cdev;	/* Backpointer to ccw device */
 64	struct mutex io_mutex;		/* Serialises device IO */
 65	struct completion *io_done;	/* do_ur_io waits; irq completes */
 66	struct device *device;
 67	struct cdev *char_device;
 68	struct ccw_dev_id dev_id;	/* device id */
 69	size_t reclen;			/* Record length for *write* CCWs */
 70	int class;			/* VM device class */
 71	int io_request_rc;		/* return code from I/O request */
 72	atomic_t ref_count;		/* reference counter */
 73	wait_queue_head_t wait;		/* wait queue to serialize open */
 74	int open_flag;			/* "urdev is open" flag */
 75	spinlock_t open_lock;		/* serialize critical sections */
 76};
 77
 78/*
 79 * A struct urfile is allocated at open() time for each device and
 80 * freed on release().
 81 */
 82struct urfile {
 83	struct urdev *urd;
 84	unsigned int flags;
 85	size_t dev_reclen;
 86	__u16 file_reclen;
 87};
 88
 89/*
 90 * Device major/minor definitions.
 91 */
 92
 93#define UR_MAJOR 0	/* get dynamic major */
 94/*
 95 * We map minor numbers directly to device numbers (0-FFFF) for simplicity.
 96 * This avoids having to allocate (and manage) slot numbers.
 97 */
 98#define NUM_MINORS 65536
 99
100/* Limiting each I/O to 511 records limits chan prog to 4KB (511 r/w + 1 NOP) */
101#define MAX_RECS_PER_IO		511
102#define WRITE_CCW_CMD		0x01
103
104#define TRACE(x...) debug_sprintf_event(vmur_dbf, 1, x)
105#define CCWDEV_CU_DI(cutype, di) \
106		CCW_DEVICE(cutype, 0x00), .driver_info = (di)
107
108#define FILE_RECLEN_OFFSET	4064 /* reclen offset in spool data block */
109
110#endif /* _VMUR_H_ */
v5.9
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Linux driver for System z and s390 unit record devices
  4 * (z/VM virtual punch, reader, printer)
  5 *
  6 * Copyright IBM Corp. 2001, 2007
  7 * Authors: Malcolm Beattie <beattiem@uk.ibm.com>
  8 *	    Michael Holzheu <holzheu@de.ibm.com>
  9 *	    Frank Munzert <munzert@de.ibm.com>
 10 */
 11
 12#ifndef _VMUR_H_
 13#define _VMUR_H_
 14
 15#include <linux/refcount.h>
 16
 17#define DEV_CLASS_UR_I 0x20 /* diag210 unit record input device class */
 18#define DEV_CLASS_UR_O 0x10 /* diag210 unit record output device class */
 19/*
 20 * we only support z/VM's default unit record devices:
 21 * both in SPOOL directory control statement and in CP DEFINE statement
 22 *	RDR defaults to 2540 reader
 23 *	PUN defaults to 2540 punch
 24 *	PRT defaults to 1403 printer
 25 */
 26#define READER_PUNCH_DEVTYPE	0x2540
 27#define PRINTER_DEVTYPE		0x1403
 28
 29/* z/VM spool file control block SFBLOK */
 30struct file_control_block {
 31	char reserved_1[8];
 32	char user_owner[8];
 33	char user_orig[8];
 34	__s32 data_recs;
 35	__s16 rec_len;
 36	__s16 file_num;
 37	__u8  file_stat;
 38	__u8  dev_type;
 39	char  reserved_2[6];
 40	char  file_name[12];
 41	char  file_type[12];
 42	char  create_date[8];
 43	char  create_time[8];
 44	char  reserved_3[6];
 45	__u8  file_class;
 46	__u8  sfb_lok;
 47	__u64 distr_code;
 48	__u32 reserved_4;
 49	__u8  current_starting_copy_number;
 50	__u8  sfblock_cntrl_flags;
 51	__u8  reserved_5;
 52	__u8  more_status_flags;
 53	char  rest[200];
 54} __attribute__ ((packed));
 55
 56#define FLG_SYSTEM_HOLD	0x04
 57#define FLG_CP_DUMP	0x10
 58#define FLG_USER_HOLD	0x20
 59#define FLG_IN_USE	0x80
 60
 61/*
 62 * A struct urdev is created for each ur device that is made available
 63 * via the ccw_device driver model.
 64 */
 65struct urdev {
 66	struct ccw_device *cdev;	/* Backpointer to ccw device */
 67	struct mutex io_mutex;		/* Serialises device IO */
 68	struct completion *io_done;	/* do_ur_io waits; irq completes */
 69	struct device *device;
 70	struct cdev *char_device;
 71	struct ccw_dev_id dev_id;	/* device id */
 72	size_t reclen;			/* Record length for *write* CCWs */
 73	int class;			/* VM device class */
 74	int io_request_rc;		/* return code from I/O request */
 75	refcount_t ref_count;		/* reference counter */
 76	wait_queue_head_t wait;		/* wait queue to serialize open */
 77	int open_flag;			/* "urdev is open" flag */
 78	spinlock_t open_lock;		/* serialize critical sections */
 79};
 80
 81/*
 82 * A struct urfile is allocated at open() time for each device and
 83 * freed on release().
 84 */
 85struct urfile {
 86	struct urdev *urd;
 87	unsigned int flags;
 88	size_t dev_reclen;
 89	__u16 file_reclen;
 90};
 91
 92/*
 93 * Device major/minor definitions.
 94 */
 95
 96#define UR_MAJOR 0	/* get dynamic major */
 97/*
 98 * We map minor numbers directly to device numbers (0-FFFF) for simplicity.
 99 * This avoids having to allocate (and manage) slot numbers.
100 */
101#define NUM_MINORS 65536
102
103/* Limiting each I/O to 511 records limits chan prog to 4KB (511 r/w + 1 NOP) */
104#define MAX_RECS_PER_IO		511
105#define WRITE_CCW_CMD		0x01
106
107#define TRACE(x...) debug_sprintf_event(vmur_dbf, 1, x)
108#define CCWDEV_CU_DI(cutype, di) \
109		CCW_DEVICE(cutype, 0x00), .driver_info = (di)
110
111#define FILE_RECLEN_OFFSET	4064 /* reclen offset in spool data block */
112
113#endif /* _VMUR_H_ */