d374c7ac0b7184f13eee3f2d1f39d16af89604a7
[deliverable/linux.git] / drivers / scsi / isci / core / scic_sds_port.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 "intel_sas.h"
57 #include "sci_base_port.h"
58 #include "scic_controller.h"
59 #include "scic_phy.h"
60 #include "scic_port.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_port_registers.h"
66 #include "scic_sds_remote_device.h"
67 #include "scic_sds_remote_node_context.h"
68 #include "scic_sds_request.h"
69 #include "sci_environment.h"
70
71
72 static void scic_sds_port_invalid_link_up(
73 struct scic_sds_port *this_port,
74 struct scic_sds_phy *phy);
75 static void scic_sds_port_timeout_handler(
76 void *port);
77 #define SCIC_SDS_PORT_MIN_TIMER_COUNT (SCI_MAX_PORTS)
78 #define SCIC_SDS_PORT_MAX_TIMER_COUNT (SCI_MAX_PORTS)
79
80 #define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000)
81
82 void sci_base_port_construct(
83 struct sci_base_port *base_port,
84 const struct sci_base_state *state_table)
85 {
86 base_port->parent.private = NULL;
87 sci_base_state_machine_construct(
88 &base_port->state_machine,
89 &base_port->parent,
90 state_table,
91 SCI_BASE_PORT_STATE_STOPPED
92 );
93
94 sci_base_state_machine_start(
95 &base_port->state_machine
96 );
97 }
98
99 /**
100 *
101 * @this_port: This is the port object to which the phy is being assigned.
102 * @phy_index: This is the phy index that is being assigned to the port.
103 *
104 * This method will return a true value if the specified phy can be assigned to
105 * this port The following is a list of phys for each port that are allowed: -
106 * Port 0 - 3 2 1 0 - Port 1 - 1 - Port 2 - 3 2 - Port 3 - 3 This method
107 * doesn't preclude all configurations. It merely ensures that a phy is part
108 * of the allowable set of phy identifiers for that port. For example, one
109 * could assign phy 3 to port 0 and no other phys. Please refer to
110 * scic_sds_port_is_phy_mask_valid() for information regarding whether the
111 * phy_mask for a port can be supported. bool true if this is a valid phy
112 * assignment for the port false if this is not a valid phy assignment for the
113 * port
114 */
115 bool scic_sds_port_is_valid_phy_assignment(
116 struct scic_sds_port *this_port,
117 u32 phy_index)
118 {
119 /* Initialize to invalid value. */
120 u32 existing_phy_index = SCI_MAX_PHYS;
121 u32 index;
122
123 if ((this_port->physical_port_index == 1) && (phy_index != 1)) {
124 return false;
125 }
126
127 if (this_port->physical_port_index == 3 && phy_index != 3) {
128 return false;
129 }
130
131 if (
132 (this_port->physical_port_index == 2)
133 && ((phy_index == 0) || (phy_index == 1))
134 ) {
135 return false;
136 }
137
138 for (index = 0; index < SCI_MAX_PHYS; index++) {
139 if ((this_port->phy_table[index] != NULL)
140 && (index != phy_index)) {
141 existing_phy_index = index;
142 }
143 }
144
145 /*
146 * Ensure that all of the phys in the port are capable of
147 * operating at the same maximum link rate. */
148 if (
149 (existing_phy_index < SCI_MAX_PHYS)
150 && (this_port->owning_controller->user_parameters.sds1.phys[
151 phy_index].max_speed_generation !=
152 this_port->owning_controller->user_parameters.sds1.phys[
153 existing_phy_index].max_speed_generation)
154 )
155 return false;
156
157 return true;
158 }
159
160 /**
161 * This method requests a list (mask) of the phys contained in the supplied SAS
162 * port.
163 * @this_port: a handle corresponding to the SAS port for which to return the
164 * phy mask.
165 *
166 * Return a bit mask indicating which phys are a part of this port. Each bit
167 * corresponds to a phy identifier (e.g. bit 0 = phy id 0).
168 */
169 u32 scic_sds_port_get_phys(struct scic_sds_port *this_port)
170 {
171 u32 index;
172 u32 mask;
173
174 mask = 0;
175
176 for (index = 0; index < SCI_MAX_PHYS; index++) {
177 if (this_port->phy_table[index] != NULL) {
178 mask |= (1 << index);
179 }
180 }
181
182 return mask;
183 }
184
185 /**
186 *
187 * @this_port: This is the port object for which to determine if the phy mask
188 * can be supported.
189 *
190 * This method will return a true value if the port's phy mask can be supported
191 * by the SCU. The following is a list of valid PHY mask configurations for
192 * each port: - Port 0 - [[3 2] 1] 0 - Port 1 - [1] - Port 2 - [[3] 2]
193 * - Port 3 - [3] This method returns a boolean indication specifying if the
194 * phy mask can be supported. true if this is a valid phy assignment for the
195 * port false if this is not a valid phy assignment for the port
196 */
197 bool scic_sds_port_is_phy_mask_valid(
198 struct scic_sds_port *this_port,
199 u32 phy_mask)
200 {
201 if (this_port->physical_port_index == 0) {
202 if (((phy_mask & 0x0F) == 0x0F)
203 || ((phy_mask & 0x03) == 0x03)
204 || ((phy_mask & 0x01) == 0x01)
205 || (phy_mask == 0))
206 return true;
207 } else if (this_port->physical_port_index == 1) {
208 if (((phy_mask & 0x02) == 0x02)
209 || (phy_mask == 0))
210 return true;
211 } else if (this_port->physical_port_index == 2) {
212 if (((phy_mask & 0x0C) == 0x0C)
213 || ((phy_mask & 0x04) == 0x04)
214 || (phy_mask == 0))
215 return true;
216 } else if (this_port->physical_port_index == 3) {
217 if (((phy_mask & 0x08) == 0x08)
218 || (phy_mask == 0))
219 return true;
220 }
221
222 return false;
223 }
224
225 /**
226 *
227 * @this_port: This parameter specifies the port from which to return a
228 * connected phy.
229 *
230 * This method retrieves a currently active (i.e. connected) phy contained in
231 * the port. Currently, the lowest order phy that is connected is returned.
232 * This method returns a pointer to a SCIS_SDS_PHY object. NULL This value is
233 * returned if there are no currently active (i.e. connected to a remote end
234 * point) phys contained in the port. All other values specify a struct scic_sds_phy
235 * object that is active in the port.
236 */
237 static struct scic_sds_phy *scic_sds_port_get_a_connected_phy(
238 struct scic_sds_port *this_port
239 ) {
240 u32 index;
241 struct scic_sds_phy *phy;
242
243 for (index = 0; index < SCI_MAX_PHYS; index++) {
244 /*
245 * Ensure that the phy is both part of the port and currently
246 * connected to the remote end-point. */
247 phy = this_port->phy_table[index];
248 if (
249 (phy != NULL)
250 && scic_sds_port_active_phy(this_port, phy)
251 ) {
252 return phy;
253 }
254 }
255
256 return NULL;
257 }
258
259 /**
260 * scic_sds_port_set_phy() -
261 * @out]: port The port object to which the phy assignement is being made.
262 * @out]: phy The phy which is being assigned to the port.
263 *
264 * This method attempts to make the assignment of the phy to the port. If
265 * successful the phy is assigned to the ports phy table. bool true if the phy
266 * assignment can be made. false if the phy assignement can not be made. This
267 * is a functional test that only fails if the phy is currently assigned to a
268 * different port.
269 */
270 enum sci_status scic_sds_port_set_phy(
271 struct scic_sds_port *port,
272 struct scic_sds_phy *phy)
273 {
274 /*
275 * Check to see if we can add this phy to a port
276 * that means that the phy is not part of a port and that the port does
277 * not already have a phy assinged to the phy index. */
278 if (
279 (port->phy_table[phy->phy_index] == NULL)
280 && (scic_sds_phy_get_port(phy) == NULL)
281 && scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)
282 ) {
283 /*
284 * Phy is being added in the stopped state so we are in MPC mode
285 * make logical port index = physical port index */
286 port->logical_port_index = port->physical_port_index;
287 port->phy_table[phy->phy_index] = phy;
288 scic_sds_phy_set_port(phy, port);
289
290 return SCI_SUCCESS;
291 }
292
293 return SCI_FAILURE;
294 }
295
296 /**
297 * scic_sds_port_clear_phy() -
298 * @out]: port The port from which the phy is being cleared.
299 * @out]: phy The phy being cleared from the port.
300 *
301 * This method will clear the phy assigned to this port. This method fails if
302 * this phy is not currently assinged to this port. bool true if the phy is
303 * removed from the port. false if this phy is not assined to this port.
304 */
305 enum sci_status scic_sds_port_clear_phy(
306 struct scic_sds_port *port,
307 struct scic_sds_phy *phy)
308 {
309 /* Make sure that this phy is part of this port */
310 if (
311 (port->phy_table[phy->phy_index] == phy)
312 && (scic_sds_phy_get_port(phy) == port)
313 ) {
314 /* Yep it is assigned to this port so remove it */
315 scic_sds_phy_set_port(
316 phy,
317 &scic_sds_port_get_controller(port)->port_table[SCI_MAX_PORTS]
318 );
319
320 port->phy_table[phy->phy_index] = NULL;
321
322 return SCI_SUCCESS;
323 }
324
325 return SCI_FAILURE;
326 }
327
328 /**
329 * scic_sds_port_add_phy() -
330 * @this_port: This parameter specifies the port in which the phy will be added.
331 * @the_phy: This parameter is the phy which is to be added to the port.
332 *
333 * This method will add a PHY to the selected port. This method returns an
334 * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other status
335 * is failre to add the phy to the port.
336 */
337 enum sci_status scic_sds_port_add_phy(
338 struct scic_sds_port *this_port,
339 struct scic_sds_phy *the_phy)
340 {
341 return this_port->state_handlers->parent.add_phy_handler(
342 &this_port->parent, &the_phy->parent);
343 }
344
345
346 /**
347 * scic_sds_port_remove_phy() -
348 * @this_port: This parameter specifies the port in which the phy will be added.
349 * @the_phy: This parameter is the phy which is to be added to the port.
350 *
351 * This method will remove the PHY from the selected PORT. This method returns
352 * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any other
353 * status is failre to add the phy to the port.
354 */
355 enum sci_status scic_sds_port_remove_phy(
356 struct scic_sds_port *this_port,
357 struct scic_sds_phy *the_phy)
358 {
359 return this_port->state_handlers->parent.remove_phy_handler(
360 &this_port->parent, &the_phy->parent);
361 }
362
363 /**
364 * This method requests the SAS address for the supplied SAS port from the SCI
365 * implementation.
366 * @this_port: a handle corresponding to the SAS port for which to return the
367 * SAS address.
368 * @sas_address: This parameter specifies a pointer to a SAS address structure
369 * into which the core will copy the SAS address for the port.
370 *
371 */
372 void scic_sds_port_get_sas_address(
373 struct scic_sds_port *this_port,
374 struct sci_sas_address *sas_address)
375 {
376 u32 index;
377
378 sas_address->high = 0;
379 sas_address->low = 0;
380
381 for (index = 0; index < SCI_MAX_PHYS; index++) {
382 if (this_port->phy_table[index] != NULL) {
383 scic_sds_phy_get_sas_address(this_port->phy_table[index], sas_address);
384 }
385 }
386 }
387
388 /**
389 * This method will indicate which protocols are supported by this port.
390 * @this_port: a handle corresponding to the SAS port for which to return the
391 * supported protocols.
392 * @protocols: This parameter specifies a pointer to an IAF protocol field
393 * structure into which the core will copy the protocol values for the port.
394 * The values are returned as part of a bit mask in order to allow for
395 * multi-protocol support.
396 *
397 */
398 static void scic_sds_port_get_protocols(
399 struct scic_sds_port *this_port,
400 struct sci_sas_identify_address_frame_protocols *protocols)
401 {
402 u8 index;
403
404 protocols->u.all = 0;
405
406 for (index = 0; index < SCI_MAX_PHYS; index++) {
407 if (this_port->phy_table[index] != NULL) {
408 scic_sds_phy_get_protocols(this_port->phy_table[index], protocols);
409 }
410 }
411 }
412
413 /**
414 * This method requests the SAS address for the device directly attached to
415 * this SAS port.
416 * @this_port: a handle corresponding to the SAS port for which to return the
417 * SAS address.
418 * @sas_address: This parameter specifies a pointer to a SAS address structure
419 * into which the core will copy the SAS address for the device directly
420 * attached to the port.
421 *
422 */
423 void scic_sds_port_get_attached_sas_address(
424 struct scic_sds_port *this_port,
425 struct sci_sas_address *sas_address)
426 {
427 struct sci_sas_identify_address_frame_protocols protocols;
428 struct scic_sds_phy *phy;
429
430 /*
431 * Ensure that the phy is both part of the port and currently
432 * connected to the remote end-point. */
433 phy = scic_sds_port_get_a_connected_phy(this_port);
434 if (phy != NULL) {
435 scic_sds_phy_get_attached_phy_protocols(phy, &protocols);
436
437 if (!protocols.u.bits.stp_target) {
438 scic_sds_phy_get_attached_sas_address(phy, sas_address);
439 } else {
440 scic_sds_phy_get_sas_address(phy, sas_address);
441 sas_address->low += phy->phy_index;
442 }
443 } else {
444 sas_address->high = 0;
445 sas_address->low = 0;
446 }
447 }
448
449 /**
450 * This method will indicate which protocols are supported by this remote
451 * device.
452 * @this_port: a handle corresponding to the SAS port for which to return the
453 * supported protocols.
454 * @protocols: This parameter specifies a pointer to an IAF protocol field
455 * structure into which the core will copy the protocol values for the port.
456 * The values are returned as part of a bit mask in order to allow for
457 * multi-protocol support.
458 *
459 */
460 void scic_sds_port_get_attached_protocols(
461 struct scic_sds_port *this_port,
462 struct sci_sas_identify_address_frame_protocols *protocols)
463 {
464 struct scic_sds_phy *phy;
465
466 /*
467 * Ensure that the phy is both part of the port and currently
468 * connected to the remote end-point. */
469 phy = scic_sds_port_get_a_connected_phy(this_port);
470 if (phy != NULL)
471 scic_sds_phy_get_attached_phy_protocols(phy, protocols);
472 else
473 protocols->u.all = 0;
474 }
475
476 /**
477 * This method returns the amount of memory requred for a port object.
478 *
479 * u32
480 */
481
482 /**
483 * This method returns the minimum number of timers required for all port
484 * objects.
485 *
486 * u32
487 */
488
489 /**
490 * This method returns the maximum number of timers required for all port
491 * objects.
492 *
493 * u32
494 */
495
496 /**
497 *
498 * @this_port:
499 * @port_index:
500 *
501 *
502 */
503 void scic_sds_port_construct(
504 struct scic_sds_port *this_port,
505 u8 port_index,
506 struct scic_sds_controller *owning_controller)
507 {
508 u32 index;
509
510 sci_base_port_construct(
511 &this_port->parent,
512 scic_sds_port_state_table
513 );
514
515 sci_base_state_machine_construct(
516 scic_sds_port_get_ready_substate_machine(this_port),
517 &this_port->parent.parent,
518 scic_sds_port_ready_substate_table,
519 SCIC_SDS_PORT_READY_SUBSTATE_WAITING
520 );
521
522 this_port->logical_port_index = SCIC_SDS_DUMMY_PORT;
523 this_port->physical_port_index = port_index;
524 this_port->active_phy_mask = 0;
525
526 this_port->owning_controller = owning_controller;
527
528 this_port->started_request_count = 0;
529 this_port->assigned_device_count = 0;
530
531 this_port->timer_handle = NULL;
532
533 this_port->port_task_scheduler_registers = NULL;
534
535 for (index = 0; index < SCI_MAX_PHYS; index++) {
536 this_port->phy_table[index] = NULL;
537 }
538 }
539
540 /**
541 * This method performs initialization of the supplied port. Initialization
542 * includes: - state machine initialization - member variable initialization
543 * - configuring the phy_mask
544 * @this_port:
545 * @transport_layer_registers:
546 * @port_task_scheduler_registers:
547 * @port_configuration_regsiter:
548 *
549 * enum sci_status SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION This value is returned
550 * if the phy being added to the port
551 */
552 enum sci_status scic_sds_port_initialize(
553 struct scic_sds_port *this_port,
554 void __iomem *port_task_scheduler_registers,
555 void __iomem *port_configuration_regsiter,
556 void __iomem *viit_registers)
557 {
558 this_port->port_task_scheduler_registers = port_task_scheduler_registers;
559 this_port->port_pe_configuration_register = port_configuration_regsiter;
560 this_port->viit_registers = viit_registers;
561
562 /*
563 * If this is not the dummy port make the assignment of
564 * the timer and start the state machine */
565 if (this_port->physical_port_index != SCI_MAX_PORTS) {
566 /* / @todo should we create the timer at create time? */
567 this_port->timer_handle = isci_event_timer_create(
568 scic_sds_port_get_controller(this_port),
569 scic_sds_port_timeout_handler,
570 this_port
571 );
572
573 } else {
574 /*
575 * Force the dummy port into a condition where it rejects all requests
576 * as its in an invalid state for any operation.
577 * / @todo should we set a set of specical handlers for the dummy port? */
578 scic_sds_port_set_base_state_handlers(
579 this_port, SCI_BASE_PORT_STATE_STOPPED
580 );
581 }
582
583 return SCI_SUCCESS;
584 }
585
586 /**
587 *
588 * @this_port: This is the struct scic_sds_port object for which has a phy that has
589 * gone link up.
590 * @the_phy: This is the struct scic_sds_phy object that has gone link up.
591 * @do_notify_user: This parameter specifies whether to inform the user (via
592 * scic_cb_port_link_up()) as to the fact that a new phy as become ready.
593 *
594 * This method is the a general link up handler for the struct scic_sds_port object.
595 * This function will determine if this struct scic_sds_phy can be assigned to this
596 * struct scic_sds_port object. If the struct scic_sds_phy object can is not a valid PHY for
597 * this port then the function will notify the SCIC_USER. A PHY can only be
598 * part of a port if it's attached SAS ADDRESS is the same as all other PHYs in
599 * the same port. none
600 */
601 void scic_sds_port_general_link_up_handler(
602 struct scic_sds_port *this_port,
603 struct scic_sds_phy *the_phy,
604 bool do_notify_user)
605 {
606 struct sci_sas_address port_sas_address;
607 struct sci_sas_address phy_sas_address;
608
609 scic_sds_port_get_attached_sas_address(this_port, &port_sas_address);
610 scic_sds_phy_get_attached_sas_address(the_phy, &phy_sas_address);
611
612 /*
613 * If the SAS address of the new phy matches the SAS address of
614 * other phys in the port OR this is the first phy in the port,
615 * then activate the phy and allow it to be used for operations
616 * in this port. */
617 if (
618 (
619 (phy_sas_address.high == port_sas_address.high)
620 && (phy_sas_address.low == port_sas_address.low)
621 )
622 || (this_port->active_phy_mask == 0)
623 ) {
624 scic_sds_port_activate_phy(this_port, the_phy, do_notify_user);
625
626 if (this_port->parent.state_machine.current_state_id
627 == SCI_BASE_PORT_STATE_RESETTING) {
628 sci_base_state_machine_change_state(
629 &this_port->parent.state_machine, SCI_BASE_PORT_STATE_READY
630 );
631 }
632 } else {
633 scic_sds_port_invalid_link_up(this_port, the_phy);
634 }
635 }
636
637
638 enum sci_status scic_port_start(struct scic_sds_port *port)
639 {
640 return port->state_handlers->parent.start_handler(&port->parent);
641 }
642
643
644 enum sci_status scic_port_stop(struct scic_sds_port *port)
645 {
646 return port->state_handlers->parent.stop_handler(&port->parent);
647 }
648
649
650 enum sci_status scic_port_get_properties(
651 struct scic_sds_port *port,
652 struct scic_port_properties *prop)
653 {
654 if ((port == NULL) ||
655 (port->logical_port_index == SCIC_SDS_DUMMY_PORT))
656 return SCI_FAILURE_INVALID_PORT;
657
658 prop->index = port->logical_port_index;
659 prop->phy_mask = scic_sds_port_get_phys(port);
660 scic_sds_port_get_sas_address(port, &prop->local.sas_address);
661 scic_sds_port_get_protocols(port, &prop->local.protocols);
662 scic_sds_port_get_attached_sas_address(port, &prop->remote.sas_address);
663 scic_sds_port_get_attached_protocols(port, &prop->remote.protocols);
664
665 return SCI_SUCCESS;
666 }
667
668
669 enum sci_status scic_port_hard_reset(
670 struct scic_sds_port *port,
671 u32 reset_timeout)
672 {
673 return port->state_handlers->parent.reset_handler(
674 &port->parent, reset_timeout);
675 }
676
677 /**
678 * This method assigns the direct attached device ID for this port.
679 *
680 * @param[in] this_port The port for which the direct attached device id is to
681 * be assigned.
682 * @param[in] device_id The direct attached device ID to assign to the port.
683 * This will be the RNi for the device
684 */
685 void scic_sds_port_setup_transports(
686 struct scic_sds_port *this_port,
687 u32 device_id)
688 {
689 u8 index;
690
691 for (index = 0; index < SCI_MAX_PHYS; index++) {
692 if (this_port->active_phy_mask & (1 << index))
693 scic_sds_phy_setup_transport(this_port->phy_table[index], device_id);
694 }
695 }
696
697 /**
698 *
699 * @this_port: This is the port on which the phy should be enabled.
700 * @the_phy: This is the specific phy which to enable.
701 * @do_notify_user: This parameter specifies whether to inform the user (via
702 * scic_cb_port_link_up()) as to the fact that a new phy as become ready.
703 *
704 * This method will activate the phy in the port. Activation includes: - adding
705 * the phy to the port - enabling the Protocol Engine in the silicon. -
706 * notifying the user that the link is up. none
707 */
708 void scic_sds_port_activate_phy(
709 struct scic_sds_port *this_port,
710 struct scic_sds_phy *the_phy,
711 bool do_notify_user)
712 {
713 struct scic_sds_controller *controller;
714 struct sci_sas_identify_address_frame_protocols protocols;
715
716 controller = scic_sds_port_get_controller(this_port);
717 scic_sds_phy_get_attached_phy_protocols(the_phy, &protocols);
718
719 /* If this is sata port then the phy has already been resumed */
720 if (!protocols.u.bits.stp_target) {
721 scic_sds_phy_resume(the_phy);
722 }
723
724 this_port->active_phy_mask |= 1 << the_phy->phy_index;
725
726 scic_sds_controller_clear_invalid_phy(controller, the_phy);
727
728 if (do_notify_user == true)
729 isci_event_port_link_up(this_port->owning_controller,
730 this_port,
731 the_phy);
732 }
733
734 /**
735 *
736 * @this_port: This is the port on which the phy should be deactivated.
737 * @the_phy: This is the specific phy that is no longer active in the port.
738 * @do_notify_user: This parameter specifies whether to inform the user (via
739 * isci_event_port_link_down()) as to the fact that a new phy as become
740 * ready.
741 *
742 * This method will deactivate the supplied phy in the port. none
743 */
744 void scic_sds_port_deactivate_phy(
745 struct scic_sds_port *this_port,
746 struct scic_sds_phy *the_phy,
747 bool do_notify_user)
748 {
749 this_port->active_phy_mask &= ~(1 << the_phy->phy_index);
750
751 the_phy->max_negotiated_speed = SCI_SAS_NO_LINK_RATE;
752
753 /* Re-assign the phy back to the LP as if it were a narrow port */
754 SCU_PCSPExCR_WRITE(this_port, the_phy->phy_index, the_phy->phy_index);
755
756 if (do_notify_user == true)
757 isci_event_port_link_down(this_port->owning_controller,
758 this_port,
759 the_phy);
760 }
761
762 /**
763 *
764 * @this_port: This is the port on which the phy should be disabled.
765 * @the_phy: This is the specific phy which to disabled.
766 *
767 * This method will disable the phy and report that the phy is not valid for
768 * this port object. None
769 */
770 static void scic_sds_port_invalid_link_up(
771 struct scic_sds_port *this_port,
772 struct scic_sds_phy *the_phy)
773 {
774 struct scic_sds_controller *controller = scic_sds_port_get_controller(this_port);
775
776 /*
777 * Check to see if we have alreay reported this link as bad and if not go
778 * ahead and tell the SCI_USER that we have discovered an invalid link. */
779 if ((controller->invalid_phy_mask & (1 << the_phy->phy_index)) == 0) {
780 scic_sds_controller_set_invalid_phy(controller, the_phy);
781
782 isci_event_port_invalid_link_up(controller, this_port, the_phy);
783 }
784 }
785
786 /**
787 * This method returns false if the port only has a single phy object assigned.
788 * If there are no phys or more than one phy then the method will return
789 * true.
790 * @this_port: The port for which the wide port condition is to be checked.
791 *
792 * bool true Is returned if this is a wide ported port. false Is returned if
793 * this is a narrow port.
794 */
795 static bool scic_sds_port_is_wide(struct scic_sds_port *this_port)
796 {
797 u32 index;
798 u32 phy_count = 0;
799
800 for (index = 0; index < SCI_MAX_PHYS; index++) {
801 if (this_port->phy_table[index] != NULL) {
802 phy_count++;
803 }
804 }
805
806 return phy_count != 1;
807 }
808
809 /**
810 * This method is called by the PHY object when the link is detected. if the
811 * port wants the PHY to continue on to the link up state then the port
812 * layer must return true. If the port object returns false the phy object
813 * must halt its attempt to go link up.
814 * @this_port: The port associated with the phy object.
815 * @the_phy: The phy object that is trying to go link up.
816 *
817 * true if the phy object can continue to the link up condition. true Is
818 * returned if this phy can continue to the ready state. false Is returned if
819 * can not continue on to the ready state. This notification is in place for
820 * wide ports and direct attached phys. Since there are no wide ported SATA
821 * devices this could become an invalid port configuration.
822 */
823 bool scic_sds_port_link_detected(
824 struct scic_sds_port *this_port,
825 struct scic_sds_phy *the_phy)
826 {
827 struct sci_sas_identify_address_frame_protocols protocols;
828
829 scic_sds_phy_get_attached_phy_protocols(the_phy, &protocols);
830
831 if (
832 (this_port->logical_port_index != SCIC_SDS_DUMMY_PORT)
833 && (protocols.u.bits.stp_target)
834 && scic_sds_port_is_wide(this_port)
835 ) {
836 scic_sds_port_invalid_link_up(this_port, the_phy);
837
838 return false;
839 }
840
841 return true;
842 }
843
844 /**
845 * This method is the entry point for the phy to inform the port that it is now
846 * in a ready state
847 * @this_port:
848 *
849 *
850 */
851 void scic_sds_port_link_up(
852 struct scic_sds_port *this_port,
853 struct scic_sds_phy *the_phy)
854 {
855 the_phy->is_in_link_training = false;
856
857 this_port->state_handlers->link_up_handler(this_port, the_phy);
858 }
859
860 /**
861 * This method is the entry point for the phy to inform the port that it is no
862 * longer in a ready state
863 * @this_port:
864 *
865 *
866 */
867 void scic_sds_port_link_down(
868 struct scic_sds_port *this_port,
869 struct scic_sds_phy *the_phy)
870 {
871 this_port->state_handlers->link_down_handler(this_port, the_phy);
872 }
873
874 /**
875 * This method is called to start an IO request on this port.
876 * @this_port:
877 * @the_device:
878 * @the_io_request:
879 *
880 * enum sci_status
881 */
882 enum sci_status scic_sds_port_start_io(
883 struct scic_sds_port *this_port,
884 struct scic_sds_remote_device *the_device,
885 struct scic_sds_request *the_io_request)
886 {
887 return this_port->state_handlers->start_io_handler(
888 this_port, the_device, the_io_request);
889 }
890
891 /**
892 * This method is called to complete an IO request to the port.
893 * @this_port:
894 * @the_device:
895 * @the_io_request:
896 *
897 * enum sci_status
898 */
899 enum sci_status scic_sds_port_complete_io(
900 struct scic_sds_port *this_port,
901 struct scic_sds_remote_device *the_device,
902 struct scic_sds_request *the_io_request)
903 {
904 return this_port->state_handlers->complete_io_handler(
905 this_port, the_device, the_io_request);
906 }
907
908 /**
909 * This method is provided to timeout requests for port operations. Mostly its
910 * for the port reset operation.
911 *
912 *
913 */
914 static void scic_sds_port_timeout_handler(void *port)
915 {
916 struct scic_sds_port *this_port = port;
917 u32 current_state;
918
919 current_state = sci_base_state_machine_get_state(
920 &this_port->parent.state_machine);
921
922 if (current_state == SCI_BASE_PORT_STATE_RESETTING) {
923 /*
924 * if the port is still in the resetting state then the timeout fired
925 * before the reset completed. */
926 sci_base_state_machine_change_state(
927 &this_port->parent.state_machine,
928 SCI_BASE_PORT_STATE_FAILED
929 );
930 } else if (current_state == SCI_BASE_PORT_STATE_STOPPED) {
931 /*
932 * if the port is stopped then the start request failed
933 * In this case stay in the stopped state. */
934 dev_err(sciport_to_dev(this_port),
935 "%s: SCIC Port 0x%p failed to stop before tiemout.\n",
936 __func__,
937 this_port);
938 } else if (current_state == SCI_BASE_PORT_STATE_STOPPING) {
939 /* if the port is still stopping then the stop has not completed */
940 isci_event_port_stop_complete(
941 scic_sds_port_get_controller(this_port),
942 port,
943 SCI_FAILURE_TIMEOUT
944 );
945 } else {
946 /*
947 * The port is in the ready state and we have a timer reporting a timeout
948 * this should not happen. */
949 dev_err(sciport_to_dev(this_port),
950 "%s: SCIC Port 0x%p is processing a timeout operation "
951 "in state %d.\n",
952 __func__,
953 this_port,
954 current_state);
955 }
956 }
957
958 /* --------------------------------------------------------------------------- */
959
960 /**
961 * This function updates the hardwares VIIT entry for this port.
962 *
963 *
964 */
965 void scic_sds_port_update_viit_entry(struct scic_sds_port *this_port)
966 {
967 struct sci_sas_address sas_address;
968
969 scic_sds_port_get_sas_address(this_port, &sas_address);
970
971 scu_port_viit_register_write(
972 this_port, initiator_sas_address_hi, sas_address.high);
973
974 scu_port_viit_register_write(
975 this_port, initiator_sas_address_lo, sas_address.low);
976
977 /* This value get cleared just in case its not already cleared */
978 scu_port_viit_register_write(
979 this_port, reserved, 0);
980
981 /* We are required to update the status register last */
982 scu_port_viit_register_write(
983 this_port, status, (
984 SCU_VIIT_ENTRY_ID_VIIT
985 | SCU_VIIT_IPPT_INITIATOR
986 | ((1 << this_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT)
987 | SCU_VIIT_STATUS_ALL_VALID
988 )
989 );
990 }
991
992 /**
993 * This method returns the maximum allowed speed for data transfers on this
994 * port. This maximum allowed speed evaluates to the maximum speed of the
995 * slowest phy in the port.
996 * @this_port: This parameter specifies the port for which to retrieve the
997 * maximum allowed speed.
998 *
999 * This method returns the maximum negotiated speed of the slowest phy in the
1000 * port.
1001 */
1002 enum sci_sas_link_rate scic_sds_port_get_max_allowed_speed(
1003 struct scic_sds_port *this_port)
1004 {
1005 u16 index = 0;
1006 enum sci_sas_link_rate max_allowed_speed = SCI_SAS_600_GB;
1007 struct scic_sds_phy *phy = NULL;
1008
1009 /*
1010 * Loop through all of the phys in this port and find the phy with the
1011 * lowest maximum link rate. */
1012 for (index = 0; index < SCI_MAX_PHYS; index++) {
1013 phy = this_port->phy_table[index];
1014 if (
1015 (phy != NULL)
1016 && (scic_sds_port_active_phy(this_port, phy) == true)
1017 && (phy->max_negotiated_speed < max_allowed_speed)
1018 )
1019 max_allowed_speed = phy->max_negotiated_speed;
1020 }
1021
1022 return max_allowed_speed;
1023 }
1024
1025
1026 /**
1027 * This method passes the event to core user.
1028 * @this_port: The port that a BCN happens.
1029 * @this_phy: The phy that receives BCN.
1030 *
1031 */
1032 void scic_sds_port_broadcast_change_received(
1033 struct scic_sds_port *this_port,
1034 struct scic_sds_phy *this_phy)
1035 {
1036 /* notify the user. */
1037 isci_event_port_bc_change_primitive_received(
1038 this_port->owning_controller, this_port, this_phy
1039 );
1040 }
1041
1042
1043 /**
1044 * This API methhod enables the broadcast change notification from underneath
1045 * hardware.
1046 * @this_port: The port that a BCN had been disabled from.
1047 *
1048 */
1049 void scic_port_enable_broadcast_change_notification(
1050 struct scic_sds_port *port)
1051 {
1052 struct scic_sds_phy *phy;
1053 u32 register_value;
1054 u8 index;
1055
1056 /* Loop through all of the phys to enable BCN. */
1057 for (index = 0; index < SCI_MAX_PHYS; index++) {
1058 phy = port->phy_table[index];
1059 if (phy != NULL) {
1060 register_value = SCU_SAS_LLCTL_READ(phy);
1061
1062 /* clear the bit by writing 1. */
1063 SCU_SAS_LLCTL_WRITE(phy, register_value);
1064 }
1065 }
1066 }
1067
1068 /*
1069 * ****************************************************************************
1070 * * READY SUBSTATE HANDLERS
1071 * **************************************************************************** */
1072
1073 /**
1074 *
1075 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1076 * object.
1077 *
1078 * This method is the general ready state stop handler for the struct scic_sds_port
1079 * object. This function will transition the ready substate machine to its
1080 * final state. enum sci_status SCI_SUCCESS
1081 */
1082 static enum sci_status scic_sds_port_ready_substate_stop_handler(
1083 struct sci_base_port *port)
1084 {
1085 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1086
1087 sci_base_state_machine_change_state(
1088 &this_port->parent.state_machine,
1089 SCI_BASE_PORT_STATE_STOPPING
1090 );
1091
1092 return SCI_SUCCESS;
1093 }
1094
1095 /**
1096 *
1097 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1098 * object.
1099 * @device: This is the struct sci_base_remote_device object which is not used in this
1100 * function.
1101 * @io_request: This is the struct sci_base_request object which is not used in this
1102 * function.
1103 *
1104 * This method is the general ready substate complete io handler for the
1105 * struct scic_sds_port object. This function decrments the outstanding request count
1106 * for this port object. enum sci_status SCI_SUCCESS
1107 */
1108 static enum sci_status scic_sds_port_ready_substate_complete_io_handler(
1109 struct scic_sds_port *port,
1110 struct scic_sds_remote_device *device,
1111 struct scic_sds_request *io_request)
1112 {
1113 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1114
1115 scic_sds_port_decrement_request_count(this_port);
1116
1117 return SCI_SUCCESS;
1118 }
1119
1120 static enum sci_status scic_sds_port_ready_substate_add_phy_handler(
1121 struct sci_base_port *port,
1122 struct sci_base_phy *phy)
1123 {
1124 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1125 struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
1126 enum sci_status status;
1127
1128 status = scic_sds_port_set_phy(this_port, this_phy);
1129
1130 if (status == SCI_SUCCESS) {
1131 scic_sds_port_general_link_up_handler(this_port, this_phy, true);
1132
1133 this_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING;
1134
1135 sci_base_state_machine_change_state(
1136 &this_port->ready_substate_machine,
1137 SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
1138 );
1139 }
1140
1141 return status;
1142 }
1143
1144
1145 static enum sci_status scic_sds_port_ready_substate_remove_phy_handler(
1146 struct sci_base_port *port,
1147 struct sci_base_phy *phy)
1148 {
1149 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1150 struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
1151 enum sci_status status;
1152
1153 status = scic_sds_port_clear_phy(this_port, this_phy);
1154
1155 if (status == SCI_SUCCESS) {
1156 scic_sds_port_deactivate_phy(this_port, this_phy, true);
1157
1158 this_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING;
1159
1160 sci_base_state_machine_change_state(
1161 &this_port->ready_substate_machine,
1162 SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
1163 );
1164 }
1165
1166 return status;
1167 }
1168
1169 /*
1170 * ****************************************************************************
1171 * * READY SUBSTATE WAITING HANDLERS
1172 * **************************************************************************** */
1173
1174 /**
1175 *
1176 * @this_port: This is the struct scic_sds_port object that which has a phy that has
1177 * gone link up.
1178 * @the_phy: This is the struct scic_sds_phy object that has gone link up.
1179 *
1180 * This method is the ready waiting substate link up handler for the
1181 * struct scic_sds_port object. This methos will report the link up condition for
1182 * this port and will transition to the ready operational substate. none
1183 */
1184 static void scic_sds_port_ready_waiting_substate_link_up_handler(
1185 struct scic_sds_port *this_port,
1186 struct scic_sds_phy *the_phy)
1187 {
1188 /*
1189 * Since this is the first phy going link up for the port we can just enable
1190 * it and continue. */
1191 scic_sds_port_activate_phy(this_port, the_phy, true);
1192
1193 sci_base_state_machine_change_state(
1194 &this_port->ready_substate_machine,
1195 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
1196 );
1197 }
1198
1199 /**
1200 *
1201 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1202 * object.
1203 * @device: This is the struct sci_base_remote_device object which is not used in this
1204 * request.
1205 * @io_request: This is the struct sci_base_request object which is not used in this
1206 * function.
1207 *
1208 * This method is the ready waiting substate start io handler for the
1209 * struct scic_sds_port object. The port object can not accept new requests so the
1210 * request is failed. enum sci_status SCI_FAILURE_INVALID_STATE
1211 */
1212 static enum sci_status scic_sds_port_ready_waiting_substate_start_io_handler(
1213 struct scic_sds_port *port,
1214 struct scic_sds_remote_device *device,
1215 struct scic_sds_request *io_request)
1216 {
1217 return SCI_FAILURE_INVALID_STATE;
1218 }
1219
1220 /*
1221 * ****************************************************************************
1222 * * READY SUBSTATE OPERATIONAL HANDLERS
1223 * **************************************************************************** */
1224
1225 /**
1226 *
1227 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1228 * object.
1229 * @timeout: This is the timeout for the reset request to complete.
1230 *
1231 * This method will casue the port to reset. enum sci_status SCI_SUCCESS
1232 */
1233 static enum sci_status scic_sds_port_ready_operational_substate_reset_handler(
1234 struct sci_base_port *port,
1235 u32 timeout)
1236 {
1237 enum sci_status status = SCI_FAILURE_INVALID_PHY;
1238 u32 phy_index;
1239 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1240 struct scic_sds_phy *selected_phy = NULL;
1241
1242
1243 /* Select a phy on which we can send the hard reset request. */
1244 for (
1245 phy_index = 0;
1246 (phy_index < SCI_MAX_PHYS)
1247 && (selected_phy == NULL);
1248 phy_index++
1249 ) {
1250 selected_phy = this_port->phy_table[phy_index];
1251
1252 if (
1253 (selected_phy != NULL)
1254 && !scic_sds_port_active_phy(this_port, selected_phy)
1255 ) {
1256 /* We found a phy but it is not ready select different phy */
1257 selected_phy = NULL;
1258 }
1259 }
1260
1261 /* If we have a phy then go ahead and start the reset procedure */
1262 if (selected_phy != NULL) {
1263 status = scic_sds_phy_reset(selected_phy);
1264
1265 if (status == SCI_SUCCESS) {
1266 isci_event_timer_start(
1267 scic_sds_port_get_controller(this_port),
1268 this_port->timer_handle,
1269 timeout
1270 );
1271
1272 this_port->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED;
1273
1274 sci_base_state_machine_change_state(
1275 &this_port->parent.state_machine,
1276 SCI_BASE_PORT_STATE_RESETTING
1277 );
1278 }
1279 }
1280
1281 return status;
1282 }
1283
1284 /**
1285 * scic_sds_port_ready_operational_substate_link_up_handler() -
1286 * @this_port: This is the struct scic_sds_port object that which has a phy that has
1287 * gone link up.
1288 * @the_phy: This is the struct scic_sds_phy object that has gone link up.
1289 *
1290 * This method is the ready operational substate link up handler for the
1291 * struct scic_sds_port object. This function notifies the SCI User that the phy has
1292 * gone link up. none
1293 */
1294 static void scic_sds_port_ready_operational_substate_link_up_handler(
1295 struct scic_sds_port *this_port,
1296 struct scic_sds_phy *the_phy)
1297 {
1298 scic_sds_port_general_link_up_handler(this_port, the_phy, true);
1299 }
1300
1301 /**
1302 * scic_sds_port_ready_operational_substate_link_down_handler() -
1303 * @this_port: This is the struct scic_sds_port object that which has a phy that has
1304 * gone link down.
1305 * @the_phy: This is the struct scic_sds_phy object that has gone link down.
1306 *
1307 * This method is the ready operational substate link down handler for the
1308 * struct scic_sds_port object. This function notifies the SCI User that the phy has
1309 * gone link down and if this is the last phy in the port the port will change
1310 * state to the ready waiting substate. none
1311 */
1312 static void scic_sds_port_ready_operational_substate_link_down_handler(
1313 struct scic_sds_port *this_port,
1314 struct scic_sds_phy *the_phy)
1315 {
1316 scic_sds_port_deactivate_phy(this_port, the_phy, true);
1317
1318 /*
1319 * If there are no active phys left in the port, then transition
1320 * the port to the WAITING state until such time as a phy goes
1321 * link up. */
1322 if (this_port->active_phy_mask == 0) {
1323 sci_base_state_machine_change_state(
1324 scic_sds_port_get_ready_substate_machine(this_port),
1325 SCIC_SDS_PORT_READY_SUBSTATE_WAITING
1326 );
1327 }
1328 }
1329
1330 /**
1331 *
1332 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1333 * object.
1334 * @device: This is the struct sci_base_remote_device object which is not used in this
1335 * function.
1336 * @io_request: This is the struct sci_base_request object which is not used in this
1337 * function.
1338 *
1339 * This method is the ready operational substate start io handler for the
1340 * struct scic_sds_port object. This function incremetns the outstanding request
1341 * count for this port object. enum sci_status SCI_SUCCESS
1342 */
1343 static enum sci_status scic_sds_port_ready_operational_substate_start_io_handler(
1344 struct scic_sds_port *port,
1345 struct scic_sds_remote_device *device,
1346 struct scic_sds_request *io_request)
1347 {
1348 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1349
1350 scic_sds_port_increment_request_count(this_port);
1351
1352 return SCI_SUCCESS;
1353 }
1354
1355 /*
1356 * ****************************************************************************
1357 * * READY SUBSTATE OPERATIONAL HANDLERS
1358 * **************************************************************************** */
1359
1360 /**
1361 * scic_sds_port_ready_configuring_substate_add_phy_handler() -
1362 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1363 * object.
1364 *
1365 * This is the default method for a port add phy request. It will report a
1366 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1367 */
1368 static enum sci_status scic_sds_port_ready_configuring_substate_add_phy_handler(
1369 struct sci_base_port *port,
1370 struct sci_base_phy *phy)
1371 {
1372 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1373 struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
1374 enum sci_status status;
1375
1376 status = scic_sds_port_set_phy(this_port, this_phy);
1377
1378 if (status == SCI_SUCCESS) {
1379 scic_sds_port_general_link_up_handler(this_port, this_phy, true);
1380
1381 /*
1382 * Re-enter the configuring state since this may be the last phy in
1383 * the port. */
1384 sci_base_state_machine_change_state(
1385 &this_port->ready_substate_machine,
1386 SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
1387 );
1388 }
1389
1390 return status;
1391 }
1392
1393 /**
1394 * scic_sds_port_ready_configuring_substate_remove_phy_handler() -
1395 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1396 * object.
1397 *
1398 * This is the default method for a port remove phy request. It will report a
1399 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1400 */
1401 static enum sci_status scic_sds_port_ready_configuring_substate_remove_phy_handler(
1402 struct sci_base_port *port,
1403 struct sci_base_phy *phy)
1404 {
1405 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
1406 struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
1407 enum sci_status status;
1408
1409 status = scic_sds_port_clear_phy(this_port, this_phy);
1410
1411 if (status == SCI_SUCCESS) {
1412 scic_sds_port_deactivate_phy(this_port, this_phy, true);
1413
1414 /*
1415 * Re-enter the configuring state since this may be the last phy in
1416 * the port. */
1417 sci_base_state_machine_change_state(
1418 &this_port->ready_substate_machine,
1419 SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
1420 );
1421 }
1422
1423 return status;
1424 }
1425
1426 /**
1427 * scic_sds_port_ready_configuring_substate_complete_io_handler() -
1428 * @port: This is the port that is being requested to complete the io request.
1429 * @device: This is the device on which the io is completing.
1430 *
1431 * This method will decrement the outstanding request count for this port. If
1432 * the request count goes to 0 then the port can be reprogrammed with its new
1433 * phy data.
1434 */
1435 static enum sci_status scic_sds_port_ready_configuring_substate_complete_io_handler(
1436 struct scic_sds_port *port,
1437 struct scic_sds_remote_device *device,
1438 struct scic_sds_request *io_request)
1439 {
1440 scic_sds_port_decrement_request_count(port);
1441
1442 if (port->started_request_count == 0) {
1443 sci_base_state_machine_change_state(
1444 &port->ready_substate_machine,
1445 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
1446 );
1447 }
1448
1449 return SCI_SUCCESS;
1450 }
1451
1452 /* --------------------------------------------------------------------------- */
1453
1454 struct scic_sds_port_state_handler
1455 scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] =
1456 {
1457 /* SCIC_SDS_PORT_READY_SUBSTATE_WAITING */
1458 {
1459 {
1460 scic_sds_port_default_start_handler,
1461 scic_sds_port_ready_substate_stop_handler,
1462 scic_sds_port_default_destruct_handler,
1463 scic_sds_port_default_reset_handler,
1464 scic_sds_port_ready_substate_add_phy_handler,
1465 scic_sds_port_default_remove_phy_handler
1466 },
1467 scic_sds_port_default_frame_handler,
1468 scic_sds_port_default_event_handler,
1469 scic_sds_port_ready_waiting_substate_link_up_handler,
1470 scic_sds_port_default_link_down_handler,
1471 scic_sds_port_ready_waiting_substate_start_io_handler,
1472 scic_sds_port_ready_substate_complete_io_handler,
1473 },
1474 /* SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL */
1475 {
1476 {
1477 scic_sds_port_default_start_handler,
1478 scic_sds_port_ready_substate_stop_handler,
1479 scic_sds_port_default_destruct_handler,
1480 scic_sds_port_ready_operational_substate_reset_handler,
1481 scic_sds_port_ready_substate_add_phy_handler,
1482 scic_sds_port_ready_substate_remove_phy_handler
1483 },
1484 scic_sds_port_default_frame_handler,
1485 scic_sds_port_default_event_handler,
1486 scic_sds_port_ready_operational_substate_link_up_handler,
1487 scic_sds_port_ready_operational_substate_link_down_handler,
1488 scic_sds_port_ready_operational_substate_start_io_handler,
1489 scic_sds_port_ready_substate_complete_io_handler
1490 },
1491 /* SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING */
1492 {
1493 {
1494 scic_sds_port_default_start_handler,
1495 scic_sds_port_ready_substate_stop_handler,
1496 scic_sds_port_default_destruct_handler,
1497 scic_sds_port_default_reset_handler,
1498 scic_sds_port_ready_configuring_substate_add_phy_handler,
1499 scic_sds_port_ready_configuring_substate_remove_phy_handler
1500 },
1501 scic_sds_port_default_frame_handler,
1502 scic_sds_port_default_event_handler,
1503 scic_sds_port_default_link_up_handler,
1504 scic_sds_port_default_link_down_handler,
1505 scic_sds_port_default_start_io_handler,
1506 scic_sds_port_ready_configuring_substate_complete_io_handler
1507 }
1508 };
1509
1510
1511 /**
1512 * scic_sds_port_set_ready_state_handlers() -
1513 *
1514 * This macro sets the port ready substate handlers.
1515 */
1516 #define scic_sds_port_set_ready_state_handlers(port, state_id) \
1517 scic_sds_port_set_state_handlers(\
1518 port, &scic_sds_port_ready_substate_handler_table[(state_id)] \
1519 )
1520
1521 /*
1522 * ******************************************************************************
1523 * * PORT STATE PRIVATE METHODS
1524 * ****************************************************************************** */
1525
1526 /**
1527 *
1528 * @this_port: This is the struct scic_sds_port object to suspend.
1529 *
1530 * This method will susped the port task scheduler for this port object. none
1531 */
1532 static void scic_sds_port_suspend_port_task_scheduler(
1533 struct scic_sds_port *this_port)
1534 {
1535 u32 pts_control_value;
1536
1537 pts_control_value = scu_port_task_scheduler_read(this_port, control);
1538
1539 pts_control_value |= SCU_PTSxCR_GEN_BIT(SUSPEND);
1540
1541 scu_port_task_scheduler_write(this_port, control, pts_control_value);
1542 }
1543
1544 /**
1545 *
1546 * @this_port: This is the struct scic_sds_port object to resume.
1547 *
1548 * This method will resume the port task scheduler for this port object. none
1549 */
1550 static void scic_sds_port_resume_port_task_scheduler(
1551 struct scic_sds_port *this_port)
1552 {
1553 u32 pts_control_value;
1554
1555 pts_control_value = scu_port_task_scheduler_read(this_port, control);
1556
1557 pts_control_value &= ~SCU_PTSxCR_GEN_BIT(SUSPEND);
1558
1559 scu_port_task_scheduler_write(this_port, control, pts_control_value);
1560 }
1561
1562 /*
1563 * ******************************************************************************
1564 * * PORT READY SUBSTATE METHODS
1565 * ****************************************************************************** */
1566
1567 /**
1568 *
1569 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
1570 *
1571 * This method will perform the actions required by the struct scic_sds_port on
1572 * entering the SCIC_SDS_PORT_READY_SUBSTATE_WAITING. This function checks the
1573 * port for any ready phys. If there is at least one phy in a ready state then
1574 * the port transitions to the ready operational substate. none
1575 */
1576 static void scic_sds_port_ready_substate_waiting_enter(
1577 struct sci_base_object *object)
1578 {
1579 struct scic_sds_port *this_port = (struct scic_sds_port *)object;
1580
1581 scic_sds_port_set_ready_state_handlers(
1582 this_port, SCIC_SDS_PORT_READY_SUBSTATE_WAITING
1583 );
1584
1585 scic_sds_port_suspend_port_task_scheduler(this_port);
1586
1587 this_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS;
1588
1589 if (this_port->active_phy_mask != 0) {
1590 /* At least one of the phys on the port is ready */
1591 sci_base_state_machine_change_state(
1592 &this_port->ready_substate_machine,
1593 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
1594 );
1595 }
1596 }
1597
1598 /**
1599 *
1600 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
1601 *
1602 * This method will perform the actions required by the struct scic_sds_port on
1603 * entering the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function sets
1604 * the state handlers for the port object, notifies the SCI User that the port
1605 * is ready, and resumes port operations. none
1606 */
1607 static void scic_sds_port_ready_substate_operational_enter(
1608 struct sci_base_object *object)
1609 {
1610 u32 index;
1611 struct scic_sds_port *this_port = (struct scic_sds_port *)object;
1612
1613 scic_sds_port_set_ready_state_handlers(
1614 this_port, SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
1615 );
1616
1617 isci_event_port_ready(
1618 scic_sds_port_get_controller(this_port), this_port
1619 );
1620
1621 for (index = 0; index < SCI_MAX_PHYS; index++) {
1622 if (this_port->phy_table[index] != NULL) {
1623 scic_sds_port_write_phy_assignment(
1624 this_port, this_port->phy_table[index]
1625 );
1626 }
1627 }
1628
1629 scic_sds_port_update_viit_entry(this_port);
1630
1631 scic_sds_port_resume_port_task_scheduler(this_port);
1632 }
1633
1634 /**
1635 *
1636 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
1637 *
1638 * This method will perform the actions required by the struct scic_sds_port on
1639 * exiting the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function reports
1640 * the port not ready and suspends the port task scheduler. none
1641 */
1642 static void scic_sds_port_ready_substate_operational_exit(
1643 struct sci_base_object *object)
1644 {
1645 struct scic_sds_port *this_port = (struct scic_sds_port *)object;
1646
1647 isci_event_port_not_ready(
1648 scic_sds_port_get_controller(this_port),
1649 this_port,
1650 this_port->not_ready_reason
1651 );
1652 }
1653
1654 /*
1655 * ******************************************************************************
1656 * * PORT READY CONFIGURING METHODS
1657 * ****************************************************************************** */
1658
1659 /**
1660 * scic_sds_port_ready_substate_configuring_enter() -
1661 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
1662 *
1663 * This method will perform the actions required by the struct scic_sds_port on
1664 * exiting the SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL. This function reports
1665 * the port not ready and suspends the port task scheduler. none
1666 */
1667 static void scic_sds_port_ready_substate_configuring_enter(
1668 struct sci_base_object *object)
1669 {
1670 struct scic_sds_port *this_port = (struct scic_sds_port *)object;
1671
1672 scic_sds_port_set_ready_state_handlers(
1673 this_port, SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING
1674 );
1675
1676 if (this_port->active_phy_mask == 0) {
1677 isci_event_port_not_ready(
1678 scic_sds_port_get_controller(this_port),
1679 this_port,
1680 SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS
1681 );
1682
1683 sci_base_state_machine_change_state(
1684 &this_port->ready_substate_machine,
1685 SCIC_SDS_PORT_READY_SUBSTATE_WAITING
1686 );
1687 } else if (this_port->started_request_count == 0) {
1688 sci_base_state_machine_change_state(
1689 &this_port->ready_substate_machine,
1690 SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
1691 );
1692 }
1693 }
1694
1695 static void scic_sds_port_ready_substate_configuring_exit(
1696 struct sci_base_object *object)
1697 {
1698 struct scic_sds_port *this_port = (struct scic_sds_port *)object;
1699
1700 scic_sds_port_suspend_port_task_scheduler(this_port);
1701 }
1702
1703 /* --------------------------------------------------------------------------- */
1704
1705 const struct sci_base_state scic_sds_port_ready_substate_table[] = {
1706 [SCIC_SDS_PORT_READY_SUBSTATE_WAITING] = {
1707 .enter_state = scic_sds_port_ready_substate_waiting_enter,
1708 },
1709 [SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL] = {
1710 .enter_state = scic_sds_port_ready_substate_operational_enter,
1711 .exit_state = scic_sds_port_ready_substate_operational_exit
1712 },
1713 [SCIC_SDS_PORT_READY_SUBSTATE_CONFIGURING] = {
1714 .enter_state = scic_sds_port_ready_substate_configuring_enter,
1715 .exit_state = scic_sds_port_ready_substate_configuring_exit
1716 },
1717 };
1718
1719 /*
1720 * ***************************************************************************
1721 * * DEFAULT HANDLERS
1722 * *************************************************************************** */
1723
1724 /**
1725 *
1726 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1727 * object.
1728 *
1729 * This is the default method for port a start request. It will report a
1730 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1731 */
1732 enum sci_status scic_sds_port_default_start_handler(
1733 struct sci_base_port *port)
1734 {
1735 struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
1736
1737 dev_warn(sciport_to_dev(sci_port),
1738 "%s: SCIC Port 0x%p requested to start while in invalid "
1739 "state %d\n",
1740 __func__,
1741 port,
1742 sci_base_state_machine_get_state(
1743 scic_sds_port_get_base_state_machine(
1744 (struct scic_sds_port *)port)));
1745
1746 return SCI_FAILURE_INVALID_STATE;
1747 }
1748
1749 /**
1750 *
1751 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1752 * object.
1753 *
1754 * This is the default method for a port stop request. It will report a
1755 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1756 */
1757 static enum sci_status scic_sds_port_default_stop_handler(
1758 struct sci_base_port *port)
1759 {
1760 struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
1761
1762 dev_warn(sciport_to_dev(sci_port),
1763 "%s: SCIC Port 0x%p requested to stop while in invalid "
1764 "state %d\n",
1765 __func__,
1766 port,
1767 sci_base_state_machine_get_state(
1768 scic_sds_port_get_base_state_machine(
1769 (struct scic_sds_port *)port)));
1770
1771 return SCI_FAILURE_INVALID_STATE;
1772 }
1773
1774 /**
1775 *
1776 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1777 * object.
1778 *
1779 * This is the default method for a port destruct request. It will report a
1780 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1781 */
1782 enum sci_status scic_sds_port_default_destruct_handler(
1783 struct sci_base_port *port)
1784 {
1785 struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
1786
1787 dev_warn(sciport_to_dev(sci_port),
1788 "%s: SCIC Port 0x%p requested to destruct while in invalid "
1789 "state %d\n",
1790 __func__,
1791 port,
1792 sci_base_state_machine_get_state(
1793 scic_sds_port_get_base_state_machine(
1794 (struct scic_sds_port *)port)));
1795
1796 return SCI_FAILURE_INVALID_STATE;
1797 }
1798
1799 /**
1800 *
1801 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1802 * object.
1803 * @timeout: This is the timeout for the reset request to complete.
1804 *
1805 * This is the default method for a port reset request. It will report a
1806 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1807 */
1808 enum sci_status scic_sds_port_default_reset_handler(
1809 struct sci_base_port *port,
1810 u32 timeout)
1811 {
1812 struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
1813
1814 dev_warn(sciport_to_dev(sci_port),
1815 "%s: SCIC Port 0x%p requested to reset while in invalid "
1816 "state %d\n",
1817 __func__,
1818 port,
1819 sci_base_state_machine_get_state(
1820 scic_sds_port_get_base_state_machine(
1821 (struct scic_sds_port *)port)));
1822
1823 return SCI_FAILURE_INVALID_STATE;
1824 }
1825
1826 /**
1827 *
1828 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1829 * object.
1830 *
1831 * This is the default method for a port add phy request. It will report a
1832 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1833 */
1834 static enum sci_status scic_sds_port_default_add_phy_handler(
1835 struct sci_base_port *port,
1836 struct sci_base_phy *phy)
1837 {
1838 struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
1839
1840 dev_warn(sciport_to_dev(sci_port),
1841 "%s: SCIC Port 0x%p requested to add phy 0x%p while in "
1842 "invalid state %d\n",
1843 __func__,
1844 port,
1845 phy,
1846 sci_base_state_machine_get_state(
1847 scic_sds_port_get_base_state_machine(
1848 (struct scic_sds_port *)port)));
1849
1850 return SCI_FAILURE_INVALID_STATE;
1851 }
1852
1853 /**
1854 *
1855 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1856 * object.
1857 *
1858 * This is the default method for a port remove phy request. It will report a
1859 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1860 */
1861 enum sci_status scic_sds_port_default_remove_phy_handler(
1862 struct sci_base_port *port,
1863 struct sci_base_phy *phy)
1864 {
1865 struct scic_sds_port *sci_port = (struct scic_sds_port *)port;
1866
1867 dev_warn(sciport_to_dev(sci_port),
1868 "%s: SCIC Port 0x%p requested to remove phy 0x%p while in "
1869 "invalid state %d\n",
1870 __func__,
1871 port,
1872 phy,
1873 sci_base_state_machine_get_state(
1874 scic_sds_port_get_base_state_machine(
1875 (struct scic_sds_port *)port)));
1876
1877 return SCI_FAILURE_INVALID_STATE;
1878 }
1879
1880 /**
1881 *
1882 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1883 * object.
1884 *
1885 * This is the default method for a port unsolicited frame request. It will
1886 * report a warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE Is it even
1887 * possible to receive an unsolicited frame directed to a port object? It
1888 * seems possible if we implementing virtual functions but until then?
1889 */
1890 enum sci_status scic_sds_port_default_frame_handler(
1891 struct scic_sds_port *port,
1892 u32 frame_index)
1893 {
1894 dev_warn(sciport_to_dev(port),
1895 "%s: SCIC Port 0x%p requested to process frame %d while in "
1896 "invalid state %d\n",
1897 __func__,
1898 port,
1899 frame_index,
1900 sci_base_state_machine_get_state(
1901 scic_sds_port_get_base_state_machine(port)));
1902
1903 scic_sds_controller_release_frame(
1904 scic_sds_port_get_controller(port), frame_index
1905 );
1906
1907 return SCI_FAILURE_INVALID_STATE;
1908 }
1909
1910 /**
1911 *
1912 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1913 * object.
1914 *
1915 * This is the default method for a port event request. It will report a
1916 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1917 */
1918 enum sci_status scic_sds_port_default_event_handler(
1919 struct scic_sds_port *port,
1920 u32 event_code)
1921 {
1922 dev_warn(sciport_to_dev(port),
1923 "%s: SCIC Port 0x%p requested to process event 0x%x while "
1924 "in invalid state %d\n",
1925 __func__,
1926 port,
1927 event_code,
1928 sci_base_state_machine_get_state(
1929 scic_sds_port_get_base_state_machine(
1930 (struct scic_sds_port *)port)));
1931
1932 return SCI_FAILURE_INVALID_STATE;
1933 }
1934
1935 /**
1936 *
1937 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1938 * object.
1939 *
1940 * This is the default method for a port link up notification. It will report
1941 * a warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1942 */
1943 void scic_sds_port_default_link_up_handler(
1944 struct scic_sds_port *this_port,
1945 struct scic_sds_phy *phy)
1946 {
1947 dev_warn(sciport_to_dev(this_port),
1948 "%s: SCIC Port 0x%p received link_up notification from phy "
1949 "0x%p while in invalid state %d\n",
1950 __func__,
1951 this_port,
1952 phy,
1953 sci_base_state_machine_get_state(
1954 scic_sds_port_get_base_state_machine(this_port)));
1955 }
1956
1957 /**
1958 *
1959 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1960 * object.
1961 *
1962 * This is the default method for a port link down notification. It will
1963 * report a warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1964 */
1965 void scic_sds_port_default_link_down_handler(
1966 struct scic_sds_port *this_port,
1967 struct scic_sds_phy *phy)
1968 {
1969 dev_warn(sciport_to_dev(this_port),
1970 "%s: SCIC Port 0x%p received link down notification from "
1971 "phy 0x%p while in invalid state %d\n",
1972 __func__,
1973 this_port,
1974 phy,
1975 sci_base_state_machine_get_state(
1976 scic_sds_port_get_base_state_machine(this_port)));
1977 }
1978
1979 /**
1980 *
1981 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
1982 * object.
1983 *
1984 * This is the default method for a port start io request. It will report a
1985 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
1986 */
1987 enum sci_status scic_sds_port_default_start_io_handler(
1988 struct scic_sds_port *this_port,
1989 struct scic_sds_remote_device *device,
1990 struct scic_sds_request *io_request)
1991 {
1992 dev_warn(sciport_to_dev(this_port),
1993 "%s: SCIC Port 0x%p requested to start io request 0x%p "
1994 "while in invalid state %d\n",
1995 __func__,
1996 this_port,
1997 io_request,
1998 sci_base_state_machine_get_state(
1999 scic_sds_port_get_base_state_machine(this_port)));
2000
2001 return SCI_FAILURE_INVALID_STATE;
2002 }
2003
2004 /**
2005 *
2006 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2007 * object.
2008 *
2009 * This is the default method for a port complete io request. It will report a
2010 * warning and exit. enum sci_status SCI_FAILURE_INVALID_STATE
2011 */
2012 static enum sci_status scic_sds_port_default_complete_io_handler(
2013 struct scic_sds_port *this_port,
2014 struct scic_sds_remote_device *device,
2015 struct scic_sds_request *io_request)
2016 {
2017 dev_warn(sciport_to_dev(this_port),
2018 "%s: SCIC Port 0x%p requested to complete io request 0x%p "
2019 "while in invalid state %d\n",
2020 __func__,
2021 this_port,
2022 io_request,
2023 sci_base_state_machine_get_state(
2024 scic_sds_port_get_base_state_machine(this_port)));
2025
2026 return SCI_FAILURE_INVALID_STATE;
2027 }
2028
2029 /*
2030 * ****************************************************************************
2031 * * GENERAL STATE HANDLERS
2032 * **************************************************************************** */
2033
2034 /**
2035 *
2036 * @port: This is the struct scic_sds_port object on which the io request count will
2037 * be decremented.
2038 * @device: This is the struct scic_sds_remote_device object to which the io request
2039 * is being directed. This parameter is not required to complete this
2040 * operation.
2041 * @io_request: This is the request that is being completed on this port
2042 * object. This parameter is not required to complete this operation.
2043 *
2044 * This is a general complete io request handler for the struct scic_sds_port object.
2045 * enum sci_status SCI_SUCCESS
2046 */
2047 static enum sci_status scic_sds_port_general_complete_io_handler(
2048 struct scic_sds_port *port,
2049 struct scic_sds_remote_device *device,
2050 struct scic_sds_request *io_request)
2051 {
2052 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2053
2054 scic_sds_port_decrement_request_count(this_port);
2055
2056 return SCI_SUCCESS;
2057 }
2058
2059 /*
2060 * ****************************************************************************
2061 * * STOPPED STATE HANDLERS
2062 * **************************************************************************** */
2063
2064 /**
2065 *
2066 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2067 * object.
2068 *
2069 * This method takes the struct scic_sds_port from a stopped state and attempts to
2070 * start it. To start a port it must have no assiged devices and it must have
2071 * at least one phy assigned to it. If those conditions are met then the port
2072 * can transition to the ready state. enum sci_status
2073 * SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION This struct scic_sds_port object could
2074 * not be started because the port configuration is not valid. SCI_SUCCESS the
2075 * start request is successful and the struct scic_sds_port object has transitioned to
2076 * the SCI_BASE_PORT_STATE_READY.
2077 */
2078 static enum sci_status scic_sds_port_stopped_state_start_handler(
2079 struct sci_base_port *port)
2080 {
2081 u32 phy_mask;
2082 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2083
2084 if (this_port->assigned_device_count > 0) {
2085 /*
2086 * / @todo This is a start failure operation because there are still
2087 * / devices assigned to this port. There must be no devices
2088 * / assigned to a port on a start operation. */
2089 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
2090 }
2091
2092 phy_mask = scic_sds_port_get_phys(this_port);
2093
2094 /*
2095 * There are one or more phys assigned to this port. Make sure
2096 * the port's phy mask is in fact legal and supported by the
2097 * silicon. */
2098 if (scic_sds_port_is_phy_mask_valid(this_port, phy_mask) == true) {
2099 sci_base_state_machine_change_state(
2100 scic_sds_port_get_base_state_machine(this_port),
2101 SCI_BASE_PORT_STATE_READY
2102 );
2103
2104 return SCI_SUCCESS;
2105 }
2106
2107 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
2108 }
2109
2110 /**
2111 *
2112 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2113 * object.
2114 *
2115 * This method takes the struct scic_sds_port that is in a stopped state and handles a
2116 * stop request. This function takes no action. enum sci_status SCI_SUCCESS the
2117 * stop request is successful as the struct scic_sds_port object is already stopped.
2118 */
2119 static enum sci_status scic_sds_port_stopped_state_stop_handler(
2120 struct sci_base_port *port)
2121 {
2122 /* We are already stopped so there is nothing to do here */
2123 return SCI_SUCCESS;
2124 }
2125
2126 /**
2127 *
2128 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2129 * object.
2130 *
2131 * This method takes the struct scic_sds_port that is in a stopped state and handles
2132 * the destruct request. The stopped state is the only state in which the
2133 * struct scic_sds_port can be destroyed. This function causes the port object to
2134 * transition to the SCI_BASE_PORT_STATE_FINAL. enum sci_status SCI_SUCCESS
2135 */
2136 static enum sci_status scic_sds_port_stopped_state_destruct_handler(
2137 struct sci_base_port *port)
2138 {
2139 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2140
2141 sci_base_state_machine_stop(&this_port->parent.state_machine);
2142
2143 return SCI_SUCCESS;
2144 }
2145
2146 /**
2147 *
2148 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2149 * object.
2150 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2151 * object.
2152 *
2153 * This method takes the struct scic_sds_port that is in a stopped state and handles
2154 * the add phy request. In MPC mode the only time a phy can be added to a port
2155 * is in the SCI_BASE_PORT_STATE_STOPPED. enum sci_status
2156 * SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION is returned when the phy can not
2157 * be added to the port. SCI_SUCCESS if the phy is added to the port.
2158 */
2159 static enum sci_status scic_sds_port_stopped_state_add_phy_handler(
2160 struct sci_base_port *port,
2161 struct sci_base_phy *phy)
2162 {
2163 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2164 struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
2165 struct sci_sas_address port_sas_address;
2166
2167 /* Read the port assigned SAS Address if there is one */
2168 scic_sds_port_get_sas_address(this_port, &port_sas_address);
2169
2170 if (port_sas_address.high != 0 && port_sas_address.low != 0) {
2171 struct sci_sas_address phy_sas_address;
2172
2173 /*
2174 * Make sure that the PHY SAS Address matches the SAS Address
2175 * for this port. */
2176 scic_sds_phy_get_sas_address(this_phy, &phy_sas_address);
2177
2178 if (
2179 (port_sas_address.high != phy_sas_address.high)
2180 || (port_sas_address.low != phy_sas_address.low)
2181 ) {
2182 return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
2183 }
2184 }
2185
2186 return scic_sds_port_set_phy(this_port, this_phy);
2187 }
2188
2189
2190 /**
2191 *
2192 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2193 * object.
2194 * @phy: This is the struct sci_base_phy object which is cast into a struct scic_sds_phy
2195 * object.
2196 *
2197 * This method takes the struct scic_sds_port that is in a stopped state and handles
2198 * the remove phy request. In MPC mode the only time a phy can be removed from
2199 * a port is in the SCI_BASE_PORT_STATE_STOPPED. enum sci_status
2200 * SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION is returned when the phy can not
2201 * be added to the port. SCI_SUCCESS if the phy is added to the port.
2202 */
2203 static enum sci_status scic_sds_port_stopped_state_remove_phy_handler(
2204 struct sci_base_port *port,
2205 struct sci_base_phy *phy)
2206 {
2207 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2208 struct scic_sds_phy *this_phy = (struct scic_sds_phy *)phy;
2209
2210 return scic_sds_port_clear_phy(this_port, this_phy);
2211 }
2212
2213 /*
2214 * ****************************************************************************
2215 * * READY STATE HANDLERS
2216 * **************************************************************************** */
2217
2218 /*
2219 * ****************************************************************************
2220 * * RESETTING STATE HANDLERS
2221 * **************************************************************************** */
2222
2223 /*
2224 * ****************************************************************************
2225 * * STOPPING STATE HANDLERS
2226 * **************************************************************************** */
2227
2228 /**
2229 *
2230 * @port: This is the struct scic_sds_port object on which the io request count will
2231 * be decremented.
2232 * @device: This is the struct scic_sds_remote_device object to which the io request
2233 * is being directed. This parameter is not required to complete this
2234 * operation.
2235 * @io_request: This is the request that is being completed on this port
2236 * object. This parameter is not required to complete this operation.
2237 *
2238 * This method takes the struct scic_sds_port that is in a stopping state and handles
2239 * the complete io request. Should the request count reach 0 then the port
2240 * object will transition to the stopped state. enum sci_status SCI_SUCCESS
2241 */
2242 static enum sci_status scic_sds_port_stopping_state_complete_io_handler(
2243 struct scic_sds_port *port,
2244 struct scic_sds_remote_device *device,
2245 struct scic_sds_request *io_request)
2246 {
2247 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2248
2249 scic_sds_port_decrement_request_count(this_port);
2250
2251 if (this_port->started_request_count == 0) {
2252 sci_base_state_machine_change_state(
2253 scic_sds_port_get_base_state_machine(this_port),
2254 SCI_BASE_PORT_STATE_STOPPED
2255 );
2256 }
2257
2258 return SCI_SUCCESS;
2259 }
2260
2261 /*
2262 * ****************************************************************************
2263 * * RESETTING STATE HANDLERS
2264 * **************************************************************************** */
2265
2266 /**
2267 *
2268 * @port: This is the port object which is being requested to stop.
2269 *
2270 * This method will stop a failed port. This causes a transition to the
2271 * stopping state. enum sci_status SCI_SUCCESS
2272 */
2273 static enum sci_status scic_sds_port_reset_state_stop_handler(
2274 struct sci_base_port *port)
2275 {
2276 struct scic_sds_port *this_port = (struct scic_sds_port *)port;
2277
2278 sci_base_state_machine_change_state(
2279 &this_port->parent.state_machine,
2280 SCI_BASE_PORT_STATE_STOPPING
2281 );
2282
2283 return SCI_SUCCESS;
2284 }
2285
2286 /**
2287 *
2288 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2289 * object.
2290 *
2291 * This method will transition a failed port to its ready state. The port
2292 * failed because a hard reset request timed out but at some time later one or
2293 * more phys in the port became ready. enum sci_status SCI_SUCCESS
2294 */
2295 static void scic_sds_port_reset_state_link_up_handler(
2296 struct scic_sds_port *this_port,
2297 struct scic_sds_phy *phy)
2298 {
2299 /*
2300 * / @todo We should make sure that the phy that has gone link up is the same
2301 * / one on which we sent the reset. It is possible that the phy on
2302 * / which we sent the reset is not the one that has gone link up and we
2303 * / want to make sure that phy being reset comes back. Consider the
2304 * / case where a reset is sent but before the hardware processes the
2305 * / reset it get a link up on the port because of a hot plug event.
2306 * / because of the reset request this phy will go link down almost
2307 * / immediately. */
2308
2309 /*
2310 * In the resetting state we don't notify the user regarding
2311 * link up and link down notifications. */
2312 scic_sds_port_general_link_up_handler(this_port, phy, false);
2313 }
2314
2315 /**
2316 *
2317 * @port: This is the struct sci_base_port object which is cast into a struct scic_sds_port
2318 * object.
2319 *
2320 * This method process link down notifications that occur during a port reset
2321 * operation. Link downs can occur during the reset operation. enum sci_status
2322 * SCI_SUCCESS
2323 */
2324 static void scic_sds_port_reset_state_link_down_handler(
2325 struct scic_sds_port *this_port,
2326 struct scic_sds_phy *phy)
2327 {
2328 /*
2329 * In the resetting state we don't notify the user regarding
2330 * link up and link down notifications. */
2331 scic_sds_port_deactivate_phy(this_port, phy, false);
2332 }
2333
2334 /* --------------------------------------------------------------------------- */
2335
2336 struct scic_sds_port_state_handler
2337 scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
2338 {
2339 /* SCI_BASE_PORT_STATE_STOPPED */
2340 {
2341 {
2342 scic_sds_port_stopped_state_start_handler,
2343 scic_sds_port_stopped_state_stop_handler,
2344 scic_sds_port_stopped_state_destruct_handler,
2345 scic_sds_port_default_reset_handler,
2346 scic_sds_port_stopped_state_add_phy_handler,
2347 scic_sds_port_stopped_state_remove_phy_handler
2348 },
2349 scic_sds_port_default_frame_handler,
2350 scic_sds_port_default_event_handler,
2351 scic_sds_port_default_link_up_handler,
2352 scic_sds_port_default_link_down_handler,
2353 scic_sds_port_default_start_io_handler,
2354 scic_sds_port_default_complete_io_handler
2355 },
2356 /* SCI_BASE_PORT_STATE_STOPPING */
2357 {
2358 {
2359 scic_sds_port_default_start_handler,
2360 scic_sds_port_default_stop_handler,
2361 scic_sds_port_default_destruct_handler,
2362 scic_sds_port_default_reset_handler,
2363 scic_sds_port_default_add_phy_handler,
2364 scic_sds_port_default_remove_phy_handler
2365 },
2366 scic_sds_port_default_frame_handler,
2367 scic_sds_port_default_event_handler,
2368 scic_sds_port_default_link_up_handler,
2369 scic_sds_port_default_link_down_handler,
2370 scic_sds_port_default_start_io_handler,
2371 scic_sds_port_stopping_state_complete_io_handler
2372 },
2373 /* SCI_BASE_PORT_STATE_READY */
2374 {
2375 {
2376 scic_sds_port_default_start_handler,
2377 scic_sds_port_default_stop_handler,
2378 scic_sds_port_default_destruct_handler,
2379 scic_sds_port_default_reset_handler,
2380 scic_sds_port_default_add_phy_handler,
2381 scic_sds_port_default_remove_phy_handler
2382 },
2383 scic_sds_port_default_frame_handler,
2384 scic_sds_port_default_event_handler,
2385 scic_sds_port_default_link_up_handler,
2386 scic_sds_port_default_link_down_handler,
2387 scic_sds_port_default_start_io_handler,
2388 scic_sds_port_general_complete_io_handler
2389 },
2390 /* SCI_BASE_PORT_STATE_RESETTING */
2391 {
2392 {
2393 scic_sds_port_default_start_handler,
2394 scic_sds_port_reset_state_stop_handler,
2395 scic_sds_port_default_destruct_handler,
2396 scic_sds_port_default_reset_handler,
2397 scic_sds_port_default_add_phy_handler,
2398 scic_sds_port_default_remove_phy_handler
2399 },
2400 scic_sds_port_default_frame_handler,
2401 scic_sds_port_default_event_handler,
2402 scic_sds_port_reset_state_link_up_handler,
2403 scic_sds_port_reset_state_link_down_handler,
2404 scic_sds_port_default_start_io_handler,
2405 scic_sds_port_general_complete_io_handler
2406 },
2407 /* SCI_BASE_PORT_STATE_FAILED */
2408 {
2409 {
2410 scic_sds_port_default_start_handler,
2411 scic_sds_port_default_stop_handler,
2412 scic_sds_port_default_destruct_handler,
2413 scic_sds_port_default_reset_handler,
2414 scic_sds_port_default_add_phy_handler,
2415 scic_sds_port_default_remove_phy_handler
2416 },
2417 scic_sds_port_default_frame_handler,
2418 scic_sds_port_default_event_handler,
2419 scic_sds_port_default_link_up_handler,
2420 scic_sds_port_default_link_down_handler,
2421 scic_sds_port_default_start_io_handler,
2422 scic_sds_port_general_complete_io_handler
2423 }
2424 };
2425
2426 /*
2427 * ******************************************************************************
2428 * * PORT STATE PRIVATE METHODS
2429 * ****************************************************************************** */
2430
2431 /**
2432 *
2433 * @this_port: This is the port object which to suspend.
2434 *
2435 * This method will enable the SCU Port Task Scheduler for this port object but
2436 * will leave the port task scheduler in a suspended state. none
2437 */
2438 static void scic_sds_port_enable_port_task_scheduler(
2439 struct scic_sds_port *this_port)
2440 {
2441 u32 pts_control_value;
2442
2443 pts_control_value = scu_port_task_scheduler_read(this_port, control);
2444
2445 pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND);
2446
2447 scu_port_task_scheduler_write(this_port, control, pts_control_value);
2448 }
2449
2450 /**
2451 *
2452 * @this_port: This is the port object which to resume.
2453 *
2454 * This method will disable the SCU port task scheduler for this port object.
2455 * none
2456 */
2457 static void scic_sds_port_disable_port_task_scheduler(
2458 struct scic_sds_port *this_port)
2459 {
2460 u32 pts_control_value;
2461
2462 pts_control_value = scu_port_task_scheduler_read(this_port, control);
2463
2464 pts_control_value &= ~(SCU_PTSxCR_GEN_BIT(ENABLE)
2465 | SCU_PTSxCR_GEN_BIT(SUSPEND));
2466
2467 scu_port_task_scheduler_write(this_port, control, pts_control_value);
2468 }
2469
2470 /*
2471 * ******************************************************************************
2472 * * PORT STATE METHODS
2473 * ****************************************************************************** */
2474
2475 /**
2476 *
2477 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2478 *
2479 * This method will perform the actions required by the struct scic_sds_port on
2480 * entering the SCI_BASE_PORT_STATE_STOPPED. This function sets the stopped
2481 * state handlers for the struct scic_sds_port object and disables the port task
2482 * scheduler in the hardware. none
2483 */
2484 static void scic_sds_port_stopped_state_enter(
2485 struct sci_base_object *object)
2486 {
2487 struct scic_sds_port *this_port;
2488
2489 this_port = (struct scic_sds_port *)object;
2490
2491 scic_sds_port_set_base_state_handlers(
2492 this_port, SCI_BASE_PORT_STATE_STOPPED
2493 );
2494
2495 if (
2496 SCI_BASE_PORT_STATE_STOPPING
2497 == this_port->parent.state_machine.previous_state_id
2498 ) {
2499 /*
2500 * If we enter this state becasuse of a request to stop
2501 * the port then we want to disable the hardwares port
2502 * task scheduler. */
2503 scic_sds_port_disable_port_task_scheduler(this_port);
2504 }
2505 }
2506
2507 /**
2508 *
2509 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2510 *
2511 * This method will perform the actions required by the struct scic_sds_port on
2512 * exiting the SCI_BASE_STATE_STOPPED. This function enables the SCU hardware
2513 * port task scheduler. none
2514 */
2515 static void scic_sds_port_stopped_state_exit(
2516 struct sci_base_object *object)
2517 {
2518 struct scic_sds_port *this_port;
2519
2520 this_port = (struct scic_sds_port *)object;
2521
2522 /* Enable and suspend the port task scheduler */
2523 scic_sds_port_enable_port_task_scheduler(this_port);
2524 }
2525
2526 /**
2527 *
2528 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2529 *
2530 * This method will perform the actions required by the struct scic_sds_port on
2531 * entering the SCI_BASE_PORT_STATE_READY. This function sets the ready state
2532 * handlers for the struct scic_sds_port object, reports the port object as not ready
2533 * and starts the ready substate machine. none
2534 */
2535 static void scic_sds_port_ready_state_enter(
2536 struct sci_base_object *object)
2537 {
2538 struct scic_sds_port *this_port;
2539
2540 this_port = (struct scic_sds_port *)object;
2541
2542 /* Put the ready state handlers in place though they will not be there long */
2543 scic_sds_port_set_base_state_handlers(
2544 this_port, SCI_BASE_PORT_STATE_READY
2545 );
2546
2547 if (
2548 SCI_BASE_PORT_STATE_RESETTING
2549 == this_port->parent.state_machine.previous_state_id
2550 ) {
2551 isci_event_port_hard_reset_complete(
2552 scic_sds_port_get_controller(this_port),
2553 this_port,
2554 SCI_SUCCESS
2555 );
2556 } else {
2557 /* Notify the caller that the port is not yet ready */
2558 isci_event_port_not_ready(
2559 scic_sds_port_get_controller(this_port),
2560 this_port,
2561 SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS
2562 );
2563 }
2564
2565 /* Start the ready substate machine */
2566 sci_base_state_machine_start(
2567 scic_sds_port_get_ready_substate_machine(this_port)
2568 );
2569 }
2570
2571 /**
2572 *
2573 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2574 *
2575 * This method will perform the actions required by the struct scic_sds_port on
2576 * exiting the SCI_BASE_STATE_READY. This function does nothing. none
2577 */
2578 static void scic_sds_port_ready_state_exit(
2579 struct sci_base_object *object)
2580 {
2581 struct scic_sds_port *this_port;
2582
2583 this_port = (struct scic_sds_port *)object;
2584
2585 sci_base_state_machine_stop(&this_port->ready_substate_machine);
2586 }
2587
2588 /**
2589 *
2590 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2591 *
2592 * This method will perform the actions required by the struct scic_sds_port on
2593 * entering the SCI_BASE_PORT_STATE_RESETTING. This function sets the resetting
2594 * state handlers for the struct scic_sds_port object. none
2595 */
2596 static void scic_sds_port_resetting_state_enter(
2597 struct sci_base_object *object)
2598 {
2599 struct scic_sds_port *this_port;
2600
2601 this_port = (struct scic_sds_port *)object;
2602
2603 scic_sds_port_set_base_state_handlers(
2604 this_port, SCI_BASE_PORT_STATE_RESETTING
2605 );
2606 }
2607
2608 /**
2609 *
2610 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2611 *
2612 * This method will perform the actions required by the struct scic_sds_port on
2613 * exiting the SCI_BASE_STATE_RESETTING. This function does nothing. none
2614 */
2615 static void scic_sds_port_resetting_state_exit(
2616 struct sci_base_object *object)
2617 {
2618 struct scic_sds_port *this_port;
2619
2620 this_port = (struct scic_sds_port *)object;
2621
2622 isci_event_timer_stop(
2623 scic_sds_port_get_controller(this_port),
2624 this_port->timer_handle
2625 );
2626 }
2627
2628 /**
2629 *
2630 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2631 *
2632 * This method will perform the actions required by the struct scic_sds_port on
2633 * entering the SCI_BASE_PORT_STATE_STOPPING. This function sets the stopping
2634 * state handlers for the struct scic_sds_port object. none
2635 */
2636 static void scic_sds_port_stopping_state_enter(
2637 struct sci_base_object *object)
2638 {
2639 struct scic_sds_port *this_port;
2640
2641 this_port = (struct scic_sds_port *)object;
2642
2643 scic_sds_port_set_base_state_handlers(
2644 this_port, SCI_BASE_PORT_STATE_STOPPING
2645 );
2646 }
2647
2648 /**
2649 *
2650 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2651 *
2652 * This method will perform the actions required by the struct scic_sds_port on
2653 * exiting the SCI_BASE_STATE_STOPPING. This function does nothing. none
2654 */
2655 static void scic_sds_port_stopping_state_exit(
2656 struct sci_base_object *object)
2657 {
2658 struct scic_sds_port *this_port;
2659
2660 this_port = (struct scic_sds_port *)object;
2661
2662 isci_event_timer_stop(
2663 scic_sds_port_get_controller(this_port),
2664 this_port->timer_handle
2665 );
2666 }
2667
2668 /**
2669 *
2670 * @object: This is the struct sci_base_object which is cast to a struct scic_sds_port object.
2671 *
2672 * This method will perform the actions required by the struct scic_sds_port on
2673 * entering the SCI_BASE_PORT_STATE_STOPPING. This function sets the stopping
2674 * state handlers for the struct scic_sds_port object. none
2675 */
2676 static void scic_sds_port_failed_state_enter(
2677 struct sci_base_object *object)
2678 {
2679 struct scic_sds_port *this_port;
2680
2681 this_port = (struct scic_sds_port *)object;
2682
2683 scic_sds_port_set_base_state_handlers(
2684 this_port,
2685 SCI_BASE_PORT_STATE_FAILED
2686 );
2687
2688 isci_event_port_hard_reset_complete(
2689 scic_sds_port_get_controller(this_port),
2690 this_port,
2691 SCI_FAILURE_TIMEOUT
2692 );
2693 }
2694
2695 /* --------------------------------------------------------------------------- */
2696
2697 const struct sci_base_state scic_sds_port_state_table[] = {
2698 [SCI_BASE_PORT_STATE_STOPPED] = {
2699 .enter_state = scic_sds_port_stopped_state_enter,
2700 .exit_state = scic_sds_port_stopped_state_exit
2701 },
2702 [SCI_BASE_PORT_STATE_STOPPING] = {
2703 .enter_state = scic_sds_port_stopping_state_enter,
2704 .exit_state = scic_sds_port_stopping_state_exit
2705 },
2706 [SCI_BASE_PORT_STATE_READY] = {
2707 .enter_state = scic_sds_port_ready_state_enter,
2708 .exit_state = scic_sds_port_ready_state_exit
2709 },
2710 [SCI_BASE_PORT_STATE_RESETTING] = {
2711 .enter_state = scic_sds_port_resetting_state_enter,
2712 .exit_state = scic_sds_port_resetting_state_exit
2713 },
2714 [SCI_BASE_PORT_STATE_FAILED] = {
2715 .enter_state = scic_sds_port_failed_state_enter,
2716 }
2717 };
2718
This page took 0.087476 seconds and 4 git commands to generate.