Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / s390 / include / asm / tape390.h
blob884fba48f1ff522e3fecd09cbf04deaeb7ca69cb
1 /*************************************************************************
3 * tape390.h
4 * enables user programs to display messages and control encryption
5 * on s390 tape devices
7 * Copyright IBM Corp. 2001,2006
8 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
10 *************************************************************************/
12 #ifndef _TAPE390_H
13 #define _TAPE390_H
15 #define TAPE390_DISPLAY _IOW('d', 1, struct display_struct)
18 * The TAPE390_DISPLAY ioctl calls the Load Display command
19 * which transfers 17 bytes of data from the channel to the subsystem:
20 * - 1 format control byte, and
21 * - two 8-byte messages
23 * Format control byte:
24 * 0-2: New Message Overlay
25 * 3: Alternate Messages
26 * 4: Blink Message
27 * 5: Display Low/High Message
28 * 6: Reserved
29 * 7: Automatic Load Request
33 typedef struct display_struct {
34 char cntrl;
35 char message1[8];
36 char message2[8];
37 } display_struct;
40 * Tape encryption support
43 struct tape390_crypt_info {
44 char capability;
45 char status;
46 char medium_status;
47 } __attribute__ ((packed));
50 /* Macros for "capable" field */
51 #define TAPE390_CRYPT_SUPPORTED_MASK 0x01
52 #define TAPE390_CRYPT_SUPPORTED(x) \
53 ((x.capability & TAPE390_CRYPT_SUPPORTED_MASK))
55 /* Macros for "status" field */
56 #define TAPE390_CRYPT_ON_MASK 0x01
57 #define TAPE390_CRYPT_ON(x) (((x.status) & TAPE390_CRYPT_ON_MASK))
59 /* Macros for "medium status" field */
60 #define TAPE390_MEDIUM_LOADED_MASK 0x01
61 #define TAPE390_MEDIUM_ENCRYPTED_MASK 0x02
62 #define TAPE390_MEDIUM_ENCRYPTED(x) \
63 (((x.medium_status) & TAPE390_MEDIUM_ENCRYPTED_MASK))
64 #define TAPE390_MEDIUM_LOADED(x) \
65 (((x.medium_status) & TAPE390_MEDIUM_LOADED_MASK))
68 * The TAPE390_CRYPT_SET ioctl is used to switch on/off encryption.
69 * The "encryption_capable" and "tape_status" fields are ignored for this ioctl!
71 #define TAPE390_CRYPT_SET _IOW('d', 2, struct tape390_crypt_info)
74 * The TAPE390_CRYPT_QUERY ioctl is used to query the encryption state.
76 #define TAPE390_CRYPT_QUERY _IOR('d', 3, struct tape390_crypt_info)
78 /* Values for "kekl1/2_type" and "kekl1/2_type_on_tape" fields */
79 #define TAPE390_KEKL_TYPE_NONE 0
80 #define TAPE390_KEKL_TYPE_LABEL 1
81 #define TAPE390_KEKL_TYPE_HASH 2
83 struct tape390_kekl {
84 unsigned char type;
85 unsigned char type_on_tape;
86 char label[65];
87 } __attribute__ ((packed));
89 struct tape390_kekl_pair {
90 struct tape390_kekl kekl[2];
91 } __attribute__ ((packed));
94 * The TAPE390_KEKL_SET ioctl is used to set Key Encrypting Key labels.
96 #define TAPE390_KEKL_SET _IOW('d', 4, struct tape390_kekl_pair)
99 * The TAPE390_KEKL_QUERY ioctl is used to query Key Encrypting Key labels.
101 #define TAPE390_KEKL_QUERY _IOR('d', 5, struct tape390_kekl_pair)
103 #endif