2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
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.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
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
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.
62 * @brief This file contains all of the interface methods that can be called
63 * by an SCIC user on a phy (SAS or SATA) object.
70 #include <dev/isci/scil/sci_types.h>
71 #include <dev/isci/scil/sci_status.h>
73 #include <dev/isci/scil/intel_sata.h>
74 #include <dev/isci/scil/intel_sas.h>
78 * @struct SCIC_PHY_PROPERTIES
79 * @brief This structure defines the properties common to all phys
80 * that can be retrieved.
82 typedef struct SCIC_PHY_PROPERTIES
85 * This field specifies the port that currently contains the
86 * supplied phy. This field may be set to SCI_INVALID_HANDLE
87 * if the phy is not currently contained in a port.
89 SCI_PORT_HANDLE_T owning_port;
92 * This field specifies the maximum link rate for which this phy
95 SCI_SAS_LINK_RATE max_link_rate;
98 * This field specifies the link rate at which the phy is
99 * currently operating.
101 SCI_SAS_LINK_RATE negotiated_link_rate;
104 * This field indicates the identify address frame that will be
105 * transmitted to the connected phy.
107 SCI_SAS_IDENTIFY_ADDRESS_FRAME_T transmit_iaf;
110 * This field specifies the index of the phy in relation to other
111 * phys within the controller. This index is zero relative.
115 } SCIC_PHY_PROPERTIES_T;
118 * @struct SCIC_SAS_PHY_PROPERTIES
119 * @brief This structure defines the properties, specific to a
120 * SAS phy, that can be retrieved.
122 typedef struct SCIC_SAS_PHY_PROPERTIES
125 * This field delineates the Identify Address Frame received
126 * from the remote end point.
128 SCI_SAS_IDENTIFY_ADDRESS_FRAME_T received_iaf;
131 * This field delineates the Phy capabilities structure received
132 * from the remote end point.
134 SAS_CAPABILITIES_T received_capabilities;
136 } SCIC_SAS_PHY_PROPERTIES_T;
139 * @struct SCIC_SATA_PHY_PROPERTIES
140 * @brief This structure defines the properties, specific to a
141 * SATA phy, that can be retrieved.
143 typedef struct SCIC_SATA_PHY_PROPERTIES
146 * This field delineates the signature FIS received from the
149 SATA_FIS_REG_D2H_T signature_fis;
152 * This field specifies to the user if a port selector is connected
153 * on the specified phy.
155 BOOL is_port_selector_present;
157 } SCIC_SATA_PHY_PROPERTIES_T;
160 * @enum SCIC_PHY_COUNTER_ID
161 * @brief This enumeration depicts the various pieces of optional
162 * information that can be retrieved for a specific phy.
164 typedef enum SCIC_PHY_COUNTER_ID
167 * This PHY information field tracks the number of frames received.
169 SCIC_PHY_COUNTER_RECEIVED_FRAME,
172 * This PHY information field tracks the number of frames transmitted.
174 SCIC_PHY_COUNTER_TRANSMITTED_FRAME,
177 * This PHY information field tracks the number of DWORDs received.
179 SCIC_PHY_COUNTER_RECEIVED_FRAME_DWORD,
182 * This PHY information field tracks the number of DWORDs transmitted.
184 SCIC_PHY_COUNTER_TRANSMITTED_FRAME_DWORD,
187 * This PHY information field tracks the number of times DWORD
188 * synchronization was lost.
190 SCIC_PHY_COUNTER_LOSS_OF_SYNC_ERROR,
193 * This PHY information field tracks the number of received DWORDs with
194 * running disparity errors.
196 SCIC_PHY_COUNTER_RECEIVED_DISPARITY_ERROR,
199 * This PHY information field tracks the number of received frames with a
200 * CRC error (not including short or truncated frames).
202 SCIC_PHY_COUNTER_RECEIVED_FRAME_CRC_ERROR,
205 * This PHY information field tracks the number of DONE (ACK/NAK TIMEOUT)
206 * primitives received.
208 SCIC_PHY_COUNTER_RECEIVED_DONE_ACK_NAK_TIMEOUT,
211 * This PHY information field tracks the number of DONE (ACK/NAK TIMEOUT)
212 * primitives transmitted.
214 SCIC_PHY_COUNTER_TRANSMITTED_DONE_ACK_NAK_TIMEOUT,
217 * This PHY information field tracks the number of times the inactivity
218 * timer for connections on the phy has been utilized.
220 SCIC_PHY_COUNTER_INACTIVITY_TIMER_EXPIRED,
223 * This PHY information field tracks the number of DONE (CREDIT TIMEOUT)
224 * primitives received.
226 SCIC_PHY_COUNTER_RECEIVED_DONE_CREDIT_TIMEOUT,
229 * This PHY information field tracks the number of DONE (CREDIT TIMEOUT)
230 * primitives transmitted.
232 SCIC_PHY_COUNTER_TRANSMITTED_DONE_CREDIT_TIMEOUT,
235 * This PHY information field tracks the number of CREDIT BLOCKED
236 * primitives received.
237 * @note Depending on remote device implementation, credit blocks
238 * may occur regularly.
240 SCIC_PHY_COUNTER_RECEIVED_CREDIT_BLOCKED,
243 * This PHY information field contains the number of short frames
244 * received. A short frame is simply a frame smaller then what is
245 * allowed by either the SAS or SATA specification.
247 SCIC_PHY_COUNTER_RECEIVED_SHORT_FRAME,
250 * This PHY information field contains the number of frames received after
251 * credit has been exhausted.
253 SCIC_PHY_COUNTER_RECEIVED_FRAME_WITHOUT_CREDIT,
256 * This PHY information field contains the number of frames received after
257 * a DONE has been received.
259 SCIC_PHY_COUNTER_RECEIVED_FRAME_AFTER_DONE,
262 * This PHY information field contains the number of times the phy
263 * failed to achieve DWORD synchronization during speed negotiation.
265 SCIC_PHY_COUNTER_SN_DWORD_SYNC_ERROR
266 } SCIC_PHY_COUNTER_ID_T;
269 * @brief This method will enable the user to retrieve information
270 * common to all phys, such as: the negotiated link rate,
273 * @param[in] phy This parameter specifies the phy for which to retrieve
275 * @param[out] properties This parameter specifies the properties
276 * structure into which to copy the requested information.
278 * @return Indicate if the user specified a valid phy.
279 * @retval SCI_SUCCESS This value is returned if the specified phy was valid.
280 * @retval SCI_FAILURE_INVALID_PHY This value is returned if the specified phy
281 * is not valid. When this value is returned, no data is copied to the
282 * properties output parameter.
284 SCI_STATUS scic_phy_get_properties(
285 SCI_PHY_HANDLE_T phy,
286 SCIC_PHY_PROPERTIES_T * properties
290 * @brief This method will enable the user to retrieve information
291 * specific to a SAS phy, such as: the received identify
292 * address frame, received phy capabilities, etc.
294 * @param[in] phy this parameter specifies the phy for which to
295 * retrieve properties.
296 * @param[out] properties This parameter specifies the properties
297 * structure into which to copy the requested information.
299 * @return This method returns an indication as to whether the SAS
300 * phy properties were successfully retrieved.
301 * @retval SCI_SUCCESS This value is returned if the SAS properties
302 * are successfully retrieved.
303 * @retval SCI_FAILURE This value is returned if the SAS properties
304 * are not successfully retrieved (e.g. It's not a SAS Phy).
306 SCI_STATUS scic_sas_phy_get_properties(
307 SCI_PHY_HANDLE_T phy,
308 SCIC_SAS_PHY_PROPERTIES_T * properties
312 * @brief This method will enable the user to retrieve information
313 * specific to a SATA phy, such as: the received signature
314 * FIS, if a port selector is present, etc.
316 * @param[in] phy this parameter specifies the phy for which to
317 * retrieve properties.
318 * @param[out] properties This parameter specifies the properties
319 * structure into which to copy the requested information.
321 * @return This method returns an indication as to whether the SATA
322 * phy properties were successfully retrieved.
323 * @retval SCI_SUCCESS This value is returned if the SATA properties
324 * are successfully retrieved.
325 * @retval SCI_FAILURE This value is returned if the SATA properties
326 * are not successfully retrieved (e.g. It's not a SATA Phy).
328 SCI_STATUS scic_sata_phy_get_properties(
329 SCI_PHY_HANDLE_T phy,
330 SCIC_SATA_PHY_PROPERTIES_T * properties
334 * @brief This method allows the SCIC user to instruct the SCIC
335 * implementation to send the SATA port selection signal.
337 * @param[in] phy this parameter specifies the phy for which to send
338 * the port selection signal.
340 * @return An indication of whether the port selection signal was
341 * successfully executed.
342 * @retval SCI_SUCCESS This value is returned if the port selection signal
343 * was successfully transmitted.
345 SCI_STATUS scic_sata_phy_send_port_selection_signal(
350 * @brief This method requests the SCI implementation to begin tracking
351 * information specified by the supplied parameters.
353 * @param[in] phy this parameter specifies the phy for which to enable
354 * the information type.
355 * @param[in] counter_id this parameter specifies the information
356 * type to be enabled.
358 * @return Indicate if enablement of the information type was successful.
359 * @retval SCI_SUCCESS This value is returned if the information type was
360 * successfully enabled.
361 * @retval SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD This value is returned
362 * if the supplied information type is not supported.
364 SCI_STATUS scic_phy_enable_counter(
365 SCI_PHY_HANDLE_T phy,
366 SCIC_PHY_COUNTER_ID_T counter_id
370 * @brief This method requests the SCI implementation to stop tracking
371 * information specified by the supplied parameters.
373 * @param[in] phy this parameter specifies the phy for which to disable
374 * the information type.
375 * @param[in] counter_id this parameter specifies the information
376 * type to be disabled.
378 * @return Indicate if disablement of the information type was successful.
379 * @retval SCI_SUCCESS This value is returned if the information type was
380 * successfully disabled.
381 * @retval SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD This value is returned
382 * if the supplied information type is not supported.
384 SCI_STATUS scic_phy_disable_counter(
385 SCI_PHY_HANDLE_T phy,
386 SCIC_PHY_COUNTER_ID_T counter_id
390 * @brief This method requests the SCI implementation to retrieve
391 * tracking information specified by the supplied parameters.
393 * @param[in] phy this parameter specifies the phy for which to retrieve
394 * the information type.
395 * @param[in] counter_id this parameter specifies the information
396 * type to be retrieved.
397 * @param[out] data this parameter is a 32-bit pointer to a location
398 * where the data being retrieved is to be placed.
400 * @return Indicate if retrieval of the information type was successful.
401 * @retval SCI_SUCCESS This value is returned if the information type was
402 * successfully retrieved.
403 * @retval SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD This value is returned
404 * if the supplied information type is not supported.
406 SCI_STATUS scic_phy_get_counter(
407 SCI_PHY_HANDLE_T phy,
408 SCIC_PHY_COUNTER_ID_T counter_id,
413 * @brief This method requests the SCI implementation to clear (reset)
414 * tracking information specified by the supplied parameters.
416 * @param[in] phy this parameter specifies the phy for which to clear
417 * the information type.
418 * @param[in] counter_id this parameter specifies the information
419 * type to be cleared.
421 * @return Indicate if clearing of the information type was successful.
422 * @retval SCI_SUCCESS This value is returned if the information type was
423 * successfully cleared.
424 * @retval SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD This value is returned
425 * if the supplied information type is not supported.
427 SCI_STATUS scic_phy_clear_counter(
428 SCI_PHY_HANDLE_T phy,
429 SCIC_PHY_COUNTER_ID_T counter_id
433 * @brief This method will attempt to stop the phy object.
435 * @param[in] this_phy
438 * @retval SCI_SUCCESS if the phy is going to stop
439 * SCI_INVALID_STATE if the phy is not in a valid state
442 SCI_STATUS scic_phy_stop(
447 * @brief This method will attempt to start the phy object. This
448 * request is only valid when the phy is in the stopped
451 * @param[in] this_phy
455 SCI_STATUS scic_phy_start(
461 #endif // __cplusplus
463 #endif // _SCIC_PHY_H_