linux/drivers/s390/char/vmur.h
Linus Torvalds d60a540ac5 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Heiko Carstens:
 "Since Martin is on vacation you get the s390 pull request for the
  v4.15 merge window this time from me.

  Besides a lot of cleanups and bug fixes these are the most important
  changes:

   - a new regset for runtime instrumentation registers

   - hardware accelerated AES-GCM support for the aes_s390 module

   - support for the new CEX6S crypto cards

   - support for FORTIFY_SOURCE

   - addition of missing z13 and new z14 instructions to the in-kernel
     disassembler

   - generate opcode tables for the in-kernel disassembler out of a
     simple text file instead of having to manually maintain those
     tables

   - fast memset16, memset32 and memset64 implementations

   - removal of named saved segment support

   - hardware counter support for z14

   - queued spinlocks and queued rwlocks implementations for s390

   - use the stack_depth tracking feature for s390 BPF JIT

   - a new s390_sthyi system call which emulates the sthyi (store
     hypervisor information) instruction

   - removal of the old KVM virtio transport

   - an s390 specific CPU alternatives implementation which is used in
     the new spinlock code"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (88 commits)
  MAINTAINERS: add virtio-ccw.h to virtio/s390 section
  s390/noexec: execute kexec datamover without DAT
  s390: fix transactional execution control register handling
  s390/bpf: take advantage of stack_depth tracking
  s390: simplify transactional execution elf hwcap handling
  s390/zcrypt: Rework struct ap_qact_ap_info.
  s390/virtio: remove unused header file kvm_virtio.h
  s390: avoid undefined behaviour
  s390/disassembler: generate opcode tables from text file
  s390/disassembler: remove insn_to_mnemonic()
  s390/dasd: avoid calling do_gettimeofday()
  s390: vfio-ccw: Do not attempt to free no-op, test and tic cda.
  s390: remove named saved segment support
  s390/archrandom: Reconsider s390 arch random implementation
  s390/pci: do not require AIS facility
  s390/qdio: sanitize put_indicator
  s390/qdio: use atomic_cmpxchg
  s390/nmi: avoid using long-displacement facility
  s390: pass endianness info to sparse
  s390/decompressor: remove informational messages
  ...
2017-11-13 11:47:01 -08:00

114 lines
3.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Linux driver for System z and s390 unit record devices
* (z/VM virtual punch, reader, printer)
*
* Copyright IBM Corp. 2001, 2007
* Authors: Malcolm Beattie <beattiem@uk.ibm.com>
* Michael Holzheu <holzheu@de.ibm.com>
* Frank Munzert <munzert@de.ibm.com>
*/
#ifndef _VMUR_H_
#define _VMUR_H_
#include <linux/refcount.h>
#define DEV_CLASS_UR_I 0x20 /* diag210 unit record input device class */
#define DEV_CLASS_UR_O 0x10 /* diag210 unit record output device class */
/*
* we only support z/VM's default unit record devices:
* both in SPOOL directory control statement and in CP DEFINE statement
* RDR defaults to 2540 reader
* PUN defaults to 2540 punch
* PRT defaults to 1403 printer
*/
#define READER_PUNCH_DEVTYPE 0x2540
#define PRINTER_DEVTYPE 0x1403
/* z/VM spool file control block SFBLOK */
struct file_control_block {
char reserved_1[8];
char user_owner[8];
char user_orig[8];
__s32 data_recs;
__s16 rec_len;
__s16 file_num;
__u8 file_stat;
__u8 dev_type;
char reserved_2[6];
char file_name[12];
char file_type[12];
char create_date[8];
char create_time[8];
char reserved_3[6];
__u8 file_class;
__u8 sfb_lok;
__u64 distr_code;
__u32 reserved_4;
__u8 current_starting_copy_number;
__u8 sfblock_cntrl_flags;
__u8 reserved_5;
__u8 more_status_flags;
char rest[200];
} __attribute__ ((packed));
#define FLG_SYSTEM_HOLD 0x04
#define FLG_CP_DUMP 0x10
#define FLG_USER_HOLD 0x20
#define FLG_IN_USE 0x80
/*
* A struct urdev is created for each ur device that is made available
* via the ccw_device driver model.
*/
struct urdev {
struct ccw_device *cdev; /* Backpointer to ccw device */
struct mutex io_mutex; /* Serialises device IO */
struct completion *io_done; /* do_ur_io waits; irq completes */
struct device *device;
struct cdev *char_device;
struct ccw_dev_id dev_id; /* device id */
size_t reclen; /* Record length for *write* CCWs */
int class; /* VM device class */
int io_request_rc; /* return code from I/O request */
refcount_t ref_count; /* reference counter */
wait_queue_head_t wait; /* wait queue to serialize open */
int open_flag; /* "urdev is open" flag */
spinlock_t open_lock; /* serialize critical sections */
};
/*
* A struct urfile is allocated at open() time for each device and
* freed on release().
*/
struct urfile {
struct urdev *urd;
unsigned int flags;
size_t dev_reclen;
__u16 file_reclen;
};
/*
* Device major/minor definitions.
*/
#define UR_MAJOR 0 /* get dynamic major */
/*
* We map minor numbers directly to device numbers (0-FFFF) for simplicity.
* This avoids having to allocate (and manage) slot numbers.
*/
#define NUM_MINORS 65536
/* Limiting each I/O to 511 records limits chan prog to 4KB (511 r/w + 1 NOP) */
#define MAX_RECS_PER_IO 511
#define WRITE_CCW_CMD 0x01
#define TRACE(x...) debug_sprintf_event(vmur_dbf, 1, x)
#define CCWDEV_CU_DI(cutype, di) \
CCW_DEVICE(cutype, 0x00), .driver_info = (di)
#define FILE_RECLEN_OFFSET 4064 /* reclen offset in spool data block */
#endif /* _VMUR_H_ */