2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * 3. The party using or redistributing the source code and binary forms
28 * agrees to the above disclaimer and the terms and conditions set forth
31 * Additional Copyright (c) 2002 by Eric Moore under same license.
32 * Additional Copyright (c) 2002 LSI Logic Corporation
38 * Lookup table for code-to-text translations.
40 struct amr_code_lookup {
45 extern char *amr_describe_code(struct amr_code_lookup *table, u_int32_t code);
47 #ifndef AMR_DEFINE_TABLES
48 extern struct amr_code_lookup amr_table_qinit[];
49 extern struct amr_code_lookup amr_table_sinit[];
50 extern struct amr_code_lookup amr_table_drvstate[];
52 #else /* AMR_DEFINE_TABLES */
54 /********************************************************************************
55 * Look up a text description of a numeric code and return a pointer to same.
58 amr_describe_code(struct amr_code_lookup *table, u_int32_t code)
62 for (i = 0; table[i].string != NULL; i++)
63 if (table[i].code == code)
64 return(table[i].string);
65 return(table[i+1].string);
68 struct amr_code_lookup amr_table_qinit[] = {
69 {"init scanning drives", AMR_QINIT_SCAN},
70 {"init scanning initialising", AMR_QINIT_SCANINIT},
71 {"init firmware initing", AMR_QINIT_FIRMWARE},
72 {"init in progress", AMR_QINIT_INPROG},
73 {"init spinning drives", AMR_QINIT_SPINUP},
74 {"insufficient memory", AMR_QINIT_NOMEM},
75 {"init flushing cache", AMR_QINIT_CACHEFLUSH},
76 {"init successfully done", AMR_QINIT_DONE},
78 {"unknown init code", 0}
81 struct amr_code_lookup amr_table_sinit[] = {
82 {"init abnormal terminated", AMR_SINIT_ABEND},
83 {"insufficient memory", AMR_SINIT_NOMEM},
84 {"firmware flushing cache", AMR_SINIT_CACHEFLUSH},
85 {"init in progress", AMR_SINIT_INPROG},
86 {"firmware spinning drives", AMR_SINIT_SPINUP},
87 {"init successfully done", AMR_SINIT_DONE},
89 {"unknown init code", 0}
92 struct amr_code_lookup amr_table_drvstate[] = {
93 {"offline", AMR_DRV_OFFLINE},
94 {"degraded", AMR_DRV_DEGRADED},
95 {"optimal", AMR_DRV_OPTIMAL},
96 {"online", AMR_DRV_ONLINE},
97 {"failed", AMR_DRV_FAILED},
98 {"rebuild", AMR_DRV_REBUILD},
99 {"hot spare", AMR_DRV_HOTSPARE},
104 struct amr_code_lookup amr_table_adaptertype[] = {
105 {"Series 431", AMR_SIG_431},
106 {"Series 438", AMR_SIG_438},
107 {"Series 762", AMR_SIG_762},
108 {"Integrated HP NetRAID (T5)", AMR_SIG_T5},
109 {"Series 466", AMR_SIG_466},
110 {"Series 467", AMR_SIG_467},
111 {"Integrated HP NetRAID (T7)", AMR_SIG_T7},
112 {"Series 490", AMR_SIG_490},
114 {"unknown adapter", 0}