1/*-
2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3 *
4 * This file is provided under a dual BSD/GPLv2 license.  When using or
5 * redistributing this file, you may do so under either license.
6 *
7 * GPL LICENSE SUMMARY
8 *
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
25 *
26 * BSD LICENSE
27 *
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
30 *
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
33 * are met:
34 *
35 *   * Redistributions of source code must retain the above copyright
36 *     notice, this list of conditions and the following disclaimer.
37 *   * Redistributions in binary form must reproduce the above copyright
38 *     notice, this list of conditions and the following disclaimer in
39 *     the documentation and/or other materials provided with the
40 *     distribution.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 *
54 * $FreeBSD$
55 */
56#ifndef _SCIF_SAS_USER_PARAMETERS_H_
57#define _SCIF_SAS_USER_PARAMETERS_H_
58
59/**
60 * @file
61 *
62 * @brief This file contains all of the interface methods that can be called
63 *        by an SCIF user on a SCIF_SAS_USER_PARAMETERS object.
64 */
65
66#ifdef __cplusplus
67extern "C" {
68#endif // __cplusplus
69
70#include <dev/isci/scil/sci_types.h>
71#include <dev/isci/scil/sci_status.h>
72#include <dev/isci/scil/intel_sas.h>
73
74
75/**
76 * @struct SCIF_SAS_USER_PARAMETERS
77 *
78 * @brief This structure delineates the various user parameters that can be
79 *        changed by the framework user.
80 */
81typedef struct SCIF_SAS_USER_PARAMETERS
82{
83   /**
84    * This field indicates if the user would like to have the SATA NCQ
85    * feature enabled for all remote devices.
86    */
87   BOOL  is_sata_ncq_enabled;
88
89   /**
90    * This field indicates if the user would like to have the SATA Automatic
91    * Standby Timer feature enabled for all remote devices.
92    */
93   BOOL  is_sata_standby_timer_enabled;
94
95   /**
96    * This field indicates if the user would like to have the SATA Non-zero
97    * Buffer Offset feature enabled for all remote devices.
98    */
99   BOOL  is_non_zero_buffer_offsets_enabled;
100
101   /**
102    * This field indicates if the user would like to clear affiliation for EA
103    * SATA devices during the controller stop process.
104    */
105   BOOL  clear_affiliation_during_controller_stop;
106
107   /**
108    * This field indicates the user's desired NCQ depth for all remote
109    * devices.  The maximum legal value for this field is 32.
110    */
111   U16  max_ncq_depth;
112
113   /**
114    * This field indicates the type of reset to be applied to all remote
115    * devices the first time they are discovered.
116    */
117   SCI_SAS_TASK_MGMT_FUNCTION_T  reset_type;
118
119   /**
120    * This field indicates the os/user recommends ignoring fua in translation
121    * for performance reasons.
122    */
123   BOOL  ignore_fua;
124
125} SCIF_SAS_USER_PARAMETERS_T;
126
127/**
128 * @union SCIF_USER_PARAMETERS
129 * @brief This structure/union specifies the various different user
130 *        parameter sets available.  Each type is specific to a
131 *        Serial Attached SCSI implementation of the framework.
132 *
133 */
134typedef union SCIF_USER_PARAMETERS
135{
136   SCIF_SAS_USER_PARAMETERS_T sas;
137
138} SCIF_USER_PARAMETERS_T;
139
140/**
141 * @brief This method allows the user to attempt to change the user
142 *        parameters utilized by the controller.
143 *
144 * @param[in] controller This parameter specifies the controller on which
145 *            to set the user parameters.
146 * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
147 *            object containing the potential new values.
148 *
149 * @return Indicate if the update of the user parameters was successful.
150 * @retval SCI_SUCCESS This value is returned if the operation succeeded.
151 * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
152 *         to change the user parameter failed, because changing one of
153 *         the parameters is not currently allowed.
154 * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
155 *         user supplied an invalid reset_type, ncq depth, etc.
156 */
157SCI_STATUS scif_user_parameters_set(
158   SCI_CONTROLLER_HANDLE_T  controller,
159   SCIF_USER_PARAMETERS_T * user_parameters
160);
161
162/**
163 * @brief This method allows the user to retrieve the user parameters
164 *        utilized by the controller.
165 *
166 * @param[in] controller This parameter specifies the controller on which
167 *            to set the user parameters.
168 * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
169 *            object into which the framework shall save it's parameters.
170 *
171 * @return none
172 */
173void scif_user_parameters_get(
174   SCI_CONTROLLER_HANDLE_T  controller,
175   SCIF_USER_PARAMETERS_T * user_parameters
176);
177
178#ifdef __cplusplus
179}
180#endif // __cplusplus
181
182#endif // _SCIF_SAS_USER_PARAMETERS_H_
183
184