aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-05-12 07:02:07 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:48 -0400
commit0cf36fa9f1197e669ac6f5efc51d0587bcc95e6e (patch)
tree570d71d24ba7ffe1410bc04f4004f35e94fd09a4 /drivers/scsi/isci
parent931532364e7966f61683bdf40fa1698d6707f523 (diff)
isci: unify phy reset handlers
Unify the implementations in scic_sds_phy_reset(), and kill the state handler Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r--drivers/scsi/isci/phy.c53
-rw-r--r--drivers/scsi/isci/phy.h6
2 files changed, 12 insertions, 47 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index cf8f2e9f6b25..b606e2f317d5 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -490,17 +490,19 @@ enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy)
490 return SCI_SUCCESS; 490 return SCI_SUCCESS;
491} 491}
492 492
493/** 493enum sci_status scic_sds_phy_reset(struct scic_sds_phy *sci_phy)
494 * This method will attempt to reset the phy. This request is only valid when
495 * the phy is in an ready state
496 * @sci_phy:
497 *
498 * enum sci_status
499 */
500enum sci_status scic_sds_phy_reset(
501 struct scic_sds_phy *sci_phy)
502{ 494{
503 return sci_phy->state_handlers->reset_handler(sci_phy); 495 enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id;
496
497 if (state != SCI_BASE_PHY_STATE_READY) {
498 dev_dbg(sciphy_to_dev(sci_phy),
499 "%s: in wrong state: %d\n", __func__, state);
500 return SCI_FAILURE_INVALID_STATE;
501 }
502
503 sci_base_state_machine_change_state(&sci_phy->state_machine,
504 SCI_BASE_PHY_STATE_RESETTING);
505 return SCI_SUCCESS;
504} 506}
505 507
506/** 508/**
@@ -1266,12 +1268,6 @@ static enum sci_status default_phy_handler(struct scic_sds_phy *sci_phy,
1266} 1268}
1267 1269
1268static enum sci_status 1270static enum sci_status
1269scic_sds_phy_default_reset_handler(struct scic_sds_phy *sci_phy)
1270{
1271 return default_phy_handler(sci_phy, __func__);
1272}
1273
1274static enum sci_status
1275scic_sds_phy_default_destroy_handler(struct scic_sds_phy *sci_phy) 1271scic_sds_phy_default_destroy_handler(struct scic_sds_phy *sci_phy)
1276{ 1272{
1277 return default_phy_handler(sci_phy, __func__); 1273 return default_phy_handler(sci_phy, __func__);
@@ -1308,15 +1304,6 @@ scic_sds_phy_stopped_state_destroy_handler(struct scic_sds_phy *sci_phy)
1308 return SCI_SUCCESS; 1304 return SCI_SUCCESS;
1309} 1305}
1310 1306
1311static enum sci_status
1312scic_sds_phy_ready_state_reset_handler(struct scic_sds_phy *sci_phy)
1313{
1314 sci_base_state_machine_change_state(&sci_phy->state_machine,
1315 SCI_BASE_PHY_STATE_RESETTING);
1316
1317 return SCI_SUCCESS;
1318}
1319
1320/** 1307/**
1321 * scic_sds_phy_ready_state_event_handler - 1308 * scic_sds_phy_ready_state_event_handler -
1322 * @phy: This is the struct scic_sds_phy object which has received the event. 1309 * @phy: This is the struct scic_sds_phy object which has received the event.
@@ -1392,112 +1379,96 @@ static enum sci_status scic_sds_phy_resetting_state_event_handler(struct scic_sd
1392 1379
1393static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = { 1380static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = {
1394 [SCI_BASE_PHY_STATE_INITIAL] = { 1381 [SCI_BASE_PHY_STATE_INITIAL] = {
1395 .reset_handler = scic_sds_phy_default_reset_handler,
1396 .destruct_handler = scic_sds_phy_default_destroy_handler, 1382 .destruct_handler = scic_sds_phy_default_destroy_handler,
1397 .frame_handler = scic_sds_phy_default_frame_handler, 1383 .frame_handler = scic_sds_phy_default_frame_handler,
1398 .event_handler = scic_sds_phy_default_event_handler, 1384 .event_handler = scic_sds_phy_default_event_handler,
1399 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1385 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1400 }, 1386 },
1401 [SCI_BASE_PHY_STATE_STOPPED] = { 1387 [SCI_BASE_PHY_STATE_STOPPED] = {
1402 .reset_handler = scic_sds_phy_default_reset_handler,
1403 .destruct_handler = scic_sds_phy_stopped_state_destroy_handler, 1388 .destruct_handler = scic_sds_phy_stopped_state_destroy_handler,
1404 .frame_handler = scic_sds_phy_default_frame_handler, 1389 .frame_handler = scic_sds_phy_default_frame_handler,
1405 .event_handler = scic_sds_phy_default_event_handler, 1390 .event_handler = scic_sds_phy_default_event_handler,
1406 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1391 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1407 }, 1392 },
1408 [SCI_BASE_PHY_STATE_STARTING] = { 1393 [SCI_BASE_PHY_STATE_STARTING] = {
1409 .reset_handler = scic_sds_phy_default_reset_handler,
1410 .destruct_handler = scic_sds_phy_default_destroy_handler, 1394 .destruct_handler = scic_sds_phy_default_destroy_handler,
1411 .frame_handler = scic_sds_phy_default_frame_handler, 1395 .frame_handler = scic_sds_phy_default_frame_handler,
1412 .event_handler = scic_sds_phy_default_event_handler, 1396 .event_handler = scic_sds_phy_default_event_handler,
1413 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1397 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1414 }, 1398 },
1415 [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = { 1399 [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = {
1416 .reset_handler = scic_sds_phy_default_reset_handler,
1417 .destruct_handler = scic_sds_phy_default_destroy_handler, 1400 .destruct_handler = scic_sds_phy_default_destroy_handler,
1418 .frame_handler = scic_sds_phy_default_frame_handler, 1401 .frame_handler = scic_sds_phy_default_frame_handler,
1419 .event_handler = scic_sds_phy_default_event_handler, 1402 .event_handler = scic_sds_phy_default_event_handler,
1420 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1403 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1421 }, 1404 },
1422 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = { 1405 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = {
1423 .reset_handler = scic_sds_phy_default_reset_handler,
1424 .destruct_handler = scic_sds_phy_default_destroy_handler, 1406 .destruct_handler = scic_sds_phy_default_destroy_handler,
1425 .frame_handler = scic_sds_phy_default_frame_handler, 1407 .frame_handler = scic_sds_phy_default_frame_handler,
1426 .event_handler = scic_sds_phy_starting_substate_await_ossp_event_handler, 1408 .event_handler = scic_sds_phy_starting_substate_await_ossp_event_handler,
1427 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1409 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1428 }, 1410 },
1429 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = { 1411 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = {
1430 .reset_handler = scic_sds_phy_default_reset_handler,
1431 .destruct_handler = scic_sds_phy_default_destroy_handler, 1412 .destruct_handler = scic_sds_phy_default_destroy_handler,
1432 .frame_handler = scic_sds_phy_default_frame_handler, 1413 .frame_handler = scic_sds_phy_default_frame_handler,
1433 .event_handler = scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler, 1414 .event_handler = scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler,
1434 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1415 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1435 }, 1416 },
1436 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = { 1417 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = {
1437 .reset_handler = scic_sds_phy_default_reset_handler,
1438 .destruct_handler = scic_sds_phy_default_destroy_handler, 1418 .destruct_handler = scic_sds_phy_default_destroy_handler,
1439 .frame_handler = scic_sds_phy_starting_substate_await_iaf_uf_frame_handler, 1419 .frame_handler = scic_sds_phy_starting_substate_await_iaf_uf_frame_handler,
1440 .event_handler = scic_sds_phy_starting_substate_await_iaf_uf_event_handler, 1420 .event_handler = scic_sds_phy_starting_substate_await_iaf_uf_event_handler,
1441 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1421 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1442 }, 1422 },
1443 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = { 1423 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = {
1444 .reset_handler = scic_sds_phy_default_reset_handler,
1445 .destruct_handler = scic_sds_phy_default_destroy_handler, 1424 .destruct_handler = scic_sds_phy_default_destroy_handler,
1446 .frame_handler = scic_sds_phy_default_frame_handler, 1425 .frame_handler = scic_sds_phy_default_frame_handler,
1447 .event_handler = scic_sds_phy_starting_substate_await_sas_power_event_handler, 1426 .event_handler = scic_sds_phy_starting_substate_await_sas_power_event_handler,
1448 .consume_power_handler = scic_sds_phy_starting_substate_await_sas_power_consume_power_handler 1427 .consume_power_handler = scic_sds_phy_starting_substate_await_sas_power_consume_power_handler
1449 }, 1428 },
1450 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = { 1429 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = {
1451 .reset_handler = scic_sds_phy_default_reset_handler,
1452 .destruct_handler = scic_sds_phy_default_destroy_handler, 1430 .destruct_handler = scic_sds_phy_default_destroy_handler,
1453 .frame_handler = scic_sds_phy_default_frame_handler, 1431 .frame_handler = scic_sds_phy_default_frame_handler,
1454 .event_handler = scic_sds_phy_starting_substate_await_sata_power_event_handler, 1432 .event_handler = scic_sds_phy_starting_substate_await_sata_power_event_handler,
1455 .consume_power_handler = scic_sds_phy_starting_substate_await_sata_power_consume_power_handler 1433 .consume_power_handler = scic_sds_phy_starting_substate_await_sata_power_consume_power_handler
1456 }, 1434 },
1457 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = { 1435 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = {
1458 .reset_handler = scic_sds_phy_default_reset_handler,
1459 .destruct_handler = scic_sds_phy_default_destroy_handler, 1436 .destruct_handler = scic_sds_phy_default_destroy_handler,
1460 .frame_handler = scic_sds_phy_default_frame_handler, 1437 .frame_handler = scic_sds_phy_default_frame_handler,
1461 .event_handler = scic_sds_phy_starting_substate_await_sata_phy_event_handler, 1438 .event_handler = scic_sds_phy_starting_substate_await_sata_phy_event_handler,
1462 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1439 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1463 }, 1440 },
1464 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = { 1441 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = {
1465 .reset_handler = scic_sds_phy_default_reset_handler,
1466 .destruct_handler = scic_sds_phy_default_destroy_handler, 1442 .destruct_handler = scic_sds_phy_default_destroy_handler,
1467 .frame_handler = scic_sds_phy_default_frame_handler, 1443 .frame_handler = scic_sds_phy_default_frame_handler,
1468 .event_handler = scic_sds_phy_starting_substate_await_sata_speed_event_handler, 1444 .event_handler = scic_sds_phy_starting_substate_await_sata_speed_event_handler,
1469 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1445 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1470 }, 1446 },
1471 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = { 1447 [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = {
1472 .reset_handler = scic_sds_phy_default_reset_handler,
1473 .destruct_handler = scic_sds_phy_default_destroy_handler, 1448 .destruct_handler = scic_sds_phy_default_destroy_handler,
1474 .frame_handler = scic_sds_phy_starting_substate_await_sig_fis_frame_handler, 1449 .frame_handler = scic_sds_phy_starting_substate_await_sig_fis_frame_handler,
1475 .event_handler = scic_sds_phy_starting_substate_await_sig_fis_event_handler, 1450 .event_handler = scic_sds_phy_starting_substate_await_sig_fis_event_handler,
1476 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1451 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1477 }, 1452 },
1478 [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = { 1453 [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = {
1479 .reset_handler = scic_sds_phy_default_reset_handler,
1480 .destruct_handler = scic_sds_phy_default_destroy_handler, 1454 .destruct_handler = scic_sds_phy_default_destroy_handler,
1481 .frame_handler = scic_sds_phy_default_frame_handler, 1455 .frame_handler = scic_sds_phy_default_frame_handler,
1482 .event_handler = scic_sds_phy_default_event_handler, 1456 .event_handler = scic_sds_phy_default_event_handler,
1483 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1457 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1484 }, 1458 },
1485 [SCI_BASE_PHY_STATE_READY] = { 1459 [SCI_BASE_PHY_STATE_READY] = {
1486 .reset_handler = scic_sds_phy_ready_state_reset_handler,
1487 .destruct_handler = scic_sds_phy_default_destroy_handler, 1460 .destruct_handler = scic_sds_phy_default_destroy_handler,
1488 .frame_handler = scic_sds_phy_default_frame_handler, 1461 .frame_handler = scic_sds_phy_default_frame_handler,
1489 .event_handler = scic_sds_phy_ready_state_event_handler, 1462 .event_handler = scic_sds_phy_ready_state_event_handler,
1490 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1463 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1491 }, 1464 },
1492 [SCI_BASE_PHY_STATE_RESETTING] = { 1465 [SCI_BASE_PHY_STATE_RESETTING] = {
1493 .reset_handler = scic_sds_phy_default_reset_handler,
1494 .destruct_handler = scic_sds_phy_default_destroy_handler, 1466 .destruct_handler = scic_sds_phy_default_destroy_handler,
1495 .frame_handler = scic_sds_phy_default_frame_handler, 1467 .frame_handler = scic_sds_phy_default_frame_handler,
1496 .event_handler = scic_sds_phy_resetting_state_event_handler, 1468 .event_handler = scic_sds_phy_resetting_state_event_handler,
1497 .consume_power_handler = scic_sds_phy_default_consume_power_handler 1469 .consume_power_handler = scic_sds_phy_default_consume_power_handler
1498 }, 1470 },
1499 [SCI_BASE_PHY_STATE_FINAL] = { 1471 [SCI_BASE_PHY_STATE_FINAL] = {
1500 .reset_handler = scic_sds_phy_default_reset_handler,
1501 .destruct_handler = scic_sds_phy_default_destroy_handler, 1472 .destruct_handler = scic_sds_phy_default_destroy_handler,
1502 .frame_handler = scic_sds_phy_default_frame_handler, 1473 .frame_handler = scic_sds_phy_default_frame_handler,
1503 .event_handler = scic_sds_phy_default_event_handler, 1474 .event_handler = scic_sds_phy_default_event_handler,
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h
index d829e15eed10..56474333dfca 100644
--- a/drivers/scsi/isci/phy.h
+++ b/drivers/scsi/isci/phy.h
@@ -512,12 +512,6 @@ typedef enum sci_status (*scic_sds_phy_power_handler_t)(struct scic_sds_phy *);
512 512
513struct scic_sds_phy_state_handler { 513struct scic_sds_phy_state_handler {
514 /** 514 /**
515 * The reset_handler specifies the method invoked when there is an
516 * attempt to reset a phy.
517 */
518 scic_sds_phy_handler_t reset_handler;
519
520 /**
521 * The destruct_handler specifies the method invoked when attempting to 515 * The destruct_handler specifies the method invoked when attempting to
522 * destruct a phy. 516 * destruct a phy.
523 */ 517 */