1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * standard tape device functions for ibm tapes. 4 * 5 * Copyright IBM Corp. 2001, 2006 6 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Tuan Ngo-Anh <ngoanh@de.ibm.com> 8 * Martin Schwidefsky <schwidefsky@de.ibm.com> 9 */ 10 11 #ifndef _TAPE_STD_H 12 #define _TAPE_STD_H 13 14 /* 15 * Biggest block size of 256K to handle. 16 */ 17 #define MAX_BLOCKSIZE 262144 18 19 /* 20 * The CCW commands for the Tape type of command. 21 */ 22 #define BACKSPACEBLOCK 0x27 /* Back Space block */ 23 #define BACKSPACEFILE 0x2f /* Back Space file */ 24 #define DATA_SEC_ERASE 0x97 /* Data security erase */ 25 #define ERASE_GAP 0x17 /* Erase Gap */ 26 #define FORSPACEBLOCK 0x37 /* Forward space block */ 27 #define FORSPACEFILE 0x3F /* Forward Space file */ 28 #define NOP 0x03 /* No operation */ 29 #define READ_FORWARD 0x02 /* Read forward */ 30 #define REWIND 0x07 /* Rewind */ 31 #define REWIND_UNLOAD 0x0F /* Rewind and Unload */ 32 #define SENSE 0x04 /* Sense */ 33 #define WRITE_CMD 0x01 /* Write */ 34 #define WRITETAPEMARK 0x1F /* Write Tape Mark */ 35 36 #define ASSIGN 0xB7 /* Assign */ 37 #define LOCATE 0x4F /* Locate Block */ 38 #define MODE_SET_DB 0xDB /* Mode Set */ 39 #define READ_BLOCK_ID 0x22 /* Read Block ID */ 40 #define UNASSIGN 0xC7 /* Unassign */ 41 42 #define SENSE_COMMAND_REJECT 0x80 43 #define SENSE_INTERVENTION_REQUIRED 0x40 44 #define SENSE_BUS_OUT_CHECK 0x20 45 #define SENSE_EQUIPMENT_CHECK 0x10 46 #define SENSE_DATA_CHECK 0x08 47 #define SENSE_OVERRUN 0x04 48 #define SENSE_DEFERRED_UNIT_CHECK 0x02 49 #define SENSE_ASSIGNED_ELSEWHERE 0x01 50 51 #define SENSE_LOCATE_FAILURE 0x80 52 #define SENSE_DRIVE_ONLINE 0x40 53 #define SENSE_RESERVED 0x20 54 #define SENSE_RECORD_SEQUENCE_ERR 0x10 55 #define SENSE_BEGINNING_OF_TAPE 0x08 56 #define SENSE_WRITE_MODE 0x04 57 #define SENSE_WRITE_PROTECT 0x02 58 #define SENSE_NOT_CAPABLE 0x01 59 60 #define SENSE_CHANNEL_ADAPTER_CODE 0xE0 61 #define SENSE_CHANNEL_ADAPTER_LOC 0x10 62 #define SENSE_REPORTING_CU 0x08 63 #define SENSE_AUTOMATIC_LOADER 0x04 64 #define SENSE_TAPE_SYNC_MODE 0x02 65 #define SENSE_TAPE_POSITIONING 0x01 66 67 /* discipline functions */ 68 struct tape_request *tape_std_read_block(struct tape_device *); 69 void tape_std_read_backward(struct tape_device *device, 70 struct tape_request *request); 71 struct tape_request *tape_std_write_block(struct tape_device *); 72 73 /* Some non-mtop commands. */ 74 int tape_std_assign(struct tape_device *); 75 int tape_std_unassign(struct tape_device *); 76 int tape_std_read_block_id(struct tape_device *device, __u64 *id); 77 int tape_std_terminate_write(struct tape_device *); 78 79 /* Standard magnetic tape commands. */ 80 int tape_std_mtbsf(struct tape_device *, int); 81 int tape_std_mtbsfm(struct tape_device *, int); 82 int tape_std_mtbsr(struct tape_device *, int); 83 int tape_std_mtcompression(struct tape_device *, int); 84 int tape_std_mteom(struct tape_device *, int); 85 int tape_std_mterase(struct tape_device *, int); 86 int tape_std_mtfsf(struct tape_device *, int); 87 int tape_std_mtfsfm(struct tape_device *, int); 88 int tape_std_mtfsr(struct tape_device *, int); 89 int tape_std_mtload(struct tape_device *, int); 90 int tape_std_mtnop(struct tape_device *, int); 91 int tape_std_mtoffl(struct tape_device *, int); 92 int tape_std_mtreset(struct tape_device *, int); 93 int tape_std_mtreten(struct tape_device *, int); 94 int tape_std_mtrew(struct tape_device *, int); 95 int tape_std_mtsetblk(struct tape_device *, int); 96 int tape_std_mtunload(struct tape_device *, int); 97 int tape_std_mtweof(struct tape_device *, int); 98 99 /* Event handlers */ 100 void tape_std_process_eov(struct tape_device *); 101 102 /* S390 tape types */ 103 enum s390_tape_type { 104 tape_3490, 105 }; 106 107 #endif // _TAPE_STD_H 108