xref: /dflybsd-src/sys/dev/raid/amr/amr_tables.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*-
2*86d7f5d3SJohn Marino  * Copyright (c) 2000 Michael Smith
3*86d7f5d3SJohn Marino  * Copyright (c) 2000 BSDi
4*86d7f5d3SJohn Marino  * All rights reserved.
5*86d7f5d3SJohn Marino  *
6*86d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
7*86d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
8*86d7f5d3SJohn Marino  * are met:
9*86d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
10*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
11*86d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
12*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
13*86d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
14*86d7f5d3SJohn Marino  *
15*86d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*86d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*86d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*86d7f5d3SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*86d7f5d3SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*86d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*86d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*86d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*86d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*86d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*86d7f5d3SJohn Marino  * SUCH DAMAGE.
26*86d7f5d3SJohn Marino  *
27*86d7f5d3SJohn Marino  * Copyright (c) 2002 Eric Moore
28*86d7f5d3SJohn Marino  * Copyright (c) 2002 LSI Logic Corporation
29*86d7f5d3SJohn Marino  * All rights reserved.
30*86d7f5d3SJohn Marino  *
31*86d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
32*86d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
33*86d7f5d3SJohn Marino  * are met:
34*86d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
35*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
36*86d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
37*86d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
38*86d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
39*86d7f5d3SJohn Marino  * 3. The party using or redistributing the source code and binary forms
40*86d7f5d3SJohn Marino  *    agrees to the disclaimer below and the terms and conditions set forth
41*86d7f5d3SJohn Marino  *    herein.
42*86d7f5d3SJohn Marino  *
43*86d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
44*86d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45*86d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46*86d7f5d3SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
47*86d7f5d3SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48*86d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49*86d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50*86d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51*86d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52*86d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53*86d7f5d3SJohn Marino  * SUCH DAMAGE.
54*86d7f5d3SJohn Marino  *
55*86d7f5d3SJohn Marino  *
56*86d7f5d3SJohn Marino  *	$FreeBSD: src/sys/dev/amr/amr_tables.h,v 1.3 2002/10/30 22:00:11 emoore Exp $
57*86d7f5d3SJohn Marino  */
58*86d7f5d3SJohn Marino 
59*86d7f5d3SJohn Marino /*
60*86d7f5d3SJohn Marino  * Lookup table for code-to-text translations.
61*86d7f5d3SJohn Marino  */
62*86d7f5d3SJohn Marino struct amr_code_lookup {
63*86d7f5d3SJohn Marino     char	*string;
64*86d7f5d3SJohn Marino     u_int32_t	code;
65*86d7f5d3SJohn Marino };
66*86d7f5d3SJohn Marino 
67*86d7f5d3SJohn Marino extern char	*amr_describe_code(struct amr_code_lookup *table, u_int32_t code);
68*86d7f5d3SJohn Marino 
69*86d7f5d3SJohn Marino #ifndef AMR_DEFINE_TABLES
70*86d7f5d3SJohn Marino extern struct amr_code_lookup amr_table_qinit[];
71*86d7f5d3SJohn Marino extern struct amr_code_lookup amr_table_sinit[];
72*86d7f5d3SJohn Marino extern struct amr_code_lookup amr_table_drvstate[];
73*86d7f5d3SJohn Marino 
74*86d7f5d3SJohn Marino #else /* AMR_DEFINE_TABLES */
75*86d7f5d3SJohn Marino 
76*86d7f5d3SJohn Marino /********************************************************************************
77*86d7f5d3SJohn Marino  * Look up a text description of a numeric code and return a pointer to same.
78*86d7f5d3SJohn Marino  */
79*86d7f5d3SJohn Marino char *
amr_describe_code(struct amr_code_lookup * table,u_int32_t code)80*86d7f5d3SJohn Marino amr_describe_code(struct amr_code_lookup *table, u_int32_t code)
81*86d7f5d3SJohn Marino {
82*86d7f5d3SJohn Marino     int		i;
83*86d7f5d3SJohn Marino 
84*86d7f5d3SJohn Marino     for (i = 0; table[i].string != NULL; i++)
85*86d7f5d3SJohn Marino 	if (table[i].code == code)
86*86d7f5d3SJohn Marino 	    return(table[i].string);
87*86d7f5d3SJohn Marino     return(table[i+1].string);
88*86d7f5d3SJohn Marino }
89*86d7f5d3SJohn Marino 
90*86d7f5d3SJohn Marino struct amr_code_lookup amr_table_qinit[] = {
91*86d7f5d3SJohn Marino     {"init scanning drives",		AMR_QINIT_SCAN},
92*86d7f5d3SJohn Marino     {"init scanning initialising",	AMR_QINIT_SCANINIT},
93*86d7f5d3SJohn Marino     {"init firmware initing",		AMR_QINIT_FIRMWARE},
94*86d7f5d3SJohn Marino     {"init in progress",		AMR_QINIT_INPROG},
95*86d7f5d3SJohn Marino     {"init spinning drives",		AMR_QINIT_SPINUP},
96*86d7f5d3SJohn Marino     {"insufficient memory",		AMR_QINIT_NOMEM},
97*86d7f5d3SJohn Marino     {"init flushing cache",		AMR_QINIT_CACHEFLUSH},
98*86d7f5d3SJohn Marino     {"init successfully done",		AMR_QINIT_DONE},
99*86d7f5d3SJohn Marino     {NULL, 0},
100*86d7f5d3SJohn Marino     {"unknown init code", 0}
101*86d7f5d3SJohn Marino };
102*86d7f5d3SJohn Marino 
103*86d7f5d3SJohn Marino struct amr_code_lookup amr_table_sinit[] = {
104*86d7f5d3SJohn Marino     {"init abnormal terminated",	AMR_SINIT_ABEND},
105*86d7f5d3SJohn Marino     {"insufficient memory",		AMR_SINIT_NOMEM},
106*86d7f5d3SJohn Marino     {"firmware flushing cache",		AMR_SINIT_CACHEFLUSH},
107*86d7f5d3SJohn Marino     {"init in progress",		AMR_SINIT_INPROG},
108*86d7f5d3SJohn Marino     {"firmware spinning drives",	AMR_SINIT_SPINUP},
109*86d7f5d3SJohn Marino     {"init successfully done",		AMR_SINIT_DONE},
110*86d7f5d3SJohn Marino     {NULL, 0},
111*86d7f5d3SJohn Marino     {"unknown init code", 0}
112*86d7f5d3SJohn Marino };
113*86d7f5d3SJohn Marino 
114*86d7f5d3SJohn Marino struct amr_code_lookup amr_table_drvstate[] = {
115*86d7f5d3SJohn Marino     {"offline",			AMR_DRV_OFFLINE},
116*86d7f5d3SJohn Marino     {"degraded",		AMR_DRV_DEGRADED},
117*86d7f5d3SJohn Marino     {"optimal",			AMR_DRV_OPTIMAL},
118*86d7f5d3SJohn Marino     {"online",			AMR_DRV_ONLINE},
119*86d7f5d3SJohn Marino     {"failed",			AMR_DRV_FAILED},
120*86d7f5d3SJohn Marino     {"rebuild",			AMR_DRV_REBUILD},
121*86d7f5d3SJohn Marino     {"hot spare",		AMR_DRV_HOTSPARE},
122*86d7f5d3SJohn Marino     {NULL, 0},
123*86d7f5d3SJohn Marino     {"unknown",	0}
124*86d7f5d3SJohn Marino };
125*86d7f5d3SJohn Marino 
126*86d7f5d3SJohn Marino struct amr_code_lookup amr_table_adaptertype[] = {
127*86d7f5d3SJohn Marino     {"Series 431",			AMR_SIG_431},
128*86d7f5d3SJohn Marino     {"Series 438",			AMR_SIG_438},
129*86d7f5d3SJohn Marino     {"Series 762",			AMR_SIG_762},
130*86d7f5d3SJohn Marino     {"Integrated HP NetRAID (T5)",	AMR_SIG_T5},
131*86d7f5d3SJohn Marino     {"Series 466",			AMR_SIG_466},
132*86d7f5d3SJohn Marino     {"Series 467",			AMR_SIG_467},
133*86d7f5d3SJohn Marino     {"Integrated HP NetRAID (T7)",	AMR_SIG_T7},
134*86d7f5d3SJohn Marino     {"Series 490",			AMR_SIG_490},
135*86d7f5d3SJohn Marino     {NULL, 0},
136*86d7f5d3SJohn Marino     {"unknown adapter",	0}
137*86d7f5d3SJohn Marino };
138*86d7f5d3SJohn Marino 
139*86d7f5d3SJohn Marino #endif
140