18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * standard tape device functions for ibm tapes. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2001, 2006 68c2ecf20Sopenharmony_ci * Author(s): Carsten Otte <cotte@de.ibm.com> 78c2ecf20Sopenharmony_ci * Tuan Ngo-Anh <ngoanh@de.ibm.com> 88c2ecf20Sopenharmony_ci * Martin Schwidefsky <schwidefsky@de.ibm.com> 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef _TAPE_STD_H 128c2ecf20Sopenharmony_ci#define _TAPE_STD_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <asm/tape390.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * Biggest block size to handle. Currently 64K because we only build 188c2ecf20Sopenharmony_ci * channel programs without data chaining. 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_ci#define MAX_BLOCKSIZE 65535 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* 238c2ecf20Sopenharmony_ci * The CCW commands for the Tape type of command. 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_ci#define INVALID_00 0x00 /* Invalid cmd */ 268c2ecf20Sopenharmony_ci#define BACKSPACEBLOCK 0x27 /* Back Space block */ 278c2ecf20Sopenharmony_ci#define BACKSPACEFILE 0x2f /* Back Space file */ 288c2ecf20Sopenharmony_ci#define DATA_SEC_ERASE 0x97 /* Data security erase */ 298c2ecf20Sopenharmony_ci#define ERASE_GAP 0x17 /* Erase Gap */ 308c2ecf20Sopenharmony_ci#define FORSPACEBLOCK 0x37 /* Forward space block */ 318c2ecf20Sopenharmony_ci#define FORSPACEFILE 0x3F /* Forward Space file */ 328c2ecf20Sopenharmony_ci#define FORCE_STREAM_CNT 0xEB /* Forced streaming count # */ 338c2ecf20Sopenharmony_ci#define NOP 0x03 /* No operation */ 348c2ecf20Sopenharmony_ci#define READ_FORWARD 0x02 /* Read forward */ 358c2ecf20Sopenharmony_ci#define REWIND 0x07 /* Rewind */ 368c2ecf20Sopenharmony_ci#define REWIND_UNLOAD 0x0F /* Rewind and Unload */ 378c2ecf20Sopenharmony_ci#define SENSE 0x04 /* Sense */ 388c2ecf20Sopenharmony_ci#define NEW_MODE_SET 0xEB /* Guess it is Mode set */ 398c2ecf20Sopenharmony_ci#define WRITE_CMD 0x01 /* Write */ 408c2ecf20Sopenharmony_ci#define WRITETAPEMARK 0x1F /* Write Tape Mark */ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define ASSIGN 0xB7 /* 3420 REJECT,3480 OK */ 438c2ecf20Sopenharmony_ci#define CONTROL_ACCESS 0xE3 /* Set high speed */ 448c2ecf20Sopenharmony_ci#define DIAG_MODE_SET 0x0B /* 3420 NOP, 3480 REJECT */ 458c2ecf20Sopenharmony_ci#define LOAD_DISPLAY 0x9F /* 3420 REJECT,3480 OK */ 468c2ecf20Sopenharmony_ci#define LOCATE 0x4F /* 3420 REJ, 3480 NOP */ 478c2ecf20Sopenharmony_ci#define LOOP_WRITE_TO_READ 0x8B /* 3480 REJECT */ 488c2ecf20Sopenharmony_ci#define MODE_SET_DB 0xDB /* 3420 REJECT,3480 OK */ 498c2ecf20Sopenharmony_ci#define MODE_SET_C3 0xC3 /* for 3420 */ 508c2ecf20Sopenharmony_ci#define MODE_SET_CB 0xCB /* for 3420 */ 518c2ecf20Sopenharmony_ci#define MODE_SET_D3 0xD3 /* for 3420 */ 528c2ecf20Sopenharmony_ci#define READ_BACKWARD 0x0C /* */ 538c2ecf20Sopenharmony_ci#define READ_BLOCK_ID 0x22 /* 3420 REJECT,3480 OK */ 548c2ecf20Sopenharmony_ci#define READ_BUFFER 0x12 /* 3420 REJECT,3480 OK */ 558c2ecf20Sopenharmony_ci#define READ_BUFF_LOG 0x24 /* 3420 REJECT,3480 OK */ 568c2ecf20Sopenharmony_ci#define RELEASE 0xD4 /* 3420 NOP, 3480 REJECT */ 578c2ecf20Sopenharmony_ci#define REQ_TRK_IN_ERROR 0x1B /* 3420 NOP, 3480 REJECT */ 588c2ecf20Sopenharmony_ci#define RESERVE 0xF4 /* 3420 NOP, 3480 REJECT */ 598c2ecf20Sopenharmony_ci#define SENSE_GROUP_ID 0x34 /* 3420 REJECT,3480 OK */ 608c2ecf20Sopenharmony_ci#define SENSE_ID 0xE4 /* 3420 REJECT,3480 OK */ 618c2ecf20Sopenharmony_ci#define READ_DEV_CHAR 0x64 /* Read device characteristics */ 628c2ecf20Sopenharmony_ci#define SET_DIAGNOSE 0x4B /* 3420 NOP, 3480 REJECT */ 638c2ecf20Sopenharmony_ci#define SET_GROUP_ID 0xAF /* 3420 REJECT,3480 OK */ 648c2ecf20Sopenharmony_ci#define SET_TAPE_WRITE_IMMED 0xC3 /* for 3480 */ 658c2ecf20Sopenharmony_ci#define SUSPEND 0x5B /* 3420 REJ, 3480 NOP */ 668c2ecf20Sopenharmony_ci#define SYNC 0x43 /* Synchronize (flush buffer) */ 678c2ecf20Sopenharmony_ci#define UNASSIGN 0xC7 /* 3420 REJECT,3480 OK */ 688c2ecf20Sopenharmony_ci#define PERF_SUBSYS_FUNC 0x77 /* 3490 CMD */ 698c2ecf20Sopenharmony_ci#define READ_CONFIG_DATA 0xFA /* 3490 CMD */ 708c2ecf20Sopenharmony_ci#define READ_MESSAGE_ID 0x4E /* 3490 CMD */ 718c2ecf20Sopenharmony_ci#define READ_SUBSYS_DATA 0x3E /* 3490 CMD */ 728c2ecf20Sopenharmony_ci#define SET_INTERFACE_ID 0x73 /* 3490 CMD */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#define SENSE_COMMAND_REJECT 0x80 758c2ecf20Sopenharmony_ci#define SENSE_INTERVENTION_REQUIRED 0x40 768c2ecf20Sopenharmony_ci#define SENSE_BUS_OUT_CHECK 0x20 778c2ecf20Sopenharmony_ci#define SENSE_EQUIPMENT_CHECK 0x10 788c2ecf20Sopenharmony_ci#define SENSE_DATA_CHECK 0x08 798c2ecf20Sopenharmony_ci#define SENSE_OVERRUN 0x04 808c2ecf20Sopenharmony_ci#define SENSE_DEFERRED_UNIT_CHECK 0x02 818c2ecf20Sopenharmony_ci#define SENSE_ASSIGNED_ELSEWHERE 0x01 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define SENSE_LOCATE_FAILURE 0x80 848c2ecf20Sopenharmony_ci#define SENSE_DRIVE_ONLINE 0x40 858c2ecf20Sopenharmony_ci#define SENSE_RESERVED 0x20 868c2ecf20Sopenharmony_ci#define SENSE_RECORD_SEQUENCE_ERR 0x10 878c2ecf20Sopenharmony_ci#define SENSE_BEGINNING_OF_TAPE 0x08 888c2ecf20Sopenharmony_ci#define SENSE_WRITE_MODE 0x04 898c2ecf20Sopenharmony_ci#define SENSE_WRITE_PROTECT 0x02 908c2ecf20Sopenharmony_ci#define SENSE_NOT_CAPABLE 0x01 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define SENSE_CHANNEL_ADAPTER_CODE 0xE0 938c2ecf20Sopenharmony_ci#define SENSE_CHANNEL_ADAPTER_LOC 0x10 948c2ecf20Sopenharmony_ci#define SENSE_REPORTING_CU 0x08 958c2ecf20Sopenharmony_ci#define SENSE_AUTOMATIC_LOADER 0x04 968c2ecf20Sopenharmony_ci#define SENSE_TAPE_SYNC_MODE 0x02 978c2ecf20Sopenharmony_ci#define SENSE_TAPE_POSITIONING 0x01 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* discipline functions */ 1008c2ecf20Sopenharmony_cistruct tape_request *tape_std_read_block(struct tape_device *, size_t); 1018c2ecf20Sopenharmony_civoid tape_std_read_backward(struct tape_device *device, 1028c2ecf20Sopenharmony_ci struct tape_request *request); 1038c2ecf20Sopenharmony_cistruct tape_request *tape_std_write_block(struct tape_device *, size_t); 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci/* Some non-mtop commands. */ 1068c2ecf20Sopenharmony_ciint tape_std_assign(struct tape_device *); 1078c2ecf20Sopenharmony_ciint tape_std_unassign(struct tape_device *); 1088c2ecf20Sopenharmony_ciint tape_std_read_block_id(struct tape_device *device, __u64 *id); 1098c2ecf20Sopenharmony_ciint tape_std_display(struct tape_device *, struct display_struct *disp); 1108c2ecf20Sopenharmony_ciint tape_std_terminate_write(struct tape_device *); 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* Standard magnetic tape commands. */ 1138c2ecf20Sopenharmony_ciint tape_std_mtbsf(struct tape_device *, int); 1148c2ecf20Sopenharmony_ciint tape_std_mtbsfm(struct tape_device *, int); 1158c2ecf20Sopenharmony_ciint tape_std_mtbsr(struct tape_device *, int); 1168c2ecf20Sopenharmony_ciint tape_std_mtcompression(struct tape_device *, int); 1178c2ecf20Sopenharmony_ciint tape_std_mteom(struct tape_device *, int); 1188c2ecf20Sopenharmony_ciint tape_std_mterase(struct tape_device *, int); 1198c2ecf20Sopenharmony_ciint tape_std_mtfsf(struct tape_device *, int); 1208c2ecf20Sopenharmony_ciint tape_std_mtfsfm(struct tape_device *, int); 1218c2ecf20Sopenharmony_ciint tape_std_mtfsr(struct tape_device *, int); 1228c2ecf20Sopenharmony_ciint tape_std_mtload(struct tape_device *, int); 1238c2ecf20Sopenharmony_ciint tape_std_mtnop(struct tape_device *, int); 1248c2ecf20Sopenharmony_ciint tape_std_mtoffl(struct tape_device *, int); 1258c2ecf20Sopenharmony_ciint tape_std_mtreset(struct tape_device *, int); 1268c2ecf20Sopenharmony_ciint tape_std_mtreten(struct tape_device *, int); 1278c2ecf20Sopenharmony_ciint tape_std_mtrew(struct tape_device *, int); 1288c2ecf20Sopenharmony_ciint tape_std_mtsetblk(struct tape_device *, int); 1298c2ecf20Sopenharmony_ciint tape_std_mtunload(struct tape_device *, int); 1308c2ecf20Sopenharmony_ciint tape_std_mtweof(struct tape_device *, int); 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci/* Event handlers */ 1338c2ecf20Sopenharmony_civoid tape_std_process_eov(struct tape_device *); 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/* S390 tape types */ 1368c2ecf20Sopenharmony_cienum s390_tape_type { 1378c2ecf20Sopenharmony_ci tape_3480, 1388c2ecf20Sopenharmony_ci tape_3490, 1398c2ecf20Sopenharmony_ci tape_3590, 1408c2ecf20Sopenharmony_ci tape_3592, 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#endif // _TAPE_STD_H 144