isci: merge phy substates
[deliverable/linux.git] / drivers / scsi / isci / phy.c
1 /*
2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
38 * distribution.
39 * * 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.
42 *
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.
54 */
55
56 #include "isci.h"
57 #include "host.h"
58 #include "phy.h"
59 #include "scu_event_codes.h"
60 #include "timers.h"
61 #include "probe_roms.h"
62
63 /* Maximum arbitration wait time in micro-seconds */
64 #define SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME (700)
65
66 enum sas_linkrate sci_phy_linkrate(struct scic_sds_phy *sci_phy)
67 {
68 return sci_phy->max_negotiated_speed;
69 }
70
71 /*
72 * *****************************************************************************
73 * * SCIC SDS PHY Internal Methods
74 * ***************************************************************************** */
75
76 /**
77 * This method will initialize the phy transport layer registers
78 * @sci_phy:
79 * @transport_layer_registers
80 *
81 * enum sci_status
82 */
83 static enum sci_status scic_sds_phy_transport_layer_initialization(
84 struct scic_sds_phy *sci_phy,
85 struct scu_transport_layer_registers __iomem *transport_layer_registers)
86 {
87 u32 tl_control;
88
89 sci_phy->transport_layer_registers = transport_layer_registers;
90
91 writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX,
92 &sci_phy->transport_layer_registers->stp_rni);
93
94 /*
95 * Hardware team recommends that we enable the STP prefetch for all
96 * transports
97 */
98 tl_control = readl(&sci_phy->transport_layer_registers->control);
99 tl_control |= SCU_TLCR_GEN_BIT(STP_WRITE_DATA_PREFETCH);
100 writel(tl_control, &sci_phy->transport_layer_registers->control);
101
102 return SCI_SUCCESS;
103 }
104
105 /**
106 * This method will initialize the phy link layer registers
107 * @sci_phy:
108 * @link_layer_registers:
109 *
110 * enum sci_status
111 */
112 static enum sci_status
113 scic_sds_phy_link_layer_initialization(struct scic_sds_phy *sci_phy,
114 struct scu_link_layer_registers __iomem *link_layer_registers)
115 {
116 struct scic_sds_controller *scic =
117 sci_phy->owning_port->owning_controller;
118 int phy_idx = sci_phy->phy_index;
119 struct sci_phy_user_params *phy_user =
120 &scic->user_parameters.sds1.phys[phy_idx];
121 struct sci_phy_oem_params *phy_oem =
122 &scic->oem_parameters.sds1.phys[phy_idx];
123 u32 phy_configuration;
124 struct scic_phy_cap phy_cap;
125 u32 parity_check = 0;
126 u32 parity_count = 0;
127 u32 llctl, link_rate;
128 u32 clksm_value = 0;
129
130 sci_phy->link_layer_registers = link_layer_registers;
131
132 /* Set our IDENTIFY frame data */
133 #define SCI_END_DEVICE 0x01
134
135 writel(SCU_SAS_TIID_GEN_BIT(SMP_INITIATOR) |
136 SCU_SAS_TIID_GEN_BIT(SSP_INITIATOR) |
137 SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) |
138 SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) |
139 SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE),
140 &sci_phy->link_layer_registers->transmit_identification);
141
142 /* Write the device SAS Address */
143 writel(0xFEDCBA98,
144 &sci_phy->link_layer_registers->sas_device_name_high);
145 writel(phy_idx, &sci_phy->link_layer_registers->sas_device_name_low);
146
147 /* Write the source SAS Address */
148 writel(phy_oem->sas_address.high,
149 &sci_phy->link_layer_registers->source_sas_address_high);
150 writel(phy_oem->sas_address.low,
151 &sci_phy->link_layer_registers->source_sas_address_low);
152
153 /* Clear and Set the PHY Identifier */
154 writel(0, &sci_phy->link_layer_registers->identify_frame_phy_id);
155 writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx),
156 &sci_phy->link_layer_registers->identify_frame_phy_id);
157
158 /* Change the initial state of the phy configuration register */
159 phy_configuration =
160 readl(&sci_phy->link_layer_registers->phy_configuration);
161
162 /* Hold OOB state machine in reset */
163 phy_configuration |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
164 writel(phy_configuration,
165 &sci_phy->link_layer_registers->phy_configuration);
166
167 /* Configure the SNW capabilities */
168 phy_cap.all = 0;
169 phy_cap.start = 1;
170 phy_cap.gen3_no_ssc = 1;
171 phy_cap.gen2_no_ssc = 1;
172 phy_cap.gen1_no_ssc = 1;
173 if (scic->oem_parameters.sds1.controller.do_enable_ssc == true) {
174 phy_cap.gen3_ssc = 1;
175 phy_cap.gen2_ssc = 1;
176 phy_cap.gen1_ssc = 1;
177 }
178
179 /*
180 * The SAS specification indicates that the phy_capabilities that
181 * are transmitted shall have an even parity. Calculate the parity. */
182 parity_check = phy_cap.all;
183 while (parity_check != 0) {
184 if (parity_check & 0x1)
185 parity_count++;
186 parity_check >>= 1;
187 }
188
189 /*
190 * If parity indicates there are an odd number of bits set, then
191 * set the parity bit to 1 in the phy capabilities. */
192 if ((parity_count % 2) != 0)
193 phy_cap.parity = 1;
194
195 writel(phy_cap.all, &sci_phy->link_layer_registers->phy_capabilities);
196
197 /* Set the enable spinup period but disable the ability to send
198 * notify enable spinup
199 */
200 writel(SCU_ENSPINUP_GEN_VAL(COUNT,
201 phy_user->notify_enable_spin_up_insertion_frequency),
202 &sci_phy->link_layer_registers->notify_enable_spinup_control);
203
204 /* Write the ALIGN Insertion Ferequency for connected phy and
205 * inpendent of connected state
206 */
207 clksm_value = SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(CONNECTED,
208 phy_user->in_connection_align_insertion_frequency);
209
210 clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL,
211 phy_user->align_insertion_frequency);
212
213 writel(clksm_value, &sci_phy->link_layer_registers->clock_skew_management);
214
215 /* @todo Provide a way to write this register correctly */
216 writel(0x02108421,
217 &sci_phy->link_layer_registers->afe_lookup_table_control);
218
219 llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT,
220 (u8)scic->user_parameters.sds1.no_outbound_task_timeout);
221
222 switch(phy_user->max_speed_generation) {
223 case SCIC_SDS_PARM_GEN3_SPEED:
224 link_rate = SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN3;
225 break;
226 case SCIC_SDS_PARM_GEN2_SPEED:
227 link_rate = SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN2;
228 break;
229 default:
230 link_rate = SCU_SAS_LINK_LAYER_CONTROL_MAX_LINK_RATE_GEN1;
231 break;
232 }
233 llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate);
234 writel(llctl, &sci_phy->link_layer_registers->link_layer_control);
235
236 if (is_a0() || is_a2()) {
237 /* Program the max ARB time for the PHY to 700us so we inter-operate with
238 * the PMC expander which shuts down PHYs if the expander PHY generates too
239 * many breaks. This time value will guarantee that the initiator PHY will
240 * generate the break.
241 */
242 writel(SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME,
243 &sci_phy->link_layer_registers->maximum_arbitration_wait_timer_timeout);
244 }
245
246 /*
247 * Set the link layer hang detection to 500ms (0x1F4) from its default
248 * value of 128ms. Max value is 511 ms.
249 */
250 writel(0x1F4, &sci_phy->link_layer_registers->link_layer_hang_detection_timeout);
251
252 /* We can exit the initial state to the stopped state */
253 sci_base_state_machine_change_state(&sci_phy->state_machine,
254 SCI_BASE_PHY_STATE_STOPPED);
255
256 return SCI_SUCCESS;
257 }
258
259 /**
260 * This function will handle the sata SIGNATURE FIS timeout condition. It will
261 * restart the starting substate machine since we dont know what has actually
262 * happening.
263 */
264 static void scic_sds_phy_sata_timeout(void *phy)
265 {
266 struct scic_sds_phy *sci_phy = phy;
267
268 dev_dbg(sciphy_to_dev(sci_phy),
269 "%s: SCIC SDS Phy 0x%p did not receive signature fis before "
270 "timeout.\n",
271 __func__,
272 sci_phy);
273
274 sci_base_state_machine_change_state(&sci_phy->state_machine,
275 SCI_BASE_PHY_STATE_STARTING);
276 }
277
278 /**
279 * This method returns the port currently containing this phy. If the phy is
280 * currently contained by the dummy port, then the phy is considered to not
281 * be part of a port.
282 * @sci_phy: This parameter specifies the phy for which to retrieve the
283 * containing port.
284 *
285 * This method returns a handle to a port that contains the supplied phy.
286 * NULL This value is returned if the phy is not part of a real
287 * port (i.e. it's contained in the dummy port). !NULL All other
288 * values indicate a handle/pointer to the port containing the phy.
289 */
290 struct scic_sds_port *scic_sds_phy_get_port(
291 struct scic_sds_phy *sci_phy)
292 {
293 if (scic_sds_port_get_index(sci_phy->owning_port) == SCIC_SDS_DUMMY_PORT)
294 return NULL;
295
296 return sci_phy->owning_port;
297 }
298
299 /**
300 * This method will assign a port to the phy object.
301 * @out]: sci_phy This parameter specifies the phy for which to assign a port
302 * object.
303 *
304 *
305 */
306 void scic_sds_phy_set_port(
307 struct scic_sds_phy *sci_phy,
308 struct scic_sds_port *sci_port)
309 {
310 sci_phy->owning_port = sci_port;
311
312 if (sci_phy->bcn_received_while_port_unassigned) {
313 sci_phy->bcn_received_while_port_unassigned = false;
314 scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy);
315 }
316 }
317
318 /**
319 * This method will initialize the constructed phy
320 * @sci_phy:
321 * @link_layer_registers:
322 *
323 * enum sci_status
324 */
325 enum sci_status scic_sds_phy_initialize(
326 struct scic_sds_phy *sci_phy,
327 struct scu_transport_layer_registers __iomem *transport_layer_registers,
328 struct scu_link_layer_registers __iomem *link_layer_registers)
329 {
330 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
331 struct isci_host *ihost = scic_to_ihost(scic);
332
333 /* Create the SIGNATURE FIS Timeout timer for this phy */
334 sci_phy->sata_timeout_timer =
335 isci_timer_create(
336 ihost,
337 sci_phy,
338 scic_sds_phy_sata_timeout);
339
340 /* Perfrom the initialization of the TL hardware */
341 scic_sds_phy_transport_layer_initialization(
342 sci_phy,
343 transport_layer_registers);
344
345 /* Perofrm the initialization of the PE hardware */
346 scic_sds_phy_link_layer_initialization(sci_phy, link_layer_registers);
347
348 /*
349 * There is nothing that needs to be done in this state just
350 * transition to the stopped state. */
351 sci_base_state_machine_change_state(&sci_phy->state_machine,
352 SCI_BASE_PHY_STATE_STOPPED);
353
354 return SCI_SUCCESS;
355 }
356
357 /**
358 * This method assigns the direct attached device ID for this phy.
359 *
360 * @sci_phy The phy for which the direct attached device id is to
361 * be assigned.
362 * @device_id The direct attached device ID to assign to the phy.
363 * This will either be the RNi for the device or an invalid RNi if there
364 * is no current device assigned to the phy.
365 */
366 void scic_sds_phy_setup_transport(
367 struct scic_sds_phy *sci_phy,
368 u32 device_id)
369 {
370 u32 tl_control;
371
372 writel(device_id, &sci_phy->transport_layer_registers->stp_rni);
373
374 /*
375 * The read should guarantee that the first write gets posted
376 * before the next write
377 */
378 tl_control = readl(&sci_phy->transport_layer_registers->control);
379 tl_control |= SCU_TLCR_GEN_BIT(CLEAR_TCI_NCQ_MAPPING_TABLE);
380 writel(tl_control, &sci_phy->transport_layer_registers->control);
381 }
382
383 /**
384 *
385 * @sci_phy: The phy object to be suspended.
386 *
387 * This function will perform the register reads/writes to suspend the SCU
388 * hardware protocol engine. none
389 */
390 static void scic_sds_phy_suspend(
391 struct scic_sds_phy *sci_phy)
392 {
393 u32 scu_sas_pcfg_value;
394
395 scu_sas_pcfg_value =
396 readl(&sci_phy->link_layer_registers->phy_configuration);
397 scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
398 writel(scu_sas_pcfg_value,
399 &sci_phy->link_layer_registers->phy_configuration);
400
401 scic_sds_phy_setup_transport(
402 sci_phy,
403 SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
404 }
405
406 void scic_sds_phy_resume(struct scic_sds_phy *sci_phy)
407 {
408 u32 scu_sas_pcfg_value;
409
410 scu_sas_pcfg_value =
411 readl(&sci_phy->link_layer_registers->phy_configuration);
412 scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
413 writel(scu_sas_pcfg_value,
414 &sci_phy->link_layer_registers->phy_configuration);
415 }
416
417 void scic_sds_phy_get_sas_address(struct scic_sds_phy *sci_phy,
418 struct sci_sas_address *sas_address)
419 {
420 sas_address->high = readl(&sci_phy->link_layer_registers->source_sas_address_high);
421 sas_address->low = readl(&sci_phy->link_layer_registers->source_sas_address_low);
422 }
423
424 void scic_sds_phy_get_attached_sas_address(struct scic_sds_phy *sci_phy,
425 struct sci_sas_address *sas_address)
426 {
427 struct sas_identify_frame *iaf;
428 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
429
430 iaf = &iphy->frame_rcvd.iaf;
431 memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE);
432 }
433
434 void scic_sds_phy_get_protocols(struct scic_sds_phy *sci_phy,
435 struct scic_phy_proto *protocols)
436 {
437 protocols->all =
438 (u16)(readl(&sci_phy->
439 link_layer_registers->transmit_identification) &
440 0x0000FFFF);
441 }
442
443 /**
444 * This method will attempt to start the phy object. This request is only valid
445 * when the phy is in the stopped state
446 * @sci_phy:
447 *
448 * enum sci_status
449 */
450 enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy)
451 {
452 return sci_phy->state_handlers->start_handler(sci_phy);
453 }
454
455 /**
456 * This method will attempt to stop the phy object.
457 * @sci_phy:
458 *
459 * enum sci_status SCI_SUCCESS if the phy is going to stop SCI_INVALID_STATE
460 * if the phy is not in a valid state to stop
461 */
462 enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy)
463 {
464 return sci_phy->state_handlers->stop_handler(sci_phy);
465 }
466
467 /**
468 * This method will attempt to reset the phy. This request is only valid when
469 * the phy is in an ready state
470 * @sci_phy:
471 *
472 * enum sci_status
473 */
474 enum sci_status scic_sds_phy_reset(
475 struct scic_sds_phy *sci_phy)
476 {
477 return sci_phy->state_handlers->reset_handler(sci_phy);
478 }
479
480 /**
481 * This method will process the event code received.
482 * @sci_phy:
483 * @event_code:
484 *
485 * enum sci_status
486 */
487 enum sci_status scic_sds_phy_event_handler(
488 struct scic_sds_phy *sci_phy,
489 u32 event_code)
490 {
491 return sci_phy->state_handlers->event_handler(sci_phy, event_code);
492 }
493
494 /**
495 * This method will process the frame index received.
496 * @sci_phy:
497 * @frame_index:
498 *
499 * enum sci_status
500 */
501 enum sci_status scic_sds_phy_frame_handler(
502 struct scic_sds_phy *sci_phy,
503 u32 frame_index)
504 {
505 return sci_phy->state_handlers->frame_handler(sci_phy, frame_index);
506 }
507
508 /**
509 * This method will give the phy permission to consume power
510 * @sci_phy:
511 *
512 * enum sci_status
513 */
514 enum sci_status scic_sds_phy_consume_power_handler(
515 struct scic_sds_phy *sci_phy)
516 {
517 return sci_phy->state_handlers->consume_power_handler(sci_phy);
518 }
519
520 /*
521 * *****************************************************************************
522 * * SCIC SDS PHY HELPER FUNCTIONS
523 * ***************************************************************************** */
524
525
526 /**
527 *
528 * @sci_phy: The phy object that received SAS PHY DETECTED.
529 *
530 * This method continues the link training for the phy as if it were a SAS PHY
531 * instead of a SATA PHY. This is done because the completion queue had a SAS
532 * PHY DETECTED event when the state machine was expecting a SATA PHY event.
533 * none
534 */
535 static void scic_sds_phy_start_sas_link_training(
536 struct scic_sds_phy *sci_phy)
537 {
538 u32 phy_control;
539
540 phy_control =
541 readl(&sci_phy->link_layer_registers->phy_configuration);
542 phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD);
543 writel(phy_control,
544 &sci_phy->link_layer_registers->phy_configuration);
545
546 sci_base_state_machine_change_state(
547 &sci_phy->state_machine,
548 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
549 );
550
551 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS;
552 }
553
554 /**
555 *
556 * @sci_phy: The phy object that received a SATA SPINUP HOLD event
557 *
558 * This method continues the link training for the phy as if it were a SATA PHY
559 * instead of a SAS PHY. This is done because the completion queue had a SATA
560 * SPINUP HOLD event when the state machine was expecting a SAS PHY event. none
561 */
562 static void scic_sds_phy_start_sata_link_training(
563 struct scic_sds_phy *sci_phy)
564 {
565 sci_base_state_machine_change_state(
566 &sci_phy->state_machine,
567 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
568 );
569
570 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA;
571 }
572
573 /**
574 * scic_sds_phy_complete_link_training - perform processing common to
575 * all protocols upon completion of link training.
576 * @sci_phy: This parameter specifies the phy object for which link training
577 * has completed.
578 * @max_link_rate: This parameter specifies the maximum link rate to be
579 * associated with this phy.
580 * @next_state: This parameter specifies the next state for the phy's starting
581 * sub-state machine.
582 *
583 */
584 static void scic_sds_phy_complete_link_training(
585 struct scic_sds_phy *sci_phy,
586 enum sas_linkrate max_link_rate,
587 u32 next_state)
588 {
589 sci_phy->max_negotiated_speed = max_link_rate;
590
591 sci_base_state_machine_change_state(&sci_phy->state_machine,
592 next_state);
593 }
594
595 static void scic_sds_phy_restart_starting_state(
596 struct scic_sds_phy *sci_phy)
597 {
598 /* Re-enter the base state machine starting state */
599 sci_base_state_machine_change_state(&sci_phy->state_machine,
600 SCI_BASE_PHY_STATE_STARTING);
601 }
602
603 /* ****************************************************************************
604 * SCIC SDS PHY general handlers
605 ************************************************************************** */
606 static enum sci_status scic_sds_phy_starting_substate_general_stop_handler(
607 struct scic_sds_phy *phy)
608 {
609 sci_base_state_machine_change_state(&phy->state_machine,
610 SCI_BASE_PHY_STATE_STOPPED);
611
612 return SCI_SUCCESS;
613 }
614
615 /*
616 * *****************************************************************************
617 * * SCIC SDS PHY EVENT_HANDLERS
618 * ***************************************************************************** */
619
620 /**
621 *
622 * @phy: This struct scic_sds_phy object which has received an event.
623 * @event_code: This is the event code which the phy object is to decode.
624 *
625 * This method is called when an event notification is received for the phy
626 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN. -
627 * decode the event - sas phy detected causes a state transition to the wait
628 * for speed event notification. - any other events log a warning message and
629 * set a failure status enum sci_status SCI_SUCCESS on any valid event notification
630 * SCI_FAILURE on any unexpected event notifation
631 */
632 static enum sci_status scic_sds_phy_starting_substate_await_ossp_event_handler(
633 struct scic_sds_phy *sci_phy,
634 u32 event_code)
635 {
636 u32 result = SCI_SUCCESS;
637
638 switch (scu_get_event_code(event_code)) {
639 case SCU_EVENT_SAS_PHY_DETECTED:
640 scic_sds_phy_start_sas_link_training(sci_phy);
641 sci_phy->is_in_link_training = true;
642 break;
643
644 case SCU_EVENT_SATA_SPINUP_HOLD:
645 scic_sds_phy_start_sata_link_training(sci_phy);
646 sci_phy->is_in_link_training = true;
647 break;
648
649 default:
650 dev_dbg(sciphy_to_dev(sci_phy),
651 "%s: PHY starting substate machine received "
652 "unexpected event_code %x\n",
653 __func__,
654 event_code);
655
656 result = SCI_FAILURE;
657 break;
658 }
659
660 return result;
661 }
662
663 /**
664 *
665 * @phy: This struct scic_sds_phy object which has received an event.
666 * @event_code: This is the event code which the phy object is to decode.
667 *
668 * This method is called when an event notification is received for the phy
669 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN. -
670 * decode the event - sas phy detected returns us back to this state. - speed
671 * event detected causes a state transition to the wait for iaf. - identify
672 * timeout is an un-expected event and the state machine is restarted. - link
673 * failure events restart the starting state machine - any other events log a
674 * warning message and set a failure status enum sci_status SCI_SUCCESS on any valid
675 * event notification SCI_FAILURE on any unexpected event notifation
676 */
677 static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler(
678 struct scic_sds_phy *sci_phy,
679 u32 event_code)
680 {
681 u32 result = SCI_SUCCESS;
682
683 switch (scu_get_event_code(event_code)) {
684 case SCU_EVENT_SAS_PHY_DETECTED:
685 /*
686 * Why is this being reported again by the controller?
687 * We would re-enter this state so just stay here */
688 break;
689
690 case SCU_EVENT_SAS_15:
691 case SCU_EVENT_SAS_15_SSC:
692 scic_sds_phy_complete_link_training(
693 sci_phy,
694 SAS_LINK_RATE_1_5_GBPS,
695 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF);
696 break;
697
698 case SCU_EVENT_SAS_30:
699 case SCU_EVENT_SAS_30_SSC:
700 scic_sds_phy_complete_link_training(
701 sci_phy,
702 SAS_LINK_RATE_3_0_GBPS,
703 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF);
704 break;
705
706 case SCU_EVENT_SAS_60:
707 case SCU_EVENT_SAS_60_SSC:
708 scic_sds_phy_complete_link_training(
709 sci_phy,
710 SAS_LINK_RATE_6_0_GBPS,
711 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF);
712 break;
713
714 case SCU_EVENT_SATA_SPINUP_HOLD:
715 /*
716 * We were doing SAS PHY link training and received a SATA PHY event
717 * continue OOB/SN as if this were a SATA PHY */
718 scic_sds_phy_start_sata_link_training(sci_phy);
719 break;
720
721 case SCU_EVENT_LINK_FAILURE:
722 /* Link failure change state back to the starting state */
723 scic_sds_phy_restart_starting_state(sci_phy);
724 break;
725
726 default:
727 dev_warn(sciphy_to_dev(sci_phy),
728 "%s: PHY starting substate machine received "
729 "unexpected event_code %x\n",
730 __func__,
731 event_code);
732
733 result = SCI_FAILURE;
734 break;
735 }
736
737 return result;
738 }
739
740 /**
741 *
742 * @phy: This struct scic_sds_phy object which has received an event.
743 * @event_code: This is the event code which the phy object is to decode.
744 *
745 * This method is called when an event notification is received for the phy
746 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF. -
747 * decode the event - sas phy detected event backs up the state machine to the
748 * await speed notification. - identify timeout is an un-expected event and the
749 * state machine is restarted. - link failure events restart the starting state
750 * machine - any other events log a warning message and set a failure status
751 * enum sci_status SCI_SUCCESS on any valid event notification SCI_FAILURE on any
752 * unexpected event notifation
753 */
754 static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler(
755 struct scic_sds_phy *sci_phy,
756 u32 event_code)
757 {
758 u32 result = SCI_SUCCESS;
759
760 switch (scu_get_event_code(event_code)) {
761 case SCU_EVENT_SAS_PHY_DETECTED:
762 /* Backup the state machine */
763 scic_sds_phy_start_sas_link_training(sci_phy);
764 break;
765
766 case SCU_EVENT_SATA_SPINUP_HOLD:
767 /*
768 * We were doing SAS PHY link training and received a SATA PHY event
769 * continue OOB/SN as if this were a SATA PHY */
770 scic_sds_phy_start_sata_link_training(sci_phy);
771 break;
772
773 case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT:
774 case SCU_EVENT_LINK_FAILURE:
775 case SCU_EVENT_HARD_RESET_RECEIVED:
776 /* Start the oob/sn state machine over again */
777 scic_sds_phy_restart_starting_state(sci_phy);
778 break;
779
780 default:
781 dev_warn(sciphy_to_dev(sci_phy),
782 "%s: PHY starting substate machine received "
783 "unexpected event_code %x\n",
784 __func__,
785 event_code);
786
787 result = SCI_FAILURE;
788 break;
789 }
790
791 return result;
792 }
793
794 /**
795 *
796 * @phy: This struct scic_sds_phy object which has received an event.
797 * @event_code: This is the event code which the phy object is to decode.
798 *
799 * This method is called when an event notification is received for the phy
800 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_POWER. -
801 * decode the event - link failure events restart the starting state machine -
802 * any other events log a warning message and set a failure status enum sci_status
803 * SCI_SUCCESS on a link failure event SCI_FAILURE on any unexpected event
804 * notifation
805 */
806 static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_handler(
807 struct scic_sds_phy *sci_phy,
808 u32 event_code)
809 {
810 u32 result = SCI_SUCCESS;
811
812 switch (scu_get_event_code(event_code)) {
813 case SCU_EVENT_LINK_FAILURE:
814 /* Link failure change state back to the starting state */
815 scic_sds_phy_restart_starting_state(sci_phy);
816 break;
817
818 default:
819 dev_warn(sciphy_to_dev(sci_phy),
820 "%s: PHY starting substate machine received unexpected "
821 "event_code %x\n",
822 __func__,
823 event_code);
824
825 result = SCI_FAILURE;
826 break;
827 }
828
829 return result;
830 }
831
832 /**
833 *
834 * @phy: This struct scic_sds_phy object which has received an event.
835 * @event_code: This is the event code which the phy object is to decode.
836 *
837 * This method is called when an event notification is received for the phy
838 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER. -
839 * decode the event - link failure events restart the starting state machine -
840 * sata spinup hold events are ignored since they are expected - any other
841 * events log a warning message and set a failure status enum sci_status SCI_SUCCESS
842 * on a link failure event SCI_FAILURE on any unexpected event notifation
843 */
844 static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_handler(
845 struct scic_sds_phy *sci_phy,
846 u32 event_code)
847 {
848 u32 result = SCI_SUCCESS;
849
850 switch (scu_get_event_code(event_code)) {
851 case SCU_EVENT_LINK_FAILURE:
852 /* Link failure change state back to the starting state */
853 scic_sds_phy_restart_starting_state(sci_phy);
854 break;
855
856 case SCU_EVENT_SATA_SPINUP_HOLD:
857 /* These events are received every 10ms and are expected while in this state */
858 break;
859
860 case SCU_EVENT_SAS_PHY_DETECTED:
861 /*
862 * There has been a change in the phy type before OOB/SN for the
863 * SATA finished start down the SAS link traning path. */
864 scic_sds_phy_start_sas_link_training(sci_phy);
865 break;
866
867 default:
868 dev_warn(sciphy_to_dev(sci_phy),
869 "%s: PHY starting substate machine received "
870 "unexpected event_code %x\n",
871 __func__,
872 event_code);
873
874 result = SCI_FAILURE;
875 break;
876 }
877
878 return result;
879 }
880
881 /**
882 * scic_sds_phy_starting_substate_await_sata_phy_event_handler -
883 * @phy: This struct scic_sds_phy object which has received an event.
884 * @event_code: This is the event code which the phy object is to decode.
885 *
886 * This method is called when an event notification is received for the phy
887 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN. -
888 * decode the event - link failure events restart the starting state machine -
889 * sata spinup hold events are ignored since they are expected - sata phy
890 * detected event change to the wait speed event - any other events log a
891 * warning message and set a failure status enum sci_status SCI_SUCCESS on a link
892 * failure event SCI_FAILURE on any unexpected event notifation
893 */
894 static enum sci_status scic_sds_phy_starting_substate_await_sata_phy_event_handler(
895 struct scic_sds_phy *sci_phy, u32 event_code)
896 {
897 u32 result = SCI_SUCCESS;
898
899 switch (scu_get_event_code(event_code)) {
900 case SCU_EVENT_LINK_FAILURE:
901 /* Link failure change state back to the starting state */
902 scic_sds_phy_restart_starting_state(sci_phy);
903 break;
904
905 case SCU_EVENT_SATA_SPINUP_HOLD:
906 /* These events might be received since we dont know how many may be in
907 * the completion queue while waiting for power
908 */
909 break;
910
911 case SCU_EVENT_SATA_PHY_DETECTED:
912 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA;
913
914 /* We have received the SATA PHY notification change state */
915 sci_base_state_machine_change_state(&sci_phy->state_machine,
916 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN);
917 break;
918
919 case SCU_EVENT_SAS_PHY_DETECTED:
920 /* There has been a change in the phy type before OOB/SN for the
921 * SATA finished start down the SAS link traning path.
922 */
923 scic_sds_phy_start_sas_link_training(sci_phy);
924 break;
925
926 default:
927 dev_warn(sciphy_to_dev(sci_phy),
928 "%s: PHY starting substate machine received "
929 "unexpected event_code %x\n",
930 __func__,
931 event_code);
932
933 result = SCI_FAILURE;
934 break;
935 }
936
937 return result;
938 }
939
940 /**
941 *
942 * @phy: This struct scic_sds_phy object which has received an event.
943 * @event_code: This is the event code which the phy object is to decode.
944 *
945 * This method is called when an event notification is received for the phy
946 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN.
947 * - decode the event - sata phy detected returns us back to this state. -
948 * speed event detected causes a state transition to the wait for signature. -
949 * link failure events restart the starting state machine - any other events
950 * log a warning message and set a failure status enum sci_status SCI_SUCCESS on any
951 * valid event notification SCI_FAILURE on any unexpected event notifation
952 */
953 static enum sci_status scic_sds_phy_starting_substate_await_sata_speed_event_handler(
954 struct scic_sds_phy *sci_phy,
955 u32 event_code)
956 {
957 u32 result = SCI_SUCCESS;
958
959 switch (scu_get_event_code(event_code)) {
960 case SCU_EVENT_SATA_PHY_DETECTED:
961 /*
962 * The hardware reports multiple SATA PHY detected events
963 * ignore the extras */
964 break;
965
966 case SCU_EVENT_SATA_15:
967 case SCU_EVENT_SATA_15_SSC:
968 scic_sds_phy_complete_link_training(
969 sci_phy,
970 SAS_LINK_RATE_1_5_GBPS,
971 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
972 break;
973
974 case SCU_EVENT_SATA_30:
975 case SCU_EVENT_SATA_30_SSC:
976 scic_sds_phy_complete_link_training(
977 sci_phy,
978 SAS_LINK_RATE_3_0_GBPS,
979 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
980 break;
981
982 case SCU_EVENT_SATA_60:
983 case SCU_EVENT_SATA_60_SSC:
984 scic_sds_phy_complete_link_training(
985 sci_phy,
986 SAS_LINK_RATE_6_0_GBPS,
987 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
988 break;
989
990 case SCU_EVENT_LINK_FAILURE:
991 /* Link failure change state back to the starting state */
992 scic_sds_phy_restart_starting_state(sci_phy);
993 break;
994
995 case SCU_EVENT_SAS_PHY_DETECTED:
996 /*
997 * There has been a change in the phy type before OOB/SN for the
998 * SATA finished start down the SAS link traning path. */
999 scic_sds_phy_start_sas_link_training(sci_phy);
1000 break;
1001
1002 default:
1003 dev_warn(sciphy_to_dev(sci_phy),
1004 "%s: PHY starting substate machine received "
1005 "unexpected event_code %x\n",
1006 __func__,
1007 event_code);
1008
1009 result = SCI_FAILURE;
1010 break;
1011 }
1012
1013 return result;
1014 }
1015
1016 /**
1017 * scic_sds_phy_starting_substate_await_sig_fis_event_handler -
1018 * @phy: This struct scic_sds_phy object which has received an event.
1019 * @event_code: This is the event code which the phy object is to decode.
1020 *
1021 * This method is called when an event notification is received for the phy
1022 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. -
1023 * decode the event - sas phy detected event backs up the state machine to the
1024 * await speed notification. - identify timeout is an un-expected event and the
1025 * state machine is restarted. - link failure events restart the starting state
1026 * machine - any other events log a warning message and set a failure status
1027 * enum sci_status SCI_SUCCESS on any valid event notification SCI_FAILURE on any
1028 * unexpected event notifation
1029 */
1030 static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_event_handler(
1031 struct scic_sds_phy *sci_phy, u32 event_code)
1032 {
1033 u32 result = SCI_SUCCESS;
1034
1035 switch (scu_get_event_code(event_code)) {
1036 case SCU_EVENT_SATA_PHY_DETECTED:
1037 /* Backup the state machine */
1038 sci_base_state_machine_change_state(&sci_phy->state_machine,
1039 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN);
1040 break;
1041
1042 case SCU_EVENT_LINK_FAILURE:
1043 /* Link failure change state back to the starting state */
1044 scic_sds_phy_restart_starting_state(sci_phy);
1045 break;
1046
1047 default:
1048 dev_warn(sciphy_to_dev(sci_phy),
1049 "%s: PHY starting substate machine received "
1050 "unexpected event_code %x\n",
1051 __func__,
1052 event_code);
1053
1054 result = SCI_FAILURE;
1055 break;
1056 }
1057
1058 return result;
1059 }
1060
1061
1062 /*
1063 * *****************************************************************************
1064 * * SCIC SDS PHY FRAME_HANDLERS
1065 * ***************************************************************************** */
1066
1067 /**
1068 *
1069 * @phy: This is struct scic_sds_phy object which is being requested to decode the
1070 * frame data.
1071 * @frame_index: This is the index of the unsolicited frame which was received
1072 * for this phy.
1073 *
1074 * This method decodes the unsolicited frame when the struct scic_sds_phy is in the
1075 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF. - Get the UF Header - If the UF
1076 * is an IAF - Copy IAF data to local phy object IAF data buffer. - Change
1077 * starting substate to wait power. - else - log warning message of unexpected
1078 * unsolicted frame - release frame buffer enum sci_status SCI_SUCCESS
1079 */
1080 static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_frame_handler(
1081 struct scic_sds_phy *sci_phy, u32 frame_index)
1082 {
1083 enum sci_status result;
1084 u32 *frame_words;
1085 struct sas_identify_frame iaf;
1086 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
1087
1088 result = scic_sds_unsolicited_frame_control_get_header(
1089 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
1090 frame_index,
1091 (void **)&frame_words);
1092
1093 if (result != SCI_SUCCESS)
1094 return result;
1095
1096 sci_swab32_cpy(&iaf, frame_words, sizeof(iaf) / sizeof(u32));
1097 if (iaf.frame_type == 0) {
1098 u32 state;
1099
1100 memcpy(&iphy->frame_rcvd.iaf, &iaf, sizeof(iaf));
1101 if (iaf.smp_tport) {
1102 /* We got the IAF for an expander PHY go to the final
1103 * state since there are no power requirements for
1104 * expander phys.
1105 */
1106 state = SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL;
1107 } else {
1108 /* We got the IAF we can now go to the await spinup
1109 * semaphore state
1110 */
1111 state = SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER;
1112 }
1113 sci_base_state_machine_change_state(
1114 &sci_phy->state_machine,
1115 state);
1116 result = SCI_SUCCESS;
1117 } else
1118 dev_warn(sciphy_to_dev(sci_phy),
1119 "%s: PHY starting substate machine received "
1120 "unexpected frame id %x\n",
1121 __func__,
1122 frame_index);
1123
1124 scic_sds_controller_release_frame(scic_sds_phy_get_controller(sci_phy),
1125 frame_index);
1126
1127 return result;
1128 }
1129
1130 /**
1131 *
1132 * @phy: This is struct scic_sds_phy object which is being requested to decode the
1133 * frame data.
1134 * @frame_index: This is the index of the unsolicited frame which was received
1135 * for this phy.
1136 *
1137 * This method decodes the unsolicited frame when the struct scic_sds_phy is in the
1138 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. - Get the UF Header - If
1139 * the UF is an SIGNATURE FIS - Copy IAF data to local phy object SIGNATURE FIS
1140 * data buffer. - else - log warning message of unexpected unsolicted frame -
1141 * release frame buffer enum sci_status SCI_SUCCESS Must decode the SIGNATURE FIS
1142 * data
1143 */
1144 static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handler(
1145 struct scic_sds_phy *sci_phy,
1146 u32 frame_index)
1147 {
1148 enum sci_status result;
1149 struct dev_to_host_fis *frame_header;
1150 u32 *fis_frame_data;
1151 struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
1152
1153 result = scic_sds_unsolicited_frame_control_get_header(
1154 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
1155 frame_index,
1156 (void **)&frame_header);
1157
1158 if (result != SCI_SUCCESS)
1159 return result;
1160
1161 if ((frame_header->fis_type == FIS_REGD2H) &&
1162 !(frame_header->status & ATA_BUSY)) {
1163 scic_sds_unsolicited_frame_control_get_buffer(
1164 &(scic_sds_phy_get_controller(sci_phy)->uf_control),
1165 frame_index,
1166 (void **)&fis_frame_data);
1167
1168 scic_sds_controller_copy_sata_response(&iphy->frame_rcvd.fis,
1169 frame_header,
1170 fis_frame_data);
1171
1172 /* got IAF we can now go to the await spinup semaphore state */
1173 sci_base_state_machine_change_state(&sci_phy->state_machine,
1174 SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL);
1175
1176 result = SCI_SUCCESS;
1177 } else
1178 dev_warn(sciphy_to_dev(sci_phy),
1179 "%s: PHY starting substate machine received "
1180 "unexpected frame id %x\n",
1181 __func__,
1182 frame_index);
1183
1184 /* Regardless of the result we are done with this frame with it */
1185 scic_sds_controller_release_frame(scic_sds_phy_get_controller(sci_phy),
1186 frame_index);
1187
1188 return result;
1189 }
1190
1191 /*
1192 * *****************************************************************************
1193 * * SCIC SDS PHY POWER_HANDLERS
1194 * ***************************************************************************** */
1195
1196 /*
1197 * This method is called by the struct scic_sds_controller when the phy object is
1198 * granted power. - The notify enable spinups are turned on for this phy object
1199 * - The phy state machine is transitioned to the
1200 * SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL. enum sci_status SCI_SUCCESS
1201 */
1202 static enum sci_status scic_sds_phy_starting_substate_await_sas_power_consume_power_handler(
1203 struct scic_sds_phy *sci_phy)
1204 {
1205 u32 enable_spinup;
1206
1207 enable_spinup = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control);
1208 enable_spinup |= SCU_ENSPINUP_GEN_BIT(ENABLE);
1209 writel(enable_spinup, &sci_phy->link_layer_registers->notify_enable_spinup_control);
1210
1211 /* Change state to the final state this substate machine has run to completion */
1212 sci_base_state_machine_change_state(&sci_phy->state_machine,
1213 SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL);
1214
1215 return SCI_SUCCESS;
1216 }
1217
1218 /*
1219 * This method is called by the struct scic_sds_controller when the phy object is
1220 * granted power. - The phy state machine is transitioned to the
1221 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN. enum sci_status SCI_SUCCESS
1222 */
1223 static enum sci_status scic_sds_phy_starting_substate_await_sata_power_consume_power_handler(
1224 struct scic_sds_phy *sci_phy)
1225 {
1226 u32 scu_sas_pcfg_value;
1227
1228 /* Release the spinup hold state and reset the OOB state machine */
1229 scu_sas_pcfg_value =
1230 readl(&sci_phy->link_layer_registers->phy_configuration);
1231 scu_sas_pcfg_value &=
1232 ~(SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD) | SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE));
1233 scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
1234 writel(scu_sas_pcfg_value,
1235 &sci_phy->link_layer_registers->phy_configuration);
1236
1237 /* Now restart the OOB operation */
1238 scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
1239 scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
1240 writel(scu_sas_pcfg_value,
1241 &sci_phy->link_layer_registers->phy_configuration);
1242
1243 /* Change state to the final state this substate machine has run to completion */
1244 sci_base_state_machine_change_state(&sci_phy->state_machine,
1245 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN);
1246
1247 return SCI_SUCCESS;
1248 }
1249
1250 static enum sci_status default_phy_handler(struct scic_sds_phy *sci_phy,
1251 const char *func)
1252 {
1253 dev_dbg(sciphy_to_dev(sci_phy),
1254 "%s: in wrong state: %d\n", func,
1255 sci_base_state_machine_get_state(&sci_phy->state_machine));
1256 return SCI_FAILURE_INVALID_STATE;
1257 }
1258
1259 static enum sci_status
1260 scic_sds_phy_default_start_handler(struct scic_sds_phy *sci_phy)
1261 {
1262 return default_phy_handler(sci_phy, __func__);
1263 }
1264
1265 static enum sci_status
1266 scic_sds_phy_default_stop_handler(struct scic_sds_phy *sci_phy)
1267 {
1268 return default_phy_handler(sci_phy, __func__);
1269 }
1270
1271 static enum sci_status
1272 scic_sds_phy_default_reset_handler(struct scic_sds_phy *sci_phy)
1273 {
1274 return default_phy_handler(sci_phy, __func__);
1275 }
1276
1277 static enum sci_status
1278 scic_sds_phy_default_destroy_handler(struct scic_sds_phy *sci_phy)
1279 {
1280 return default_phy_handler(sci_phy, __func__);
1281 }
1282
1283 static enum sci_status
1284 scic_sds_phy_default_frame_handler(struct scic_sds_phy *sci_phy,
1285 u32 frame_index)
1286 {
1287 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
1288
1289 default_phy_handler(sci_phy, __func__);
1290 scic_sds_controller_release_frame(scic, frame_index);
1291
1292 return SCI_FAILURE_INVALID_STATE;
1293 }
1294
1295 static enum sci_status
1296 scic_sds_phy_default_event_handler(struct scic_sds_phy *sci_phy,
1297 u32 event_code)
1298 {
1299 return default_phy_handler(sci_phy, __func__);
1300 }
1301
1302 static enum sci_status
1303 scic_sds_phy_default_consume_power_handler(struct scic_sds_phy *sci_phy)
1304 {
1305 return default_phy_handler(sci_phy, __func__);
1306 }
1307
1308 /*
1309 * This method takes the struct scic_sds_phy from a stopped state and
1310 * attempts to start it. - The phy state machine is transitioned to the
1311 * SCI_BASE_PHY_STATE_STARTING. enum sci_status SCI_SUCCESS
1312 */
1313 static enum sci_status
1314 scic_sds_phy_stopped_state_start_handler(struct scic_sds_phy *sci_phy)
1315 {
1316 struct isci_host *ihost;
1317 struct scic_sds_controller *scic;
1318
1319 scic = scic_sds_phy_get_controller(sci_phy),
1320 ihost = scic_to_ihost(scic);
1321
1322 /* Create the SIGNATURE FIS Timeout timer for this phy */
1323 sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy,
1324 scic_sds_phy_sata_timeout);
1325
1326 if (sci_phy->sata_timeout_timer)
1327 sci_base_state_machine_change_state(&sci_phy->state_machine,
1328 SCI_BASE_PHY_STATE_STARTING);
1329
1330 return SCI_SUCCESS;
1331 }
1332
1333 static enum sci_status
1334 scic_sds_phy_stopped_state_destroy_handler(struct scic_sds_phy *sci_phy)
1335 {
1336 return SCI_SUCCESS;
1337 }
1338
1339 static enum sci_status
1340 scic_sds_phy_ready_state_stop_handler(struct scic_sds_phy *sci_phy)
1341 {
1342 sci_base_state_machine_change_state(&sci_phy->state_machine,
1343 SCI_BASE_PHY_STATE_STOPPED);
1344
1345 return SCI_SUCCESS;
1346 }
1347
1348 static enum sci_status
1349 scic_sds_phy_ready_state_reset_handler(struct scic_sds_phy *sci_phy)
1350 {
1351 sci_base_state_machine_change_state(&sci_phy->state_machine,
1352 SCI_BASE_PHY_STATE_RESETTING);
1353
1354 return SCI_SUCCESS;
1355 }
1356
1357 /**
1358 * scic_sds_phy_ready_state_event_handler -
1359 * @phy: This is the struct scic_sds_phy object which has received the event.
1360 *
1361 * This method request the struct scic_sds_phy handle the received event. The only
1362 * event that we are interested in while in the ready state is the link failure
1363 * event. - decoded event is a link failure - transition the struct scic_sds_phy back
1364 * to the SCI_BASE_PHY_STATE_STARTING state. - any other event received will
1365 * report a warning message enum sci_status SCI_SUCCESS if the event received is a
1366 * link failure SCI_FAILURE_INVALID_STATE for any other event received.
1367 */
1368 static enum sci_status scic_sds_phy_ready_state_event_handler(struct scic_sds_phy *sci_phy,
1369 u32 event_code)
1370 {
1371 enum sci_status result = SCI_FAILURE;
1372
1373 switch (scu_get_event_code(event_code)) {
1374 case SCU_EVENT_LINK_FAILURE:
1375 /* Link failure change state back to the starting state */
1376 sci_base_state_machine_change_state(&sci_phy->state_machine,
1377 SCI_BASE_PHY_STATE_STARTING);
1378 result = SCI_SUCCESS;
1379 break;
1380
1381 case SCU_EVENT_BROADCAST_CHANGE:
1382 /* Broadcast change received. Notify the port. */
1383 if (scic_sds_phy_get_port(sci_phy) != NULL)
1384 scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy);
1385 else
1386 sci_phy->bcn_received_while_port_unassigned = true;
1387 break;
1388
1389 default:
1390 dev_warn(sciphy_to_dev(sci_phy),
1391 "%sP SCIC PHY 0x%p ready state machine received "
1392 "unexpected event_code %x\n",
1393 __func__, sci_phy, event_code);
1394
1395 result = SCI_FAILURE_INVALID_STATE;
1396 break;
1397 }
1398
1399 return result;
1400 }
1401
1402 static enum sci_status scic_sds_phy_resetting_state_event_handler(struct scic_sds_phy *sci_phy,
1403 u32 event_code)
1404 {
1405 enum sci_status result = SCI_FAILURE;
1406
1407 switch (scu_get_event_code(event_code)) {
1408 case SCU_EVENT_HARD_RESET_TRANSMITTED:
1409 /* Link failure change state back to the starting state */
1410 sci_base_state_machine_change_state(&sci_phy->state_machine,
1411 SCI_BASE_PHY_STATE_STARTING);
1412 result = SCI_SUCCESS;
1413 break;
1414
1415 default:
1416 dev_warn(sciphy_to_dev(sci_phy),
1417 "%s: SCIC PHY 0x%p resetting state machine received "
1418 "unexpected event_code %x\n",
1419 __func__, sci_phy, event_code);
1420
1421 result = SCI_FAILURE_INVALID_STATE;
1422 break;
1423 }
1424
1425 return result;
1426 }
1427
1428 /* --------------------------------------------------------------------------- */
1429
1430 static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = {
1431 [SCI_BASE_PHY_STATE_INITIAL] = {
1432 .start_handler = scic_sds_phy_default_start_handler,
1433 .stop_handler = scic_sds_phy_default_stop_handler,
1434 .reset_handler = scic_sds_phy_default_reset_handler,
1435 .destruct_handler = scic_sds_phy_default_destroy_handler,
1436 .frame_handler = scic_sds_phy_default_frame_handler,
1437 .event_handler = scic_sds_phy_default_event_handler,
1438 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1439 },
1440 [SCI_BASE_PHY_STATE_STOPPED] = {
1441 .start_handler = scic_sds_phy_stopped_state_start_handler,
1442 .stop_handler = scic_sds_phy_default_stop_handler,
1443 .reset_handler = scic_sds_phy_default_reset_handler,
1444 .destruct_handler = scic_sds_phy_stopped_state_destroy_handler,
1445 .frame_handler = scic_sds_phy_default_frame_handler,
1446 .event_handler = scic_sds_phy_default_event_handler,
1447 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1448 },
1449 [SCI_BASE_PHY_STATE_STARTING] = {
1450 .start_handler = scic_sds_phy_default_start_handler,
1451 .stop_handler = scic_sds_phy_default_stop_handler,
1452 .reset_handler = scic_sds_phy_default_reset_handler,
1453 .destruct_handler = scic_sds_phy_default_destroy_handler,
1454 .frame_handler = scic_sds_phy_default_frame_handler,
1455 .event_handler = scic_sds_phy_default_event_handler,
1456 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1457 },
1458 [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = {
1459 .start_handler = scic_sds_phy_default_start_handler,
1460 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1461 .reset_handler = scic_sds_phy_default_reset_handler,
1462 .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
1466 },
1467 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = {
1468 .start_handler = scic_sds_phy_default_start_handler,
1469 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1470 .reset_handler = scic_sds_phy_default_reset_handler,
1471 .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
1475 },
1476 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = {
1477 .start_handler = scic_sds_phy_default_start_handler,
1478 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1479 .reset_handler = scic_sds_phy_default_reset_handler,
1480 .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
1484 },
1485 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = {
1486 .start_handler = scic_sds_phy_default_start_handler,
1487 .stop_handler = scic_sds_phy_default_stop_handler,
1488 .reset_handler = scic_sds_phy_default_reset_handler,
1489 .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
1493 },
1494 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = {
1495 .start_handler = scic_sds_phy_default_start_handler,
1496 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1497 .reset_handler = scic_sds_phy_default_reset_handler,
1498 .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
1502 },
1503 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = {
1504 .start_handler = scic_sds_phy_default_start_handler,
1505 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1506 .reset_handler = scic_sds_phy_default_reset_handler,
1507 .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
1511 },
1512 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = {
1513 .start_handler = scic_sds_phy_default_start_handler,
1514 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1515 .reset_handler = scic_sds_phy_default_reset_handler,
1516 .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
1520 },
1521 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = {
1522 .start_handler = scic_sds_phy_default_start_handler,
1523 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1524 .reset_handler = scic_sds_phy_default_reset_handler,
1525 .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
1529 },
1530 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = {
1531 .start_handler = scic_sds_phy_default_start_handler,
1532 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1533 .reset_handler = scic_sds_phy_default_reset_handler,
1534 .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
1538 },
1539 [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = {
1540 .start_handler = scic_sds_phy_default_start_handler,
1541 .stop_handler = scic_sds_phy_starting_substate_general_stop_handler,
1542 .reset_handler = scic_sds_phy_default_reset_handler,
1543 .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
1547 },
1548 [SCI_BASE_PHY_STATE_READY] = {
1549 .start_handler = scic_sds_phy_default_start_handler,
1550 .stop_handler = scic_sds_phy_ready_state_stop_handler,
1551 .reset_handler = scic_sds_phy_ready_state_reset_handler,
1552 .destruct_handler = scic_sds_phy_default_destroy_handler,
1553 .frame_handler = scic_sds_phy_default_frame_handler,
1554 .event_handler = scic_sds_phy_ready_state_event_handler,
1555 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1556 },
1557 [SCI_BASE_PHY_STATE_RESETTING] = {
1558 .start_handler = scic_sds_phy_default_start_handler,
1559 .stop_handler = scic_sds_phy_default_stop_handler,
1560 .reset_handler = scic_sds_phy_default_reset_handler,
1561 .destruct_handler = scic_sds_phy_default_destroy_handler,
1562 .frame_handler = scic_sds_phy_default_frame_handler,
1563 .event_handler = scic_sds_phy_resetting_state_event_handler,
1564 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1565 },
1566 [SCI_BASE_PHY_STATE_FINAL] = {
1567 .start_handler = scic_sds_phy_default_start_handler,
1568 .stop_handler = scic_sds_phy_default_stop_handler,
1569 .reset_handler = scic_sds_phy_default_reset_handler,
1570 .destruct_handler = scic_sds_phy_default_destroy_handler,
1571 .frame_handler = scic_sds_phy_default_frame_handler,
1572 .event_handler = scic_sds_phy_default_event_handler,
1573 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1574 }
1575 };
1576
1577 /*
1578 * ****************************************************************************
1579 * * PHY STARTING SUBSTATE METHODS
1580 * **************************************************************************** */
1581
1582 /**
1583 * scic_sds_phy_starting_initial_substate_enter -
1584 * @object: This is the object which is cast to a struct scic_sds_phy object.
1585 *
1586 * This method will perform the actions required by the struct scic_sds_phy on
1587 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL. - The initial state
1588 * handlers are put in place for the struct scic_sds_phy object. - The state is
1589 * changed to the wait phy type event notification. none
1590 */
1591 static void scic_sds_phy_starting_initial_substate_enter(void *object)
1592 {
1593 struct scic_sds_phy *sci_phy = object;
1594
1595 scic_sds_phy_set_base_state_handlers(
1596 sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL);
1597
1598 /* This is just an temporary state go off to the starting state */
1599 sci_base_state_machine_change_state(&sci_phy->state_machine,
1600 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN);
1601 }
1602
1603 /**
1604 *
1605 * @object: This is the object which is cast to a struct scic_sds_phy object.
1606 *
1607 * This method will perform the actions required by the struct scic_sds_phy on
1608 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_PHY_TYPE_EN. - Set the
1609 * struct scic_sds_phy object state handlers for this state. none
1610 */
1611 static void scic_sds_phy_starting_await_ossp_en_substate_enter(void *object)
1612 {
1613 struct scic_sds_phy *sci_phy = object;
1614
1615 scic_sds_phy_set_base_state_handlers(
1616 sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN
1617 );
1618 }
1619
1620 /**
1621 *
1622 * @object: This is the object which is cast to a struct scic_sds_phy object.
1623 *
1624 * This method will perform the actions required by the struct scic_sds_phy on
1625 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN. - Set the
1626 * struct scic_sds_phy object state handlers for this state. none
1627 */
1628 static void scic_sds_phy_starting_await_sas_speed_en_substate_enter(
1629 void *object)
1630 {
1631 struct scic_sds_phy *sci_phy = object;
1632
1633 scic_sds_phy_set_base_state_handlers(
1634 sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
1635 );
1636 }
1637
1638 /**
1639 *
1640 * @object: This is the object which is cast to a struct scic_sds_phy object.
1641 *
1642 * This method will perform the actions required by the struct scic_sds_phy on
1643 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF. - Set the
1644 * struct scic_sds_phy object state handlers for this state. none
1645 */
1646 static void scic_sds_phy_starting_await_iaf_uf_substate_enter(void *object)
1647 {
1648 struct scic_sds_phy *sci_phy = object;
1649
1650 scic_sds_phy_set_base_state_handlers(
1651 sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
1652 );
1653 }
1654
1655 /**
1656 *
1657 * @object: This is the object which is cast to a struct scic_sds_phy object.
1658 *
1659 * This method will perform the actions required by the struct scic_sds_phy on
1660 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER. - Set the
1661 * struct scic_sds_phy object state handlers for this state. - Add this phy object to
1662 * the power control queue none
1663 */
1664 static void scic_sds_phy_starting_await_sas_power_substate_enter(void *object)
1665 {
1666 struct scic_sds_phy *sci_phy = object;
1667
1668 scic_sds_phy_set_base_state_handlers(
1669 sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
1670 );
1671
1672 scic_sds_controller_power_control_queue_insert(
1673 scic_sds_phy_get_controller(sci_phy),
1674 sci_phy
1675 );
1676 }
1677
1678 /**
1679 *
1680 * @object: This is the object which is cast to a struct scic_sds_phy object.
1681 *
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
1685 */
1686 static void scic_sds_phy_starting_await_sas_power_substate_exit(void *object)
1687 {
1688 struct scic_sds_phy *sci_phy = object;
1689
1690 scic_sds_controller_power_control_queue_remove(
1691 scic_sds_phy_get_controller(sci_phy), sci_phy
1692 );
1693 }
1694
1695 /**
1696 *
1697 * @object: This is the object which is cast to a struct scic_sds_phy object.
1698 *
1699 * This method will perform the actions required by the struct scic_sds_phy on
1700 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER. - Set the
1701 * struct scic_sds_phy object state handlers for this state. - Add this phy object to
1702 * the power control queue none
1703 */
1704 static void scic_sds_phy_starting_await_sata_power_substate_enter(void *object)
1705 {
1706 struct scic_sds_phy *sci_phy = object;
1707
1708 scic_sds_phy_set_base_state_handlers(
1709 sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
1710 );
1711
1712 scic_sds_controller_power_control_queue_insert(
1713 scic_sds_phy_get_controller(sci_phy),
1714 sci_phy
1715 );
1716 }
1717
1718 /**
1719 *
1720 * @object: This is the object which is cast to a struct scic_sds_phy object.
1721 *
1722 * This method will perform the actions required by the struct scic_sds_phy on exiting
1723 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER. - Remove the
1724 * struct scic_sds_phy object from the power control queue. none
1725 */
1726 static void scic_sds_phy_starting_await_sata_power_substate_exit(void *object)
1727 {
1728 struct scic_sds_phy *sci_phy = object;
1729
1730 scic_sds_controller_power_control_queue_remove(
1731 scic_sds_phy_get_controller(sci_phy),
1732 sci_phy
1733 );
1734 }
1735
1736 /**
1737 *
1738 * @object: This is the object which is cast to a struct scic_sds_phy object.
1739 *
1740 * This function will perform the actions required by the struct scic_sds_phy on
1741 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN. - Set the
1742 * struct scic_sds_phy object state handlers for this state. none
1743 */
1744 static void scic_sds_phy_starting_await_sata_phy_substate_enter(void *object)
1745 {
1746 struct scic_sds_phy *sci_phy = object;
1747
1748 scic_sds_phy_set_base_state_handlers(
1749 sci_phy,
1750 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN);
1751
1752 isci_timer_start(sci_phy->sata_timeout_timer,
1753 SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
1754 }
1755
1756 /**
1757 *
1758 * @object: This is the object which is cast to a struct scic_sds_phy object.
1759 *
1760 * This method will perform the actions required by the struct scic_sds_phy
1761 * on exiting
1762 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN. - stop the timer
1763 * that was started on entry to await sata phy event notification none
1764 */
1765 static inline void scic_sds_phy_starting_await_sata_phy_substate_exit(
1766 void *object)
1767 {
1768 struct scic_sds_phy *sci_phy = object;
1769
1770 isci_timer_stop(sci_phy->sata_timeout_timer);
1771 }
1772
1773 /**
1774 *
1775 * @object: This is the object which is cast to a struct scic_sds_phy object.
1776 *
1777 * This method will perform the actions required by the struct scic_sds_phy on
1778 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN. - Set the
1779 * struct scic_sds_phy object state handlers for this state. none
1780 */
1781 static void scic_sds_phy_starting_await_sata_speed_substate_enter(void *object)
1782 {
1783 struct scic_sds_phy *sci_phy = object;
1784
1785 scic_sds_phy_set_base_state_handlers(
1786 sci_phy,
1787 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN);
1788
1789 isci_timer_start(sci_phy->sata_timeout_timer,
1790 SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT);
1791 }
1792
1793 /**
1794 *
1795 * @object: This is the object which is cast to a struct scic_sds_phy object.
1796 *
1797 * This function will perform the actions required by the
1798 * struct scic_sds_phy on exiting
1799 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN. - stop the timer
1800 * that was started on entry to await sata phy event notification none
1801 */
1802 static inline void scic_sds_phy_starting_await_sata_speed_substate_exit(
1803 void *object)
1804 {
1805 struct scic_sds_phy *sci_phy = object;
1806
1807 isci_timer_stop(sci_phy->sata_timeout_timer);
1808 }
1809
1810 /**
1811 *
1812 * @object: This is the object which is cast to a struct scic_sds_phy object.
1813 *
1814 * This function will perform the actions required by the struct scic_sds_phy on
1815 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. - Set the
1816 * struct scic_sds_phy object state handlers for this state.
1817 * - Start the SIGNATURE FIS
1818 * timeout timer none
1819 */
1820 static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(void *object)
1821 {
1822 bool continue_to_ready_state;
1823 struct scic_sds_phy *sci_phy = object;
1824
1825 scic_sds_phy_set_base_state_handlers(
1826 sci_phy,
1827 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
1828
1829 continue_to_ready_state = scic_sds_port_link_detected(
1830 sci_phy->owning_port,
1831 sci_phy);
1832
1833 if (continue_to_ready_state) {
1834 /*
1835 * Clear the PE suspend condition so we can actually
1836 * receive SIG FIS
1837 * The hardware will not respond to the XRDY until the PE
1838 * suspend condition is cleared.
1839 */
1840 scic_sds_phy_resume(sci_phy);
1841
1842 isci_timer_start(sci_phy->sata_timeout_timer,
1843 SCIC_SDS_SIGNATURE_FIS_TIMEOUT);
1844 } else
1845 sci_phy->is_in_link_training = false;
1846 }
1847
1848 /**
1849 *
1850 * @object: This is the object which is cast to a struct scic_sds_phy object.
1851 *
1852 * This function will perform the actions required by the
1853 * struct scic_sds_phy on exiting
1854 * the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF. - Stop the SIGNATURE
1855 * FIS timeout timer. none
1856 */
1857 static inline void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(
1858 void *object)
1859 {
1860 struct scic_sds_phy *sci_phy = object;
1861
1862 isci_timer_stop(sci_phy->sata_timeout_timer);
1863 }
1864
1865 /**
1866 *
1867 * @object: This is the object which is cast to a struct scic_sds_phy object.
1868 *
1869 * This method will perform the actions required by the struct scic_sds_phy on
1870 * entering the SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL. - Set the struct scic_sds_phy
1871 * object state handlers for this state. - Change base state machine to the
1872 * ready state. none
1873 */
1874 static void scic_sds_phy_starting_final_substate_enter(void *object)
1875 {
1876 struct scic_sds_phy *sci_phy = object;
1877
1878 scic_sds_phy_set_base_state_handlers(sci_phy,
1879 SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL);
1880
1881 /* State machine has run to completion so exit out and change
1882 * the base state machine to the ready state
1883 */
1884 sci_base_state_machine_change_state(&sci_phy->state_machine,
1885 SCI_BASE_PHY_STATE_READY);
1886 }
1887
1888 /*
1889 * ****************************************************************************
1890 * * PHY STATE PRIVATE METHODS
1891 * **************************************************************************** */
1892
1893 /**
1894 *
1895 * @sci_phy: This is the struct scic_sds_phy object to stop.
1896 *
1897 * This method will stop the struct scic_sds_phy object. This does not reset the
1898 * protocol engine it just suspends it and places it in a state where it will
1899 * not cause the end device to power up. none
1900 */
1901 static void scu_link_layer_stop_protocol_engine(
1902 struct scic_sds_phy *sci_phy)
1903 {
1904 u32 scu_sas_pcfg_value;
1905 u32 enable_spinup_value;
1906
1907 /* Suspend the protocol engine and place it in a sata spinup hold state */
1908 scu_sas_pcfg_value =
1909 readl(&sci_phy->link_layer_registers->phy_configuration);
1910 scu_sas_pcfg_value |=
1911 (SCU_SAS_PCFG_GEN_BIT(OOB_RESET) |
1912 SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE) |
1913 SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD));
1914 writel(scu_sas_pcfg_value,
1915 &sci_phy->link_layer_registers->phy_configuration);
1916
1917 /* Disable the notify enable spinup primitives */
1918 enable_spinup_value = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control);
1919 enable_spinup_value &= ~SCU_ENSPINUP_GEN_BIT(ENABLE);
1920 writel(enable_spinup_value, &sci_phy->link_layer_registers->notify_enable_spinup_control);
1921 }
1922
1923 /**
1924 *
1925 *
1926 * This method will start the OOB/SN state machine for this struct scic_sds_phy object.
1927 */
1928 static void scu_link_layer_start_oob(
1929 struct scic_sds_phy *sci_phy)
1930 {
1931 u32 scu_sas_pcfg_value;
1932
1933 scu_sas_pcfg_value =
1934 readl(&sci_phy->link_layer_registers->phy_configuration);
1935 scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
1936 scu_sas_pcfg_value &=
1937 ~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) |
1938 SCU_SAS_PCFG_GEN_BIT(HARD_RESET));
1939 writel(scu_sas_pcfg_value,
1940 &sci_phy->link_layer_registers->phy_configuration);
1941 }
1942
1943 /**
1944 *
1945 *
1946 * This method will transmit a hard reset request on the specified phy. The SCU
1947 * hardware requires that we reset the OOB state machine and set the hard reset
1948 * bit in the phy configuration register. We then must start OOB over with the
1949 * hard reset bit set.
1950 */
1951 static void scu_link_layer_tx_hard_reset(
1952 struct scic_sds_phy *sci_phy)
1953 {
1954 u32 phy_configuration_value;
1955
1956 /*
1957 * SAS Phys must wait for the HARD_RESET_TX event notification to transition
1958 * to the starting state. */
1959 phy_configuration_value =
1960 readl(&sci_phy->link_layer_registers->phy_configuration);
1961 phy_configuration_value |=
1962 (SCU_SAS_PCFG_GEN_BIT(HARD_RESET) |
1963 SCU_SAS_PCFG_GEN_BIT(OOB_RESET));
1964 writel(phy_configuration_value,
1965 &sci_phy->link_layer_registers->phy_configuration);
1966
1967 /* Now take the OOB state machine out of reset */
1968 phy_configuration_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
1969 phy_configuration_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
1970 writel(phy_configuration_value,
1971 &sci_phy->link_layer_registers->phy_configuration);
1972 }
1973
1974 /*
1975 * ****************************************************************************
1976 * * PHY BASE STATE METHODS
1977 * **************************************************************************** */
1978
1979 /**
1980 *
1981 * @object: This is the object which is cast to a struct scic_sds_phy object.
1982 *
1983 * This method will perform the actions required by the struct scic_sds_phy on
1984 * entering the SCI_BASE_PHY_STATE_INITIAL. - This function sets the state
1985 * handlers for the phy object base state machine initial state. none
1986 */
1987 static void scic_sds_phy_initial_state_enter(void *object)
1988 {
1989 struct scic_sds_phy *sci_phy = object;
1990
1991 scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_INITIAL);
1992 }
1993
1994 /**
1995 *
1996 * @object: This is the object which is cast to a struct scic_sds_phy object.
1997 *
1998 * This function will perform the actions required by the struct scic_sds_phy on
1999 * entering the SCI_BASE_PHY_STATE_INITIAL. - This function sets the state
2000 * handlers for the phy object base state machine initial state. - The SCU
2001 * hardware is requested to stop the protocol engine. none
2002 */
2003 static void scic_sds_phy_stopped_state_enter(void *object)
2004 {
2005 struct scic_sds_phy *sci_phy = object;
2006 struct scic_sds_controller *scic = scic_sds_phy_get_controller(sci_phy);
2007 struct isci_host *ihost = scic_to_ihost(scic);
2008
2009 /*
2010 * @todo We need to get to the controller to place this PE in a
2011 * reset state
2012 */
2013
2014 scic_sds_phy_set_base_state_handlers(sci_phy,
2015 SCI_BASE_PHY_STATE_STOPPED);
2016
2017 if (sci_phy->sata_timeout_timer != NULL) {
2018 isci_del_timer(ihost, sci_phy->sata_timeout_timer);
2019
2020 sci_phy->sata_timeout_timer = NULL;
2021 }
2022
2023 scu_link_layer_stop_protocol_engine(sci_phy);
2024
2025 if (sci_phy->state_machine.previous_state_id !=
2026 SCI_BASE_PHY_STATE_INITIAL)
2027 scic_sds_controller_link_down(
2028 scic_sds_phy_get_controller(sci_phy),
2029 scic_sds_phy_get_port(sci_phy),
2030 sci_phy);
2031 }
2032
2033 /**
2034 *
2035 * @object: This is the object which is cast to a struct scic_sds_phy object.
2036 *
2037 * This method will perform the actions required by the struct scic_sds_phy on
2038 * entering the SCI_BASE_PHY_STATE_STARTING. - This function sets the state
2039 * handlers for the phy object base state machine starting state. - The SCU
2040 * hardware is requested to start OOB/SN on this protocl engine. - The phy
2041 * starting substate machine is started. - If the previous state was the ready
2042 * state then the struct scic_sds_controller is informed that the phy has gone link
2043 * down. none
2044 */
2045 static void scic_sds_phy_starting_state_enter(void *object)
2046 {
2047 struct scic_sds_phy *sci_phy = object;
2048
2049 scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_STARTING);
2050
2051 scu_link_layer_stop_protocol_engine(sci_phy);
2052 scu_link_layer_start_oob(sci_phy);
2053
2054 /* We don't know what kind of phy we are going to be just yet */
2055 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
2056 sci_phy->bcn_received_while_port_unassigned = false;
2057
2058 if (sci_phy->state_machine.previous_state_id
2059 == SCI_BASE_PHY_STATE_READY) {
2060 scic_sds_controller_link_down(
2061 scic_sds_phy_get_controller(sci_phy),
2062 scic_sds_phy_get_port(sci_phy),
2063 sci_phy
2064 );
2065 }
2066
2067 sci_base_state_machine_change_state(&sci_phy->state_machine,
2068 SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL);
2069 }
2070
2071 /**
2072 *
2073 * @object: This is the object which is cast to a struct scic_sds_phy object.
2074 *
2075 * This method will perform the actions required by the struct scic_sds_phy on
2076 * entering the SCI_BASE_PHY_STATE_READY. - This function sets the state
2077 * handlers for the phy object base state machine ready state. - The SCU
2078 * hardware protocol engine is resumed. - The struct scic_sds_controller is informed
2079 * that the phy object has gone link up. none
2080 */
2081 static void scic_sds_phy_ready_state_enter(void *object)
2082 {
2083 struct scic_sds_phy *sci_phy = object;
2084
2085 scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_READY);
2086
2087 scic_sds_controller_link_up(
2088 scic_sds_phy_get_controller(sci_phy),
2089 scic_sds_phy_get_port(sci_phy),
2090 sci_phy
2091 );
2092 }
2093
2094 /**
2095 *
2096 * @object: This is the object which is cast to a struct scic_sds_phy object.
2097 *
2098 * This method will perform the actions required by the struct scic_sds_phy on exiting
2099 * the SCI_BASE_PHY_STATE_INITIAL. This function suspends the SCU hardware
2100 * protocol engine represented by this struct scic_sds_phy object. none
2101 */
2102 static void scic_sds_phy_ready_state_exit(void *object)
2103 {
2104 struct scic_sds_phy *sci_phy = object;
2105
2106 scic_sds_phy_suspend(sci_phy);
2107 }
2108
2109 /**
2110 *
2111 * @object: This is the object which is cast to a struct scic_sds_phy object.
2112 *
2113 * This method will perform the actions required by the struct scic_sds_phy on
2114 * entering the SCI_BASE_PHY_STATE_RESETTING. - This function sets the state
2115 * handlers for the phy object base state machine resetting state. none
2116 */
2117 static void scic_sds_phy_resetting_state_enter(void *object)
2118 {
2119 struct scic_sds_phy *sci_phy = object;
2120
2121 scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_RESETTING);
2122
2123 /*
2124 * The phy is being reset, therefore deactivate it from the port.
2125 * In the resetting state we don't notify the user regarding
2126 * link up and link down notifications. */
2127 scic_sds_port_deactivate_phy(sci_phy->owning_port, sci_phy, false);
2128
2129 if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
2130 scu_link_layer_tx_hard_reset(sci_phy);
2131 } else {
2132 /*
2133 * The SCU does not need to have a discrete reset state so
2134 * just go back to the starting state.
2135 */
2136 sci_base_state_machine_change_state(
2137 &sci_phy->state_machine,
2138 SCI_BASE_PHY_STATE_STARTING);
2139 }
2140 }
2141
2142 /**
2143 *
2144 * @object: This is the object which is cast to a struct scic_sds_phy object.
2145 *
2146 * This method will perform the actions required by the struct scic_sds_phy on
2147 * entering the SCI_BASE_PHY_STATE_FINAL. - This function sets the state
2148 * handlers for the phy object base state machine final state. none
2149 */
2150 static void scic_sds_phy_final_state_enter(void *object)
2151 {
2152 struct scic_sds_phy *sci_phy = object;
2153
2154 scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_FINAL);
2155
2156 /* Nothing to do here */
2157 }
2158
2159 /* --------------------------------------------------------------------------- */
2160
2161 static const struct sci_base_state scic_sds_phy_state_table[] = {
2162 [SCI_BASE_PHY_STATE_INITIAL] = {
2163 .enter_state = scic_sds_phy_initial_state_enter,
2164 },
2165 [SCI_BASE_PHY_STATE_STOPPED] = {
2166 .enter_state = scic_sds_phy_stopped_state_enter,
2167 },
2168 [SCI_BASE_PHY_STATE_STARTING] = {
2169 .enter_state = scic_sds_phy_starting_state_enter,
2170 },
2171 [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = {
2172 .enter_state = scic_sds_phy_starting_initial_substate_enter,
2173 },
2174 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = {
2175 .enter_state = scic_sds_phy_starting_await_ossp_en_substate_enter,
2176 },
2177 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = {
2178 .enter_state = scic_sds_phy_starting_await_sas_speed_en_substate_enter,
2179 },
2180 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = {
2181 .enter_state = scic_sds_phy_starting_await_iaf_uf_substate_enter,
2182 },
2183 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = {
2184 .enter_state = scic_sds_phy_starting_await_sas_power_substate_enter,
2185 .exit_state = scic_sds_phy_starting_await_sas_power_substate_exit,
2186 },
2187 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = {
2188 .enter_state = scic_sds_phy_starting_await_sata_power_substate_enter,
2189 .exit_state = scic_sds_phy_starting_await_sata_power_substate_exit
2190 },
2191 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = {
2192 .enter_state = scic_sds_phy_starting_await_sata_phy_substate_enter,
2193 .exit_state = scic_sds_phy_starting_await_sata_phy_substate_exit
2194 },
2195 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = {
2196 .enter_state = scic_sds_phy_starting_await_sata_speed_substate_enter,
2197 .exit_state = scic_sds_phy_starting_await_sata_speed_substate_exit
2198 },
2199 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = {
2200 .enter_state = scic_sds_phy_starting_await_sig_fis_uf_substate_enter,
2201 .exit_state = scic_sds_phy_starting_await_sig_fis_uf_substate_exit
2202 },
2203 [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = {
2204 .enter_state = scic_sds_phy_starting_final_substate_enter,
2205 },
2206 [SCI_BASE_PHY_STATE_READY] = {
2207 .enter_state = scic_sds_phy_ready_state_enter,
2208 .exit_state = scic_sds_phy_ready_state_exit,
2209 },
2210 [SCI_BASE_PHY_STATE_RESETTING] = {
2211 .enter_state = scic_sds_phy_resetting_state_enter,
2212 },
2213 [SCI_BASE_PHY_STATE_FINAL] = {
2214 .enter_state = scic_sds_phy_final_state_enter,
2215 },
2216 };
2217
2218 void scic_sds_phy_construct(struct scic_sds_phy *sci_phy,
2219 struct scic_sds_port *owning_port, u8 phy_index)
2220 {
2221 sci_base_state_machine_construct(&sci_phy->state_machine,
2222 sci_phy,
2223 scic_sds_phy_state_table,
2224 SCI_BASE_PHY_STATE_INITIAL);
2225
2226 sci_base_state_machine_start(&sci_phy->state_machine);
2227
2228 /* Copy the rest of the input data to our locals */
2229 sci_phy->owning_port = owning_port;
2230 sci_phy->phy_index = phy_index;
2231 sci_phy->bcn_received_while_port_unassigned = false;
2232 sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
2233 sci_phy->link_layer_registers = NULL;
2234 sci_phy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN;
2235 sci_phy->sata_timeout_timer = NULL;
2236 }
2237
2238 void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index)
2239 {
2240 union scic_oem_parameters oem;
2241 u64 sci_sas_addr;
2242 __be64 sas_addr;
2243
2244 scic_oem_parameters_get(&ihost->sci, &oem);
2245 sci_sas_addr = oem.sds1.phys[index].sas_address.high;
2246 sci_sas_addr <<= 32;
2247 sci_sas_addr |= oem.sds1.phys[index].sas_address.low;
2248 sas_addr = cpu_to_be64(sci_sas_addr);
2249 memcpy(iphy->sas_addr, &sas_addr, sizeof(sas_addr));
2250
2251 iphy->isci_port = NULL;
2252 iphy->sas_phy.enabled = 0;
2253 iphy->sas_phy.id = index;
2254 iphy->sas_phy.sas_addr = &iphy->sas_addr[0];
2255 iphy->sas_phy.frame_rcvd = (u8 *)&iphy->frame_rcvd;
2256 iphy->sas_phy.ha = &ihost->sas_ha;
2257 iphy->sas_phy.lldd_phy = iphy;
2258 iphy->sas_phy.enabled = 1;
2259 iphy->sas_phy.class = SAS;
2260 iphy->sas_phy.iproto = SAS_PROTOCOL_ALL;
2261 iphy->sas_phy.tproto = 0;
2262 iphy->sas_phy.type = PHY_TYPE_PHYSICAL;
2263 iphy->sas_phy.role = PHY_ROLE_INITIATOR;
2264 iphy->sas_phy.oob_mode = OOB_NOT_CONNECTED;
2265 iphy->sas_phy.linkrate = SAS_LINK_RATE_UNKNOWN;
2266 memset(&iphy->frame_rcvd, 0, sizeof(iphy->frame_rcvd));
2267 }
2268
2269
2270 /**
2271 * isci_phy_control() - This function is one of the SAS Domain Template
2272 * functions. This is a phy management function.
2273 * @phy: This parameter specifies the sphy being controlled.
2274 * @func: This parameter specifies the phy control function being invoked.
2275 * @buf: This parameter is specific to the phy function being invoked.
2276 *
2277 * status, zero indicates success.
2278 */
2279 int isci_phy_control(struct asd_sas_phy *sas_phy,
2280 enum phy_func func,
2281 void *buf)
2282 {
2283 int ret = 0;
2284 struct isci_phy *iphy = sas_phy->lldd_phy;
2285 struct isci_port *iport = iphy->isci_port;
2286 struct isci_host *ihost = sas_phy->ha->lldd_ha;
2287 unsigned long flags;
2288
2289 dev_dbg(&ihost->pdev->dev,
2290 "%s: phy %p; func %d; buf %p; isci phy %p, port %p\n",
2291 __func__, sas_phy, func, buf, iphy, iport);
2292
2293 switch (func) {
2294 case PHY_FUNC_DISABLE:
2295 spin_lock_irqsave(&ihost->scic_lock, flags);
2296 scic_sds_phy_stop(&iphy->sci);
2297 spin_unlock_irqrestore(&ihost->scic_lock, flags);
2298 break;
2299
2300 case PHY_FUNC_LINK_RESET:
2301 spin_lock_irqsave(&ihost->scic_lock, flags);
2302 scic_sds_phy_stop(&iphy->sci);
2303 scic_sds_phy_start(&iphy->sci);
2304 spin_unlock_irqrestore(&ihost->scic_lock, flags);
2305 break;
2306
2307 case PHY_FUNC_HARD_RESET:
2308 if (!iport)
2309 return -ENODEV;
2310
2311 /* Perform the port reset. */
2312 ret = isci_port_perform_hard_reset(ihost, iport, iphy);
2313
2314 break;
2315
2316 default:
2317 dev_dbg(&ihost->pdev->dev,
2318 "%s: phy %p; func %d NOT IMPLEMENTED!\n",
2319 __func__, sas_phy, func);
2320 ret = -ENOSYS;
2321 break;
2322 }
2323 return ret;
2324 }
This page took 0.083999 seconds and 5 git commands to generate.