xref: /freebsd/sys/dev/isci/scil/scif_config_parameters.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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 #ifndef _SCIF_SAS_USER_PARAMETERS_H_
55 #define _SCIF_SAS_USER_PARAMETERS_H_
56 
57 /**
58  * @file
59  *
60  * @brief This file contains all of the interface methods that can be called
61  *        by an SCIF user on a SCIF_SAS_USER_PARAMETERS object.
62  */
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif // __cplusplus
67 
68 #include <dev/isci/scil/sci_types.h>
69 #include <dev/isci/scil/sci_status.h>
70 #include <dev/isci/scil/intel_sas.h>
71 
72 
73 /**
74  * @struct SCIF_SAS_USER_PARAMETERS
75  *
76  * @brief This structure delineates the various user parameters that can be
77  *        changed by the framework user.
78  */
79 typedef struct SCIF_SAS_USER_PARAMETERS
80 {
81    /**
82     * This field indicates if the user would like to have the SATA NCQ
83     * feature enabled for all remote devices.
84     */
85    BOOL  is_sata_ncq_enabled;
86 
87    /**
88     * This field indicates if the user would like to have the SATA Automatic
89     * Standby Timer feature enabled for all remote devices.
90     */
91    BOOL  is_sata_standby_timer_enabled;
92 
93    /**
94     * This field indicates if the user would like to have the SATA Non-zero
95     * Buffer Offset feature enabled for all remote devices.
96     */
97    BOOL  is_non_zero_buffer_offsets_enabled;
98 
99    /**
100     * This field indicates if the user would like to clear affiliation for EA
101     * SATA devices during the controller stop process.
102     */
103    BOOL  clear_affiliation_during_controller_stop;
104 
105    /**
106     * This field indicates the user's desired NCQ depth for all remote
107     * devices.  The maximum legal value for this field is 32.
108     */
109    U16  max_ncq_depth;
110 
111    /**
112     * This field indicates the type of reset to be applied to all remote
113     * devices the first time they are discovered.
114     */
115    SCI_SAS_TASK_MGMT_FUNCTION_T  reset_type;
116 
117    /**
118     * This field indicates the os/user recommends ignoring fua in translation
119     * for performance reasons.
120     */
121    BOOL  ignore_fua;
122 
123 } SCIF_SAS_USER_PARAMETERS_T;
124 
125 /**
126  * @union SCIF_USER_PARAMETERS
127  * @brief This structure/union specifies the various different user
128  *        parameter sets available.  Each type is specific to a
129  *        Serial Attached SCSI implementation of the framework.
130  *
131  */
132 typedef union SCIF_USER_PARAMETERS
133 {
134    SCIF_SAS_USER_PARAMETERS_T sas;
135 
136 } SCIF_USER_PARAMETERS_T;
137 
138 /**
139  * @brief This method allows the user to attempt to change the user
140  *        parameters utilized by the controller.
141  *
142  * @param[in] controller This parameter specifies the controller on which
143  *            to set the user parameters.
144  * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
145  *            object containing the potential new values.
146  *
147  * @return Indicate if the update of the user parameters was successful.
148  * @retval SCI_SUCCESS This value is returned if the operation succeeded.
149  * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
150  *         to change the user parameter failed, because changing one of
151  *         the parameters is not currently allowed.
152  * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
153  *         user supplied an invalid reset_type, ncq depth, etc.
154  */
155 SCI_STATUS scif_user_parameters_set(
156    SCI_CONTROLLER_HANDLE_T  controller,
157    SCIF_USER_PARAMETERS_T * user_parameters
158 );
159 
160 /**
161  * @brief This method allows the user to retrieve the user parameters
162  *        utilized by the controller.
163  *
164  * @param[in] controller This parameter specifies the controller on which
165  *            to set the user parameters.
166  * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
167  *            object into which the framework shall save it's parameters.
168  *
169  * @return none
170  */
171 void scif_user_parameters_get(
172    SCI_CONTROLLER_HANDLE_T  controller,
173    SCIF_USER_PARAMETERS_T * user_parameters
174 );
175 
176 #ifdef __cplusplus
177 }
178 #endif // __cplusplus
179 
180 #endif // _SCIF_SAS_USER_PARAMETERS_H_
181 
182