The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/scsi/scsi_sense.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include <sys/param.h>
    2 
    3 #include <scsi/scsiconf.h>
    4 
    5 /* XXX There should be a way for a type driver to have its own
    6  *     private senses and add them when it is added.
    7  */
    8 
    9 #if !defined(NO_SCSI_SENSE)
   10 
   11 #include "sd.h"
   12 #include "st.h"
   13 #define NSPRINT 0
   14 #include "pt.h"
   15 #include "worm.h"
   16 #include "cd.h"
   17 #define NSCAN 0
   18 #include "od.h"
   19 #include "ch.h"
   20 #define NCOMM 0
   21 
   22 static struct
   23 {
   24         u_char asc;
   25         u_char ascq;
   26         char *desc;
   27 } tab[] = {
   28 #if (NCH > 0)
   29         {0x28, 0x01, "Import or export element accessed" },
   30         {0x21, 0x01, "Invalid element address" },
   31         {0x3b, 0x0d, "Medium destination element full" },
   32         {0x3b, 0x0e, "Medium source element empty" },
   33 #endif
   34 #if (NOD > 0)
   35         {0x58, 0x00, "Generation does not exist" },
   36         {0x59, 0x00, "Updated block read" },
   37 #endif
   38 #if (NSCAN > 0)
   39         {0x2c, 0x02, "Invalid combination of windows specified" },
   40         {0x60, 0x00, "Lamp failure" },
   41         {0x61, 0x02, "Out of focus" },
   42         {0x3b, 0x0c, "Position past beginning of medium" },
   43         {0x3b, 0x0b, "Position past end of medium" },
   44         {0x3b, 0x0a, "Read past beginning of medium" },
   45         {0x3b, 0x09, "Read past end of medium" },
   46         {0x62, 0x00, "Scan head positioning error" },
   47         {0x2c, 0x01, "Too many windows specified" },
   48         {0x61, 0x01, "Unable to acquire video" },
   49         {0x61, 0x00, "Video acquisition error" },
   50 #endif
   51 #if (NCD > 0)
   52         {0x00, 0x11, "Audio play operation in progress" },
   53         {0x00, 0x12, "Audio play operation paused" },
   54         {0x00, 0x14, "Audio play operation stopped due to error" },
   55         {0x00, 0x13, "Audio play operation successfully completed" },
   56         {0x63, 0x00, "End of user area encountered on this track" },
   57         {0x64, 0x00, "Illegal mode for this track" },
   58         {0x00, 0x15, "No current audio status to return" },
   59         {0x18, 0x03, "Recovered data with CIRC" },
   60         {0x18, 0x04, "Recovered data with L-EC" },
   61         {0x57, 0x00, "Unable to recover table-of-contents" },
   62 #endif
   63 #if (NWORM > 0)||(NOD > 0)
   64         {0x11, 0x07, "Data resynchronization error" },
   65 #endif
   66 #if (NWORM > 0)||(NCD > 0)||(NOD > 0)
   67         {0x11, 0x06, "Circ unrecovered error" },
   68         {0x09, 0x02, "Focus servo failure" },
   69         {0x11, 0x05, "L-EC uncorrectable error" },
   70         {0x17, 0x04, "Recovered data with retries and/or CIRC applied" },
   71         {0x09, 0x03, "Spindle servo failure" },
   72         {0x09, 0x01, "Tracking servo failure" },
   73 #endif
   74 #if (NPT > 0)
   75         {0x54, 0x00, "SCSI to host system interface failure" },
   76         {0x55, 0x00, "System resource failure" },
   77 #endif
   78 #if (NSPRINT > 0)
   79         {0x3b, 0x07, "Failed to sense bottom-of-form" },
   80         {0x3b, 0x06, "Failed to sense top-of-form" },
   81         {0x3b, 0x05, "Paper jam" },
   82         {0x36, 0x00, "Ribbon, ink, or toner failure" },
   83         {0x3b, 0x04, "Slew failure" },
   84         {0x3b, 0x03, "Tape or electronic vertical forms unit not ready" },
   85 #endif
   86 #if (NST > 0)
   87         {0x14, 0x04, "Block sequence error" },
   88         {0x52, 0x00, "Cartridge fault" },
   89         {0x14, 0x03, "End-of-data not found" },
   90         {0x03, 0x02, "Excessive write errors" },
   91         {0x00, 0x01, "Filemark detected" },
   92         {0x14, 0x02, "Filemark or setmark not found" },
   93         {0x11, 0x08, "Incomplete block read" },
   94         {0x11, 0x09, "No gap found" },
   95         {0x03, 0x01, "No write current" },
   96         {0x2d, 0x00, "Overwrite error on update in place" },
   97         {0x50, 0x02, "Position error related to timing" },
   98         {0x3b, 0x08, "Reposition error" },
   99         {0x00, 0x03, "Setmark detected" },
  100         {0x33, 0x00, "Tape length error" },
  101         {0x3b, 0x01, "Tape position error at beginning-of-medium" },
  102         {0x3b, 0x02, "Tape position error at end-of-medium" },
  103         {0x53, 0x01, "Unload tape failure" },
  104         {0x50, 0x00, "Write append error" },
  105         {0x50, 0x01, "Write append position error" },
  106 #endif
  107 #if (NST > 0)||(NOD > 0)
  108         {0x51, 0x00, "Erase failure" },
  109 #endif
  110 #if (NST > 0)||(NSCAN > 0)
  111         {0x00, 0x04, "Beginning-of-partition/medium detected" },
  112         {0x00, 0x05, "End-of-data detected" },
  113         {0x00, 0x02, "End-of-partition/medium detected" },
  114         {0x0c, 0x00, "Write error" },
  115 #endif
  116 #if (NST > 0)||(NSPRINT > 0)
  117         {0x3b, 0x00, "Sequential positioning error" },
  118 #endif
  119 #if (NSD > 0)
  120         {0x41, 0x00, "Data path failure (should use 40 nn)" },
  121         {0x22, 0x00, "Illegal function (should use 20 00, 24 00, or 26 00)" },
  122         {0x42, 0x00, "Power-on or self-test failure (should use 40 nn)" },
  123         {0x40, 0x00, "Ram failure (should use 40 nn)" },
  124 #endif
  125 #if (NSD > 0)||(NOD > 0)
  126         {0x19, 0x00, "Defect list error" },
  127         {0x19, 0x03, "Defect list error in grown list" },
  128         {0x19, 0x02, "Defect list error in primary list" },
  129         {0x19, 0x01, "Defect list not available" },
  130         {0x1c, 0x00, "Defect list not found" },
  131         {0x1c, 0x02, "Grown defect list not found" },
  132         {0x1c, 0x01, "Primary defect list not found" },
  133         {0x5c, 0x00, "RPL status change" },
  134         {0x5c, 0x02, "Spindles not synchronized" },
  135         {0x5c, 0x01, "Spindles synchronized" },
  136 #endif
  137 #if (NSD > 0)||(NWORM > 0)||(NOD > 0)
  138         {0x13, 0x00, "Address mark not found for data field" },
  139         {0x12, 0x00, "Address mark not found for id field" },
  140         {0x16, 0x00, "Data synchronization mark error" },
  141         {0x32, 0x01, "Defect list update failure" },
  142         {0x10, 0x00, "Id CRC or ECC error" },
  143         {0x1d, 0x00, "Miscompare during verify operation" },
  144         {0x32, 0x00, "No defect spare location available" },
  145         {0x01, 0x00, "No index/sector signal" },
  146         {0x17, 0x06, "Recovered data without ECC - data auto-reallocated" },
  147         {0x17, 0x07, "Recovered data without ECC - recommend reassignment" },
  148         {0x17, 0x08, "Recovered data without ECC - recommend rewrite" },
  149         {0x1e, 0x00, "Recovered ID with ECC correction" },
  150         {0x11, 0x04, "Unrecovered read error - auto reallocate failed" },
  151         {0x11, 0x0b, "Unrecovered read error - recommend reassignment" },
  152         {0x11, 0x0c, "Unrecovered read error - recommend rewrite the data" },
  153         {0x0c, 0x02, "Write error - auto reallocation failed" },
  154         {0x0c, 0x01, "Write error recovered with auto reallocation" },
  155 #endif
  156 #if (NSD > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)
  157         {0x18, 0x02, "Recovered data - data auto-reallocated" },
  158         {0x18, 0x05, "Recovered data - recommend reassignment" },
  159         {0x18, 0x06, "Recovered data - recommend rewrite" },
  160         {0x17, 0x05, "Recovered data using previous sector id" },
  161         {0x18, 0x01, "Recovered data with error correction & retries applied" },
  162 #endif
  163 #if (NSD > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)||(NCH > 0)
  164         {0x06, 0x00, "No reference position found" },
  165         {0x02, 0x00, "No seek complete" },
  166 #endif
  167 #if (NSD > 0)||(NSPRINT > 0)||(NOD > 0)
  168         {0x31, 0x01, "Format command failed" },
  169 #endif
  170 #if (NSD > 0)||(NST > 0)
  171         {0x30, 0x03, "Cleaning cartridge installed" },
  172 #endif
  173 #if (NSD > 0)||(NST > 0)||(NOD > 0)
  174         {0x11, 0x0a, "Miscorrected error" },
  175 #endif
  176 #if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NOD > 0)
  177         {0x31, 0x00, "Medium format corrupted" },
  178         {0x5a, 0x03, "Operator selected write permit" },
  179         {0x5a, 0x02, "Operator selected write protect" },
  180         {0x27, 0x00, "Write protected" },
  181 #endif
  182 #if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NSCAN > 0)||(NOD > 0)
  183         {0x11, 0x02, "Error too long to correct" },
  184         {0x11, 0x03, "Multiple read errors" },
  185         {0x11, 0x01, "Read retries exhausted" },
  186 #endif
  187 #if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)
  188         {0x30, 0x02, "Cannot read medium - incompatible format" },
  189         {0x30, 0x01, "Cannot read medium - unknown format" },
  190         {0x15, 0x02, "Positioning error detected by read of medium" },
  191         {0x14, 0x01, "Record not found" },
  192         {0x18, 0x00, "Recovered data with error correction applied" },
  193         {0x17, 0x03, "Recovered data with negative head offset" },
  194         {0x17, 0x02, "Recovered data with positive head offset" },
  195         {0x09, 0x00, "Track following error" },
  196 #endif
  197 #if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NOD > 0)||(NCH > 0)
  198         {0x30, 0x00, "Incompatible medium installed" },
  199         {0x21, 0x00, "Logical block address out of range" },
  200         {0x53, 0x02, "Medium removal prevented" },
  201         {0x5a, 0x01, "Operator medium removal request" },
  202 #endif
  203 #if (NSD > 0)||(NST > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)
  204         {0x17, 0x00, "Recovered data with no error correction applied" },
  205         {0x17, 0x01, "Recovered data with retries" },
  206         {0x11, 0x00, "Unrecovered read error" },
  207 #endif
  208 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NOD > 0)
  209         {0x04, 0x04, "Logical unit not ready, format in progress" },
  210 #endif
  211 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NSCAN > 0)||(NOD > 0)
  212         {0x03, 0x00, "Peripheral device write fault" },
  213 #endif
  214 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)
  215         {0x14, 0x00, "Recorded entity not found" },
  216 #endif
  217 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(NCH > 0)
  218         {0x15, 0x01, "Mechanical positioning error" },
  219         {0x53, 0x00, "Media load or eject failed" },
  220         {0x3a, 0x00, "Medium not present" },
  221         {0x07, 0x00, "Multiple peripheral devices selected" },
  222         {0x15, 0x00, "Random positioning error" },
  223 #endif
  224 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(NCH > 0)||(ncomm > 0)
  225         {0x2a, 0x02, "Log parameters changed" },
  226         {0x08, 0x00, "Logical unit communication failure" },
  227         {0x08, 0x02, "Logical unit communication parity error" },
  228         {0x08, 0x01, "Logical unit communication time-out" },
  229         {0x2a, 0x01, "Mode parameters changed" },
  230         {0x2a, 0x00, "Parameters changed" },
  231         {0x37, 0x00, "Rounded parameter" },
  232         {0x39, 0x00, "Saving parameters not supported" },
  233 #endif
  234 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NPT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(ncomm > 0)
  235         {0x2b, 0x00, "Copy cannot execute since host cannot disconnect" },
  236 #endif
  237 #if (NSD > 0)||(NST > 0)||(NSPRINT > 0)||(NPT > 0)||(NWORM > 0)||(NCD > 0)||(NSCAN > 0)||(NOD > 0)||(NCH > 0)
  238         {0x5b, 0x02, "Log counter at maximum" },
  239         {0x5b, 0x00, "Log exception" },
  240         {0x5b, 0x03, "Log list codes exhausted" },
  241         {0x5a, 0x00, "Operator request or state change input (unspecified)" },
  242         {0x5b, 0x01, "Threshold condition met" },
  243 #endif
  244         {0x3f, 0x02, "Changed operating definition" },
  245         {0x4a, 0x00, "Command phase error" },
  246         {0x2c, 0x00, "Command sequence error" },
  247         {0x2f, 0x00, "Commands cleared by another initiator" },
  248         {0x4b, 0x00, "Data phase error" },
  249 /*      {0x40, 0xnn, "Diagnostic failure on component nn (80h-ffh)" }, */
  250         {0x0a, 0x00, "Error log overflow" },
  251         {0x00, 0x06, "I/O process terminated" },
  252         {0x48, 0x00, "Initiator detected error message received" },
  253         {0x3f, 0x03, "Inquiry data has changed" },
  254         {0x44, 0x00, "Internal target failure" },
  255         {0x3d, 0x00, "Invalid bits in identify message" },
  256         {0x20, 0x00, "Invalid command operation code" },
  257         {0x24, 0x00, "Invalid field in CDB" },
  258         {0x26, 0x00, "Invalid field in parameter list" },
  259         {0x49, 0x00, "Invalid message error" },
  260         {0x05, 0x00, "Logical unit does not respond to selection" },
  261         {0x4c, 0x00, "Logical unit failed self-configuration" },
  262         {0x3e, 0x00, "Logical unit has not self-configured yet" },
  263         {0x04, 0x01, "Logical unit is in process of becoming ready" },
  264         {0x04, 0x00, "Logical unit not ready, cause not reportable" },
  265         {0x04, 0x02, "Logical unit not ready, initializing command required" },
  266         {0x04, 0x03, "Logical unit not ready, manual intervention required" },
  267         {0x25, 0x00, "Logical unit not supported" },
  268         {0x43, 0x00, "Message error" },
  269         {0x3f, 0x01, "Microcode has been changed" },
  270         {0x00, 0x00, "No additional sense information" },
  271         {0x28, 0x00, "Not ready to ready transition, medium may have changed" },
  272         {0x4e, 0x00, "Overlapped commands attempted" },
  273         {0x1a, 0x00, "Parameter list length error" },
  274         {0x26, 0x01, "Parameter not supported" },
  275         {0x26, 0x02, "Parameter value invalid" },
  276         {0x29, 0x00, "Power on, reset, or bus device reset occurred" },
  277         {0x47, 0x00, "SCSI parity error" },
  278         {0x45, 0x00, "Select or reselect failure" },
  279         {0x1b, 0x00, "Synchronous data transfer error" },
  280         {0x3f, 0x00, "Target operating conditions have changed" },
  281         {0x26, 0x03, "Threshold parameters not supported" },
  282         {0x46, 0x00, "Unsuccessful soft reset" },
  283 };
  284 
  285 char *scsi_sense_desc(int asc, int ascq)
  286 {
  287         int i;
  288 
  289         if (asc >= 0x80 && asc <= 0xff)
  290                 return "Vendor Specific ASC";
  291 
  292         if (ascq >= 0x80 && ascq <= 0xff)
  293                 return "Vendor Specific ASCQ";
  294 
  295         for (i = 0; i < sizeof(tab) / sizeof(tab[0]); i++)
  296                 if (tab[i].asc == asc && tab[i].ascq == ascq)
  297                         return tab[i].desc;
  298 
  299         return "";
  300 }
  301 
  302 #else /* NO_SCSI_SENSE */
  303 char *scsi_sense_desc(int asc, int ascq)
  304 {
  305         return "";
  306 }
  307 #endif

Cache object: 29a4928b6c103523ad2094581eba2bb3


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.