1*44704f69SBart Van Assche /* 2*44704f69SBart Van Assche * Copyright (c) 2022 Douglas Gilbert. 3*44704f69SBart Van Assche * All rights reserved. 4*44704f69SBart Van Assche * Use of this source code is governed by a BSD-style 5*44704f69SBart Van Assche * license that can be found in the BSD_LICENSE file. 6*44704f69SBart Van Assche * 7*44704f69SBart Van Assche * SPDX-License-Identifier: BSD-2-Clause 8*44704f69SBart Van Assche */ 9*44704f69SBart Van Assche 10*44704f69SBart Van Assche #include <stdlib.h> 11*44704f69SBart Van Assche 12*44704f69SBart Van Assche #ifdef HAVE_CONFIG_H 13*44704f69SBart Van Assche #include "config.h" 14*44704f69SBart Van Assche #else 15*44704f69SBart Van Assche #define SG_SCSI_STRINGS 1 16*44704f69SBart Van Assche #endif 17*44704f69SBart Van Assche 18*44704f69SBart Van Assche #include "sg_lib.h" 19*44704f69SBart Van Assche #include "sg_lib_data.h" 20*44704f69SBart Van Assche #include "sg_lib_names.h" 21*44704f69SBart Van Assche 22*44704f69SBart Van Assche /* List of SPC, then SBC, the ZBC mode page names. Tape and other mode pages 23*44704f69SBart Van Assche * are squeezed into this list as long as they don't conflict. 24*44704f69SBart Van Assche * The value is: (mode_page << 8) | mode_subpage 25*44704f69SBart Van Assche * Maintain the list in numerical order to allow binary search. */ 26*44704f69SBart Van Assche struct sg_lib_simple_value_name_t sg_lib_names_mode_arr[] = { 27*44704f69SBart Van Assche {0x0000, "Unit Attention condition"}, /* common vendor specific page */ 28*44704f69SBart Van Assche {0x0100, "Read-Write error recovery"}, /* SBC */ 29*44704f69SBart Van Assche {0x0200, "Disconnect-Reconnect"}, /* SPC */ 30*44704f69SBart Van Assche {0x0300, "Format (obsolete)"}, /* SBC */ 31*44704f69SBart Van Assche {0x0400, "Rigid disk geometry (obsolete)"}, /* SBC */ 32*44704f69SBart Van Assche {0x0500, "Flexible disk (obsolete)"}, /* SBC */ 33*44704f69SBart Van Assche {0x0700, "Verify error recovery"}, /* SBC */ 34*44704f69SBart Van Assche {0x0800, "Caching"}, /* SBC */ 35*44704f69SBart Van Assche {0x0900, "Peripheral device (obsolete)"}, /* SPC */ 36*44704f69SBart Van Assche {0x0a00, "Control"}, /* SPC */ 37*44704f69SBart Van Assche {0x0a01, "Control extension"}, /* SPC */ 38*44704f69SBart Van Assche {0x0a02, "Application tag"}, /* SBC */ 39*44704f69SBart Van Assche {0x0a03, "Command duration limit A"}, /* SPC */ 40*44704f69SBart Van Assche {0x0a04, "Command duration limit B"}, /* SPC */ 41*44704f69SBart Van Assche {0x0a05, "IO Advice Hints Grouping"}, /* SBC */ 42*44704f69SBart Van Assche {0x0a06, "Background operation control"}, /* SBC */ 43*44704f69SBart Van Assche {0x0af0, "Control data protection"}, /* SSC */ 44*44704f69SBart Van Assche {0x0af1, "PATA control"}, /* SAT */ 45*44704f69SBart Van Assche {0x0b00, "Medium Types Supported (obsolete)"}, /* SSC */ 46*44704f69SBart Van Assche {0x0c00, "Notch and partition (obsolete)"}, /* SBC */ 47*44704f69SBart Van Assche {0x0d00, "Power condition (obsolete), CD device parameters"}, 48*44704f69SBart Van Assche {0x0e00, "CD audio control"}, /* MMC */ 49*44704f69SBart Van Assche {0x0e01, "Target device"}, /* ADC */ 50*44704f69SBart Van Assche {0x0e02, "DT device primary port"}, /* ADC */ 51*44704f69SBart Van Assche {0x0e03, "Logical unit"}, /* ADC */ 52*44704f69SBart Van Assche {0x0e04, "Target device serial number"}, /* ADC */ 53*44704f69SBart Van Assche {0x0f00, "Data compression"}, /* SSC */ 54*44704f69SBart Van Assche {0x1000, "XOR control (obsolete, Device configuration"}, /* SBC,SSC */ 55*44704f69SBart Van Assche {0x1001, "Device configuration extension"}, /* SSC */ 56*44704f69SBart Van Assche {0x1100, "Medium partition (1)"}, /* SSC */ 57*44704f69SBart Van Assche {0x1400, "Enclosure services management"}, /* SES */ 58*44704f69SBart Van Assche {0x1800, "Protocol specific logical unit"}, /* transport */ 59*44704f69SBart Van Assche {0x1900, "Protocol specific port"}, /* transport */ 60*44704f69SBart Van Assche {0x1901, "Phy control and discovery"}, /* SPL */ 61*44704f69SBart Van Assche {0x1902, "Shared port control"}, /* SPL */ 62*44704f69SBart Van Assche {0x1903, "Enhanced phy control"}, /* SPL */ 63*44704f69SBart Van Assche {0x1904, "Out of band management control"}, /* SPL */ 64*44704f69SBart Van Assche {0x1A00, "Power condition"}, /* SPC */ 65*44704f69SBart Van Assche {0x1A01, "Power consumption"}, /* SPC */ 66*44704f69SBart Van Assche {0x1Af1, "ATA Power condition"}, /* SPC */ 67*44704f69SBart Van Assche {0x1b00, "LUN mapping"}, /* ADC */ 68*44704f69SBart Van Assche {0x1c00, "Information exceptions control"}, /* SPC */ 69*44704f69SBart Van Assche {0x1c01, "Background control"}, /* SBC */ 70*44704f69SBart Van Assche {0x1c02, "Logical block provisioning"}, /* SBC */ 71*44704f69SBart Van Assche {0x1c02, "Logical block provisioning"}, /* SBC */ 72*44704f69SBart Van Assche {0x1d00, "Medium configuration, CD/DVD timeout, " 73*44704f69SBart Van Assche "element address assignments"}, /* SSC,MMC,SMC */ 74*44704f69SBart Van Assche {0x1e00, "Transport geometry assignments"}, /* SMC */ 75*44704f69SBart Van Assche {0x1f00, "Device capabilities"}, /* SMC */ 76*44704f69SBart Van Assche 77*44704f69SBart Van Assche {-1, NULL}, /* sentinel */ 78*44704f69SBart Van Assche }; 79*44704f69SBart Van Assche 80*44704f69SBart Van Assche /* Don't count sentinel when doing binary searches, etc */ 81*44704f69SBart Van Assche const size_t sg_lib_names_mode_len = 82*44704f69SBart Van Assche SG_ARRAY_SIZE(sg_lib_names_mode_arr) - 1; 83*44704f69SBart Van Assche 84*44704f69SBart Van Assche /* List of SPC, then SBC, the ZBC VPD page names. Tape and other VPD pages 85*44704f69SBart Van Assche * are squeezed into this list as long as they don't conflict. 86*44704f69SBart Van Assche * For VPDs > 0 the value is: (vpd << 8) | vpd_number 87*44704f69SBart Van Assche * Maintain the list in numerical order to allow binary search. */ 88*44704f69SBart Van Assche struct sg_lib_simple_value_name_t sg_lib_names_vpd_arr[] = { 89*44704f69SBart Van Assche {0x00, "Supported VPD pages"}, /* SPC */ 90*44704f69SBart Van Assche {0x80, "Unit serial number"}, /* SPC */ 91*44704f69SBart Van Assche {0x81, "Implemented operating definition (obsolete)"}, /* SPC */ 92*44704f69SBart Van Assche {0x82, "ASCII implemented operating definition (obsolete)"}, /* SPC */ 93*44704f69SBart Van Assche {0x83, "Device identification"}, /* SPC */ 94*44704f69SBart Van Assche {0x84, "Software interface identification"}, /* SPC */ 95*44704f69SBart Van Assche {0x85, "Management network addresses"}, /* SPC */ 96*44704f69SBart Van Assche {0x86, "Extended INQUIRY data"}, /* SPC */ 97*44704f69SBart Van Assche {0x87, "Mode page policy"}, /* SPC */ 98*44704f69SBart Van Assche {0x88, "SCSI ports"}, /* SPC */ 99*44704f69SBart Van Assche {0x89, "ATA information"}, /* SAT */ 100*44704f69SBart Van Assche {0x8a, "Power condition"}, /* SPC */ 101*44704f69SBart Van Assche {0x8b, "Device constituents"}, /* SSC */ 102*44704f69SBart Van Assche {0x8c, "CFA profile information"}, /* SPC */ 103*44704f69SBart Van Assche {0x8d, "Power consumption"}, /* SPC */ 104*44704f69SBart Van Assche {0x8f, "Third party copy"}, /* SPC */ 105*44704f69SBart Van Assche {0x90, "Protocol specific logical unit information"}, /* transport */ 106*44704f69SBart Van Assche {0x91, "Protocol specific port information"}, /* transport */ 107*44704f69SBart Van Assche {0x92, "SCSI feature sets"}, /* SPC,SBC */ 108*44704f69SBart Van Assche {0xb0, "Block limits"}, /* SBC */ 109*44704f69SBart Van Assche {0xb1, "Block device characteristics"}, /* SBC */ 110*44704f69SBart Van Assche {0xb2, "Logical block provisioning"}, /* SBC */ 111*44704f69SBart Van Assche {0xb3, "Referrals"}, /* SBC */ 112*44704f69SBart Van Assche {0xb4, "Supported Block Lengths and Protection Types"}, /* SBC */ 113*44704f69SBart Van Assche {0xb5, "Block device characteristics extension"}, /* SBC */ 114*44704f69SBart Van Assche {0xb6, "Zoned block device characteristics"}, /* ZBC */ 115*44704f69SBart Van Assche {0xb7, "Block limits extension"}, /* SBC */ 116*44704f69SBart Van Assche {0xb8, "Format presets"}, /* SBC */ 117*44704f69SBart Van Assche {0xb9, "Concurrent positioning ranges"}, /* SBC */ 118*44704f69SBart Van Assche {0x01b0, "Sequential access Device Capabilities"}, /* SSC */ 119*44704f69SBart Van Assche {0x01b1, "Manufacturer-assigned serial number"}, /* SSC */ 120*44704f69SBart Van Assche {0x01b2, "TapeAlert supported flags"}, /* SSC */ 121*44704f69SBart Van Assche {0x01b3, "Automation device serial number"}, /* SSC */ 122*44704f69SBart Van Assche {0x01b4, "Data transfer device element address"}, /* SSC */ 123*44704f69SBart Van Assche {0x01b5, "Data transfer device element address"}, /* SSC */ 124*44704f69SBart Van Assche {0x11b0, "OSD information"}, /* OSD */ 125*44704f69SBart Van Assche {0x11b1, "Security token"}, /* OSD */ 126*44704f69SBart Van Assche 127*44704f69SBart Van Assche {-1, NULL}, /* sentinel */ 128*44704f69SBart Van Assche }; 129*44704f69SBart Van Assche 130*44704f69SBart Van Assche /* Don't count sentinel when doing binary searches, etc */ 131*44704f69SBart Van Assche const size_t sg_lib_names_vpd_len = 132*44704f69SBart Van Assche SG_ARRAY_SIZE(sg_lib_names_vpd_arr) - 1; 133