]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/dev/isci/scil/sati_mode_pages.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / dev / isci / scil / sati_mode_pages.c
1 /*-
2  * This file is provided under a dual BSD/GPLv2 license.  When using or
3  * redistributing this file, you may do so under either license.
4  *
5  * GPL LICENSE SUMMARY
6  *
7  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of version 2 of the GNU General Public License as
11  * published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21  * The full GNU General Public License is included in this distribution
22  * in the file called LICENSE.GPL.
23  *
24  * BSD LICENSE
25  *
26  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without
30  * modification, are permitted provided that the following conditions
31  * are met:
32  *
33  *   * Redistributions of source code must retain the above copyright
34  *     notice, this list of conditions and the following disclaimer.
35  *   * Redistributions in binary form must reproduce the above copyright
36  *     notice, this list of conditions and the following disclaimer in
37  *     the documentation and/or other materials provided with the
38  *     distribution.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51  */
52
53 #include <sys/cdefs.h>
54 __FBSDID("$FreeBSD$");
55
56 /**
57  * @file
58  * @brief This file contains the mode page constants and data for the mode
59  *        pages supported by this translation implementation.
60  */
61
62 // DO NOT MOVE THIS INCLUDE STATEMENT! This include must occur before
63 // the below check for ENABLE_SATI_MODE_PAGES.
64 #include <dev/isci/scil/sati_types.h>
65
66 #if defined(ENABLE_SATI_MODE_PAGES)
67
68 #include <dev/isci/scil/sati_mode_pages.h>
69 #include <dev/isci/scil/intel_scsi.h>
70
71 //******************************************************************************
72 //* C O N S T A N T S
73 //******************************************************************************
74
75 #define SCSI_MODE_PAGE19_SAS_ID         0x6
76 #define SCSI_MODE_PAGE19_SUB1_PAGE_NUM  0x1
77 #define SCSI_MODE_PAGE19_SUB1_PC        0x59
78
79 //******************************************************************************
80 //* M O D E   P A G E S
81 //******************************************************************************
82
83 U8 sat_default_mode_page_01[] =
84 {
85    SCSI_MODE_PAGE_READ_WRITE_ERROR, // Byte 0 - Page Code, SPF(0), PS(0)
86    SCSI_MODE_PAGE_01_LENGTH-2,      // Byte 1 - Page Length
87    0x80, // Byte 2 - AWRE, ARRE, TB, RC, EER, PER, DTE, DCR
88    0x00, // Byte 3 - Read Retry Count
89
90    0x00, // Byte 4 - Obsolete
91    0x00, // Byte 5 - Obsolete
92    0x00, // Byte 6 - Obsolete
93    0x00, // Byte 7 - Restricted for MMC-4
94
95    0x00, // Byte 8 - Write Retry Count
96    0x00, // Byte 9 - Reserved
97    0x00, // Byte 10 - Recovery Time Limit
98    0x00, // Byte 11
99 };
100
101 U8 sat_changeable_mode_page_01[] =
102 {
103    SCSI_MODE_PAGE_READ_WRITE_ERROR,
104    SCSI_MODE_PAGE_01_LENGTH-2,
105    0x00,
106    0x00,
107
108    0x00,
109    0x00,
110    0x00,
111    0x00,
112
113    0x00,
114    0x00,
115    0x00,
116    0x00,
117 };
118
119 U8 sat_default_mode_page_02[] =
120 {
121    SCSI_MODE_PAGE_DISCONNECT_RECONNECT, // Byte 0 - Page Code, SPF(0), PS(0)
122    SCSI_MODE_PAGE_02_LENGTH-2,          // Byte 1 - Page Length
123    0x00, // Byte 2 - Buffer Full Ratio
124    0x00, // Byte 3 - Buffer Empty Ratio
125
126    0x00, // Byte 4 - Bus Inactivity Limit
127    0x00, // Byte 5
128    0x00, // Byte 6 - Disconnect Time Limit
129    0x00, // Byte 7
130
131    0x00, // Byte 8 - Connect Time Limit
132    0x00, // Byte 9
133    0x00, // Byte 10 - Maximum Burst Size
134    0x00, // Byte 11
135
136    0x00, // Byte 12 - EMDP, FAIR_ARB, DIMM, DTDC
137    0x00, // Byte 13
138    0x00, // Byte 14 - First Burst Size
139    0x00, // Byte 15
140 };
141
142 U8 sat_changeable_mode_page_02[] =
143 {
144    SCSI_MODE_PAGE_DISCONNECT_RECONNECT,
145    SCSI_MODE_PAGE_02_LENGTH-2,
146    0x00,
147    0x00,
148
149    0x00,
150    0x00,
151    0x00,
152    0x00,
153
154    0x00,
155    0x00,
156    0x00,
157    0x00,
158
159    0x00,
160    0x00,
161    0x00,
162    0x00,
163 };
164
165 U8 sat_default_mode_page_08[] =
166 {
167    SCSI_MODE_PAGE_CACHING,     // Byte 0 - Page Code, SPF(0), PS(0)
168    SCSI_MODE_PAGE_08_LENGTH-2, // Byte 1 - Page Length
169    0x00, // Byte 2 - IC, ABPF, CAP, DISC, SIZE, WCE(1), MF, RCD
170    0x00, // Byte 3 - Demand Read Retention Priority, Write Retention Priority
171
172    0x00, // Byte 4 - Disable Pre-Fetch Transfer Length
173    0x00, // Byte 5
174    0x00, // Byte 6 - Minimum Pre-Fetch
175    0x00, // Byte 7
176
177    0x00, // Byte 8 - Maximum Pre-Fetch
178    0x00, // Byte 9
179    0x00, // Byte 10 - Maximum Pre-Fetch Ceiling
180    0x00, // Byte 11
181
182    0x00, // Byte 12 - FSW, LBCSS, DRA(0), Vendor Specific, NV_DIS
183    0x00, // Byte 13 - Number of Cache Segments
184    0x00, // Byte 14 - Cache Segment Size
185    0x00, // Byte 15
186
187    0x00, // Byte 16 - Reserved
188    0x00, // Byte 17 - Non-Cache Segment Size
189    0x00, // Byte 18
190    0x00, // PAD
191 };
192
193 U8 sat_changeable_mode_page_08[] =
194 {
195    SCSI_MODE_PAGE_CACHING,
196    SCSI_MODE_PAGE_08_LENGTH-2,
197    SCSI_MODE_PAGE_CACHE_PAGE_WCE_BIT,
198    0x00,
199
200    0x00,
201    0x00,
202    0x00,
203    0x00,
204
205    0x00,
206    0x00,
207    0x00,
208    0x00,
209
210    SCSI_MODE_PAGE_CACHE_PAGE_DRA_BIT,
211    0x00,
212    0x00,
213    0x00,
214
215    0x00,
216    0x00,
217    0x00,
218    0x00, // PAD
219 };
220
221 U8 sat_default_mode_page_0A[] =
222 {
223    SCSI_MODE_PAGE_CONTROL,     // Byte 0 - Page Code, SPF(0), PS(0)
224    SCSI_MODE_PAGE_0A_LENGTH-2, // Byte 1 - Page Length
225    0x00, // Byte 2 - TST(0), TMF_ONLY(0), D_SENSE(0), GLTSD(0), RLEC(0)
226    0x10, // Byte 3 - Queue Algorithm(0), QErr(0)
227
228    0x00, // Byte 4 - TAS(0), RAC(0), UA_(0), SWP(0)
229    0x00, // Byte 5 - ATO(0), AUTOLOAD(0)
230    0x00, // Byte 6
231    0x00, // Byte 7
232
233    0xFF, // Byte 8 - Unlimited Busy timeout
234    0xFF, // Byte 9
235    0x00, // Byte 10 - do not support self time compl time xlation
236    0x00, // Byte 11
237 };
238
239 U8 sat_changeable_mode_page_0A[] =
240 {
241    SCSI_MODE_PAGE_CONTROL,
242    SCSI_MODE_PAGE_0A_LENGTH-2,
243    0x00,
244    0x00,
245
246    0x00,
247    0x00,
248    0x00,
249    0x00,
250
251    0x00,
252    0x00,
253    0x00,
254    0x00,
255 };
256
257 U8 sat_default_mode_page_19[] =
258 {
259    SCSI_MODE_PAGE_PROTOCOL_SPECIFIC_PORT, // Byte 0 - PS, SPF, Page Code
260    SCSI_MODE_PAGE_19_LENGTH-2,  // Byte 1 - Page Length
261    SCSI_MODE_PAGE19_SAS_ID,     // Byte 2 - Rsvd, READY_LED,  ProtoID
262    0x00, // PAD
263
264    0xFF, // Byte 4 - IT NLT MSB, 0xFF retry forever
265    0xFF, // Byte 5 - IT NLT LSB, 0xFF retry forever
266    0x00, // Byte 6 - IRT MSB, 0x0 disable init resp timer
267    0x00, // Byte 7 - IRT LSB, 0x0 disable init resp timer
268 };
269
270 U8 sat_changeable_mode_page_19[] =
271 {
272    SCSI_MODE_PAGE_PROTOCOL_SPECIFIC_PORT,
273    SCSI_MODE_PAGE_19_LENGTH-2,
274    0x00,
275    0x00,
276
277    0x00,
278    0x00,
279    0x00,
280    0x00,
281 };
282
283 U8 sat_default_mode_page_1C[] =
284 {
285    SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL, // Byte 0 - Page Code,
286                                               // SPF(0), PS(0)
287    SCSI_MODE_PAGE_1C_LENGTH-2,   // Byte 1 - Page Length
288    SCSI_MODE_PAGE_DEXCPT_ENABLE, // Byte 2 - Perf, EBF, EWasc,
289                                  // DExcpt(1), Test, LogErr
290    0x06, // Byte 3 -- MRIE (6 == values only available upon request)
291
292    0x00, // Byte 4 -- Interval Timer
293    0x00, // Byte 5
294    0x00, // Byte 6
295    0x00, // Byte 7
296
297    0x00, // Byte 8 -- Report Count
298    0x00, // Byte 9
299    0x00, // Byte 10
300    0x00, // Byte 11
301 };
302
303 U8 sat_changeable_mode_page_1C[] =
304 {
305    SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL,
306    SCSI_MODE_PAGE_1C_LENGTH-2,
307    SCSI_MODE_PAGE_DEXCPT_ENABLE,
308    0x00,
309
310    0x00,
311    0x00,
312    0x00,
313    0x00,
314
315    0x00,
316    0x00,
317    0x00,
318    0x00,
319 };
320
321 U8 sat_supported_mode_pages[] =
322 {
323    SCSI_MODE_PAGE_READ_WRITE_ERROR,
324    SCSI_MODE_PAGE_DISCONNECT_RECONNECT,
325    SCSI_MODE_PAGE_CACHING,
326    SCSI_MODE_PAGE_CONTROL,
327    SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL
328 };
329
330 U8 *sat_changeable_mode_pages[] =
331 {
332    sat_changeable_mode_page_01,
333    sat_changeable_mode_page_02,
334    sat_changeable_mode_page_08,
335    sat_changeable_mode_page_0A,
336    sat_changeable_mode_page_1C
337 };
338
339 U8 *sat_default_mode_pages[] =
340 {
341    sat_default_mode_page_01,
342    sat_default_mode_page_02,
343    sat_default_mode_page_08,
344    sat_default_mode_page_0A,
345    sat_default_mode_page_1C
346 };
347
348 U16 sat_mode_page_sizes[] =
349 {
350    sizeof(sat_default_mode_page_01),
351    sizeof(sat_default_mode_page_02),
352    sizeof(sat_default_mode_page_08),
353    sizeof(sat_default_mode_page_0A),
354    sizeof(sat_default_mode_page_1C)
355 };
356
357 U16 sati_mode_page_get_page_index(
358    U8  page_code
359 )
360 {
361    U16 index;
362    for (index = 0; index < SAT_SUPPORTED_MODE_PAGES_LENGTH; index++)
363    {
364       if (sat_supported_mode_pages[index] == page_code)
365          return index;
366    }
367
368    return SATI_MODE_PAGE_UNSUPPORTED_INDEX;
369 }
370
371 #endif // defined(ENABLE_SATI_MODE_PAGES)
372