diff options
Diffstat (limited to 'drivers/scsi/isci/phy.c')
-rw-r--r-- | drivers/scsi/isci/phy.c | 385 |
1 files changed, 151 insertions, 234 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index ca96b5ad0d52..0df9f713f487 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -67,25 +67,13 @@ enum sas_linkrate sci_phy_linkrate(struct isci_phy *iphy) | |||
67 | return iphy->max_negotiated_speed; | 67 | return iphy->max_negotiated_speed; |
68 | } | 68 | } |
69 | 69 | ||
70 | /* | 70 | static enum sci_status |
71 | * ***************************************************************************** | 71 | sci_phy_transport_layer_initialization(struct isci_phy *iphy, |
72 | * * SCIC SDS PHY Internal Methods | 72 | struct scu_transport_layer_registers __iomem *reg) |
73 | * ***************************************************************************** */ | ||
74 | |||
75 | /** | ||
76 | * This method will initialize the phy transport layer registers | ||
77 | * @sci_phy: | ||
78 | * @transport_layer_registers | ||
79 | * | ||
80 | * enum sci_status | ||
81 | */ | ||
82 | static enum sci_status scic_sds_phy_transport_layer_initialization( | ||
83 | struct isci_phy *iphy, | ||
84 | struct scu_transport_layer_registers __iomem *transport_layer_registers) | ||
85 | { | 73 | { |
86 | u32 tl_control; | 74 | u32 tl_control; |
87 | 75 | ||
88 | iphy->transport_layer_registers = transport_layer_registers; | 76 | iphy->transport_layer_registers = reg; |
89 | 77 | ||
90 | writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX, | 78 | writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX, |
91 | &iphy->transport_layer_registers->stp_rni); | 79 | &iphy->transport_layer_registers->stp_rni); |
@@ -101,32 +89,23 @@ static enum sci_status scic_sds_phy_transport_layer_initialization( | |||
101 | return SCI_SUCCESS; | 89 | return SCI_SUCCESS; |
102 | } | 90 | } |
103 | 91 | ||
104 | /** | ||
105 | * This method will initialize the phy link layer registers | ||
106 | * @sci_phy: | ||
107 | * @link_layer_registers: | ||
108 | * | ||
109 | * enum sci_status | ||
110 | */ | ||
111 | static enum sci_status | 92 | static enum sci_status |
112 | scic_sds_phy_link_layer_initialization(struct isci_phy *iphy, | 93 | sci_phy_link_layer_initialization(struct isci_phy *iphy, |
113 | struct scu_link_layer_registers __iomem *link_layer_registers) | 94 | struct scu_link_layer_registers __iomem *reg) |
114 | { | 95 | { |
115 | struct isci_host *ihost = | 96 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
116 | iphy->owning_port->owning_controller; | ||
117 | int phy_idx = iphy->phy_index; | 97 | int phy_idx = iphy->phy_index; |
118 | struct sci_phy_user_params *phy_user = | 98 | struct sci_phy_user_params *phy_user = &ihost->user_parameters.phys[phy_idx]; |
119 | &ihost->user_parameters.sds1.phys[phy_idx]; | ||
120 | struct sci_phy_oem_params *phy_oem = | 99 | struct sci_phy_oem_params *phy_oem = |
121 | &ihost->oem_parameters.sds1.phys[phy_idx]; | 100 | &ihost->oem_parameters.phys[phy_idx]; |
122 | u32 phy_configuration; | 101 | u32 phy_configuration; |
123 | struct scic_phy_cap phy_cap; | 102 | struct sci_phy_cap phy_cap; |
124 | u32 parity_check = 0; | 103 | u32 parity_check = 0; |
125 | u32 parity_count = 0; | 104 | u32 parity_count = 0; |
126 | u32 llctl, link_rate; | 105 | u32 llctl, link_rate; |
127 | u32 clksm_value = 0; | 106 | u32 clksm_value = 0; |
128 | 107 | ||
129 | iphy->link_layer_registers = link_layer_registers; | 108 | iphy->link_layer_registers = reg; |
130 | 109 | ||
131 | /* Set our IDENTIFY frame data */ | 110 | /* Set our IDENTIFY frame data */ |
132 | #define SCI_END_DEVICE 0x01 | 111 | #define SCI_END_DEVICE 0x01 |
@@ -169,7 +148,7 @@ scic_sds_phy_link_layer_initialization(struct isci_phy *iphy, | |||
169 | phy_cap.gen3_no_ssc = 1; | 148 | phy_cap.gen3_no_ssc = 1; |
170 | phy_cap.gen2_no_ssc = 1; | 149 | phy_cap.gen2_no_ssc = 1; |
171 | phy_cap.gen1_no_ssc = 1; | 150 | phy_cap.gen1_no_ssc = 1; |
172 | if (ihost->oem_parameters.sds1.controller.do_enable_ssc == true) { | 151 | if (ihost->oem_parameters.controller.do_enable_ssc == true) { |
173 | phy_cap.gen3_ssc = 1; | 152 | phy_cap.gen3_ssc = 1; |
174 | phy_cap.gen2_ssc = 1; | 153 | phy_cap.gen2_ssc = 1; |
175 | phy_cap.gen1_ssc = 1; | 154 | phy_cap.gen1_ssc = 1; |
@@ -216,7 +195,7 @@ scic_sds_phy_link_layer_initialization(struct isci_phy *iphy, | |||
216 | &iphy->link_layer_registers->afe_lookup_table_control); | 195 | &iphy->link_layer_registers->afe_lookup_table_control); |
217 | 196 | ||
218 | llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT, | 197 | llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT, |
219 | (u8)ihost->user_parameters.sds1.no_outbound_task_timeout); | 198 | (u8)ihost->user_parameters.no_outbound_task_timeout); |
220 | 199 | ||
221 | switch(phy_user->max_speed_generation) { | 200 | switch(phy_user->max_speed_generation) { |
222 | case SCIC_SDS_PARM_GEN3_SPEED: | 201 | case SCIC_SDS_PARM_GEN3_SPEED: |
@@ -289,7 +268,7 @@ done: | |||
289 | struct isci_port *phy_get_non_dummy_port( | 268 | struct isci_port *phy_get_non_dummy_port( |
290 | struct isci_phy *iphy) | 269 | struct isci_phy *iphy) |
291 | { | 270 | { |
292 | if (scic_sds_port_get_index(iphy->owning_port) == SCIC_SDS_DUMMY_PORT) | 271 | if (sci_port_get_index(iphy->owning_port) == SCIC_SDS_DUMMY_PORT) |
293 | return NULL; | 272 | return NULL; |
294 | 273 | ||
295 | return iphy->owning_port; | 274 | return iphy->owning_port; |
@@ -302,7 +281,7 @@ struct isci_port *phy_get_non_dummy_port( | |||
302 | * | 281 | * |
303 | * | 282 | * |
304 | */ | 283 | */ |
305 | void scic_sds_phy_set_port( | 284 | void sci_phy_set_port( |
306 | struct isci_phy *iphy, | 285 | struct isci_phy *iphy, |
307 | struct isci_port *iport) | 286 | struct isci_port *iport) |
308 | { | 287 | { |
@@ -310,33 +289,23 @@ void scic_sds_phy_set_port( | |||
310 | 289 | ||
311 | if (iphy->bcn_received_while_port_unassigned) { | 290 | if (iphy->bcn_received_while_port_unassigned) { |
312 | iphy->bcn_received_while_port_unassigned = false; | 291 | iphy->bcn_received_while_port_unassigned = false; |
313 | scic_sds_port_broadcast_change_received(iphy->owning_port, iphy); | 292 | sci_port_broadcast_change_received(iphy->owning_port, iphy); |
314 | } | 293 | } |
315 | } | 294 | } |
316 | 295 | ||
317 | /** | 296 | enum sci_status sci_phy_initialize(struct isci_phy *iphy, |
318 | * This method will initialize the constructed phy | 297 | struct scu_transport_layer_registers __iomem *tl, |
319 | * @sci_phy: | 298 | struct scu_link_layer_registers __iomem *ll) |
320 | * @link_layer_registers: | ||
321 | * | ||
322 | * enum sci_status | ||
323 | */ | ||
324 | enum sci_status scic_sds_phy_initialize( | ||
325 | struct isci_phy *iphy, | ||
326 | struct scu_transport_layer_registers __iomem *transport_layer_registers, | ||
327 | struct scu_link_layer_registers __iomem *link_layer_registers) | ||
328 | { | 299 | { |
329 | /* Perfrom the initialization of the TL hardware */ | 300 | /* Perfrom the initialization of the TL hardware */ |
330 | scic_sds_phy_transport_layer_initialization( | 301 | sci_phy_transport_layer_initialization(iphy, tl); |
331 | iphy, | ||
332 | transport_layer_registers); | ||
333 | 302 | ||
334 | /* Perofrm the initialization of the PE hardware */ | 303 | /* Perofrm the initialization of the PE hardware */ |
335 | scic_sds_phy_link_layer_initialization(iphy, link_layer_registers); | 304 | sci_phy_link_layer_initialization(iphy, ll); |
336 | 305 | ||
337 | /* | 306 | /* There is nothing that needs to be done in this state just |
338 | * There is nothing that needs to be done in this state just | 307 | * transition to the stopped state |
339 | * transition to the stopped state. */ | 308 | */ |
340 | sci_change_state(&iphy->sm, SCI_PHY_STOPPED); | 309 | sci_change_state(&iphy->sm, SCI_PHY_STOPPED); |
341 | 310 | ||
342 | return SCI_SUCCESS; | 311 | return SCI_SUCCESS; |
@@ -351,9 +320,7 @@ enum sci_status scic_sds_phy_initialize( | |||
351 | * This will either be the RNi for the device or an invalid RNi if there | 320 | * This will either be the RNi for the device or an invalid RNi if there |
352 | * is no current device assigned to the phy. | 321 | * is no current device assigned to the phy. |
353 | */ | 322 | */ |
354 | void scic_sds_phy_setup_transport( | 323 | void sci_phy_setup_transport(struct isci_phy *iphy, u32 device_id) |
355 | struct isci_phy *iphy, | ||
356 | u32 device_id) | ||
357 | { | 324 | { |
358 | u32 tl_control; | 325 | u32 tl_control; |
359 | 326 | ||
@@ -368,15 +335,7 @@ void scic_sds_phy_setup_transport( | |||
368 | writel(tl_control, &iphy->transport_layer_registers->control); | 335 | writel(tl_control, &iphy->transport_layer_registers->control); |
369 | } | 336 | } |
370 | 337 | ||
371 | /** | 338 | static void sci_phy_suspend(struct isci_phy *iphy) |
372 | * | ||
373 | * @sci_phy: The phy object to be suspended. | ||
374 | * | ||
375 | * This function will perform the register reads/writes to suspend the SCU | ||
376 | * hardware protocol engine. none | ||
377 | */ | ||
378 | static void scic_sds_phy_suspend( | ||
379 | struct isci_phy *iphy) | ||
380 | { | 339 | { |
381 | u32 scu_sas_pcfg_value; | 340 | u32 scu_sas_pcfg_value; |
382 | 341 | ||
@@ -386,12 +345,10 @@ static void scic_sds_phy_suspend( | |||
386 | writel(scu_sas_pcfg_value, | 345 | writel(scu_sas_pcfg_value, |
387 | &iphy->link_layer_registers->phy_configuration); | 346 | &iphy->link_layer_registers->phy_configuration); |
388 | 347 | ||
389 | scic_sds_phy_setup_transport( | 348 | sci_phy_setup_transport(iphy, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); |
390 | iphy, | ||
391 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); | ||
392 | } | 349 | } |
393 | 350 | ||
394 | void scic_sds_phy_resume(struct isci_phy *iphy) | 351 | void sci_phy_resume(struct isci_phy *iphy) |
395 | { | 352 | { |
396 | u32 scu_sas_pcfg_value; | 353 | u32 scu_sas_pcfg_value; |
397 | 354 | ||
@@ -402,34 +359,28 @@ void scic_sds_phy_resume(struct isci_phy *iphy) | |||
402 | &iphy->link_layer_registers->phy_configuration); | 359 | &iphy->link_layer_registers->phy_configuration); |
403 | } | 360 | } |
404 | 361 | ||
405 | void scic_sds_phy_get_sas_address(struct isci_phy *iphy, | 362 | void sci_phy_get_sas_address(struct isci_phy *iphy, struct sci_sas_address *sas) |
406 | struct sci_sas_address *sas_address) | ||
407 | { | 363 | { |
408 | sas_address->high = readl(&iphy->link_layer_registers->source_sas_address_high); | 364 | sas->high = readl(&iphy->link_layer_registers->source_sas_address_high); |
409 | sas_address->low = readl(&iphy->link_layer_registers->source_sas_address_low); | 365 | sas->low = readl(&iphy->link_layer_registers->source_sas_address_low); |
410 | } | 366 | } |
411 | 367 | ||
412 | void scic_sds_phy_get_attached_sas_address(struct isci_phy *iphy, | 368 | void sci_phy_get_attached_sas_address(struct isci_phy *iphy, struct sci_sas_address *sas) |
413 | struct sci_sas_address *sas_address) | ||
414 | { | 369 | { |
415 | struct sas_identify_frame *iaf; | 370 | struct sas_identify_frame *iaf; |
416 | 371 | ||
417 | iaf = &iphy->frame_rcvd.iaf; | 372 | iaf = &iphy->frame_rcvd.iaf; |
418 | memcpy(sas_address, iaf->sas_addr, SAS_ADDR_SIZE); | 373 | memcpy(sas, iaf->sas_addr, SAS_ADDR_SIZE); |
419 | } | 374 | } |
420 | 375 | ||
421 | void scic_sds_phy_get_protocols(struct isci_phy *iphy, | 376 | void sci_phy_get_protocols(struct isci_phy *iphy, struct sci_phy_proto *proto) |
422 | struct scic_phy_proto *protocols) | ||
423 | { | 377 | { |
424 | protocols->all = | 378 | proto->all = readl(&iphy->link_layer_registers->transmit_identification); |
425 | (u16)(readl(&iphy-> | ||
426 | link_layer_registers->transmit_identification) & | ||
427 | 0x0000FFFF); | ||
428 | } | 379 | } |
429 | 380 | ||
430 | enum sci_status scic_sds_phy_start(struct isci_phy *iphy) | 381 | enum sci_status sci_phy_start(struct isci_phy *iphy) |
431 | { | 382 | { |
432 | enum scic_sds_phy_states state = iphy->sm.current_state_id; | 383 | enum sci_phy_states state = iphy->sm.current_state_id; |
433 | 384 | ||
434 | if (state != SCI_PHY_STOPPED) { | 385 | if (state != SCI_PHY_STOPPED) { |
435 | dev_dbg(sciphy_to_dev(iphy), | 386 | dev_dbg(sciphy_to_dev(iphy), |
@@ -441,9 +392,9 @@ enum sci_status scic_sds_phy_start(struct isci_phy *iphy) | |||
441 | return SCI_SUCCESS; | 392 | return SCI_SUCCESS; |
442 | } | 393 | } |
443 | 394 | ||
444 | enum sci_status scic_sds_phy_stop(struct isci_phy *iphy) | 395 | enum sci_status sci_phy_stop(struct isci_phy *iphy) |
445 | { | 396 | { |
446 | enum scic_sds_phy_states state = iphy->sm.current_state_id; | 397 | enum sci_phy_states state = iphy->sm.current_state_id; |
447 | 398 | ||
448 | switch (state) { | 399 | switch (state) { |
449 | case SCI_PHY_SUB_INITIAL: | 400 | case SCI_PHY_SUB_INITIAL: |
@@ -467,9 +418,9 @@ enum sci_status scic_sds_phy_stop(struct isci_phy *iphy) | |||
467 | return SCI_SUCCESS; | 418 | return SCI_SUCCESS; |
468 | } | 419 | } |
469 | 420 | ||
470 | enum sci_status scic_sds_phy_reset(struct isci_phy *iphy) | 421 | enum sci_status sci_phy_reset(struct isci_phy *iphy) |
471 | { | 422 | { |
472 | enum scic_sds_phy_states state = iphy->sm.current_state_id; | 423 | enum sci_phy_states state = iphy->sm.current_state_id; |
473 | 424 | ||
474 | if (state != SCI_PHY_READY) { | 425 | if (state != SCI_PHY_READY) { |
475 | dev_dbg(sciphy_to_dev(iphy), | 426 | dev_dbg(sciphy_to_dev(iphy), |
@@ -481,9 +432,9 @@ enum sci_status scic_sds_phy_reset(struct isci_phy *iphy) | |||
481 | return SCI_SUCCESS; | 432 | return SCI_SUCCESS; |
482 | } | 433 | } |
483 | 434 | ||
484 | enum sci_status scic_sds_phy_consume_power_handler(struct isci_phy *iphy) | 435 | enum sci_status sci_phy_consume_power_handler(struct isci_phy *iphy) |
485 | { | 436 | { |
486 | enum scic_sds_phy_states state = iphy->sm.current_state_id; | 437 | enum sci_phy_states state = iphy->sm.current_state_id; |
487 | 438 | ||
488 | switch (state) { | 439 | switch (state) { |
489 | case SCI_PHY_SUB_AWAIT_SAS_POWER: { | 440 | case SCI_PHY_SUB_AWAIT_SAS_POWER: { |
@@ -528,55 +479,37 @@ enum sci_status scic_sds_phy_consume_power_handler(struct isci_phy *iphy) | |||
528 | } | 479 | } |
529 | } | 480 | } |
530 | 481 | ||
531 | /* | 482 | static void sci_phy_start_sas_link_training(struct isci_phy *iphy) |
532 | * ***************************************************************************** | ||
533 | * * SCIC SDS PHY HELPER FUNCTIONS | ||
534 | * ***************************************************************************** */ | ||
535 | |||
536 | |||
537 | /** | ||
538 | * | ||
539 | * @sci_phy: The phy object that received SAS PHY DETECTED. | ||
540 | * | ||
541 | * This method continues the link training for the phy as if it were a SAS PHY | ||
542 | * instead of a SATA PHY. This is done because the completion queue had a SAS | ||
543 | * PHY DETECTED event when the state machine was expecting a SATA PHY event. | ||
544 | * none | ||
545 | */ | ||
546 | static void scic_sds_phy_start_sas_link_training( | ||
547 | struct isci_phy *iphy) | ||
548 | { | 483 | { |
484 | /* continue the link training for the phy as if it were a SAS PHY | ||
485 | * instead of a SATA PHY. This is done because the completion queue had a SAS | ||
486 | * PHY DETECTED event when the state machine was expecting a SATA PHY event. | ||
487 | */ | ||
549 | u32 phy_control; | 488 | u32 phy_control; |
550 | 489 | ||
551 | phy_control = | 490 | phy_control = readl(&iphy->link_layer_registers->phy_configuration); |
552 | readl(&iphy->link_layer_registers->phy_configuration); | ||
553 | phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD); | 491 | phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD); |
554 | writel(phy_control, | 492 | writel(phy_control, |
555 | &iphy->link_layer_registers->phy_configuration); | 493 | &iphy->link_layer_registers->phy_configuration); |
556 | 494 | ||
557 | sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SAS_SPEED_EN); | 495 | sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SAS_SPEED_EN); |
558 | 496 | ||
559 | iphy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS; | 497 | iphy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS; |
560 | } | 498 | } |
561 | 499 | ||
562 | /** | 500 | static void sci_phy_start_sata_link_training(struct isci_phy *iphy) |
563 | * | ||
564 | * @sci_phy: The phy object that received a SATA SPINUP HOLD event | ||
565 | * | ||
566 | * This method continues the link training for the phy as if it were a SATA PHY | ||
567 | * instead of a SAS PHY. This is done because the completion queue had a SATA | ||
568 | * SPINUP HOLD event when the state machine was expecting a SAS PHY event. none | ||
569 | */ | ||
570 | static void scic_sds_phy_start_sata_link_training( | ||
571 | struct isci_phy *iphy) | ||
572 | { | 501 | { |
502 | /* This method continues the link training for the phy as if it were a SATA PHY | ||
503 | * instead of a SAS PHY. This is done because the completion queue had a SATA | ||
504 | * SPINUP HOLD event when the state machine was expecting a SAS PHY event. none | ||
505 | */ | ||
573 | sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SATA_POWER); | 506 | sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_SATA_POWER); |
574 | 507 | ||
575 | iphy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; | 508 | iphy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; |
576 | } | 509 | } |
577 | 510 | ||
578 | /** | 511 | /** |
579 | * scic_sds_phy_complete_link_training - perform processing common to | 512 | * sci_phy_complete_link_training - perform processing common to |
580 | * all protocols upon completion of link training. | 513 | * all protocols upon completion of link training. |
581 | * @sci_phy: This parameter specifies the phy object for which link training | 514 | * @sci_phy: This parameter specifies the phy object for which link training |
582 | * has completed. | 515 | * has completed. |
@@ -586,30 +519,28 @@ static void scic_sds_phy_start_sata_link_training( | |||
586 | * sub-state machine. | 519 | * sub-state machine. |
587 | * | 520 | * |
588 | */ | 521 | */ |
589 | static void scic_sds_phy_complete_link_training( | 522 | static void sci_phy_complete_link_training(struct isci_phy *iphy, |
590 | struct isci_phy *iphy, | 523 | enum sas_linkrate max_link_rate, |
591 | enum sas_linkrate max_link_rate, | 524 | u32 next_state) |
592 | u32 next_state) | ||
593 | { | 525 | { |
594 | iphy->max_negotiated_speed = max_link_rate; | 526 | iphy->max_negotiated_speed = max_link_rate; |
595 | 527 | ||
596 | sci_change_state(&iphy->sm, next_state); | 528 | sci_change_state(&iphy->sm, next_state); |
597 | } | 529 | } |
598 | 530 | ||
599 | enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | 531 | enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code) |
600 | u32 event_code) | ||
601 | { | 532 | { |
602 | enum scic_sds_phy_states state = iphy->sm.current_state_id; | 533 | enum sci_phy_states state = iphy->sm.current_state_id; |
603 | 534 | ||
604 | switch (state) { | 535 | switch (state) { |
605 | case SCI_PHY_SUB_AWAIT_OSSP_EN: | 536 | case SCI_PHY_SUB_AWAIT_OSSP_EN: |
606 | switch (scu_get_event_code(event_code)) { | 537 | switch (scu_get_event_code(event_code)) { |
607 | case SCU_EVENT_SAS_PHY_DETECTED: | 538 | case SCU_EVENT_SAS_PHY_DETECTED: |
608 | scic_sds_phy_start_sas_link_training(iphy); | 539 | sci_phy_start_sas_link_training(iphy); |
609 | iphy->is_in_link_training = true; | 540 | iphy->is_in_link_training = true; |
610 | break; | 541 | break; |
611 | case SCU_EVENT_SATA_SPINUP_HOLD: | 542 | case SCU_EVENT_SATA_SPINUP_HOLD: |
612 | scic_sds_phy_start_sata_link_training(iphy); | 543 | sci_phy_start_sata_link_training(iphy); |
613 | iphy->is_in_link_training = true; | 544 | iphy->is_in_link_training = true; |
614 | break; | 545 | break; |
615 | default: | 546 | default: |
@@ -630,30 +561,24 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
630 | break; | 561 | break; |
631 | case SCU_EVENT_SAS_15: | 562 | case SCU_EVENT_SAS_15: |
632 | case SCU_EVENT_SAS_15_SSC: | 563 | case SCU_EVENT_SAS_15_SSC: |
633 | scic_sds_phy_complete_link_training( | 564 | sci_phy_complete_link_training(iphy, SAS_LINK_RATE_1_5_GBPS, |
634 | iphy, | 565 | SCI_PHY_SUB_AWAIT_IAF_UF); |
635 | SAS_LINK_RATE_1_5_GBPS, | ||
636 | SCI_PHY_SUB_AWAIT_IAF_UF); | ||
637 | break; | 566 | break; |
638 | case SCU_EVENT_SAS_30: | 567 | case SCU_EVENT_SAS_30: |
639 | case SCU_EVENT_SAS_30_SSC: | 568 | case SCU_EVENT_SAS_30_SSC: |
640 | scic_sds_phy_complete_link_training( | 569 | sci_phy_complete_link_training(iphy, SAS_LINK_RATE_3_0_GBPS, |
641 | iphy, | 570 | SCI_PHY_SUB_AWAIT_IAF_UF); |
642 | SAS_LINK_RATE_3_0_GBPS, | ||
643 | SCI_PHY_SUB_AWAIT_IAF_UF); | ||
644 | break; | 571 | break; |
645 | case SCU_EVENT_SAS_60: | 572 | case SCU_EVENT_SAS_60: |
646 | case SCU_EVENT_SAS_60_SSC: | 573 | case SCU_EVENT_SAS_60_SSC: |
647 | scic_sds_phy_complete_link_training( | 574 | sci_phy_complete_link_training(iphy, SAS_LINK_RATE_6_0_GBPS, |
648 | iphy, | 575 | SCI_PHY_SUB_AWAIT_IAF_UF); |
649 | SAS_LINK_RATE_6_0_GBPS, | ||
650 | SCI_PHY_SUB_AWAIT_IAF_UF); | ||
651 | break; | 576 | break; |
652 | case SCU_EVENT_SATA_SPINUP_HOLD: | 577 | case SCU_EVENT_SATA_SPINUP_HOLD: |
653 | /* | 578 | /* |
654 | * We were doing SAS PHY link training and received a SATA PHY event | 579 | * We were doing SAS PHY link training and received a SATA PHY event |
655 | * continue OOB/SN as if this were a SATA PHY */ | 580 | * continue OOB/SN as if this were a SATA PHY */ |
656 | scic_sds_phy_start_sata_link_training(iphy); | 581 | sci_phy_start_sata_link_training(iphy); |
657 | break; | 582 | break; |
658 | case SCU_EVENT_LINK_FAILURE: | 583 | case SCU_EVENT_LINK_FAILURE: |
659 | /* Link failure change state back to the starting state */ | 584 | /* Link failure change state back to the starting state */ |
@@ -673,14 +598,14 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
673 | switch (scu_get_event_code(event_code)) { | 598 | switch (scu_get_event_code(event_code)) { |
674 | case SCU_EVENT_SAS_PHY_DETECTED: | 599 | case SCU_EVENT_SAS_PHY_DETECTED: |
675 | /* Backup the state machine */ | 600 | /* Backup the state machine */ |
676 | scic_sds_phy_start_sas_link_training(iphy); | 601 | sci_phy_start_sas_link_training(iphy); |
677 | break; | 602 | break; |
678 | case SCU_EVENT_SATA_SPINUP_HOLD: | 603 | case SCU_EVENT_SATA_SPINUP_HOLD: |
679 | /* We were doing SAS PHY link training and received a | 604 | /* We were doing SAS PHY link training and received a |
680 | * SATA PHY event continue OOB/SN as if this were a | 605 | * SATA PHY event continue OOB/SN as if this were a |
681 | * SATA PHY | 606 | * SATA PHY |
682 | */ | 607 | */ |
683 | scic_sds_phy_start_sata_link_training(iphy); | 608 | sci_phy_start_sata_link_training(iphy); |
684 | break; | 609 | break; |
685 | case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT: | 610 | case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT: |
686 | case SCU_EVENT_LINK_FAILURE: | 611 | case SCU_EVENT_LINK_FAILURE: |
@@ -727,7 +652,7 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
727 | /* There has been a change in the phy type before OOB/SN for the | 652 | /* There has been a change in the phy type before OOB/SN for the |
728 | * SATA finished start down the SAS link traning path. | 653 | * SATA finished start down the SAS link traning path. |
729 | */ | 654 | */ |
730 | scic_sds_phy_start_sas_link_training(iphy); | 655 | sci_phy_start_sas_link_training(iphy); |
731 | break; | 656 | break; |
732 | 657 | ||
733 | default: | 658 | default: |
@@ -760,7 +685,7 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
760 | /* There has been a change in the phy type before OOB/SN for the | 685 | /* There has been a change in the phy type before OOB/SN for the |
761 | * SATA finished start down the SAS link traning path. | 686 | * SATA finished start down the SAS link traning path. |
762 | */ | 687 | */ |
763 | scic_sds_phy_start_sas_link_training(iphy); | 688 | sci_phy_start_sas_link_training(iphy); |
764 | break; | 689 | break; |
765 | default: | 690 | default: |
766 | dev_warn(sciphy_to_dev(iphy), | 691 | dev_warn(sciphy_to_dev(iphy), |
@@ -781,24 +706,18 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
781 | break; | 706 | break; |
782 | case SCU_EVENT_SATA_15: | 707 | case SCU_EVENT_SATA_15: |
783 | case SCU_EVENT_SATA_15_SSC: | 708 | case SCU_EVENT_SATA_15_SSC: |
784 | scic_sds_phy_complete_link_training( | 709 | sci_phy_complete_link_training(iphy, SAS_LINK_RATE_1_5_GBPS, |
785 | iphy, | 710 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); |
786 | SAS_LINK_RATE_1_5_GBPS, | ||
787 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); | ||
788 | break; | 711 | break; |
789 | case SCU_EVENT_SATA_30: | 712 | case SCU_EVENT_SATA_30: |
790 | case SCU_EVENT_SATA_30_SSC: | 713 | case SCU_EVENT_SATA_30_SSC: |
791 | scic_sds_phy_complete_link_training( | 714 | sci_phy_complete_link_training(iphy, SAS_LINK_RATE_3_0_GBPS, |
792 | iphy, | 715 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); |
793 | SAS_LINK_RATE_3_0_GBPS, | ||
794 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); | ||
795 | break; | 716 | break; |
796 | case SCU_EVENT_SATA_60: | 717 | case SCU_EVENT_SATA_60: |
797 | case SCU_EVENT_SATA_60_SSC: | 718 | case SCU_EVENT_SATA_60_SSC: |
798 | scic_sds_phy_complete_link_training( | 719 | sci_phy_complete_link_training(iphy, SAS_LINK_RATE_6_0_GBPS, |
799 | iphy, | 720 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); |
800 | SAS_LINK_RATE_6_0_GBPS, | ||
801 | SCI_PHY_SUB_AWAIT_SIG_FIS_UF); | ||
802 | break; | 721 | break; |
803 | case SCU_EVENT_LINK_FAILURE: | 722 | case SCU_EVENT_LINK_FAILURE: |
804 | /* Link failure change state back to the starting state */ | 723 | /* Link failure change state back to the starting state */ |
@@ -808,7 +727,7 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
808 | /* | 727 | /* |
809 | * There has been a change in the phy type before OOB/SN for the | 728 | * There has been a change in the phy type before OOB/SN for the |
810 | * SATA finished start down the SAS link traning path. */ | 729 | * SATA finished start down the SAS link traning path. */ |
811 | scic_sds_phy_start_sas_link_training(iphy); | 730 | sci_phy_start_sas_link_training(iphy); |
812 | break; | 731 | break; |
813 | default: | 732 | default: |
814 | dev_warn(sciphy_to_dev(iphy), | 733 | dev_warn(sciphy_to_dev(iphy), |
@@ -851,7 +770,7 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
851 | case SCU_EVENT_BROADCAST_CHANGE: | 770 | case SCU_EVENT_BROADCAST_CHANGE: |
852 | /* Broadcast change received. Notify the port. */ | 771 | /* Broadcast change received. Notify the port. */ |
853 | if (phy_get_non_dummy_port(iphy) != NULL) | 772 | if (phy_get_non_dummy_port(iphy) != NULL) |
854 | scic_sds_port_broadcast_change_received(iphy->owning_port, iphy); | 773 | sci_port_broadcast_change_received(iphy->owning_port, iphy); |
855 | else | 774 | else |
856 | iphy->bcn_received_while_port_unassigned = true; | 775 | iphy->bcn_received_while_port_unassigned = true; |
857 | break; | 776 | break; |
@@ -886,10 +805,9 @@ enum sci_status scic_sds_phy_event_handler(struct isci_phy *iphy, | |||
886 | } | 805 | } |
887 | } | 806 | } |
888 | 807 | ||
889 | enum sci_status scic_sds_phy_frame_handler(struct isci_phy *iphy, | 808 | enum sci_status sci_phy_frame_handler(struct isci_phy *iphy, u32 frame_index) |
890 | u32 frame_index) | ||
891 | { | 809 | { |
892 | enum scic_sds_phy_states state = iphy->sm.current_state_id; | 810 | enum sci_phy_states state = iphy->sm.current_state_id; |
893 | struct isci_host *ihost = iphy->owning_port->owning_controller; | 811 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
894 | enum sci_status result; | 812 | enum sci_status result; |
895 | unsigned long flags; | 813 | unsigned long flags; |
@@ -899,9 +817,9 @@ enum sci_status scic_sds_phy_frame_handler(struct isci_phy *iphy, | |||
899 | u32 *frame_words; | 817 | u32 *frame_words; |
900 | struct sas_identify_frame iaf; | 818 | struct sas_identify_frame iaf; |
901 | 819 | ||
902 | result = scic_sds_unsolicited_frame_control_get_header(&ihost->uf_control, | 820 | result = sci_unsolicited_frame_control_get_header(&ihost->uf_control, |
903 | frame_index, | 821 | frame_index, |
904 | (void **)&frame_words); | 822 | (void **)&frame_words); |
905 | 823 | ||
906 | if (result != SCI_SUCCESS) | 824 | if (result != SCI_SUCCESS) |
907 | return result; | 825 | return result; |
@@ -933,15 +851,15 @@ enum sci_status scic_sds_phy_frame_handler(struct isci_phy *iphy, | |||
933 | "unexpected frame id %x\n", | 851 | "unexpected frame id %x\n", |
934 | __func__, frame_index); | 852 | __func__, frame_index); |
935 | 853 | ||
936 | scic_sds_controller_release_frame(ihost, frame_index); | 854 | sci_controller_release_frame(ihost, frame_index); |
937 | return result; | 855 | return result; |
938 | } | 856 | } |
939 | case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: { | 857 | case SCI_PHY_SUB_AWAIT_SIG_FIS_UF: { |
940 | struct dev_to_host_fis *frame_header; | 858 | struct dev_to_host_fis *frame_header; |
941 | u32 *fis_frame_data; | 859 | u32 *fis_frame_data; |
942 | 860 | ||
943 | result = scic_sds_unsolicited_frame_control_get_header( | 861 | result = sci_unsolicited_frame_control_get_header( |
944 | &(scic_sds_phy_get_controller(iphy)->uf_control), | 862 | &(sci_phy_get_controller(iphy)->uf_control), |
945 | frame_index, | 863 | frame_index, |
946 | (void **)&frame_header); | 864 | (void **)&frame_header); |
947 | 865 | ||
@@ -950,14 +868,14 @@ enum sci_status scic_sds_phy_frame_handler(struct isci_phy *iphy, | |||
950 | 868 | ||
951 | if ((frame_header->fis_type == FIS_REGD2H) && | 869 | if ((frame_header->fis_type == FIS_REGD2H) && |
952 | !(frame_header->status & ATA_BUSY)) { | 870 | !(frame_header->status & ATA_BUSY)) { |
953 | scic_sds_unsolicited_frame_control_get_buffer(&ihost->uf_control, | 871 | sci_unsolicited_frame_control_get_buffer(&ihost->uf_control, |
954 | frame_index, | 872 | frame_index, |
955 | (void **)&fis_frame_data); | 873 | (void **)&fis_frame_data); |
956 | 874 | ||
957 | spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); | 875 | spin_lock_irqsave(&iphy->sas_phy.frame_rcvd_lock, flags); |
958 | scic_sds_controller_copy_sata_response(&iphy->frame_rcvd.fis, | 876 | sci_controller_copy_sata_response(&iphy->frame_rcvd.fis, |
959 | frame_header, | 877 | frame_header, |
960 | fis_frame_data); | 878 | fis_frame_data); |
961 | spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); | 879 | spin_unlock_irqrestore(&iphy->sas_phy.frame_rcvd_lock, flags); |
962 | 880 | ||
963 | /* got IAF we can now go to the await spinup semaphore state */ | 881 | /* got IAF we can now go to the await spinup semaphore state */ |
@@ -971,7 +889,7 @@ enum sci_status scic_sds_phy_frame_handler(struct isci_phy *iphy, | |||
971 | __func__, frame_index); | 889 | __func__, frame_index); |
972 | 890 | ||
973 | /* Regardless of the result we are done with this frame with it */ | 891 | /* Regardless of the result we are done with this frame with it */ |
974 | scic_sds_controller_release_frame(ihost, frame_index); | 892 | sci_controller_release_frame(ihost, frame_index); |
975 | 893 | ||
976 | return result; | 894 | return result; |
977 | } | 895 | } |
@@ -983,7 +901,7 @@ enum sci_status scic_sds_phy_frame_handler(struct isci_phy *iphy, | |||
983 | 901 | ||
984 | } | 902 | } |
985 | 903 | ||
986 | static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_state_machine *sm) | 904 | static void sci_phy_starting_initial_substate_enter(struct sci_base_state_machine *sm) |
987 | { | 905 | { |
988 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 906 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
989 | 907 | ||
@@ -991,71 +909,71 @@ static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_state_m | |||
991 | sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_OSSP_EN); | 909 | sci_change_state(&iphy->sm, SCI_PHY_SUB_AWAIT_OSSP_EN); |
992 | } | 910 | } |
993 | 911 | ||
994 | static void scic_sds_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm) | 912 | static void sci_phy_starting_await_sas_power_substate_enter(struct sci_base_state_machine *sm) |
995 | { | 913 | { |
996 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 914 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
997 | struct isci_host *ihost = iphy->owning_port->owning_controller; | 915 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
998 | 916 | ||
999 | scic_sds_controller_power_control_queue_insert(ihost, iphy); | 917 | sci_controller_power_control_queue_insert(ihost, iphy); |
1000 | } | 918 | } |
1001 | 919 | ||
1002 | static void scic_sds_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm) | 920 | static void sci_phy_starting_await_sas_power_substate_exit(struct sci_base_state_machine *sm) |
1003 | { | 921 | { |
1004 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 922 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1005 | struct isci_host *ihost = iphy->owning_port->owning_controller; | 923 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
1006 | 924 | ||
1007 | scic_sds_controller_power_control_queue_remove(ihost, iphy); | 925 | sci_controller_power_control_queue_remove(ihost, iphy); |
1008 | } | 926 | } |
1009 | 927 | ||
1010 | static void scic_sds_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm) | 928 | static void sci_phy_starting_await_sata_power_substate_enter(struct sci_base_state_machine *sm) |
1011 | { | 929 | { |
1012 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 930 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1013 | struct isci_host *ihost = iphy->owning_port->owning_controller; | 931 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
1014 | 932 | ||
1015 | scic_sds_controller_power_control_queue_insert(ihost, iphy); | 933 | sci_controller_power_control_queue_insert(ihost, iphy); |
1016 | } | 934 | } |
1017 | 935 | ||
1018 | static void scic_sds_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm) | 936 | static void sci_phy_starting_await_sata_power_substate_exit(struct sci_base_state_machine *sm) |
1019 | { | 937 | { |
1020 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 938 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1021 | struct isci_host *ihost = iphy->owning_port->owning_controller; | 939 | struct isci_host *ihost = iphy->owning_port->owning_controller; |
1022 | 940 | ||
1023 | scic_sds_controller_power_control_queue_remove(ihost, iphy); | 941 | sci_controller_power_control_queue_remove(ihost, iphy); |
1024 | } | 942 | } |
1025 | 943 | ||
1026 | static void scic_sds_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm) | 944 | static void sci_phy_starting_await_sata_phy_substate_enter(struct sci_base_state_machine *sm) |
1027 | { | 945 | { |
1028 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 946 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1029 | 947 | ||
1030 | sci_mod_timer(&iphy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); | 948 | sci_mod_timer(&iphy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); |
1031 | } | 949 | } |
1032 | 950 | ||
1033 | static void scic_sds_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm) | 951 | static void sci_phy_starting_await_sata_phy_substate_exit(struct sci_base_state_machine *sm) |
1034 | { | 952 | { |
1035 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 953 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1036 | 954 | ||
1037 | sci_del_timer(&iphy->sata_timer); | 955 | sci_del_timer(&iphy->sata_timer); |
1038 | } | 956 | } |
1039 | 957 | ||
1040 | static void scic_sds_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm) | 958 | static void sci_phy_starting_await_sata_speed_substate_enter(struct sci_base_state_machine *sm) |
1041 | { | 959 | { |
1042 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 960 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1043 | 961 | ||
1044 | sci_mod_timer(&iphy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); | 962 | sci_mod_timer(&iphy->sata_timer, SCIC_SDS_SATA_LINK_TRAINING_TIMEOUT); |
1045 | } | 963 | } |
1046 | 964 | ||
1047 | static void scic_sds_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm) | 965 | static void sci_phy_starting_await_sata_speed_substate_exit(struct sci_base_state_machine *sm) |
1048 | { | 966 | { |
1049 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 967 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1050 | 968 | ||
1051 | sci_del_timer(&iphy->sata_timer); | 969 | sci_del_timer(&iphy->sata_timer); |
1052 | } | 970 | } |
1053 | 971 | ||
1054 | static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm) | 972 | static void sci_phy_starting_await_sig_fis_uf_substate_enter(struct sci_base_state_machine *sm) |
1055 | { | 973 | { |
1056 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 974 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1057 | 975 | ||
1058 | if (scic_sds_port_link_detected(iphy->owning_port, iphy)) { | 976 | if (sci_port_link_detected(iphy->owning_port, iphy)) { |
1059 | 977 | ||
1060 | /* | 978 | /* |
1061 | * Clear the PE suspend condition so we can actually | 979 | * Clear the PE suspend condition so we can actually |
@@ -1063,7 +981,7 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_bas | |||
1063 | * The hardware will not respond to the XRDY until the PE | 981 | * The hardware will not respond to the XRDY until the PE |
1064 | * suspend condition is cleared. | 982 | * suspend condition is cleared. |
1065 | */ | 983 | */ |
1066 | scic_sds_phy_resume(iphy); | 984 | sci_phy_resume(iphy); |
1067 | 985 | ||
1068 | sci_mod_timer(&iphy->sata_timer, | 986 | sci_mod_timer(&iphy->sata_timer, |
1069 | SCIC_SDS_SIGNATURE_FIS_TIMEOUT); | 987 | SCIC_SDS_SIGNATURE_FIS_TIMEOUT); |
@@ -1071,14 +989,14 @@ static void scic_sds_phy_starting_await_sig_fis_uf_substate_enter(struct sci_bas | |||
1071 | iphy->is_in_link_training = false; | 989 | iphy->is_in_link_training = false; |
1072 | } | 990 | } |
1073 | 991 | ||
1074 | static void scic_sds_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base_state_machine *sm) | 992 | static void sci_phy_starting_await_sig_fis_uf_substate_exit(struct sci_base_state_machine *sm) |
1075 | { | 993 | { |
1076 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 994 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1077 | 995 | ||
1078 | sci_del_timer(&iphy->sata_timer); | 996 | sci_del_timer(&iphy->sata_timer); |
1079 | } | 997 | } |
1080 | 998 | ||
1081 | static void scic_sds_phy_starting_final_substate_enter(struct sci_base_state_machine *sm) | 999 | static void sci_phy_starting_final_substate_enter(struct sci_base_state_machine *sm) |
1082 | { | 1000 | { |
1083 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 1001 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1084 | 1002 | ||
@@ -1169,7 +1087,7 @@ static void scu_link_layer_tx_hard_reset( | |||
1169 | &iphy->link_layer_registers->phy_configuration); | 1087 | &iphy->link_layer_registers->phy_configuration); |
1170 | } | 1088 | } |
1171 | 1089 | ||
1172 | static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) | 1090 | static void sci_phy_stopped_state_enter(struct sci_base_state_machine *sm) |
1173 | { | 1091 | { |
1174 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 1092 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1175 | 1093 | ||
@@ -1182,12 +1100,12 @@ static void scic_sds_phy_stopped_state_enter(struct sci_base_state_machine *sm) | |||
1182 | scu_link_layer_stop_protocol_engine(iphy); | 1100 | scu_link_layer_stop_protocol_engine(iphy); |
1183 | 1101 | ||
1184 | if (iphy->sm.previous_state_id != SCI_PHY_INITIAL) | 1102 | if (iphy->sm.previous_state_id != SCI_PHY_INITIAL) |
1185 | scic_sds_controller_link_down(scic_sds_phy_get_controller(iphy), | 1103 | sci_controller_link_down(sci_phy_get_controller(iphy), |
1186 | phy_get_non_dummy_port(iphy), | 1104 | phy_get_non_dummy_port(iphy), |
1187 | iphy); | 1105 | iphy); |
1188 | } | 1106 | } |
1189 | 1107 | ||
1190 | static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm) | 1108 | static void sci_phy_starting_state_enter(struct sci_base_state_machine *sm) |
1191 | { | 1109 | { |
1192 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 1110 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1193 | 1111 | ||
@@ -1199,31 +1117,31 @@ static void scic_sds_phy_starting_state_enter(struct sci_base_state_machine *sm) | |||
1199 | iphy->bcn_received_while_port_unassigned = false; | 1117 | iphy->bcn_received_while_port_unassigned = false; |
1200 | 1118 | ||
1201 | if (iphy->sm.previous_state_id == SCI_PHY_READY) | 1119 | if (iphy->sm.previous_state_id == SCI_PHY_READY) |
1202 | scic_sds_controller_link_down(scic_sds_phy_get_controller(iphy), | 1120 | sci_controller_link_down(sci_phy_get_controller(iphy), |
1203 | phy_get_non_dummy_port(iphy), | 1121 | phy_get_non_dummy_port(iphy), |
1204 | iphy); | 1122 | iphy); |
1205 | 1123 | ||
1206 | sci_change_state(&iphy->sm, SCI_PHY_SUB_INITIAL); | 1124 | sci_change_state(&iphy->sm, SCI_PHY_SUB_INITIAL); |
1207 | } | 1125 | } |
1208 | 1126 | ||
1209 | static void scic_sds_phy_ready_state_enter(struct sci_base_state_machine *sm) | 1127 | static void sci_phy_ready_state_enter(struct sci_base_state_machine *sm) |
1210 | { | 1128 | { |
1211 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 1129 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1212 | 1130 | ||
1213 | scic_sds_controller_link_up(scic_sds_phy_get_controller(iphy), | 1131 | sci_controller_link_up(sci_phy_get_controller(iphy), |
1214 | phy_get_non_dummy_port(iphy), | 1132 | phy_get_non_dummy_port(iphy), |
1215 | iphy); | 1133 | iphy); |
1216 | 1134 | ||
1217 | } | 1135 | } |
1218 | 1136 | ||
1219 | static void scic_sds_phy_ready_state_exit(struct sci_base_state_machine *sm) | 1137 | static void sci_phy_ready_state_exit(struct sci_base_state_machine *sm) |
1220 | { | 1138 | { |
1221 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 1139 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1222 | 1140 | ||
1223 | scic_sds_phy_suspend(iphy); | 1141 | sci_phy_suspend(iphy); |
1224 | } | 1142 | } |
1225 | 1143 | ||
1226 | static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm) | 1144 | static void sci_phy_resetting_state_enter(struct sci_base_state_machine *sm) |
1227 | { | 1145 | { |
1228 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); | 1146 | struct isci_phy *iphy = container_of(sm, typeof(*iphy), sm); |
1229 | 1147 | ||
@@ -1231,7 +1149,7 @@ static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm | |||
1231 | * the resetting state we don't notify the user regarding link up and | 1149 | * the resetting state we don't notify the user regarding link up and |
1232 | * link down notifications | 1150 | * link down notifications |
1233 | */ | 1151 | */ |
1234 | scic_sds_port_deactivate_phy(iphy->owning_port, iphy, false); | 1152 | sci_port_deactivate_phy(iphy->owning_port, iphy, false); |
1235 | 1153 | ||
1236 | if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { | 1154 | if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { |
1237 | scu_link_layer_tx_hard_reset(iphy); | 1155 | scu_link_layer_tx_hard_reset(iphy); |
@@ -1243,57 +1161,57 @@ static void scic_sds_phy_resetting_state_enter(struct sci_base_state_machine *sm | |||
1243 | } | 1161 | } |
1244 | } | 1162 | } |
1245 | 1163 | ||
1246 | static const struct sci_base_state scic_sds_phy_state_table[] = { | 1164 | static const struct sci_base_state sci_phy_state_table[] = { |
1247 | [SCI_PHY_INITIAL] = { }, | 1165 | [SCI_PHY_INITIAL] = { }, |
1248 | [SCI_PHY_STOPPED] = { | 1166 | [SCI_PHY_STOPPED] = { |
1249 | .enter_state = scic_sds_phy_stopped_state_enter, | 1167 | .enter_state = sci_phy_stopped_state_enter, |
1250 | }, | 1168 | }, |
1251 | [SCI_PHY_STARTING] = { | 1169 | [SCI_PHY_STARTING] = { |
1252 | .enter_state = scic_sds_phy_starting_state_enter, | 1170 | .enter_state = sci_phy_starting_state_enter, |
1253 | }, | 1171 | }, |
1254 | [SCI_PHY_SUB_INITIAL] = { | 1172 | [SCI_PHY_SUB_INITIAL] = { |
1255 | .enter_state = scic_sds_phy_starting_initial_substate_enter, | 1173 | .enter_state = sci_phy_starting_initial_substate_enter, |
1256 | }, | 1174 | }, |
1257 | [SCI_PHY_SUB_AWAIT_OSSP_EN] = { }, | 1175 | [SCI_PHY_SUB_AWAIT_OSSP_EN] = { }, |
1258 | [SCI_PHY_SUB_AWAIT_SAS_SPEED_EN] = { }, | 1176 | [SCI_PHY_SUB_AWAIT_SAS_SPEED_EN] = { }, |
1259 | [SCI_PHY_SUB_AWAIT_IAF_UF] = { }, | 1177 | [SCI_PHY_SUB_AWAIT_IAF_UF] = { }, |
1260 | [SCI_PHY_SUB_AWAIT_SAS_POWER] = { | 1178 | [SCI_PHY_SUB_AWAIT_SAS_POWER] = { |
1261 | .enter_state = scic_sds_phy_starting_await_sas_power_substate_enter, | 1179 | .enter_state = sci_phy_starting_await_sas_power_substate_enter, |
1262 | .exit_state = scic_sds_phy_starting_await_sas_power_substate_exit, | 1180 | .exit_state = sci_phy_starting_await_sas_power_substate_exit, |
1263 | }, | 1181 | }, |
1264 | [SCI_PHY_SUB_AWAIT_SATA_POWER] = { | 1182 | [SCI_PHY_SUB_AWAIT_SATA_POWER] = { |
1265 | .enter_state = scic_sds_phy_starting_await_sata_power_substate_enter, | 1183 | .enter_state = sci_phy_starting_await_sata_power_substate_enter, |
1266 | .exit_state = scic_sds_phy_starting_await_sata_power_substate_exit | 1184 | .exit_state = sci_phy_starting_await_sata_power_substate_exit |
1267 | }, | 1185 | }, |
1268 | [SCI_PHY_SUB_AWAIT_SATA_PHY_EN] = { | 1186 | [SCI_PHY_SUB_AWAIT_SATA_PHY_EN] = { |
1269 | .enter_state = scic_sds_phy_starting_await_sata_phy_substate_enter, | 1187 | .enter_state = sci_phy_starting_await_sata_phy_substate_enter, |
1270 | .exit_state = scic_sds_phy_starting_await_sata_phy_substate_exit | 1188 | .exit_state = sci_phy_starting_await_sata_phy_substate_exit |
1271 | }, | 1189 | }, |
1272 | [SCI_PHY_SUB_AWAIT_SATA_SPEED_EN] = { | 1190 | [SCI_PHY_SUB_AWAIT_SATA_SPEED_EN] = { |
1273 | .enter_state = scic_sds_phy_starting_await_sata_speed_substate_enter, | 1191 | .enter_state = sci_phy_starting_await_sata_speed_substate_enter, |
1274 | .exit_state = scic_sds_phy_starting_await_sata_speed_substate_exit | 1192 | .exit_state = sci_phy_starting_await_sata_speed_substate_exit |
1275 | }, | 1193 | }, |
1276 | [SCI_PHY_SUB_AWAIT_SIG_FIS_UF] = { | 1194 | [SCI_PHY_SUB_AWAIT_SIG_FIS_UF] = { |
1277 | .enter_state = scic_sds_phy_starting_await_sig_fis_uf_substate_enter, | 1195 | .enter_state = sci_phy_starting_await_sig_fis_uf_substate_enter, |
1278 | .exit_state = scic_sds_phy_starting_await_sig_fis_uf_substate_exit | 1196 | .exit_state = sci_phy_starting_await_sig_fis_uf_substate_exit |
1279 | }, | 1197 | }, |
1280 | [SCI_PHY_SUB_FINAL] = { | 1198 | [SCI_PHY_SUB_FINAL] = { |
1281 | .enter_state = scic_sds_phy_starting_final_substate_enter, | 1199 | .enter_state = sci_phy_starting_final_substate_enter, |
1282 | }, | 1200 | }, |
1283 | [SCI_PHY_READY] = { | 1201 | [SCI_PHY_READY] = { |
1284 | .enter_state = scic_sds_phy_ready_state_enter, | 1202 | .enter_state = sci_phy_ready_state_enter, |
1285 | .exit_state = scic_sds_phy_ready_state_exit, | 1203 | .exit_state = sci_phy_ready_state_exit, |
1286 | }, | 1204 | }, |
1287 | [SCI_PHY_RESETTING] = { | 1205 | [SCI_PHY_RESETTING] = { |
1288 | .enter_state = scic_sds_phy_resetting_state_enter, | 1206 | .enter_state = sci_phy_resetting_state_enter, |
1289 | }, | 1207 | }, |
1290 | [SCI_PHY_FINAL] = { }, | 1208 | [SCI_PHY_FINAL] = { }, |
1291 | }; | 1209 | }; |
1292 | 1210 | ||
1293 | void scic_sds_phy_construct(struct isci_phy *iphy, | 1211 | void sci_phy_construct(struct isci_phy *iphy, |
1294 | struct isci_port *iport, u8 phy_index) | 1212 | struct isci_port *iport, u8 phy_index) |
1295 | { | 1213 | { |
1296 | sci_init_sm(&iphy->sm, scic_sds_phy_state_table, SCI_PHY_INITIAL); | 1214 | sci_init_sm(&iphy->sm, sci_phy_state_table, SCI_PHY_INITIAL); |
1297 | 1215 | ||
1298 | /* Copy the rest of the input data to our locals */ | 1216 | /* Copy the rest of the input data to our locals */ |
1299 | iphy->owning_port = iport; | 1217 | iphy->owning_port = iport; |
@@ -1309,14 +1227,13 @@ void scic_sds_phy_construct(struct isci_phy *iphy, | |||
1309 | 1227 | ||
1310 | void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index) | 1228 | void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index) |
1311 | { | 1229 | { |
1312 | union scic_oem_parameters oem; | 1230 | struct sci_oem_params *oem = &ihost->oem_parameters; |
1313 | u64 sci_sas_addr; | 1231 | u64 sci_sas_addr; |
1314 | __be64 sas_addr; | 1232 | __be64 sas_addr; |
1315 | 1233 | ||
1316 | scic_oem_parameters_get(ihost, &oem); | 1234 | sci_sas_addr = oem->phys[index].sas_address.high; |
1317 | sci_sas_addr = oem.sds1.phys[index].sas_address.high; | ||
1318 | sci_sas_addr <<= 32; | 1235 | sci_sas_addr <<= 32; |
1319 | sci_sas_addr |= oem.sds1.phys[index].sas_address.low; | 1236 | sci_sas_addr |= oem->phys[index].sas_address.low; |
1320 | sas_addr = cpu_to_be64(sci_sas_addr); | 1237 | sas_addr = cpu_to_be64(sci_sas_addr); |
1321 | memcpy(iphy->sas_addr, &sas_addr, sizeof(sas_addr)); | 1238 | memcpy(iphy->sas_addr, &sas_addr, sizeof(sas_addr)); |
1322 | 1239 | ||
@@ -1365,14 +1282,14 @@ int isci_phy_control(struct asd_sas_phy *sas_phy, | |||
1365 | switch (func) { | 1282 | switch (func) { |
1366 | case PHY_FUNC_DISABLE: | 1283 | case PHY_FUNC_DISABLE: |
1367 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1284 | spin_lock_irqsave(&ihost->scic_lock, flags); |
1368 | scic_sds_phy_stop(iphy); | 1285 | sci_phy_stop(iphy); |
1369 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1286 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1370 | break; | 1287 | break; |
1371 | 1288 | ||
1372 | case PHY_FUNC_LINK_RESET: | 1289 | case PHY_FUNC_LINK_RESET: |
1373 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1290 | spin_lock_irqsave(&ihost->scic_lock, flags); |
1374 | scic_sds_phy_stop(iphy); | 1291 | sci_phy_stop(iphy); |
1375 | scic_sds_phy_start(iphy); | 1292 | sci_phy_start(iphy); |
1376 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1293 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1377 | break; | 1294 | break; |
1378 | 1295 | ||