167555Smsmith/*- 267555Smsmith * Copyright (c) 2000 Michael Smith 3123103Sps * Copyright (c) 2003 Paul Saab 4123103Sps * Copyright (c) 2003 Vinod Kashyap 567555Smsmith * Copyright (c) 2000 BSDi 667555Smsmith * All rights reserved. 767555Smsmith * 867555Smsmith * Redistribution and use in source and binary forms, with or without 967555Smsmith * modification, are permitted provided that the following conditions 1067555Smsmith * are met: 1167555Smsmith * 1. Redistributions of source code must retain the above copyright 1267555Smsmith * notice, this list of conditions and the following disclaimer. 1367555Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1467555Smsmith * notice, this list of conditions and the following disclaimer in the 1567555Smsmith * documentation and/or other materials provided with the distribution. 1667555Smsmith * 1767555Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1867555Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1967555Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2067555Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2167555Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2267555Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2367555Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2467555Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2567555Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2667555Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2767555Smsmith * SUCH DAMAGE. 2867555Smsmith * 2967555Smsmith * $FreeBSD: releng/11.0/sys/dev/twe/twe_tables.h 123103 2003-12-02 07:57:20Z ps $ 3067555Smsmith */ 3167555Smsmith 3267555Smsmith/* 3367555Smsmith * Lookup table for code-to-text translations. 3467555Smsmith */ 3567555Smsmithstruct twe_code_lookup { 3667555Smsmith char *string; 3767555Smsmith u_int32_t code; 3867555Smsmith}; 3967555Smsmith 4067555Smsmithextern char *twe_describe_code(struct twe_code_lookup *table, u_int32_t code); 4167555Smsmith 4267555Smsmith#ifndef TWE_DEFINE_TABLES 4367555Smsmithextern struct twe_code_lookup twe_table_status[]; 4467555Smsmithextern struct twe_code_lookup twe_table_unitstate[]; 4567555Smsmithextern struct twe_code_lookup twe_table_unittype[]; 4667555Smsmithextern struct twe_code_lookup twe_table_aen[]; 4767555Smsmithextern struct twe_code_lookup twe_table_opcode[]; 4867555Smsmith#else /* TWE_DEFINE_TABLES */ 4967555Smsmith 5067555Smsmithstruct twe_code_lookup twe_table_status[] = { 5167555Smsmith /* success */ 5267555Smsmith {"successful completion", 0x00}, 5367555Smsmith /* info */ 5467555Smsmith {"command in progress", 0x42}, 5567555Smsmith {"retrying interface CRC error from UDMA command", 0x6c}, 5667555Smsmith /* warning */ 5767555Smsmith {"redundant/inconsequential request ignored", 0x81}, 5867555Smsmith {"failed to write zeroes to LBA 0", 0x8e}, 5967555Smsmith {"failed to profile TwinStor zones", 0x8f}, 6067555Smsmith /* fatal */ 6167555Smsmith {"aborted due to system command or reconfiguration", 0xc1}, 6267555Smsmith {"aborted", 0xc4}, 6367555Smsmith {"access error", 0xc5}, 6467555Smsmith {"access violation", 0xc6}, 6567555Smsmith {"device failure", 0xc7}, /* high byte may be port number */ 6667555Smsmith {"controller error", 0xc8}, 6767555Smsmith {"timed out", 0xc9}, 6867555Smsmith {"invalid unit number", 0xcb}, 6967555Smsmith {"unit not available", 0xcf}, 7067555Smsmith {"undefined opcode", 0xd2}, 7167555Smsmith {"request incompatible with unit", 0xdb}, 7267555Smsmith {"invalid request", 0xdc}, 7367555Smsmith {"firmware error, reset requested", 0xff}, 7467555Smsmith {NULL, 0}, 7567555Smsmith {"unknown status", 0} 7667555Smsmith}; 7767555Smsmith 7867555Smsmithstruct twe_code_lookup twe_table_unitstate[] = { 7967555Smsmith {"Normal", TWE_PARAM_UNITSTATUS_Normal}, 8067555Smsmith {"Initialising", TWE_PARAM_UNITSTATUS_Initialising}, 8167555Smsmith {"Degraded", TWE_PARAM_UNITSTATUS_Degraded}, 8267555Smsmith {"Rebuilding", TWE_PARAM_UNITSTATUS_Rebuilding}, 8367555Smsmith {"Verifying", TWE_PARAM_UNITSTATUS_Verifying}, 8467555Smsmith {"Corrupt", TWE_PARAM_UNITSTATUS_Corrupt}, 8567555Smsmith {"Missing", TWE_PARAM_UNITSTATUS_Missing}, 8667555Smsmith {NULL, 0}, 8767555Smsmith {"unknown state", 0} 8867555Smsmith}; 8967555Smsmith 9067555Smsmithstruct twe_code_lookup twe_table_unittype[] = { 9167555Smsmith {"RAID0", TWE_UD_CONFIG_RAID0}, 9267555Smsmith {"RAID1", TWE_UD_CONFIG_RAID1}, 9367555Smsmith {"TwinStor", TWE_UD_CONFIG_TwinStor}, 9467555Smsmith {"RAID5", TWE_UD_CONFIG_RAID5}, 9567555Smsmith {"RAID10", TWE_UD_CONFIG_RAID10}, 9667555Smsmith {"CBOD", TWE_UD_CONFIG_CBOD}, 9767555Smsmith {"SPARE", TWE_UD_CONFIG_SPARE}, 9867555Smsmith {"SUBUNIT", TWE_UD_CONFIG_SUBUNIT}, 9967555Smsmith {"JBOD", TWE_UD_CONFIG_JBOD}, 10067555Smsmith {NULL, 0}, 10167555Smsmith {"unknown type", 0} 10267555Smsmith}; 10367555Smsmith 10467555Smsmithstruct twe_code_lookup twe_table_aen[] = { 10567555Smsmith {"q queue empty", 0x00}, 10667555Smsmith {"q soft reset", 0x01}, 107123103Sps {"c degraded unit", 0x02}, 10891790Smsmith {"a controller error", 0x03}, 10967555Smsmith {"c rebuild fail", 0x04}, 11067555Smsmith {"c rebuild done", 0x05}, 11167555Smsmith {"c incomplete unit", 0x06}, 11267555Smsmith {"c initialisation done", 0x07}, 11367555Smsmith {"c unclean shutdown detected", 0x08}, 11467555Smsmith {"c drive timeout", 0x09}, 11567555Smsmith {"c drive error", 0x0a}, 11667555Smsmith {"c rebuild started", 0x0b}, 11791790Smsmith {"c init started", 0x0c}, 11891790Smsmith {"c logical unit deleted", 0x0d}, 11991790Smsmith {"p SMART threshold exceeded", 0x0f}, 12091790Smsmith {"p ATA UDMA downgrade", 0x21}, 12191790Smsmith {"p ATA UDMA upgrade", 0x22}, 12291790Smsmith {"p sector repair occurred", 0x23}, 12391790Smsmith {"a SBUF integrity check failure", 0x24}, 12491790Smsmith {"p lost cached write", 0x25}, 12591790Smsmith {"p drive ECC error detected", 0x26}, 12691790Smsmith {"p DCB checksum error", 0x27}, 12791790Smsmith {"p DCB unsupported version", 0x28}, 12891790Smsmith {"c verify started", 0x29}, 12991790Smsmith {"c verify failed", 0x2a}, 13091790Smsmith {"c verify complete", 0x2b}, 13191790Smsmith {"p overwrote bad sector during rebuild", 0x2c}, 13291790Smsmith {"p encountered bad sector during rebuild", 0x2d}, 133118508Sps {"a replacement drive too small", 0x2e}, 134118508Sps {"c array not previously initialized", 0x2f}, 135118508Sps {"p drive not supported", 0x30}, 13691790Smsmith {"a aen queue full", 0xff}, 13767555Smsmith {NULL, 0}, 13867555Smsmith {"x unknown AEN", 0} 13967555Smsmith}; 14067555Smsmith 14167555Smsmithstruct twe_code_lookup twe_table_opcode[] = { 14267555Smsmith {"NOP", 0x00}, 14367555Smsmith {"INIT_CONNECTION", 0x01}, 14467555Smsmith {"READ", 0x02}, 14567555Smsmith {"WRITE", 0x03}, 14667555Smsmith {"READVERIFY", 0x04}, 14767555Smsmith {"VERIFY", 0x05}, 14867555Smsmith {"ZEROUNIT", 0x08}, 14967555Smsmith {"REPLACEUNIT", 0x09}, 15067555Smsmith {"HOTSWAP", 0x0a}, 15167555Smsmith {"SETATAFEATURE", 0x0c}, 15267555Smsmith {"FLUSH", 0x0e}, 15367555Smsmith {"ABORT", 0x0f}, 15467555Smsmith {"CHECKSTATUS", 0x10}, 15567555Smsmith {"GET_PARAM", 0x12}, 15667555Smsmith {"SET_PARAM", 0x13}, 15767555Smsmith {"CREATEUNIT", 0x14}, 15867555Smsmith {"DELETEUNIT", 0x15}, 15967555Smsmith {"REBUILDUNIT", 0x17}, 16067555Smsmith {"SECTOR_INFO", 0x1a}, 16167555Smsmith {"AEN_LISTEN", 0x1c}, 16267555Smsmith {"CMD_PACKET", 0x1d}, 16367555Smsmith {NULL, 0}, 16467555Smsmith {"unknown opcode", 0} 16567555Smsmith}; 16667555Smsmith 16767555Smsmith#endif 168