aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/isci/core/scic_sds_remote_device.c54
-rw-r--r--drivers/scsi/isci/core/scic_sds_smp_remote_device.c46
-rw-r--r--drivers/scsi/isci/core/scic_sds_stp_remote_device.c101
-rw-r--r--drivers/scsi/isci/remote_device.c22
-rw-r--r--drivers/scsi/isci/remote_device.h9
5 files changed, 92 insertions, 140 deletions
diff --git a/drivers/scsi/isci/core/scic_sds_remote_device.c b/drivers/scsi/isci/core/scic_sds_remote_device.c
index e100fdeee031..a6bcaa15fbf4 100644
--- a/drivers/scsi/isci/core/scic_sds_remote_device.c
+++ b/drivers/scsi/isci/core/scic_sds_remote_device.c
@@ -1513,24 +1513,19 @@ static void scic_sds_remote_device_stopped_state_enter(
1513 * sets the starting state handlers, sets the device not ready, and posts the 1513 * sets the starting state handlers, sets the device not ready, and posts the
1514 * remote node context to the hardware. none 1514 * remote node context to the hardware. none
1515 */ 1515 */
1516static void scic_sds_remote_device_starting_state_enter( 1516static void scic_sds_remote_device_starting_state_enter(struct sci_base_object *object)
1517 struct sci_base_object *object)
1518{ 1517{
1519 struct scic_sds_controller *scic; 1518 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
1520 struct scic_sds_remote_device *sci_dev = 1519 parent.parent);
1521 (struct scic_sds_remote_device *)object; 1520 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
1521 struct isci_host *ihost = sci_object_get_association(scic);
1522 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 1522 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
1523 1523
1524 scic = scic_sds_remote_device_get_controller(sci_dev); 1524 SET_STATE_HANDLER(sci_dev, scic_sds_remote_device_state_handler_table,
1525 1525 SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
1526 SET_STATE_HANDLER(
1527 sci_dev,
1528 scic_sds_remote_device_state_handler_table,
1529 SCI_BASE_REMOTE_DEVICE_STATE_STARTING);
1530 1526
1531 isci_remote_device_not_ready( 1527 isci_remote_device_not_ready(ihost, idev,
1532 idev, 1528 SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED);
1533 SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED);
1534} 1529}
1535 1530
1536static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *object) 1531static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *object)
@@ -1556,14 +1551,13 @@ static void scic_sds_remote_device_starting_state_exit(struct sci_base_object *o
1556 * This is the enter function for the SCI_BASE_REMOTE_DEVICE_STATE_READY it sets 1551 * This is the enter function for the SCI_BASE_REMOTE_DEVICE_STATE_READY it sets
1557 * the ready state handlers, and starts the ready substate machine. none 1552 * the ready state handlers, and starts the ready substate machine. none
1558 */ 1553 */
1559static void scic_sds_remote_device_ready_state_enter( 1554static void scic_sds_remote_device_ready_state_enter(struct sci_base_object *object)
1560 struct sci_base_object *object)
1561{ 1555{
1562 struct scic_sds_remote_device *sci_dev = 1556 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
1563 (struct scic_sds_remote_device *)object; 1557 parent.parent);
1558 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
1559 struct isci_host *ihost = sci_object_get_association(scic);
1564 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 1560 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
1565 struct scic_sds_controller *scic
1566 = scic_sds_remote_device_get_controller(sci_dev);
1567 1561
1568 SET_STATE_HANDLER(sci_dev, 1562 SET_STATE_HANDLER(sci_dev,
1569 scic_sds_remote_device_state_handler_table, 1563 scic_sds_remote_device_state_handler_table,
@@ -1574,7 +1568,7 @@ static void scic_sds_remote_device_ready_state_enter(
1574 if (sci_dev->has_ready_substate_machine) 1568 if (sci_dev->has_ready_substate_machine)
1575 sci_base_state_machine_start(&sci_dev->ready_substate_machine); 1569 sci_base_state_machine_start(&sci_dev->ready_substate_machine);
1576 else 1570 else
1577 isci_remote_device_ready(idev); 1571 isci_remote_device_ready(ihost, idev);
1578} 1572}
1579 1573
1580/** 1574/**
@@ -1588,16 +1582,18 @@ static void scic_sds_remote_device_ready_state_enter(
1588static void scic_sds_remote_device_ready_state_exit( 1582static void scic_sds_remote_device_ready_state_exit(
1589 struct sci_base_object *object) 1583 struct sci_base_object *object)
1590{ 1584{
1591 struct scic_sds_remote_device *sci_dev = 1585 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
1592 (struct scic_sds_remote_device *)object; 1586 parent.parent);
1593 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
1594
1595 if (sci_dev->has_ready_substate_machine) 1587 if (sci_dev->has_ready_substate_machine)
1596 sci_base_state_machine_stop(&sci_dev->ready_substate_machine); 1588 sci_base_state_machine_stop(&sci_dev->ready_substate_machine);
1597 else 1589 else {
1598 isci_remote_device_not_ready( 1590 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
1599 idev, 1591 struct isci_host *ihost = sci_object_get_association(scic);
1600 SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED); 1592 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
1593
1594 isci_remote_device_not_ready(ihost, idev,
1595 SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED);
1596 }
1601} 1597}
1602 1598
1603/** 1599/**
diff --git a/drivers/scsi/isci/core/scic_sds_smp_remote_device.c b/drivers/scsi/isci/core/scic_sds_smp_remote_device.c
index 55202481e091..06cb93221b4c 100644
--- a/drivers/scsi/isci/core/scic_sds_smp_remote_device.c
+++ b/drivers/scsi/isci/core/scic_sds_smp_remote_device.c
@@ -253,20 +253,19 @@ static const struct scic_sds_remote_device_state_handler scic_sds_smp_remote_dev
253 * This function sets the ready cmd substate handlers and reports the device as 253 * This function sets the ready cmd substate handlers and reports the device as
254 * ready. none 254 * ready. none
255 */ 255 */
256static inline void scic_sds_smp_remote_device_ready_idle_substate_enter( 256static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_object *object)
257 struct sci_base_object *object)
258{ 257{
259 struct scic_sds_remote_device *sci_dev = 258 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
260 (struct scic_sds_remote_device *)object; 259 parent.parent);
260 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
261 struct isci_host *ihost = sci_object_get_association(scic);
261 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 262 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
262 263
264 SET_STATE_HANDLER(sci_dev,
265 scic_sds_smp_remote_device_ready_substate_handler_table,
266 SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
263 267
264 SET_STATE_HANDLER( 268 isci_remote_device_ready(ihost, idev);
265 sci_dev,
266 scic_sds_smp_remote_device_ready_substate_handler_table,
267 SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE);
268
269 isci_remote_device_ready(idev);
270} 269}
271 270
272/** 271/**
@@ -281,20 +280,20 @@ static inline void scic_sds_smp_remote_device_ready_idle_substate_enter(
281static void scic_sds_smp_remote_device_ready_cmd_substate_enter( 280static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
282 struct sci_base_object *object) 281 struct sci_base_object *object)
283{ 282{
284 struct scic_sds_remote_device *sci_dev = 283 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
285 (struct scic_sds_remote_device *)object; 284 parent.parent);
285 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
286 struct isci_host *ihost = sci_object_get_association(scic);
286 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 287 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
287 288
288 BUG_ON(sci_dev->working_request == NULL); 289 BUG_ON(sci_dev->working_request == NULL);
289 290
290 SET_STATE_HANDLER( 291 SET_STATE_HANDLER(sci_dev,
291 sci_dev, 292 scic_sds_smp_remote_device_ready_substate_handler_table,
292 scic_sds_smp_remote_device_ready_substate_handler_table, 293 SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
293 SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
294 294
295 isci_remote_device_not_ready( 295 isci_remote_device_not_ready(ihost, idev,
296 idev, 296 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
297 SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED);
298} 297}
299 298
300/** 299/**
@@ -304,12 +303,11 @@ static void scic_sds_smp_remote_device_ready_cmd_substate_enter(
304 * 303 *
305 * This is the SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_CMD exit method. none 304 * This is the SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_CMD exit method. none
306 */ 305 */
307static void scic_sds_smp_remote_device_ready_cmd_substate_exit( 306static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_object *object)
308 struct sci_base_object *object)
309{ 307{
310 struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object; 308 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
311 309 parent.parent);
312 this_device->working_request = NULL; 310 sci_dev->working_request = NULL;
313} 311}
314 312
315/* --------------------------------------------------------------------------- */ 313/* --------------------------------------------------------------------------- */
diff --git a/drivers/scsi/isci/core/scic_sds_stp_remote_device.c b/drivers/scsi/isci/core/scic_sds_stp_remote_device.c
index 193a95fa90e1..0a00a40bdbbe 100644
--- a/drivers/scsi/isci/core/scic_sds_stp_remote_device.c
+++ b/drivers/scsi/isci/core/scic_sds_stp_remote_device.c
@@ -677,13 +677,13 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev
677 * * STP REMOTE DEVICE READY SUBSTATE PRIVATE METHODS 677 * * STP REMOTE DEVICE READY SUBSTATE PRIVATE METHODS
678 * ***************************************************************************** */ 678 * ***************************************************************************** */
679 679
680static inline void 680static void
681scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler( 681scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *user_cookie)
682 void *user_cookie)
683{ 682{
684 struct scic_sds_remote_device *sci_dev = 683 struct scic_sds_remote_device *sci_dev = user_cookie;
685 (struct scic_sds_remote_device *)user_cookie;
686 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 684 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
685 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
686 struct isci_host *ihost = sci_object_get_association(scic);
687 687
688 /* 688 /*
689 * For NCQ operation we do not issue a 689 * For NCQ operation we do not issue a
@@ -692,7 +692,7 @@ scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(
692 */ 692 */
693 if (sci_dev->ready_substate_machine.previous_state_id != 693 if (sci_dev->ready_substate_machine.previous_state_id !=
694 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ) 694 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ)
695 isci_remote_device_ready(idev); 695 isci_remote_device_ready(ihost, idev);
696} 696}
697 697
698/* 698/*
@@ -737,87 +737,48 @@ static void scic_sds_stp_remote_device_ready_idle_substate_enter(
737 } 737 }
738} 738}
739 739
740/* 740static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_object *object)
741 * *****************************************************************************
742 * * STP REMOTE DEVICE READY CMD SUBSTATE
743 * ***************************************************************************** */
744
745/**
746 *
747 * @device: This is the SCI base object which is cast into a
748 * struct scic_sds_remote_device object.
749 *
750 */
751static inline void scic_sds_stp_remote_device_ready_cmd_substate_enter(
752 struct sci_base_object *device)
753{ 741{
754 struct scic_sds_remote_device *sci_dev = 742 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
755 (struct scic_sds_remote_device *)device; 743 parent.parent);
744 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
745 struct isci_host *ihost = sci_object_get_association(scic);
756 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 746 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
757 747
758 BUG_ON(sci_dev->working_request == NULL); 748 BUG_ON(sci_dev->working_request == NULL);
759 749
760 SET_STATE_HANDLER( 750 SET_STATE_HANDLER(sci_dev,
761 sci_dev, 751 scic_sds_stp_remote_device_ready_substate_handler_table,
762 scic_sds_stp_remote_device_ready_substate_handler_table, 752 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
763 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD);
764 753
765 isci_remote_device_not_ready( 754 isci_remote_device_not_ready(ihost, idev,
766 idev, 755 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
767 SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED);
768} 756}
769 757
770/* 758static void scic_sds_stp_remote_device_ready_ncq_substate_enter(struct sci_base_object *object)
771 * *****************************************************************************
772 * * STP REMOTE DEVICE READY NCQ SUBSTATE
773 * ***************************************************************************** */
774
775/**
776 *
777 * @device: This is the SCI base object which is cast into a
778 * struct scic_sds_remote_device object.
779 *
780 */
781static void scic_sds_stp_remote_device_ready_ncq_substate_enter(
782 struct sci_base_object *device)
783{ 759{
784 struct scic_sds_remote_device *this_device; 760 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
785 761 parent.parent);
786 this_device = (struct scic_sds_remote_device *)device; 762 SET_STATE_HANDLER(sci_dev,
787 763 scic_sds_stp_remote_device_ready_substate_handler_table,
788 SET_STATE_HANDLER( 764 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ);
789 this_device,
790 scic_sds_stp_remote_device_ready_substate_handler_table,
791 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ
792 );
793} 765}
794 766
795/* 767static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_object *object)
796 * *****************************************************************************
797 * * STP REMOTE DEVICE READY NCQ ERROR SUBSTATE
798 * ***************************************************************************** */
799
800/**
801 *
802 * @device: This is the SCI base object which is cast into a
803 * struct scic_sds_remote_device object.
804 *
805 */
806static inline void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(
807 struct sci_base_object *device)
808{ 768{
809 struct scic_sds_remote_device *sci_dev = 769 struct scic_sds_remote_device *sci_dev = container_of(object, typeof(*sci_dev),
810 (struct scic_sds_remote_device *)device; 770 parent.parent);
771 struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev);
772 struct isci_host *ihost = sci_object_get_association(scic);
811 struct isci_remote_device *idev = sci_object_get_association(sci_dev); 773 struct isci_remote_device *idev = sci_object_get_association(sci_dev);
812 774
813 SET_STATE_HANDLER( 775 SET_STATE_HANDLER(sci_dev,
814 sci_dev, 776 scic_sds_stp_remote_device_ready_substate_handler_table,
815 scic_sds_stp_remote_device_ready_substate_handler_table, 777 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR);
816 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR);
817 778
818 if (sci_dev->not_ready_reason == 779 if (sci_dev->not_ready_reason ==
819 SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) 780 SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED)
820 isci_remote_device_not_ready(idev, sci_dev->not_ready_reason); 781 isci_remote_device_not_ready(ihost, idev, sci_dev->not_ready_reason);
821} 782}
822 783
823/* 784/*
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 6fe6815e4b74..0fdaa6d62c1b 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -281,13 +281,12 @@ isci_remote_device_alloc(struct isci_host *ihost, struct isci_port *iport)
281 * isci_remote_device_ready() - This function is called by the scic when the 281 * isci_remote_device_ready() - This function is called by the scic when the
282 * remote device is ready. We mark the isci device as ready and signal the 282 * remote device is ready. We mark the isci device as ready and signal the
283 * waiting proccess. 283 * waiting proccess.
284 * @idev: This parameter specifies the remote device 284 * @ihost: our valid isci_host
285 * @idev: remote device
285 * 286 *
286 */ 287 */
287void isci_remote_device_ready(struct isci_remote_device *idev) 288void isci_remote_device_ready(struct isci_host *ihost, struct isci_remote_device *idev)
288{ 289{
289 struct isci_host *ihost = idev->isci_port->isci_host;
290
291 dev_dbg(&ihost->pdev->dev, 290 dev_dbg(&ihost->pdev->dev,
292 "%s: idev = %p\n", __func__, idev); 291 "%s: idev = %p\n", __func__, idev);
293 292
@@ -304,18 +303,17 @@ void isci_remote_device_ready(struct isci_remote_device *idev)
304 * @isci_device: This parameter specifies the remote device 303 * @isci_device: This parameter specifies the remote device
305 * 304 *
306 */ 305 */
307void isci_remote_device_not_ready( 306void isci_remote_device_not_ready(struct isci_host *ihost,
308 struct isci_remote_device *isci_device, 307 struct isci_remote_device *idev, u32 reason)
309 u32 reason_code)
310{ 308{
311 dev_dbg(&isci_device->isci_port->isci_host->pdev->dev, 309 dev_dbg(&ihost->pdev->dev,
312 "%s: isci_device = %p\n", __func__, isci_device); 310 "%s: isci_device = %p\n", __func__, idev);
313 311
314 if (reason_code == SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED) 312 if (reason == SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED)
315 isci_remote_device_change_state(isci_device, isci_stopping); 313 isci_remote_device_change_state(idev, isci_stopping);
316 else 314 else
317 /* device ready is actually a "not ready for io" state. */ 315 /* device ready is actually a "not ready for io" state. */
318 isci_remote_device_change_state(isci_device, isci_ready); 316 isci_remote_device_change_state(idev, isci_ready);
319} 317}
320 318
321/** 319/**
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h
index f45a5f064fce..cf5302abb8b2 100644
--- a/drivers/scsi/isci/remote_device.h
+++ b/drivers/scsi/isci/remote_device.h
@@ -109,12 +109,11 @@ enum sci_status isci_remote_device_stop(struct isci_host *ihost,
109void isci_remote_device_nuke_requests( 109void isci_remote_device_nuke_requests(
110 struct isci_remote_device *isci_device); 110 struct isci_remote_device *isci_device);
111 111
112void isci_remote_device_ready( 112void isci_remote_device_ready(struct isci_host *ihost,
113 struct isci_remote_device *); 113 struct isci_remote_device *idev);
114 114
115void isci_remote_device_not_ready( 115void isci_remote_device_not_ready(struct isci_host *ihost,
116 struct isci_remote_device *, 116 struct isci_remote_device *idev, u32 reason);
117 u32);
118 117
119void isci_remote_device_gone( 118void isci_remote_device_gone(
120 struct domain_device *domain_dev); 119 struct domain_device *domain_dev);