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.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
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
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #include "intel_ata.h"
57 #include "intel_sata.h"
58 #include "sci_base_state.h"
59 #include "sci_base_state_machine.h"
61 #include "scic_sds_controller.h"
62 #include "scic_sds_phy.h"
63 #include "scic_sds_phy_registers.h"
64 #include "scic_sds_port.h"
65 #include "scic_sds_remote_node_context.h"
66 #include "sci_environment.h"
68 #include "scu_event_codes.h"
70 #define SCIC_SDS_PHY_MIN_TIMER_COUNT (SCI_MAX_PHYS)
71 #define SCIC_SDS_PHY_MAX_TIMER_COUNT (SCI_MAX_PHYS)
73 /* Maximum arbitration wait time in micro-seconds */
74 #define SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME (700)
76 enum sas_linkrate
sci_phy_linkrate(struct scic_sds_phy
*sci_phy
)
78 return sci_phy
->max_negotiated_speed
;
82 * *****************************************************************************
83 * * SCIC SDS PHY Internal Methods
84 * ***************************************************************************** */
87 * This method will initialize the phy transport layer registers
89 * @transport_layer_registers
93 static enum sci_status
scic_sds_phy_transport_layer_initialization(
94 struct scic_sds_phy
*this_phy
,
95 struct scu_transport_layer_registers __iomem
*transport_layer_registers
)
99 this_phy
->transport_layer_registers
= transport_layer_registers
;
101 SCU_STPTLDARNI_WRITE(this_phy
, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
);
103 /* Hardware team recommends that we enable the STP prefetch for all transports */
104 tl_control
= SCU_TLCR_READ(this_phy
);
105 tl_control
|= SCU_TLCR_GEN_BIT(STP_WRITE_DATA_PREFETCH
);
106 SCU_TLCR_WRITE(this_phy
, tl_control
);
112 * This method will initialize the phy link layer registers
114 * @link_layer_registers:
118 static enum sci_status
119 scic_sds_phy_link_layer_initialization(struct scic_sds_phy
*sci_phy
,
120 struct scu_link_layer_registers __iomem
*link_layer_registers
)
122 struct scic_sds_controller
*scic
= sci_phy
->owning_port
->owning_controller
;
123 int phy_idx
= sci_phy
->phy_index
;
124 struct sci_phy_user_params
*phy_user
= &scic
->user_parameters
.sds1
.phys
[phy_idx
];
125 struct sci_phy_oem_params
*phy_oem
= &scic
->oem_parameters
.sds1
.phys
[phy_idx
];
126 u32 phy_configuration
;
127 struct sas_capabilities phy_capabilities
;
128 u32 parity_check
= 0;
129 u32 parity_count
= 0;
130 u32 llctl
, link_rate
;
133 sci_phy
->link_layer_registers
= link_layer_registers
;
135 /* Set our IDENTIFY frame data */
136 #define SCI_END_DEVICE 0x01
138 SCU_SAS_TIID_WRITE(sci_phy
, (SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR
) |
139 SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR
) |
140 SCU_SAS_TIID_GEN_BIT(STP_INITIATOR
) |
141 SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST
) |
142 SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE
, SCI_END_DEVICE
)));
144 /* Write the device SAS Address */
145 SCU_SAS_TIDNH_WRITE(sci_phy
, 0xFEDCBA98);
146 SCU_SAS_TIDNL_WRITE(sci_phy
, phy_idx
);
148 /* Write the source SAS Address */
149 SCU_SAS_TISSAH_WRITE(sci_phy
, phy_oem
->sas_address
.high
);
150 SCU_SAS_TISSAL_WRITE(sci_phy
, phy_oem
->sas_address
.low
);
152 /* Clear and Set the PHY Identifier */
153 SCU_SAS_TIPID_WRITE(sci_phy
, 0x00000000);
154 SCU_SAS_TIPID_WRITE(sci_phy
, SCU_SAS_TIPID_GEN_VALUE(ID
, phy_idx
));
156 /* Change the initial state of the phy configuration register */
157 phy_configuration
= SCU_SAS_PCFG_READ(sci_phy
);
159 /* Hold OOB state machine in reset */
160 phy_configuration
|= SCU_SAS_PCFG_GEN_BIT(OOB_RESET
);
161 SCU_SAS_PCFG_WRITE(sci_phy
, phy_configuration
);
163 /* Configure the SNW capabilities */
164 phy_capabilities
.u
.all
= 0;
165 phy_capabilities
.u
.bits
.start
= 1;
166 phy_capabilities
.u
.bits
.gen3_without_ssc_supported
= 1;
167 phy_capabilities
.u
.bits
.gen2_without_ssc_supported
= 1;
168 phy_capabilities
.u
.bits
.gen1_without_ssc_supported
= 1;
169 if (scic
->oem_parameters
.sds1
.controller
.do_enable_ssc
== true) {
170 phy_capabilities
.u
.bits
.gen3_with_ssc_supported
= 1;
171 phy_capabilities
.u
.bits
.gen2_with_ssc_supported
= 1;
172 phy_capabilities
.u
.bits
.gen1_with_ssc_supported
= 1;
176 * The SAS specification indicates that the phy_capabilities that
177 * are transmitted shall have an even parity. Calculate the parity. */
178 parity_check
= phy_capabilities
.u
.all
;
179 while (parity_check
!= 0) {
180 if (parity_check
& 0x1)
186 * If parity indicates there are an odd number of bits set, then
187 * set the parity bit to 1 in the phy capabilities. */
188 if ((parity_count
% 2) != 0)
189 phy_capabilities
.u
.bits
.parity
= 1;
191 SCU_SAS_PHYCAP_WRITE(sci_phy
, phy_capabilities
.u
.all
);
193 /* Set the enable spinup period but disable the ability to send
194 * notify enable spinup
196 SCU_SAS_ENSPINUP_WRITE(sci_phy
, SCU_ENSPINUP_GEN_VAL(COUNT
,
197 phy_user
->notify_enable_spin_up_insertion_frequency
));
199 /* Write the ALIGN Insertion Ferequency for connected phy and
200 * inpendent of connected state
202 clksm_value
= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(CONNECTED
,
203 phy_user
->in_connection_align_insertion_frequency
);
205 clksm_value
|= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL
,
206 phy_user
->align_insertion_frequency
);
208 SCU_SAS_CLKSM_WRITE(sci_phy
, clksm_value
);
210 /* @todo Provide a way to write this register correctly */
211 scu_link_layer_register_write(sci_phy
, afe_lookup_table_control
, 0x02108421);
213 llctl
= SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT
,
214 (u8
)scic
->user_parameters
.sds1
.no_outbound_task_timeout
);
216 switch(phy_user
->max_speed_generation
) {
217 case SCIC_SDS_PARM_GEN3_SPEED
:
218 link_rate
= SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN3
;
220 case SCIC_SDS_PARM_GEN2_SPEED
:
221 link_rate
= SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN2
;
224 link_rate
= SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1
;
227 llctl
|= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE
, link_rate
);
229 scu_link_layer_register_write(sci_phy
, link_layer_control
, llctl
);
231 if (is_a0() || is_a2()) {
232 /* Program the max ARB time for the PHY to 700us so we inter-operate with
233 * the PMC expander which shuts down PHYs if the expander PHY generates too
234 * many breaks. This time value will guarantee that the initiator PHY will
235 * generate the break.
237 scu_link_layer_register_write(sci_phy
,
238 maximum_arbitration_wait_timer_timeout
,
239 SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME
);
243 * Set the link layer hang detection to 500ms (0x1F4) from its default
244 * value of 128ms. Max value is 511 ms. */
245 scu_link_layer_register_write(sci_phy
, link_layer_hang_detection_timeout
,
248 /* We can exit the initial state to the stopped state */
249 sci_base_state_machine_change_state(scic_sds_phy_get_base_state_machine(sci_phy
),
250 SCI_BASE_PHY_STATE_STOPPED
);
256 * This function will handle the sata SIGNATURE FIS timeout condition. It will
257 * restart the starting substate machine since we dont know what has actually
260 void scic_sds_phy_sata_timeout(void *phy
)
262 struct scic_sds_phy
*sci_phy
= phy
;
264 dev_dbg(sciphy_to_dev(sci_phy
),
265 "%s: SCIC SDS Phy 0x%p did not receive signature fis before "
270 sci_base_state_machine_stop(
271 scic_sds_phy_get_starting_substate_machine(sci_phy
));
273 sci_base_state_machine_change_state(
274 scic_sds_phy_get_base_state_machine(sci_phy
),
275 SCI_BASE_PHY_STATE_STARTING
280 * This method will construct the struct scic_sds_phy object
286 void scic_sds_phy_construct(
287 struct scic_sds_phy
*this_phy
,
288 struct scic_sds_port
*owning_port
,
292 * Call the base constructor first
294 sci_base_phy_construct(
296 scic_sds_phy_state_table
299 /* Copy the rest of the input data to our locals */
300 this_phy
->owning_port
= owning_port
;
301 this_phy
->phy_index
= phy_index
;
302 this_phy
->bcn_received_while_port_unassigned
= false;
303 this_phy
->protocol
= SCIC_SDS_PHY_PROTOCOL_UNKNOWN
;
304 this_phy
->link_layer_registers
= NULL
;
305 this_phy
->max_negotiated_speed
= SCI_SAS_NO_LINK_RATE
;
306 this_phy
->sata_timeout_timer
= NULL
;
308 /* Clear out the identification buffer data */
309 memset(&this_phy
->phy_type
, 0, sizeof(this_phy
->phy_type
));
311 /* Initialize the the substate machines */
312 sci_base_state_machine_construct(
313 &this_phy
->starting_substate_machine
,
314 &this_phy
->parent
.parent
,
315 scic_sds_phy_starting_substates
,
316 SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
321 * This method returns the port currently containing this phy. If the phy is
322 * currently contained by the dummy port, then the phy is considered to not
324 * @this_phy: This parameter specifies the phy for which to retrieve the
327 * This method returns a handle to a port that contains the supplied phy.
328 * NULL This value is returned if the phy is not part of a real
329 * port (i.e. it's contained in the dummy port). !NULL All other
330 * values indicate a handle/pointer to the port containing the phy.
332 struct scic_sds_port
*scic_sds_phy_get_port(
333 struct scic_sds_phy
*this_phy
)
335 if (scic_sds_port_get_index(this_phy
->owning_port
) == SCIC_SDS_DUMMY_PORT
)
338 return this_phy
->owning_port
;
342 * This method will assign a port to the phy object.
343 * @out]: this_phy This parameter specifies the phy for which to assign a port
348 void scic_sds_phy_set_port(
349 struct scic_sds_phy
*this_phy
,
350 struct scic_sds_port
*the_port
)
352 this_phy
->owning_port
= the_port
;
354 if (this_phy
->bcn_received_while_port_unassigned
) {
355 this_phy
->bcn_received_while_port_unassigned
= false;
356 scic_sds_port_broadcast_change_received(this_phy
->owning_port
, this_phy
);
361 * This method will initialize the constructed phy
363 * @link_layer_registers:
367 enum sci_status
scic_sds_phy_initialize(
368 struct scic_sds_phy
*sci_phy
,
369 struct scu_transport_layer_registers __iomem
*transport_layer_registers
,
370 struct scu_link_layer_registers __iomem
*link_layer_registers
)
372 /* Create the SIGNATURE FIS Timeout timer for this phy */
373 sci_phy
->sata_timeout_timer
= isci_event_timer_create(
374 scic_sds_phy_get_controller(sci_phy
),
375 scic_sds_phy_sata_timeout
,
379 /* Perfrom the initialization of the TL hardware */
380 scic_sds_phy_transport_layer_initialization(sci_phy
, transport_layer_registers
);
382 /* Perofrm the initialization of the PE hardware */
383 scic_sds_phy_link_layer_initialization(sci_phy
, link_layer_registers
);
386 * There is nothing that needs to be done in this state just
387 * transition to the stopped state. */
388 sci_base_state_machine_change_state(
389 scic_sds_phy_get_base_state_machine(sci_phy
),
390 SCI_BASE_PHY_STATE_STOPPED
397 * This method assigns the direct attached device ID for this phy.
399 * @this_phy The phy for which the direct attached device id is to
401 * @device_id The direct attached device ID to assign to the phy.
402 * This will either be the RNi for the device or an invalid RNi if there
403 * is no current device assigned to the phy.
405 void scic_sds_phy_setup_transport(
406 struct scic_sds_phy
*this_phy
,
411 SCU_STPTLDARNI_WRITE(this_phy
, device_id
);
414 * The read should guarantee that the first write gets posted
415 * before the next write
417 tl_control
= SCU_TLCR_READ(this_phy
);
418 tl_control
|= SCU_TLCR_GEN_BIT(CLEAR_TCI_NCQ_MAPPING_TABLE
);
419 SCU_TLCR_WRITE(this_phy
, tl_control
);
424 * @this_phy: The phy object to be suspended.
426 * This function will perform the register reads/writes to suspend the SCU
427 * hardware protocol engine. none
429 void scic_sds_phy_suspend(
430 struct scic_sds_phy
*this_phy
)
432 u32 scu_sas_pcfg_value
;
434 scu_sas_pcfg_value
= SCU_SAS_PCFG_READ(this_phy
);
435 scu_sas_pcfg_value
|= SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE
);
436 SCU_SAS_PCFG_WRITE(this_phy
, scu_sas_pcfg_value
);
437 scic_sds_phy_setup_transport(this_phy
, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
);
442 * @this_phy: The phy object to resume.
444 * This function will perform the register reads/writes required to resume the
445 * SCU hardware protocol engine. none
447 void scic_sds_phy_resume(
448 struct scic_sds_phy
*this_phy
)
450 u32 scu_sas_pcfg_value
;
452 scu_sas_pcfg_value
= SCU_SAS_PCFG_READ(this_phy
);
454 scu_sas_pcfg_value
&= ~SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE
);
456 SCU_SAS_PCFG_WRITE(this_phy
, scu_sas_pcfg_value
);
460 * This method returns the local sas address assigned to this phy.
461 * @this_phy: This parameter specifies the phy for which to retrieve the local
463 * @sas_address: This parameter specifies the location into which to copy the
467 void scic_sds_phy_get_sas_address(
468 struct scic_sds_phy
*this_phy
,
469 struct sci_sas_address
*sas_address
)
471 sas_address
->high
= SCU_SAS_TISSAH_READ(this_phy
);
472 sas_address
->low
= SCU_SAS_TISSAL_READ(this_phy
);
476 * This method returns the remote end-point (i.e. attached) sas address
477 * assigned to this phy.
478 * @this_phy: This parameter specifies the phy for which to retrieve the remote
479 * end-point SAS address.
480 * @sas_address: This parameter specifies the location into which to copy the
481 * remote end-point SAS address.
484 void scic_sds_phy_get_attached_sas_address(
485 struct scic_sds_phy
*this_phy
,
486 struct sci_sas_address
*sas_address
)
489 = this_phy
->phy_type
.sas
.identify_address_frame_buffer
.sas_address
.high
;
491 = this_phy
->phy_type
.sas
.identify_address_frame_buffer
.sas_address
.low
;
495 * This method returns the supported protocols assigned to this phy
500 void scic_sds_phy_get_protocols(
501 struct scic_sds_phy
*this_phy
,
502 struct sci_sas_identify_address_frame_protocols
*protocols
)
504 protocols
->u
.all
= (u16
)(SCU_SAS_TIID_READ(this_phy
) & 0x0000FFFF);
509 * @this_phy: The parameter is the phy object for which the attached phy
510 * protcols are to be returned.
512 * This method returns the supported protocols for the attached phy. If this
513 * is a SAS phy the protocols are returned from the identify address frame. If
514 * this is a SATA phy then protocols are made up and the target phy is an STP
515 * target phy. The caller will get the entire set of bits for the protocol
518 void scic_sds_phy_get_attached_phy_protocols(
519 struct scic_sds_phy
*this_phy
,
520 struct sci_sas_identify_address_frame_protocols
*protocols
)
522 protocols
->u
.all
= 0;
524 if (this_phy
->protocol
== SCIC_SDS_PHY_PROTOCOL_SAS
) {
526 this_phy
->phy_type
.sas
.identify_address_frame_buffer
.protocols
.u
.all
;
527 } else if (this_phy
->protocol
== SCIC_SDS_PHY_PROTOCOL_SATA
) {
528 protocols
->u
.bits
.stp_target
= 1;
533 * *****************************************************************************
534 * * SCIC SDS PHY Handler Redirects
535 * ***************************************************************************** */
538 * This method will attempt to start the phy object. This request is only valid
539 * when the phy is in the stopped state
544 enum sci_status
scic_sds_phy_start(
545 struct scic_sds_phy
*this_phy
)
547 return this_phy
->state_handlers
->parent
.start_handler(&this_phy
->parent
);
551 * This method will attempt to stop the phy object.
554 * enum sci_status SCI_SUCCESS if the phy is going to stop SCI_INVALID_STATE if the
555 * phy is not in a valid state to stop
557 enum sci_status
scic_sds_phy_stop(
558 struct scic_sds_phy
*this_phy
)
560 return this_phy
->state_handlers
->parent
.stop_handler(&this_phy
->parent
);
564 * This method will attempt to reset the phy. This request is only valid when
565 * the phy is in an ready state
570 enum sci_status
scic_sds_phy_reset(
571 struct scic_sds_phy
*this_phy
)
573 return this_phy
->state_handlers
->parent
.reset_handler(
579 * This method will process the event code received.
585 enum sci_status
scic_sds_phy_event_handler(
586 struct scic_sds_phy
*this_phy
,
589 return this_phy
->state_handlers
->event_handler(this_phy
, event_code
);
593 * This method will process the frame index received.
599 enum sci_status
scic_sds_phy_frame_handler(
600 struct scic_sds_phy
*this_phy
,
603 return this_phy
->state_handlers
->frame_handler(this_phy
, frame_index
);
607 * This method will give the phy permission to consume power
612 enum sci_status
scic_sds_phy_consume_power_handler(
613 struct scic_sds_phy
*this_phy
)
615 return this_phy
->state_handlers
->consume_power_handler(this_phy
);
619 * *****************************************************************************
620 * * SCIC PHY Public Methods
621 * ***************************************************************************** */
624 enum sci_status
scic_sas_phy_get_properties(
625 struct scic_sds_phy
*sci_phy
,
626 struct scic_sas_phy_properties
*properties
)
628 if (sci_phy
->protocol
== SCIC_SDS_PHY_PROTOCOL_SAS
) {
630 &properties
->received_iaf
,
631 &sci_phy
->phy_type
.sas
.identify_address_frame_buffer
,
632 sizeof(struct sci_sas_identify_address_frame
)
635 properties
->received_capabilities
.u
.all
636 = SCU_SAS_RECPHYCAP_READ(sci_phy
);
645 enum sci_status
scic_sata_phy_get_properties(
646 struct scic_sds_phy
*sci_phy
,
647 struct scic_sata_phy_properties
*properties
)
649 if (sci_phy
->protocol
== SCIC_SDS_PHY_PROTOCOL_SATA
) {
651 &properties
->signature_fis
,
652 &sci_phy
->phy_type
.sata
.signature_fis_buffer
,
653 sizeof(struct sata_fis_reg_d2h
)
656 /* / @todo add support for port selectors. */
657 properties
->is_port_selector_present
= false;
666 * *****************************************************************************
667 * * SCIC SDS PHY HELPER FUNCTIONS
668 * ***************************************************************************** */
673 * @this_phy: The phy object that received SAS PHY DETECTED.
675 * This method continues the link training for the phy as if it were a SAS PHY
676 * instead of a SATA PHY. This is done because the completion queue had a SAS
677 * PHY DETECTED event when the state machine was expecting a SATA PHY event.
680 static void scic_sds_phy_start_sas_link_training(
681 struct scic_sds_phy
*this_phy
)
685 phy_control
= SCU_SAS_PCFG_READ(this_phy
);
686 phy_control
|= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD
);
687 SCU_SAS_PCFG_WRITE(this_phy
, phy_control
);
689 sci_base_state_machine_change_state(
690 &this_phy
->starting_substate_machine
,
691 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
694 this_phy
->protocol
= SCIC_SDS_PHY_PROTOCOL_SAS
;
699 * @this_phy: The phy object that received a SATA SPINUP HOLD event
701 * This method continues the link training for the phy as if it were a SATA PHY
702 * instead of a SAS PHY. This is done because the completion queue had a SATA
703 * SPINUP HOLD event when the state machine was expecting a SAS PHY event. none
705 static void scic_sds_phy_start_sata_link_training(
706 struct scic_sds_phy
*this_phy
)
708 sci_base_state_machine_change_state(
709 &this_phy
->starting_substate_machine
,
710 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
713 this_phy
->protocol
= SCIC_SDS_PHY_PROTOCOL_SATA
;
717 * This method performs processing common to all protocols upon completion of
719 * @this_phy: This parameter specifies the phy object for which link training
721 * @max_link_rate: This parameter specifies the maximum link rate to be
722 * associated with this phy.
723 * @next_state: This parameter specifies the next state for the phy's starting
727 static void scic_sds_phy_complete_link_training(
728 struct scic_sds_phy
*this_phy
,
729 enum sci_sas_link_rate max_link_rate
,
732 this_phy
->max_negotiated_speed
= max_link_rate
;
734 sci_base_state_machine_change_state(
735 scic_sds_phy_get_starting_substate_machine(this_phy
), next_state
741 * @this_phy: The struct scic_sds_phy object to restart.
743 * This method restarts the struct scic_sds_phy objects base state machine in the
744 * starting state from any starting substate. none
746 static void scic_sds_phy_restart_starting_state(
747 struct scic_sds_phy
*this_phy
)
749 /* Stop the current substate machine */
750 sci_base_state_machine_stop(
751 scic_sds_phy_get_starting_substate_machine(this_phy
)
754 /* Re-enter the base state machine starting state */
755 sci_base_state_machine_change_state(
756 scic_sds_phy_get_base_state_machine(this_phy
),
757 SCI_BASE_PHY_STATE_STARTING
761 /* ****************************************************************************
762 * SCIC SDS PHY general handlers
763 ************************************************************************** */
764 static enum sci_status
scic_sds_phy_starting_substate_general_stop_handler(
765 struct sci_base_phy
*phy
)
767 struct scic_sds_phy
*this_phy
;
768 this_phy
= (struct scic_sds_phy
*)phy
;
770 sci_base_state_machine_stop(&this_phy
->starting_substate_machine
);
772 sci_base_state_machine_change_state(&phy
->state_machine
,
773 SCI_BASE_PHY_STATE_STOPPED
);
779 * *****************************************************************************
780 * * SCIC SDS PHY EVENT_HANDLERS
781 * ***************************************************************************** */
785 * @phy: This struct scic_sds_phy object which has received an event.
786 * @event_code: This is the event code which the phy object is to decode.
788 * This method is called when an event notification is received for the phy
789 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN. -
790 * decode the event - sas phy detected causes a state transition to the wait
791 * for speed event notification. - any other events log a warning message and
792 * set a failure status enum sci_status SCI_SUCCESS on any valid event notification
793 * SCI_FAILURE on any unexpected event notifation
795 static enum sci_status
scic_sds_phy_starting_substate_await_ossp_event_handler(
796 struct scic_sds_phy
*this_phy
,
799 u32 result
= SCI_SUCCESS
;
801 switch (scu_get_event_code(event_code
)) {
802 case SCU_EVENT_SAS_PHY_DETECTED
:
803 scic_sds_phy_start_sas_link_training(this_phy
);
804 this_phy
->is_in_link_training
= true;
807 case SCU_EVENT_SATA_SPINUP_HOLD
:
808 scic_sds_phy_start_sata_link_training(this_phy
);
809 this_phy
->is_in_link_training
= true;
813 dev_warn(sciphy_to_dev(this_phy
),
814 "%s: PHY starting substate machine received "
815 "unexpected event_code %x\n",
819 result
= SCI_FAILURE
;
828 * @phy: This struct scic_sds_phy object which has received an event.
829 * @event_code: This is the event code which the phy object is to decode.
831 * This method is called when an event notification is received for the phy
832 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN. -
833 * decode the event - sas phy detected returns us back to this state. - speed
834 * event detected causes a state transition to the wait for iaf. - identify
835 * timeout is an un-expected event and the state machine is restarted. - link
836 * failure events restart the starting state machine - any other events log a
837 * warning message and set a failure status enum sci_status SCI_SUCCESS on any valid
838 * event notification SCI_FAILURE on any unexpected event notifation
840 static enum sci_status
scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler(
841 struct scic_sds_phy
*this_phy
,
844 u32 result
= SCI_SUCCESS
;
846 switch (scu_get_event_code(event_code
)) {
847 case SCU_EVENT_SAS_PHY_DETECTED
:
849 * Why is this being reported again by the controller?
850 * We would re-enter this state so just stay here */
853 case SCU_EVENT_SAS_15
:
854 case SCU_EVENT_SAS_15_SSC
:
855 scic_sds_phy_complete_link_training(
856 this_phy
, SCI_SAS_150_GB
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
860 case SCU_EVENT_SAS_30
:
861 case SCU_EVENT_SAS_30_SSC
:
862 scic_sds_phy_complete_link_training(
863 this_phy
, SCI_SAS_300_GB
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
867 case SCU_EVENT_SAS_60
:
868 case SCU_EVENT_SAS_60_SSC
:
869 scic_sds_phy_complete_link_training(
870 this_phy
, SCI_SAS_600_GB
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
874 case SCU_EVENT_SATA_SPINUP_HOLD
:
876 * We were doing SAS PHY link training and received a SATA PHY event
877 * continue OOB/SN as if this were a SATA PHY */
878 scic_sds_phy_start_sata_link_training(this_phy
);
881 case SCU_EVENT_LINK_FAILURE
:
882 /* Link failure change state back to the starting state */
883 scic_sds_phy_restart_starting_state(this_phy
);
887 dev_warn(sciphy_to_dev(this_phy
),
888 "%s: PHY starting substate machine received "
889 "unexpected event_code %x\n",
893 result
= SCI_FAILURE
;
902 * @phy: This struct scic_sds_phy object which has received an event.
903 * @event_code: This is the event code which the phy object is to decode.
905 * This method is called when an event notification is received for the phy
906 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF. -
907 * decode the event - sas phy detected event backs up the state machine to the
908 * await speed notification. - identify timeout is an un-expected event and the
909 * state machine is restarted. - link failure events restart the starting state
910 * machine - any other events log a warning message and set a failure status
911 * enum sci_status SCI_SUCCESS on any valid event notification SCI_FAILURE on any
912 * unexpected event notifation
914 static enum sci_status
scic_sds_phy_starting_substate_await_iaf_uf_event_handler(
915 struct scic_sds_phy
*this_phy
,
918 u32 result
= SCI_SUCCESS
;
920 switch (scu_get_event_code(event_code
)) {
921 case SCU_EVENT_SAS_PHY_DETECTED
:
922 /* Backup the state machine */
923 scic_sds_phy_start_sas_link_training(this_phy
);
926 case SCU_EVENT_SATA_SPINUP_HOLD
:
928 * We were doing SAS PHY link training and received a SATA PHY event
929 * continue OOB/SN as if this were a SATA PHY */
930 scic_sds_phy_start_sata_link_training(this_phy
);
933 case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT
:
934 case SCU_EVENT_LINK_FAILURE
:
935 case SCU_EVENT_HARD_RESET_RECEIVED
:
936 /* Start the oob/sn state machine over again */
937 scic_sds_phy_restart_starting_state(this_phy
);
941 dev_warn(sciphy_to_dev(this_phy
),
942 "%s: PHY starting substate machine received "
943 "unexpected event_code %x\n",
947 result
= SCI_FAILURE
;
956 * @phy: This struct scic_sds_phy object which has received an event.
957 * @event_code: This is the event code which the phy object is to decode.
959 * This method is called when an event notification is received for the phy
960 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_POWER. -
961 * decode the event - link failure events restart the starting state machine -
962 * any other events log a warning message and set a failure status enum sci_status
963 * SCI_SUCCESS on a link failure event SCI_FAILURE on any unexpected event
966 static enum sci_status
scic_sds_phy_starting_substate_await_sas_power_event_handler(
967 struct scic_sds_phy
*this_phy
,
970 u32 result
= SCI_SUCCESS
;
972 switch (scu_get_event_code(event_code
)) {
973 case SCU_EVENT_LINK_FAILURE
:
974 /* Link failure change state back to the starting state */
975 scic_sds_phy_restart_starting_state(this_phy
);
979 dev_warn(sciphy_to_dev(this_phy
),
980 "%s: PHY starting substate machine received unexpected "
985 result
= SCI_FAILURE
;
994 * @phy: This struct scic_sds_phy object which has received an event.
995 * @event_code: This is the event code which the phy object is to decode.
997 * This method is called when an event notification is received for the phy
998 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER. -
999 * decode the event - link failure events restart the starting state machine -
1000 * sata spinup hold events are ignored since they are expected - any other
1001 * events log a warning message and set a failure status enum sci_status SCI_SUCCESS
1002 * on a link failure event SCI_FAILURE on any unexpected event notifation
1004 static enum sci_status
scic_sds_phy_starting_substate_await_sata_power_event_handler(
1005 struct scic_sds_phy
*this_phy
,
1008 u32 result
= SCI_SUCCESS
;
1010 switch (scu_get_event_code(event_code
)) {
1011 case SCU_EVENT_LINK_FAILURE
:
1012 /* Link failure change state back to the starting state */
1013 scic_sds_phy_restart_starting_state(this_phy
);
1016 case SCU_EVENT_SATA_SPINUP_HOLD
:
1017 /* These events are received every 10ms and are expected while in this state */
1020 case SCU_EVENT_SAS_PHY_DETECTED
:
1022 * There has been a change in the phy type before OOB/SN for the
1023 * SATA finished start down the SAS link traning path. */
1024 scic_sds_phy_start_sas_link_training(this_phy
);
1028 dev_warn(sciphy_to_dev(this_phy
),
1029 "%s: PHY starting substate machine received "
1030 "unexpected event_code %x\n",
1034 result
= SCI_FAILURE
;
1043 * @phy: This struct scic_sds_phy object which has received an event.
1044 * @event_code: This is the event code which the phy object is to decode.
1046 * This method is called when an event notification is received for the phy
1047 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN. -
1048 * decode the event - link failure events restart the starting state machine -
1049 * sata spinup hold events are ignored since they are expected - sata phy
1050 * detected event change to the wait speed event - any other events log a
1051 * warning message and set a failure status enum sci_status SCI_SUCCESS on a link
1052 * failure event SCI_FAILURE on any unexpected event notifation
1054 static enum sci_status
scic_sds_phy_starting_substate_await_sata_phy_event_handler(
1055 struct scic_sds_phy
*this_phy
,
1058 u32 result
= SCI_SUCCESS
;
1060 switch (scu_get_event_code(event_code
)) {
1061 case SCU_EVENT_LINK_FAILURE
:
1062 /* Link failure change state back to the starting state */
1063 scic_sds_phy_restart_starting_state(this_phy
);
1066 case SCU_EVENT_SATA_SPINUP_HOLD
:
1068 * These events might be received since we dont know how many may be in
1069 * the completion queue while waiting for power */
1072 case SCU_EVENT_SATA_PHY_DETECTED
:
1073 this_phy
->protocol
= SCIC_SDS_PHY_PROTOCOL_SATA
;
1075 /* We have received the SATA PHY notification change state */
1076 sci_base_state_machine_change_state(
1077 scic_sds_phy_get_starting_substate_machine(this_phy
),
1078 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN
1082 case SCU_EVENT_SAS_PHY_DETECTED
:
1084 * There has been a change in the phy type before OOB/SN for the
1085 * SATA finished start down the SAS link traning path. */
1086 scic_sds_phy_start_sas_link_training(this_phy
);
1090 dev_warn(sciphy_to_dev(this_phy
),
1091 "%s: PHY starting substate machine received "
1092 "unexpected event_code %x\n",
1096 result
= SCI_FAILURE
;
1105 * @phy: This struct scic_sds_phy object which has received an event.
1106 * @event_code: This is the event code which the phy object is to decode.
1108 * This method is called when an event notification is received for the phy
1109 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN.
1110 * - decode the event - sata phy detected returns us back to this state. -
1111 * speed event detected causes a state transition to the wait for signature. -
1112 * link failure events restart the starting state machine - any other events
1113 * log a warning message and set a failure status enum sci_status SCI_SUCCESS on any
1114 * valid event notification SCI_FAILURE on any unexpected event notifation
1116 static enum sci_status
scic_sds_phy_starting_substate_await_sata_speed_event_handler(
1117 struct scic_sds_phy
*this_phy
,
1120 u32 result
= SCI_SUCCESS
;
1122 switch (scu_get_event_code(event_code
)) {
1123 case SCU_EVENT_SATA_PHY_DETECTED
:
1125 * The hardware reports multiple SATA PHY detected events
1126 * ignore the extras */
1129 case SCU_EVENT_SATA_15
:
1130 case SCU_EVENT_SATA_15_SSC
:
1131 scic_sds_phy_complete_link_training(
1134 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF
1138 case SCU_EVENT_SATA_30
:
1139 case SCU_EVENT_SATA_30_SSC
:
1140 scic_sds_phy_complete_link_training(
1143 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF
1147 case SCU_EVENT_SATA_60
:
1148 case SCU_EVENT_SATA_60_SSC
:
1149 scic_sds_phy_complete_link_training(
1152 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF
1156 case SCU_EVENT_LINK_FAILURE
:
1157 /* Link failure change state back to the starting state */
1158 scic_sds_phy_restart_starting_state(this_phy
);
1161 case SCU_EVENT_SAS_PHY_DETECTED
:
1163 * There has been a change in the phy type before OOB/SN for the
1164 * SATA finished start down the SAS link traning path. */
1165 scic_sds_phy_start_sas_link_training(this_phy
);
1169 dev_warn(sciphy_to_dev(this_phy
),
1170 "%s: PHY starting substate machine received "
1171 "unexpected event_code %x\n",
1175 result
= SCI_FAILURE
;
1184 * @phy: This struct scic_sds_phy object which has received an event.
1185 * @event_code: This is the event code which the phy object is to decode.
1187 * This method is called when an event notification is received for the phy
1188 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. -
1189 * decode the event - sas phy detected event backs up the state machine to the
1190 * await speed notification. - identify timeout is an un-expected event and the
1191 * state machine is restarted. - link failure events restart the starting state
1192 * machine - any other events log a warning message and set a failure status
1193 * enum sci_status SCI_SUCCESS on any valid event notification SCI_FAILURE on any
1194 * unexpected event notifation
1196 static enum sci_status
scic_sds_phy_starting_substate_await_sig_fis_event_handler(
1197 struct scic_sds_phy
*this_phy
,
1200 u32 result
= SCI_SUCCESS
;
1202 switch (scu_get_event_code(event_code
)) {
1203 case SCU_EVENT_SATA_PHY_DETECTED
:
1204 /* Backup the state machine */
1205 sci_base_state_machine_change_state(
1206 scic_sds_phy_get_starting_substate_machine(this_phy
),
1207 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN
1211 case SCU_EVENT_LINK_FAILURE
:
1212 /* Link failure change state back to the starting state */
1213 scic_sds_phy_restart_starting_state(this_phy
);
1217 dev_warn(sciphy_to_dev(this_phy
),
1218 "%s: PHY starting substate machine received "
1219 "unexpected event_code %x\n",
1223 result
= SCI_FAILURE
;
1232 * *****************************************************************************
1233 * * SCIC SDS PHY FRAME_HANDLERS
1234 * ***************************************************************************** */
1238 * @phy: This is struct scic_sds_phy object which is being requested to decode the
1240 * @frame_index: This is the index of the unsolicited frame which was received
1243 * This method decodes the unsolicited frame when the struct scic_sds_phy is in the
1244 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF. - Get the UF Header - If the UF
1245 * is an IAF - Copy IAF data to local phy object IAF data buffer. - Change
1246 * starting substate to wait power. - else - log warning message of unexpected
1247 * unsolicted frame - release frame buffer enum sci_status SCI_SUCCESS
1249 static enum sci_status
scic_sds_phy_starting_substate_await_iaf_uf_frame_handler(
1250 struct scic_sds_phy
*this_phy
,
1253 enum sci_status result
;
1255 struct sci_sas_identify_address_frame
*identify_frame
;
1257 result
= scic_sds_unsolicited_frame_control_get_header(
1258 &(scic_sds_phy_get_controller(this_phy
)->uf_control
),
1260 (void **)&frame_words
);
1262 if (result
!= SCI_SUCCESS
) {
1266 frame_words
[0] = SCIC_SWAP_DWORD(frame_words
[0]);
1267 identify_frame
= (struct sci_sas_identify_address_frame
*)frame_words
;
1269 if (identify_frame
->address_frame_type
== 0) {
1271 * Byte swap the rest of the frame so we can make
1272 * a copy of the buffer */
1273 frame_words
[1] = SCIC_SWAP_DWORD(frame_words
[1]);
1274 frame_words
[2] = SCIC_SWAP_DWORD(frame_words
[2]);
1275 frame_words
[3] = SCIC_SWAP_DWORD(frame_words
[3]);
1276 frame_words
[4] = SCIC_SWAP_DWORD(frame_words
[4]);
1277 frame_words
[5] = SCIC_SWAP_DWORD(frame_words
[5]);
1280 &this_phy
->phy_type
.sas
.identify_address_frame_buffer
,
1282 sizeof(struct sci_sas_identify_address_frame
)
1285 if (identify_frame
->protocols
.u
.bits
.smp_target
) {
1287 * We got the IAF for an expander PHY go to the final state since
1288 * there are no power requirements for expander phys. */
1289 sci_base_state_machine_change_state(
1290 scic_sds_phy_get_starting_substate_machine(this_phy
),
1291 SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
1294 /* We got the IAF we can now go to the await spinup semaphore state */
1295 sci_base_state_machine_change_state(
1296 scic_sds_phy_get_starting_substate_machine(this_phy
),
1297 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
1301 result
= SCI_SUCCESS
;
1303 dev_warn(sciphy_to_dev(this_phy
),
1304 "%s: PHY starting substate machine received "
1305 "unexpected frame id %x\n",
1309 /* Regardless of the result release this frame since we are done with it */
1310 scic_sds_controller_release_frame(
1311 scic_sds_phy_get_controller(this_phy
), frame_index
1319 * @phy: This is struct scic_sds_phy object which is being requested to decode the
1321 * @frame_index: This is the index of the unsolicited frame which was received
1324 * This method decodes the unsolicited frame when the struct scic_sds_phy is in the
1325 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. - Get the UF Header - If
1326 * the UF is an SIGNATURE FIS - Copy IAF data to local phy object SIGNATURE FIS
1327 * data buffer. - else - log warning message of unexpected unsolicted frame -
1328 * release frame buffer enum sci_status SCI_SUCCESS Must decode the SIGNATURE FIS
1331 static enum sci_status
scic_sds_phy_starting_substate_await_sig_fis_frame_handler(
1332 struct scic_sds_phy
*this_phy
,
1335 enum sci_status result
;
1337 struct sata_fis_header
*fis_frame_header
;
1338 u32
*fis_frame_data
;
1340 result
= scic_sds_unsolicited_frame_control_get_header(
1341 &(scic_sds_phy_get_controller(this_phy
)->uf_control
),
1343 (void **)&frame_words
);
1345 if (result
!= SCI_SUCCESS
) {
1349 fis_frame_header
= (struct sata_fis_header
*)frame_words
;
1352 (fis_frame_header
->fis_type
== SATA_FIS_TYPE_REGD2H
)
1353 && !(fis_frame_header
->status
& ATA_STATUS_REG_BSY_BIT
)
1355 scic_sds_unsolicited_frame_control_get_buffer(
1356 &(scic_sds_phy_get_controller(this_phy
)->uf_control
),
1358 (void **)&fis_frame_data
1361 scic_sds_controller_copy_sata_response(
1362 &this_phy
->phy_type
.sata
.signature_fis_buffer
,
1367 /* We got the IAF we can now go to the await spinup semaphore state */
1368 sci_base_state_machine_change_state(
1369 scic_sds_phy_get_starting_substate_machine(this_phy
),
1370 SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
1373 result
= SCI_SUCCESS
;
1375 dev_warn(sciphy_to_dev(this_phy
),
1376 "%s: PHY starting substate machine received "
1377 "unexpected frame id %x\n",
1381 /* Regardless of the result release this frame since we are done with it */
1382 scic_sds_controller_release_frame(
1383 scic_sds_phy_get_controller(this_phy
), frame_index
1390 * *****************************************************************************
1391 * * SCIC SDS PHY POWER_HANDLERS
1392 * ***************************************************************************** */
1396 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
1399 * This method is called by the struct scic_sds_controller when the phy object is
1400 * granted power. - The notify enable spinups are turned on for this phy object
1401 * - The phy state machine is transitioned to the
1402 * SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL. enum sci_status SCI_SUCCESS
1404 static enum sci_status
scic_sds_phy_starting_substate_await_sas_power_consume_power_handler(
1405 struct scic_sds_phy
*this_phy
)
1409 enable_spinup
= SCU_SAS_ENSPINUP_READ(this_phy
);
1410 enable_spinup
|= SCU_ENSPINUP_GEN_BIT(ENABLE
);
1411 SCU_SAS_ENSPINUP_WRITE(this_phy
, enable_spinup
);
1413 /* Change state to the final state this substate machine has run to completion */
1414 sci_base_state_machine_change_state(
1415 scic_sds_phy_get_starting_substate_machine(this_phy
),
1416 SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
1424 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
1427 * This method is called by the struct scic_sds_controller when the phy object is
1428 * granted power. - The phy state machine is transitioned to the
1429 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN. enum sci_status SCI_SUCCESS
1431 static enum sci_status
scic_sds_phy_starting_substate_await_sata_power_consume_power_handler(
1432 struct scic_sds_phy
*this_phy
)
1434 u32 scu_sas_pcfg_value
;
1436 /* Release the spinup hold state and reset the OOB state machine */
1437 scu_sas_pcfg_value
= SCU_SAS_PCFG_READ(this_phy
);
1438 scu_sas_pcfg_value
&=
1439 ~(SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD
) | SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE
));
1440 scu_sas_pcfg_value
|= SCU_SAS_PCFG_GEN_BIT(OOB_RESET
);
1441 SCU_SAS_PCFG_WRITE(this_phy
, scu_sas_pcfg_value
);
1443 /* Now restart the OOB operation */
1444 scu_sas_pcfg_value
&= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET
);
1445 scu_sas_pcfg_value
|= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE
);
1446 SCU_SAS_PCFG_WRITE(this_phy
, scu_sas_pcfg_value
);
1448 /* Change state to the final state this substate machine has run to completion */
1449 sci_base_state_machine_change_state(
1450 scic_sds_phy_get_starting_substate_machine(this_phy
),
1451 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN
1457 const struct scic_sds_phy_state_handler scic_sds_phy_starting_substate_handler_table
[] = {
1458 [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
] = {
1459 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1460 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1461 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1462 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1463 .frame_handler
= scic_sds_phy_default_frame_handler
,
1464 .event_handler
= scic_sds_phy_default_event_handler
,
1465 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1467 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN
] = {
1468 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1469 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1470 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1471 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1472 .frame_handler
= scic_sds_phy_default_frame_handler
,
1473 .event_handler
= scic_sds_phy_starting_substate_await_ossp_event_handler
,
1474 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1476 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
] = {
1477 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1478 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1479 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1480 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1481 .frame_handler
= scic_sds_phy_default_frame_handler
,
1482 .event_handler
= scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler
,
1483 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1485 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
] = {
1486 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1487 .parent
.stop_handler
= scic_sds_phy_default_stop_handler
,
1488 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1489 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1490 .frame_handler
= scic_sds_phy_starting_substate_await_iaf_uf_frame_handler
,
1491 .event_handler
= scic_sds_phy_starting_substate_await_iaf_uf_event_handler
,
1492 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1494 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
] = {
1495 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1496 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1497 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1498 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1499 .frame_handler
= scic_sds_phy_default_frame_handler
,
1500 .event_handler
= scic_sds_phy_starting_substate_await_sas_power_event_handler
,
1501 .consume_power_handler
= scic_sds_phy_starting_substate_await_sas_power_consume_power_handler
1503 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
] = {
1504 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1505 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1506 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1507 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1508 .frame_handler
= scic_sds_phy_default_frame_handler
,
1509 .event_handler
= scic_sds_phy_starting_substate_await_sata_power_event_handler
,
1510 .consume_power_handler
= scic_sds_phy_starting_substate_await_sata_power_consume_power_handler
1512 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN
] = {
1513 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1514 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1515 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1516 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1517 .frame_handler
= scic_sds_phy_default_frame_handler
,
1518 .event_handler
= scic_sds_phy_starting_substate_await_sata_phy_event_handler
,
1519 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1521 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN
] = {
1522 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1523 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1524 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1525 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1526 .frame_handler
= scic_sds_phy_default_frame_handler
,
1527 .event_handler
= scic_sds_phy_starting_substate_await_sata_speed_event_handler
,
1528 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1530 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF
] = {
1531 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1532 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1533 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1534 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1535 .frame_handler
= scic_sds_phy_starting_substate_await_sig_fis_frame_handler
,
1536 .event_handler
= scic_sds_phy_starting_substate_await_sig_fis_event_handler
,
1537 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1539 [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
] = {
1540 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
1541 .parent
.stop_handler
= scic_sds_phy_starting_substate_general_stop_handler
,
1542 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
1543 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
1544 .frame_handler
= scic_sds_phy_default_frame_handler
,
1545 .event_handler
= scic_sds_phy_default_event_handler
,
1546 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
1551 * scic_sds_phy_set_starting_substate_handlers() -
1553 * This macro sets the starting substate handlers by state_id
1555 #define scic_sds_phy_set_starting_substate_handlers(phy, state_id) \
1556 scic_sds_phy_set_state_handlers(\
1558 &scic_sds_phy_starting_substate_handler_table[(state_id)] \
1562 * ****************************************************************************
1563 * * PHY STARTING SUBSTATE METHODS
1564 * **************************************************************************** */
1568 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1570 * This method will perform the actions required by the struct scic_sds_phy on
1571 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL. - The initial state
1572 * handlers are put in place for the struct scic_sds_phy object. - The state is
1573 * changed to the wait phy type event notification. none
1575 static void scic_sds_phy_starting_initial_substate_enter(
1576 struct sci_base_object
*object
)
1578 struct scic_sds_phy
*this_phy
;
1580 this_phy
= (struct scic_sds_phy
*)object
;
1582 scic_sds_phy_set_starting_substate_handlers(
1583 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
);
1585 /* This is just an temporary state go off to the starting state */
1586 sci_base_state_machine_change_state(
1587 scic_sds_phy_get_starting_substate_machine(this_phy
),
1588 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN
1594 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1596 * This method will perform the actions required by the struct scic_sds_phy on
1597 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_PHY_TYPE_EN. - Set the
1598 * struct scic_sds_phy object state handlers for this state. none
1600 static void scic_sds_phy_starting_await_ossp_en_substate_enter(
1601 struct sci_base_object
*object
)
1603 struct scic_sds_phy
*this_phy
;
1605 this_phy
= (struct scic_sds_phy
*)object
;
1607 scic_sds_phy_set_starting_substate_handlers(
1608 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN
1614 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1616 * This method will perform the actions required by the struct scic_sds_phy on
1617 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN. - Set the
1618 * struct scic_sds_phy object state handlers for this state. none
1620 static void scic_sds_phy_starting_await_sas_speed_en_substate_enter(
1621 struct sci_base_object
*object
)
1623 struct scic_sds_phy
*this_phy
;
1625 this_phy
= (struct scic_sds_phy
*)object
;
1627 scic_sds_phy_set_starting_substate_handlers(
1628 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
1634 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1636 * This method will perform the actions required by the struct scic_sds_phy on
1637 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF. - Set the
1638 * struct scic_sds_phy object state handlers for this state. none
1640 static void scic_sds_phy_starting_await_iaf_uf_substate_enter(
1641 struct sci_base_object
*object
)
1643 struct scic_sds_phy
*this_phy
;
1645 this_phy
= (struct scic_sds_phy
*)object
;
1647 scic_sds_phy_set_starting_substate_handlers(
1648 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
1654 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1656 * This method will perform the actions required by the struct scic_sds_phy on
1657 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER. - Set the
1658 * struct scic_sds_phy object state handlers for this state. - Add this phy object to
1659 * the power control queue none
1661 static void scic_sds_phy_starting_await_sas_power_substate_enter(
1662 struct sci_base_object
*object
)
1664 struct scic_sds_phy
*this_phy
;
1666 this_phy
= (struct scic_sds_phy
*)object
;
1668 scic_sds_phy_set_starting_substate_handlers(
1669 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
1672 scic_sds_controller_power_control_queue_insert(
1673 scic_sds_phy_get_controller(this_phy
),
1680 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1682 * This method will perform the actions required by the struct scic_sds_phy on exiting
1683 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER. - Remove the
1684 * struct scic_sds_phy object from the power control queue. none
1686 static void scic_sds_phy_starting_await_sas_power_substate_exit(
1687 struct sci_base_object
*object
)
1689 struct scic_sds_phy
*this_phy
;
1691 this_phy
= (struct scic_sds_phy
*)object
;
1693 scic_sds_controller_power_control_queue_remove(
1694 scic_sds_phy_get_controller(this_phy
), this_phy
1700 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1702 * This method will perform the actions required by the struct scic_sds_phy on
1703 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER. - Set the
1704 * struct scic_sds_phy object state handlers for this state. - Add this phy object to
1705 * the power control queue none
1707 static void scic_sds_phy_starting_await_sata_power_substate_enter(
1708 struct sci_base_object
*object
)
1710 struct scic_sds_phy
*this_phy
;
1712 this_phy
= (struct scic_sds_phy
*)object
;
1714 scic_sds_phy_set_starting_substate_handlers(
1715 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
1718 scic_sds_controller_power_control_queue_insert(
1719 scic_sds_phy_get_controller(this_phy
),
1726 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1728 * This method will perform the actions required by the struct scic_sds_phy on exiting
1729 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER. - Remove the
1730 * struct scic_sds_phy object from the power control queue. none
1732 static void scic_sds_phy_starting_await_sata_power_substate_exit(
1733 struct sci_base_object
*object
)
1735 struct scic_sds_phy
*this_phy
;
1737 this_phy
= (struct scic_sds_phy
*)object
;
1739 scic_sds_controller_power_control_queue_remove(
1740 scic_sds_phy_get_controller(this_phy
),
1747 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1749 * This method will perform the actions required by the struct scic_sds_phy on
1750 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN. - Set the
1751 * struct scic_sds_phy object state handlers for this state. none
1753 static void scic_sds_phy_starting_await_sata_phy_substate_enter(
1754 struct sci_base_object
*object
)
1756 struct scic_sds_phy
*this_phy
;
1758 this_phy
= (struct scic_sds_phy
*)object
;
1760 scic_sds_phy_set_starting_substate_handlers(
1761 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN
1764 isci_event_timer_start(
1765 scic_sds_phy_get_controller(this_phy
),
1766 this_phy
->sata_timeout_timer
,
1767 SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT
1773 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1775 * This method will perform the actions required by the struct scic_sds_phy on exiting
1776 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN. - stop the timer
1777 * that was started on entry to await sata phy event notification none
1779 static void scic_sds_phy_starting_await_sata_phy_substate_exit(
1780 struct sci_base_object
*object
)
1782 struct scic_sds_phy
*this_phy
;
1784 this_phy
= (struct scic_sds_phy
*)object
;
1786 isci_event_timer_stop(
1787 scic_sds_phy_get_controller(this_phy
),
1788 this_phy
->sata_timeout_timer
1794 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1796 * This method will perform the actions required by the struct scic_sds_phy on
1797 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN. - Set the
1798 * struct scic_sds_phy object state handlers for this state. none
1800 static void scic_sds_phy_starting_await_sata_speed_substate_enter(
1801 struct sci_base_object
*object
)
1803 struct scic_sds_phy
*this_phy
;
1805 this_phy
= (struct scic_sds_phy
*)object
;
1807 scic_sds_phy_set_starting_substate_handlers(
1808 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN
1811 isci_event_timer_start(
1812 scic_sds_phy_get_controller(this_phy
),
1813 this_phy
->sata_timeout_timer
,
1814 SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT
1820 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1822 * This method will perform the actions required by the struct scic_sds_phy on exiting
1823 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN. - stop the timer
1824 * that was started on entry to await sata phy event notification none
1826 static void scic_sds_phy_starting_await_sata_speed_substate_exit(
1827 struct sci_base_object
*object
)
1829 struct scic_sds_phy
*this_phy
;
1831 this_phy
= (struct scic_sds_phy
*)object
;
1833 isci_event_timer_stop(
1834 scic_sds_phy_get_controller(this_phy
),
1835 this_phy
->sata_timeout_timer
1841 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1843 * This method will perform the actions required by the struct scic_sds_phy on
1844 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. - Set the
1845 * struct scic_sds_phy object state handlers for this state. - Start the SIGNATURE FIS
1846 * timeout timer none
1848 static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(
1849 struct sci_base_object
*object
)
1851 bool continue_to_ready_state
;
1852 struct scic_sds_phy
*this_phy
;
1854 this_phy
= (struct scic_sds_phy
*)object
;
1856 scic_sds_phy_set_starting_substate_handlers(
1857 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF
1860 continue_to_ready_state
= scic_sds_port_link_detected(
1861 this_phy
->owning_port
,
1865 if (continue_to_ready_state
) {
1867 * Clear the PE suspend condition so we can actually receive SIG FIS
1868 * The hardware will not respond to the XRDY until the PE suspend
1869 * condition is cleared. */
1870 scic_sds_phy_resume(this_phy
);
1872 isci_event_timer_start(
1873 scic_sds_phy_get_controller(this_phy
),
1874 this_phy
->sata_timeout_timer
,
1875 SCIC_SDS_SIGNATURE_FIS_TIMEOUT
1878 this_phy
->is_in_link_training
= false;
1884 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1886 * This method will perform the actions required by the struct scic_sds_phy on exiting
1887 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. - Stop the SIGNATURE
1888 * FIS timeout timer. none
1890 static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(
1891 struct sci_base_object
*object
)
1893 struct scic_sds_phy
*this_phy
;
1895 this_phy
= (struct scic_sds_phy
*)object
;
1897 isci_event_timer_stop(
1898 scic_sds_phy_get_controller(this_phy
),
1899 this_phy
->sata_timeout_timer
1905 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
1907 * This method will perform the actions required by the struct scic_sds_phy on
1908 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL. - Set the struct scic_sds_phy
1909 * object state handlers for this state. - Change base state machine to the
1912 static void scic_sds_phy_starting_final_substate_enter(
1913 struct sci_base_object
*object
)
1915 struct scic_sds_phy
*this_phy
;
1917 this_phy
= (struct scic_sds_phy
*)object
;
1919 scic_sds_phy_set_starting_substate_handlers(
1920 this_phy
, SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
1924 * State machine has run to completion so exit out and change
1925 * the base state machine to the ready state */
1926 sci_base_state_machine_change_state(
1927 scic_sds_phy_get_base_state_machine(this_phy
),
1928 SCI_BASE_PHY_STATE_READY
);
1931 /* --------------------------------------------------------------------------- */
1933 const struct sci_base_state scic_sds_phy_starting_substates
[] = {
1934 [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
] = {
1935 .enter_state
= scic_sds_phy_starting_initial_substate_enter
,
1937 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN
] = {
1938 .enter_state
= scic_sds_phy_starting_await_ossp_en_substate_enter
,
1940 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
] = {
1941 .enter_state
= scic_sds_phy_starting_await_sas_speed_en_substate_enter
,
1943 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
] = {
1944 .enter_state
= scic_sds_phy_starting_await_iaf_uf_substate_enter
,
1946 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
] = {
1947 .enter_state
= scic_sds_phy_starting_await_sas_power_substate_enter
,
1948 .exit_state
= scic_sds_phy_starting_await_sas_power_substate_exit
,
1950 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
] = {
1951 .enter_state
= scic_sds_phy_starting_await_sata_power_substate_enter
,
1952 .exit_state
= scic_sds_phy_starting_await_sata_power_substate_exit
1954 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN
] = {
1955 .enter_state
= scic_sds_phy_starting_await_sata_phy_substate_enter
,
1956 .exit_state
= scic_sds_phy_starting_await_sata_phy_substate_exit
1958 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN
] = {
1959 .enter_state
= scic_sds_phy_starting_await_sata_speed_substate_enter
,
1960 .exit_state
= scic_sds_phy_starting_await_sata_speed_substate_exit
1962 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF
] = {
1963 .enter_state
= scic_sds_phy_starting_await_sig_fis_uf_substate_enter
,
1964 .exit_state
= scic_sds_phy_starting_await_sig_fis_uf_substate_exit
1966 [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
] = {
1967 .enter_state
= scic_sds_phy_starting_final_substate_enter
,
1972 * ***************************************************************************
1973 * * DEFAULT HANDLERS
1974 * *************************************************************************** */
1978 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
1981 * This is the default method for phy a start request. It will report a
1982 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1984 enum sci_status
scic_sds_phy_default_start_handler(
1985 struct sci_base_phy
*phy
)
1987 struct scic_sds_phy
*this_phy
;
1989 this_phy
= (struct scic_sds_phy
*)phy
;
1991 dev_warn(sciphy_to_dev(this_phy
),
1992 "%s: SCIC Phy 0x%p requested to start from invalid "
1996 sci_base_state_machine_get_state(
1997 &this_phy
->parent
.state_machine
));
1999 return SCI_FAILURE_INVALID_STATE
;
2005 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2008 * This is the default method for phy a stop request. It will report a warning
2009 * and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2011 enum sci_status
scic_sds_phy_default_stop_handler(
2012 struct sci_base_phy
*phy
)
2014 struct scic_sds_phy
*this_phy
;
2016 this_phy
= (struct scic_sds_phy
*)phy
;
2018 dev_warn(sciphy_to_dev(this_phy
),
2019 "%s: SCIC Phy 0x%p requested to stop from invalid "
2023 sci_base_state_machine_get_state(
2024 &this_phy
->parent
.state_machine
));
2026 return SCI_FAILURE_INVALID_STATE
;
2031 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2034 * This is the default method for phy a reset request. It will report a
2035 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2037 enum sci_status
scic_sds_phy_default_reset_handler(
2038 struct sci_base_phy
*phy
)
2040 struct scic_sds_phy
*this_phy
;
2042 this_phy
= (struct scic_sds_phy
*)phy
;
2044 dev_warn(sciphy_to_dev(this_phy
),
2045 "%s: SCIC Phy 0x%p requested to reset from invalid state "
2049 sci_base_state_machine_get_state(
2050 &this_phy
->parent
.state_machine
));
2052 return SCI_FAILURE_INVALID_STATE
;
2057 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2060 * This is the default method for phy a destruct request. It will report a
2061 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2063 enum sci_status
scic_sds_phy_default_destroy_handler(
2064 struct sci_base_phy
*phy
)
2066 struct scic_sds_phy
*this_phy
;
2068 this_phy
= (struct scic_sds_phy
*)phy
;
2070 /* / @todo Implement something for the default */
2071 dev_warn(sciphy_to_dev(this_phy
),
2072 "%s: SCIC Phy 0x%p requested to destroy from invalid "
2076 sci_base_state_machine_get_state(
2077 &this_phy
->parent
.state_machine
));
2079 return SCI_FAILURE_INVALID_STATE
;
2084 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2086 * @frame_index: This is the frame index that was received from the SCU
2089 * This is the default method for a phy frame handling request. It will report
2090 * a warning, release the frame and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2092 enum sci_status
scic_sds_phy_default_frame_handler(
2093 struct scic_sds_phy
*this_phy
,
2096 dev_warn(sciphy_to_dev(this_phy
),
2097 "%s: SCIC Phy 0x%p received unexpected frame data %d "
2098 "while in state %d\n",
2102 sci_base_state_machine_get_state(
2103 &this_phy
->parent
.state_machine
));
2105 scic_sds_controller_release_frame(
2106 scic_sds_phy_get_controller(this_phy
), frame_index
);
2108 return SCI_FAILURE_INVALID_STATE
;
2113 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2115 * @event_code: This is the event code that was received from the SCU hardware.
2117 * This is the default method for a phy event handler. It will report a
2118 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2120 enum sci_status
scic_sds_phy_default_event_handler(
2121 struct scic_sds_phy
*this_phy
,
2124 dev_warn(sciphy_to_dev(this_phy
),
2125 "%s: SCIC Phy 0x%p received unexpected event status %x "
2126 "while in state %d\n",
2130 sci_base_state_machine_get_state(
2131 &this_phy
->parent
.state_machine
));
2133 return SCI_FAILURE_INVALID_STATE
;
2138 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2141 * This is the default method for a phy consume power handler. It will report
2142 * a warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2144 enum sci_status
scic_sds_phy_default_consume_power_handler(
2145 struct scic_sds_phy
*this_phy
)
2147 dev_warn(sciphy_to_dev(this_phy
),
2148 "%s: SCIC Phy 0x%p given unexpected permission to consume "
2149 "power while in state %d\n",
2152 sci_base_state_machine_get_state(
2153 &this_phy
->parent
.state_machine
));
2155 return SCI_FAILURE_INVALID_STATE
;
2159 * ******************************************************************************
2160 * * PHY STOPPED STATE HANDLERS
2161 * ****************************************************************************** */
2165 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2168 * This method takes the struct scic_sds_phy from a stopped state and attempts to
2169 * start it. - The phy state machine is transitioned to the
2170 * SCI_BASE_PHY_STATE_STARTING. enum sci_status SCI_SUCCESS
2172 static enum sci_status
scic_sds_phy_stopped_state_start_handler(struct sci_base_phy
*phy
)
2174 struct scic_sds_phy
*this_phy
;
2176 this_phy
= (struct scic_sds_phy
*)phy
;
2178 /* Create the SIGNATURE FIS Timeout timer for this phy */
2179 this_phy
->sata_timeout_timer
= isci_event_timer_create(
2180 scic_sds_phy_get_controller(this_phy
),
2181 scic_sds_phy_sata_timeout
, this_phy
);
2183 if (this_phy
->sata_timeout_timer
!= NULL
) {
2184 sci_base_state_machine_change_state(
2185 scic_sds_phy_get_base_state_machine(this_phy
),
2186 SCI_BASE_PHY_STATE_STARTING
);
2194 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2197 * This method takes the struct scic_sds_phy from a stopped state and destroys it. -
2198 * This function takes no action. Shouldnt this function transition the
2199 * struct sci_base_phy::state_machine to the SCI_BASE_PHY_STATE_FINAL? enum sci_status
2202 static enum sci_status
scic_sds_phy_stopped_state_destroy_handler(
2203 struct sci_base_phy
*phy
)
2205 struct scic_sds_phy
*this_phy
;
2207 this_phy
= (struct scic_sds_phy
*)phy
;
2209 /* @todo what do we actually need to do here? */
2214 * ******************************************************************************
2215 * * PHY STARTING STATE HANDLERS
2216 * ****************************************************************************** */
2218 /* All of these state handlers are mapped to the starting sub-state machine */
2221 * ******************************************************************************
2222 * * PHY READY STATE HANDLERS
2223 * ****************************************************************************** */
2227 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2230 * This method takes the struct scic_sds_phy from a ready state and attempts to stop
2231 * it. - The phy state machine is transitioned to the
2232 * SCI_BASE_PHY_STATE_STOPPED. enum sci_status SCI_SUCCESS
2234 static enum sci_status
scic_sds_phy_ready_state_stop_handler(
2235 struct sci_base_phy
*phy
)
2237 struct scic_sds_phy
*this_phy
;
2239 this_phy
= (struct scic_sds_phy
*)phy
;
2241 sci_base_state_machine_change_state(
2242 scic_sds_phy_get_base_state_machine(this_phy
),
2243 SCI_BASE_PHY_STATE_STOPPED
2251 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2254 * This method takes the struct scic_sds_phy from a ready state and attempts to reset
2255 * it. - The phy state machine is transitioned to the
2256 * SCI_BASE_PHY_STATE_STARTING. enum sci_status SCI_SUCCESS
2258 static enum sci_status
scic_sds_phy_ready_state_reset_handler(
2259 struct sci_base_phy
*phy
)
2261 struct scic_sds_phy
*this_phy
;
2263 this_phy
= (struct scic_sds_phy
*)phy
;
2265 sci_base_state_machine_change_state(
2266 scic_sds_phy_get_base_state_machine(this_phy
),
2267 SCI_BASE_PHY_STATE_RESETTING
2275 * @phy: This is the struct scic_sds_phy object which has received the event.
2277 * This method request the struct scic_sds_phy handle the received event. The only
2278 * event that we are interested in while in the ready state is the link failure
2279 * event. - decoded event is a link failure - transition the struct scic_sds_phy back
2280 * to the SCI_BASE_PHY_STATE_STARTING state. - any other event recived will
2281 * report a warning message enum sci_status SCI_SUCCESS if the event received is a
2282 * link failure SCI_FAILURE_INVALID_STATE for any other event received.
2284 static enum sci_status
scic_sds_phy_ready_state_event_handler(
2285 struct scic_sds_phy
*this_phy
,
2288 enum sci_status result
= SCI_FAILURE
;
2290 switch (scu_get_event_code(event_code
)) {
2291 case SCU_EVENT_LINK_FAILURE
:
2292 /* Link failure change state back to the starting state */
2293 sci_base_state_machine_change_state(
2294 scic_sds_phy_get_base_state_machine(this_phy
),
2295 SCI_BASE_PHY_STATE_STARTING
2298 result
= SCI_SUCCESS
;
2301 case SCU_EVENT_BROADCAST_CHANGE
:
2302 /* Broadcast change received. Notify the port. */
2303 if (scic_sds_phy_get_port(this_phy
) != NULL
)
2304 scic_sds_port_broadcast_change_received(this_phy
->owning_port
, this_phy
);
2306 this_phy
->bcn_received_while_port_unassigned
= true;
2310 dev_warn(sciphy_to_dev(this_phy
),
2311 "%sP SCIC PHY 0x%p ready state machine received "
2312 "unexpected event_code %x\n",
2317 result
= SCI_FAILURE_INVALID_STATE
;
2324 /* --------------------------------------------------------------------------- */
2328 * @this_phy: This is the struct scic_sds_phy object which is receiving the event.
2329 * @event_code: This is the event code to be processed.
2331 * This is the resetting state event handler. enum sci_status
2332 * SCI_FAILURE_INVALID_STATE
2334 static enum sci_status
scic_sds_phy_resetting_state_event_handler(
2335 struct scic_sds_phy
*this_phy
,
2338 enum sci_status result
= SCI_FAILURE
;
2340 switch (scu_get_event_code(event_code
)) {
2341 case SCU_EVENT_HARD_RESET_TRANSMITTED
:
2342 /* Link failure change state back to the starting state */
2343 sci_base_state_machine_change_state(
2344 scic_sds_phy_get_base_state_machine(this_phy
),
2345 SCI_BASE_PHY_STATE_STARTING
2348 result
= SCI_SUCCESS
;
2352 dev_warn(sciphy_to_dev(this_phy
),
2353 "%s: SCIC PHY 0x%p resetting state machine received "
2354 "unexpected event_code %x\n",
2359 result
= SCI_FAILURE_INVALID_STATE
;
2366 /* --------------------------------------------------------------------------- */
2368 const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table
[] = {
2369 [SCI_BASE_PHY_STATE_INITIAL
] = {
2370 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
2371 .parent
.stop_handler
= scic_sds_phy_default_stop_handler
,
2372 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
2373 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
2374 .frame_handler
= scic_sds_phy_default_frame_handler
,
2375 .event_handler
= scic_sds_phy_default_event_handler
,
2376 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
2378 [SCI_BASE_PHY_STATE_STOPPED
] = {
2379 .parent
.start_handler
= scic_sds_phy_stopped_state_start_handler
,
2380 .parent
.stop_handler
= scic_sds_phy_default_stop_handler
,
2381 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
2382 .parent
.destruct_handler
= scic_sds_phy_stopped_state_destroy_handler
,
2383 .frame_handler
= scic_sds_phy_default_frame_handler
,
2384 .event_handler
= scic_sds_phy_default_event_handler
,
2385 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
2387 [SCI_BASE_PHY_STATE_STARTING
] = {
2388 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
2389 .parent
.stop_handler
= scic_sds_phy_default_stop_handler
,
2390 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
2391 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
2392 .frame_handler
= scic_sds_phy_default_frame_handler
,
2393 .event_handler
= scic_sds_phy_default_event_handler
,
2394 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
2396 [SCI_BASE_PHY_STATE_READY
] = {
2397 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
2398 .parent
.stop_handler
= scic_sds_phy_ready_state_stop_handler
,
2399 .parent
.reset_handler
= scic_sds_phy_ready_state_reset_handler
,
2400 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
2401 .frame_handler
= scic_sds_phy_default_frame_handler
,
2402 .event_handler
= scic_sds_phy_ready_state_event_handler
,
2403 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
2405 [SCI_BASE_PHY_STATE_RESETTING
] = {
2406 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
2407 .parent
.stop_handler
= scic_sds_phy_default_stop_handler
,
2408 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
2409 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
2410 .frame_handler
= scic_sds_phy_default_frame_handler
,
2411 .event_handler
= scic_sds_phy_resetting_state_event_handler
,
2412 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
2414 [SCI_BASE_PHY_STATE_FINAL
] = {
2415 .parent
.start_handler
= scic_sds_phy_default_start_handler
,
2416 .parent
.stop_handler
= scic_sds_phy_default_stop_handler
,
2417 .parent
.reset_handler
= scic_sds_phy_default_reset_handler
,
2418 .parent
.destruct_handler
= scic_sds_phy_default_destroy_handler
,
2419 .frame_handler
= scic_sds_phy_default_frame_handler
,
2420 .event_handler
= scic_sds_phy_default_event_handler
,
2421 .consume_power_handler
= scic_sds_phy_default_consume_power_handler
2426 * ****************************************************************************
2427 * * PHY STATE PRIVATE METHODS
2428 * **************************************************************************** */
2432 * @this_phy: This is the struct scic_sds_phy object to stop.
2434 * This method will stop the struct scic_sds_phy object. This does not reset the
2435 * protocol engine it just suspends it and places it in a state where it will
2436 * not cause the end device to power up. none
2438 static void scu_link_layer_stop_protocol_engine(
2439 struct scic_sds_phy
*this_phy
)
2441 u32 scu_sas_pcfg_value
;
2442 u32 enable_spinup_value
;
2444 /* Suspend the protocol engine and place it in a sata spinup hold state */
2445 scu_sas_pcfg_value
= SCU_SAS_PCFG_READ(this_phy
);
2446 scu_sas_pcfg_value
|= (
2447 SCU_SAS_PCFG_GEN_BIT(OOB_RESET
)
2448 | SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE
)
2449 | SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD
)
2451 SCU_SAS_PCFG_WRITE(this_phy
, scu_sas_pcfg_value
);
2453 /* Disable the notify enable spinup primitives */
2454 enable_spinup_value
= SCU_SAS_ENSPINUP_READ(this_phy
);
2455 enable_spinup_value
&= ~SCU_ENSPINUP_GEN_BIT(ENABLE
);
2456 SCU_SAS_ENSPINUP_WRITE(this_phy
, enable_spinup_value
);
2462 * This method will start the OOB/SN state machine for this struct scic_sds_phy object.
2464 static void scu_link_layer_start_oob(
2465 struct scic_sds_phy
*this_phy
)
2467 u32 scu_sas_pcfg_value
;
2469 scu_sas_pcfg_value
= SCU_SAS_PCFG_READ(this_phy
);
2470 scu_sas_pcfg_value
|= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE
);
2471 scu_sas_pcfg_value
&=
2472 ~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET
) | SCU_SAS_PCFG_GEN_BIT(HARD_RESET
));
2474 SCU_SAS_PCFG_WRITE(this_phy
, scu_sas_pcfg_value
);
2480 * This method will transmit a hard reset request on the specified phy. The SCU
2481 * hardware requires that we reset the OOB state machine and set the hard reset
2482 * bit in the phy configuration register. We then must start OOB over with the
2483 * hard reset bit set.
2485 static void scu_link_layer_tx_hard_reset(
2486 struct scic_sds_phy
*this_phy
)
2488 u32 phy_configuration_value
;
2491 * SAS Phys must wait for the HARD_RESET_TX event notification to transition
2492 * to the starting state. */
2493 phy_configuration_value
= SCU_SAS_PCFG_READ(this_phy
);
2494 phy_configuration_value
|=
2495 (SCU_SAS_PCFG_GEN_BIT(HARD_RESET
) | SCU_SAS_PCFG_GEN_BIT(OOB_RESET
));
2496 SCU_SAS_PCFG_WRITE(this_phy
, phy_configuration_value
);
2498 /* Now take the OOB state machine out of reset */
2499 phy_configuration_value
|= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE
);
2500 phy_configuration_value
&= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET
);
2501 SCU_SAS_PCFG_WRITE(this_phy
, phy_configuration_value
);
2505 * ****************************************************************************
2506 * * PHY BASE STATE METHODS
2507 * **************************************************************************** */
2511 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2513 * This method will perform the actions required by the struct scic_sds_phy on
2514 * entering the SCI_BASE_PHY_STATE_INITIAL. - This function sets the state
2515 * handlers for the phy object base state machine initial state. none
2517 static void scic_sds_phy_initial_state_enter(
2518 struct sci_base_object
*object
)
2520 struct scic_sds_phy
*this_phy
;
2522 this_phy
= (struct scic_sds_phy
*)object
;
2524 scic_sds_phy_set_base_state_handlers(this_phy
, SCI_BASE_PHY_STATE_INITIAL
);
2529 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2531 * This method will perform the actions required by the struct scic_sds_phy on
2532 * entering the SCI_BASE_PHY_STATE_INITIAL. - This function sets the state
2533 * handlers for the phy object base state machine initial state. - The SCU
2534 * hardware is requested to stop the protocol engine. none
2536 static void scic_sds_phy_stopped_state_enter(struct sci_base_object
*object
)
2538 struct scic_sds_phy
*sci_phy
;
2540 sci_phy
= (struct scic_sds_phy
*)object
;
2542 /* / @todo We need to get to the controller to place this PE in a reset state */
2544 scic_sds_phy_set_base_state_handlers(sci_phy
, SCI_BASE_PHY_STATE_STOPPED
);
2546 if (sci_phy
->sata_timeout_timer
!= NULL
) {
2547 isci_event_timer_destroy(scic_sds_phy_get_controller(sci_phy
),
2548 sci_phy
->sata_timeout_timer
);
2550 sci_phy
->sata_timeout_timer
= NULL
;
2553 scu_link_layer_stop_protocol_engine(sci_phy
);
2558 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2560 * This method will perform the actions required by the struct scic_sds_phy on
2561 * entering the SCI_BASE_PHY_STATE_STARTING. - This function sets the state
2562 * handlers for the phy object base state machine starting state. - The SCU
2563 * hardware is requested to start OOB/SN on this protocl engine. - The phy
2564 * starting substate machine is started. - If the previous state was the ready
2565 * state then the struct scic_sds_controller is informed that the phy has gone link
2568 static void scic_sds_phy_starting_state_enter(
2569 struct sci_base_object
*object
)
2571 struct scic_sds_phy
*this_phy
;
2573 this_phy
= (struct scic_sds_phy
*)object
;
2575 scic_sds_phy_set_base_state_handlers(this_phy
, SCI_BASE_PHY_STATE_STARTING
);
2577 scu_link_layer_stop_protocol_engine(this_phy
);
2578 scu_link_layer_start_oob(this_phy
);
2580 /* We don't know what kind of phy we are going to be just yet */
2581 this_phy
->protocol
= SCIC_SDS_PHY_PROTOCOL_UNKNOWN
;
2582 this_phy
->bcn_received_while_port_unassigned
= false;
2584 /* Change over to the starting substate machine to continue */
2585 sci_base_state_machine_start(&this_phy
->starting_substate_machine
);
2587 if (this_phy
->parent
.state_machine
.previous_state_id
2588 == SCI_BASE_PHY_STATE_READY
) {
2589 scic_sds_controller_link_down(
2590 scic_sds_phy_get_controller(this_phy
),
2591 scic_sds_phy_get_port(this_phy
),
2599 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2601 * This method will perform the actions required by the struct scic_sds_phy on
2602 * entering the SCI_BASE_PHY_STATE_READY. - This function sets the state
2603 * handlers for the phy object base state machine ready state. - The SCU
2604 * hardware protocol engine is resumed. - The struct scic_sds_controller is informed
2605 * that the phy object has gone link up. none
2607 static void scic_sds_phy_ready_state_enter(
2608 struct sci_base_object
*object
)
2610 struct scic_sds_phy
*this_phy
;
2612 this_phy
= (struct scic_sds_phy
*)object
;
2614 scic_sds_phy_set_base_state_handlers(this_phy
, SCI_BASE_PHY_STATE_READY
);
2616 scic_sds_controller_link_up(
2617 scic_sds_phy_get_controller(this_phy
),
2618 scic_sds_phy_get_port(this_phy
),
2625 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2627 * This method will perform the actions required by the struct scic_sds_phy on exiting
2628 * the SCI_BASE_PHY_STATE_INITIAL. This function suspends the SCU hardware
2629 * protocol engine represented by this struct scic_sds_phy object. none
2631 static void scic_sds_phy_ready_state_exit(
2632 struct sci_base_object
*object
)
2634 struct scic_sds_phy
*this_phy
;
2636 this_phy
= (struct scic_sds_phy
*)object
;
2638 scic_sds_phy_suspend(this_phy
);
2643 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2645 * This method will perform the actions required by the struct scic_sds_phy on
2646 * entering the SCI_BASE_PHY_STATE_RESETTING. - This function sets the state
2647 * handlers for the phy object base state machine resetting state. none
2649 static void scic_sds_phy_resetting_state_enter(
2650 struct sci_base_object
*object
)
2652 struct scic_sds_phy
*this_phy
;
2654 this_phy
= (struct scic_sds_phy
*)object
;
2656 scic_sds_phy_set_base_state_handlers(this_phy
, SCI_BASE_PHY_STATE_RESETTING
);
2659 * The phy is being reset, therefore deactivate it from the port.
2660 * In the resetting state we don't notify the user regarding
2661 * link up and link down notifications. */
2662 scic_sds_port_deactivate_phy(this_phy
->owning_port
, this_phy
, false);
2664 if (this_phy
->protocol
== SCIC_SDS_PHY_PROTOCOL_SAS
) {
2665 scu_link_layer_tx_hard_reset(this_phy
);
2668 * The SCU does not need to have a descrete reset state so just go back to
2669 * the starting state. */
2670 sci_base_state_machine_change_state(
2671 &this_phy
->parent
.state_machine
,
2672 SCI_BASE_PHY_STATE_STARTING
2679 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_phy object.
2681 * This method will perform the actions required by the struct scic_sds_phy on
2682 * entering the SCI_BASE_PHY_STATE_FINAL. - This function sets the state
2683 * handlers for the phy object base state machine final state. none
2685 static void scic_sds_phy_final_state_enter(
2686 struct sci_base_object
*object
)
2688 struct scic_sds_phy
*this_phy
;
2690 this_phy
= (struct scic_sds_phy
*)object
;
2692 scic_sds_phy_set_base_state_handlers(this_phy
, SCI_BASE_PHY_STATE_FINAL
);
2694 /* Nothing to do here */
2697 /* --------------------------------------------------------------------------- */
2699 const struct sci_base_state scic_sds_phy_state_table
[] = {
2700 [SCI_BASE_PHY_STATE_INITIAL
] = {
2701 .enter_state
= scic_sds_phy_initial_state_enter
,
2703 [SCI_BASE_PHY_STATE_STOPPED
] = {
2704 .enter_state
= scic_sds_phy_stopped_state_enter
,
2706 [SCI_BASE_PHY_STATE_STARTING
] = {
2707 .enter_state
= scic_sds_phy_starting_state_enter
,
2709 [SCI_BASE_PHY_STATE_READY
] = {
2710 .enter_state
= scic_sds_phy_ready_state_enter
,
2711 .exit_state
= scic_sds_phy_ready_state_exit
,
2713 [SCI_BASE_PHY_STATE_RESETTING
] = {
2714 .enter_state
= scic_sds_phy_resetting_state_enter
,
2716 [SCI_BASE_PHY_STATE_FINAL
] = {
2717 .enter_state
= scic_sds_phy_final_state_enter
,