1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2000 Michael Smith 5 * Copyright (c) 2003 Paul Saab 6 * Copyright (c) 2003 Vinod Kashyap 7 * Copyright (c) 2000 BSDi 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * $FreeBSD: stable/12/sys/dev/twe/twe_tables.h 326255 2017-11-27 14:52:40Z pfg $ 32 */ 33 34 /* 35 * Lookup table for code-to-text translations. 36 */ 37 struct twe_code_lookup { 38 char *string; 39 u_int32_t code; 40 }; 41 42 extern char *twe_describe_code(struct twe_code_lookup *table, u_int32_t code); 43 44 #ifndef TWE_DEFINE_TABLES 45 extern struct twe_code_lookup twe_table_status[]; 46 extern struct twe_code_lookup twe_table_unitstate[]; 47 extern struct twe_code_lookup twe_table_unittype[]; 48 extern struct twe_code_lookup twe_table_aen[]; 49 extern struct twe_code_lookup twe_table_opcode[]; 50 #else /* TWE_DEFINE_TABLES */ 51 52 struct twe_code_lookup twe_table_status[] = { 53 /* success */ 54 {"successful completion", 0x00}, 55 /* info */ 56 {"command in progress", 0x42}, 57 {"retrying interface CRC error from UDMA command", 0x6c}, 58 /* warning */ 59 {"redundant/inconsequential request ignored", 0x81}, 60 {"failed to write zeroes to LBA 0", 0x8e}, 61 {"failed to profile TwinStor zones", 0x8f}, 62 /* fatal */ 63 {"aborted due to system command or reconfiguration", 0xc1}, 64 {"aborted", 0xc4}, 65 {"access error", 0xc5}, 66 {"access violation", 0xc6}, 67 {"device failure", 0xc7}, /* high byte may be port number */ 68 {"controller error", 0xc8}, 69 {"timed out", 0xc9}, 70 {"invalid unit number", 0xcb}, 71 {"unit not available", 0xcf}, 72 {"undefined opcode", 0xd2}, 73 {"request incompatible with unit", 0xdb}, 74 {"invalid request", 0xdc}, 75 {"firmware error, reset requested", 0xff}, 76 {NULL, 0}, 77 {"unknown status", 0} 78 }; 79 80 struct twe_code_lookup twe_table_unitstate[] = { 81 {"Normal", TWE_PARAM_UNITSTATUS_Normal}, 82 {"Initialising", TWE_PARAM_UNITSTATUS_Initialising}, 83 {"Degraded", TWE_PARAM_UNITSTATUS_Degraded}, 84 {"Rebuilding", TWE_PARAM_UNITSTATUS_Rebuilding}, 85 {"Verifying", TWE_PARAM_UNITSTATUS_Verifying}, 86 {"Corrupt", TWE_PARAM_UNITSTATUS_Corrupt}, 87 {"Missing", TWE_PARAM_UNITSTATUS_Missing}, 88 {NULL, 0}, 89 {"unknown state", 0} 90 }; 91 92 struct twe_code_lookup twe_table_unittype[] = { 93 {"RAID0", TWE_UD_CONFIG_RAID0}, 94 {"RAID1", TWE_UD_CONFIG_RAID1}, 95 {"TwinStor", TWE_UD_CONFIG_TwinStor}, 96 {"RAID5", TWE_UD_CONFIG_RAID5}, 97 {"RAID10", TWE_UD_CONFIG_RAID10}, 98 {"CBOD", TWE_UD_CONFIG_CBOD}, 99 {"SPARE", TWE_UD_CONFIG_SPARE}, 100 {"SUBUNIT", TWE_UD_CONFIG_SUBUNIT}, 101 {"JBOD", TWE_UD_CONFIG_JBOD}, 102 {NULL, 0}, 103 {"unknown type", 0} 104 }; 105 106 struct twe_code_lookup twe_table_aen[] = { 107 {"q queue empty", 0x00}, 108 {"q soft reset", 0x01}, 109 {"c degraded unit", 0x02}, 110 {"a controller error", 0x03}, 111 {"c rebuild fail", 0x04}, 112 {"c rebuild done", 0x05}, 113 {"c incomplete unit", 0x06}, 114 {"c initialisation done", 0x07}, 115 {"c unclean shutdown detected", 0x08}, 116 {"c drive timeout", 0x09}, 117 {"c drive error", 0x0a}, 118 {"c rebuild started", 0x0b}, 119 {"c init started", 0x0c}, 120 {"c logical unit deleted", 0x0d}, 121 {"p SMART threshold exceeded", 0x0f}, 122 {"p ATA UDMA downgrade", 0x21}, 123 {"p ATA UDMA upgrade", 0x22}, 124 {"p sector repair occurred", 0x23}, 125 {"a SBUF integrity check failure", 0x24}, 126 {"p lost cached write", 0x25}, 127 {"p drive ECC error detected", 0x26}, 128 {"p DCB checksum error", 0x27}, 129 {"p DCB unsupported version", 0x28}, 130 {"c verify started", 0x29}, 131 {"c verify failed", 0x2a}, 132 {"c verify complete", 0x2b}, 133 {"p overwrote bad sector during rebuild", 0x2c}, 134 {"p encountered bad sector during rebuild", 0x2d}, 135 {"a replacement drive too small", 0x2e}, 136 {"c array not previously initialized", 0x2f}, 137 {"p drive not supported", 0x30}, 138 {"a aen queue full", 0xff}, 139 {NULL, 0}, 140 {"x unknown AEN", 0} 141 }; 142 143 struct twe_code_lookup twe_table_opcode[] = { 144 {"NOP", 0x00}, 145 {"INIT_CONNECTION", 0x01}, 146 {"READ", 0x02}, 147 {"WRITE", 0x03}, 148 {"READVERIFY", 0x04}, 149 {"VERIFY", 0x05}, 150 {"ZEROUNIT", 0x08}, 151 {"REPLACEUNIT", 0x09}, 152 {"HOTSWAP", 0x0a}, 153 {"SETATAFEATURE", 0x0c}, 154 {"FLUSH", 0x0e}, 155 {"ABORT", 0x0f}, 156 {"CHECKSTATUS", 0x10}, 157 {"GET_PARAM", 0x12}, 158 {"SET_PARAM", 0x13}, 159 {"CREATEUNIT", 0x14}, 160 {"DELETEUNIT", 0x15}, 161 {"REBUILDUNIT", 0x17}, 162 {"SECTOR_INFO", 0x1a}, 163 {"AEN_LISTEN", 0x1c}, 164 {"CMD_PACKET", 0x1d}, 165 {NULL, 0}, 166 {"unknown opcode", 0} 167 }; 168 169 #endif 170