diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-12 06:44:24 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:48 -0400 |
commit | 966699b50c61940e06ff39fb1085bea813f9a51d (patch) | |
tree | e9b7e4fe56a5334ed99964fc931695b0a6368b3f | |
parent | 4a33c525f0e94b57602abd1e43644cbf6f5418f4 (diff) |
isci: unify phy start handlers
Implement all handlers in scic_sds_phy_start(), and kill the state handler
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/phy.c | 74 | ||||
-rw-r--r-- | drivers/scsi/isci/phy.h | 6 |
2 files changed, 19 insertions, 61 deletions
diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c index e5ae676926f2..7cae192a2a30 100644 --- a/drivers/scsi/isci/phy.c +++ b/drivers/scsi/isci/phy.c | |||
@@ -440,16 +440,27 @@ void scic_sds_phy_get_protocols(struct scic_sds_phy *sci_phy, | |||
440 | 0x0000FFFF); | 440 | 0x0000FFFF); |
441 | } | 441 | } |
442 | 442 | ||
443 | /** | ||
444 | * This method will attempt to start the phy object. This request is only valid | ||
445 | * when the phy is in the stopped state | ||
446 | * @sci_phy: | ||
447 | * | ||
448 | * enum sci_status | ||
449 | */ | ||
450 | enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy) | 443 | enum sci_status scic_sds_phy_start(struct scic_sds_phy *sci_phy) |
451 | { | 444 | { |
452 | return sci_phy->state_handlers->start_handler(sci_phy); | 445 | struct scic_sds_controller *scic = sci_phy->owning_port->owning_controller; |
446 | enum scic_sds_phy_states state = sci_phy->state_machine.current_state_id; | ||
447 | struct isci_host *ihost = scic_to_ihost(scic); | ||
448 | |||
449 | if (state != SCI_BASE_PHY_STATE_STOPPED) { | ||
450 | dev_dbg(sciphy_to_dev(sci_phy), | ||
451 | "%s: in wrong state: %d\n", __func__, state); | ||
452 | return SCI_FAILURE_INVALID_STATE; | ||
453 | } | ||
454 | |||
455 | /* Create the SIGNATURE FIS Timeout timer for this phy */ | ||
456 | sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy, | ||
457 | scic_sds_phy_sata_timeout); | ||
458 | |||
459 | if (sci_phy->sata_timeout_timer) | ||
460 | sci_base_state_machine_change_state(&sci_phy->state_machine, | ||
461 | SCI_BASE_PHY_STATE_STARTING); | ||
462 | |||
463 | return SCI_SUCCESS; | ||
453 | } | 464 | } |
454 | 465 | ||
455 | /** | 466 | /** |
@@ -1257,12 +1268,6 @@ static enum sci_status default_phy_handler(struct scic_sds_phy *sci_phy, | |||
1257 | } | 1268 | } |
1258 | 1269 | ||
1259 | static enum sci_status | 1270 | static enum sci_status |
1260 | scic_sds_phy_default_start_handler(struct scic_sds_phy *sci_phy) | ||
1261 | { | ||
1262 | return default_phy_handler(sci_phy, __func__); | ||
1263 | } | ||
1264 | |||
1265 | static enum sci_status | ||
1266 | scic_sds_phy_default_stop_handler(struct scic_sds_phy *sci_phy) | 1271 | scic_sds_phy_default_stop_handler(struct scic_sds_phy *sci_phy) |
1267 | { | 1272 | { |
1268 | return default_phy_handler(sci_phy, __func__); | 1273 | return default_phy_handler(sci_phy, __func__); |
@@ -1305,31 +1310,6 @@ scic_sds_phy_default_consume_power_handler(struct scic_sds_phy *sci_phy) | |||
1305 | return default_phy_handler(sci_phy, __func__); | 1310 | return default_phy_handler(sci_phy, __func__); |
1306 | } | 1311 | } |
1307 | 1312 | ||
1308 | /* | ||
1309 | * This method takes the struct scic_sds_phy from a stopped state and | ||
1310 | * attempts to start it. - The phy state machine is transitioned to the | ||
1311 | * SCI_BASE_PHY_STATE_STARTING. enum sci_status SCI_SUCCESS | ||
1312 | */ | ||
1313 | static enum sci_status | ||
1314 | scic_sds_phy_stopped_state_start_handler(struct scic_sds_phy *sci_phy) | ||
1315 | { | ||
1316 | struct isci_host *ihost; | ||
1317 | struct scic_sds_controller *scic; | ||
1318 | |||
1319 | scic = scic_sds_phy_get_controller(sci_phy), | ||
1320 | ihost = scic_to_ihost(scic); | ||
1321 | |||
1322 | /* Create the SIGNATURE FIS Timeout timer for this phy */ | ||
1323 | sci_phy->sata_timeout_timer = isci_timer_create(ihost, sci_phy, | ||
1324 | scic_sds_phy_sata_timeout); | ||
1325 | |||
1326 | if (sci_phy->sata_timeout_timer) | ||
1327 | sci_base_state_machine_change_state(&sci_phy->state_machine, | ||
1328 | SCI_BASE_PHY_STATE_STARTING); | ||
1329 | |||
1330 | return SCI_SUCCESS; | ||
1331 | } | ||
1332 | |||
1333 | static enum sci_status | 1313 | static enum sci_status |
1334 | scic_sds_phy_stopped_state_destroy_handler(struct scic_sds_phy *sci_phy) | 1314 | scic_sds_phy_stopped_state_destroy_handler(struct scic_sds_phy *sci_phy) |
1335 | { | 1315 | { |
@@ -1429,7 +1409,6 @@ static enum sci_status scic_sds_phy_resetting_state_event_handler(struct scic_sd | |||
1429 | 1409 | ||
1430 | static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = { | 1410 | static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[] = { |
1431 | [SCI_BASE_PHY_STATE_INITIAL] = { | 1411 | [SCI_BASE_PHY_STATE_INITIAL] = { |
1432 | .start_handler = scic_sds_phy_default_start_handler, | ||
1433 | .stop_handler = scic_sds_phy_default_stop_handler, | 1412 | .stop_handler = scic_sds_phy_default_stop_handler, |
1434 | .reset_handler = scic_sds_phy_default_reset_handler, | 1413 | .reset_handler = scic_sds_phy_default_reset_handler, |
1435 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1414 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1438,7 +1417,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1438 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1417 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1439 | }, | 1418 | }, |
1440 | [SCI_BASE_PHY_STATE_STOPPED] = { | 1419 | [SCI_BASE_PHY_STATE_STOPPED] = { |
1441 | .start_handler = scic_sds_phy_stopped_state_start_handler, | ||
1442 | .stop_handler = scic_sds_phy_default_stop_handler, | 1420 | .stop_handler = scic_sds_phy_default_stop_handler, |
1443 | .reset_handler = scic_sds_phy_default_reset_handler, | 1421 | .reset_handler = scic_sds_phy_default_reset_handler, |
1444 | .destruct_handler = scic_sds_phy_stopped_state_destroy_handler, | 1422 | .destruct_handler = scic_sds_phy_stopped_state_destroy_handler, |
@@ -1447,7 +1425,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1447 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1425 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1448 | }, | 1426 | }, |
1449 | [SCI_BASE_PHY_STATE_STARTING] = { | 1427 | [SCI_BASE_PHY_STATE_STARTING] = { |
1450 | .start_handler = scic_sds_phy_default_start_handler, | ||
1451 | .stop_handler = scic_sds_phy_default_stop_handler, | 1428 | .stop_handler = scic_sds_phy_default_stop_handler, |
1452 | .reset_handler = scic_sds_phy_default_reset_handler, | 1429 | .reset_handler = scic_sds_phy_default_reset_handler, |
1453 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1430 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1456,7 +1433,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1456 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1433 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1457 | }, | 1434 | }, |
1458 | [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = { | 1435 | [SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL] = { |
1459 | .start_handler = scic_sds_phy_default_start_handler, | ||
1460 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1436 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1461 | .reset_handler = scic_sds_phy_default_reset_handler, | 1437 | .reset_handler = scic_sds_phy_default_reset_handler, |
1462 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1438 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1465,7 +1441,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1465 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1441 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1466 | }, | 1442 | }, |
1467 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = { | 1443 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN] = { |
1468 | .start_handler = scic_sds_phy_default_start_handler, | ||
1469 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1444 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1470 | .reset_handler = scic_sds_phy_default_reset_handler, | 1445 | .reset_handler = scic_sds_phy_default_reset_handler, |
1471 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1446 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1474,7 +1449,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1474 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1449 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1475 | }, | 1450 | }, |
1476 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = { | 1451 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN] = { |
1477 | .start_handler = scic_sds_phy_default_start_handler, | ||
1478 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1452 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1479 | .reset_handler = scic_sds_phy_default_reset_handler, | 1453 | .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, |
@@ -1483,7 +1457,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
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 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = { | 1459 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF] = { |
1486 | .start_handler = scic_sds_phy_default_start_handler, | ||
1487 | .stop_handler = scic_sds_phy_default_stop_handler, | 1460 | .stop_handler = scic_sds_phy_default_stop_handler, |
1488 | .reset_handler = scic_sds_phy_default_reset_handler, | 1461 | .reset_handler = scic_sds_phy_default_reset_handler, |
1489 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1462 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1492,7 +1465,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1492 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1465 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1493 | }, | 1466 | }, |
1494 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = { | 1467 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER] = { |
1495 | .start_handler = scic_sds_phy_default_start_handler, | ||
1496 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1468 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1497 | .reset_handler = scic_sds_phy_default_reset_handler, | 1469 | .reset_handler = scic_sds_phy_default_reset_handler, |
1498 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1470 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1501,7 +1473,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1501 | .consume_power_handler = scic_sds_phy_starting_substate_await_sas_power_consume_power_handler | 1473 | .consume_power_handler = scic_sds_phy_starting_substate_await_sas_power_consume_power_handler |
1502 | }, | 1474 | }, |
1503 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = { | 1475 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER] = { |
1504 | .start_handler = scic_sds_phy_default_start_handler, | ||
1505 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1476 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1506 | .reset_handler = scic_sds_phy_default_reset_handler, | 1477 | .reset_handler = scic_sds_phy_default_reset_handler, |
1507 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1478 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1510,7 +1481,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1510 | .consume_power_handler = scic_sds_phy_starting_substate_await_sata_power_consume_power_handler | 1481 | .consume_power_handler = scic_sds_phy_starting_substate_await_sata_power_consume_power_handler |
1511 | }, | 1482 | }, |
1512 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = { | 1483 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_PHY_EN] = { |
1513 | .start_handler = scic_sds_phy_default_start_handler, | ||
1514 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1484 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1515 | .reset_handler = scic_sds_phy_default_reset_handler, | 1485 | .reset_handler = scic_sds_phy_default_reset_handler, |
1516 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1486 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1519,7 +1489,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1519 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1489 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1520 | }, | 1490 | }, |
1521 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = { | 1491 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_SPEED_EN] = { |
1522 | .start_handler = scic_sds_phy_default_start_handler, | ||
1523 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1492 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1524 | .reset_handler = scic_sds_phy_default_reset_handler, | 1493 | .reset_handler = scic_sds_phy_default_reset_handler, |
1525 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1494 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1528,7 +1497,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1528 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1497 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1529 | }, | 1498 | }, |
1530 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = { | 1499 | [SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF] = { |
1531 | .start_handler = scic_sds_phy_default_start_handler, | ||
1532 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1500 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1533 | .reset_handler = scic_sds_phy_default_reset_handler, | 1501 | .reset_handler = scic_sds_phy_default_reset_handler, |
1534 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1502 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1537,7 +1505,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1537 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1505 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1538 | }, | 1506 | }, |
1539 | [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = { | 1507 | [SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL] = { |
1540 | .start_handler = scic_sds_phy_default_start_handler, | ||
1541 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, | 1508 | .stop_handler = scic_sds_phy_starting_substate_general_stop_handler, |
1542 | .reset_handler = scic_sds_phy_default_reset_handler, | 1509 | .reset_handler = scic_sds_phy_default_reset_handler, |
1543 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1510 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1546,7 +1513,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1546 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1513 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1547 | }, | 1514 | }, |
1548 | [SCI_BASE_PHY_STATE_READY] = { | 1515 | [SCI_BASE_PHY_STATE_READY] = { |
1549 | .start_handler = scic_sds_phy_default_start_handler, | ||
1550 | .stop_handler = scic_sds_phy_ready_state_stop_handler, | 1516 | .stop_handler = scic_sds_phy_ready_state_stop_handler, |
1551 | .reset_handler = scic_sds_phy_ready_state_reset_handler, | 1517 | .reset_handler = scic_sds_phy_ready_state_reset_handler, |
1552 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1518 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1555,7 +1521,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1555 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1521 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1556 | }, | 1522 | }, |
1557 | [SCI_BASE_PHY_STATE_RESETTING] = { | 1523 | [SCI_BASE_PHY_STATE_RESETTING] = { |
1558 | .start_handler = scic_sds_phy_default_start_handler, | ||
1559 | .stop_handler = scic_sds_phy_default_stop_handler, | 1524 | .stop_handler = scic_sds_phy_default_stop_handler, |
1560 | .reset_handler = scic_sds_phy_default_reset_handler, | 1525 | .reset_handler = scic_sds_phy_default_reset_handler, |
1561 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1526 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
@@ -1564,7 +1529,6 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ | |||
1564 | .consume_power_handler = scic_sds_phy_default_consume_power_handler | 1529 | .consume_power_handler = scic_sds_phy_default_consume_power_handler |
1565 | }, | 1530 | }, |
1566 | [SCI_BASE_PHY_STATE_FINAL] = { | 1531 | [SCI_BASE_PHY_STATE_FINAL] = { |
1567 | .start_handler = scic_sds_phy_default_start_handler, | ||
1568 | .stop_handler = scic_sds_phy_default_stop_handler, | 1532 | .stop_handler = scic_sds_phy_default_stop_handler, |
1569 | .reset_handler = scic_sds_phy_default_reset_handler, | 1533 | .reset_handler = scic_sds_phy_default_reset_handler, |
1570 | .destruct_handler = scic_sds_phy_default_destroy_handler, | 1534 | .destruct_handler = scic_sds_phy_default_destroy_handler, |
diff --git a/drivers/scsi/isci/phy.h b/drivers/scsi/isci/phy.h index bf0296463c80..9b7d54e64e8f 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 | ||
513 | struct scic_sds_phy_state_handler { | 513 | struct scic_sds_phy_state_handler { |
514 | /** | 514 | /** |
515 | * The start_handler specifies the method invoked when there is an | ||
516 | * attempt to start a phy. | ||
517 | */ | ||
518 | scic_sds_phy_handler_t start_handler; | ||
519 | |||
520 | /** | ||
521 | * The stop_handler specifies the method invoked when there is an | 515 | * The stop_handler specifies the method invoked when there is an |
522 | * attempt to stop a phy. | 516 | * attempt to stop a phy. |
523 | */ | 517 | */ |