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