1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 29807f759SDavid Howells /************************************************************************* 39807f759SDavid Howells * 49807f759SDavid Howells * enables user programs to display messages and control encryption 59807f759SDavid Howells * on s390 tape devices 69807f759SDavid Howells * 79807f759SDavid Howells * Copyright IBM Corp. 2001, 2006 89807f759SDavid Howells * Author(s): Michael Holzheu <holzheu@de.ibm.com> 99807f759SDavid Howells * 109807f759SDavid Howells *************************************************************************/ 119807f759SDavid Howells 129807f759SDavid Howells #ifndef _TAPE390_H 139807f759SDavid Howells #define _TAPE390_H 149807f759SDavid Howells 159807f759SDavid Howells #define TAPE390_DISPLAY _IOW('d', 1, struct display_struct) 169807f759SDavid Howells 179807f759SDavid Howells /* 189807f759SDavid Howells * The TAPE390_DISPLAY ioctl calls the Load Display command 199807f759SDavid Howells * which transfers 17 bytes of data from the channel to the subsystem: 209807f759SDavid Howells * - 1 format control byte, and 219807f759SDavid Howells * - two 8-byte messages 229807f759SDavid Howells * 239807f759SDavid Howells * Format control byte: 249807f759SDavid Howells * 0-2: New Message Overlay 259807f759SDavid Howells * 3: Alternate Messages 269807f759SDavid Howells * 4: Blink Message 279807f759SDavid Howells * 5: Display Low/High Message 289807f759SDavid Howells * 6: Reserved 299807f759SDavid Howells * 7: Automatic Load Request 309807f759SDavid Howells * 319807f759SDavid Howells */ 329807f759SDavid Howells 339807f759SDavid Howells typedef struct display_struct { 349807f759SDavid Howells char cntrl; 359807f759SDavid Howells char message1[8]; 369807f759SDavid Howells char message2[8]; 379807f759SDavid Howells } display_struct; 389807f759SDavid Howells 399807f759SDavid Howells /* 409807f759SDavid Howells * Tape encryption support 419807f759SDavid Howells */ 429807f759SDavid Howells 439807f759SDavid Howells struct tape390_crypt_info { 449807f759SDavid Howells char capability; 459807f759SDavid Howells char status; 469807f759SDavid Howells char medium_status; 479807f759SDavid Howells } __attribute__ ((packed)); 489807f759SDavid Howells 499807f759SDavid Howells 509807f759SDavid Howells /* Macros for "capable" field */ 519807f759SDavid Howells #define TAPE390_CRYPT_SUPPORTED_MASK 0x01 529807f759SDavid Howells #define TAPE390_CRYPT_SUPPORTED(x) \ 539807f759SDavid Howells ((x.capability & TAPE390_CRYPT_SUPPORTED_MASK)) 549807f759SDavid Howells 559807f759SDavid Howells /* Macros for "status" field */ 569807f759SDavid Howells #define TAPE390_CRYPT_ON_MASK 0x01 579807f759SDavid Howells #define TAPE390_CRYPT_ON(x) (((x.status) & TAPE390_CRYPT_ON_MASK)) 589807f759SDavid Howells 599807f759SDavid Howells /* Macros for "medium status" field */ 609807f759SDavid Howells #define TAPE390_MEDIUM_LOADED_MASK 0x01 619807f759SDavid Howells #define TAPE390_MEDIUM_ENCRYPTED_MASK 0x02 629807f759SDavid Howells #define TAPE390_MEDIUM_ENCRYPTED(x) \ 639807f759SDavid Howells (((x.medium_status) & TAPE390_MEDIUM_ENCRYPTED_MASK)) 649807f759SDavid Howells #define TAPE390_MEDIUM_LOADED(x) \ 659807f759SDavid Howells (((x.medium_status) & TAPE390_MEDIUM_LOADED_MASK)) 669807f759SDavid Howells 679807f759SDavid Howells /* 689807f759SDavid Howells * The TAPE390_CRYPT_SET ioctl is used to switch on/off encryption. 699807f759SDavid Howells * The "encryption_capable" and "tape_status" fields are ignored for this ioctl! 709807f759SDavid Howells */ 719807f759SDavid Howells #define TAPE390_CRYPT_SET _IOW('d', 2, struct tape390_crypt_info) 729807f759SDavid Howells 739807f759SDavid Howells /* 749807f759SDavid Howells * The TAPE390_CRYPT_QUERY ioctl is used to query the encryption state. 759807f759SDavid Howells */ 769807f759SDavid Howells #define TAPE390_CRYPT_QUERY _IOR('d', 3, struct tape390_crypt_info) 779807f759SDavid Howells 789807f759SDavid Howells /* Values for "kekl1/2_type" and "kekl1/2_type_on_tape" fields */ 799807f759SDavid Howells #define TAPE390_KEKL_TYPE_NONE 0 809807f759SDavid Howells #define TAPE390_KEKL_TYPE_LABEL 1 819807f759SDavid Howells #define TAPE390_KEKL_TYPE_HASH 2 829807f759SDavid Howells 839807f759SDavid Howells struct tape390_kekl { 849807f759SDavid Howells unsigned char type; 859807f759SDavid Howells unsigned char type_on_tape; 869807f759SDavid Howells char label[65]; 879807f759SDavid Howells } __attribute__ ((packed)); 889807f759SDavid Howells 899807f759SDavid Howells struct tape390_kekl_pair { 909807f759SDavid Howells struct tape390_kekl kekl[2]; 919807f759SDavid Howells } __attribute__ ((packed)); 929807f759SDavid Howells 939807f759SDavid Howells /* 949807f759SDavid Howells * The TAPE390_KEKL_SET ioctl is used to set Key Encrypting Key labels. 959807f759SDavid Howells */ 969807f759SDavid Howells #define TAPE390_KEKL_SET _IOW('d', 4, struct tape390_kekl_pair) 979807f759SDavid Howells 989807f759SDavid Howells /* 999807f759SDavid Howells * The TAPE390_KEKL_QUERY ioctl is used to query Key Encrypting Key labels. 1009807f759SDavid Howells */ 1019807f759SDavid Howells #define TAPE390_KEKL_QUERY _IOR('d', 5, struct tape390_kekl_pair) 1029807f759SDavid Howells 1039807f759SDavid Howells #endif 104