home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / gtak212b.zip / SOURCE.ZIP / TAPE / errtab.c < prev    next >
C/C++ Source or Header  |  1992-09-02  |  9KB  |  295 lines

  1. /*****************************************************************************
  2.  * $Id: errtab.c,v 1.2 1992/09/02 19:05:46 ak Exp $
  3.  *****************************************************************************
  4.  * $Log: errtab.c,v $
  5.  * Revision 1.2  1992/09/02  19:05:46  ak
  6.  * Version 2.0
  7.  * - EMX version
  8.  * - AIX version
  9.  * - SCSI-2 commands
  10.  * - ADD Driver
  11.  * - blocksize support
  12.  *
  13.  * Revision 1.1.1.1  1992/01/06  20:27:22  ak
  14.  * Interface now based on ST01 and ASPI.
  15.  * AHA_DRVR no longer supported.
  16.  * Files reorganized.
  17.  *
  18.  * Revision 1.1  1992/01/06  20:27:20  ak
  19.  * Initial revision
  20.  *
  21.  *****************************************************************************/
  22.  
  23. static char *rcsid = "$Id: errtab.c,v 1.2 1992/09/02 19:05:46 ak Exp $";
  24.  
  25. #include "scsi.h"
  26.  
  27. char    *senseTab[] = {
  28.     "No error",
  29.     "Recovered data",
  30.     "Not ready",
  31.     "Media error",
  32.     "Hardware error",
  33.     "Illegal request",
  34.     "Unit attention",
  35.     "Write protected",
  36.     "At end of logical media",
  37.     "Vendor sense key",
  38.     "Copy aborted",
  39.     "Aborted",
  40.     "Search equal",
  41.     "Media overflow",
  42.     "Verify failed",
  43.     "Reserved"
  44. };
  45.  
  46. ErrorTable targetStatusTab[] = {
  47.     GoodStatus,        "Good status",
  48.     CheckStatus,        "Check status",
  49.     ConditionMet,        "Condition met",
  50.     BusyStatus,        "Device busy",
  51.     Intermediate,        "Linked good status",
  52.     IntermediateCondMet,    "Linked good status, condition met",
  53.     ReservationConflict,    "Reservation conflict",
  54.     CommandTerminated,    "Command terminated",
  55.     QueueFull,        "Queue full",
  56.     -1
  57. };
  58.  
  59. ErrorTable tdc3600ercd[] = {
  60. #if !defined(__SMALL__) && !defined(__MEDIUM__)
  61.     0x00,    "No error",
  62.     0x02,    "Hardware error",
  63.     0x04,    "Media not loaded",
  64.     0x09,    "Media not loaded",
  65.     0x0A,    "Insufficient capacity",
  66.     0x11,    "Uncorrectable data error",
  67.     0x14,    "No record found",
  68.     0x17,    "Write protected",
  69.     0x19,    "Bad block found",
  70.     0x1C,    "File mark detected",
  71.     0x1D,    "Compare error",
  72.     0x20,    "Invalid command",
  73.     0x30,    "Unit attention",
  74.     0x33,    "Append error",
  75.     0x34,    "Read End-Of-Media",
  76. #endif
  77.     -1
  78. };
  79.  
  80. ErrorTable tdc3600xercd[] = {
  81. #if !defined(__SMALL__) && !defined(__MEDIUM__)
  82.     0x00,    "No error",
  83.     0x01,    "Append error",
  84.     0x02,    "Bad command block",
  85.     0x03,    "Bad parameter block",
  86.     0x04,    "Bus parity error",
  87.     0x05,    "Busy",
  88.     0x06,    "Capstan servo error",
  89.     0x07,    "Cartridge removed",
  90.     0x08,    "Compare error",
  91.     0x09,    "Copy data error",
  92.     0x0A,    "Copy management error",
  93.     0x0B,    "File mark error",
  94.     0x0C,    "Head servo error",
  95.     0x0D,    "Illegal command",
  96.     0x0E,    "Illegal copy",
  97.     0x0F,    "Illegal length",
  98.     0x10,    "Inappropriate request",
  99.     0x11,    "Latch error",
  100.     0x12,    "No cartridge",
  101.     0x13,    "Not loaded",
  102.     0x14,    "Power-on request",
  103.     0x15,    "QIC. No data detected",
  104.     0x16,    "Read after write error",
  105.     0x17,    "Read EOM logical",
  106.     0x18,    "Read EOM physical",
  107.     0x19,    "Reservation conflict",
  108.     0x1A,    "Sensor error",
  109.     0x1B,    "Tape runout",
  110.     0x1C,    "Unit attention",
  111.     0x1D,    "Write EOM warning",
  112.     0x1E,    "Write EOM",
  113.     0x1F,    "Catridge write protected",
  114.     0x20,    "16 rewrite errors",
  115.     0x21,    "24 rereads, block found",
  116.     0x22,    "24 rereads, block not found",
  117.     0x23,    "Illegal copy function",
  118.     0x24,    "Illegal header",
  119.     0x25,    "No header",
  120.     0x26,    "Too large address",
  121.     0x27,    "Bad ID or LUN",
  122.     0x28,    "Partial description",
  123.     0x29,    "Bad target status",
  124.     0x2A,    "Check condition",
  125.     0x2B,    "Data transfer error",
  126.     0x2C,    "Selection failure",
  127.     0x2D,    "Sequence error",
  128.     0x2E,    "Illegal block size",
  129. #endif
  130.     -1
  131. };
  132.  
  133. ErrorTable scsi2asc[] = {
  134. #if !defined(__SMALL__) && !defined(__MEDIUM__)
  135.     0x0000,    "No additional sense info",
  136.     0x0001,    "Filemark detected",
  137.     0x0002,    "End of partition/medium detected",
  138.     0x0003,    "Setmark detected",
  139.     0x0004,    "Beginning of partition/medium detected",
  140.     0x0005,    "End of data detected",
  141.     0x0006,    "I/O process terminated",
  142.     0x0300,    "Peripheral device write fault",
  143.     0x0301,    "No write current",
  144.     0x0302,    "Excessive write errors",
  145.     0x0400,    "Logical unit not ready",
  146.     0x0401,    "Logical unit is in process of becoming ready",
  147.     0x0402,    "Logical unit not ready, initializing command required",
  148.     0x0403,    "Logical unit not ready, manual intervention required",
  149.     0x0404,    "Logical unit not ready, format in progress",
  150.     0x0500,    "Logical unit does not respond to selection",
  151.     0x0700,    "Multiple peripheral devices selected",
  152.     0x0800,    "Logical unit communication failure",
  153.     0x0801,    "Logical unit communication time-out",
  154.     0x0802,    "Logical unit communication parity error",
  155.     0x0900,    "Track following error",
  156.     0x0A00,    "Error log overflow",
  157.     0x0C00,    "Write error",
  158.     0x1100,    "Unrecovered read error",
  159.     0x1101,    "Read retries exhausted",
  160.     0x1102,    "Error too long to correct",
  161.     0x1103,    "Multiple read errors",
  162.     0x1108,    "Incomplete block read",
  163.     0x1109,    "No gap found",
  164.     0x110A,    "Miscorrected error",
  165.     0x1400,    "Recorded entity not found",
  166.     0x1401,    "Record not found",
  167.     0x1500,    "Random positioning error",
  168.     0x1501,    "Mechanical positioning error",
  169.     0x1502,    "Positioning error detected  by read of medium",
  170.     0x1700,    "Recovered data with no error correction applied",
  171.     0x1701,    "Recovered data with retries",
  172.     0x1702,    "Recovered data with positive head offset",
  173.     0x1703,    "Recovered data with negative head offset",
  174.     0x1800,    "Recovered data with error correction applied",
  175.     0x1A00,    "Parameter list length error",
  176.     0x1B00,    "Synchronous data transfer error",
  177.     0x2000,    "Invalid command operation code",
  178.     0x2400,    "Invalid field in CDB",
  179.     0x2500,    "Logical unit not supported",
  180.     0x2600,    "Invalid field in parameter list",
  181.     0x2601,    "Parameter not supported",
  182.     0x2602,    "Parameter value invalid",
  183.     0x2603,    "Threshold parameters not supported",
  184.     0x2700,    "Write protected",
  185.     0x2800,    "Not ready to ready transition (medium may have changed)",
  186.     0x2900,    "Power on, reset or bus device reset occurred",
  187.     0x2A00,    "Parameters changed",
  188.     0x2A01,    "Mode parameters changed",
  189.     0x2A02,    "Log parameters changed",
  190.     0x2B00,    "Copy cannot execute since host cannot disconnect",
  191.     0x2C00,    "Command sequence error",
  192.     0x2D00,    "Overwrite error on update in place",
  193.     0x2F00,    "Commands cleared by another initiator",
  194.     0x3000,    "Incompatible medium installed",
  195.     0x3001,    "Cannot read medium - unknown format",
  196.     0x3002,    "Cannot read medium - incompatible format",
  197.     0x3003,    "Cleaning cartridge installed",
  198.     0x3100,    "Medium format corrupted",
  199.     0x3300,    "Tape length error",
  200.     0x3700,    "Rounded parameter",
  201.     0x3900,    "Saving parameters not supported",
  202.     0x3A00,    "Medium not present",
  203.     0x3B00,    "Sequntial positioning error",
  204.     0x3B01,    "Tape position error at beginning of medium",
  205.     0x3B02,    "Tape position error at end of medium",
  206.     0x3B08,    "Reposition error",
  207.     0x3D00,    "Invalid bits in identify message",
  208.     0x3E00,    "Logical unit has not self-configured yet",
  209.     0x3F00,    "Target operating conditions have changed",
  210.     0x3F01,    "Microcode has been changed",
  211.     0x3F02,    "Changed operatin definition",
  212.     0x3F03,    "Inquiry data has changed",
  213.     0x4300,    "Message error",
  214.     0x4400,    "Internal target failure",
  215.     0x4500,    "Select or reselect failure",
  216.     0x4600,    "Unsuccessful soft reset",
  217.     0x4700,    "SCSI parity error",
  218.     0x4800,    "Initiator detected error message received",
  219.     0x4900,    "Invalid message error",
  220.     0x4A00,    "Command phase error",
  221.     0x4B00,    "Data phase error",
  222.     0x4C00,    "Logical unit failed self-configuration",
  223.     0x5000,    "Write append error",
  224.     0x5001,    "Write append position error",
  225.     0x5002,    "Position error related to timing",
  226.     0x5100,    "Erase failure",
  227.     0x5200,    "Cartridge fault",
  228.     0x5300,    "Media load or eject failed",
  229.     0x5301,    "Unload tape failure",
  230.     0x5302,    "Medium removal prevented",
  231.     0x5A00,    "Operator request or state change input (unspecified)",
  232.     0x5A01,    "Operator medium removal request",
  233.     0x5A02,    "Operator selected write protect",
  234.     0x5A03,    "Operator selected write permit",
  235.     0x5B00,    "Log exception",
  236.     0x5B01,    "Treshold condition met",
  237.     0x5B02,    "Log counter at maximum",
  238.     0x5B03,    "Log list codes exhausted",
  239. #endif
  240.     -1
  241. };
  242.  
  243. ErrorTable addErrorTab[] = {
  244.     0x11,    "Command not supported",
  245.     0x12,    "Command syntax",
  246.     0x13,    "Bad scatter/gather list",
  247.     0x14,    "Out of ressources",
  248.     0x15,    "Aborted",
  249.     0x16,    "ADD software failure",
  250.     0x17,    "OS software failure",
  251.     0x21,    "Unit not allocated",
  252.     0x22,    "Unit busy",
  253.     0x23,    "Not ready",
  254.     0x24,    "Powered off",
  255.     0x31,    "Addressing error",
  256.     0x32,    "Volume overflow",
  257.     0x33,    "CRC error",
  258.     0x41,    "Not formatted",
  259.     0x42,    "Media not supported",
  260.     0x43,    "Write protected",
  261.     0x44,    "Media changed",
  262.     0x45,    "Media not present",
  263.     0x51,    "Host bus error",
  264.     0x52,    "Adapter SCSI bus error",
  265.     0x53,    "Adapter overrun",
  266.     0x54,    "Adapter underrun",
  267.     0x55,    "Adapter diagnose failure",
  268.     0x56,    "Adapter timeout",
  269.     0x57,    "Device timeout",
  270.     0x58,    "Adapter operation not supported",
  271.     0x59,    "Refer to status",
  272.     0x5A,    "Nonspecific adapter error",
  273.     0x61,    "Device SCSI bus error",
  274.     0x62,    "Device operation not supported",
  275.     0x63,    "Device diagnose failure",
  276.     0x64,    "Device busy",
  277.     0x65,    "Device overrun",
  278.     0x66,    "Device underrun",
  279.     0x67,    "Device reset",
  280.     0x68,    "Nonspecific device error",
  281.     -1
  282. };
  283.  
  284. char *
  285. find_error(ErrorTable *p, unsigned code)
  286. {
  287.     static char other[20];
  288.  
  289.     for (; p->code != (unsigned)-1; ++p)
  290.         if (p->code == code)
  291.             return p->text;
  292.     sprintf(other, "Unknown error code: %02X", code);
  293.     return other;
  294. }
  295.