···10101111#include <linux/types.h>1212#include <linux/ioctl.h>1313-#include <linux/qic117.h>14131514/*1615 * Structures and definitions for mag tape io control commands···115116#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */116117#define MT_ISFTAPE_FLAG 0x800000117118118118-struct mt_tape_info {119119- long t_type; /* device type id (mt_type) */120120- char *t_name; /* descriptive name */121121-};122122-123123-#define MT_TAPE_INFO { \124124- {MT_ISUNKNOWN, "Unknown type of tape device"}, \125125- {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \126126- {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \127127- {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \128128- {MT_ISCMSJ500, "CMS Jumbo 500"}, \129129- {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \130130- {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \131131- {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \132132- {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \133133- {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \134134- {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \135135- {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \136136- {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \137137- {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \138138- {MT_ISONSTREAM_SC, "OnStream SC-, DI-, DP-, or USB tape drive"}, \139139- {MT_ISSCSI1, "Generic SCSI-1 tape"}, \140140- {MT_ISSCSI2, "Generic SCSI-2 tape"}, \141141- {0, NULL} \142142-}143143-144119145120/* structure for MTIOCPOS - mag tape get position command */146121···123150};124151125152126126-/* structure for MTIOCVOLINFO, query information about the volume127127- * currently positioned at (zftape)128128- */129129-struct mtvolinfo {130130- unsigned int mt_volno; /* vol-number */131131- unsigned int mt_blksz; /* blocksize used when recording */132132- unsigned int mt_rawsize; /* raw tape space consumed, in kb */133133- unsigned int mt_size; /* volume size after decompression, in kb */134134- unsigned int mt_cmpr:1; /* this volume has been compressed */135135-};136136-137137-/* raw access to a floppy drive, read and write an arbitrary segment.138138- * For ftape/zftape to support formatting etc.139139- */140140-#define MT_FT_RD_SINGLE 0141141-#define MT_FT_RD_AHEAD 1142142-#define MT_FT_WR_ASYNC 0 /* start tape only when all buffers are full */143143-#define MT_FT_WR_MULTI 1 /* start tape, continue until buffers are empty */144144-#define MT_FT_WR_SINGLE 2 /* write a single segment and stop afterwards */145145-#define MT_FT_WR_DELETE 3 /* write deleted data marks, one segment at time */146146-147147-struct mtftseg148148-{ 149149- unsigned mt_segno; /* the segment to read or write */150150- unsigned mt_mode; /* modes for read/write (sync/async etc.) */151151- int mt_result; /* result of r/w request, not of the ioctl */152152- void __user *mt_data; /* User space buffer: must be 29kb */153153-};154154-155155-/* get tape capacity (ftape/zftape)156156- */157157-struct mttapesize {158158- unsigned long mt_capacity; /* entire, uncompressed capacity 159159- * of a cartridge160160- */161161- unsigned long mt_used; /* what has been used so far, raw 162162- * uncompressed amount163163- */164164-};165165-166166-/* possible values of the ftfmt_op field167167- */168168-#define FTFMT_SET_PARMS 1 /* set software parms */169169-#define FTFMT_GET_PARMS 2 /* get software parms */170170-#define FTFMT_FORMAT_TRACK 3 /* start formatting a tape track */171171-#define FTFMT_STATUS 4 /* monitor formatting a tape track */172172-#define FTFMT_VERIFY 5 /* verify the given segment */173173-174174-struct ftfmtparms {175175- unsigned char ft_qicstd; /* QIC-40/QIC-80/QIC-3010/QIC-3020 */176176- unsigned char ft_fmtcode; /* Refer to the QIC specs */177177- unsigned char ft_fhm; /* floppy head max */178178- unsigned char ft_ftm; /* floppy track max */179179- unsigned short ft_spt; /* segments per track */180180- unsigned short ft_tpc; /* tracks per cartridge */181181-};182182-183183-struct ftfmttrack {184184- unsigned int ft_track; /* track to format */185185- unsigned char ft_gap3; /* size of gap3, for FORMAT_TRK */186186-};187187-188188-struct ftfmtstatus {189189- unsigned int ft_segment; /* segment currently being formatted */190190-};191191-192192-struct ftfmtverify {193193- unsigned int ft_segment; /* segment to verify */194194- unsigned long ft_bsm; /* bsm as result of VERIFY cmd */195195-};196196-197197-struct mtftformat {198198- unsigned int fmt_op; /* operation to perform */199199- union fmt_arg {200200- struct ftfmtparms fmt_parms; /* format parameters */201201- struct ftfmttrack fmt_track; /* ctrl while formatting */202202- struct ftfmtstatus fmt_status;203203- struct ftfmtverify fmt_verify; /* for verifying */ 204204- } fmt_arg;205205-};206206-207207-struct mtftcmd {208208- unsigned int ft_wait_before; /* timeout to wait for drive to get ready 209209- * before command is sent. Milliseconds210210- */211211- qic117_cmd_t ft_cmd; /* command to send */212212- unsigned char ft_parm_cnt; /* zero: no parm is sent. */213213- unsigned char ft_parms[3]; /* parameter(s) to send to214214- * the drive. The parms are nibbles215215- * driver sends cmd + 2 step pulses */216216- unsigned int ft_result_bits; /* if non zero, number of bits217217- * returned by the tape drive218218- */219219- unsigned int ft_result; /* the result returned by the tape drive*/220220- unsigned int ft_wait_after; /* timeout to wait for drive to get ready221221- * after command is sent. 0: don't wait */222222- int ft_status; /* status returned by ready wait223223- * undefined if timeout was 0.224224- */225225- int ft_error; /* error code if error status was set by 226226- * command227227- */228228-};229229-230153/* mag tape io control commands */231154#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */232155#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */233156#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */234157235235-/* The next two are used by the QIC-02 driver for runtime reconfiguration.236236- * See tpqic02.h for struct mtconfiginfo.237237- */238238-#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* get tape config */239239-#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* set tape config */240240-241241-/* the next six are used by the floppy ftape drivers and its frontends242242- * sorry, but MTIOCTOP commands are write only.243243- */244244-#define MTIOCRDFTSEG _IOWR('m', 6, struct mtftseg) /* read a segment */245245-#define MTIOCWRFTSEG _IOWR('m', 7, struct mtftseg) /* write a segment */246246-#define MTIOCVOLINFO _IOR('m', 8, struct mtvolinfo) /* info about volume */247247-#define MTIOCGETSIZE _IOR('m', 9, struct mttapesize)/* get cartridge size*/248248-#define MTIOCFTFORMAT _IOWR('m', 10, struct mtftformat) /* format ftape */249249-#define MTIOCFTCMD _IOWR('m', 11, struct mtftcmd) /* send QIC-117 cmd */250158251159/* Generic Mag Tape (device independent) status macros for examining252160 * mt_gstat -- HP-UX compatible.
-290
include/linux/qic117.h
···11-#ifndef _QIC117_H22-#define _QIC117_H33-44-/*55- * Copyright (C) 1993-1996 Bas Laarhoven,66- * (C) 1997 Claus-Justus Heine.77-88- This program is free software; you can redistribute it and/or modify99- it under the terms of the GNU General Public License as published by1010- the Free Software Foundation; either version 2, or (at your option)1111- any later version.1212-1313- This program is distributed in the hope that it will be useful,1414- but WITHOUT ANY WARRANTY; without even the implied warranty of1515- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1616- GNU General Public License for more details.1717-1818- You should have received a copy of the GNU General Public License1919- along with this program; see the file COPYING. If not, write to2020- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.2121-2222- *2323- * $Source: /homes/cvs/ftape-stacked/include/linux/qic117.h,v $2424- * $Revision: 1.2 $2525- * $Date: 1997/10/05 19:19:32 $2626- *2727- * This file contains QIC-117 spec. related definitions for the2828- * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux.2929- *3030- * These data were taken from the Quarter-Inch Cartridge3131- * Drive Standards, Inc. document titled:3232- * `Common Command Set Interface Specification for Flexible3333- * Disk Controller Based Minicartridge Tape Drives'3434- * document QIC-117 Revision J, 28 Aug 96.3535- * For more information, contact:3636- * Quarter-Inch Cartridge Drive Standards, Inc.3737- * 311 East Carrillo Street3838- * Santa Barbara, California 931013939- * Telephone (805) 963-38534040- * Fax (805) 962-15414141- * WWW http://www.qic.org4242- *4343- * Current QIC standard revisions (of interest) are:4444- * QIC-40-MC, Rev. M, 2 Sep 92.4545- * QIC-80-MC, Rev. N, 20 Mar 96.4646- * QIC-80-MC, Rev. K, 15 Dec 94.4747- * QIC-113, Rev. G, 15 Jun 95.4848- * QIC-117, Rev. J, 28 Aug 96.4949- * QIC-122, Rev. B, 6 Mar 91.5050- * QIC-130, Rev. C, 2 Sep 92.5151- * QIC-3010-MC, Rev. F, 14 Jun 95.5252- * QIC-3020-MC, Rev. G, 31 Aug 95.5353- * QIC-CRF3, Rev. B, 15 Jun 95.5454- * */5555-5656-/*5757- * QIC-117 common command set rev. J.5858- * These commands are sent to the tape unit5959- * as number of pulses over the step line.6060- */6161-6262-typedef enum {6363- QIC_NO_COMMAND = 0,6464- QIC_RESET = 1,6565- QIC_REPORT_NEXT_BIT = 2,6666- QIC_PAUSE = 3,6767- QIC_MICRO_STEP_PAUSE = 4,6868- QIC_ALTERNATE_TIMEOUT = 5,6969- QIC_REPORT_DRIVE_STATUS = 6,7070- QIC_REPORT_ERROR_CODE = 7,7171- QIC_REPORT_DRIVE_CONFIGURATION = 8,7272- QIC_REPORT_ROM_VERSION = 9,7373- QIC_LOGICAL_FORWARD = 10,7474- QIC_PHYSICAL_REVERSE = 11,7575- QIC_PHYSICAL_FORWARD = 12,7676- QIC_SEEK_HEAD_TO_TRACK = 13,7777- QIC_SEEK_LOAD_POINT = 14,7878- QIC_ENTER_FORMAT_MODE = 15,7979- QIC_WRITE_REFERENCE_BURST = 16,8080- QIC_ENTER_VERIFY_MODE = 17,8181- QIC_STOP_TAPE = 18,8282-/* commands 19-20: reserved */8383- QIC_MICRO_STEP_HEAD_UP = 21,8484- QIC_MICRO_STEP_HEAD_DOWN = 22,8585- QIC_SOFT_SELECT = 23,8686- QIC_SOFT_DESELECT = 24,8787- QIC_SKIP_REVERSE = 25,8888- QIC_SKIP_FORWARD = 26,8989- QIC_SELECT_RATE = 27,9090-/* command 27, in ccs2: Select Rate or Format */9191- QIC_ENTER_DIAGNOSTIC_1 = 28,9292- QIC_ENTER_DIAGNOSTIC_2 = 29,9393- QIC_ENTER_PRIMARY_MODE = 30,9494-/* command 31: vendor unique */9595- QIC_REPORT_VENDOR_ID = 32,9696- QIC_REPORT_TAPE_STATUS = 33,9797- QIC_SKIP_EXTENDED_REVERSE = 34,9898- QIC_SKIP_EXTENDED_FORWARD = 35,9999- QIC_CALIBRATE_TAPE_LENGTH = 36,100100- QIC_REPORT_FORMAT_SEGMENTS = 37,101101- QIC_SET_FORMAT_SEGMENTS = 38,102102-/* commands 39-45: reserved */103103- QIC_PHANTOM_SELECT = 46,104104- QIC_PHANTOM_DESELECT = 47105105-} qic117_cmd_t;106106-107107-typedef enum {108108- discretional = 0, required, ccs1, ccs2109109-} qic_compatibility;110110-111111-typedef enum {112112- unused, mode, motion, report113113-} command_types;114114-115115-struct qic117_command_table {116116- char *name;117117- __u8 mask;118118- __u8 state;119119- __u8 cmd_type;120120- __u8 non_intr;121121- __u8 level;122122-};123123-124124-#define QIC117_COMMANDS {\125125-/* command mask state cmd_type */\126126-/* | name | | | non_intr */\127127-/* | | | | | | level */\128128-/* 0*/ {NULL, 0x00, 0x00, mode, 0, discretional},\129129-/* 1*/ {"soft reset", 0x00, 0x00, motion, 1, required},\130130-/* 2*/ {"report next bit", 0x00, 0x00, report, 0, required},\131131-/* 3*/ {"pause", 0x36, 0x24, motion, 1, required},\132132-/* 4*/ {"micro step pause", 0x36, 0x24, motion, 1, required},\133133-/* 5*/ {"alternate command timeout", 0x00, 0x00, mode, 0, required},\134134-/* 6*/ {"report drive status", 0x00, 0x00, report, 0, required},\135135-/* 7*/ {"report error code", 0x01, 0x01, report, 0, required},\136136-/* 8*/ {"report drive configuration",0x00, 0x00, report, 0, required},\137137-/* 9*/ {"report rom version", 0x00, 0x00, report, 0, required},\138138-/*10*/ {"logical forward", 0x37, 0x25, motion, 0, required},\139139-/*11*/ {"physical reverse", 0x17, 0x05, motion, 0, required},\140140-/*12*/ {"physical forward", 0x17, 0x05, motion, 0, required},\141141-/*13*/ {"seek head to track", 0x37, 0x25, motion, 0, required},\142142-/*14*/ {"seek load point", 0x17, 0x05, motion, 1, required},\143143-/*15*/ {"enter format mode", 0x1f, 0x05, mode, 0, required},\144144-/*16*/ {"write reference burst", 0x1f, 0x05, motion, 1, required},\145145-/*17*/ {"enter verify mode", 0x37, 0x25, mode, 0, required},\146146-/*18*/ {"stop tape", 0x00, 0x00, motion, 1, required},\147147-/*19*/ {"reserved (19)", 0x00, 0x00, unused, 0, discretional},\148148-/*20*/ {"reserved (20)", 0x00, 0x00, unused, 0, discretional},\149149-/*21*/ {"micro step head up", 0x02, 0x00, motion, 0, required},\150150-/*22*/ {"micro step head down", 0x02, 0x00, motion, 0, required},\151151-/*23*/ {"soft select", 0x00, 0x00, mode, 0, discretional},\152152-/*24*/ {"soft deselect", 0x00, 0x00, mode, 0, discretional},\153153-/*25*/ {"skip segments reverse", 0x36, 0x24, motion, 1, required},\154154-/*26*/ {"skip segments forward", 0x36, 0x24, motion, 1, required},\155155-/*27*/ {"select rate or format", 0x03, 0x01, mode, 0, required /* [ccs2] */},\156156-/*28*/ {"enter diag mode 1", 0x00, 0x00, mode, 0, discretional},\157157-/*29*/ {"enter diag mode 2", 0x00, 0x00, mode, 0, discretional},\158158-/*30*/ {"enter primary mode", 0x00, 0x00, mode, 0, required},\159159-/*31*/ {"vendor unique (31)", 0x00, 0x00, unused, 0, discretional},\160160-/*32*/ {"report vendor id", 0x00, 0x00, report, 0, required},\161161-/*33*/ {"report tape status", 0x04, 0x04, report, 0, ccs1},\162162-/*34*/ {"skip extended reverse", 0x36, 0x24, motion, 1, ccs1},\163163-/*35*/ {"skip extended forward", 0x36, 0x24, motion, 1, ccs1},\164164-/*36*/ {"calibrate tape length", 0x17, 0x05, motion, 1, ccs2},\165165-/*37*/ {"report format segments", 0x17, 0x05, report, 0, ccs2},\166166-/*38*/ {"set format segments", 0x17, 0x05, mode, 0, ccs2},\167167-/*39*/ {"reserved (39)", 0x00, 0x00, unused, 0, discretional},\168168-/*40*/ {"vendor unique (40)", 0x00, 0x00, unused, 0, discretional},\169169-/*41*/ {"vendor unique (41)", 0x00, 0x00, unused, 0, discretional},\170170-/*42*/ {"vendor unique (42)", 0x00, 0x00, unused, 0, discretional},\171171-/*43*/ {"vendor unique (43)", 0x00, 0x00, unused, 0, discretional},\172172-/*44*/ {"vendor unique (44)", 0x00, 0x00, unused, 0, discretional},\173173-/*45*/ {"vendor unique (45)", 0x00, 0x00, unused, 0, discretional},\174174-/*46*/ {"phantom select", 0x00, 0x00, mode, 0, discretional},\175175-/*47*/ {"phantom deselect", 0x00, 0x00, mode, 0, discretional},\176176-}177177-178178-/*179179- * Status bits returned by QIC_REPORT_DRIVE_STATUS180180- */181181-182182-#define QIC_STATUS_READY 0x01 /* Drive is ready or idle. */183183-#define QIC_STATUS_ERROR 0x02 /* Error detected, must read184184- error code to clear this */185185-#define QIC_STATUS_CARTRIDGE_PRESENT 0x04 /* Tape is present */186186-#define QIC_STATUS_WRITE_PROTECT 0x08 /* Tape is write protected */187187-#define QIC_STATUS_NEW_CARTRIDGE 0x10 /* New cartridge inserted, must188188- read error status to clear. */189189-#define QIC_STATUS_REFERENCED 0x20 /* Cartridge appears to have been190190- formatted. */191191-#define QIC_STATUS_AT_BOT 0x40 /* Cartridge is at physical192192- beginning of tape. */193193-#define QIC_STATUS_AT_EOT 0x80 /* Cartridge is at physical end194194- of tape. */195195-/*196196- * Status bits returned by QIC_REPORT_DRIVE_CONFIGURATION197197- */198198-199199-#define QIC_CONFIG_RATE_MASK 0x18200200-#define QIC_CONFIG_RATE_SHIFT 3201201-#define QIC_CONFIG_RATE_250 0202202-#define QIC_CONFIG_RATE_500 2203203-#define QIC_CONFIG_RATE_1000 3204204-#define QIC_CONFIG_RATE_2000 1205205-#define QIC_CONFIG_RATE_4000 0 /* since QIC-117 Rev. J */206206-207207-#define QIC_CONFIG_LONG 0x40 /* Extra Length Tape Detected */208208-#define QIC_CONFIG_80 0x80 /* QIC-80 detected. */209209-210210-/*211211- * Status bits returned by QIC_REPORT_TAPE_STATUS212212- */213213-214214-#define QIC_TAPE_STD_MASK 0x0f215215-#define QIC_TAPE_QIC40 0x01216216-#define QIC_TAPE_QIC80 0x02217217-#define QIC_TAPE_QIC3020 0x03218218-#define QIC_TAPE_QIC3010 0x04219219-220220-#define QIC_TAPE_LEN_MASK 0x70221221-#define QIC_TAPE_205FT 0x10222222-#define QIC_TAPE_307FT 0x20223223-#define QIC_TAPE_VARIABLE 0x30224224-#define QIC_TAPE_1100FT 0x40225225-#define QIC_TAPE_FLEX 0x60226226-227227-#define QIC_TAPE_WIDE 0x80228228-229229-/* Define a value (in feet) slightly higher than 230230- * the possible maximum tape length.231231- */232232-#define QIC_TOP_TAPE_LEN 1500233233-234234-/*235235- * Errors: List of error codes, and their severity.236236- */237237-238238-typedef struct {239239- char *message; /* Text describing the error. */240240- unsigned int fatal:1; /* Non-zero if the error is fatal. */241241-} ftape_error;242242-243243-#define QIC117_ERRORS {\244244- /* 0*/ { "No error", 0, },\245245- /* 1*/ { "Command Received while Drive Not Ready", 0, },\246246- /* 2*/ { "Cartridge Not Present or Removed", 1, },\247247- /* 3*/ { "Motor Speed Error (not within 1%)", 1, },\248248- /* 4*/ { "Motor Speed Fault (jammed, or gross speed error", 1, },\249249- /* 5*/ { "Cartridge Write Protected", 1, },\250250- /* 6*/ { "Undefined or Reserved Command Code", 1, },\251251- /* 7*/ { "Illegal Track Address Specified for Seek", 1, },\252252- /* 8*/ { "Illegal Command in Report Subcontext", 0, },\253253- /* 9*/ { "Illegal Entry into a Diagnostic Mode", 1, },\254254- /*10*/ { "Broken Tape Detected (based on hole sensor)", 1, },\255255- /*11*/ { "Warning--Read Gain Setting Error", 1, },\256256- /*12*/ { "Command Received While Error Status Pending (obs)", 1, },\257257- /*13*/ { "Command Received While New Cartridge Pending", 1, },\258258- /*14*/ { "Command Illegal or Undefined in Primary Mode", 1, },\259259- /*15*/ { "Command Illegal or Undefined in Format Mode", 1, },\260260- /*16*/ { "Command Illegal or Undefined in Verify Mode", 1, },\261261- /*17*/ { "Logical Forward Not at Logical BOT or no Format Segments in Format Mode", 1, },\262262- /*18*/ { "Logical EOT Before All Segments generated", 1, },\263263- /*19*/ { "Command Illegal When Cartridge Not Referenced", 1, },\264264- /*20*/ { "Self-Diagnostic Failed (cannot be cleared)", 1, },\265265- /*21*/ { "Warning EEPROM Not Initialized, Defaults Set", 1, },\266266- /*22*/ { "EEPROM Corrupted or Hardware Failure", 1, },\267267- /*23*/ { "Motion Time-out Error", 1, },\268268- /*24*/ { "Data Segment Too Long -- Logical Forward or Pause", 1, },\269269- /*25*/ { "Transmit Overrun (obs)", 1, },\270270- /*26*/ { "Power On Reset Occurred", 0, },\271271- /*27*/ { "Software Reset Occurred", 0, },\272272- /*28*/ { "Diagnostic Mode 1 Error", 1, },\273273- /*29*/ { "Diagnostic Mode 2 Error", 1, },\274274- /*30*/ { "Command Received During Non-Interruptible Process", 1, },\275275- /*31*/ { "Rate or Format Selection Error", 1, },\276276- /*32*/ { "Illegal Command While in High Speed Mode", 1, },\277277- /*33*/ { "Illegal Seek Segment Value", 1, },\278278- /*34*/ { "Invalid Media", 1, },\279279- /*35*/ { "Head Positioning Failure", 1, },\280280- /*36*/ { "Write Reference Burst Failure", 1, },\281281- /*37*/ { "Prom Code Missing", 1, },\282282- /*38*/ { "Invalid Format", 1, },\283283- /*39*/ { "EOT/BOT System Failure", 1, },\284284- /*40*/ { "Prom A Checksum Error", 1, },\285285- /*41*/ { "Drive Wakeup Reset Occurred", 1, },\286286- /*42*/ { "Prom B Checksum Error", 1, },\287287- /*43*/ { "Illegal Entry into Format Mode", 1, },\288288-}289289-290290-#endif /* _QIC117_H */