Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *    standard tape device functions for ibm tapes.
0004  *
0005  *    Copyright IBM Corp. 2001, 2006
0006  *    Author(s): Carsten Otte <cotte@de.ibm.com>
0007  *       Tuan Ngo-Anh <ngoanh@de.ibm.com>
0008  *       Martin Schwidefsky <schwidefsky@de.ibm.com>
0009  */
0010 
0011 #ifndef _TAPE_STD_H
0012 #define _TAPE_STD_H
0013 
0014 #include <asm/tape390.h>
0015 
0016 /*
0017  * Biggest block size to handle. Currently 64K because we only build
0018  * channel programs without data chaining.
0019  */
0020 #define MAX_BLOCKSIZE   65535
0021 
0022 /*
0023  * The CCW commands for the Tape type of command.
0024  */
0025 #define INVALID_00      0x00    /* Invalid cmd */
0026 #define BACKSPACEBLOCK      0x27    /* Back Space block */
0027 #define BACKSPACEFILE       0x2f    /* Back Space file */
0028 #define DATA_SEC_ERASE      0x97    /* Data security erase */
0029 #define ERASE_GAP       0x17    /* Erase Gap */
0030 #define FORSPACEBLOCK       0x37    /* Forward space block */
0031 #define FORSPACEFILE        0x3F    /* Forward Space file */
0032 #define FORCE_STREAM_CNT    0xEB    /* Forced streaming count # */
0033 #define NOP         0x03    /* No operation */
0034 #define READ_FORWARD        0x02    /* Read forward */
0035 #define REWIND          0x07    /* Rewind */
0036 #define REWIND_UNLOAD       0x0F    /* Rewind and Unload */
0037 #define SENSE           0x04    /* Sense */
0038 #define NEW_MODE_SET        0xEB    /* Guess it is Mode set */
0039 #define WRITE_CMD       0x01    /* Write */
0040 #define WRITETAPEMARK       0x1F    /* Write Tape Mark */
0041 
0042 #define ASSIGN          0xB7    /* 3420 REJECT,3480 OK  */
0043 #define CONTROL_ACCESS      0xE3    /* Set high speed */
0044 #define DIAG_MODE_SET       0x0B    /* 3420 NOP, 3480 REJECT */
0045 #define LOAD_DISPLAY        0x9F    /* 3420 REJECT,3480 OK */
0046 #define LOCATE          0x4F    /* 3420 REJ, 3480 NOP */
0047 #define LOOP_WRITE_TO_READ  0x8B    /* 3480 REJECT */
0048 #define MODE_SET_DB     0xDB    /* 3420 REJECT,3480 OK */
0049 #define MODE_SET_C3     0xC3    /* for 3420 */
0050 #define MODE_SET_CB     0xCB    /* for 3420 */
0051 #define MODE_SET_D3     0xD3    /* for 3420 */
0052 #define READ_BACKWARD       0x0C    /* */
0053 #define READ_BLOCK_ID       0x22    /* 3420 REJECT,3480 OK */
0054 #define READ_BUFFER     0x12    /* 3420 REJECT,3480 OK */
0055 #define READ_BUFF_LOG       0x24    /* 3420 REJECT,3480 OK */
0056 #define RELEASE         0xD4    /* 3420 NOP, 3480 REJECT */
0057 #define REQ_TRK_IN_ERROR    0x1B    /* 3420 NOP, 3480 REJECT */
0058 #define RESERVE         0xF4    /* 3420 NOP, 3480 REJECT */
0059 #define SENSE_GROUP_ID      0x34    /* 3420 REJECT,3480 OK */
0060 #define SENSE_ID        0xE4    /* 3420 REJECT,3480 OK */
0061 #define READ_DEV_CHAR       0x64    /* Read device characteristics */
0062 #define SET_DIAGNOSE        0x4B    /* 3420 NOP, 3480 REJECT */
0063 #define SET_GROUP_ID        0xAF    /* 3420 REJECT,3480 OK */
0064 #define SET_TAPE_WRITE_IMMED    0xC3    /* for 3480 */
0065 #define SUSPEND         0x5B    /* 3420 REJ, 3480 NOP */
0066 #define SYNC            0x43    /* Synchronize (flush buffer) */
0067 #define UNASSIGN        0xC7    /* 3420 REJECT,3480 OK */
0068 #define PERF_SUBSYS_FUNC    0x77    /* 3490 CMD */
0069 #define READ_CONFIG_DATA    0xFA    /* 3490 CMD */
0070 #define READ_MESSAGE_ID     0x4E    /* 3490 CMD */
0071 #define READ_SUBSYS_DATA    0x3E    /* 3490 CMD */
0072 #define SET_INTERFACE_ID    0x73    /* 3490 CMD */
0073 
0074 #define SENSE_COMMAND_REJECT        0x80
0075 #define SENSE_INTERVENTION_REQUIRED 0x40
0076 #define SENSE_BUS_OUT_CHECK     0x20
0077 #define SENSE_EQUIPMENT_CHECK       0x10
0078 #define SENSE_DATA_CHECK        0x08
0079 #define SENSE_OVERRUN           0x04
0080 #define SENSE_DEFERRED_UNIT_CHECK   0x02
0081 #define SENSE_ASSIGNED_ELSEWHERE    0x01
0082 
0083 #define SENSE_LOCATE_FAILURE        0x80
0084 #define SENSE_DRIVE_ONLINE      0x40
0085 #define SENSE_RESERVED          0x20
0086 #define SENSE_RECORD_SEQUENCE_ERR   0x10
0087 #define SENSE_BEGINNING_OF_TAPE     0x08
0088 #define SENSE_WRITE_MODE        0x04
0089 #define SENSE_WRITE_PROTECT     0x02
0090 #define SENSE_NOT_CAPABLE       0x01
0091 
0092 #define SENSE_CHANNEL_ADAPTER_CODE  0xE0
0093 #define SENSE_CHANNEL_ADAPTER_LOC   0x10
0094 #define SENSE_REPORTING_CU      0x08
0095 #define SENSE_AUTOMATIC_LOADER      0x04
0096 #define SENSE_TAPE_SYNC_MODE        0x02
0097 #define SENSE_TAPE_POSITIONING      0x01
0098 
0099 /* discipline functions */
0100 struct tape_request *tape_std_read_block(struct tape_device *, size_t);
0101 void tape_std_read_backward(struct tape_device *device,
0102                 struct tape_request *request);
0103 struct tape_request *tape_std_write_block(struct tape_device *, size_t);
0104 
0105 /* Some non-mtop commands. */
0106 int tape_std_assign(struct tape_device *);
0107 int tape_std_unassign(struct tape_device *);
0108 int tape_std_read_block_id(struct tape_device *device, __u64 *id);
0109 int tape_std_display(struct tape_device *, struct display_struct *disp);
0110 int tape_std_terminate_write(struct tape_device *);
0111 
0112 /* Standard magnetic tape commands. */
0113 int tape_std_mtbsf(struct tape_device *, int);
0114 int tape_std_mtbsfm(struct tape_device *, int);
0115 int tape_std_mtbsr(struct tape_device *, int);
0116 int tape_std_mtcompression(struct tape_device *, int);
0117 int tape_std_mteom(struct tape_device *, int);
0118 int tape_std_mterase(struct tape_device *, int);
0119 int tape_std_mtfsf(struct tape_device *, int);
0120 int tape_std_mtfsfm(struct tape_device *, int);
0121 int tape_std_mtfsr(struct tape_device *, int);
0122 int tape_std_mtload(struct tape_device *, int);
0123 int tape_std_mtnop(struct tape_device *, int);
0124 int tape_std_mtoffl(struct tape_device *, int);
0125 int tape_std_mtreset(struct tape_device *, int);
0126 int tape_std_mtreten(struct tape_device *, int);
0127 int tape_std_mtrew(struct tape_device *, int);
0128 int tape_std_mtsetblk(struct tape_device *, int);
0129 int tape_std_mtunload(struct tape_device *, int);
0130 int tape_std_mtweof(struct tape_device *, int);
0131 
0132 /* Event handlers */
0133 void tape_std_process_eov(struct tape_device *);
0134 
0135 /* S390 tape types */
0136 enum s390_tape_type {
0137         tape_3480,
0138         tape_3490,
0139         tape_3590,
0140         tape_3592,
0141 };
0142 
0143 #endif // _TAPE_STD_H