xref: /freebsd/sys/dev/isci/scil/scif_config_parameters.h (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
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  * $FreeBSD$
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