1230557Sjimharris/*- 2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license. When using or 3230557Sjimharris * redistributing this file, you may do so under either license. 4230557Sjimharris * 5230557Sjimharris * GPL LICENSE SUMMARY 6230557Sjimharris * 7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8230557Sjimharris * 9230557Sjimharris * This program is free software; you can redistribute it and/or modify 10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as 11230557Sjimharris * published by the Free Software Foundation. 12230557Sjimharris * 13230557Sjimharris * This program is distributed in the hope that it will be useful, but 14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of 15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16230557Sjimharris * General Public License for more details. 17230557Sjimharris * 18230557Sjimharris * You should have received a copy of the GNU General Public License 19230557Sjimharris * along with this program; if not, write to the Free Software 20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21230557Sjimharris * The full GNU General Public License is included in this distribution 22230557Sjimharris * in the file called LICENSE.GPL. 23230557Sjimharris * 24230557Sjimharris * BSD LICENSE 25230557Sjimharris * 26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27230557Sjimharris * All rights reserved. 28230557Sjimharris * 29230557Sjimharris * Redistribution and use in source and binary forms, with or without 30230557Sjimharris * modification, are permitted provided that the following conditions 31230557Sjimharris * are met: 32230557Sjimharris * 33230557Sjimharris * * Redistributions of source code must retain the above copyright 34230557Sjimharris * notice, this list of conditions and the following disclaimer. 35230557Sjimharris * * Redistributions in binary form must reproduce the above copyright 36230557Sjimharris * notice, this list of conditions and the following disclaimer in 37230557Sjimharris * the documentation and/or other materials provided with the 38230557Sjimharris * distribution. 39230557Sjimharris * 40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51230557Sjimharris */ 52230557Sjimharris 53230557Sjimharris#include <sys/cdefs.h> 54230557Sjimharris__FBSDID("$FreeBSD: releng/10.3/sys/dev/isci/scil/sati_mode_pages.c 231136 2012-02-07 17:43:58Z jimharris $"); 55230557Sjimharris 56230557Sjimharris/** 57230557Sjimharris * @file 58230557Sjimharris * @brief This file contains the mode page constants and data for the mode 59230557Sjimharris * pages supported by this translation implementation. 60230557Sjimharris */ 61230557Sjimharris 62230557Sjimharris// DO NOT MOVE THIS INCLUDE STATEMENT! This include must occur before 63230557Sjimharris// the below check for ENABLE_SATI_MODE_PAGES. 64230557Sjimharris#include <dev/isci/scil/sati_types.h> 65230557Sjimharris 66230557Sjimharris#if defined(ENABLE_SATI_MODE_PAGES) 67230557Sjimharris 68230557Sjimharris#include <dev/isci/scil/sati_mode_pages.h> 69230557Sjimharris#include <dev/isci/scil/intel_scsi.h> 70230557Sjimharris 71230557Sjimharris//****************************************************************************** 72230557Sjimharris//* C O N S T A N T S 73230557Sjimharris//****************************************************************************** 74230557Sjimharris 75230557Sjimharris#define SCSI_MODE_PAGE19_SAS_ID 0x6 76230557Sjimharris#define SCSI_MODE_PAGE19_SUB1_PAGE_NUM 0x1 77230557Sjimharris#define SCSI_MODE_PAGE19_SUB1_PC 0x59 78230557Sjimharris 79230557Sjimharris//****************************************************************************** 80230557Sjimharris//* M O D E P A G E S 81230557Sjimharris//****************************************************************************** 82230557Sjimharris 83230557SjimharrisU8 sat_default_mode_page_01[] = 84230557Sjimharris{ 85230557Sjimharris SCSI_MODE_PAGE_READ_WRITE_ERROR, // Byte 0 - Page Code, SPF(0), PS(0) 86230557Sjimharris SCSI_MODE_PAGE_01_LENGTH-2, // Byte 1 - Page Length 87230557Sjimharris 0x80, // Byte 2 - AWRE, ARRE, TB, RC, EER, PER, DTE, DCR 88230557Sjimharris 0x00, // Byte 3 - Read Retry Count 89230557Sjimharris 90230557Sjimharris 0x00, // Byte 4 - Obsolete 91230557Sjimharris 0x00, // Byte 5 - Obsolete 92230557Sjimharris 0x00, // Byte 6 - Obsolete 93230557Sjimharris 0x00, // Byte 7 - Restricted for MMC-4 94230557Sjimharris 95230557Sjimharris 0x00, // Byte 8 - Write Retry Count 96230557Sjimharris 0x00, // Byte 9 - Reserved 97230557Sjimharris 0x00, // Byte 10 - Recovery Time Limit 98230557Sjimharris 0x00, // Byte 11 99230557Sjimharris}; 100230557Sjimharris 101230557SjimharrisU8 sat_changeable_mode_page_01[] = 102230557Sjimharris{ 103230557Sjimharris SCSI_MODE_PAGE_READ_WRITE_ERROR, 104230557Sjimharris SCSI_MODE_PAGE_01_LENGTH-2, 105230557Sjimharris 0x00, 106230557Sjimharris 0x00, 107230557Sjimharris 108230557Sjimharris 0x00, 109230557Sjimharris 0x00, 110230557Sjimharris 0x00, 111230557Sjimharris 0x00, 112230557Sjimharris 113230557Sjimharris 0x00, 114230557Sjimharris 0x00, 115230557Sjimharris 0x00, 116230557Sjimharris 0x00, 117230557Sjimharris}; 118230557Sjimharris 119230557SjimharrisU8 sat_default_mode_page_02[] = 120230557Sjimharris{ 121230557Sjimharris SCSI_MODE_PAGE_DISCONNECT_RECONNECT, // Byte 0 - Page Code, SPF(0), PS(0) 122230557Sjimharris SCSI_MODE_PAGE_02_LENGTH-2, // Byte 1 - Page Length 123230557Sjimharris 0x00, // Byte 2 - Buffer Full Ratio 124230557Sjimharris 0x00, // Byte 3 - Buffer Empty Ratio 125230557Sjimharris 126230557Sjimharris 0x00, // Byte 4 - Bus Inactivity Limit 127230557Sjimharris 0x00, // Byte 5 128230557Sjimharris 0x00, // Byte 6 - Disconnect Time Limit 129230557Sjimharris 0x00, // Byte 7 130230557Sjimharris 131230557Sjimharris 0x00, // Byte 8 - Connect Time Limit 132230557Sjimharris 0x00, // Byte 9 133230557Sjimharris 0x00, // Byte 10 - Maximum Burst Size 134230557Sjimharris 0x00, // Byte 11 135230557Sjimharris 136230557Sjimharris 0x00, // Byte 12 - EMDP, FAIR_ARB, DIMM, DTDC 137230557Sjimharris 0x00, // Byte 13 138230557Sjimharris 0x00, // Byte 14 - First Burst Size 139230557Sjimharris 0x00, // Byte 15 140230557Sjimharris}; 141230557Sjimharris 142230557SjimharrisU8 sat_changeable_mode_page_02[] = 143230557Sjimharris{ 144230557Sjimharris SCSI_MODE_PAGE_DISCONNECT_RECONNECT, 145230557Sjimharris SCSI_MODE_PAGE_02_LENGTH-2, 146230557Sjimharris 0x00, 147230557Sjimharris 0x00, 148230557Sjimharris 149230557Sjimharris 0x00, 150230557Sjimharris 0x00, 151230557Sjimharris 0x00, 152230557Sjimharris 0x00, 153230557Sjimharris 154230557Sjimharris 0x00, 155230557Sjimharris 0x00, 156230557Sjimharris 0x00, 157230557Sjimharris 0x00, 158230557Sjimharris 159230557Sjimharris 0x00, 160230557Sjimharris 0x00, 161230557Sjimharris 0x00, 162230557Sjimharris 0x00, 163230557Sjimharris}; 164230557Sjimharris 165230557SjimharrisU8 sat_default_mode_page_08[] = 166230557Sjimharris{ 167230557Sjimharris SCSI_MODE_PAGE_CACHING, // Byte 0 - Page Code, SPF(0), PS(0) 168230557Sjimharris SCSI_MODE_PAGE_08_LENGTH-2, // Byte 1 - Page Length 169230557Sjimharris 0x00, // Byte 2 - IC, ABPF, CAP, DISC, SIZE, WCE(1), MF, RCD 170230557Sjimharris 0x00, // Byte 3 - Demand Read Retention Priority, Write Retention Priority 171230557Sjimharris 172230557Sjimharris 0x00, // Byte 4 - Disable Pre-Fetch Transfer Length 173230557Sjimharris 0x00, // Byte 5 174230557Sjimharris 0x00, // Byte 6 - Minimum Pre-Fetch 175230557Sjimharris 0x00, // Byte 7 176230557Sjimharris 177230557Sjimharris 0x00, // Byte 8 - Maximum Pre-Fetch 178230557Sjimharris 0x00, // Byte 9 179230557Sjimharris 0x00, // Byte 10 - Maximum Pre-Fetch Ceiling 180230557Sjimharris 0x00, // Byte 11 181230557Sjimharris 182230557Sjimharris 0x00, // Byte 12 - FSW, LBCSS, DRA(0), Vendor Specific, NV_DIS 183230557Sjimharris 0x00, // Byte 13 - Number of Cache Segments 184230557Sjimharris 0x00, // Byte 14 - Cache Segment Size 185230557Sjimharris 0x00, // Byte 15 186230557Sjimharris 187230557Sjimharris 0x00, // Byte 16 - Reserved 188230557Sjimharris 0x00, // Byte 17 - Non-Cache Segment Size 189230557Sjimharris 0x00, // Byte 18 190230557Sjimharris 0x00, // PAD 191230557Sjimharris}; 192230557Sjimharris 193230557SjimharrisU8 sat_changeable_mode_page_08[] = 194230557Sjimharris{ 195230557Sjimharris SCSI_MODE_PAGE_CACHING, 196230557Sjimharris SCSI_MODE_PAGE_08_LENGTH-2, 197230557Sjimharris SCSI_MODE_PAGE_CACHE_PAGE_WCE_BIT, 198230557Sjimharris 0x00, 199230557Sjimharris 200230557Sjimharris 0x00, 201230557Sjimharris 0x00, 202230557Sjimharris 0x00, 203230557Sjimharris 0x00, 204230557Sjimharris 205230557Sjimharris 0x00, 206230557Sjimharris 0x00, 207230557Sjimharris 0x00, 208230557Sjimharris 0x00, 209230557Sjimharris 210230557Sjimharris SCSI_MODE_PAGE_CACHE_PAGE_DRA_BIT, 211230557Sjimharris 0x00, 212230557Sjimharris 0x00, 213230557Sjimharris 0x00, 214230557Sjimharris 215230557Sjimharris 0x00, 216230557Sjimharris 0x00, 217230557Sjimharris 0x00, 218230557Sjimharris 0x00, // PAD 219230557Sjimharris}; 220230557Sjimharris 221230557SjimharrisU8 sat_default_mode_page_0A[] = 222230557Sjimharris{ 223230557Sjimharris SCSI_MODE_PAGE_CONTROL, // Byte 0 - Page Code, SPF(0), PS(0) 224230557Sjimharris SCSI_MODE_PAGE_0A_LENGTH-2, // Byte 1 - Page Length 225230557Sjimharris 0x00, // Byte 2 - TST(0), TMF_ONLY(0), D_SENSE(0), GLTSD(0), RLEC(0) 226230557Sjimharris 0x10, // Byte 3 - Queue Algorithm(0), QErr(0) 227230557Sjimharris 228230557Sjimharris 0x00, // Byte 4 - TAS(0), RAC(0), UA_(0), SWP(0) 229230557Sjimharris 0x00, // Byte 5 - ATO(0), AUTOLOAD(0) 230230557Sjimharris 0x00, // Byte 6 231230557Sjimharris 0x00, // Byte 7 232230557Sjimharris 233230557Sjimharris 0xFF, // Byte 8 - Unlimited Busy timeout 234230557Sjimharris 0xFF, // Byte 9 235230557Sjimharris 0x00, // Byte 10 - do not support self time compl time xlation 236230557Sjimharris 0x00, // Byte 11 237230557Sjimharris}; 238230557Sjimharris 239230557SjimharrisU8 sat_changeable_mode_page_0A[] = 240230557Sjimharris{ 241230557Sjimharris SCSI_MODE_PAGE_CONTROL, 242230557Sjimharris SCSI_MODE_PAGE_0A_LENGTH-2, 243230557Sjimharris 0x00, 244230557Sjimharris 0x00, 245230557Sjimharris 246230557Sjimharris 0x00, 247230557Sjimharris 0x00, 248230557Sjimharris 0x00, 249230557Sjimharris 0x00, 250230557Sjimharris 251230557Sjimharris 0x00, 252230557Sjimharris 0x00, 253230557Sjimharris 0x00, 254230557Sjimharris 0x00, 255230557Sjimharris}; 256230557Sjimharris 257230557SjimharrisU8 sat_default_mode_page_19[] = 258230557Sjimharris{ 259230557Sjimharris SCSI_MODE_PAGE_PROTOCOL_SPECIFIC_PORT, // Byte 0 - PS, SPF, Page Code 260230557Sjimharris SCSI_MODE_PAGE_19_LENGTH-2, // Byte 1 - Page Length 261230557Sjimharris SCSI_MODE_PAGE19_SAS_ID, // Byte 2 - Rsvd, READY_LED, ProtoID 262230557Sjimharris 0x00, // PAD 263230557Sjimharris 264230557Sjimharris 0xFF, // Byte 4 - IT NLT MSB, 0xFF retry forever 265230557Sjimharris 0xFF, // Byte 5 - IT NLT LSB, 0xFF retry forever 266230557Sjimharris 0x00, // Byte 6 - IRT MSB, 0x0 disable init resp timer 267230557Sjimharris 0x00, // Byte 7 - IRT LSB, 0x0 disable init resp timer 268230557Sjimharris}; 269230557Sjimharris 270230557SjimharrisU8 sat_changeable_mode_page_19[] = 271230557Sjimharris{ 272230557Sjimharris SCSI_MODE_PAGE_PROTOCOL_SPECIFIC_PORT, 273230557Sjimharris SCSI_MODE_PAGE_19_LENGTH-2, 274230557Sjimharris 0x00, 275230557Sjimharris 0x00, 276230557Sjimharris 277230557Sjimharris 0x00, 278230557Sjimharris 0x00, 279230557Sjimharris 0x00, 280230557Sjimharris 0x00, 281230557Sjimharris}; 282230557Sjimharris 283230557SjimharrisU8 sat_default_mode_page_1C[] = 284230557Sjimharris{ 285230557Sjimharris SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL, // Byte 0 - Page Code, 286230557Sjimharris // SPF(0), PS(0) 287230557Sjimharris SCSI_MODE_PAGE_1C_LENGTH-2, // Byte 1 - Page Length 288230557Sjimharris SCSI_MODE_PAGE_DEXCPT_ENABLE, // Byte 2 - Perf, EBF, EWasc, 289230557Sjimharris // DExcpt(1), Test, LogErr 290230557Sjimharris 0x06, // Byte 3 -- MRIE (6 == values only available upon request) 291230557Sjimharris 292230557Sjimharris 0x00, // Byte 4 -- Interval Timer 293230557Sjimharris 0x00, // Byte 5 294230557Sjimharris 0x00, // Byte 6 295230557Sjimharris 0x00, // Byte 7 296230557Sjimharris 297230557Sjimharris 0x00, // Byte 8 -- Report Count 298230557Sjimharris 0x00, // Byte 9 299230557Sjimharris 0x00, // Byte 10 300230557Sjimharris 0x00, // Byte 11 301230557Sjimharris}; 302230557Sjimharris 303230557SjimharrisU8 sat_changeable_mode_page_1C[] = 304230557Sjimharris{ 305230557Sjimharris SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL, 306230557Sjimharris SCSI_MODE_PAGE_1C_LENGTH-2, 307230557Sjimharris SCSI_MODE_PAGE_DEXCPT_ENABLE, 308230557Sjimharris 0x00, 309230557Sjimharris 310230557Sjimharris 0x00, 311230557Sjimharris 0x00, 312230557Sjimharris 0x00, 313230557Sjimharris 0x00, 314230557Sjimharris 315230557Sjimharris 0x00, 316230557Sjimharris 0x00, 317230557Sjimharris 0x00, 318230557Sjimharris 0x00, 319230557Sjimharris}; 320230557Sjimharris 321230557SjimharrisU8 sat_supported_mode_pages[] = 322230557Sjimharris{ 323230557Sjimharris SCSI_MODE_PAGE_READ_WRITE_ERROR, 324230557Sjimharris SCSI_MODE_PAGE_DISCONNECT_RECONNECT, 325230557Sjimharris SCSI_MODE_PAGE_CACHING, 326230557Sjimharris SCSI_MODE_PAGE_CONTROL, 327230557Sjimharris SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL 328230557Sjimharris}; 329230557Sjimharris 330230557SjimharrisU8 *sat_changeable_mode_pages[] = 331230557Sjimharris{ 332230557Sjimharris sat_changeable_mode_page_01, 333230557Sjimharris sat_changeable_mode_page_02, 334230557Sjimharris sat_changeable_mode_page_08, 335230557Sjimharris sat_changeable_mode_page_0A, 336230557Sjimharris sat_changeable_mode_page_1C 337230557Sjimharris}; 338230557Sjimharris 339230557SjimharrisU8 *sat_default_mode_pages[] = 340230557Sjimharris{ 341230557Sjimharris sat_default_mode_page_01, 342230557Sjimharris sat_default_mode_page_02, 343230557Sjimharris sat_default_mode_page_08, 344230557Sjimharris sat_default_mode_page_0A, 345230557Sjimharris sat_default_mode_page_1C 346230557Sjimharris}; 347230557Sjimharris 348230557SjimharrisU16 sat_mode_page_sizes[] = 349230557Sjimharris{ 350230557Sjimharris sizeof(sat_default_mode_page_01), 351230557Sjimharris sizeof(sat_default_mode_page_02), 352230557Sjimharris sizeof(sat_default_mode_page_08), 353230557Sjimharris sizeof(sat_default_mode_page_0A), 354230557Sjimharris sizeof(sat_default_mode_page_1C) 355230557Sjimharris}; 356230557Sjimharris 357230557SjimharrisU16 sati_mode_page_get_page_index( 358230557Sjimharris U8 page_code 359230557Sjimharris) 360230557Sjimharris{ 361230557Sjimharris U16 index; 362230557Sjimharris for (index = 0; index < SAT_SUPPORTED_MODE_PAGES_LENGTH; index++) 363230557Sjimharris { 364230557Sjimharris if (sat_supported_mode_pages[index] == page_code) 365230557Sjimharris return index; 366230557Sjimharris } 367230557Sjimharris 368230557Sjimharris return SATI_MODE_PAGE_UNSUPPORTED_INDEX; 369230557Sjimharris} 370230557Sjimharris 371230557Sjimharris#endif // defined(ENABLE_SATI_MODE_PAGES) 372230557Sjimharris 373