diff options
author | Dan Williams <dan.j.williams@intel.com> | 2012-02-10 04:18:44 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-29 17:23:15 -0500 |
commit | d7a0ccdd9bd78b5b74d2963ec7ab67c9d896902a (patch) | |
tree | 9fc59d3303e7453006c767b0f4daadbf3d4ed5c1 /drivers/scsi/isci/port.c | |
parent | 16d3db1b298529e6aec4a4cf0f56225d9e0bc641 (diff) |
[SCSI] isci: debug, provide state-enum-to-string conversions
Debugging the driver requires tracing the state transtions and tracing
state names is less work than decoding numbers.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/isci/port.c')
-rw-r--r-- | drivers/scsi/isci/port.c | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index c5ae94dbef48..5fada73b71ff 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -60,6 +60,16 @@ | |||
60 | #define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000) | 60 | #define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000) |
61 | #define SCU_DUMMY_INDEX (0xFFFF) | 61 | #define SCU_DUMMY_INDEX (0xFFFF) |
62 | 62 | ||
63 | #undef C | ||
64 | #define C(a) (#a) | ||
65 | const char *port_state_name(enum sci_port_states state) | ||
66 | { | ||
67 | static const char * const strings[] = PORT_STATES; | ||
68 | |||
69 | return strings[state]; | ||
70 | } | ||
71 | #undef C | ||
72 | |||
63 | static struct device *sciport_to_dev(struct isci_port *iport) | 73 | static struct device *sciport_to_dev(struct isci_port *iport) |
64 | { | 74 | { |
65 | int i = iport->physical_port_index; | 75 | int i = iport->physical_port_index; |
@@ -1054,8 +1064,8 @@ enum sci_status sci_port_start(struct isci_port *iport) | |||
1054 | 1064 | ||
1055 | state = iport->sm.current_state_id; | 1065 | state = iport->sm.current_state_id; |
1056 | if (state != SCI_PORT_STOPPED) { | 1066 | if (state != SCI_PORT_STOPPED) { |
1057 | dev_warn(sciport_to_dev(iport), | 1067 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1058 | "%s: in wrong state: %d\n", __func__, state); | 1068 | __func__, port_state_name(state)); |
1059 | return SCI_FAILURE_INVALID_STATE; | 1069 | return SCI_FAILURE_INVALID_STATE; |
1060 | } | 1070 | } |
1061 | 1071 | ||
@@ -1129,8 +1139,8 @@ enum sci_status sci_port_stop(struct isci_port *iport) | |||
1129 | SCI_PORT_STOPPING); | 1139 | SCI_PORT_STOPPING); |
1130 | return SCI_SUCCESS; | 1140 | return SCI_SUCCESS; |
1131 | default: | 1141 | default: |
1132 | dev_warn(sciport_to_dev(iport), | 1142 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1133 | "%s: in wrong state: %d\n", __func__, state); | 1143 | __func__, port_state_name(state)); |
1134 | return SCI_FAILURE_INVALID_STATE; | 1144 | return SCI_FAILURE_INVALID_STATE; |
1135 | } | 1145 | } |
1136 | } | 1146 | } |
@@ -1144,8 +1154,8 @@ static enum sci_status sci_port_hard_reset(struct isci_port *iport, u32 timeout) | |||
1144 | 1154 | ||
1145 | state = iport->sm.current_state_id; | 1155 | state = iport->sm.current_state_id; |
1146 | if (state != SCI_PORT_SUB_OPERATIONAL) { | 1156 | if (state != SCI_PORT_SUB_OPERATIONAL) { |
1147 | dev_warn(sciport_to_dev(iport), | 1157 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1148 | "%s: in wrong state: %d\n", __func__, state); | 1158 | __func__, port_state_name(state)); |
1149 | return SCI_FAILURE_INVALID_STATE; | 1159 | return SCI_FAILURE_INVALID_STATE; |
1150 | } | 1160 | } |
1151 | 1161 | ||
@@ -1239,8 +1249,8 @@ enum sci_status sci_port_add_phy(struct isci_port *iport, | |||
1239 | SCI_PORT_SUB_CONFIGURING); | 1249 | SCI_PORT_SUB_CONFIGURING); |
1240 | return SCI_SUCCESS; | 1250 | return SCI_SUCCESS; |
1241 | default: | 1251 | default: |
1242 | dev_warn(sciport_to_dev(iport), | 1252 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1243 | "%s: in wrong state: %d\n", __func__, state); | 1253 | __func__, port_state_name(state)); |
1244 | return SCI_FAILURE_INVALID_STATE; | 1254 | return SCI_FAILURE_INVALID_STATE; |
1245 | } | 1255 | } |
1246 | } | 1256 | } |
@@ -1289,8 +1299,8 @@ enum sci_status sci_port_remove_phy(struct isci_port *iport, | |||
1289 | SCI_PORT_SUB_CONFIGURING); | 1299 | SCI_PORT_SUB_CONFIGURING); |
1290 | return SCI_SUCCESS; | 1300 | return SCI_SUCCESS; |
1291 | default: | 1301 | default: |
1292 | dev_warn(sciport_to_dev(iport), | 1302 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1293 | "%s: in wrong state: %d\n", __func__, state); | 1303 | __func__, port_state_name(state)); |
1294 | return SCI_FAILURE_INVALID_STATE; | 1304 | return SCI_FAILURE_INVALID_STATE; |
1295 | } | 1305 | } |
1296 | } | 1306 | } |
@@ -1332,8 +1342,8 @@ enum sci_status sci_port_link_up(struct isci_port *iport, | |||
1332 | sci_port_general_link_up_handler(iport, iphy, PF_RESUME); | 1342 | sci_port_general_link_up_handler(iport, iphy, PF_RESUME); |
1333 | return SCI_SUCCESS; | 1343 | return SCI_SUCCESS; |
1334 | default: | 1344 | default: |
1335 | dev_warn(sciport_to_dev(iport), | 1345 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1336 | "%s: in wrong state: %d\n", __func__, state); | 1346 | __func__, port_state_name(state)); |
1337 | return SCI_FAILURE_INVALID_STATE; | 1347 | return SCI_FAILURE_INVALID_STATE; |
1338 | } | 1348 | } |
1339 | } | 1349 | } |
@@ -1362,8 +1372,8 @@ enum sci_status sci_port_link_down(struct isci_port *iport, | |||
1362 | sci_port_deactivate_phy(iport, iphy, false); | 1372 | sci_port_deactivate_phy(iport, iphy, false); |
1363 | return SCI_SUCCESS; | 1373 | return SCI_SUCCESS; |
1364 | default: | 1374 | default: |
1365 | dev_warn(sciport_to_dev(iport), | 1375 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1366 | "%s: in wrong state: %d\n", __func__, state); | 1376 | __func__, port_state_name(state)); |
1367 | return SCI_FAILURE_INVALID_STATE; | 1377 | return SCI_FAILURE_INVALID_STATE; |
1368 | } | 1378 | } |
1369 | } | 1379 | } |
@@ -1382,8 +1392,8 @@ enum sci_status sci_port_start_io(struct isci_port *iport, | |||
1382 | iport->started_request_count++; | 1392 | iport->started_request_count++; |
1383 | return SCI_SUCCESS; | 1393 | return SCI_SUCCESS; |
1384 | default: | 1394 | default: |
1385 | dev_warn(sciport_to_dev(iport), | 1395 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1386 | "%s: in wrong state: %d\n", __func__, state); | 1396 | __func__, port_state_name(state)); |
1387 | return SCI_FAILURE_INVALID_STATE; | 1397 | return SCI_FAILURE_INVALID_STATE; |
1388 | } | 1398 | } |
1389 | } | 1399 | } |
@@ -1397,8 +1407,8 @@ enum sci_status sci_port_complete_io(struct isci_port *iport, | |||
1397 | state = iport->sm.current_state_id; | 1407 | state = iport->sm.current_state_id; |
1398 | switch (state) { | 1408 | switch (state) { |
1399 | case SCI_PORT_STOPPED: | 1409 | case SCI_PORT_STOPPED: |
1400 | dev_warn(sciport_to_dev(iport), | 1410 | dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n", |
1401 | "%s: in wrong state: %d\n", __func__, state); | 1411 | __func__, port_state_name(state)); |
1402 | return SCI_FAILURE_INVALID_STATE; | 1412 | return SCI_FAILURE_INVALID_STATE; |
1403 | case SCI_PORT_STOPPING: | 1413 | case SCI_PORT_STOPPING: |
1404 | sci_port_decrement_request_count(iport); | 1414 | sci_port_decrement_request_count(iport); |