sg_lib_data.c (sdparm-1.11.tgz) | : | sg_lib_data.c (sdparm-1.12.tgz) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright (c) 2007-2020 Douglas Gilbert. | * Copyright (c) 2007-2021 Douglas Gilbert. | |||
* All rights reserved. | * All rights reserved. | |||
* Use of this source code is governed by a BSD-style | * Use of this source code is governed by a BSD-style | |||
* license that can be found in the BSD_LICENSE file. | * license that can be found in the BSD_LICENSE file. | |||
* | * | |||
* SPDX-License-Identifier: BSD-2-Clause | * SPDX-License-Identifier: BSD-2-Clause | |||
*/ | */ | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include "config.h" | #include "config.h" | |||
#else | #else | |||
#define SG_SCSI_STRINGS 1 | #define SG_SCSI_STRINGS 1 | |||
#endif | #endif | |||
#include "sg_lib.h" | #include "sg_lib.h" | |||
#include "sg_lib_data.h" | #include "sg_lib_data.h" | |||
const char * sg_lib_version_str = "2.72 20200125"; | const char * sg_lib_version_str = "2.79 20210304"; | |||
/* spc5r22, sbc4r17, zbc2r04 */ | /* spc6r05, sbc4r22, zbc2r09 */ | |||
/* indexed by pdt; those that map to own index do not decay */ | /* indexed by pdt; those that map to own index do not decay */ | |||
int sg_lib_pdt_decay_arr[32] = { | int sg_lib_pdt_decay_arr[32] = { | |||
PDT_DISK, PDT_TAPE, PDT_TAPE /* printer */, PDT_PROCESSOR, | PDT_DISK, PDT_TAPE, PDT_TAPE /* printer */, PDT_PROCESSOR, | |||
PDT_DISK /* WO */, PDT_MMC, PDT_SCANNER, PDT_DISK /* optical */, | PDT_DISK /* WO */, PDT_MMC, PDT_SCANNER, PDT_DISK /* optical */, | |||
PDT_MCHANGER, PDT_COMMS, 0xa, 0xb, | PDT_MCHANGER, PDT_COMMS, 0xa, 0xb, | |||
PDT_SAC, PDT_SES, PDT_DISK /* rbc */, PDT_OCRW, | PDT_SAC, PDT_SES, PDT_DISK /* rbc */, PDT_OCRW, | |||
PDT_BCC, PDT_OSD, PDT_TAPE /* adc */, PDT_SMD, | PDT_BCC, PDT_OSD, PDT_TAPE /* adc */, PDT_SMD, | |||
PDT_DISK /* zbc */, 0x15, 0x16, 0x17, | PDT_DISK /* zbc */, 0x15, 0x16, 0x17, | |||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, PDT_WLUN, PDT_UNKNOWN | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, PDT_WLUN, PDT_UNKNOWN | |||
skipping to change at line 364 | skipping to change at line 364 | |||
{0xf, 0, "Receive binding report"}, /* added spc5r11 */ | {0xf, 0, "Receive binding report"}, /* added spc5r11 */ | |||
{0x10, 0, "Read capacity(16)"}, | {0x10, 0, "Read capacity(16)"}, | |||
{0x11, 0, "Read long(16)"}, /* obsolete in SBC-4 r7 */ | {0x11, 0, "Read long(16)"}, /* obsolete in SBC-4 r7 */ | |||
{0x12, 0, "Get LBA status(16)"}, /* 32 byte variant added in sbc4r14 */ | {0x12, 0, "Get LBA status(16)"}, /* 32 byte variant added in sbc4r14 */ | |||
{0x13, 0, "Report referrals"}, | {0x13, 0, "Report referrals"}, | |||
{0x14, 0, "Stream control"}, | {0x14, 0, "Stream control"}, | |||
{0x15, 0, "Background control"}, | {0x15, 0, "Background control"}, | |||
{0x16, 0, "Get stream status"}, | {0x16, 0, "Get stream status"}, | |||
{0x17, 0, "Get physical element status"}, /* added sbc4r13 */ | {0x17, 0, "Get physical element status"}, /* added sbc4r13 */ | |||
{0x18, 0, "Remove element and truncate"}, /* added sbc4r13 */ | {0x18, 0, "Remove element and truncate"}, /* added sbc4r13 */ | |||
{0x19, 0, "Restore elements and rebuild"}, /* added sbc4r19 */ | ||||
{0x1a, 0, "Remove element and modify zones"}, /* added zbc2r07 */ | ||||
{0xffff, 0, NULL}, | {0xffff, 0, NULL}, | |||
}; | }; | |||
/* Service action out(16) [0x9f] service actions */ | /* Service action out(16) [0x9f] service actions */ | |||
struct sg_lib_value_name_t sg_lib_serv_out16_arr[] = { | struct sg_lib_value_name_t sg_lib_serv_out16_arr[] = { | |||
{0x0b, 0, "Test bind"}, /* added spc5r13 */ | {0x0b, 0, "Test bind"}, /* added spc5r13 */ | |||
{0x0c, 0, "Prepare bind report"}, /* added spc5r11 */ | {0x0c, 0, "Prepare bind report"}, /* added spc5r11 */ | |||
{0x0d, 0, "Set affiliation"}, | {0x0d, 0, "Set affiliation"}, | |||
{0x0e, 0, "Bind"}, | {0x0e, 0, "Bind"}, | |||
{0x0f, 0, "Unbind"}, | {0x0f, 0, "Unbind"}, | |||
skipping to change at line 635 | skipping to change at line 637 | |||
}; | }; | |||
struct sg_lib_value_name_t sg_lib_read_attr_arr[] = { | struct sg_lib_value_name_t sg_lib_read_attr_arr[] = { | |||
{0xffff, 0, NULL}, | {0xffff, 0, NULL}, | |||
}; | }; | |||
#endif /* SG_SCSI_STRINGS */ | #endif /* SG_SCSI_STRINGS */ | |||
/* A conveniently formatted list of SCSI ASC/ASCQ codes and their | /* A conveniently formatted list of SCSI ASC/ASCQ codes and their | |||
* corresponding text can be found at: www.t10.org/lists/asc-num.txt | * corresponding text can be found at: www.t10.org/lists/asc-num.txt | |||
* The following should match asc-num.txt dated 20191014 */ | * The following should match asc-num.txt dated 20200817 */ | |||
#ifdef SG_SCSI_STRINGS | #ifdef SG_SCSI_STRINGS | |||
struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[] = | struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[] = | |||
{ | { | |||
{0x40,0x01,0x7f,"Ram failure [0x%x]"}, | {0x40,0x01,0x7f,"Ram failure [0x%x]"}, | |||
{0x40,0x80,0xff,"Diagnostic failure on component [0x%x]"}, | {0x40,0x80,0xff,"Diagnostic failure on component [0x%x]"}, | |||
{0x41,0x01,0xff,"Data path failure [0x%x]"}, | {0x41,0x01,0xff,"Data path failure [0x%x]"}, | |||
{0x42,0x01,0xff,"Power-on or self-test failure [0x%x]"}, | {0x42,0x01,0xff,"Power-on or self-test failure [0x%x]"}, | |||
{0x4d,0x00,0xff,"Tagged overlapped commands [0x%x]"}, | {0x4d,0x00,0xff,"Tagged overlapped commands [0x%x]"}, | |||
{0x70,0x00,0xff,"Decompression exception short algorithm id of 0x%x"}, | {0x70,0x00,0xff,"Decompression exception short algorithm id of 0x%x"}, | |||
skipping to change at line 726 | skipping to change at line 728 | |||
{0x04,0x1c,"Logical unit not ready, additional power use not yet " | {0x04,0x1c,"Logical unit not ready, additional power use not yet " | |||
"granted"}, | "granted"}, | |||
{0x04,0x1d,"Logical unit not ready, configuration in progress"}, | {0x04,0x1d,"Logical unit not ready, configuration in progress"}, | |||
{0x04,0x1e,"Logical unit not ready, microcode activation required"}, | {0x04,0x1e,"Logical unit not ready, microcode activation required"}, | |||
{0x04,0x1f,"Logical unit not ready, microcode download required"}, | {0x04,0x1f,"Logical unit not ready, microcode download required"}, | |||
{0x04,0x20,"Logical unit not ready, logical unit reset required"}, | {0x04,0x20,"Logical unit not ready, logical unit reset required"}, | |||
{0x04,0x21,"Logical unit not ready, hard reset required"}, | {0x04,0x21,"Logical unit not ready, hard reset required"}, | |||
{0x04,0x22,"Logical unit not ready, power cycle required"}, | {0x04,0x22,"Logical unit not ready, power cycle required"}, | |||
{0x04,0x23,"Logical unit not ready, affiliation required"}, | {0x04,0x23,"Logical unit not ready, affiliation required"}, | |||
{0x04,0x24,"Depopulation in progress"}, /* spc5r15 */ | {0x04,0x24,"Depopulation in progress"}, /* spc5r15 */ | |||
{0x04,0x25,"Depopulation restoration in progress"}, /* spc6r02 */ | ||||
{0x05,0x00,"Logical unit does not respond to selection"}, | {0x05,0x00,"Logical unit does not respond to selection"}, | |||
{0x06,0x00,"No reference position found"}, | {0x06,0x00,"No reference position found"}, | |||
{0x07,0x00,"Multiple peripheral devices selected"}, | {0x07,0x00,"Multiple peripheral devices selected"}, | |||
{0x08,0x00,"Logical unit communication failure"}, | {0x08,0x00,"Logical unit communication failure"}, | |||
{0x08,0x01,"Logical unit communication time-out"}, | {0x08,0x01,"Logical unit communication time-out"}, | |||
{0x08,0x02,"Logical unit communication parity error"}, | {0x08,0x02,"Logical unit communication parity error"}, | |||
{0x08,0x03,"Logical unit communication CRC error (Ultra-DMA/32)"}, | {0x08,0x03,"Logical unit communication CRC error (Ultra-DMA/32)"}, | |||
{0x08,0x04,"Unreachable copy target"}, | {0x08,0x04,"Unreachable copy target"}, | |||
{0x09,0x00,"Track following error"}, | {0x09,0x00,"Track following error"}, | |||
{0x09,0x01,"Tracking servo failure"}, | {0x09,0x01,"Tracking servo failure"}, | |||
skipping to change at line 1004 | skipping to change at line 1007 | |||
{0x2C,0x09,"Previous reservation conflict status"}, | {0x2C,0x09,"Previous reservation conflict status"}, | |||
{0x2C,0x0A,"Partition or collection contains user objects"}, | {0x2C,0x0A,"Partition or collection contains user objects"}, | |||
{0x2C,0x0B,"Not reserved"}, | {0x2C,0x0B,"Not reserved"}, | |||
{0x2C,0x0C,"ORWRITE generation does not match"}, | {0x2C,0x0C,"ORWRITE generation does not match"}, | |||
{0x2C,0x0D,"Reset write pointer not allowed"}, | {0x2C,0x0D,"Reset write pointer not allowed"}, | |||
{0x2C,0x0E,"Zone is offline"}, | {0x2C,0x0E,"Zone is offline"}, | |||
{0x2C,0x0F,"Stream not open"}, | {0x2C,0x0F,"Stream not open"}, | |||
{0x2C,0x10,"Unwritten data in zone"}, | {0x2C,0x10,"Unwritten data in zone"}, | |||
{0x2C,0x11,"Descriptor format sense data required"}, | {0x2C,0x11,"Descriptor format sense data required"}, | |||
{0x2C,0x12,"Zone is inactive"}, | {0x2C,0x12,"Zone is inactive"}, | |||
{0x2C,0x13,"Well known logical unit access required"}, /* spc6r02 */ | ||||
{0x2D,0x00,"Overwrite error on update in place"}, | {0x2D,0x00,"Overwrite error on update in place"}, | |||
{0x2E,0x00,"Insufficient time for operation"}, | {0x2E,0x00,"Insufficient time for operation"}, | |||
{0x2E,0x01,"Command timeout before processing"}, | {0x2E,0x01,"Command timeout before processing"}, | |||
{0x2E,0x02,"Command timeout during processing"}, | {0x2E,0x02,"Command timeout during processing"}, | |||
{0x2E,0x03,"Command timeout during processing due to error recovery"}, | {0x2E,0x03,"Command timeout during processing due to error recovery"}, | |||
{0x2F,0x00,"Commands cleared by another initiator"}, | {0x2F,0x00,"Commands cleared by another initiator"}, | |||
{0x2F,0x01,"Commands cleared by power loss notification"}, | {0x2F,0x01,"Commands cleared by power loss notification"}, | |||
{0x2F,0x02,"Commands cleared by device server"}, | {0x2F,0x02,"Commands cleared by device server"}, | |||
{0x2F,0x03,"Some commands cleared by queuing layer event"}, | {0x2F,0x03,"Some commands cleared by queuing layer event"}, | |||
{0x30,0x00,"Incompatible medium installed"}, | {0x30,0x00,"Incompatible medium installed"}, | |||
skipping to change at line 1035 | skipping to change at line 1039 | |||
{0x30,0x0C,"WORM medium - overwrite attempted"}, | {0x30,0x0C,"WORM medium - overwrite attempted"}, | |||
{0x30,0x0D,"WORM medium - integrity check"}, | {0x30,0x0D,"WORM medium - integrity check"}, | |||
{0x30,0x10,"Medium not formatted"}, | {0x30,0x10,"Medium not formatted"}, | |||
{0x30,0x11,"Incompatible volume type"}, | {0x30,0x11,"Incompatible volume type"}, | |||
{0x30,0x12,"Incompatible volume qualifier"}, | {0x30,0x12,"Incompatible volume qualifier"}, | |||
{0x30,0x13,"Cleaning volume expired"}, | {0x30,0x13,"Cleaning volume expired"}, | |||
{0x31,0x00,"Medium format corrupted"}, | {0x31,0x00,"Medium format corrupted"}, | |||
{0x31,0x01,"Format command failed"}, | {0x31,0x01,"Format command failed"}, | |||
{0x31,0x02,"Zoned formatting failed due to spare linking"}, | {0x31,0x02,"Zoned formatting failed due to spare linking"}, | |||
{0x31,0x03,"Sanitize command failed"}, | {0x31,0x03,"Sanitize command failed"}, | |||
{0x31,0x04,"Depopulation failed"}, /* spc5r15 */ | {0x31,0x04,"Depopulation failed"}, /* spc5r15 */ | |||
{0x31,0x05,"Depopulation restoration failed"}, /* spc6r02 */ | ||||
{0x32,0x00,"No defect spare location available"}, | {0x32,0x00,"No defect spare location available"}, | |||
{0x32,0x01,"Defect list update failure"}, | {0x32,0x01,"Defect list update failure"}, | |||
{0x33,0x00,"Tape length error"}, | {0x33,0x00,"Tape length error"}, | |||
{0x34,0x00,"Enclosure failure"}, | {0x34,0x00,"Enclosure failure"}, | |||
{0x35,0x00,"Enclosure services failure"}, | {0x35,0x00,"Enclosure services failure"}, | |||
{0x35,0x01,"Unsupported enclosure function"}, | {0x35,0x01,"Unsupported enclosure function"}, | |||
{0x35,0x02,"Enclosure services unavailable"}, | {0x35,0x02,"Enclosure services unavailable"}, | |||
{0x35,0x03,"Enclosure services transfer failure"}, | {0x35,0x03,"Enclosure services transfer failure"}, | |||
{0x35,0x04,"Enclosure services transfer refused"}, | {0x35,0x04,"Enclosure services transfer refused"}, | |||
{0x35,0x05,"Enclosure services checksum error"}, | {0x35,0x05,"Enclosure services checksum error"}, | |||
{0x36,0x00,"Ribbon, ink, or toner failure"}, | {0x36,0x00,"Ribbon, ink, or toner failure"}, | |||
{0x37,0x00,"Rounded parameter"}, | {0x37,0x00,"Rounded parameter"}, | |||
{0x38,0x00,"Event status notification"}, | {0x38,0x00,"Event status notification"}, | |||
{0x38,0x02,"Esn - power management class event"}, | {0x38,0x02,"Esn - power management class event"}, | |||
{0x38,0x04,"Esn - media class event"}, | {0x38,0x04,"Esn - media class event"}, | |||
{0x38,0x06,"Esn - device busy class event"}, | {0x38,0x06,"Esn - device busy class event"}, | |||
{0x38,0x07,"Thin provisioning soft threshold reached"}, | {0x38,0x07,"Thin provisioning soft threshold reached"}, | |||
{0x38,0x08,"Depopulation interrupted"}, /* spc6r03 */ | ||||
{0x39,0x00,"Saving parameters not supported"}, | {0x39,0x00,"Saving parameters not supported"}, | |||
{0x3A,0x00,"Medium not present"}, | {0x3A,0x00,"Medium not present"}, | |||
{0x3A,0x01,"Medium not present - tray closed"}, | {0x3A,0x01,"Medium not present - tray closed"}, | |||
{0x3A,0x02,"Medium not present - tray open"}, | {0x3A,0x02,"Medium not present - tray open"}, | |||
{0x3A,0x03,"Medium not present - loadable"}, | {0x3A,0x03,"Medium not present - loadable"}, | |||
{0x3A,0x04,"Medium not present - medium auxiliary memory accessible"}, | {0x3A,0x04,"Medium not present - medium auxiliary memory accessible"}, | |||
{0x3B,0x00,"Sequential positioning error"}, | {0x3B,0x00,"Sequential positioning error"}, | |||
{0x3B,0x01,"Tape position error at beginning-of-medium"}, | {0x3B,0x01,"Tape position error at beginning-of-medium"}, | |||
{0x3B,0x02,"Tape position error at end-of-medium"}, | {0x3B,0x02,"Tape position error at end-of-medium"}, | |||
{0x3B,0x03,"Tape or electronic vertical forms unit not ready"}, | {0x3B,0x03,"Tape or electronic vertical forms unit not ready"}, | |||
skipping to change at line 1087 | skipping to change at line 1093 | |||
{0x3B,0x13,"Medium magazine inserted"}, | {0x3B,0x13,"Medium magazine inserted"}, | |||
{0x3B,0x14,"Medium magazine locked"}, | {0x3B,0x14,"Medium magazine locked"}, | |||
{0x3B,0x15,"Medium magazine unlocked"}, | {0x3B,0x15,"Medium magazine unlocked"}, | |||
{0x3B,0x16,"Mechanical positioning or changer error"}, | {0x3B,0x16,"Mechanical positioning or changer error"}, | |||
{0x3B,0x17,"Read past end of user object"}, | {0x3B,0x17,"Read past end of user object"}, | |||
{0x3B,0x18,"Element disabled"}, | {0x3B,0x18,"Element disabled"}, | |||
{0x3B,0x19,"Element enabled"}, | {0x3B,0x19,"Element enabled"}, | |||
{0x3B,0x1a,"Data transfer device removed"}, | {0x3B,0x1a,"Data transfer device removed"}, | |||
{0x3B,0x1b,"Data transfer device inserted"}, | {0x3B,0x1b,"Data transfer device inserted"}, | |||
{0x3B,0x1c,"Too many logical objects on partition to support operation"}, | {0x3B,0x1c,"Too many logical objects on partition to support operation"}, | |||
{0x3B,0x20,"Element static information changed"}, | ||||
{0x3D,0x00,"Invalid bits in identify message"}, | {0x3D,0x00,"Invalid bits in identify message"}, | |||
{0x3E,0x00,"Logical unit has not self-configured yet"}, | {0x3E,0x00,"Logical unit has not self-configured yet"}, | |||
{0x3E,0x01,"Logical unit failure"}, | {0x3E,0x01,"Logical unit failure"}, | |||
{0x3E,0x02,"Timeout on logical unit"}, | {0x3E,0x02,"Timeout on logical unit"}, | |||
{0x3E,0x03,"Logical unit failed self-test"}, | {0x3E,0x03,"Logical unit failed self-test"}, | |||
{0x3E,0x04,"Logical unit unable to update self-test log"}, | {0x3E,0x04,"Logical unit unable to update self-test log"}, | |||
{0x3F,0x00,"Target operating conditions have changed"}, | {0x3F,0x00,"Target operating conditions have changed"}, | |||
{0x3F,0x01,"Microcode has been changed"}, | {0x3F,0x01,"Microcode has been changed"}, | |||
{0x3F,0x02,"Changed operating definition"}, | {0x3F,0x02,"Changed operating definition"}, | |||
{0x3F,0x03,"Inquiry data has changed"}, | {0x3F,0x03,"Inquiry data has changed"}, | |||
skipping to change at line 1532 | skipping to change at line 1539 | |||
}; | }; | |||
/* SCSI Feature Sets array. code->value, pdt->peri_dev_type (-1 for SPC) */ | /* SCSI Feature Sets array. code->value, pdt->peri_dev_type (-1 for SPC) */ | |||
struct sg_lib_value_name_t sg_lib_scsi_feature_sets[] = | struct sg_lib_value_name_t sg_lib_scsi_feature_sets[] = | |||
{ | { | |||
{SCSI_FS_SPC_DISCOVERY_2016, -1, "Discovery 2016"}, | {SCSI_FS_SPC_DISCOVERY_2016, -1, "Discovery 2016"}, | |||
{SCSI_FS_SBC_BASE_2010, PDT_DISK, "SBC Base 2010"}, | {SCSI_FS_SBC_BASE_2010, PDT_DISK, "SBC Base 2010"}, | |||
{SCSI_FS_SBC_BASE_2016, PDT_DISK, "SBC Base 2016"}, | {SCSI_FS_SBC_BASE_2016, PDT_DISK, "SBC Base 2016"}, | |||
{SCSI_FS_SBC_BASIC_PROV_2016, PDT_DISK, "Basic provisioning 2016"}, | {SCSI_FS_SBC_BASIC_PROV_2016, PDT_DISK, "Basic provisioning 2016"}, | |||
{SCSI_FS_SBC_DRIVE_MAINT_2016, PDT_DISK, "Drive maintenance 2016"}, | {SCSI_FS_SBC_DRIVE_MAINT_2016, PDT_DISK, "Drive maintenance 2016"}, | |||
{SCSI_FS_ZBC_HOST_AWARE_2020, PDT_ZBC, "Host Aware 2020"}, | ||||
{SCSI_FS_ZBC_HOST_MANAGED_2020, PDT_ZBC, "Host Managed 2020"}, | ||||
{SCSI_FS_ZBC_DOMAINS_REALMS_2020, PDT_ZBC, "Domains and Realms 2020"}, | ||||
{0x0, 0, NULL}, /* 0x0 is reserved sfs; trailing sentinel */ | {0x0, 0, NULL}, /* 0x0 is reserved sfs; trailing sentinel */ | |||
}; | }; | |||
#if (SG_SCSI_STRINGS && HAVE_NVME && (! IGNORE_NVME)) | #if (SG_SCSI_STRINGS && HAVE_NVME && (! IGNORE_NVME)) | |||
/* Commands sent to the NVMe Admin Queue (queue id 0) have the following | /* Commands sent to the NVMe Admin Queue (queue id 0) have the following | |||
* names in the NVM Express 1.3a document dated 20171024 */ | * names in the NVM Express 1.3a document dated 20171024 */ | |||
struct sg_lib_simple_value_name_t sg_lib_nvme_admin_cmd_arr[] = | struct sg_lib_simple_value_name_t sg_lib_nvme_admin_cmd_arr[] = | |||
{ | { | |||
{0x0, "Delete I/O Submission Queue"}, /* first mandatory command */ | {0x0, "Delete I/O Submission Queue"}, /* first mandatory command */ | |||
End of changes. 10 change blocks. | ||||
5 lines changed or deleted | 15 lines changed or added |