| @@ -83,7 +83,7 @@ static void isci_port_change_state(struct isci_port *iport, enum isci_status sta · 82 unmodified lines |
| 83 | * transmit_identification register. | 83 | * transmit_identification register. |
| 84 | */ | 84 | */ |
| 85 | static void | 85 | static void |
| 86 | scic_sds_port_get_protocols(struct scic_sds_port *sci_port, | 86 | scic_sds_port_get_protocols(struct isci_port *iport, |
| 87 | struct scic_phy_proto *protocols) | 87 | struct scic_phy_proto *protocols) |
| 88 | { | 88 | { |
| 89 | u8 index; | 89 | u8 index; |
| @@ -91,8 +91,8 @@ scic_sds_port_get_protocols(struct scic_sds_port *sci_port, · 1 unmodified line |
| 91 | protocols->all = 0; | 91 | protocols->all = 0; |
| 92 | | 92 | |
| 93 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 93 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 94 | if (sci_port->phy_table[index] != NULL) { | 94 | if (iport->phy_table[index] != NULL) { |
| 95 | scic_sds_phy_get_protocols(sci_port->phy_table[index], | 95 | scic_sds_phy_get_protocols(iport->phy_table[index], |
| 96 | protocols); | 96 | protocols); |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| @@ -107,7 +107,7 @@ scic_sds_port_get_protocols(struct scic_sds_port *sci_port, · 8 unmodified lines |
| 107 | * Return a bit mask indicating which phys are a part of this port. Each bit | 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). | 108 | * corresponds to a phy identifier (e.g. bit 0 = phy id 0). |
| 109 | */ | 109 | */ |
| 110 | static u32 scic_sds_port_get_phys(struct scic_sds_port *sci_port) | 110 | static u32 scic_sds_port_get_phys(struct isci_port *iport) |
| 111 | { | 111 | { |
| 112 | u32 index; | 112 | u32 index; |
| 113 | u32 mask; | 113 | u32 mask; |
| @@ -115,7 +115,7 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *sci_port) · 1 unmodified line |
| 115 | mask = 0; | 115 | mask = 0; |
| 116 | | 116 | |
| 117 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 117 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 118 | if (sci_port->phy_table[index] != NULL) { | 118 | if (iport->phy_table[index] != NULL) { |
| 119 | mask |= (1 << index); | 119 | mask |= (1 << index); |
| 120 | } | 120 | } |
| 121 | } | 121 | } |
| @@ -136,30 +136,29 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *sci_port) · 14 unmodified lines |
| 136 | * value is returned if the specified port is not valid. When this value is | 136 | * 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. | 137 | * returned, no data is copied to the properties output parameter. |
| 138 | */ | 138 | */ |
| 139 | static enum sci_status scic_port_get_properties(struct scic_sds_port *port, | 139 | static enum sci_status scic_port_get_properties(struct isci_port *iport, |
| 140 | struct scic_port_properties *prop) | 140 | struct scic_port_properties *prop) |
| 141 | { | 141 | { |
| 142 | if ((port == NULL) || | 142 | if (!iport || iport->logical_port_index == SCIC_SDS_DUMMY_PORT) |
| 143 | (port->logical_port_index == SCIC_SDS_DUMMY_PORT)) | | |
| 144 | return SCI_FAILURE_INVALID_PORT; | 143 | return SCI_FAILURE_INVALID_PORT; |
| 145 | | 144 | |
| 146 | prop->index = port->logical_port_index; | 145 | prop->index = iport->logical_port_index; |
| 147 | prop->phy_mask = scic_sds_port_get_phys(port); | 146 | prop->phy_mask = scic_sds_port_get_phys(iport); |
| 148 | scic_sds_port_get_sas_address(port, &prop->local.sas_address); | 147 | scic_sds_port_get_sas_address(iport, &prop->local.sas_address); |
| 149 | scic_sds_port_get_protocols(port, &prop->local.protocols); | 148 | scic_sds_port_get_protocols(iport, &prop->local.protocols); |
| 150 | scic_sds_port_get_attached_sas_address(port, &prop->remote.sas_address); | 149 | scic_sds_port_get_attached_sas_address(iport, &prop->remote.sas_address); |
| 151 | | 150 | |
| 152 | return SCI_SUCCESS; | 151 | return SCI_SUCCESS; |
| 153 | } | 152 | } |
| 154 | | 153 | |
| 155 | static void scic_port_bcn_enable(struct scic_sds_port *sci_port) | 154 | static void scic_port_bcn_enable(struct isci_port *iport) |
| 156 | { | 155 | { |
| 157 | struct isci_phy *iphy; | 156 | struct isci_phy *iphy; |
| 158 | u32 val; | 157 | u32 val; |
| 159 | int i; | 158 | int i; |
| 160 | | 159 | |
| 161 | for (i = 0; i < ARRAY_SIZE(sci_port->phy_table); i++) { | 160 | for (i = 0; i < ARRAY_SIZE(iport->phy_table); i++) { |
| 162 | iphy = sci_port->phy_table[i]; | 161 | iphy = iport->phy_table[i]; |
| 163 | if (!iphy) | 162 | if (!iphy) |
| 164 | continue; | 163 | continue; |
| 165 | val = readl(&iphy->link_layer_registers->link_layer_control); | 164 | val = readl(&iphy->link_layer_registers->link_layer_control); |
| @@ -179,8 +178,8 @@ void isci_port_bcn_enable(struct isci_host *ihost, struct isci_port *iport) · 13 unmodified lines |
| 179 | if (!test_and_clear_bit(IPORT_BCN_PENDING, &iport->flags)) | 178 | if (!test_and_clear_bit(IPORT_BCN_PENDING, &iport->flags)) |
| 180 | return; | 179 | return; |
| 181 | | 180 | |
| 182 | for (i = 0; i < ARRAY_SIZE(iport->sci.phy_table); i++) { | 181 | for (i = 0; i < ARRAY_SIZE(iport->phy_table); i++) { |
| 183 | struct isci_phy *iphy = iport->sci.phy_table[i]; | 182 | struct isci_phy *iphy = iport->phy_table[i]; |
| 184 | | 183 | |
| 185 | if (!iphy) | 184 | if (!iphy) |
| 186 | continue; | 185 | continue; |
| @@ -191,12 +190,10 @@ void isci_port_bcn_enable(struct isci_host *ihost, struct isci_port *iport) · 4 unmodified lines |
| 191 | } | 190 | } |
| 192 | } | 191 | } |
| 193 | | 192 | |
| 194 | void isci_port_bc_change_received(struct isci_host *ihost, | 193 | static void isci_port_bc_change_received(struct isci_host *ihost, |
| 195 | struct scic_sds_port *sci_port, | 194 | struct isci_port *iport, |
| 196 | struct isci_phy *iphy) | 195 | struct isci_phy *iphy) |
| 197 | { | 196 | { |
| 198 | struct isci_port *iport = iphy->isci_port; | | |
| 199 | | | |
| 200 | if (iport && test_bit(IPORT_BCN_BLOCKED, &iport->flags)) { | 197 | if (iport && test_bit(IPORT_BCN_BLOCKED, &iport->flags)) { |
| 201 | dev_dbg(&ihost->pdev->dev, | 198 | dev_dbg(&ihost->pdev->dev, |
| 202 | "%s: disabled BCN; isci_phy = %p, sas_phy = %p\n", | 199 | "%s: disabled BCN; isci_phy = %p, sas_phy = %p\n", |
| @@ -212,31 +209,30 @@ void isci_port_bc_change_received(struct isci_host *ihost, · 9 unmodified lines |
| 212 | ihost->sas_ha.notify_port_event(&iphy->sas_phy, | 209 | ihost->sas_ha.notify_port_event(&iphy->sas_phy, |
| 213 | PORTE_BROADCAST_RCVD); | 210 | PORTE_BROADCAST_RCVD); |
| 214 | } | 211 | } |
| 215 | scic_port_bcn_enable(sci_port); | 212 | scic_port_bcn_enable(iport); |
| 216 | } | 213 | } |
| 217 | | 214 | |
| 218 | static void isci_port_link_up(struct isci_host *isci_host, | 215 | static void isci_port_link_up(struct isci_host *isci_host, |
| 219 | struct scic_sds_port *port, | 216 | struct isci_port *iport, |
| 220 | struct isci_phy *iphy) | 217 | struct isci_phy *iphy) |
| 221 | { | 218 | { |
| 222 | unsigned long flags; | 219 | unsigned long flags; |
| 223 | struct scic_port_properties properties; | 220 | struct scic_port_properties properties; |
| 224 | struct isci_port *isci_port = sci_port_to_iport(port); | | |
| 225 | unsigned long success = true; | 221 | unsigned long success = true; |
| 226 | | 222 | |
| 227 | BUG_ON(iphy->isci_port != NULL); | 223 | BUG_ON(iphy->isci_port != NULL); |
| 228 | | 224 | |
| 229 | iphy->isci_port = isci_port; | 225 | iphy->isci_port = iport; |
| 230 | | 226 | |
| 231 | dev_dbg(&isci_host->pdev->dev, | 227 | dev_dbg(&isci_host->pdev->dev, |
| 232 | "%s: isci_port = %p\n", | 228 | "%s: isci_port = %p\n", |
| 233 | __func__, isci_port); | 229 | __func__, iport); |
| 234 | | 230 | |
| 235 | spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); | 231 | spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); |
| 236 | | 232 | |
| 237 | isci_port_change_state(iphy->isci_port, isci_starting); | 233 | isci_port_change_state(iphy->isci_port, isci_starting); |
| 238 | | 234 | |
| 239 | scic_port_get_properties(port, &properties); | 235 | scic_port_get_properties(iport, &properties); |
| 240 | | 236 | |
| 241 | if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { | 237 | if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { |
| 242 | u64 attached_sas_address; | 238 | u64 attached_sas_address; |
| @@ -370,7 +366,7 @@ static void isci_port_not_ready(struct isci_host *isci_host, struct isci_port *i · 127 unmodified lines |
| 370 | } | 366 | } |
| 371 | | 367 | |
| 372 | static void isci_port_stop_complete(struct scic_sds_controller *scic, | 368 | static void isci_port_stop_complete(struct scic_sds_controller *scic, |
| 373 | struct scic_sds_port *sci_port, | 369 | struct isci_port *iport, |
| 374 | enum sci_status completion_status) | 370 | enum sci_status completion_status) |
| 375 | { | 371 | { |
| 376 | dev_dbg(&scic_to_ihost(scic)->pdev->dev, "Port stop complete\n"); | 372 | dev_dbg(&scic_to_ihost(scic)->pdev->dev, "Port stop complete\n"); |
| @@ -408,30 +404,30 @@ static void isci_port_hard_reset_complete(struct isci_port *isci_port, · 31 unmodified lines |
| 408 | * assignment for the port false if this is not a valid phy assignment for the | 404 | * assignment for the port false if this is not a valid phy assignment for the |
| 409 | * port | 405 | * port |
| 410 | */ | 406 | */ |
| 411 | bool scic_sds_port_is_valid_phy_assignment(struct scic_sds_port *sci_port, | 407 | bool scic_sds_port_is_valid_phy_assignment(struct isci_port *iport, |
| 412 | u32 phy_index) | 408 | u32 phy_index) |
| 413 | { | 409 | { |
| 414 | /* Initialize to invalid value. */ | 410 | /* Initialize to invalid value. */ |
| 415 | u32 existing_phy_index = SCI_MAX_PHYS; | 411 | u32 existing_phy_index = SCI_MAX_PHYS; |
| 416 | u32 index; | 412 | u32 index; |
| 417 | | 413 | |
| 418 | if ((sci_port->physical_port_index == 1) && (phy_index != 1)) { | 414 | if ((iport->physical_port_index == 1) && (phy_index != 1)) { |
| 419 | return false; | 415 | return false; |
| 420 | } | 416 | } |
| 421 | | 417 | |
| 422 | if (sci_port->physical_port_index == 3 && phy_index != 3) { | 418 | if (iport->physical_port_index == 3 && phy_index != 3) { |
| 423 | return false; | 419 | return false; |
| 424 | } | 420 | } |
| 425 | | 421 | |
| 426 | if ( | 422 | if ( |
| 427 | (sci_port->physical_port_index == 2) | 423 | (iport->physical_port_index == 2) |
| 428 | && ((phy_index == 0) || (phy_index == 1)) | 424 | && ((phy_index == 0) || (phy_index == 1)) |
| 429 | ) { | 425 | ) { |
| 430 | return false; | 426 | return false; |
| 431 | } | 427 | } |
| 432 | | 428 | |
| 433 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 429 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 434 | if ((sci_port->phy_table[index] != NULL) | 430 | if ((iport->phy_table[index] != NULL) |
| 435 | && (index != phy_index)) { | 431 | && (index != phy_index)) { |
| 436 | existing_phy_index = index; | 432 | existing_phy_index = index; |
| 437 | } | 433 | } |
| @@ -442,9 +438,9 @@ bool scic_sds_port_is_valid_phy_assignment(struct scic_sds_port *sci_port, · 4 unmodified lines |
| 442 | * operating at the same maximum link rate. */ | 438 | * operating at the same maximum link rate. */ |
| 443 | if ( | 439 | if ( |
| 444 | (existing_phy_index < SCI_MAX_PHYS) | 440 | (existing_phy_index < SCI_MAX_PHYS) |
| 445 | && (sci_port->owning_controller->user_parameters.sds1.phys[ | 441 | && (iport->owning_controller->user_parameters.sds1.phys[ |
| 446 | phy_index].max_speed_generation != | 442 | phy_index].max_speed_generation != |
| 447 | sci_port->owning_controller->user_parameters.sds1.phys[ | 443 | iport->owning_controller->user_parameters.sds1.phys[ |
| 448 | existing_phy_index].max_speed_generation) | 444 | existing_phy_index].max_speed_generation) |
| 449 | ) | 445 | ) |
| 450 | return false; | 446 | return false; |
| @@ -465,25 +461,25 @@ bool scic_sds_port_is_valid_phy_assignment(struct scic_sds_port *sci_port, · 14 unmodified lines |
| 465 | * port false if this is not a valid phy assignment for the port | 461 | * port false if this is not a valid phy assignment for the port |
| 466 | */ | 462 | */ |
| 467 | static bool scic_sds_port_is_phy_mask_valid( | 463 | static bool scic_sds_port_is_phy_mask_valid( |
| 468 | struct scic_sds_port *sci_port, | 464 | struct isci_port *iport, |
| 469 | u32 phy_mask) | 465 | u32 phy_mask) |
| 470 | { | 466 | { |
| 471 | if (sci_port->physical_port_index == 0) { | 467 | if (iport->physical_port_index == 0) { |
| 472 | if (((phy_mask & 0x0F) == 0x0F) | 468 | if (((phy_mask & 0x0F) == 0x0F) |
| 473 | || ((phy_mask & 0x03) == 0x03) | 469 | || ((phy_mask & 0x03) == 0x03) |
| 474 | || ((phy_mask & 0x01) == 0x01) | 470 | || ((phy_mask & 0x01) == 0x01) |
| 475 | || (phy_mask == 0)) | 471 | || (phy_mask == 0)) |
| 476 | return true; | 472 | return true; |
| 477 | } else if (sci_port->physical_port_index == 1) { | 473 | } else if (iport->physical_port_index == 1) { |
| 478 | if (((phy_mask & 0x02) == 0x02) | 474 | if (((phy_mask & 0x02) == 0x02) |
| 479 | || (phy_mask == 0)) | 475 | || (phy_mask == 0)) |
| 480 | return true; | 476 | return true; |
| 481 | } else if (sci_port->physical_port_index == 2) { | 477 | } else if (iport->physical_port_index == 2) { |
| 482 | if (((phy_mask & 0x0C) == 0x0C) | 478 | if (((phy_mask & 0x0C) == 0x0C) |
| 483 | || ((phy_mask & 0x04) == 0x04) | 479 | || ((phy_mask & 0x04) == 0x04) |
| 484 | || (phy_mask == 0)) | 480 | || (phy_mask == 0)) |
| 485 | return true; | 481 | return true; |
| 486 | } else if (sci_port->physical_port_index == 3) { | 482 | } else if (iport->physical_port_index == 3) { |
| 487 | if (((phy_mask & 0x08) == 0x08) | 483 | if (((phy_mask & 0x08) == 0x08) |
| 488 | || (phy_mask == 0)) | 484 | || (phy_mask == 0)) |
| 489 | return true; | 485 | return true; |
| @@ -500,7 +496,7 @@ static bool scic_sds_port_is_phy_mask_valid( · 10 unmodified lines |
| 500 | * point) phys contained in the port. All other values specify a struct scic_sds_phy | 496 | * point) phys contained in the port. All other values specify a struct scic_sds_phy |
| 501 | * object that is active in the port. | 497 | * object that is active in the port. |
| 502 | */ | 498 | */ |
| 503 | static struct isci_phy *scic_sds_port_get_a_connected_phy(struct scic_sds_port *sci_port) | 499 | static struct isci_phy *scic_sds_port_get_a_connected_phy(struct isci_port *iport) |
| 504 | { | 500 | { |
| 505 | u32 index; | 501 | u32 index; |
| 506 | struct isci_phy *iphy; | 502 | struct isci_phy *iphy; |
| @@ -509,29 +505,29 @@ static struct isci_phy *scic_sds_port_get_a_connected_phy(struct scic_sds_port * · 2 unmodified lines |
| 509 | /* Ensure that the phy is both part of the port and currently | 505 | /* Ensure that the phy is both part of the port and currently |
| 510 | * connected to the remote end-point. | 506 | * connected to the remote end-point. |
| 511 | */ | 507 | */ |
| 512 | iphy = sci_port->phy_table[index]; | 508 | iphy = iport->phy_table[index]; |
| 513 | if (iphy && scic_sds_port_active_phy(sci_port, iphy)) | 509 | if (iphy && scic_sds_port_active_phy(iport, iphy)) |
| 514 | return iphy; | 510 | return iphy; |
| 515 | } | 511 | } |
| 516 | | 512 | |
| 517 | return NULL; | 513 | return NULL; |
| 518 | } | 514 | } |
| 519 | | 515 | |
| 520 | static enum sci_status scic_sds_port_set_phy(struct scic_sds_port *port, struct isci_phy *iphy) | 516 | static enum sci_status scic_sds_port_set_phy(struct isci_port *iport, struct isci_phy *iphy) |
| 521 | { | 517 | { |
| 522 | /* Check to see if we can add this phy to a port | 518 | /* Check to see if we can add this phy to a port |
| 523 | * that means that the phy is not part of a port and that the port does | 519 | * that means that the phy is not part of a port and that the port does |
| 524 | * not already have a phy assinged to the phy index. | 520 | * not already have a phy assinged to the phy index. |
| 525 | */ | 521 | */ |
| 526 | if (!port->phy_table[iphy->phy_index] && | 522 | if (!iport->phy_table[iphy->phy_index] && |
| 527 | !phy_get_non_dummy_port(iphy) && | 523 | !phy_get_non_dummy_port(iphy) && |
| 528 | scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index)) { | 524 | scic_sds_port_is_valid_phy_assignment(iport, iphy->phy_index)) { |
| 529 | /* Phy is being added in the stopped state so we are in MPC mode | 525 | /* Phy is being added in the stopped state so we are in MPC mode |
| 530 | * make logical port index = physical port index | 526 | * make logical port index = physical port index |
| 531 | */ | 527 | */ |
| 532 | port->logical_port_index = port->physical_port_index; | 528 | iport->logical_port_index = iport->physical_port_index; |
| 533 | port->phy_table[iphy->phy_index] = iphy; | 529 | iport->phy_table[iphy->phy_index] = iphy; |
| 534 | scic_sds_phy_set_port(iphy, port); | 530 | scic_sds_phy_set_port(iphy, iport); |
| 535 | | 531 | |
| 536 | return SCI_SUCCESS; | 532 | return SCI_SUCCESS; |
| 537 | } | 533 | } |
| @@ -539,18 +535,18 @@ static enum sci_status scic_sds_port_set_phy(struct scic_sds_port *port, struct · 1 unmodified line |
| 539 | return SCI_FAILURE; | 535 | return SCI_FAILURE; |
| 540 | } | 536 | } |
| 541 | | 537 | |
| 542 | static enum sci_status scic_sds_port_clear_phy(struct scic_sds_port *port, | 538 | static enum sci_status scic_sds_port_clear_phy(struct isci_port *iport, |
| 543 | struct isci_phy *iphy) | 539 | struct isci_phy *iphy) |
| 544 | { | 540 | { |
| 545 | /* Make sure that this phy is part of this port */ | 541 | /* Make sure that this phy is part of this port */ |
| 546 | if (port->phy_table[iphy->phy_index] == iphy && | 542 | if (iport->phy_table[iphy->phy_index] == iphy && |
| 547 | phy_get_non_dummy_port(iphy) == port) { | 543 | phy_get_non_dummy_port(iphy) == iport) { |
| 548 | struct scic_sds_controller *scic = port->owning_controller; | 544 | struct scic_sds_controller *scic = iport->owning_controller; |
| 549 | struct isci_host *ihost = scic_to_ihost(scic); | 545 | struct isci_host *ihost = scic_to_ihost(scic); |
| 550 | | 546 | |
| 551 | /* Yep it is assigned to this port so remove it */ | 547 | /* Yep it is assigned to this port so remove it */ |
| 552 | scic_sds_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS].sci); | 548 | scic_sds_phy_set_port(iphy, &ihost->ports[SCI_MAX_PORTS]); |
| 553 | port->phy_table[iphy->phy_index] = NULL; | 549 | iport->phy_table[iphy->phy_index] = NULL; |
| 554 | return SCI_SUCCESS; | 550 | return SCI_SUCCESS; |
| 555 | } | 551 | } |
| 556 | | 552 | |
| @@ -568,7 +564,7 @@ static enum sci_status scic_sds_port_clear_phy(struct scic_sds_port *port, · 11 unmodified lines |
| 568 | * | 564 | * |
| 569 | */ | 565 | */ |
| 570 | void scic_sds_port_get_sas_address( | 566 | void scic_sds_port_get_sas_address( |
| 571 | struct scic_sds_port *sci_port, | 567 | struct isci_port *iport, |
| 572 | struct sci_sas_address *sas_address) | 568 | struct sci_sas_address *sas_address) |
| 573 | { | 569 | { |
| 574 | u32 index; | 570 | u32 index; |
| @@ -577,8 +573,8 @@ void scic_sds_port_get_sas_address( · 2 unmodified lines |
| 577 | sas_address->low = 0; | 573 | sas_address->low = 0; |
| 578 | | 574 | |
| 579 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 575 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 580 | if (sci_port->phy_table[index] != NULL) { | 576 | if (iport->phy_table[index] != NULL) { |
| 581 | scic_sds_phy_get_sas_address(sci_port->phy_table[index], sas_address); | 577 | scic_sds_phy_get_sas_address(iport->phy_table[index], sas_address); |
| 582 | } | 578 | } |
| 583 | } | 579 | } |
| 584 | } | 580 | } |
| @@ -594,7 +590,7 @@ void scic_sds_port_get_sas_address( · 9 unmodified lines |
| 594 | * | 590 | * |
| 595 | */ | 591 | */ |
| 596 | void scic_sds_port_get_attached_sas_address( | 592 | void scic_sds_port_get_attached_sas_address( |
| 597 | struct scic_sds_port *sci_port, | 593 | struct isci_port *iport, |
| 598 | struct sci_sas_address *sas_address) | 594 | struct sci_sas_address *sas_address) |
| 599 | { | 595 | { |
| 600 | struct isci_phy *iphy; | 596 | struct isci_phy *iphy; |
| @@ -603,7 +599,7 @@ void scic_sds_port_get_attached_sas_address( · 2 unmodified lines |
| 603 | * Ensure that the phy is both part of the port and currently | 599 | * Ensure that the phy is both part of the port and currently |
| 604 | * connected to the remote end-point. | 600 | * connected to the remote end-point. |
| 605 | */ | 601 | */ |
| 606 | iphy = scic_sds_port_get_a_connected_phy(sci_port); | 602 | iphy = scic_sds_port_get_a_connected_phy(iport); |
| 607 | if (iphy) { | 603 | if (iphy) { |
| 608 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) { | 604 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) { |
| 609 | scic_sds_phy_get_attached_sas_address(iphy, | 605 | scic_sds_phy_get_attached_sas_address(iphy, |
| @@ -628,11 +624,11 @@ void scic_sds_port_get_attached_sas_address( · 18 unmodified lines |
| 628 | * This structure will be posted to the hardware to work around a scheduler | 624 | * This structure will be posted to the hardware to work around a scheduler |
| 629 | * error in the hardware. | 625 | * error in the hardware. |
| 630 | */ | 626 | */ |
| 631 | static void scic_sds_port_construct_dummy_rnc(struct scic_sds_port *sci_port, u16 rni) | 627 | static void scic_sds_port_construct_dummy_rnc(struct isci_port *iport, u16 rni) |
| 632 | { | 628 | { |
| 633 | union scu_remote_node_context *rnc; | 629 | union scu_remote_node_context *rnc; |
| 634 | | 630 | |
| 635 | rnc = &sci_port->owning_controller->remote_node_context_table[rni]; | 631 | rnc = &iport->owning_controller->remote_node_context_table[rni]; |
| 636 | | 632 | |
| 637 | memset(rnc, 0, sizeof(union scu_remote_node_context)); | 633 | memset(rnc, 0, sizeof(union scu_remote_node_context)); |
| 638 | | 634 | |
| @@ -641,7 +637,7 @@ static void scic_sds_port_construct_dummy_rnc(struct scic_sds_port *sci_port, u1 · 2 unmodified lines |
| 641 | | 637 | |
| 642 | rnc->ssp.remote_node_index = rni; | 638 | rnc->ssp.remote_node_index = rni; |
| 643 | rnc->ssp.remote_node_port_width = 1; | 639 | rnc->ssp.remote_node_port_width = 1; |
| 644 | rnc->ssp.logical_port_index = sci_port->physical_port_index; | 640 | rnc->ssp.logical_port_index = iport->physical_port_index; |
| 645 | | 641 | |
| 646 | rnc->ssp.nexus_loss_timer_enable = false; | 642 | rnc->ssp.nexus_loss_timer_enable = false; |
| 647 | rnc->ssp.check_bit = false; | 643 | rnc->ssp.check_bit = false; |
| @@ -656,9 +652,9 @@ static void scic_sds_port_construct_dummy_rnc(struct scic_sds_port *sci_port, u1 · 8 unmodified lines |
| 656 | * structure will be posted to the hardwre to work around a scheduler error | 652 | * structure will be posted to the hardwre to work around a scheduler error |
| 657 | * in the hardware. | 653 | * in the hardware. |
| 658 | */ | 654 | */ |
| 659 | static void scic_sds_port_construct_dummy_task(struct scic_sds_port *sci_port, u16 tag) | 655 | static void scic_sds_port_construct_dummy_task(struct isci_port *iport, u16 tag) |
| 660 | { | 656 | { |
| 661 | struct scic_sds_controller *scic = sci_port->owning_controller; | 657 | struct scic_sds_controller *scic = iport->owning_controller; |
| 662 | struct scu_task_context *task_context; | 658 | struct scu_task_context *task_context; |
| 663 | | 659 | |
| 664 | task_context = &scic->task_context_table[ISCI_TAG_TCI(tag)]; | 660 | task_context = &scic->task_context_table[ISCI_TAG_TCI(tag)]; |
| @@ -666,29 +662,29 @@ static void scic_sds_port_construct_dummy_task(struct scic_sds_port *sci_port, u · 1 unmodified line |
| 666 | | 662 | |
| 667 | task_context->initiator_request = 1; | 663 | task_context->initiator_request = 1; |
| 668 | task_context->connection_rate = 1; | 664 | task_context->connection_rate = 1; |
| 669 | task_context->logical_port_index = sci_port->physical_port_index; | 665 | task_context->logical_port_index = iport->physical_port_index; |
| 670 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP; | 666 | task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP; |
| 671 | task_context->task_index = ISCI_TAG_TCI(tag); | 667 | task_context->task_index = ISCI_TAG_TCI(tag); |
| 672 | task_context->valid = SCU_TASK_CONTEXT_VALID; | 668 | task_context->valid = SCU_TASK_CONTEXT_VALID; |
| 673 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 669 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
| 674 | task_context->remote_node_index = sci_port->reserved_rni; | 670 | task_context->remote_node_index = iport->reserved_rni; |
| 675 | task_context->do_not_dma_ssp_good_response = 1; | 671 | task_context->do_not_dma_ssp_good_response = 1; |
| 676 | task_context->task_phase = 0x01; | 672 | task_context->task_phase = 0x01; |
| 677 | } | 673 | } |
| 678 | | 674 | |
| 679 | static void scic_sds_port_destroy_dummy_resources(struct scic_sds_port *sci_port) | 675 | static void scic_sds_port_destroy_dummy_resources(struct isci_port *iport) |
| 680 | { | 676 | { |
| 681 | struct scic_sds_controller *scic = sci_port->owning_controller; | 677 | struct scic_sds_controller *scic = iport->owning_controller; |
| 682 | | 678 | |
| 683 | if (sci_port->reserved_tag != SCI_CONTROLLER_INVALID_IO_TAG) | 679 | if (iport->reserved_tag != SCI_CONTROLLER_INVALID_IO_TAG) |
| 684 | isci_free_tag(scic_to_ihost(scic), sci_port->reserved_tag); | 680 | isci_free_tag(scic_to_ihost(scic), iport->reserved_tag); |
| 685 | | 681 | |
| 686 | if (sci_port->reserved_rni != SCU_DUMMY_INDEX) | 682 | if (iport->reserved_rni != SCU_DUMMY_INDEX) |
| 687 | scic_sds_remote_node_table_release_remote_node_index(&scic->available_remote_nodes, | 683 | scic_sds_remote_node_table_release_remote_node_index(&scic->available_remote_nodes, |
| 688 | 1, sci_port->reserved_rni); | 684 | 1, iport->reserved_rni); |
| 689 | | 685 | |
| 690 | sci_port->reserved_rni = SCU_DUMMY_INDEX; | 686 | iport->reserved_rni = SCU_DUMMY_INDEX; |
| 691 | sci_port->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; | 687 | iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; |
| 692 | } | 688 | } |
| 693 | | 689 | |
| 694 | /** | 690 | /** |
| @@ -704,14 +700,14 @@ static void scic_sds_port_destroy_dummy_resources(struct scic_sds_port *sci_port · 9 unmodified lines |
| 704 | * if the phy being added to the port | 700 | * if the phy being added to the port |
| 705 | */ | 701 | */ |
| 706 | enum sci_status scic_sds_port_initialize( | 702 | enum sci_status scic_sds_port_initialize( |
| 707 | struct scic_sds_port *sci_port, | 703 | struct isci_port *iport, |
| 708 | void __iomem *port_task_scheduler_registers, | 704 | void __iomem *port_task_scheduler_registers, |
| 709 | void __iomem *port_configuration_regsiter, | 705 | void __iomem *port_configuration_regsiter, |
| 710 | void __iomem *viit_registers) | 706 | void __iomem *viit_registers) |
| 711 | { | 707 | { |
| 712 | sci_port->port_task_scheduler_registers = port_task_scheduler_registers; | 708 | iport->port_task_scheduler_registers = port_task_scheduler_registers; |
| 713 | sci_port->port_pe_configuration_register = port_configuration_regsiter; | 709 | iport->port_pe_configuration_register = port_configuration_regsiter; |
| 714 | sci_port->viit_registers = viit_registers; | 710 | iport->viit_registers = viit_registers; |
| 715 | | 711 | |
| 716 | return SCI_SUCCESS; | 712 | return SCI_SUCCESS; |
| 717 | } | 713 | } |
| @@ -720,20 +716,20 @@ enum sci_status scic_sds_port_initialize( · 2 unmodified lines |
| 720 | /** | 716 | /** |
| 721 | * This method assigns the direct attached device ID for this port. | 717 | * This method assigns the direct attached device ID for this port. |
| 722 | * | 718 | * |
| 723 | * @param[in] sci_port The port for which the direct attached device id is to | 719 | * @param[in] iport The port for which the direct attached device id is to |
| 724 | * be assigned. | 720 | * be assigned. |
| 725 | * @param[in] device_id The direct attached device ID to assign to the port. | 721 | * @param[in] device_id The direct attached device ID to assign to the port. |
| 726 | * This will be the RNi for the device | 722 | * This will be the RNi for the device |
| 727 | */ | 723 | */ |
| 728 | void scic_sds_port_setup_transports( | 724 | void scic_sds_port_setup_transports( |
| 729 | struct scic_sds_port *sci_port, | 725 | struct isci_port *iport, |
| 730 | u32 device_id) | 726 | u32 device_id) |
| 731 | { | 727 | { |
| 732 | u8 index; | 728 | u8 index; |
| 733 | | 729 | |
| 734 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 730 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 735 | if (sci_port->active_phy_mask & (1 << index)) | 731 | if (iport->active_phy_mask & (1 << index)) |
| 736 | scic_sds_phy_setup_transport(sci_port->phy_table[index], device_id); | 732 | scic_sds_phy_setup_transport(iport->phy_table[index], device_id); |
| 737 | } | 733 | } |
| 738 | } | 734 | } |
| 739 | | 735 | |
| @@ -749,39 +745,38 @@ void scic_sds_port_setup_transports( · 9 unmodified lines |
| 749 | * the phy to the port - enabling the Protocol Engine in the silicon. - | 745 | * the phy to the port - enabling the Protocol Engine in the silicon. - |
| 750 | * notifying the user that the link is up. none | 746 | * notifying the user that the link is up. none |
| 751 | */ | 747 | */ |
| 752 | static void scic_sds_port_activate_phy(struct scic_sds_port *sci_port, | 748 | static void scic_sds_port_activate_phy(struct isci_port *iport, |
| 753 | struct isci_phy *iphy, | 749 | struct isci_phy *iphy, |
| 754 | bool do_notify_user) | 750 | bool do_notify_user) |
| 755 | { | 751 | { |
| 756 | struct scic_sds_controller *scic = sci_port->owning_controller; | 752 | struct scic_sds_controller *scic = iport->owning_controller; |
| 757 | struct isci_host *ihost = scic_to_ihost(scic); | 753 | struct isci_host *ihost = scic_to_ihost(scic); |
| 758 | | 754 | |
| 759 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) | 755 | if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) |
| 760 | scic_sds_phy_resume(iphy); | 756 | scic_sds_phy_resume(iphy); |
| 761 | | 757 | |
| 762 | sci_port->active_phy_mask |= 1 << iphy->phy_index; | 758 | iport->active_phy_mask |= 1 << iphy->phy_index; |
| 763 | | 759 | |
| 764 | scic_sds_controller_clear_invalid_phy(scic, iphy); | 760 | scic_sds_controller_clear_invalid_phy(scic, iphy); |
| 765 | | 761 | |
| 766 | if (do_notify_user == true) | 762 | if (do_notify_user == true) |
| 767 | isci_port_link_up(ihost, sci_port, iphy); | 763 | isci_port_link_up(ihost, iport, iphy); |
| 768 | } | 764 | } |
| 769 | | 765 | |
| 770 | void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port, | 766 | void scic_sds_port_deactivate_phy(struct isci_port *iport, |
| 771 | struct isci_phy *iphy, | 767 | struct isci_phy *iphy, |
| 772 | bool do_notify_user) | 768 | bool do_notify_user) |
| 773 | { | 769 | { |
| 774 | struct scic_sds_controller *scic = scic_sds_port_get_controller(sci_port); | 770 | struct scic_sds_controller *scic = scic_sds_port_get_controller(iport); |
| 775 | struct isci_port *iport = sci_port_to_iport(sci_port); | | |
| 776 | struct isci_host *ihost = scic_to_ihost(scic); | 771 | struct isci_host *ihost = scic_to_ihost(scic); |
| 777 | | 772 | |
| 778 | sci_port->active_phy_mask &= ~(1 << iphy->phy_index); | 773 | iport->active_phy_mask &= ~(1 << iphy->phy_index); |
| 779 | | 774 | |
| 780 | iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; | 775 | iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; |
| 781 | | 776 | |
| 782 | /* Re-assign the phy back to the LP as if it were a narrow port */ | 777 | /* Re-assign the phy back to the LP as if it were a narrow port */ |
| 783 | writel(iphy->phy_index, | 778 | writel(iphy->phy_index, |
| 784 | &sci_port->port_pe_configuration_register[iphy->phy_index]); | 779 | &iport->port_pe_configuration_register[iphy->phy_index]); |
| 785 | | 780 | |
| 786 | if (do_notify_user == true) | 781 | if (do_notify_user == true) |
| 787 | isci_port_link_down(ihost, iphy, iport); | 782 | isci_port_link_down(ihost, iphy, iport); |
| @@ -795,10 +790,10 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port, · 7 unmodified lines |
| 795 | * This function will disable the phy and report that the phy is not valid for | 790 | * This function will disable the phy and report that the phy is not valid for |
| 796 | * this port object. None | 791 | * this port object. None |
| 797 | */ | 792 | */ |
| 798 | static void scic_sds_port_invalid_link_up(struct scic_sds_port *sci_port, | 793 | static void scic_sds_port_invalid_link_up(struct isci_port *iport, |
| 799 | struct isci_phy *iphy) | 794 | struct isci_phy *iphy) |
| 800 | { | 795 | { |
| 801 | struct scic_sds_controller *scic = sci_port->owning_controller; | 796 | struct scic_sds_controller *scic = iport->owning_controller; |
| 802 | | 797 | |
| 803 | /* | 798 | /* |
| 804 | * Check to see if we have alreay reported this link as bad and if | 799 | * Check to see if we have alreay reported this link as bad and if |
| @@ -825,17 +820,17 @@ static bool is_port_ready_state(enum scic_sds_port_states state) · 20 unmodified lines |
| 825 | } | 820 | } |
| 826 | | 821 | |
| 827 | /* flag dummy rnc hanling when exiting a ready state */ | 822 | /* flag dummy rnc hanling when exiting a ready state */ |
| 828 | static void port_state_machine_change(struct scic_sds_port *sci_port, | 823 | static void port_state_machine_change(struct isci_port *iport, |
| 829 | enum scic_sds_port_states state) | 824 | enum scic_sds_port_states state) |
| 830 | { | 825 | { |
| 831 | struct sci_base_state_machine *sm = &sci_port->sm; | 826 | struct sci_base_state_machine *sm = &iport->sm; |
| 832 | enum scic_sds_port_states old_state = sm->current_state_id; | 827 | enum scic_sds_port_states old_state = sm->current_state_id; |
| 833 | | 828 | |
| 834 | if (is_port_ready_state(old_state) && !is_port_ready_state(state)) | 829 | if (is_port_ready_state(old_state) && !is_port_ready_state(state)) |
| 835 | sci_port->ready_exit = true; | 830 | iport->ready_exit = true; |
| 836 | | 831 | |
| 837 | sci_change_state(sm, state); | 832 | sci_change_state(sm, state); |
| 838 | sci_port->ready_exit = false; | 833 | iport->ready_exit = false; |
| 839 | } | 834 | } |
| 840 | | 835 | |
| 841 | /** | 836 | /** |
| @@ -851,14 +846,14 @@ static void port_state_machine_change(struct scic_sds_port *sci_port, · 9 unmodified lines |
| 851 | * part of a port if it's attached SAS ADDRESS is the same as all other PHYs in | 846 | * part of a port if it's attached SAS ADDRESS is the same as all other PHYs in |
| 852 | * the same port. none | 847 | * the same port. none |
| 853 | */ | 848 | */ |
| 854 | static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port, | 849 | static void scic_sds_port_general_link_up_handler(struct isci_port *iport, |
| 855 | struct isci_phy *iphy, | 850 | struct isci_phy *iphy, |
| 856 | bool do_notify_user) | 851 | bool do_notify_user) |
| 857 | { | 852 | { |
| 858 | struct sci_sas_address port_sas_address; | 853 | struct sci_sas_address port_sas_address; |
| 859 | struct sci_sas_address phy_sas_address; | 854 | struct sci_sas_address phy_sas_address; |
| 860 | | 855 | |
| 861 | scic_sds_port_get_attached_sas_address(sci_port, &port_sas_address); | 856 | scic_sds_port_get_attached_sas_address(iport, &port_sas_address); |
| 862 | scic_sds_phy_get_attached_sas_address(iphy, &phy_sas_address); | 857 | scic_sds_phy_get_attached_sas_address(iphy, &phy_sas_address); |
| 863 | | 858 | |
| 864 | /* If the SAS address of the new phy matches the SAS address of | 859 | /* If the SAS address of the new phy matches the SAS address of |
| @@ -868,14 +863,14 @@ static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port · 3 unmodified lines |
| 868 | */ | 863 | */ |
| 869 | if ((phy_sas_address.high == port_sas_address.high && | 864 | if ((phy_sas_address.high == port_sas_address.high && |
| 870 | phy_sas_address.low == port_sas_address.low) || | 865 | phy_sas_address.low == port_sas_address.low) || |
| 871 | sci_port->active_phy_mask == 0) { | 866 | iport->active_phy_mask == 0) { |
| 872 | struct sci_base_state_machine *sm = &sci_port->sm; | 867 | struct sci_base_state_machine *sm = &iport->sm; |
| 873 | | 868 | |
| 874 | scic_sds_port_activate_phy(sci_port, iphy, do_notify_user); | 869 | scic_sds_port_activate_phy(iport, iphy, do_notify_user); |
| 875 | if (sm->current_state_id == SCI_PORT_RESETTING) | 870 | if (sm->current_state_id == SCI_PORT_RESETTING) |
| 876 | port_state_machine_change(sci_port, SCI_PORT_READY); | 871 | port_state_machine_change(iport, SCI_PORT_READY); |
| 877 | } else | 872 | } else |
| 878 | scic_sds_port_invalid_link_up(sci_port, iphy); | 873 | scic_sds_port_invalid_link_up(iport, iphy); |
| 879 | } | 874 | } |
| 880 | | 875 | |
| 881 | | 876 | |
| @@ -889,13 +884,13 @@ static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port · 7 unmodified lines |
| 889 | * bool true Is returned if this is a wide ported port. false Is returned if | 884 | * bool true Is returned if this is a wide ported port. false Is returned if |
| 890 | * this is a narrow port. | 885 | * this is a narrow port. |
| 891 | */ | 886 | */ |
| 892 | static bool scic_sds_port_is_wide(struct scic_sds_port *sci_port) | 887 | static bool scic_sds_port_is_wide(struct isci_port *iport) |
| 893 | { | 888 | { |
| 894 | u32 index; | 889 | u32 index; |
| 895 | u32 phy_count = 0; | 890 | u32 phy_count = 0; |
| 896 | | 891 | |
| 897 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 892 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 898 | if (sci_port->phy_table[index] != NULL) { | 893 | if (iport->phy_table[index] != NULL) { |
| 899 | phy_count++; | 894 | phy_count++; |
| 900 | } | 895 | } |
| 901 | } | 896 | } |
| @@ -918,13 +913,13 @@ static bool scic_sds_port_is_wide(struct scic_sds_port *sci_port) · 16 unmodified lines |
| 918 | * devices this could become an invalid port configuration. | 913 | * devices this could become an invalid port configuration. |
| 919 | */ | 914 | */ |
| 920 | bool scic_sds_port_link_detected( | 915 | bool scic_sds_port_link_detected( |
| 921 | struct scic_sds_port *sci_port, | 916 | struct isci_port *iport, |
| 922 | struct isci_phy *iphy) | 917 | struct isci_phy *iphy) |
| 923 | { | 918 | { |
| 924 | if ((sci_port->logical_port_index != SCIC_SDS_DUMMY_PORT) && | 919 | if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && |
| 925 | (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) && | 920 | (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) && |
| 926 | scic_sds_port_is_wide(sci_port)) { | 921 | scic_sds_port_is_wide(iport)) { |
| 927 | scic_sds_port_invalid_link_up(sci_port, iphy); | 922 | scic_sds_port_invalid_link_up(iport, iphy); |
| 928 | | 923 | |
| 929 | return false; | 924 | return false; |
| 930 | } | 925 | } |
| @@ -935,8 +930,8 @@ bool scic_sds_port_link_detected( · 4 unmodified lines |
| 935 | static void port_timeout(unsigned long data) | 930 | static void port_timeout(unsigned long data) |
| 936 | { | 931 | { |
| 937 | struct sci_timer *tmr = (struct sci_timer *)data; | 932 | struct sci_timer *tmr = (struct sci_timer *)data; |
| 938 | struct scic_sds_port *sci_port = container_of(tmr, typeof(*sci_port), timer); | 933 | struct isci_port *iport = container_of(tmr, typeof(*iport), timer); |
| 939 | struct isci_host *ihost = scic_to_ihost(sci_port->owning_controller); | 934 | struct isci_host *ihost = scic_to_ihost(iport->owning_controller); |
| 940 | unsigned long flags; | 935 | unsigned long flags; |
| 941 | u32 current_state; | 936 | u32 current_state; |
| 942 | | 937 | |
| @@ -945,33 +940,33 @@ static void port_timeout(unsigned long data) · 2 unmodified lines |
| 945 | if (tmr->cancel) | 940 | if (tmr->cancel) |
| 946 | goto done; | 941 | goto done; |
| 947 | | 942 | |
| 948 | current_state = sci_port->sm.current_state_id; | 943 | current_state = iport->sm.current_state_id; |
| 949 | | 944 | |
| 950 | if (current_state == SCI_PORT_RESETTING) { | 945 | if (current_state == SCI_PORT_RESETTING) { |
| 951 | /* if the port is still in the resetting state then the timeout | 946 | /* if the port is still in the resetting state then the timeout |
| 952 | * fired before the reset completed. | 947 | * fired before the reset completed. |
| 953 | */ | 948 | */ |
| 954 | port_state_machine_change(sci_port, SCI_PORT_FAILED); | 949 | port_state_machine_change(iport, SCI_PORT_FAILED); |
| 955 | } else if (current_state == SCI_PORT_STOPPED) { | 950 | } else if (current_state == SCI_PORT_STOPPED) { |
| 956 | /* if the port is stopped then the start request failed In this | 951 | /* if the port is stopped then the start request failed In this |
| 957 | * case stay in the stopped state. | 952 | * case stay in the stopped state. |
| 958 | */ | 953 | */ |
| 959 | dev_err(sciport_to_dev(sci_port), | 954 | dev_err(sciport_to_dev(iport), |
| 960 | "%s: SCIC Port 0x%p failed to stop before tiemout.\n", | 955 | "%s: SCIC Port 0x%p failed to stop before tiemout.\n", |
| 961 | __func__, | 956 | __func__, |
| 962 | sci_port); | 957 | iport); |
| 963 | } else if (current_state == SCI_PORT_STOPPING) { | 958 | } else if (current_state == SCI_PORT_STOPPING) { |
| 964 | /* if the port is still stopping then the stop has not completed */ | 959 | /* if the port is still stopping then the stop has not completed */ |
| 965 | isci_port_stop_complete(sci_port->owning_controller, | 960 | isci_port_stop_complete(iport->owning_controller, |
| 966 | sci_port, | 961 | iport, |
| 967 | SCI_FAILURE_TIMEOUT); | 962 | SCI_FAILURE_TIMEOUT); |
| 968 | } else { | 963 | } else { |
| 969 | /* The port is in the ready state and we have a timer | 964 | /* The port is in the ready state and we have a timer |
| 970 | * reporting a timeout this should not happen. | 965 | * reporting a timeout this should not happen. |
| 971 | */ | 966 | */ |
| 972 | dev_err(sciport_to_dev(sci_port), | 967 | dev_err(sciport_to_dev(iport), |
| 973 | "%s: SCIC Port 0x%p is processing a timeout operation " | 968 | "%s: SCIC Port 0x%p is processing a timeout operation " |
| 974 | "in state %d.\n", __func__, sci_port, current_state); | 969 | "in state %d.\n", __func__, iport, current_state); |
| 975 | } | 970 | } |
| 976 | | 971 | |
| 977 | done: | 972 | done: |
| @@ -985,29 +980,29 @@ done: · 7 unmodified lines |
| 985 | * | 980 | * |
| 986 | * | 981 | * |
| 987 | */ | 982 | */ |
| 988 | static void scic_sds_port_update_viit_entry(struct scic_sds_port *sci_port) | 983 | static void scic_sds_port_update_viit_entry(struct isci_port *iport) |
| 989 | { | 984 | { |
| 990 | struct sci_sas_address sas_address; | 985 | struct sci_sas_address sas_address; |
| 991 | | 986 | |
| 992 | scic_sds_port_get_sas_address(sci_port, &sas_address); | 987 | scic_sds_port_get_sas_address(iport, &sas_address); |
| 993 | | 988 | |
| 994 | writel(sas_address.high, | 989 | writel(sas_address.high, |
| 995 | &sci_port->viit_registers->initiator_sas_address_hi); | 990 | &iport->viit_registers->initiator_sas_address_hi); |
| 996 | writel(sas_address.low, | 991 | writel(sas_address.low, |
| 997 | &sci_port->viit_registers->initiator_sas_address_lo); | 992 | &iport->viit_registers->initiator_sas_address_lo); |
| 998 | | 993 | |
| 999 | /* This value get cleared just in case its not already cleared */ | 994 | /* This value get cleared just in case its not already cleared */ |
| 1000 | writel(0, &sci_port->viit_registers->reserved); | 995 | writel(0, &iport->viit_registers->reserved); |
| 1001 | | 996 | |
| 1002 | /* We are required to update the status register last */ | 997 | /* We are required to update the status register last */ |
| 1003 | writel(SCU_VIIT_ENTRY_ID_VIIT | | 998 | writel(SCU_VIIT_ENTRY_ID_VIIT | |
| 1004 | SCU_VIIT_IPPT_INITIATOR | | 999 | SCU_VIIT_IPPT_INITIATOR | |
| 1005 | ((1 << sci_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) | | 1000 | ((1 << iport->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) | |
| 1006 | SCU_VIIT_STATUS_ALL_VALID, | 1001 | SCU_VIIT_STATUS_ALL_VALID, |
| 1007 | &sci_port->viit_registers->status); | 1002 | &iport->viit_registers->status); |
| 1008 | } | 1003 | } |
| 1009 | | 1004 | |
| 1010 | enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct scic_sds_port *sci_port) | 1005 | enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct isci_port *iport) |
| 1011 | { | 1006 | { |
| 1012 | u16 index; | 1007 | u16 index; |
| 1013 | struct isci_phy *iphy; | 1008 | struct isci_phy *iphy; |
| @@ -1017,8 +1012,8 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct scic_sds_port *sci_ · 3 unmodified lines |
| 1017 | * Loop through all of the phys in this port and find the phy with the | 1012 | * Loop through all of the phys in this port and find the phy with the |
| 1018 | * lowest maximum link rate. */ | 1013 | * lowest maximum link rate. */ |
| 1019 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 1014 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 1020 | iphy = sci_port->phy_table[index]; | 1015 | iphy = iport->phy_table[index]; |
| 1021 | if (iphy && scic_sds_port_active_phy(sci_port, iphy) && | 1016 | if (iphy && scic_sds_port_active_phy(iport, iphy) && |
| 1022 | iphy->max_negotiated_speed < max_allowed_speed) | 1017 | iphy->max_negotiated_speed < max_allowed_speed) |
| 1023 | max_allowed_speed = iphy->max_negotiated_speed; | 1018 | max_allowed_speed = iphy->max_negotiated_speed; |
| 1024 | } | 1019 | } |
| @@ -1026,13 +1021,13 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(struct scic_sds_port *sci_ · 1 unmodified line |
| 1026 | return max_allowed_speed; | 1021 | return max_allowed_speed; |
| 1027 | } | 1022 | } |
| 1028 | | 1023 | |
| 1029 | static void scic_sds_port_suspend_port_task_scheduler(struct scic_sds_port *port) | 1024 | static void scic_sds_port_suspend_port_task_scheduler(struct isci_port *iport) |
| 1030 | { | 1025 | { |
| 1031 | u32 pts_control_value; | 1026 | u32 pts_control_value; |
| 1032 | | 1027 | |
| 1033 | pts_control_value = readl(&port->port_task_scheduler_registers->control); | 1028 | pts_control_value = readl(&iport->port_task_scheduler_registers->control); |
| 1034 | pts_control_value |= SCU_PTSxCR_GEN_BIT(SUSPEND); | 1029 | pts_control_value |= SCU_PTSxCR_GEN_BIT(SUSPEND); |
| 1035 | writel(pts_control_value, &port->port_task_scheduler_registers->control); | 1030 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
| 1036 | } | 1031 | } |
| 1037 | | 1032 | |
| 1038 | /** | 1033 | /** |
| @@ -1044,10 +1039,10 @@ static void scic_sds_port_suspend_port_task_scheduler(struct scic_sds_port *port · 5 unmodified lines |
| 1044 | * ongoing requests. | 1039 | * ongoing requests. |
| 1045 | * | 1040 | * |
| 1046 | */ | 1041 | */ |
| 1047 | static void scic_sds_port_post_dummy_request(struct scic_sds_port *sci_port) | 1042 | static void scic_sds_port_post_dummy_request(struct isci_port *iport) |
| 1048 | { | 1043 | { |
| 1049 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1044 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1050 | u16 tag = sci_port->reserved_tag; | 1045 | u16 tag = iport->reserved_tag; |
| 1051 | struct scu_task_context *tc; | 1046 | struct scu_task_context *tc; |
| 1052 | u32 command; | 1047 | u32 command; |
| 1053 | | 1048 | |
| @@ -1055,7 +1050,7 @@ static void scic_sds_port_post_dummy_request(struct scic_sds_port *sci_port) · 1 unmodified line |
| 1055 | tc->abort = 0; | 1050 | tc->abort = 0; |
| 1056 | | 1051 | |
| 1057 | command = SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 1052 | command = SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
| 1058 | sci_port->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | | 1053 | iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | |
| 1059 | ISCI_TAG_TCI(tag); | 1054 | ISCI_TAG_TCI(tag); |
| 1060 | | 1055 | |
| 1061 | scic_sds_controller_post_request(scic, command); | 1056 | scic_sds_controller_post_request(scic, command); |
| @@ -1068,10 +1063,10 @@ static void scic_sds_port_post_dummy_request(struct scic_sds_port *sci_port) · 6 unmodified lines |
| 1068 | * @sci_port: The port on which the task must be aborted. | 1063 | * @sci_port: The port on which the task must be aborted. |
| 1069 | * | 1064 | * |
| 1070 | */ | 1065 | */ |
| 1071 | static void scic_sds_port_abort_dummy_request(struct scic_sds_port *sci_port) | 1066 | static void scic_sds_port_abort_dummy_request(struct isci_port *iport) |
| 1072 | { | 1067 | { |
| 1073 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1068 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1074 | u16 tag = sci_port->reserved_tag; | 1069 | u16 tag = iport->reserved_tag; |
| 1075 | struct scu_task_context *tc; | 1070 | struct scu_task_context *tc; |
| 1076 | u32 command; | 1071 | u32 command; |
| 1077 | | 1072 | |
| @@ -1079,7 +1074,7 @@ static void scic_sds_port_abort_dummy_request(struct scic_sds_port *sci_port) · 1 unmodified line |
| 1079 | tc->abort = 1; | 1074 | tc->abort = 1; |
| 1080 | | 1075 | |
| 1081 | command = SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT | | 1076 | command = SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT | |
| 1082 | sci_port->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | | 1077 | iport->physical_port_index << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT | |
| 1083 | ISCI_TAG_TCI(tag); | 1078 | ISCI_TAG_TCI(tag); |
| 1084 | | 1079 | |
| 1085 | scic_sds_controller_post_request(scic, command); | 1080 | scic_sds_controller_post_request(scic, command); |
| @@ -1087,31 +1082,31 @@ static void scic_sds_port_abort_dummy_request(struct scic_sds_port *sci_port) · 1 unmodified line |
| 1087 | | 1082 | |
| 1088 | /** | 1083 | /** |
| 1089 | * | 1084 | * |
| 1090 | * @sci_port: This is the struct scic_sds_port object to resume. | 1085 | * @sci_port: This is the struct isci_port object to resume. |
| 1091 | * | 1086 | * |
| 1092 | * This method will resume the port task scheduler for this port object. none | 1087 | * This method will resume the port task scheduler for this port object. none |
| 1093 | */ | 1088 | */ |
| 1094 | static void | 1089 | static void |
| 1095 | scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port) | 1090 | scic_sds_port_resume_port_task_scheduler(struct isci_port *iport) |
| 1096 | { | 1091 | { |
| 1097 | u32 pts_control_value; | 1092 | u32 pts_control_value; |
| 1098 | | 1093 | |
| 1099 | pts_control_value = readl(&port->port_task_scheduler_registers->control); | 1094 | pts_control_value = readl(&iport->port_task_scheduler_registers->control); |
| 1100 | pts_control_value &= ~SCU_PTSxCR_GEN_BIT(SUSPEND); | 1095 | pts_control_value &= ~SCU_PTSxCR_GEN_BIT(SUSPEND); |
| 1101 | writel(pts_control_value, &port->port_task_scheduler_registers->control); | 1096 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
| 1102 | } | 1097 | } |
| 1103 | | 1098 | |
| 1104 | static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm) | 1099 | static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_machine *sm) |
| 1105 | { | 1100 | { |
| 1106 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1101 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1107 | | 1102 | |
| 1108 | scic_sds_port_suspend_port_task_scheduler(sci_port); | 1103 | scic_sds_port_suspend_port_task_scheduler(iport); |
| 1109 | | 1104 | |
| 1110 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; | 1105 | iport->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; |
| 1111 | | 1106 | |
| 1112 | if (sci_port->active_phy_mask != 0) { | 1107 | if (iport->active_phy_mask != 0) { |
| 1113 | /* At least one of the phys on the port is ready */ | 1108 | /* At least one of the phys on the port is ready */ |
| 1114 | port_state_machine_change(sci_port, | 1109 | port_state_machine_change(iport, |
| 1115 | SCI_PORT_SUB_OPERATIONAL); | 1110 | SCI_PORT_SUB_OPERATIONAL); |
| 1116 | } | 1111 | } |
| 1117 | } | 1112 | } |
| @@ -1119,38 +1114,37 @@ static void scic_sds_port_ready_substate_waiting_enter(struct sci_base_state_mac · 1 unmodified line |
| 1119 | static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) | 1114 | static void scic_sds_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) |
| 1120 | { | 1115 | { |
| 1121 | u32 index; | 1116 | u32 index; |
| 1122 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1117 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1123 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1118 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1124 | struct isci_host *ihost = scic_to_ihost(scic); | 1119 | struct isci_host *ihost = scic_to_ihost(scic); |
| 1125 | struct isci_port *iport = sci_port_to_iport(sci_port); | | |
| 1126 | | 1120 | |
| 1127 | isci_port_ready(ihost, iport); | 1121 | isci_port_ready(ihost, iport); |
| 1128 | | 1122 | |
| 1129 | for (index = 0; index < SCI_MAX_PHYS; index++) { | 1123 | for (index = 0; index < SCI_MAX_PHYS; index++) { |
| 1130 | if (sci_port->phy_table[index]) { | 1124 | if (iport->phy_table[index]) { |
| 1131 | writel(sci_port->physical_port_index, | 1125 | writel(iport->physical_port_index, |
| 1132 | &sci_port->port_pe_configuration_register[ | 1126 | &iport->port_pe_configuration_register[ |
| 1133 | sci_port->phy_table[index]->phy_index]); | 1127 | iport->phy_table[index]->phy_index]); |
| 1134 | } | 1128 | } |
| 1135 | } | 1129 | } |
| 1136 | | 1130 | |
| 1137 | scic_sds_port_update_viit_entry(sci_port); | 1131 | scic_sds_port_update_viit_entry(iport); |
| 1138 | | 1132 | |
| 1139 | scic_sds_port_resume_port_task_scheduler(sci_port); | 1133 | scic_sds_port_resume_port_task_scheduler(iport); |
| 1140 | | 1134 | |
| 1141 | /* | 1135 | /* |
| 1142 | * Post the dummy task for the port so the hardware can schedule | 1136 | * Post the dummy task for the port so the hardware can schedule |
| 1143 | * io correctly | 1137 | * io correctly |
| 1144 | */ | 1138 | */ |
| 1145 | scic_sds_port_post_dummy_request(sci_port); | 1139 | scic_sds_port_post_dummy_request(iport); |
| 1146 | } | 1140 | } |
| 1147 | | 1141 | |
| 1148 | static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci_port) | 1142 | static void scic_sds_port_invalidate_dummy_remote_node(struct isci_port *iport) |
| 1149 | { | 1143 | { |
| 1150 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1144 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1151 | u8 phys_index = sci_port->physical_port_index; | 1145 | u8 phys_index = iport->physical_port_index; |
| 1152 | union scu_remote_node_context *rnc; | 1146 | union scu_remote_node_context *rnc; |
| 1153 | u16 rni = sci_port->reserved_rni; | 1147 | u16 rni = iport->reserved_rni; |
| 1154 | u32 command; | 1148 | u32 command; |
| 1155 | | 1149 | |
| 1156 | rnc = &scic->remote_node_context_table[rni]; | 1150 | rnc = &scic->remote_node_context_table[rni]; |
| @@ -1172,73 +1166,71 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci · 15 unmodified lines |
| 1172 | | 1166 | |
| 1173 | /** | 1167 | /** |
| 1174 | * | 1168 | * |
| 1175 | * @object: This is the object which is cast to a struct scic_sds_port object. | 1169 | * @object: This is the object which is cast to a struct isci_port object. |
| 1176 | * | 1170 | * |
| 1177 | * This method will perform the actions required by the struct scic_sds_port on | 1171 | * This method will perform the actions required by the struct isci_port on |
| 1178 | * exiting the SCI_PORT_SUB_OPERATIONAL. This function reports | 1172 | * exiting the SCI_PORT_SUB_OPERATIONAL. This function reports |
| 1179 | * the port not ready and suspends the port task scheduler. none | 1173 | * the port not ready and suspends the port task scheduler. none |
| 1180 | */ | 1174 | */ |
| 1181 | static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) | 1175 | static void scic_sds_port_ready_substate_operational_exit(struct sci_base_state_machine *sm) |
| 1182 | { | 1176 | { |
| 1183 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1177 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1184 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1178 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1185 | struct isci_host *ihost = scic_to_ihost(scic); | 1179 | struct isci_host *ihost = scic_to_ihost(scic); |
| 1186 | struct isci_port *iport = sci_port_to_iport(sci_port); | | |
| 1187 | | 1180 | |
| 1188 | /* | 1181 | /* |
| 1189 | * Kill the dummy task for this port if it has not yet posted | 1182 | * Kill the dummy task for this port if it has not yet posted |
| 1190 | * the hardware will treat this as a NOP and just return abort | 1183 | * the hardware will treat this as a NOP and just return abort |
| 1191 | * complete. | 1184 | * complete. |
| 1192 | */ | 1185 | */ |
| 1193 | scic_sds_port_abort_dummy_request(sci_port); | 1186 | scic_sds_port_abort_dummy_request(iport); |
| 1194 | | 1187 | |
| 1195 | isci_port_not_ready(ihost, iport); | 1188 | isci_port_not_ready(ihost, iport); |
| 1196 | | 1189 | |
| 1197 | if (sci_port->ready_exit) | 1190 | if (iport->ready_exit) |
| 1198 | scic_sds_port_invalidate_dummy_remote_node(sci_port); | 1191 | scic_sds_port_invalidate_dummy_remote_node(iport); |
| 1199 | } | 1192 | } |
| 1200 | | 1193 | |
| 1201 | static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) | 1194 | static void scic_sds_port_ready_substate_configuring_enter(struct sci_base_state_machine *sm) |
| 1202 | { | 1195 | { |
| 1203 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1196 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1204 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1197 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1205 | struct isci_host *ihost = scic_to_ihost(scic); | 1198 | struct isci_host *ihost = scic_to_ihost(scic); |
| 1206 | struct isci_port *iport = sci_port_to_iport(sci_port); | | |
| 1207 | | 1199 | |
| 1208 | if (sci_port->active_phy_mask == 0) { | 1200 | if (iport->active_phy_mask == 0) { |
| 1209 | isci_port_not_ready(ihost, iport); | 1201 | isci_port_not_ready(ihost, iport); |
| 1210 | | 1202 | |
| 1211 | port_state_machine_change(sci_port, | 1203 | port_state_machine_change(iport, |
| 1212 | SCI_PORT_SUB_WAITING); | 1204 | SCI_PORT_SUB_WAITING); |
| 1213 | } else if (sci_port->started_request_count == 0) | 1205 | } else if (iport->started_request_count == 0) |
| 1214 | port_state_machine_change(sci_port, | 1206 | port_state_machine_change(iport, |
| 1215 | SCI_PORT_SUB_OPERATIONAL); | 1207 | SCI_PORT_SUB_OPERATIONAL); |
| 1216 | } | 1208 | } |
| 1217 | | 1209 | |
| 1218 | static void scic_sds_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) | 1210 | static void scic_sds_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) |
| 1219 | { | 1211 | { |
| 1220 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1212 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1221 | | 1213 | |
| 1222 | scic_sds_port_suspend_port_task_scheduler(sci_port); | 1214 | scic_sds_port_suspend_port_task_scheduler(iport); |
| 1223 | if (sci_port->ready_exit) | 1215 | if (iport->ready_exit) |
| 1224 | scic_sds_port_invalidate_dummy_remote_node(sci_port); | 1216 | scic_sds_port_invalidate_dummy_remote_node(iport); |
| 1225 | } | 1217 | } |
| 1226 | | 1218 | |
| 1227 | enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) | 1219 | enum sci_status scic_sds_port_start(struct isci_port *iport) |
| 1228 | { | 1220 | { |
| 1229 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1221 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1230 | enum sci_status status = SCI_SUCCESS; | 1222 | enum sci_status status = SCI_SUCCESS; |
| 1231 | enum scic_sds_port_states state; | 1223 | enum scic_sds_port_states state; |
| 1232 | u32 phy_mask; | 1224 | u32 phy_mask; |
| 1233 | | 1225 | |
| 1234 | state = sci_port->sm.current_state_id; | 1226 | state = iport->sm.current_state_id; |
| 1235 | if (state != SCI_PORT_STOPPED) { | 1227 | if (state != SCI_PORT_STOPPED) { |
| 1236 | dev_warn(sciport_to_dev(sci_port), | 1228 | dev_warn(sciport_to_dev(iport), |
| 1237 | "%s: in wrong state: %d\n", __func__, state); | 1229 | "%s: in wrong state: %d\n", __func__, state); |
| 1238 | return SCI_FAILURE_INVALID_STATE; | 1230 | return SCI_FAILURE_INVALID_STATE; |
| 1239 | } | 1231 | } |
| 1240 | | 1232 | |
| 1241 | if (sci_port->assigned_device_count > 0) { | 1233 | if (iport->assigned_device_count > 0) { |
| 1242 | /* TODO This is a start failure operation because | 1234 | /* TODO This is a start failure operation because |
| 1243 | * there are still devices assigned to this port. | 1235 | * there are still devices assigned to this port. |
| 1244 | * There must be no devices assigned to a port on a | 1236 | * There must be no devices assigned to a port on a |
| @@ -1247,18 +1239,18 @@ enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) · 2 unmodified lines |
| 1247 | return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; | 1239 | return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; |
| 1248 | } | 1240 | } |
| 1249 | | 1241 | |
| 1250 | if (sci_port->reserved_rni == SCU_DUMMY_INDEX) { | 1242 | if (iport->reserved_rni == SCU_DUMMY_INDEX) { |
| 1251 | u16 rni = scic_sds_remote_node_table_allocate_remote_node( | 1243 | u16 rni = scic_sds_remote_node_table_allocate_remote_node( |
| 1252 | &scic->available_remote_nodes, 1); | 1244 | &scic->available_remote_nodes, 1); |
| 1253 | | 1245 | |
| 1254 | if (rni != SCU_DUMMY_INDEX) | 1246 | if (rni != SCU_DUMMY_INDEX) |
| 1255 | scic_sds_port_construct_dummy_rnc(sci_port, rni); | 1247 | scic_sds_port_construct_dummy_rnc(iport, rni); |
| 1256 | else | 1248 | else |
| 1257 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; | 1249 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; |
| 1258 | sci_port->reserved_rni = rni; | 1250 | iport->reserved_rni = rni; |
| 1259 | } | 1251 | } |
| 1260 | | 1252 | |
| 1261 | if (sci_port->reserved_tag == SCI_CONTROLLER_INVALID_IO_TAG) { | 1253 | if (iport->reserved_tag == SCI_CONTROLLER_INVALID_IO_TAG) { |
| 1262 | struct isci_host *ihost = scic_to_ihost(scic); | 1254 | struct isci_host *ihost = scic_to_ihost(scic); |
| 1263 | u16 tag; | 1255 | u16 tag; |
| 1264 | | 1256 | |
| @@ -1266,20 +1258,20 @@ enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) · 1 unmodified line |
| 1266 | if (tag == SCI_CONTROLLER_INVALID_IO_TAG) | 1258 | if (tag == SCI_CONTROLLER_INVALID_IO_TAG) |
| 1267 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; | 1259 | status = SCI_FAILURE_INSUFFICIENT_RESOURCES; |
| 1268 | else | 1260 | else |
| 1269 | scic_sds_port_construct_dummy_task(sci_port, tag); | 1261 | scic_sds_port_construct_dummy_task(iport, tag); |
| 1270 | sci_port->reserved_tag = tag; | 1262 | iport->reserved_tag = tag; |
| 1271 | } | 1263 | } |
| 1272 | | 1264 | |
| 1273 | if (status == SCI_SUCCESS) { | 1265 | if (status == SCI_SUCCESS) { |
| 1274 | phy_mask = scic_sds_port_get_phys(sci_port); | 1266 | phy_mask = scic_sds_port_get_phys(iport); |
| 1275 | | 1267 | |
| 1276 | /* | 1268 | /* |
| 1277 | * There are one or more phys assigned to this port. Make sure | 1269 | * There are one or more phys assigned to this port. Make sure |
| 1278 | * the port's phy mask is in fact legal and supported by the | 1270 | * the port's phy mask is in fact legal and supported by the |
| 1279 | * silicon. | 1271 | * silicon. |
| 1280 | */ | 1272 | */ |
| 1281 | if (scic_sds_port_is_phy_mask_valid(sci_port, phy_mask) == true) { | 1273 | if (scic_sds_port_is_phy_mask_valid(iport, phy_mask) == true) { |
| 1282 | port_state_machine_change(sci_port, | 1274 | port_state_machine_change(iport, |
| 1283 | SCI_PORT_READY); | 1275 | SCI_PORT_READY); |
| 1284 | | 1276 | |
| 1285 | return SCI_SUCCESS; | 1277 | return SCI_SUCCESS; |
| @@ -1288,16 +1280,16 @@ enum sci_status scic_sds_port_start(struct scic_sds_port *sci_port) · 2 unmodified lines |
| 1288 | } | 1280 | } |
| 1289 | | 1281 | |
| 1290 | if (status != SCI_SUCCESS) | 1282 | if (status != SCI_SUCCESS) |
| 1291 | scic_sds_port_destroy_dummy_resources(sci_port); | 1283 | scic_sds_port_destroy_dummy_resources(iport); |
| 1292 | | 1284 | |
| 1293 | return status; | 1285 | return status; |
| 1294 | } | 1286 | } |
| 1295 | | 1287 | |
| 1296 | enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port) | 1288 | enum sci_status scic_sds_port_stop(struct isci_port *iport) |
| 1297 | { | 1289 | { |
| 1298 | enum scic_sds_port_states state; | 1290 | enum scic_sds_port_states state; |
| 1299 | | 1291 | |
| 1300 | state = sci_port->sm.current_state_id; | 1292 | state = iport->sm.current_state_id; |
| 1301 | switch (state) { | 1293 | switch (state) { |
| 1302 | case SCI_PORT_STOPPED: | 1294 | case SCI_PORT_STOPPED: |
| 1303 | return SCI_SUCCESS; | 1295 | return SCI_SUCCESS; |
| @@ -1305,34 +1297,34 @@ enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port) · 1 unmodified line |
| 1305 | case SCI_PORT_SUB_OPERATIONAL: | 1297 | case SCI_PORT_SUB_OPERATIONAL: |
| 1306 | case SCI_PORT_SUB_CONFIGURING: | 1298 | case SCI_PORT_SUB_CONFIGURING: |
| 1307 | case SCI_PORT_RESETTING: | 1299 | case SCI_PORT_RESETTING: |
| 1308 | port_state_machine_change(sci_port, | 1300 | port_state_machine_change(iport, |
| 1309 | SCI_PORT_STOPPING); | 1301 | SCI_PORT_STOPPING); |
| 1310 | return SCI_SUCCESS; | 1302 | return SCI_SUCCESS; |
| 1311 | default: | 1303 | default: |
| 1312 | dev_warn(sciport_to_dev(sci_port), | 1304 | dev_warn(sciport_to_dev(iport), |
| 1313 | "%s: in wrong state: %d\n", __func__, state); | 1305 | "%s: in wrong state: %d\n", __func__, state); |
| 1314 | return SCI_FAILURE_INVALID_STATE; | 1306 | return SCI_FAILURE_INVALID_STATE; |
| 1315 | } | 1307 | } |
| 1316 | } | 1308 | } |
| 1317 | | 1309 | |
| 1318 | static enum sci_status scic_port_hard_reset(struct scic_sds_port *sci_port, u32 timeout) | 1310 | static enum sci_status scic_port_hard_reset(struct isci_port *iport, u32 timeout) |
| 1319 | { | 1311 | { |
| 1320 | enum sci_status status = SCI_FAILURE_INVALID_PHY; | 1312 | enum sci_status status = SCI_FAILURE_INVALID_PHY; |
| 1321 | struct isci_phy *iphy = NULL; | 1313 | struct isci_phy *iphy = NULL; |
| 1322 | enum scic_sds_port_states state; | 1314 | enum scic_sds_port_states state; |
| 1323 | u32 phy_index; | 1315 | u32 phy_index; |
| 1324 | | 1316 | |
| 1325 | state = sci_port->sm.current_state_id; | 1317 | state = iport->sm.current_state_id; |
| 1326 | if (state != SCI_PORT_SUB_OPERATIONAL) { | 1318 | if (state != SCI_PORT_SUB_OPERATIONAL) { |
| 1327 | dev_warn(sciport_to_dev(sci_port), | 1319 | dev_warn(sciport_to_dev(iport), |
| 1328 | "%s: in wrong state: %d\n", __func__, state); | 1320 | "%s: in wrong state: %d\n", __func__, state); |
| 1329 | return SCI_FAILURE_INVALID_STATE; | 1321 | return SCI_FAILURE_INVALID_STATE; |
| 1330 | } | 1322 | } |
| 1331 | | 1323 | |
| 1332 | /* Select a phy on which we can send the hard reset request. */ | 1324 | /* Select a phy on which we can send the hard reset request. */ |
| 1333 | for (phy_index = 0; phy_index < SCI_MAX_PHYS && !iphy; phy_index++) { | 1325 | for (phy_index = 0; phy_index < SCI_MAX_PHYS && !iphy; phy_index++) { |
| 1334 | iphy = sci_port->phy_table[phy_index]; | 1326 | iphy = iport->phy_table[phy_index]; |
| 1335 | if (iphy && !scic_sds_port_active_phy(sci_port, iphy)) { | 1327 | if (iphy && !scic_sds_port_active_phy(iport, iphy)) { |
| 1336 | /* | 1328 | /* |
| 1337 | * We found a phy but it is not ready select | 1329 | * We found a phy but it is not ready select |
| 1338 | * different phy | 1330 | * different phy |
| @@ -1349,10 +1341,10 @@ static enum sci_status scic_port_hard_reset(struct scic_sds_port *sci_port, u32 · 10 unmodified lines |
| 1349 | if (status != SCI_SUCCESS) | 1341 | if (status != SCI_SUCCESS) |
| 1350 | return status; | 1342 | return status; |
| 1351 | | 1343 | |
| 1352 | sci_mod_timer(&sci_port->timer, timeout); | 1344 | sci_mod_timer(&iport->timer, timeout); |
| 1353 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; | 1345 | iport->not_ready_reason = SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED; |
| 1354 | | 1346 | |
| 1355 | port_state_machine_change(sci_port, SCI_PORT_RESETTING); | 1347 | port_state_machine_change(iport, SCI_PORT_RESETTING); |
| 1356 | return SCI_SUCCESS; | 1348 | return SCI_SUCCESS; |
| 1357 | } | 1349 | } |
| 1358 | | 1350 | |
| @@ -1365,19 +1357,19 @@ static enum sci_status scic_port_hard_reset(struct scic_sds_port *sci_port, u32 · 6 unmodified lines |
| 1365 | * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other | 1357 | * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other |
| 1366 | * status is a failure to add the phy to the port. | 1358 | * status is a failure to add the phy to the port. |
| 1367 | */ | 1359 | */ |
| 1368 | enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, | 1360 | enum sci_status scic_sds_port_add_phy(struct isci_port *iport, |
| 1369 | struct isci_phy *iphy) | 1361 | struct isci_phy *iphy) |
| 1370 | { | 1362 | { |
| 1371 | enum sci_status status; | 1363 | enum sci_status status; |
| 1372 | enum scic_sds_port_states state; | 1364 | enum scic_sds_port_states state; |
| 1373 | | 1365 | |
| 1374 | state = sci_port->sm.current_state_id; | 1366 | state = iport->sm.current_state_id; |
| 1375 | switch (state) { | 1367 | switch (state) { |
| 1376 | case SCI_PORT_STOPPED: { | 1368 | case SCI_PORT_STOPPED: { |
| 1377 | struct sci_sas_address port_sas_address; | 1369 | struct sci_sas_address port_sas_address; |
| 1378 | | 1370 | |
| 1379 | /* Read the port assigned SAS Address if there is one */ | 1371 | /* Read the port assigned SAS Address if there is one */ |
| 1380 | scic_sds_port_get_sas_address(sci_port, &port_sas_address); | 1372 | scic_sds_port_get_sas_address(iport, &port_sas_address); |
| 1381 | | 1373 | |
| 1382 | if (port_sas_address.high != 0 && port_sas_address.low != 0) { | 1374 | if (port_sas_address.high != 0 && port_sas_address.low != 0) { |
| 1383 | struct sci_sas_address phy_sas_address; | 1375 | struct sci_sas_address phy_sas_address; |
| @@ -1391,35 +1383,35 @@ enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, · 7 unmodified lines |
| 1391 | port_sas_address.low != phy_sas_address.low) | 1383 | port_sas_address.low != phy_sas_address.low) |
| 1392 | return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; | 1384 | return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; |
| 1393 | } | 1385 | } |
| 1394 | return scic_sds_port_set_phy(sci_port, iphy); | 1386 | return scic_sds_port_set_phy(iport, iphy); |
| 1395 | } | 1387 | } |
| 1396 | case SCI_PORT_SUB_WAITING: | 1388 | case SCI_PORT_SUB_WAITING: |
| 1397 | case SCI_PORT_SUB_OPERATIONAL: | 1389 | case SCI_PORT_SUB_OPERATIONAL: |
| 1398 | status = scic_sds_port_set_phy(sci_port, iphy); | 1390 | status = scic_sds_port_set_phy(iport, iphy); |
| 1399 | | 1391 | |
| 1400 | if (status != SCI_SUCCESS) | 1392 | if (status != SCI_SUCCESS) |
| 1401 | return status; | 1393 | return status; |
| 1402 | | 1394 | |
| 1403 | scic_sds_port_general_link_up_handler(sci_port, iphy, true); | 1395 | scic_sds_port_general_link_up_handler(iport, iphy, true); |
| 1404 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; | 1396 | iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; |
| 1405 | port_state_machine_change(sci_port, SCI_PORT_SUB_CONFIGURING); | 1397 | port_state_machine_change(iport, SCI_PORT_SUB_CONFIGURING); |
| 1406 | | 1398 | |
| 1407 | return status; | 1399 | return status; |
| 1408 | case SCI_PORT_SUB_CONFIGURING: | 1400 | case SCI_PORT_SUB_CONFIGURING: |
| 1409 | status = scic_sds_port_set_phy(sci_port, iphy); | 1401 | status = scic_sds_port_set_phy(iport, iphy); |
| 1410 | | 1402 | |
| 1411 | if (status != SCI_SUCCESS) | 1403 | if (status != SCI_SUCCESS) |
| 1412 | return status; | 1404 | return status; |
| 1413 | scic_sds_port_general_link_up_handler(sci_port, iphy, true); | 1405 | scic_sds_port_general_link_up_handler(iport, iphy, true); |
| 1414 | | 1406 | |
| 1415 | /* Re-enter the configuring state since this may be the last phy in | 1407 | /* Re-enter the configuring state since this may be the last phy in |
| 1416 | * the port. | 1408 | * the port. |
| 1417 | */ | 1409 | */ |
| 1418 | port_state_machine_change(sci_port, | 1410 | port_state_machine_change(iport, |
| 1419 | SCI_PORT_SUB_CONFIGURING); | 1411 | SCI_PORT_SUB_CONFIGURING); |
| 1420 | return SCI_SUCCESS; | 1412 | return SCI_SUCCESS; |
| 1421 | default: | 1413 | default: |
| 1422 | dev_warn(sciport_to_dev(sci_port), | 1414 | dev_warn(sciport_to_dev(iport), |
| 1423 | "%s: in wrong state: %d\n", __func__, state); | 1415 | "%s: in wrong state: %d\n", __func__, state); |
| 1424 | return SCI_FAILURE_INVALID_STATE; | 1416 | return SCI_FAILURE_INVALID_STATE; |
| 1425 | } | 1417 | } |
| @@ -1434,65 +1426,65 @@ enum sci_status scic_sds_port_add_phy(struct scic_sds_port *sci_port, · 8 unmodified lines |
| 1434 | * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any | 1426 | * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any |
| 1435 | * other status is a failure to add the phy to the port. | 1427 | * other status is a failure to add the phy to the port. |
| 1436 | */ | 1428 | */ |
| 1437 | enum sci_status scic_sds_port_remove_phy(struct scic_sds_port *sci_port, | 1429 | enum sci_status scic_sds_port_remove_phy(struct isci_port *iport, |
| 1438 | struct isci_phy *iphy) | 1430 | struct isci_phy *iphy) |
| 1439 | { | 1431 | { |
| 1440 | enum sci_status status; | 1432 | enum sci_status status; |
| 1441 | enum scic_sds_port_states state; | 1433 | enum scic_sds_port_states state; |
| 1442 | | 1434 | |
| 1443 | state = sci_port->sm.current_state_id; | 1435 | state = iport->sm.current_state_id; |
| 1444 | | 1436 | |
| 1445 | switch (state) { | 1437 | switch (state) { |
| 1446 | case SCI_PORT_STOPPED: | 1438 | case SCI_PORT_STOPPED: |
| 1447 | return scic_sds_port_clear_phy(sci_port, iphy); | 1439 | return scic_sds_port_clear_phy(iport, iphy); |
| 1448 | case SCI_PORT_SUB_OPERATIONAL: | 1440 | case SCI_PORT_SUB_OPERATIONAL: |
| 1449 | status = scic_sds_port_clear_phy(sci_port, iphy); | 1441 | status = scic_sds_port_clear_phy(iport, iphy); |
| 1450 | if (status != SCI_SUCCESS) | 1442 | if (status != SCI_SUCCESS) |
| 1451 | return status; | 1443 | return status; |
| 1452 | | 1444 | |
| 1453 | scic_sds_port_deactivate_phy(sci_port, iphy, true); | 1445 | scic_sds_port_deactivate_phy(iport, iphy, true); |
| 1454 | sci_port->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; | 1446 | iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; |
| 1455 | port_state_machine_change(sci_port, | 1447 | port_state_machine_change(iport, |
| 1456 | SCI_PORT_SUB_CONFIGURING); | 1448 | SCI_PORT_SUB_CONFIGURING); |
| 1457 | return SCI_SUCCESS; | 1449 | return SCI_SUCCESS; |
| 1458 | case SCI_PORT_SUB_CONFIGURING: | 1450 | case SCI_PORT_SUB_CONFIGURING: |
| 1459 | status = scic_sds_port_clear_phy(sci_port, iphy); | 1451 | status = scic_sds_port_clear_phy(iport, iphy); |
| 1460 | | 1452 | |
| 1461 | if (status != SCI_SUCCESS) | 1453 | if (status != SCI_SUCCESS) |
| 1462 | return status; | 1454 | return status; |
| 1463 | scic_sds_port_deactivate_phy(sci_port, iphy, true); | 1455 | scic_sds_port_deactivate_phy(iport, iphy, true); |
| 1464 | | 1456 | |
| 1465 | /* Re-enter the configuring state since this may be the last phy in | 1457 | /* Re-enter the configuring state since this may be the last phy in |
| 1466 | * the port | 1458 | * the port |
| 1467 | */ | 1459 | */ |
| 1468 | port_state_machine_change(sci_port, | 1460 | port_state_machine_change(iport, |
| 1469 | SCI_PORT_SUB_CONFIGURING); | 1461 | SCI_PORT_SUB_CONFIGURING); |
| 1470 | return SCI_SUCCESS; | 1462 | return SCI_SUCCESS; |
| 1471 | default: | 1463 | default: |
| 1472 | dev_warn(sciport_to_dev(sci_port), | 1464 | dev_warn(sciport_to_dev(iport), |
| 1473 | "%s: in wrong state: %d\n", __func__, state); | 1465 | "%s: in wrong state: %d\n", __func__, state); |
| 1474 | return SCI_FAILURE_INVALID_STATE; | 1466 | return SCI_FAILURE_INVALID_STATE; |
| 1475 | } | 1467 | } |
| 1476 | } | 1468 | } |
| 1477 | | 1469 | |
| 1478 | enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port, | 1470 | enum sci_status scic_sds_port_link_up(struct isci_port *iport, |
| 1479 | struct isci_phy *iphy) | 1471 | struct isci_phy *iphy) |
| 1480 | { | 1472 | { |
| 1481 | enum scic_sds_port_states state; | 1473 | enum scic_sds_port_states state; |
| 1482 | | 1474 | |
| 1483 | state = sci_port->sm.current_state_id; | 1475 | state = iport->sm.current_state_id; |
| 1484 | switch (state) { | 1476 | switch (state) { |
| 1485 | case SCI_PORT_SUB_WAITING: | 1477 | case SCI_PORT_SUB_WAITING: |
| 1486 | /* Since this is the first phy going link up for the port we | 1478 | /* Since this is the first phy going link up for the port we |
| 1487 | * can just enable it and continue | 1479 | * can just enable it and continue |
| 1488 | */ | 1480 | */ |
| 1489 | scic_sds_port_activate_phy(sci_port, iphy, true); | 1481 | scic_sds_port_activate_phy(iport, iphy, true); |
| 1490 | | 1482 | |
| 1491 | port_state_machine_change(sci_port, | 1483 | port_state_machine_change(iport, |
| 1492 | SCI_PORT_SUB_OPERATIONAL); | 1484 | SCI_PORT_SUB_OPERATIONAL); |
| 1493 | return SCI_SUCCESS; | 1485 | return SCI_SUCCESS; |
| 1494 | case SCI_PORT_SUB_OPERATIONAL: | 1486 | case SCI_PORT_SUB_OPERATIONAL: |
| 1495 | scic_sds_port_general_link_up_handler(sci_port, iphy, true); | 1487 | scic_sds_port_general_link_up_handler(iport, iphy, true); |
| 1496 | return SCI_SUCCESS; | 1488 | return SCI_SUCCESS; |
| 1497 | case SCI_PORT_RESETTING: | 1489 | case SCI_PORT_RESETTING: |
| 1498 | /* TODO We should make sure that the phy that has gone | 1490 | /* TODO We should make sure that the phy that has gone |
| @@ -1509,82 +1501,82 @@ enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port, · 10 unmodified lines |
| 1509 | /* In the resetting state we don't notify the user regarding | 1501 | /* In the resetting state we don't notify the user regarding |
| 1510 | * link up and link down notifications. | 1502 | * link up and link down notifications. |
| 1511 | */ | 1503 | */ |
| 1512 | scic_sds_port_general_link_up_handler(sci_port, iphy, false); | 1504 | scic_sds_port_general_link_up_handler(iport, iphy, false); |
| 1513 | return SCI_SUCCESS; | 1505 | return SCI_SUCCESS; |
| 1514 | default: | 1506 | default: |
| 1515 | dev_warn(sciport_to_dev(sci_port), | 1507 | dev_warn(sciport_to_dev(iport), |
| 1516 | "%s: in wrong state: %d\n", __func__, state); | 1508 | "%s: in wrong state: %d\n", __func__, state); |
| 1517 | return SCI_FAILURE_INVALID_STATE; | 1509 | return SCI_FAILURE_INVALID_STATE; |
| 1518 | } | 1510 | } |
| 1519 | } | 1511 | } |
| 1520 | | 1512 | |
| 1521 | enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port, | 1513 | enum sci_status scic_sds_port_link_down(struct isci_port *iport, |
| 1522 | struct isci_phy *iphy) | 1514 | struct isci_phy *iphy) |
| 1523 | { | 1515 | { |
| 1524 | enum scic_sds_port_states state; | 1516 | enum scic_sds_port_states state; |
| 1525 | | 1517 | |
| 1526 | state = sci_port->sm.current_state_id; | 1518 | state = iport->sm.current_state_id; |
| 1527 | switch (state) { | 1519 | switch (state) { |
| 1528 | case SCI_PORT_SUB_OPERATIONAL: | 1520 | case SCI_PORT_SUB_OPERATIONAL: |
| 1529 | scic_sds_port_deactivate_phy(sci_port, iphy, true); | 1521 | scic_sds_port_deactivate_phy(iport, iphy, true); |
| 1530 | | 1522 | |
| 1531 | /* If there are no active phys left in the port, then | 1523 | /* If there are no active phys left in the port, then |
| 1532 | * transition the port to the WAITING state until such time | 1524 | * transition the port to the WAITING state until such time |
| 1533 | * as a phy goes link up | 1525 | * as a phy goes link up |
| 1534 | */ | 1526 | */ |
| 1535 | if (sci_port->active_phy_mask == 0) | 1527 | if (iport->active_phy_mask == 0) |
| 1536 | port_state_machine_change(sci_port, | 1528 | port_state_machine_change(iport, |
| 1537 | SCI_PORT_SUB_WAITING); | 1529 | SCI_PORT_SUB_WAITING); |
| 1538 | return SCI_SUCCESS; | 1530 | return SCI_SUCCESS; |
| 1539 | case SCI_PORT_RESETTING: | 1531 | case SCI_PORT_RESETTING: |
| 1540 | /* In the resetting state we don't notify the user regarding | 1532 | /* In the resetting state we don't notify the user regarding |
| 1541 | * link up and link down notifications. */ | 1533 | * link up and link down notifications. */ |
| 1542 | scic_sds_port_deactivate_phy(sci_port, iphy, false); | 1534 | scic_sds_port_deactivate_phy(iport, iphy, false); |
| 1543 | return SCI_SUCCESS; | 1535 | return SCI_SUCCESS; |
| 1544 | default: | 1536 | default: |
| 1545 | dev_warn(sciport_to_dev(sci_port), | 1537 | dev_warn(sciport_to_dev(iport), |
| 1546 | "%s: in wrong state: %d\n", __func__, state); | 1538 | "%s: in wrong state: %d\n", __func__, state); |
| 1547 | return SCI_FAILURE_INVALID_STATE; | 1539 | return SCI_FAILURE_INVALID_STATE; |
| 1548 | } | 1540 | } |
| 1549 | } | 1541 | } |
| 1550 | | 1542 | |
| 1551 | enum sci_status scic_sds_port_start_io(struct scic_sds_port *sci_port, | 1543 | enum sci_status scic_sds_port_start_io(struct isci_port *iport, |
| 1552 | struct scic_sds_remote_device *sci_dev, | 1544 | struct scic_sds_remote_device *sci_dev, |
| 1553 | struct isci_request *ireq) | 1545 | struct isci_request *ireq) |
| 1554 | { | 1546 | { |
| 1555 | enum scic_sds_port_states state; | 1547 | enum scic_sds_port_states state; |
| 1556 | | 1548 | |
| 1557 | state = sci_port->sm.current_state_id; | 1549 | state = iport->sm.current_state_id; |
| 1558 | switch (state) { | 1550 | switch (state) { |
| 1559 | case SCI_PORT_SUB_WAITING: | 1551 | case SCI_PORT_SUB_WAITING: |
| 1560 | return SCI_FAILURE_INVALID_STATE; | 1552 | return SCI_FAILURE_INVALID_STATE; |
| 1561 | case SCI_PORT_SUB_OPERATIONAL: | 1553 | case SCI_PORT_SUB_OPERATIONAL: |
| 1562 | sci_port->started_request_count++; | 1554 | iport->started_request_count++; |
| 1563 | return SCI_SUCCESS; | 1555 | return SCI_SUCCESS; |
| 1564 | default: | 1556 | default: |
| 1565 | dev_warn(sciport_to_dev(sci_port), | 1557 | dev_warn(sciport_to_dev(iport), |
| 1566 | "%s: in wrong state: %d\n", __func__, state); | 1558 | "%s: in wrong state: %d\n", __func__, state); |
| 1567 | return SCI_FAILURE_INVALID_STATE; | 1559 | return SCI_FAILURE_INVALID_STATE; |
| 1568 | } | 1560 | } |
| 1569 | } | 1561 | } |
| 1570 | | 1562 | |
| 1571 | enum sci_status scic_sds_port_complete_io(struct scic_sds_port *sci_port, | 1563 | enum sci_status scic_sds_port_complete_io(struct isci_port *iport, |
| 1572 | struct scic_sds_remote_device *sci_dev, | 1564 | struct scic_sds_remote_device *sci_dev, |
| 1573 | struct isci_request *ireq) | 1565 | struct isci_request *ireq) |
| 1574 | { | 1566 | { |
| 1575 | enum scic_sds_port_states state; | 1567 | enum scic_sds_port_states state; |
| 1576 | | 1568 | |
| 1577 | state = sci_port->sm.current_state_id; | 1569 | state = iport->sm.current_state_id; |
| 1578 | switch (state) { | 1570 | switch (state) { |
| 1579 | case SCI_PORT_STOPPED: | 1571 | case SCI_PORT_STOPPED: |
| 1580 | dev_warn(sciport_to_dev(sci_port), | 1572 | dev_warn(sciport_to_dev(iport), |
| 1581 | "%s: in wrong state: %d\n", __func__, state); | 1573 | "%s: in wrong state: %d\n", __func__, state); |
| 1582 | return SCI_FAILURE_INVALID_STATE; | 1574 | return SCI_FAILURE_INVALID_STATE; |
| 1583 | case SCI_PORT_STOPPING: | 1575 | case SCI_PORT_STOPPING: |
| 1584 | scic_sds_port_decrement_request_count(sci_port); | 1576 | scic_sds_port_decrement_request_count(iport); |
| 1585 | | 1577 | |
| 1586 | if (sci_port->started_request_count == 0) | 1578 | if (iport->started_request_count == 0) |
| 1587 | port_state_machine_change(sci_port, | 1579 | port_state_machine_change(iport, |
| 1588 | SCI_PORT_STOPPED); | 1580 | SCI_PORT_STOPPED); |
| 1589 | break; | 1581 | break; |
| 1590 | case SCI_PORT_READY: | 1582 | case SCI_PORT_READY: |
| @@ -1592,12 +1584,12 @@ enum sci_status scic_sds_port_complete_io(struct scic_sds_port *sci_port, · 1 unmodified line |
| 1592 | case SCI_PORT_FAILED: | 1584 | case SCI_PORT_FAILED: |
| 1593 | case SCI_PORT_SUB_WAITING: | 1585 | case SCI_PORT_SUB_WAITING: |
| 1594 | case SCI_PORT_SUB_OPERATIONAL: | 1586 | case SCI_PORT_SUB_OPERATIONAL: |
| 1595 | scic_sds_port_decrement_request_count(sci_port); | 1587 | scic_sds_port_decrement_request_count(iport); |
| 1596 | break; | 1588 | break; |
| 1597 | case SCI_PORT_SUB_CONFIGURING: | 1589 | case SCI_PORT_SUB_CONFIGURING: |
| 1598 | scic_sds_port_decrement_request_count(sci_port); | 1590 | scic_sds_port_decrement_request_count(iport); |
| 1599 | if (sci_port->started_request_count == 0) { | 1591 | if (iport->started_request_count == 0) { |
| 1600 | port_state_machine_change(sci_port, | 1592 | port_state_machine_change(iport, |
| 1601 | SCI_PORT_SUB_OPERATIONAL); | 1593 | SCI_PORT_SUB_OPERATIONAL); |
| 1602 | } | 1594 | } |
| 1603 | break; | 1595 | break; |
| @@ -1613,13 +1605,13 @@ enum sci_status scic_sds_port_complete_io(struct scic_sds_port *sci_port, · 9 unmodified lines |
| 1613 | * will leave the port task scheduler in a suspended state. none | 1605 | * will leave the port task scheduler in a suspended state. none |
| 1614 | */ | 1606 | */ |
| 1615 | static void | 1607 | static void |
| 1616 | scic_sds_port_enable_port_task_scheduler(struct scic_sds_port *port) | 1608 | scic_sds_port_enable_port_task_scheduler(struct isci_port *iport) |
| 1617 | { | 1609 | { |
| 1618 | u32 pts_control_value; | 1610 | u32 pts_control_value; |
| 1619 | | 1611 | |
| 1620 | pts_control_value = readl(&port->port_task_scheduler_registers->control); | 1612 | pts_control_value = readl(&iport->port_task_scheduler_registers->control); |
| 1621 | pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND); | 1613 | pts_control_value |= SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND); |
| 1622 | writel(pts_control_value, &port->port_task_scheduler_registers->control); | 1614 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
| 1623 | } | 1615 | } |
| 1624 | | 1616 | |
| 1625 | /** | 1617 | /** |
| @@ -1630,22 +1622,22 @@ scic_sds_port_enable_port_task_scheduler(struct scic_sds_port *port) · 4 unmodified lines |
| 1630 | * none | 1622 | * none |
| 1631 | */ | 1623 | */ |
| 1632 | static void | 1624 | static void |
| 1633 | scic_sds_port_disable_port_task_scheduler(struct scic_sds_port *port) | 1625 | scic_sds_port_disable_port_task_scheduler(struct isci_port *iport) |
| 1634 | { | 1626 | { |
| 1635 | u32 pts_control_value; | 1627 | u32 pts_control_value; |
| 1636 | | 1628 | |
| 1637 | pts_control_value = readl(&port->port_task_scheduler_registers->control); | 1629 | pts_control_value = readl(&iport->port_task_scheduler_registers->control); |
| 1638 | pts_control_value &= | 1630 | pts_control_value &= |
| 1639 | ~(SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND)); | 1631 | ~(SCU_PTSxCR_GEN_BIT(ENABLE) | SCU_PTSxCR_GEN_BIT(SUSPEND)); |
| 1640 | writel(pts_control_value, &port->port_task_scheduler_registers->control); | 1632 | writel(pts_control_value, &iport->port_task_scheduler_registers->control); |
| 1641 | } | 1633 | } |
| 1642 | | 1634 | |
| 1643 | static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port) | 1635 | static void scic_sds_port_post_dummy_remote_node(struct isci_port *iport) |
| 1644 | { | 1636 | { |
| 1645 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1637 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1646 | u8 phys_index = sci_port->physical_port_index; | 1638 | u8 phys_index = iport->physical_port_index; |
| 1647 | union scu_remote_node_context *rnc; | 1639 | union scu_remote_node_context *rnc; |
| 1648 | u16 rni = sci_port->reserved_rni; | 1640 | u16 rni = iport->reserved_rni; |
| 1649 | u32 command; | 1641 | u32 command; |
| 1650 | | 1642 | |
| 1651 | rnc = &scic->remote_node_context_table[rni]; | 1643 | rnc = &scic->remote_node_context_table[rni]; |
| @@ -1670,67 +1662,65 @@ static void scic_sds_port_post_dummy_remote_node(struct scic_sds_port *sci_port) · 18 unmodified lines |
| 1670 | | 1662 | |
| 1671 | static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) | 1663 | static void scic_sds_port_stopped_state_enter(struct sci_base_state_machine *sm) |
| 1672 | { | 1664 | { |
| 1673 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1665 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1674 | | 1666 | |
| 1675 | if (sci_port->sm.previous_state_id == SCI_PORT_STOPPING) { | 1667 | if (iport->sm.previous_state_id == SCI_PORT_STOPPING) { |
| 1676 | /* | 1668 | /* |
| 1677 | * If we enter this state becasuse of a request to stop | 1669 | * If we enter this state becasuse of a request to stop |
| 1678 | * the port then we want to disable the hardwares port | 1670 | * the port then we want to disable the hardwares port |
| 1679 | * task scheduler. */ | 1671 | * task scheduler. */ |
| 1680 | scic_sds_port_disable_port_task_scheduler(sci_port); | 1672 | scic_sds_port_disable_port_task_scheduler(iport); |
| 1681 | } | 1673 | } |
| 1682 | } | 1674 | } |
| 1683 | | 1675 | |
| 1684 | static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm) | 1676 | static void scic_sds_port_stopped_state_exit(struct sci_base_state_machine *sm) |
| 1685 | { | 1677 | { |
| 1686 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1678 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1687 | | 1679 | |
| 1688 | /* Enable and suspend the port task scheduler */ | 1680 | /* Enable and suspend the port task scheduler */ |
| 1689 | scic_sds_port_enable_port_task_scheduler(sci_port); | 1681 | scic_sds_port_enable_port_task_scheduler(iport); |
| 1690 | } | 1682 | } |
| 1691 | | 1683 | |
| 1692 | static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) | 1684 | static void scic_sds_port_ready_state_enter(struct sci_base_state_machine *sm) |
| 1693 | { | 1685 | { |
| 1694 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1686 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1695 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1687 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1696 | struct isci_host *ihost = scic_to_ihost(scic); | 1688 | struct isci_host *ihost = scic_to_ihost(scic); |
| 1697 | struct isci_port *iport = sci_port_to_iport(sci_port); | | |
| 1698 | u32 prev_state; | 1689 | u32 prev_state; |
| 1699 | | 1690 | |
| 1700 | prev_state = sci_port->sm.previous_state_id; | 1691 | prev_state = iport->sm.previous_state_id; |
| 1701 | if (prev_state == SCI_PORT_RESETTING) | 1692 | if (prev_state == SCI_PORT_RESETTING) |
| 1702 | isci_port_hard_reset_complete(iport, SCI_SUCCESS); | 1693 | isci_port_hard_reset_complete(iport, SCI_SUCCESS); |
| 1703 | else | 1694 | else |
| 1704 | isci_port_not_ready(ihost, iport); | 1695 | isci_port_not_ready(ihost, iport); |
| 1705 | | 1696 | |
| 1706 | /* Post and suspend the dummy remote node context for this port. */ | 1697 | /* Post and suspend the dummy remote node context for this port. */ |
| 1707 | scic_sds_port_post_dummy_remote_node(sci_port); | 1698 | scic_sds_port_post_dummy_remote_node(iport); |
| 1708 | | 1699 | |
| 1709 | /* Start the ready substate machine */ | 1700 | /* Start the ready substate machine */ |
| 1710 | port_state_machine_change(sci_port, | 1701 | port_state_machine_change(iport, |
| 1711 | SCI_PORT_SUB_WAITING); | 1702 | SCI_PORT_SUB_WAITING); |
| 1712 | } | 1703 | } |
| 1713 | | 1704 | |
| 1714 | static void scic_sds_port_resetting_state_exit(struct sci_base_state_machine *sm) | 1705 | static void scic_sds_port_resetting_state_exit(struct sci_base_state_machine *sm) |
| 1715 | { | 1706 | { |
| 1716 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1707 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1717 | | 1708 | |
| 1718 | sci_del_timer(&sci_port->timer); | 1709 | sci_del_timer(&iport->timer); |
| 1719 | } | 1710 | } |
| 1720 | | 1711 | |
| 1721 | static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm) | 1712 | static void scic_sds_port_stopping_state_exit(struct sci_base_state_machine *sm) |
| 1722 | { | 1713 | { |
| 1723 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1714 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1724 | | 1715 | |
| 1725 | sci_del_timer(&sci_port->timer); | 1716 | sci_del_timer(&iport->timer); |
| 1726 | | 1717 | |
| 1727 | scic_sds_port_destroy_dummy_resources(sci_port); | 1718 | scic_sds_port_destroy_dummy_resources(iport); |
| 1728 | } | 1719 | } |
| 1729 | | 1720 | |
| 1730 | static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) | 1721 | static void scic_sds_port_failed_state_enter(struct sci_base_state_machine *sm) |
| 1731 | { | 1722 | { |
| 1732 | struct scic_sds_port *sci_port = container_of(sm, typeof(*sci_port), sm); | 1723 | struct isci_port *iport = container_of(sm, typeof(*iport), sm); |
| 1733 | struct isci_port *iport = sci_port_to_iport(sci_port); | | |
| 1734 | | 1724 | |
| 1735 | isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); | 1725 | isci_port_hard_reset_complete(iport, SCI_FAILURE_TIMEOUT); |
| 1736 | } | 1726 | } |
| @@ -1767,30 +1757,30 @@ static const struct sci_base_state scic_sds_port_state_table[] = { · 30 unmodified lines |
| 1767 | } | 1757 | } |
| 1768 | }; | 1758 | }; |
| 1769 | | 1759 | |
| 1770 | void scic_sds_port_construct(struct scic_sds_port *sci_port, u8 index, | 1760 | void scic_sds_port_construct(struct isci_port *iport, u8 index, |
| 1771 | struct scic_sds_controller *scic) | 1761 | struct scic_sds_controller *scic) |
| 1772 | { | 1762 | { |
| 1773 | sci_init_sm(&sci_port->sm, scic_sds_port_state_table, SCI_PORT_STOPPED); | 1763 | sci_init_sm(&iport->sm, scic_sds_port_state_table, SCI_PORT_STOPPED); |
| 1774 | | 1764 | |
| 1775 | sci_port->logical_port_index = SCIC_SDS_DUMMY_PORT; | 1765 | iport->logical_port_index = SCIC_SDS_DUMMY_PORT; |
| 1776 | sci_port->physical_port_index = index; | 1766 | iport->physical_port_index = index; |
| 1777 | sci_port->active_phy_mask = 0; | 1767 | iport->active_phy_mask = 0; |
| 1778 | sci_port->ready_exit = false; | 1768 | iport->ready_exit = false; |
| 1779 | | 1769 | |
| 1780 | sci_port->owning_controller = scic; | 1770 | iport->owning_controller = scic; |
| 1781 | | 1771 | |
| 1782 | sci_port->started_request_count = 0; | 1772 | iport->started_request_count = 0; |
| 1783 | sci_port->assigned_device_count = 0; | 1773 | iport->assigned_device_count = 0; |
| 1784 | | 1774 | |
| 1785 | sci_port->reserved_rni = SCU_DUMMY_INDEX; | 1775 | iport->reserved_rni = SCU_DUMMY_INDEX; |
| 1786 | sci_port->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; | 1776 | iport->reserved_tag = SCI_CONTROLLER_INVALID_IO_TAG; |
| 1787 | | 1777 | |
| 1788 | sci_init_timer(&sci_port->timer, port_timeout); | 1778 | sci_init_timer(&iport->timer, port_timeout); |
| 1789 | | 1779 | |
| 1790 | sci_port->port_task_scheduler_registers = NULL; | 1780 | iport->port_task_scheduler_registers = NULL; |
| 1791 | | 1781 | |
| 1792 | for (index = 0; index < SCI_MAX_PHYS; index++) | 1782 | for (index = 0; index < SCI_MAX_PHYS; index++) |
| 1793 | sci_port->phy_table[index] = NULL; | 1783 | iport->phy_table[index] = NULL; |
| 1794 | } | 1784 | } |
| 1795 | | 1785 | |
| 1796 | void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index) | 1786 | void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index) |
| @@ -1817,14 +1807,14 @@ enum isci_status isci_port_get_state( · 20 unmodified lines |
| 1817 | } | 1807 | } |
| 1818 | | 1808 | |
| 1819 | void scic_sds_port_broadcast_change_received( | 1809 | void scic_sds_port_broadcast_change_received( |
| 1820 | struct scic_sds_port *sci_port, | 1810 | struct isci_port *iport, |
| 1821 | struct isci_phy *iphy) | 1811 | struct isci_phy *iphy) |
| 1822 | { | 1812 | { |
| 1823 | struct scic_sds_controller *scic = sci_port->owning_controller; | 1813 | struct scic_sds_controller *scic = iport->owning_controller; |
| 1824 | struct isci_host *ihost = scic_to_ihost(scic); | 1814 | struct isci_host *ihost = scic_to_ihost(scic); |
| 1825 | | 1815 | |
| 1826 | /* notify the user. */ | 1816 | /* notify the user. */ |
| 1827 | isci_port_bc_change_received(ihost, sci_port, iphy); | 1817 | isci_port_bc_change_received(ihost, iport, iphy); |
| 1828 | } | 1818 | } |
| 1829 | | 1819 | |
| 1830 | int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport, | 1820 | int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport, |
| @@ -1842,7 +1832,7 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor · 11 unmodified lines |
| 1842 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1832 | spin_lock_irqsave(&ihost->scic_lock, flags); |
| 1843 | | 1833 | |
| 1844 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT | 1834 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT |
| 1845 | status = scic_port_hard_reset(&iport->sci, ISCI_PORT_RESET_TIMEOUT); | 1835 | status = scic_port_hard_reset(iport, ISCI_PORT_RESET_TIMEOUT); |
| 1846 | | 1836 | |
| 1847 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1837 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
| 1848 | | 1838 | |
| @@ -1878,14 +1868,12 @@ int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *ipor · 29 unmodified lines |
| 1878 | /* Down all phys in the port. */ | 1868 | /* Down all phys in the port. */ |
| 1879 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1869 | spin_lock_irqsave(&ihost->scic_lock, flags); |
| 1880 | for (idx = 0; idx < SCI_MAX_PHYS; ++idx) { | 1870 | for (idx = 0; idx < SCI_MAX_PHYS; ++idx) { |
| | 1871 | struct isci_phy *iphy = iport->phy_table[idx]; |
| 1881 | | 1872 | |
| 1882 | if (iport->sci.phy_table[idx] != NULL) { | 1873 | if (!iphy) |
| 1883 | | 1874 | continue; |
| 1884 | scic_sds_phy_stop( | 1875 | scic_sds_phy_stop(iphy); |
| 1885 | iport->sci.phy_table[idx]); | 1876 | scic_sds_phy_start(iphy); |
| 1886 | scic_sds_phy_start( | | |
| 1887 | iport->sci.phy_table[idx]); | | |
| 1888 | } | | |
| 1889 | } | 1877 | } |
| 1890 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1878 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
| 1891 | } | 1879 | } |