/* $NetBSD: mly_tables.h,v 1.6 2008/04/28 20:23:55 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*-
* Copyright (c) 2000 Michael Smith
* Copyright (c) 2000 BSDi
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from FreeBSD: mly_tables.h,v 1.2 2001/07/14 00:12:22 msmith Exp
*/
/*
* Look up a text description of a numeric code and return a pointer to same.
*/
static const char *
mly_describe_code(const struct mly_code_lookup *table, u_int32_t code)
{
int i;
for (i = 0; table[i].string != NULL; i++)
if (table[i].code == code)
return (table[i].string);
return (table[i + 1].string);
}
/*
* This table is directly derived from the corresponding table in the Linux
* driver, and uses a derivative encoding for simplicity's sake.
*
* The first character of the string determines the format of the message.
*
* p "physical device <channel>:<target> <text>" (physical device status)
* s "physical device <channel>:<target> <text>" (scsi message or error)
* " sense key <key> asc <asc> ascq <ascq>"
* " info <info> csi <csi>"
* l "logical drive <unit>: <text>" (logical device status)
* m "logical drive <unit>: <text>" (logical device message)
*
* Messages which are typically suppressed have the first character
* capitalised. These messages will only be printed if bootverbose is set.
*
* The second character in the string indicates an action to be taken as a
* result of the event.
*
* r rescan the device for possible state change
*
*/
static const struct mly_code_lookup mly_table_event[] = {
/*
* Physical device events (0x0000 - 0x007f).
*/
{ "pr online", 0x0001 },
{ "pr standby", 0x0002 },
{ "p automatic rebuild started", 0x0005 },
{ "p manual rebuild started", 0x0006 },
{ "pr rebuild completed", 0x0007 },
{ "pr rebuild cancelled", 0x0008 },
{ "pr rebuild failed for unknown reasons", 0x0009 },
{ "pr rebuild failed due to new physical device", 0x000a },
{ "pr rebuild failed due to logical drive failure", 0x000b },
{ "sr offline", 0x000c },
{ "pr found", 0x000d },
{ "pr gone", 0x000e },
{ "p unconfigured", 0x000f },
{ "p expand capacity started", 0x0010 },
{ "pr expand capacity completed", 0x0011 },
{ "pr expand capacity failed", 0x0012 },
{ "p parity error", 0x0016 },
{ "p soft error", 0x0017 },
{ "p miscellaneous error", 0x0018 },
{ "p reset", 0x0019 },
{ "p active spare found", 0x001a },
{ "p warm spare found", 0x001b },
{ "s sense data received", 0x001c },
{ "p initialization started", 0x001d },
{ "pr initialization completed", 0x001e },
{ "pr initialization failed", 0x001f },
{ "pr initialization cancelled", 0x0020 },
{ "P write recovery failed", 0x0021 },
{ "p scsi bus reset failed", 0x0022 },
{ "p double check condition", 0x0023 },
{ "p device cannot be accessed", 0x0024 },
{ "p gross error on scsi processor", 0x0025 },
{ "p bad tag from device", 0x0026 },
{ "p command timeout", 0x0027 },
{ "pr system reset", 0x0028 },
{ "p busy status or parity error", 0x0029 },
{ "pr host set device to failed state", 0x002a },
{ "pr selection timeout", 0x002b },
{ "p scsi bus phase error", 0x002c },
{ "pr device returned unknown status", 0x002d },
{ "pr device not ready", 0x002e },
{ "p device not found at startup", 0x002f },
{ "p COD write operation failed", 0x0030 },
{ "p BDT write operation failed", 0x0031 },
{ "p missing at startup", 0x0039 },
{ "p start rebuild failed (physical drive too small)", 0x003a },