2 * Linux driver for System z and s390 unit record devices
3 * (z/VM virtual punch, reader, printer)
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>
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 */
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
23 #define READER_PUNCH_DEVTYPE 0x2540
24 #define PRINTER_DEVTYPE 0x1403
26 /* z/VM spool file control block SFBLOK */
27 struct file_control_block
{
46 __u8 current_starting_copy_number
;
47 __u8 sfblock_cntrl_flags
;
49 __u8 more_status_flags
;
51 } __attribute__ ((packed
));
53 #define FLG_CP_DUMP 0x10
56 * A struct urdev is created for each ur device that is made available
57 * via the ccw_device driver model.
60 struct ccw_device
*cdev
; /* Backpointer to ccw device */
61 struct mutex io_mutex
; /* Serialises device IO */
62 struct mutex open_mutex
; /* Serialises access to device */
63 struct completion
*io_done
; /* do_ur_io waits; irq completes */
64 struct device
*device
;
65 struct cdev
*char_device
;
66 struct ccw_dev_id dev_id
; /* device id */
67 size_t reclen
; /* Record length for *write* CCWs */
68 int class; /* VM device class */
69 int io_request_rc
; /* return code from I/O request */
73 * A struct urfile is allocated at open() time for each device and
84 * Device major/minor definitions.
87 #define UR_MAJOR 0 /* get dynamic major */
89 * We map minor numbers directly to device numbers (0-FFFF) for simplicity.
90 * This avoids having to allocate (and manage) slot numbers.
92 #define NUM_MINORS 65536
94 /* Limiting each I/O to 511 records limits chan prog to 4KB (511 r/w + 1 NOP) */
95 #define MAX_RECS_PER_IO 511
96 #define WRITE_CCW_CMD 0x01
98 #define TRACE(x...) debug_sprintf_event(vmur_dbf, 1, x)
99 #define CCWDEV_CU_DI(cutype, di) \
100 CCW_DEVICE(cutype, 0x00), .driver_info = (di)
102 #define FILE_RECLEN_OFFSET 4064 /* reclen offset in spool data block */
104 #endif /* _VMUR_H_ */