diff options
Diffstat (limited to 'drivers/scsi/isci/port.c')
-rw-r--r-- | drivers/scsi/isci/port.c | 551 |
1 files changed, 207 insertions, 344 deletions
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index c434d5a0effa..1822ed68409e 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -74,57 +74,35 @@ static void isci_port_change_state(struct isci_port *iport, enum isci_status sta | |||
74 | spin_unlock_irqrestore(&iport->state_lock, flags); | 74 | spin_unlock_irqrestore(&iport->state_lock, flags); |
75 | } | 75 | } |
76 | 76 | ||
77 | /* | 77 | static void sci_port_get_protocols(struct isci_port *iport, struct sci_phy_proto *proto) |
78 | * This function will indicate which protocols are supported by this port. | ||
79 | * @sci_port: a handle corresponding to the SAS port for which to return the | ||
80 | * supported protocols. | ||
81 | * @protocols: This parameter specifies a pointer to a data structure | ||
82 | * which the core will copy the protocol values for the port from the | ||
83 | * transmit_identification register. | ||
84 | */ | ||
85 | static void | ||
86 | scic_sds_port_get_protocols(struct isci_port *iport, | ||
87 | struct scic_phy_proto *protocols) | ||
88 | { | 78 | { |
89 | u8 index; | 79 | u8 index; |
90 | 80 | ||
91 | protocols->all = 0; | 81 | proto->all = 0; |
92 | |||
93 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 82 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
94 | if (iport->phy_table[index] != NULL) { | 83 | struct isci_phy *iphy = iport->phy_table[index]; |
95 | scic_sds_phy_get_protocols(iport->phy_table[index], | 84 | |
96 | protocols); | 85 | if (!iphy) |
97 | } | 86 | continue; |
87 | sci_phy_get_protocols(iphy, proto); | ||
98 | } | 88 | } |
99 | } | 89 | } |
100 | 90 | ||
101 | /** | 91 | static u32 sci_port_get_phys(struct isci_port *iport) |
102 | * This method requests a list (mask) of the phys contained in the supplied SAS | ||
103 | * port. | ||
104 | * @sci_port: a handle corresponding to the SAS port for which to return the | ||
105 | * phy mask. | ||
106 | * | ||
107 | * Return a bit mask indicating which phys are a part of this port. Each bit | ||
108 | * corresponds to a phy identifier (e.g. bit 0 = phy id 0). | ||
109 | */ | ||
110 | static u32 scic_sds_port_get_phys(struct isci_port *iport) | ||
111 | { | 92 | { |
112 | u32 index; | 93 | u32 index; |
113 | u32 mask; | 94 | u32 mask; |
114 | 95 | ||
115 | mask = 0; | 96 | mask = 0; |
116 | 97 | for (index = 0; index < SCI_MAX_PHYS; index++) | |
117 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 98 | if (iport->phy_table[index]) |
118 | if (iport->phy_table[index] != NULL) { | ||
119 | mask |= (1 << index); | 99 | mask |= (1 << index); |
120 | } | ||
121 | } | ||
122 | 100 | ||
123 | return mask; | 101 | return mask; |
124 | } | 102 | } |
125 | 103 | ||
126 | /** | 104 | /** |
127 | * scic_port_get_properties() - This method simply returns the properties | 105 | * sci_port_get_properties() - This method simply returns the properties |
128 | * regarding the port, such as: physical index, protocols, sas address, etc. | 106 | * regarding the port, such as: physical index, protocols, sas address, etc. |
129 | * @port: this parameter specifies the port for which to retrieve the physical | 107 | * @port: this parameter specifies the port for which to retrieve the physical |
130 | * index. | 108 | * index. |
@@ -136,22 +114,22 @@ static u32 scic_sds_port_get_phys(struct isci_port *iport) | |||
136 | * value is returned if the specified port is not valid. When this value is | 114 | * value is returned if the specified port is not valid. When this value is |
137 | * returned, no data is copied to the properties output parameter. | 115 | * returned, no data is copied to the properties output parameter. |
138 | */ | 116 | */ |
139 | static enum sci_status scic_port_get_properties(struct isci_port *iport, | 117 | static enum sci_status sci_port_get_properties(struct isci_port *iport, |
140 | struct scic_port_properties *prop) | 118 | struct sci_port_properties *prop) |
141 | { | 119 | { |
142 | if (!iport || iport->logical_port_index == SCIC_SDS_DUMMY_PORT) | 120 | if (!iport || iport->logical_port_index == SCIC_SDS_DUMMY_PORT) |
143 | return SCI_FAILURE_INVALID_PORT; | 121 | return SCI_FAILURE_INVALID_PORT; |
144 | 122 | ||
145 | prop->index = iport->logical_port_index; | 123 | prop->index = iport->logical_port_index; |
146 | prop->phy_mask = scic_sds_port_get_phys(iport); | 124 | prop->phy_mask = sci_port_get_phys(iport); |
147 | scic_sds_port_get_sas_address(iport, &prop->local.sas_address); | 125 | sci_port_get_sas_address(iport, &prop->local.sas_address); |
148 | scic_sds_port_get_protocols(iport, &prop->local.protocols); | 126 | sci_port_get_protocols(iport, &prop->local.protocols); |
149 | scic_sds_port_get_attached_sas_address(iport, &prop->remote.sas_address); | 127 | sci_port_get_attached_sas_address(iport, &prop->remote.sas_address); |
150 | 128 | ||
151 | return SCI_SUCCESS; | 129 | return SCI_SUCCESS; |
152 | } | 130 | } |
153 | 131 | ||
154 | static void scic_port_bcn_enable(struct isci_port *iport) | 132 | static void sci_port_bcn_enable(struct isci_port *iport) |
155 | { | 133 | { |
156 | struct isci_phy *iphy; | 134 | struct isci_phy *iphy; |
157 | u32 val; | 135 | u32 val; |
@@ -167,7 +145,7 @@ static void scic_port_bcn_enable(struct isci_port *iport) | |||
167 | } | 145 | } |
168 | } | 146 | } |
169 | 147 | ||
170 | /* called under scic_lock to stabilize phy:port associations */ | 148 | /* called under sci_lock to stabilize phy:port associations */ |
171 | void isci_port_bcn_enable(struct isci_host *ihost, struct isci_port *iport) | 149 | void isci_port_bcn_enable(struct isci_host *ihost, struct isci_port *iport) |
172 | { | 150 | { |
173 | int i; | 151 | int i; |
@@ -209,7 +187,7 @@ static void isci_port_bc_change_received(struct isci_host *ihost, | |||
209 | ihost->sas_ha.notify_port_event(&iphy->sas_phy, | 187 | ihost->sas_ha.notify_port_event(&iphy->sas_phy, |
210 | PORTE_BROADCAST_RCVD); | 188 | PORTE_BROADCAST_RCVD); |
211 | } | 189 | } |
212 | scic_port_bcn_enable(iport); | 190 | sci_port_bcn_enable(iport); |
213 | } | 191 | } |
214 | 192 | ||
215 | static void isci_port_link_up(struct isci_host *isci_host, | 193 | static void isci_port_link_up(struct isci_host *isci_host, |
@@ -217,7 +195,7 @@ static void isci_port_link_up(struct isci_host *isci_host, | |||
217 | struct isci_phy *iphy) | 195 | struct isci_phy *iphy) |
218 | { | 196 | { |
219 | unsigned long flags; | 197 | unsigned long flags; |
220 | struct scic_port_properties properties; | 198 | struct sci_port_properties properties; |
221 | unsigned long success = true; | 199 | unsigned long success = true; |
222 | 200 | ||
223 | BUG_ON(iphy->isci_port != NULL); | 201 | BUG_ON(iphy->isci_port != NULL); |
@@ -232,7 +210,7 @@ static void isci_port_link_up(struct isci_host *isci_host, | |||
232 | 210 | ||
233 | isci_port_change_state(iphy->isci_port, isci_starting); | 211 | isci_port_change_state(iphy->isci_port, isci_starting); |
234 | 212 | ||
235 | scic_port_get_properties(iport, &properties); | 213 | sci_port_get_properties(iport, &properties); |
236 | 214 | ||
237 | if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { | 215 | if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { |
238 | u64 attached_sas_address; | 216 | u64 attached_sas_address; |
@@ -245,7 +223,7 @@ static void isci_port_link_up(struct isci_host *isci_host, | |||
245 | * automagically assign a SAS address to the end device | 223 | * automagically assign a SAS address to the end device |
246 | * for the purpose of creating a port. This SAS address | 224 | * for the purpose of creating a port. This SAS address |
247 | * will not be the same as assigned to the PHY and needs | 225 | * will not be the same as assigned to the PHY and needs |
248 | * to be obtained from struct scic_port_properties properties. | 226 | * to be obtained from struct sci_port_properties properties. |
249 | */ | 227 | */ |
250 | attached_sas_address = properties.remote.sas_address.high; | 228 | attached_sas_address = properties.remote.sas_address.high; |
251 | attached_sas_address <<= 32; | 229 | attached_sas_address <<= 32; |
@@ -399,50 +377,40 @@ static void isci_port_hard_reset_complete(struct isci_port *isci_port, | |||
399 | * doesn't preclude all configurations. It merely ensures that a phy is part | 377 | * doesn't preclude all configurations. It merely ensures that a phy is part |
400 | * of the allowable set of phy identifiers for that port. For example, one | 378 | * of the allowable set of phy identifiers for that port. For example, one |
401 | * could assign phy 3 to port 0 and no other phys. Please refer to | 379 | * could assign phy 3 to port 0 and no other phys. Please refer to |
402 | * scic_sds_port_is_phy_mask_valid() for information regarding whether the | 380 | * sci_port_is_phy_mask_valid() for information regarding whether the |
403 | * phy_mask for a port can be supported. bool true if this is a valid phy | 381 | * phy_mask for a port can be supported. bool true if this is a valid phy |
404 | * assignment for the port false if this is not a valid phy assignment for the | 382 | * assignment for the port false if this is not a valid phy assignment for the |
405 | * port | 383 | * port |
406 | */ | 384 | */ |
407 | bool scic_sds_port_is_valid_phy_assignment(struct isci_port *iport, | 385 | bool sci_port_is_valid_phy_assignment(struct isci_port *iport, u32 phy_index) |
408 | u32 phy_index) | ||
409 | { | 386 | { |
387 | struct isci_host *ihost = iport->owning_controller; | ||
388 | struct sci_user_parameters *user = &ihost->user_parameters; | ||
389 | |||
410 | /* Initialize to invalid value. */ | 390 | /* Initialize to invalid value. */ |
411 | u32 existing_phy_index = SCI_MAX_PHYS; | 391 | u32 existing_phy_index = SCI_MAX_PHYS; |
412 | u32 index; | 392 | u32 index; |
413 | 393 | ||
414 | if ((iport->physical_port_index == 1) && (phy_index != 1)) { | 394 | if ((iport->physical_port_index == 1) && (phy_index != 1)) |
415 | return false; | 395 | return false; |
416 | } | ||
417 | 396 | ||
418 | if (iport->physical_port_index == 3 && phy_index != 3) { | 397 | if (iport->physical_port_index == 3 && phy_index != 3) |
419 | return false; | 398 | return false; |
420 | } | ||
421 | 399 | ||
422 | if ( | 400 | if (iport->physical_port_index == 2 && |
423 | (iport->physical_port_index == 2) | 401 | (phy_index == 0 || phy_index == 1)) |
424 | && ((phy_index == 0) || (phy_index == 1)) | ||
425 | ) { | ||
426 | return false; | 402 | return false; |
427 | } | ||
428 | 403 | ||
429 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 404 | for (index = 0; index < SCI_MAX_PHYS; index++) |
430 | if ((iport->phy_table[index] != NULL) | 405 | if (iport->phy_table[index] && index != phy_index) |
431 | && (index != phy_index)) { | ||
432 | existing_phy_index = index; | 406 | existing_phy_index = index; |
433 | } | ||
434 | } | ||
435 | 407 | ||
436 | /* | 408 | /* Ensure that all of the phys in the port are capable of |
437 | * Ensure that all of the phys in the port are capable of | 409 | * operating at the same maximum link rate. |
438 | * operating at the same maximum link rate. */ | 410 | */ |
439 | if ( | 411 | if (existing_phy_index < SCI_MAX_PHYS && |
440 | (existing_phy_index < SCI_MAX_PHYS) | 412 | user->phys[phy_index].max_speed_generation != |
441 | && (iport->owning_controller->user_parameters.sds1.phys[ | 413 | user->phys[existing_phy_index].max_speed_generation) |
442 | phy_index].max_speed_generation != | ||
443 | iport->owning_controller->user_parameters.sds1.phys[ | ||
444 | existing_phy_index].max_speed_generation) | ||
445 | ) | ||
446 | return false; | 414 | return false; |
447 | 415 | ||
448 | return true; | 416 | return true; |
@@ -460,7 +428,7 @@ bool scic_sds_port_is_valid_phy_assignment(struct isci_port *iport, | |||
460 | * phy mask can be supported. true if this is a valid phy assignment for the | 428 | * phy mask can be supported. true if this is a valid phy assignment for the |
461 | * port false if this is not a valid phy assignment for the port | 429 | * port false if this is not a valid phy assignment for the port |
462 | */ | 430 | */ |
463 | static bool scic_sds_port_is_phy_mask_valid( | 431 | static bool sci_port_is_phy_mask_valid( |
464 | struct isci_port *iport, | 432 | struct isci_port *iport, |
465 | u32 phy_mask) | 433 | u32 phy_mask) |
466 | { | 434 | { |
@@ -493,10 +461,10 @@ static bool scic_sds_port_is_phy_mask_valid( | |||
493 | * the port. Currently, the lowest order phy that is connected is returned. | 461 | * the port. Currently, the lowest order phy that is connected is returned. |
494 | * This method returns a pointer to a SCIS_SDS_PHY object. NULL This value is | 462 | * This method returns a pointer to a SCIS_SDS_PHY object. NULL This value is |
495 | * returned if there are no currently active (i.e. connected to a remote end | 463 | * returned if there are no currently active (i.e. connected to a remote end |
496 | * point) phys contained in the port. All other values specify a struct scic_sds_phy | 464 | * point) phys contained in the port. All other values specify a struct sci_phy |
497 | * object that is active in the port. | 465 | * object that is active in the port. |
498 | */ | 466 | */ |
499 | static struct isci_phy *scic_sds_port_get_a_connected_phy(struct isci_port *iport) | 467 | static struct isci_phy *sci_port_get_a_connected_phy(struct isci_port *iport) |
500 | { | 468 | { |
501 | u32 index; | 469 | u32 index; |
502 | struct isci_phy *iphy; | 470 | struct isci_phy *iphy; |
@@ -506,14 +474,14 @@ static struct isci_phy *scic_sds_port_get_a_connected_phy(struct isci_port *ipor | |||
506 | * connected to the remote end-point. | 474 | * connected to the remote end-point. |
507 | */ | 475 | */ |
508 | iphy = iport->phy_table[index]; | 476 | iphy = iport->phy_table[index]; |
509 | if (iphy && scic_sds_port_active_phy(iport, iphy)) | 477 | if (iphy && sci_port_active_phy(iport, iphy)) |
510 | return iphy; | 478 | return iphy; |
511 | } | 479 | } |
512 | 480 | ||
513 | return NULL; | 481 | return NULL; |
514 | } | 482 | } |
515 | 483 | ||
516 | static enum sci_status scic_sds_port_set_phy(struct isci_port *iport, struct isci_phy *iphy) | 484 | static enum sci_status sci_port_set_phy(struct isci_port *iport, struct isci_phy *iphy) |
517 | { | 485 | { |
518 | /* Check to see if we can add this phy to a port | 486 | /* Check to see if we can add this phy to a port |
519 | * that means that the phy is not part of a port and that the port does | 487 | * that means that the phy is not part of a port and that the port does |
@@ -521,13 +489,13 @@ static enum sci_status scic_sds_port_set_phy(struct isci_port *iport, struct isc | |||
521 | */ | 489 | */ |
522 | if (!iport->phy_table[iphy->phy_index] && | 490 | if (!iport->phy_table[iphy->phy_index] && |
523 | !phy_get_non_dummy_port(iphy) && | 491 | !phy_get_non_dummy_port(iphy) && |
524 | scic_sds_port_is_valid_phy_assignment(iport, iphy->phy_index)) { | 492 | sci_port_is_valid_phy_assignment(iport, iphy->phy_index)) { |
525 | /* Phy is being added in the stopped state so we are in MPC mode | 493 | /* Phy is being added in the stopped state so we are in MPC mode |
526 | * make logical port index = physical port index | 494 | * make logical port index = physical port index |
527 | */ | 495 | */ |
528 | iport->logical_port_index = iport->physical_port_index; | 496 | iport->logical_port_index = iport->physical_port_index; |
529 | iport->phy_table[iphy->phy_index] = iphy; | 497 | iport->phy_table[iphy->phy_index] = iphy; |
530 | scic_sds_phy_set_port(iphy, iport); | 498 | sci_phy_set_port(iphy, iport); |
531 | 499 | ||
532 | return SCI_SUCCESS; | 500 | return SCI_SUCCESS; |
533 | } | 501 | } |
@@ -535,8 +503,7 @@ static enum sci_status scic_sds_port_set_phy(struct isci_port *iport, struct isc | |||
535 | return SCI_FAILURE; | 503 | return SCI_FAILURE; |
536 | } | 504 | } |
537 | 505 | ||
538 | static enum sci_status scic_sds_port_clear_phy(struct isci_port *iport, | 506 | static enum sci_status sci_port_clear_phy(struct isci_port *iport, struct isci_phy *iphy) |
539 | struct isci_phy *iphy) | ||
540 | { | 507 | { |
541 | /* Make sure that this phy is part of this port */ | 508 | /* Make sure that this phy is part of this port */ |
542 | if (iport->phy_table[iphy->phy_index] == iphy && | 509 | if (iport->phy_table[iphy->phy_index] == iphy && |
@@ -544,7 +511,7 @@ static enum sci_status scic_sds_port_clear_phy(struct isci_port *iport, | |||
544 | struct isci_host *ihost = iport->owning_controller; | 511 | struct isci_host *ihost = iport->owning_controller; |
545 | 512 | ||
546 | /* Yep it is assigned to this port so remove it */ | 513 | /* Yep it is assigned to this port so remove it */ |
547 | scic_sds_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); | 514 | sci_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); |
548 | iport->phy_table[iphy->phy_index] = NULL; | 515 | iport->phy_table[iphy->phy_index] = NULL; |
549 | return SCI_SUCCESS; | 516 | return SCI_SUCCESS; |
550 | } | 517 | } |
@@ -552,45 +519,18 @@ static enum sci_status scic_sds_port_clear_phy(struct isci_port *iport, | |||
552 | return SCI_FAILURE; | 519 | return SCI_FAILURE; |
553 | } | 520 | } |
554 | 521 | ||
555 | 522 | void sci_port_get_sas_address(struct isci_port *iport, struct sci_sas_address *sas) | |
556 | /** | ||
557 | * This method requests the SAS address for the supplied SAS port from the SCI | ||
558 | * implementation. | ||
559 | * @sci_port: a handle corresponding to the SAS port for which to return the | ||
560 | * SAS address. | ||
561 | * @sas_address: This parameter specifies a pointer to a SAS address structure | ||
562 | * into which the core will copy the SAS address for the port. | ||
563 | * | ||
564 | */ | ||
565 | void scic_sds_port_get_sas_address( | ||
566 | struct isci_port *iport, | ||
567 | struct sci_sas_address *sas_address) | ||
568 | { | 523 | { |
569 | u32 index; | 524 | u32 index; |
570 | 525 | ||
571 | sas_address->high = 0; | 526 | sas->high = 0; |
572 | sas_address->low = 0; | 527 | sas->low = 0; |
573 | 528 | for (index = 0; index < SCI_MAX_PHYS; index++) | |
574 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 529 | if (iport->phy_table[index]) |
575 | if (iport->phy_table[index] != NULL) { | 530 | sci_phy_get_sas_address(iport->phy_table[index], sas); |
576 | scic_sds_phy_get_sas_address(iport->phy_table[index], sas_address); | ||
577 | } | ||
578 | } | ||
579 | } | 531 | } |
580 | 532 | ||
581 | /* | 533 | void sci_port_get_attached_sas_address(struct isci_port *iport, struct sci_sas_address *sas) |
582 | * This function requests the SAS address for the device directly attached to | ||
583 | * this SAS port. | ||
584 | * @sci_port: a handle corresponding to the SAS port for which to return the | ||
585 | * SAS address. | ||
586 | * @sas_address: This parameter specifies a pointer to a SAS address structure | ||
587 | * into which the core will copy the SAS address for the device directly | ||
588 | * attached to the port. | ||
589 | * | ||
590 | */ | ||
591 | void scic_sds_port_get_attached_sas_address( | ||
592 | struct isci_port *iport, | ||
593 | struct sci_sas_address *sas_address) | ||
594 | { | 534 | { |
595 | struct isci_phy *iphy; | 535 | struct isci_phy *iphy; |
596 | 536 | ||
@@ -598,23 +538,22 @@ void scic_sds_port_get_attached_sas_address( | |||
598 | * Ensure that the phy is both part of the port and currently | 538 | * Ensure that the phy is both part of the port and currently |
599 | * connected to the remote end-point. | 539 | * connected to the remote end-point. |
600 | */ | 540 | */ |
601 | iphy = scic_sds_port_get_a_connected_phy(iport); | 541 | iphy = sci_port_get_a_connected_phy(iport); |
602 | if (iphy) { | 542 | if (iphy) { |
603 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) { | 543 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) { |
604 | scic_sds_phy_get_attached_sas_address(iphy, | 544 | sci_phy_get_attached_sas_address(iphy, sas); |
605 | sas_address); | ||
606 | } else { | 545 | } else { |
607 | scic_sds_phy_get_sas_address(iphy, sas_address); | 546 | sci_phy_get_sas_address(iphy, sas); |
608 | sas_address->low += iphy->phy_index; | 547 | sas->low += iphy->phy_index; |
609 | } | 548 | } |
610 | } else { | 549 | } else { |
611 | sas_address->high = 0; | 550 | sas->high = 0; |
612 | sas_address->low = 0; | 551 | sas->low = 0; |
613 | } | 552 | } |
614 | } | 553 | } |
615 | 554 | ||
616 | /** | 555 | /** |
617 | * scic_sds_port_construct_dummy_rnc() - create dummy rnc for si workaround | 556 | * sci_port_construct_dummy_rnc() - create dummy rnc for si workaround |
618 | * | 557 | * |
619 | * @sci_port: logical port on which we need to create the remote node context | 558 | * @sci_port: logical port on which we need to create the remote node context |
620 | * @rni: remote node index for this remote node context. | 559 | * @rni: remote node index for this remote node context. |
@@ -623,7 +562,7 @@ void scic_sds_port_get_attached_sas_address( | |||
623 | * This structure will be posted to the hardware to work around a scheduler | 562 | * This structure will be posted to the hardware to work around a scheduler |
624 | * error in the hardware. | 563 | * error in the hardware. |
625 | */ | 564 | */ |
626 | static void scic_sds_port_construct_dummy_rnc(struct isci_port *iport, u16 rni) | 565 | static void sci_port_construct_dummy_rnc(struct isci_port *iport, u16 rni) |
627 | { | 566 | { |
628 | union scu_remote_node_context *rnc; | 567 | union scu_remote_node_context *rnc; |
629 | 568 | ||
@@ -651,7 +590,7 @@ static void scic_sds_port_construct_dummy_rnc(struct isci_port *iport, u16 rni) | |||
651 | * structure will be posted to the hardwre to work around a scheduler error | 590 | * structure will be posted to the hardwre to work around a scheduler error |
652 | * in the hardware. | 591 | * in the hardware. |
653 | */ | 592 | */ |
654 | static void scic_sds_port_construct_dummy_task(struct isci_port *iport, u16 tag) | 593 | static void sci_port_construct_dummy_task(struct isci_port *iport, u16 tag) |
655 | { | 594 | { |
656 | struct isci_host *ihost = iport->owning_controller; | 595 | struct isci_host *ihost = iport->owning_controller; |
657 | struct scu_task_context *task_context; | 596 | struct scu_task_context *task_context; |
@@ -671,7 +610,7 @@ static void scic_sds_port_construct_dummy_task(struct isci_port *iport, u16 tag) | |||
671 | task_context->task_phase = 0x01; | 610 | task_context->task_phase = 0x01; |
672 | } | 611 | } |
673 | 612 | ||
674 | static void scic_sds_port_destroy_dummy_resources(struct isci_port *iport) | 613 | static void sci_port_destroy_dummy_resources(struct isci_port *iport) |
675 | { | 614 | { |
676 | struct isci_host *ihost = iport->owning_controller; | 615 | struct isci_host *ihost = iport->owning_controller; |
677 | 616 | ||
@@ -679,93 +618,43 @@ static void scic_sds_port_destroy_dummy_resources(struct isci_port *iport) | |||
679 | isci_free_tag(ihost, iport->reserved_tag); | 618 | isci_free_tag(ihost, iport->reserved_tag); |
680 | 619 | ||
681 | if (iport->reserved_rni != SCU_DUMMY_INDEX) | 620 | if (iport->reserved_rni != SCU_DUMMY_INDEX) |
682 | scic_sds_remote_node_table_release_remote_node_index(&ihost->available_remote_nodes, | 621 | sci_remote_node_table_release_remote_node_index(&ihost->available_remote_nodes, |
683 | 1, iport->reserved_rni); | 622 | 1, iport->reserved_rni); |
684 | 623 | ||
685 | iport->reserved_rni = SCU_DUMMY_INDEX; | 624 | iport->reserved_rni = SCU_DUMMY_INDEX; |
686 | iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; | 625 | iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; |
687 | } | 626 | } |
688 | 627 | ||
689 | /** | 628 | void sci_port_setup_transports(struct isci_port *iport, u32 device_id) |
690 | * This method performs initialization of the supplied port. Initialization | ||
691 | * includes: - state machine initialization - member variable initialization | ||
692 | * - configuring the phy_mask | ||
693 | * @sci_port: | ||
694 | * @transport_layer_registers: | ||
695 | * @port_task_scheduler_registers: | ||
696 | * @port_configuration_regsiter: | ||
697 | * | ||
698 | * enum sci_status SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION This value is returned | ||
699 | * if the phy being added to the port | ||
700 | */ | ||
701 | enum sci_status scic_sds_port_initialize( | ||
702 | struct isci_port *iport, | ||
703 | void __iomem *port_task_scheduler_registers, | ||
704 | void __iomem *port_configuration_regsiter, | ||
705 | void __iomem *viit_registers) | ||
706 | { | ||
707 | iport->port_task_scheduler_registers = port_task_scheduler_registers; | ||
708 | iport->port_pe_configuration_register = port_configuration_regsiter; | ||
709 | iport->viit_registers = viit_registers; | ||
710 | |||
711 | return SCI_SUCCESS; | ||
712 | } | ||
713 | |||
714 | |||
715 | /** | ||
716 | * This method assigns the direct attached device ID for this port. | ||
717 | * | ||
718 | * @param[in] iport The port for which the direct attached device id is to | ||
719 | * be assigned. | ||
720 | * @param[in] device_id The direct attached device ID to assign to the port. | ||
721 | * This will be the RNi for the device | ||
722 | */ | ||
723 | void scic_sds_port_setup_transports( | ||
724 | struct isci_port *iport, | ||
725 | u32 device_id) | ||
726 | { | 629 | { |
727 | u8 index; | 630 | u8 index; |
728 | 631 | ||
729 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 632 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
730 | if (iport->active_phy_mask & (1 << index)) | 633 | if (iport->active_phy_mask & (1 << index)) |
731 | scic_sds_phy_setup_transport(iport->phy_table[index], device_id); | 634 | sci_phy_setup_transport(iport->phy_table[index], device_id); |
732 | } | 635 | } |
733 | } | 636 | } |
734 | 637 | ||
735 | /** | 638 | static void sci_port_activate_phy(struct isci_port *iport, struct isci_phy *iphy, |
736 | * | 639 | bool do_notify_user) |
737 | * @sci_port: This is the port on which the phy should be enabled. | ||
738 | * @sci_phy: This is the specific phy which to enable. | ||
739 | * @do_notify_user: This parameter specifies whether to inform the user (via | ||
740 | * scic_cb_port_link_up()) as to the fact that a new phy as become ready. | ||
741 | * | ||
742 | * This function will activate the phy in the port. | ||
743 | * Activation includes: - adding | ||
744 | * the phy to the port - enabling the Protocol Engine in the silicon. - | ||
745 | * notifying the user that the link is up. none | ||
746 | */ | ||
747 | static void scic_sds_port_activate_phy(struct isci_port *iport, | ||
748 | struct isci_phy *iphy, | ||
749 | bool do_notify_user) | ||
750 | { | 640 | { |
751 | struct isci_host *ihost = iport->owning_controller; | 641 | struct isci_host *ihost = iport->owning_controller; |
752 | 642 | ||
753 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) | 643 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) |
754 | scic_sds_phy_resume(iphy); | 644 | sci_phy_resume(iphy); |
755 | 645 | ||
756 | iport->active_phy_mask |= 1 << iphy->phy_index; | 646 | iport->active_phy_mask |= 1 << iphy->phy_index; |
757 | 647 | ||
758 | scic_sds_controller_clear_invalid_phy(ihost, iphy); | 648 | sci_controller_clear_invalid_phy(ihost, iphy); |
759 | 649 | ||
760 | if (do_notify_user == true) | 650 | if (do_notify_user == true) |
761 | isci_port_link_up(ihost, iport, iphy); | 651 | isci_port_link_up(ihost, iport, iphy); |
762 | } | 652 | } |
763 | 653 | ||
764 | void scic_sds_port_deactivate_phy(struct isci_port *iport, | 654 | void sci_port_deactivate_phy(struct isci_port *iport, struct isci_phy *iphy, |
765 | struct isci_phy *iphy, | 655 | bool do_notify_user) |
766 | bool do_notify_user) | ||
767 | { | 656 | { |
768 | struct isci_host *ihost = scic_sds_port_get_controller(iport); | 657 | struct isci_host *ihost = sci_port_get_controller(iport); |
769 | 658 | ||
770 | iport->active_phy_mask &= ~(1 << iphy->phy_index); | 659 | iport->active_phy_mask &= ~(1 << iphy->phy_index); |
771 | 660 | ||
@@ -779,16 +668,7 @@ void scic_sds_port_deactivate_phy(struct isci_port *iport, | |||
779 | isci_port_link_down(ihost, iphy, iport); | 668 | isci_port_link_down(ihost, iphy, iport); |
780 | } | 669 | } |
781 | 670 | ||
782 | /** | 671 | static void sci_port_invalid_link_up(struct isci_port *iport, struct isci_phy *iphy) |
783 | * | ||
784 | * @sci_port: This is the port on which the phy should be disabled. | ||
785 | * @sci_phy: This is the specific phy which to disabled. | ||
786 | * | ||
787 | * This function will disable the phy and report that the phy is not valid for | ||
788 | * this port object. None | ||
789 | */ | ||
790 | static void scic_sds_port_invalid_link_up(struct isci_port *iport, | ||
791 | struct isci_phy *iphy) | ||
792 | { | 672 | { |
793 | struct isci_host *ihost = iport->owning_controller; | 673 | struct isci_host *ihost = iport->owning_controller; |
794 | 674 | ||
@@ -798,12 +678,12 @@ static void scic_sds_port_invalid_link_up(struct isci_port *iport, | |||
798 | * invalid link. | 678 | * invalid link. |
799 | */ | 679 | */ |
800 | if ((ihost->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { | 680 | if ((ihost->invalid_phy_mask & (1 << iphy->phy_index)) == 0) { |
801 | scic_sds_controller_set_invalid_phy(ihost, iphy); | 681 | sci_controller_set_invalid_phy(ihost, iphy); |
802 | dev_warn(&ihost->pdev->dev, "Invalid link up!\n"); | 682 | dev_warn(&ihost->pdev->dev, "Invalid link up!\n"); |
803 | } | 683 | } |
804 | } | 684 | } |
805 | 685 | ||
806 | static bool is_port_ready_state(enum scic_sds_port_states state) | 686 | static bool is_port_ready_state(enum sci_port_states state) |
807 | { | 687 | { |
808 | switch (state) { | 688 | switch (state) { |
809 | case SCI_PORT_READY: | 689 | case SCI_PORT_READY: |
@@ -818,10 +698,10 @@ static bool is_port_ready_state(enum scic_sds_port_states state) | |||
818 | 698 | ||
819 | /* flag dummy rnc hanling when exiting a ready state */ | 699 | /* flag dummy rnc hanling when exiting a ready state */ |
820 | static void port_state_machine_change(struct isci_port *iport, | 700 | static void port_state_machine_change(struct isci_port *iport, |
821 | enum scic_sds_port_states state) | 701 | enum sci_port_states state) |
822 | { | 702 | { |
823 | struct sci_base_state_machine *sm = &iport->sm; | 703 | struct sci_base_state_machine *sm = &iport->sm; |
824 | enum scic_sds_port_states old_state = sm->current_state_id; | 704 | enum sci_port_states old_state = sm->current_state_id; |
825 | 705 | ||
826 | if (is_port_ready_state(old_state) && !is_port_ready_state(state)) | 706 | if (is_port_ready_state(old_state) && !is_port_ready_state(state)) |
827 | iport->ready_exit = true; | 707 | iport->ready_exit = true; |
@@ -831,11 +711,11 @@ static void port_state_machine_change(struct isci_port *iport, | |||
831 | } | 711 | } |
832 | 712 | ||
833 | /** | 713 | /** |
834 | * scic_sds_port_general_link_up_handler - phy can be assigned to port? | 714 | * sci_port_general_link_up_handler - phy can be assigned to port? |
835 | * @sci_port: scic_sds_port object for which has a phy that has gone link up. | 715 | * @sci_port: sci_port object for which has a phy that has gone link up. |
836 | * @sci_phy: This is the struct isci_phy object that has gone link up. | 716 | * @sci_phy: This is the struct isci_phy object that has gone link up. |
837 | * @do_notify_user: This parameter specifies whether to inform the user (via | 717 | * @do_notify_user: This parameter specifies whether to inform the user (via |
838 | * scic_cb_port_link_up()) as to the fact that a new phy as become ready. | 718 | * sci_port_link_up()) as to the fact that a new phy as become ready. |
839 | * | 719 | * |
840 | * Determine if this phy can be assigned to this | 720 | * Determine if this phy can be assigned to this |
841 | * port . If the phy is not a valid PHY for | 721 | * port . If the phy is not a valid PHY for |
@@ -843,15 +723,15 @@ static void port_state_machine_change(struct isci_port *iport, | |||
843 | * part of a port if it's attached SAS ADDRESS is the same as all other PHYs in | 723 | * part of a port if it's attached SAS ADDRESS is the same as all other PHYs in |
844 | * the same port. none | 724 | * the same port. none |
845 | */ | 725 | */ |
846 | static void scic_sds_port_general_link_up_handler(struct isci_port *iport, | 726 | static void sci_port_general_link_up_handler(struct isci_port *iport, |
847 | struct isci_phy *iphy, | 727 | struct isci_phy *iphy, |
848 | bool do_notify_user) | 728 | bool do_notify_user) |
849 | { | 729 | { |
850 | struct sci_sas_address port_sas_address; | 730 | struct sci_sas_address port_sas_address; |
851 | struct sci_sas_address phy_sas_address; | 731 | struct sci_sas_address phy_sas_address; |
852 | 732 | ||
853 | scic_sds_port_get_attached_sas_address(iport, &port_sas_address); | 733 | sci_port_get_attached_sas_address(iport, &port_sas_address); |
854 | scic_sds_phy_get_attached_sas_address(iphy, &phy_sas_address); | 734 | sci_phy_get_attached_sas_address(iphy, &phy_sas_address); |
855 | 735 | ||
856 | /* If the SAS address of the new phy matches the SAS address of | 736 | /* If the SAS address of the new phy matches the SAS address of |
857 | * other phys in the port OR this is the first phy in the port, | 737 | * other phys in the port OR this is the first phy in the port, |
@@ -863,11 +743,11 @@ static void scic_sds_port_general_link_up_handler(struct isci_port *iport, | |||
863 | iport->active_phy_mask == 0) { | 743 | iport->active_phy_mask == 0) { |
864 | struct sci_base_state_machine *sm = &iport->sm; | 744 | struct sci_base_state_machine *sm = &iport->sm; |
865 | 745 | ||
866 | scic_sds_port_activate_phy(iport, iphy, do_notify_user); | 746 | sci_port_activate_phy(iport, iphy, do_notify_user); |
867 | if (sm->current_state_id == SCI_PORT_RESETTING) | 747 | if (sm->current_state_id == SCI_PORT_RESETTING) |
868 | port_state_machine_change(iport, SCI_PORT_READY); | 748 | port_state_machine_change(iport, SCI_PORT_READY); |
869 | } else | 749 | } else |
870 | scic_sds_port_invalid_link_up(iport, iphy); | 750 | sci_port_invalid_link_up(iport, iphy); |
871 | } | 751 | } |
872 | 752 | ||
873 | 753 | ||
@@ -881,7 +761,7 @@ static void scic_sds_port_general_link_up_handler(struct isci_port *iport, | |||
881 | * bool true Is returned if this is a wide ported port. false Is returned if | 761 | * bool true Is returned if this is a wide ported port. false Is returned if |
882 | * this is a narrow port. | 762 | * this is a narrow port. |
883 | */ | 763 | */ |
884 | static bool scic_sds_port_is_wide(struct isci_port *iport) | 764 | static bool sci_port_is_wide(struct isci_port *iport) |
885 | { | 765 | { |
886 | u32 index; | 766 | u32 index; |
887 | u32 phy_count = 0; | 767 | u32 phy_count = 0; |
@@ -909,14 +789,14 @@ static bool scic_sds_port_is_wide(struct isci_port *iport) | |||
909 | * wide ports and direct attached phys. Since there are no wide ported SATA | 789 | * wide ports and direct attached phys. Since there are no wide ported SATA |
910 | * devices this could become an invalid port configuration. | 790 | * devices this could become an invalid port configuration. |
911 | */ | 791 | */ |
912 | bool scic_sds_port_link_detected( | 792 | bool sci_port_link_detected( |
913 | struct isci_port *iport, | 793 | struct isci_port *iport, |
914 | struct isci_phy *iphy) | 794 | struct isci_phy *iphy) |
915 | { | 795 | { |
916 | if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && | 796 | if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && |
917 | (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) && | 797 | (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) && |
918 | scic_sds_port_is_wide(iport)) { | 798 | sci_port_is_wide(iport)) { |
919 | scic_sds_port_invalid_link_up(iport, iphy); | 799 | sci_port_invalid_link_up(iport, iphy); |
920 | 800 | ||
921 | return false; | 801 | return false; |
922 | } | 802 | } |
@@ -977,11 +857,11 @@ done: | |||
977 | * | 857 | * |
978 | * | 858 | * |
979 | */ | 859 | */ |
980 | static void scic_sds_port_update_viit_entry(struct isci_port *iport) | 860 | static void sci_port_update_viit_entry(struct isci_port *iport) |
981 | { | 861 | { |
982 | struct sci_sas_address sas_address; | 862 | struct sci_sas_address sas_address; |
983 | 863 | ||
984 | scic_sds_port_get_sas_address(iport, &sas_address); | 864 | sci_port_get_sas_address(iport, &sas_address); |
985 | 865 | ||
986 | writel(sas_address.high, | 866 | writel(sas_address.high, |
987 | &iport->viit_registers->initiator_sas_address_hi); | 867 | &iport->viit_registers->initiator_sas_address_hi); |
@@ -999,7 +879,7 @@ static void scic_sds_port_update_viit_entry(struct isci_port *iport) | |||
999 | &iport->viit_registers->status); | 879 | &iport->viit_registers->status); |
1000 | } | 880 | } |
1001 | 881 | ||
1002 | enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct isci_port *iport) | 882 | enum sas_linkrate sci_port_get_max_allowed_speed(struct isci_port *iport) |
1003 | { | 883 | { |
1004 | u16 index; | 884 | u16 index; |
1005 | struct isci_phy *iphy; | 885 | struct isci_phy *iphy; |
@@ -1010,7 +890,7 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct isci_port *iport) | |||
1010 | * lowest maximum link rate. */ | 890 | * lowest maximum link rate. */ |
1011 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 891 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
1012 | iphy = iport->phy_table[index]; | 892 | iphy = iport->phy_table[index]; |
1013 | if (iphy && scic_sds_port_active_phy(iport, iphy) && | 893 | if (iphy && sci_port_active_phy(iport, iphy) && |
1014 | iphy->max_negotiated_speed < max_allowed_speed) | 894 | iphy->max_negotiated_speed < max_allowed_speed) |
1015 | max_allowed_speed = iphy->max_negotiated_speed; | 895 | max_allowed_speed = iphy->max_negotiated_speed; |
1016 | } | 896 | } |
@@ -1018,7 +898,7 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct isci_port *iport) | |||
1018 | return max_allowed_speed; | 898 | return max_allowed_speed; |
1019 | } | 899 | } |
1020 | 900 | ||
1021 | static void scic_sds_port_suspend_port_task_scheduler(struct isci_port *iport) | 901 | static void sci_port_suspend_port_task_scheduler(struct isci_port *iport) |
1022 | { | 902 | { |
1023 | u32 pts_control_value; | 903 | u32 pts_control_value; |
1024 | 904 | ||
@@ -1028,7 +908,7 @@ static void scic_sds_port_suspend_port_task_scheduler(struct isci_port *iport) | |||
1028 | } | 908 | } |
1029 | 909 | ||
1030 | /** | 910 | /** |
1031 | * scic_sds_port_post_dummy_request() - post dummy/workaround request | 911 | * sci_port_post_dummy_request() - post dummy/workaround request |
1032 | * @sci_port: port to post task | 912 | * @sci_port: port to post task |
1033 | * | 913 | * |
1034 | * Prevent the hardware scheduler from posting new requests to the front | 914 | * Prevent the hardware scheduler from posting new requests to the front |
@@ -1036,7 +916,7 @@ static void scic_sds_port_suspend_port_task_scheduler(struct isci_port *iport) | |||
1036 | * ongoing requests. | 916 | * ongoing requests. |
1037 | * | 917 | * |
1038 | */ | 918 | */ |
1039 | static void scic_sds_port_post_dummy_request(struct isci_port *iport) | 919 | static void sci_port_post_dummy_request(struct isci_port *iport) |
1040 | { | 920 | { |
1041 | struct isci_host *ihost = iport->owning_controller; | 921 | struct isci_host *ihost = iport->owning_controller; |
1042 | u16 tag = iport->reserved_tag; | 922 | u16 tag = iport->reserved_tag; |
@@ -1050,7 +930,7 @@ static void scic_sds_port_post_dummy_request(struct isci_port *iport) | |||
1050 | iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | | 930 | iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | |
1051 | ISCI_TAG_TCI(tag); | 931 | ISCI_TAG_TCI(tag); |
1052 | 932 | ||
1053 | scic_sds_controller_post_request(ihost, command); | 933 | sci_controller_post_request(ihost, command); |
1054 | } | 934 | } |
1055 | 935 | ||
1056 | /** | 936 | /** |
@@ -1060,7 +940,7 @@ static void scic_sds_port_post_dummy_request(struct isci_port *iport) | |||
1060 | * @sci_port: The port on which the task must be aborted. | 940 | * @sci_port: The port on which the task must be aborted. |
1061 | * | 941 | * |
1062 | */ | 942 | */ |
1063 | static void scic_sds_port_abort_dummy_request(struct isci_port *iport) | 943 | static void sci_port_abort_dummy_request(struct isci_port *iport) |
1064 | { | 944 | { |
1065 | struct isci_host *ihost = iport->owning_controller; | 945 | struct isci_host *ihost = iport->owning_controller; |
1066 | u16 tag = iport->reserved_tag; | 946 | u16 tag = iport->reserved_tag; |
@@ -1074,7 +954,7 @@ static void scic_sds_port_abort_dummy_request(struct isci_port *iport) | |||
1074 | iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | | 954 | iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | |
1075 | ISCI_TAG_TCI(tag); | 955 | ISCI_TAG_TCI(tag); |
1076 | 956 | ||
1077 | scic_sds_controller_post_request(ihost, command); | 957 | sci_controller_post_request(ihost, command); |
1078 | } | 958 | } |
1079 | 959 | ||
1080 | /** | 960 | /** |
@@ -1084,7 +964,7 @@ static void scic_sds_port_abort_dummy_request(struct isci_port *iport) | |||
1084 | * This method will resume the port task scheduler for this port object. none | 964 | * This method will resume the port task scheduler for this port object. none |
1085 | */ | 965 | */ |
1086 | static void | 966 | static void |
1087 | scic_sds_port_resume_port_task_scheduler(struct isci_port *iport) | 967 | sci_port_resume_port_task_scheduler(struct isci_port *iport) |
1088 | { | 968 | { |
1089 | u32 pts_control_value; | 969 | u32 pts_control_value; |
1090 | 970 | ||
@@ -1093,11 +973,11 @@ scic_sds_port_resume_port_task_scheduler(struct isci_port *iport) | |||
1093 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); | 973 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
1094 | } | 974 | } |
1095 | 975 | ||
1096 | static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm) | 976 | static void sci_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm) |
1097 | { | 977 | { |
1098 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 978 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1099 | 979 | ||
1100 | scic_sds_port_suspend_port_task_scheduler(iport); | 980 | sci_port_suspend_port_task_scheduler(iport); |
1101 | 981 | ||
1102 | iport->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; | 982 | iport->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; |
1103 | 983 | ||
@@ -1108,7 +988,7 @@ static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_mac | |||
1108 | } | 988 | } |
1109 | } | 989 | } |
1110 | 990 | ||
1111 | static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) | 991 | static void sci_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) |
1112 | { | 992 | { |
1113 | u32 index; | 993 | u32 index; |
1114 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 994 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
@@ -1124,18 +1004,18 @@ static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state | |||
1124 | } | 1004 | } |
1125 | } | 1005 | } |
1126 | 1006 | ||
1127 | scic_sds_port_update_viit_entry(iport); | 1007 | sci_port_update_viit_entry(iport); |
1128 | 1008 | ||
1129 | scic_sds_port_resume_port_task_scheduler(iport); | 1009 | sci_port_resume_port_task_scheduler(iport); |
1130 | 1010 | ||
1131 | /* | 1011 | /* |
1132 | * Post the dummy task for the port so the hardware can schedule | 1012 | * Post the dummy task for the port so the hardware can schedule |
1133 | * io correctly | 1013 | * io correctly |
1134 | */ | 1014 | */ |
1135 | scic_sds_port_post_dummy_request(iport); | 1015 | sci_port_post_dummy_request(iport); |
1136 | } | 1016 | } |
1137 | 1017 | ||
1138 | static void scic_sds_port_invalidate_dummy_remote_node(struct isci_port *iport) | 1018 | static void sci_port_invalidate_dummy_remote_node(struct isci_port *iport) |
1139 | { | 1019 | { |
1140 | struct isci_host *ihost = iport->owning_controller; | 1020 | struct isci_host *ihost = iport->owning_controller; |
1141 | u8 phys_index = iport->physical_port_index; | 1021 | u8 phys_index = iport->physical_port_index; |
@@ -1157,7 +1037,7 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct isci_port *iport) | |||
1157 | command = SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE | | 1037 | command = SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE | |
1158 | phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; | 1038 | phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; |
1159 | 1039 | ||
1160 | scic_sds_controller_post_request(ihost, command); | 1040 | sci_controller_post_request(ihost, command); |
1161 | } | 1041 | } |
1162 | 1042 | ||
1163 | /** | 1043 | /** |
@@ -1168,7 +1048,7 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct isci_port *iport) | |||
1168 | * exiting the SCI_PORT_SUB_OPERATIONAL. This function reports | 1048 | * exiting the SCI_PORT_SUB_OPERATIONAL. This function reports |
1169 | * the port not ready and suspends the port task scheduler. none | 1049 | * the port not ready and suspends the port task scheduler. none |
1170 | */ | 1050 | */ |
1171 | static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) | 1051 | static void sci_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) |
1172 | { | 1052 | { |
1173 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1053 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1174 | struct isci_host *ihost = iport->owning_controller; | 1054 | struct isci_host *ihost = iport->owning_controller; |
@@ -1178,15 +1058,15 @@ static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_ | |||
1178 | * the hardware will treat this as a NOP and just return abort | 1058 | * the hardware will treat this as a NOP and just return abort |
1179 | * complete. | 1059 | * complete. |
1180 | */ | 1060 | */ |
1181 | scic_sds_port_abort_dummy_request(iport); | 1061 | sci_port_abort_dummy_request(iport); |
1182 | 1062 | ||
1183 | isci_port_not_ready(ihost, iport); | 1063 | isci_port_not_ready(ihost, iport); |
1184 | 1064 | ||
1185 | if (iport->ready_exit) | 1065 | if (iport->ready_exit) |
1186 | scic_sds_port_invalidate_dummy_remote_node(iport); | 1066 | sci_port_invalidate_dummy_remote_node(iport); |
1187 | } | 1067 | } |
1188 | 1068 | ||
1189 | static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) | 1069 | static void sci_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) |
1190 | { | 1070 | { |
1191 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1071 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1192 | struct isci_host *ihost = iport->owning_controller; | 1072 | struct isci_host *ihost = iport->owning_controller; |
@@ -1201,20 +1081,20 @@ static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state | |||
1201 | SCI_PORT_SUB_OPERATIONAL); | 1081 | SCI_PORT_SUB_OPERATIONAL); |
1202 | } | 1082 | } |
1203 | 1083 | ||
1204 | static void scic_sds_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) | 1084 | static void sci_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) |
1205 | { | 1085 | { |
1206 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1086 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1207 | 1087 | ||
1208 | scic_sds_port_suspend_port_task_scheduler(iport); | 1088 | sci_port_suspend_port_task_scheduler(iport); |
1209 | if (iport->ready_exit) | 1089 | if (iport->ready_exit) |
1210 | scic_sds_port_invalidate_dummy_remote_node(iport); | 1090 | sci_port_invalidate_dummy_remote_node(iport); |
1211 | } | 1091 | } |
1212 | 1092 | ||
1213 | enum sci_status scic_sds_port_start(struct isci_port *iport) | 1093 | enum sci_status sci_port_start(struct isci_port *iport) |
1214 | { | 1094 | { |
1215 | struct isci_host *ihost = iport->owning_controller; | 1095 | struct isci_host *ihost = iport->owning_controller; |
1216 | enum sci_status status = SCI_SUCCESS; | 1096 | enum sci_status status = SCI_SUCCESS; |
1217 | enum scic_sds_port_states state; | 1097 | enum sci_port_states state; |
1218 | u32 phy_mask; | 1098 | u32 phy_mask; |
1219 | 1099 | ||
1220 | state = iport->sm.current_state_id; | 1100 | state = iport->sm.current_state_id; |
@@ -1234,11 +1114,11 @@ enum sci_status scic_sds_port_start(struct isci_port *iport) | |||
1234 | } | 1114 | } |
1235 | 1115 | ||
1236 | if (iport->reserved_rni == SCU_DUMMY_INDEX) { | 1116 | if (iport->reserved_rni == SCU_DUMMY_INDEX) { |
1237 | u16 rni = scic_sds_remote_node_table_allocate_remote_node( | 1117 | u16 rni = sci_remote_node_table_allocate_remote_node( |
1238 | &ihost->available_remote_nodes, 1); | 1118 | &ihost->available_remote_nodes, 1); |
1239 | 1119 | ||
1240 | if (rni != SCU_DUMMY_INDEX) | 1120 | if (rni != SCU_DUMMY_INDEX) |
1241 | scic_sds_port_construct_dummy_rnc(iport, rni); | 1121 | sci_port_construct_dummy_rnc(iport, rni); |
1242 | else | 1122 | else |
1243 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; | 1123 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; |
1244 | iport->reserved_rni = rni; | 1124 | iport->reserved_rni = rni; |
@@ -1251,19 +1131,19 @@ enum sci_status scic_sds_port_start(struct isci_port *iport) | |||
1251 | if (tag == SCI_CONTROLLER_INVALID_IO_TAG) | 1131 | if (tag == SCI_CONTROLLER_INVALID_IO_TAG) |
1252 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; | 1132 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; |
1253 | else | 1133 | else |
1254 | scic_sds_port_construct_dummy_task(iport, tag); | 1134 | sci_port_construct_dummy_task(iport, tag); |
1255 | iport->reserved_tag = tag; | 1135 | iport->reserved_tag = tag; |
1256 | } | 1136 | } |
1257 | 1137 | ||
1258 | if (status == SCI_SUCCESS) { | 1138 | if (status == SCI_SUCCESS) { |
1259 | phy_mask = scic_sds_port_get_phys(iport); | 1139 | phy_mask = sci_port_get_phys(iport); |
1260 | 1140 | ||
1261 | /* | 1141 | /* |
1262 | * There are one or more phys assigned to this port. Make sure | 1142 | * There are one or more phys assigned to this port. Make sure |
1263 | * the port's phy mask is in fact legal and supported by the | 1143 | * the port's phy mask is in fact legal and supported by the |
1264 | * silicon. | 1144 | * silicon. |
1265 | */ | 1145 | */ |
1266 | if (scic_sds_port_is_phy_mask_valid(iport, phy_mask) == true) { | 1146 | if (sci_port_is_phy_mask_valid(iport, phy_mask) == true) { |
1267 | port_state_machine_change(iport, | 1147 | port_state_machine_change(iport, |
1268 | SCI_PORT_READY); | 1148 | SCI_PORT_READY); |
1269 | 1149 | ||
@@ -1273,14 +1153,14 @@ enum sci_status scic_sds_port_start(struct isci_port *iport) | |||
1273 | } | 1153 | } |
1274 | 1154 | ||
1275 | if (status != SCI_SUCCESS) | 1155 | if (status != SCI_SUCCESS) |
1276 | scic_sds_port_destroy_dummy_resources(iport); | 1156 | sci_port_destroy_dummy_resources(iport); |
1277 | 1157 | ||
1278 | return status; | 1158 | return status; |
1279 | } | 1159 | } |
1280 | 1160 | ||
1281 | enum sci_status scic_sds_port_stop(struct isci_port *iport) | 1161 | enum sci_status sci_port_stop(struct isci_port *iport) |
1282 | { | 1162 | { |
1283 | enum scic_sds_port_states state; | 1163 | enum sci_port_states state; |
1284 | 1164 | ||
1285 | state = iport->sm.current_state_id; | 1165 | state = iport->sm.current_state_id; |
1286 | switch (state) { | 1166 | switch (state) { |
@@ -1300,11 +1180,11 @@ enum sci_status scic_sds_port_stop(struct isci_port *iport) | |||
1300 | } | 1180 | } |
1301 | } | 1181 | } |
1302 | 1182 | ||
1303 | static enum sci_status scic_port_hard_reset(struct isci_port *iport, u32 timeout) | 1183 | static enum sci_status sci_port_hard_reset(struct isci_port *iport, u32 timeout) |
1304 | { | 1184 | { |
1305 | enum sci_status status = SCI_FAILURE_INVALID_PHY; | 1185 | enum sci_status status = SCI_FAILURE_INVALID_PHY; |
1306 | struct isci_phy *iphy = NULL; | 1186 | struct isci_phy *iphy = NULL; |
1307 | enum scic_sds_port_states state; | 1187 | enum sci_port_states state; |
1308 | u32 phy_index; | 1188 | u32 phy_index; |
1309 | 1189 | ||
1310 | state = iport->sm.current_state_id; | 1190 | state = iport->sm.current_state_id; |
@@ -1317,7 +1197,7 @@ static enum sci_status scic_port_hard_reset(struct isci_port *iport, u32 timeout | |||
1317 | /* Select a phy on which we can send the hard reset request. */ | 1197 | /* Select a phy on which we can send the hard reset request. */ |
1318 | for (phy_index = 0; phy_index < SCI_MAX_PHYS && !iphy; phy_index++) { | 1198 | for (phy_index = 0; phy_index < SCI_MAX_PHYS && !iphy; phy_index++) { |
1319 | iphy = iport->phy_table[phy_index]; | 1199 | iphy = iport->phy_table[phy_index]; |
1320 | if (iphy && !scic_sds_port_active_phy(iport, iphy)) { | 1200 | if (iphy && !sci_port_active_phy(iport, iphy)) { |
1321 | /* | 1201 | /* |
1322 | * We found a phy but it is not ready select | 1202 | * We found a phy but it is not ready select |
1323 | * different phy | 1203 | * different phy |
@@ -1329,7 +1209,7 @@ static enum sci_status scic_port_hard_reset(struct isci_port *iport, u32 timeout | |||
1329 | /* If we have a phy then go ahead and start the reset procedure */ | 1209 | /* If we have a phy then go ahead and start the reset procedure */ |
1330 | if (!iphy) | 1210 | if (!iphy) |
1331 | return status; | 1211 | return status; |
1332 | status = scic_sds_phy_reset(iphy); | 1212 | status = sci_phy_reset(iphy); |
1333 | 1213 | ||
1334 | if (status != SCI_SUCCESS) | 1214 | if (status != SCI_SUCCESS) |
1335 | return status; | 1215 | return status; |
@@ -1342,7 +1222,7 @@ static enum sci_status scic_port_hard_reset(struct isci_port *iport, u32 timeout | |||
1342 | } | 1222 | } |
1343 | 1223 | ||
1344 | /** | 1224 | /** |
1345 | * scic_sds_port_add_phy() - | 1225 | * sci_port_add_phy() - |
1346 | * @sci_port: This parameter specifies the port in which the phy will be added. | 1226 | * @sci_port: This parameter specifies the port in which the phy will be added. |
1347 | * @sci_phy: This parameter is the phy which is to be added to the port. | 1227 | * @sci_phy: This parameter is the phy which is to be added to the port. |
1348 | * | 1228 | * |
@@ -1350,11 +1230,11 @@ static enum sci_status scic_port_hard_reset(struct isci_port *iport, u32 timeout | |||
1350 | * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other | 1230 | * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other |
1351 | * status is a failure to add the phy to the port. | 1231 | * status is a failure to add the phy to the port. |
1352 | */ | 1232 | */ |
1353 | enum sci_status scic_sds_port_add_phy(struct isci_port *iport, | 1233 | enum sci_status sci_port_add_phy(struct isci_port *iport, |
1354 | struct isci_phy *iphy) | 1234 | struct isci_phy *iphy) |
1355 | { | 1235 | { |
1356 | enum sci_status status; | 1236 | enum sci_status status; |
1357 | enum scic_sds_port_states state; | 1237 | enum sci_port_states state; |
1358 | 1238 | ||
1359 | state = iport->sm.current_state_id; | 1239 | state = iport->sm.current_state_id; |
1360 | switch (state) { | 1240 | switch (state) { |
@@ -1362,7 +1242,7 @@ enum sci_status scic_sds_port_add_phy(struct isci_port *iport, | |||
1362 | struct sci_sas_address port_sas_address; | 1242 | struct sci_sas_address port_sas_address; |
1363 | 1243 | ||
1364 | /* Read the port assigned SAS Address if there is one */ | 1244 | /* Read the port assigned SAS Address if there is one */ |
1365 | scic_sds_port_get_sas_address(iport, &port_sas_address); | 1245 | sci_port_get_sas_address(iport, &port_sas_address); |
1366 | 1246 | ||
1367 | if (port_sas_address.high != 0 && port_sas_address.low != 0) { | 1247 | if (port_sas_address.high != 0 && port_sas_address.low != 0) { |
1368 | struct sci_sas_address phy_sas_address; | 1248 | struct sci_sas_address phy_sas_address; |
@@ -1370,32 +1250,32 @@ enum sci_status scic_sds_port_add_phy(struct isci_port *iport, | |||
1370 | /* Make sure that the PHY SAS Address matches the SAS Address | 1250 | /* Make sure that the PHY SAS Address matches the SAS Address |
1371 | * for this port | 1251 | * for this port |
1372 | */ | 1252 | */ |
1373 | scic_sds_phy_get_sas_address(iphy, &phy_sas_address); | 1253 | sci_phy_get_sas_address(iphy, &phy_sas_address); |
1374 | 1254 | ||
1375 | if (port_sas_address.high != phy_sas_address.high || | 1255 | if (port_sas_address.high != phy_sas_address.high || |
1376 | port_sas_address.low != phy_sas_address.low) | 1256 | port_sas_address.low != phy_sas_address.low) |
1377 | return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; | 1257 | return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; |
1378 | } | 1258 | } |
1379 | return scic_sds_port_set_phy(iport, iphy); | 1259 | return sci_port_set_phy(iport, iphy); |
1380 | } | 1260 | } |
1381 | case SCI_PORT_SUB_WAITING: | 1261 | case SCI_PORT_SUB_WAITING: |
1382 | case SCI_PORT_SUB_OPERATIONAL: | 1262 | case SCI_PORT_SUB_OPERATIONAL: |
1383 | status = scic_sds_port_set_phy(iport, iphy); | 1263 | status = sci_port_set_phy(iport, iphy); |
1384 | 1264 | ||
1385 | if (status != SCI_SUCCESS) | 1265 | if (status != SCI_SUCCESS) |
1386 | return status; | 1266 | return status; |
1387 | 1267 | ||
1388 | scic_sds_port_general_link_up_handler(iport, iphy, true); | 1268 | sci_port_general_link_up_handler(iport, iphy, true); |
1389 | iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; | 1269 | iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; |
1390 | port_state_machine_change(iport, SCI_PORT_SUB_CONFIGURING); | 1270 | port_state_machine_change(iport, SCI_PORT_SUB_CONFIGURING); |
1391 | 1271 | ||
1392 | return status; | 1272 | return status; |
1393 | case SCI_PORT_SUB_CONFIGURING: | 1273 | case SCI_PORT_SUB_CONFIGURING: |
1394 | status = scic_sds_port_set_phy(iport, iphy); | 1274 | status = sci_port_set_phy(iport, iphy); |
1395 | 1275 | ||
1396 | if (status != SCI_SUCCESS) | 1276 | if (status != SCI_SUCCESS) |
1397 | return status; | 1277 | return status; |
1398 | scic_sds_port_general_link_up_handler(iport, iphy, true); | 1278 | sci_port_general_link_up_handler(iport, iphy, true); |
1399 | 1279 | ||
1400 | /* Re-enter the configuring state since this may be the last phy in | 1280 | /* Re-enter the configuring state since this may be the last phy in |
1401 | * the port. | 1281 | * the port. |
@@ -1411,7 +1291,7 @@ enum sci_status scic_sds_port_add_phy(struct isci_port *iport, | |||
1411 | } | 1291 | } |
1412 | 1292 | ||
1413 | /** | 1293 | /** |
1414 | * scic_sds_port_remove_phy() - | 1294 | * sci_port_remove_phy() - |
1415 | * @sci_port: This parameter specifies the port in which the phy will be added. | 1295 | * @sci_port: This parameter specifies the port in which the phy will be added. |
1416 | * @sci_phy: This parameter is the phy which is to be added to the port. | 1296 | * @sci_phy: This parameter is the phy which is to be added to the port. |
1417 | * | 1297 | * |
@@ -1419,33 +1299,33 @@ enum sci_status scic_sds_port_add_phy(struct isci_port *iport, | |||
1419 | * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any | 1299 | * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any |
1420 | * other status is a failure to add the phy to the port. | 1300 | * other status is a failure to add the phy to the port. |
1421 | */ | 1301 | */ |
1422 | enum sci_status scic_sds_port_remove_phy(struct isci_port *iport, | 1302 | enum sci_status sci_port_remove_phy(struct isci_port *iport, |
1423 | struct isci_phy *iphy) | 1303 | struct isci_phy *iphy) |
1424 | { | 1304 | { |
1425 | enum sci_status status; | 1305 | enum sci_status status; |
1426 | enum scic_sds_port_states state; | 1306 | enum sci_port_states state; |
1427 | 1307 | ||
1428 | state = iport->sm.current_state_id; | 1308 | state = iport->sm.current_state_id; |
1429 | 1309 | ||
1430 | switch (state) { | 1310 | switch (state) { |
1431 | case SCI_PORT_STOPPED: | 1311 | case SCI_PORT_STOPPED: |
1432 | return scic_sds_port_clear_phy(iport, iphy); | 1312 | return sci_port_clear_phy(iport, iphy); |
1433 | case SCI_PORT_SUB_OPERATIONAL: | 1313 | case SCI_PORT_SUB_OPERATIONAL: |
1434 | status = scic_sds_port_clear_phy(iport, iphy); | 1314 | status = sci_port_clear_phy(iport, iphy); |
1435 | if (status != SCI_SUCCESS) | 1315 | if (status != SCI_SUCCESS) |
1436 | return status; | 1316 | return status; |
1437 | 1317 | ||
1438 | scic_sds_port_deactivate_phy(iport, iphy, true); | 1318 | sci_port_deactivate_phy(iport, iphy, true); |
1439 | iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; | 1319 | iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; |
1440 | port_state_machine_change(iport, | 1320 | port_state_machine_change(iport, |
1441 | SCI_PORT_SUB_CONFIGURING); | 1321 | SCI_PORT_SUB_CONFIGURING); |
1442 | return SCI_SUCCESS; | 1322 | return SCI_SUCCESS; |
1443 | case SCI_PORT_SUB_CONFIGURING: | 1323 | case SCI_PORT_SUB_CONFIGURING: |
1444 | status = scic_sds_port_clear_phy(iport, iphy); | 1324 | status = sci_port_clear_phy(iport, iphy); |
1445 | 1325 | ||
1446 | if (status != SCI_SUCCESS) | 1326 | if (status != SCI_SUCCESS) |
1447 | return status; | 1327 | return status; |
1448 | scic_sds_port_deactivate_phy(iport, iphy, true); | 1328 | sci_port_deactivate_phy(iport, iphy, true); |
1449 | 1329 | ||
1450 | /* Re-enter the configuring state since this may be the last phy in | 1330 | /* Re-enter the configuring state since this may be the last phy in |
1451 | * the port | 1331 | * the port |
@@ -1460,10 +1340,10 @@ enum sci_status scic_sds_port_remove_phy(struct isci_port *iport, | |||
1460 | } | 1340 | } |
1461 | } | 1341 | } |
1462 | 1342 | ||
1463 | enum sci_status scic_sds_port_link_up(struct isci_port *iport, | 1343 | enum sci_status sci_port_link_up(struct isci_port *iport, |
1464 | struct isci_phy *iphy) | 1344 | struct isci_phy *iphy) |
1465 | { | 1345 | { |
1466 | enum scic_sds_port_states state; | 1346 | enum sci_port_states state; |
1467 | 1347 | ||
1468 | state = iport->sm.current_state_id; | 1348 | state = iport->sm.current_state_id; |
1469 | switch (state) { | 1349 | switch (state) { |
@@ -1471,13 +1351,13 @@ enum sci_status scic_sds_port_link_up(struct isci_port *iport, | |||
1471 | /* Since this is the first phy going link up for the port we | 1351 | /* Since this is the first phy going link up for the port we |
1472 | * can just enable it and continue | 1352 | * can just enable it and continue |
1473 | */ | 1353 | */ |
1474 | scic_sds_port_activate_phy(iport, iphy, true); | 1354 | sci_port_activate_phy(iport, iphy, true); |
1475 | 1355 | ||
1476 | port_state_machine_change(iport, | 1356 | port_state_machine_change(iport, |
1477 | SCI_PORT_SUB_OPERATIONAL); | 1357 | SCI_PORT_SUB_OPERATIONAL); |
1478 | return SCI_SUCCESS; | 1358 | return SCI_SUCCESS; |
1479 | case SCI_PORT_SUB_OPERATIONAL: | 1359 | case SCI_PORT_SUB_OPERATIONAL: |
1480 | scic_sds_port_general_link_up_handler(iport, iphy, true); | 1360 | sci_port_general_link_up_handler(iport, iphy, true); |
1481 | return SCI_SUCCESS; | 1361 | return SCI_SUCCESS; |
1482 | case SCI_PORT_RESETTING: | 1362 | case SCI_PORT_RESETTING: |
1483 | /* TODO We should make sure that the phy that has gone | 1363 | /* TODO We should make sure that the phy that has gone |
@@ -1494,7 +1374,7 @@ enum sci_status scic_sds_port_link_up(struct isci_port *iport, | |||
1494 | /* In the resetting state we don't notify the user regarding | 1374 | /* In the resetting state we don't notify the user regarding |
1495 | * link up and link down notifications. | 1375 | * link up and link down notifications. |
1496 | */ | 1376 | */ |
1497 | scic_sds_port_general_link_up_handler(iport, iphy, false); | 1377 | sci_port_general_link_up_handler(iport, iphy, false); |
1498 | return SCI_SUCCESS; | 1378 | return SCI_SUCCESS; |
1499 | default: | 1379 | default: |
1500 | dev_warn(sciport_to_dev(iport), | 1380 | dev_warn(sciport_to_dev(iport), |
@@ -1503,15 +1383,15 @@ enum sci_status scic_sds_port_link_up(struct isci_port *iport, | |||
1503 | } | 1383 | } |
1504 | } | 1384 | } |
1505 | 1385 | ||
1506 | enum sci_status scic_sds_port_link_down(struct isci_port *iport, | 1386 | enum sci_status sci_port_link_down(struct isci_port *iport, |
1507 | struct isci_phy *iphy) | 1387 | struct isci_phy *iphy) |
1508 | { | 1388 | { |
1509 | enum scic_sds_port_states state; | 1389 | enum sci_port_states state; |
1510 | 1390 | ||
1511 | state = iport->sm.current_state_id; | 1391 | state = iport->sm.current_state_id; |
1512 | switch (state) { | 1392 | switch (state) { |
1513 | case SCI_PORT_SUB_OPERATIONAL: | 1393 | case SCI_PORT_SUB_OPERATIONAL: |
1514 | scic_sds_port_deactivate_phy(iport, iphy, true); | 1394 | sci_port_deactivate_phy(iport, iphy, true); |
1515 | 1395 | ||
1516 | /* If there are no active phys left in the port, then | 1396 | /* If there are no active phys left in the port, then |
1517 | * transition the port to the WAITING state until such time | 1397 | * transition the port to the WAITING state until such time |
@@ -1524,7 +1404,7 @@ enum sci_status scic_sds_port_link_down(struct isci_port *iport, | |||
1524 | case SCI_PORT_RESETTING: | 1404 | case SCI_PORT_RESETTING: |
1525 | /* In the resetting state we don't notify the user regarding | 1405 | /* In the resetting state we don't notify the user regarding |
1526 | * link up and link down notifications. */ | 1406 | * link up and link down notifications. */ |
1527 | scic_sds_port_deactivate_phy(iport, iphy, false); | 1407 | sci_port_deactivate_phy(iport, iphy, false); |
1528 | return SCI_SUCCESS; | 1408 | return SCI_SUCCESS; |
1529 | default: | 1409 | default: |
1530 | dev_warn(sciport_to_dev(iport), | 1410 | dev_warn(sciport_to_dev(iport), |
@@ -1533,11 +1413,11 @@ enum sci_status scic_sds_port_link_down(struct isci_port *iport, | |||
1533 | } | 1413 | } |
1534 | } | 1414 | } |
1535 | 1415 | ||
1536 | enum sci_status scic_sds_port_start_io(struct isci_port *iport, | 1416 | enum sci_status sci_port_start_io(struct isci_port *iport, |
1537 | struct isci_remote_device *idev, | 1417 | struct isci_remote_device *idev, |
1538 | struct isci_request *ireq) | 1418 | struct isci_request *ireq) |
1539 | { | 1419 | { |
1540 | enum scic_sds_port_states state; | 1420 | enum sci_port_states state; |
1541 | 1421 | ||
1542 | state = iport->sm.current_state_id; | 1422 | state = iport->sm.current_state_id; |
1543 | switch (state) { | 1423 | switch (state) { |
@@ -1553,11 +1433,11 @@ enum sci_status scic_sds_port_start_io(struct isci_port *iport, | |||
1553 | } | 1433 | } |
1554 | } | 1434 | } |
1555 | 1435 | ||
1556 | enum sci_status scic_sds_port_complete_io(struct isci_port *iport, | 1436 | enum sci_status sci_port_complete_io(struct isci_port *iport, |
1557 | struct isci_remote_device *idev, | 1437 | struct isci_remote_device *idev, |
1558 | struct isci_request *ireq) | 1438 | struct isci_request *ireq) |
1559 | { | 1439 | { |
1560 | enum scic_sds_port_states state; | 1440 | enum sci_port_states state; |
1561 | 1441 | ||
1562 | state = iport->sm.current_state_id; | 1442 | state = iport->sm.current_state_id; |
1563 | switch (state) { | 1443 | switch (state) { |
@@ -1566,7 +1446,7 @@ enum sci_status scic_sds_port_complete_io(struct isci_port *iport, | |||
1566 | "%s: in wrong state: %d\n", __func__, state); | 1446 | "%s: in wrong state: %d\n", __func__, state); |
1567 | return SCI_FAILURE_INVALID_STATE; | 1447 | return SCI_FAILURE_INVALID_STATE; |
1568 | case SCI_PORT_STOPPING: | 1448 | case SCI_PORT_STOPPING: |
1569 | scic_sds_port_decrement_request_count(iport); | 1449 | sci_port_decrement_request_count(iport); |
1570 | 1450 | ||
1571 | if (iport->started_request_count == 0) | 1451 | if (iport->started_request_count == 0) |
1572 | port_state_machine_change(iport, | 1452 | port_state_machine_change(iport, |
@@ -1577,10 +1457,10 @@ enum sci_status scic_sds_port_complete_io(struct isci_port *iport, | |||
1577 | case SCI_PORT_FAILED: | 1457 | case SCI_PORT_FAILED: |
1578 | case SCI_PORT_SUB_WAITING: | 1458 | case SCI_PORT_SUB_WAITING: |
1579 | case SCI_PORT_SUB_OPERATIONAL: | 1459 | case SCI_PORT_SUB_OPERATIONAL: |
1580 | scic_sds_port_decrement_request_count(iport); | 1460 | sci_port_decrement_request_count(iport); |
1581 | break; | 1461 | break; |
1582 | case SCI_PORT_SUB_CONFIGURING: | 1462 | case SCI_PORT_SUB_CONFIGURING: |
1583 | scic_sds_port_decrement_request_count(iport); | 1463 | sci_port_decrement_request_count(iport); |
1584 | if (iport->started_request_count == 0) { | 1464 | if (iport->started_request_count == 0) { |
1585 | port_state_machine_change(iport, | 1465 | port_state_machine_change(iport, |
1586 | SCI_PORT_SUB_OPERATIONAL); | 1466 | SCI_PORT_SUB_OPERATIONAL); |
@@ -1590,32 +1470,17 @@ enum sci_status scic_sds_port_complete_io(struct isci_port *iport, | |||
1590 | return SCI_SUCCESS; | 1470 | return SCI_SUCCESS; |
1591 | } | 1471 | } |
1592 | 1472 | ||
1593 | /** | 1473 | static void sci_port_enable_port_task_scheduler(struct isci_port *iport) |
1594 | * | ||
1595 | * @sci_port: This is the port object which to suspend. | ||
1596 | * | ||
1597 | * This method will enable the SCU Port Task Scheduler for this port object but | ||
1598 | * will leave the port task scheduler in a suspended state. none | ||
1599 | */ | ||
1600 | static void | ||
1601 | scic_sds_port_enable_port_task_scheduler(struct isci_port *iport) | ||
1602 | { | 1474 | { |
1603 | u32 pts_control_value; | 1475 | u32 pts_control_value; |
1604 | 1476 | ||
1477 | /* enable the port task scheduler in a suspended state */ | ||
1605 | pts_control_value = readl(&iport->port_task_scheduler_registers->control); | 1478 | pts_control_value = readl(&iport->port_task_scheduler_registers->control); |
1606 | pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND); | 1479 | pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND); |
1607 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); | 1480 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
1608 | } | 1481 | } |
1609 | 1482 | ||
1610 | /** | 1483 | static void sci_port_disable_port_task_scheduler(struct isci_port *iport) |
1611 | * | ||
1612 | * @sci_port: This is the port object which to resume. | ||
1613 | * | ||
1614 | * This method will disable the SCU port task scheduler for this port object. | ||
1615 | * none | ||
1616 | */ | ||
1617 | static void | ||
1618 | scic_sds_port_disable_port_task_scheduler(struct isci_port *iport) | ||
1619 | { | 1484 | { |
1620 | u32 pts_control_value; | 1485 | u32 pts_control_value; |
1621 | 1486 | ||
@@ -1625,7 +1490,7 @@ scic_sds_port_disable_port_task_scheduler(struct isci_port *iport) | |||
1625 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); | 1490 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
1626 | } | 1491 | } |
1627 | 1492 | ||
1628 | static void scic_sds_port_post_dummy_remote_node(struct isci_port *iport) | 1493 | static void sci_port_post_dummy_remote_node(struct isci_port *iport) |
1629 | { | 1494 | { |
1630 | struct isci_host *ihost = iport->owning_controller; | 1495 | struct isci_host *ihost = iport->owning_controller; |
1631 | u8 phys_index = iport->physical_port_index; | 1496 | u8 phys_index = iport->physical_port_index; |
@@ -1639,7 +1504,7 @@ static void scic_sds_port_post_dummy_remote_node(struct isci_port *iport) | |||
1639 | command = SCU_CONTEXT_COMMAND_POST_RNC_32 | | 1504 | command = SCU_CONTEXT_COMMAND_POST_RNC_32 | |
1640 | phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; | 1505 | phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; |
1641 | 1506 | ||
1642 | scic_sds_controller_post_request(ihost, command); | 1507 | sci_controller_post_request(ihost, command); |
1643 | 1508 | ||
1644 | /* ensure hardware has seen the post rnc command and give it | 1509 | /* ensure hardware has seen the post rnc command and give it |
1645 | * ample time to act before sending the suspend | 1510 | * ample time to act before sending the suspend |
@@ -1650,10 +1515,10 @@ static void scic_sds_port_post_dummy_remote_node(struct isci_port *iport) | |||
1650 | command = SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX | | 1515 | command = SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX | |
1651 | phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; | 1516 | phys_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | rni; |
1652 | 1517 | ||
1653 | scic_sds_controller_post_request(ihost, command); | 1518 | sci_controller_post_request(ihost, command); |
1654 | } | 1519 | } |
1655 | 1520 | ||
1656 | static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) | 1521 | static void sci_port_stopped_state_enter(struct sci_base_state_machine *sm) |
1657 | { | 1522 | { |
1658 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1523 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1659 | 1524 | ||
@@ -1662,19 +1527,19 @@ static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) | |||
1662 | * If we enter this state becasuse of a request to stop | 1527 | * If we enter this state becasuse of a request to stop |
1663 | * the port then we want to disable the hardwares port | 1528 | * the port then we want to disable the hardwares port |
1664 | * task scheduler. */ | 1529 | * task scheduler. */ |
1665 | scic_sds_port_disable_port_task_scheduler(iport); | 1530 | sci_port_disable_port_task_scheduler(iport); |
1666 | } | 1531 | } |
1667 | } | 1532 | } |
1668 | 1533 | ||
1669 | static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm) | 1534 | static void sci_port_stopped_state_exit(struct sci_base_state_machine *sm) |
1670 | { | 1535 | { |
1671 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1536 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1672 | 1537 | ||
1673 | /* Enable and suspend the port task scheduler */ | 1538 | /* Enable and suspend the port task scheduler */ |
1674 | scic_sds_port_enable_port_task_scheduler(iport); | 1539 | sci_port_enable_port_task_scheduler(iport); |
1675 | } | 1540 | } |
1676 | 1541 | ||
1677 | static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) | 1542 | static void sci_port_ready_state_enter(struct sci_base_state_machine *sm) |
1678 | { | 1543 | { |
1679 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1544 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1680 | struct isci_host *ihost = iport->owning_controller; | 1545 | struct isci_host *ihost = iport->owning_controller; |
@@ -1687,30 +1552,30 @@ static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) | |||
1687 | isci_port_not_ready(ihost, iport); | 1552 | isci_port_not_ready(ihost, iport); |
1688 | 1553 | ||
1689 | /* Post and suspend the dummy remote node context for this port. */ | 1554 | /* Post and suspend the dummy remote node context for this port. */ |
1690 | scic_sds_port_post_dummy_remote_node(iport); | 1555 | sci_port_post_dummy_remote_node(iport); |
1691 | 1556 | ||
1692 | /* Start the ready substate machine */ | 1557 | /* Start the ready substate machine */ |
1693 | port_state_machine_change(iport, | 1558 | port_state_machine_change(iport, |
1694 | SCI_PORT_SUB_WAITING); | 1559 | SCI_PORT_SUB_WAITING); |
1695 | } | 1560 | } |
1696 | 1561 | ||
1697 | static void scic_sds_port_resetting_state_exit(struct sci_base_state_machine *sm) | 1562 | static void sci_port_resetting_state_exit(struct sci_base_state_machine *sm) |
1698 | { | 1563 | { |
1699 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1564 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1700 | 1565 | ||
1701 | sci_del_timer(&iport->timer); | 1566 | sci_del_timer(&iport->timer); |
1702 | } | 1567 | } |
1703 | 1568 | ||
1704 | static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm) | 1569 | static void sci_port_stopping_state_exit(struct sci_base_state_machine *sm) |
1705 | { | 1570 | { |
1706 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1571 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1707 | 1572 | ||
1708 | sci_del_timer(&iport->timer); | 1573 | sci_del_timer(&iport->timer); |
1709 | 1574 | ||
1710 | scic_sds_port_destroy_dummy_resources(iport); | 1575 | sci_port_destroy_dummy_resources(iport); |
1711 | } | 1576 | } |
1712 | 1577 | ||
1713 | static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) | 1578 | static void sci_port_failed_state_enter(struct sci_base_state_machine *sm) |
1714 | { | 1579 | { |
1715 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); | 1580 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
1716 | 1581 | ||
@@ -1719,40 +1584,40 @@ static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) | |||
1719 | 1584 | ||
1720 | /* --------------------------------------------------------------------------- */ | 1585 | /* --------------------------------------------------------------------------- */ |
1721 | 1586 | ||
1722 | static const struct sci_base_state scic_sds_port_state_table[] = { | 1587 | static const struct sci_base_state sci_port_state_table[] = { |
1723 | [SCI_PORT_STOPPED] = { | 1588 | [SCI_PORT_STOPPED] = { |
1724 | .enter_state = scic_sds_port_stopped_state_enter, | 1589 | .enter_state = sci_port_stopped_state_enter, |
1725 | .exit_state = scic_sds_port_stopped_state_exit | 1590 | .exit_state = sci_port_stopped_state_exit |
1726 | }, | 1591 | }, |
1727 | [SCI_PORT_STOPPING] = { | 1592 | [SCI_PORT_STOPPING] = { |
1728 | .exit_state = scic_sds_port_stopping_state_exit | 1593 | .exit_state = sci_port_stopping_state_exit |
1729 | }, | 1594 | }, |
1730 | [SCI_PORT_READY] = { | 1595 | [SCI_PORT_READY] = { |
1731 | .enter_state = scic_sds_port_ready_state_enter, | 1596 | .enter_state = sci_port_ready_state_enter, |
1732 | }, | 1597 | }, |
1733 | [SCI_PORT_SUB_WAITING] = { | 1598 | [SCI_PORT_SUB_WAITING] = { |
1734 | .enter_state = scic_sds_port_ready_substate_waiting_enter, | 1599 | .enter_state = sci_port_ready_substate_waiting_enter, |
1735 | }, | 1600 | }, |
1736 | [SCI_PORT_SUB_OPERATIONAL] = { | 1601 | [SCI_PORT_SUB_OPERATIONAL] = { |
1737 | .enter_state = scic_sds_port_ready_substate_operational_enter, | 1602 | .enter_state = sci_port_ready_substate_operational_enter, |
1738 | .exit_state = scic_sds_port_ready_substate_operational_exit | 1603 | .exit_state = sci_port_ready_substate_operational_exit |
1739 | }, | 1604 | }, |
1740 | [SCI_PORT_SUB_CONFIGURING] = { | 1605 | [SCI_PORT_SUB_CONFIGURING] = { |
1741 | .enter_state = scic_sds_port_ready_substate_configuring_enter, | 1606 | .enter_state = sci_port_ready_substate_configuring_enter, |
1742 | .exit_state = scic_sds_port_ready_substate_configuring_exit | 1607 | .exit_state = sci_port_ready_substate_configuring_exit |
1743 | }, | 1608 | }, |
1744 | [SCI_PORT_RESETTING] = { | 1609 | [SCI_PORT_RESETTING] = { |
1745 | .exit_state = scic_sds_port_resetting_state_exit | 1610 | .exit_state = sci_port_resetting_state_exit |
1746 | }, | 1611 | }, |
1747 | [SCI_PORT_FAILED] = { | 1612 | [SCI_PORT_FAILED] = { |
1748 | .enter_state = scic_sds_port_failed_state_enter, | 1613 | .enter_state = sci_port_failed_state_enter, |
1749 | } | 1614 | } |
1750 | }; | 1615 | }; |
1751 | 1616 | ||
1752 | void scic_sds_port_construct(struct isci_port *iport, u8 index, | 1617 | void sci_port_construct(struct isci_port *iport, u8 index, |
1753 | struct isci_host *ihost) | 1618 | struct isci_host *ihost) |
1754 | { | 1619 | { |
1755 | sci_init_sm(&iport->sm, scic_sds_port_state_table, SCI_PORT_STOPPED); | 1620 | sci_init_sm(&iport->sm, sci_port_state_table, SCI_PORT_STOPPED); |
1756 | 1621 | ||
1757 | iport->logical_port_index = SCIC_SDS_DUMMY_PORT; | 1622 | iport->logical_port_index = SCIC_SDS_DUMMY_PORT; |
1758 | iport->physical_port_index = index; | 1623 | iport->physical_port_index = index; |
@@ -1798,9 +1663,7 @@ enum isci_status isci_port_get_state( | |||
1798 | return isci_port->status; | 1663 | return isci_port->status; |
1799 | } | 1664 | } |
1800 | 1665 | ||
1801 | void scic_sds_port_broadcast_change_received( | 1666 | void sci_port_broadcast_change_received(struct isci_port *iport, struct isci_phy *iphy) |
1802 | struct isci_port *iport, | ||
1803 | struct isci_phy *iphy) | ||
1804 | { | 1667 | { |
1805 | struct isci_host *ihost = iport->owning_controller; | 1668 | struct isci_host *ihost = iport->owning_controller; |
1806 | 1669 | ||
@@ -1823,7 +1686,7 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor | |||
1823 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1686 | spin_lock_irqsave(&ihost->scic_lock, flags); |
1824 | 1687 | ||
1825 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT | 1688 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT |
1826 | status = scic_port_hard_reset(iport, ISCI_PORT_RESET_TIMEOUT); | 1689 | status = sci_port_hard_reset(iport, ISCI_PORT_RESET_TIMEOUT); |
1827 | 1690 | ||
1828 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1691 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1829 | 1692 | ||
@@ -1840,7 +1703,7 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor | |||
1840 | ret = TMF_RESP_FUNC_FAILED; | 1703 | ret = TMF_RESP_FUNC_FAILED; |
1841 | 1704 | ||
1842 | dev_err(&ihost->pdev->dev, | 1705 | dev_err(&ihost->pdev->dev, |
1843 | "%s: iport = %p; scic_port_hard_reset call" | 1706 | "%s: iport = %p; sci_port_hard_reset call" |
1844 | " failed 0x%x\n", | 1707 | " failed 0x%x\n", |
1845 | __func__, iport, status); | 1708 | __func__, iport, status); |
1846 | 1709 | ||
@@ -1863,8 +1726,8 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor | |||
1863 | 1726 | ||
1864 | if (!iphy) | 1727 | if (!iphy) |
1865 | continue; | 1728 | continue; |
1866 | scic_sds_phy_stop(iphy); | 1729 | sci_phy_stop(iphy); |
1867 | scic_sds_phy_start(iphy); | 1730 | sci_phy_start(iphy); |
1868 | } | 1731 | } |
1869 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1732 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1870 | } | 1733 | } |