diff options
author | jack_wang <jack_wang@usish.com> | 2009-11-05 09:33:35 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:01:31 -0500 |
commit | 72d0baa089ebd058cdb8b87fde835e9157c4597a (patch) | |
tree | bb4eba3d387d5ba185be7e922646a72bb4e08177 /drivers/scsi/pm8001 | |
parent | d0b68041bdd0e5ea6dae1210541bf124443d72ec (diff) |
[SCSI] pm8001: enhance IOMB process modules
We set interupt cascading count of outbound queue to get better
performance, correct some unnecessary return values and some noisy
print messages. patch attached.
Signed-off-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: Lindar Liu <lindar_liu@usish.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 245 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.h | 2 |
2 files changed, 141 insertions, 106 deletions
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index d18c2635995f..a3de306b9045 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -341,7 +341,7 @@ update_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha, int number) | |||
341 | * @pm8001_ha : our hba card infomation | 341 | * @pm8001_ha : our hba card infomation |
342 | * @shiftValue : shifting value in memory bar. | 342 | * @shiftValue : shifting value in memory bar. |
343 | */ | 343 | */ |
344 | static u32 bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue) | 344 | static int bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue) |
345 | { | 345 | { |
346 | u32 regVal; | 346 | u32 regVal; |
347 | u32 max_wait_count; | 347 | u32 max_wait_count; |
@@ -1217,7 +1217,7 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha) | |||
1217 | * @messageSize: the message size of this transfer, normally it is 64 bytes | 1217 | * @messageSize: the message size of this transfer, normally it is 64 bytes |
1218 | * @messagePtr: the pointer to message. | 1218 | * @messagePtr: the pointer to message. |
1219 | */ | 1219 | */ |
1220 | static u32 mpi_msg_free_get(struct inbound_queue_table *circularQ, | 1220 | static int mpi_msg_free_get(struct inbound_queue_table *circularQ, |
1221 | u16 messageSize, void **messagePtr) | 1221 | u16 messageSize, void **messagePtr) |
1222 | { | 1222 | { |
1223 | u32 offset, consumer_index; | 1223 | u32 offset, consumer_index; |
@@ -1257,7 +1257,7 @@ static u32 mpi_msg_free_get(struct inbound_queue_table *circularQ, | |||
1257 | * @opCode: the operation code represents commands which LLDD and fw recognized. | 1257 | * @opCode: the operation code represents commands which LLDD and fw recognized. |
1258 | * @payload: the command payload of each operation command. | 1258 | * @payload: the command payload of each operation command. |
1259 | */ | 1259 | */ |
1260 | static u32 mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, | 1260 | static int mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, |
1261 | struct inbound_queue_table *circularQ, | 1261 | struct inbound_queue_table *circularQ, |
1262 | u32 opCode, void *payload) | 1262 | u32 opCode, void *payload) |
1263 | { | 1263 | { |
@@ -1270,7 +1270,7 @@ static u32 mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, | |||
1270 | pm8001_printk("No free mpi buffer \n")); | 1270 | pm8001_printk("No free mpi buffer \n")); |
1271 | return -1; | 1271 | return -1; |
1272 | } | 1272 | } |
1273 | 1273 | BUG_ON(!payload); | |
1274 | /*Copy to the payload*/ | 1274 | /*Copy to the payload*/ |
1275 | memcpy(pMessage, payload, (64 - sizeof(struct mpi_msg_hdr))); | 1275 | memcpy(pMessage, payload, (64 - sizeof(struct mpi_msg_hdr))); |
1276 | 1276 | ||
@@ -1289,10 +1289,30 @@ static u32 mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, | |||
1289 | return 0; | 1289 | return 0; |
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | static u32 mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, | 1292 | static u32 mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg, |
1293 | struct outbound_queue_table *circularQ, u8 bc) | 1293 | struct outbound_queue_table *circularQ, u8 bc) |
1294 | { | 1294 | { |
1295 | u32 producer_index; | 1295 | u32 producer_index; |
1296 | struct mpi_msg_hdr *msgHeader; | ||
1297 | struct mpi_msg_hdr *pOutBoundMsgHeader; | ||
1298 | |||
1299 | msgHeader = (struct mpi_msg_hdr *)(pMsg - sizeof(struct mpi_msg_hdr)); | ||
1300 | pOutBoundMsgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt + | ||
1301 | circularQ->consumer_idx * 64); | ||
1302 | if (pOutBoundMsgHeader != msgHeader) { | ||
1303 | PM8001_FAIL_DBG(pm8001_ha, | ||
1304 | pm8001_printk("consumer_idx = %d msgHeader = %p\n", | ||
1305 | circularQ->consumer_idx, msgHeader)); | ||
1306 | |||
1307 | /* Update the producer index from SPC */ | ||
1308 | producer_index = pm8001_read_32(circularQ->pi_virt); | ||
1309 | circularQ->producer_index = cpu_to_le32(producer_index); | ||
1310 | PM8001_FAIL_DBG(pm8001_ha, | ||
1311 | pm8001_printk("consumer_idx = %d producer_index = %d" | ||
1312 | "msgHeader = %p\n", circularQ->consumer_idx, | ||
1313 | circularQ->producer_index, msgHeader)); | ||
1314 | return 0; | ||
1315 | } | ||
1296 | /* free the circular queue buffer elements associated with the message*/ | 1316 | /* free the circular queue buffer elements associated with the message*/ |
1297 | circularQ->consumer_idx = (circularQ->consumer_idx + bc) % 256; | 1317 | circularQ->consumer_idx = (circularQ->consumer_idx + bc) % 256; |
1298 | /* update the CI of outbound queue */ | 1318 | /* update the CI of outbound queue */ |
@@ -1324,8 +1344,6 @@ static u32 mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, | |||
1324 | do { | 1344 | do { |
1325 | /* If there are not-yet-delivered messages ... */ | 1345 | /* If there are not-yet-delivered messages ... */ |
1326 | if (circularQ->producer_index != circularQ->consumer_idx) { | 1346 | if (circularQ->producer_index != circularQ->consumer_idx) { |
1327 | PM8001_IO_DBG(pm8001_ha, | ||
1328 | pm8001_printk("process an IOMB\n")); | ||
1329 | /*Get the pointer to the circular queue buffer element*/ | 1347 | /*Get the pointer to the circular queue buffer element*/ |
1330 | msgHeader = (struct mpi_msg_hdr *) | 1348 | msgHeader = (struct mpi_msg_hdr *) |
1331 | (circularQ->base_virt + | 1349 | (circularQ->base_virt + |
@@ -1342,34 +1360,43 @@ static u32 mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, | |||
1342 | *pBC = (u8)((msgHeader_tmp >> 24) & | 1360 | *pBC = (u8)((msgHeader_tmp >> 24) & |
1343 | 0x1f); | 1361 | 0x1f); |
1344 | PM8001_IO_DBG(pm8001_ha, | 1362 | PM8001_IO_DBG(pm8001_ha, |
1345 | pm8001_printk("mpi_msg_consume" | 1363 | pm8001_printk(": CI=%d PI=%d " |
1346 | ": CI=%d PI=%d msgHeader=%x\n", | 1364 | "msgHeader=%x\n", |
1347 | circularQ->consumer_idx, | 1365 | circularQ->consumer_idx, |
1348 | circularQ->producer_index, | 1366 | circularQ->producer_index, |
1349 | msgHeader_tmp)); | 1367 | msgHeader_tmp)); |
1350 | return MPI_IO_STATUS_SUCCESS; | 1368 | return MPI_IO_STATUS_SUCCESS; |
1351 | } else { | 1369 | } else { |
1352 | u32 producer_index; | ||
1353 | void *pi_virt = circularQ->pi_virt; | ||
1354 | /* free the circular queue buffer | ||
1355 | elements associated with the message*/ | ||
1356 | circularQ->consumer_idx = | 1370 | circularQ->consumer_idx = |
1357 | (circularQ->consumer_idx + | 1371 | (circularQ->consumer_idx + |
1358 | ((msgHeader_tmp >> 24) & 0x1f)) | 1372 | ((msgHeader_tmp >> 24) & 0x1f)) |
1359 | % 256; | 1373 | % 256; |
1374 | msgHeader_tmp = 0; | ||
1375 | pm8001_write_32(msgHeader, 0, 0); | ||
1360 | /* update the CI of outbound queue */ | 1376 | /* update the CI of outbound queue */ |
1361 | pm8001_cw32(pm8001_ha, | 1377 | pm8001_cw32(pm8001_ha, |
1362 | circularQ->ci_pci_bar, | 1378 | circularQ->ci_pci_bar, |
1363 | circularQ->ci_offset, | 1379 | circularQ->ci_offset, |
1364 | circularQ->consumer_idx); | 1380 | circularQ->consumer_idx); |
1365 | /* Update the producer index from SPC */ | ||
1366 | producer_index = | ||
1367 | pm8001_read_32(pi_virt); | ||
1368 | circularQ->producer_index = | ||
1369 | cpu_to_le32(producer_index); | ||
1370 | } | 1381 | } |
1371 | } else | 1382 | } else { |
1383 | circularQ->consumer_idx = | ||
1384 | (circularQ->consumer_idx + | ||
1385 | ((msgHeader_tmp >> 24) & 0x1f)) % 256; | ||
1386 | msgHeader_tmp = 0; | ||
1387 | pm8001_write_32(msgHeader, 0, 0); | ||
1388 | /* update the CI of outbound queue */ | ||
1389 | pm8001_cw32(pm8001_ha, circularQ->ci_pci_bar, | ||
1390 | circularQ->ci_offset, | ||
1391 | circularQ->consumer_idx); | ||
1372 | return MPI_IO_STATUS_FAIL; | 1392 | return MPI_IO_STATUS_FAIL; |
1393 | } | ||
1394 | } else { | ||
1395 | u32 producer_index; | ||
1396 | void *pi_virt = circularQ->pi_virt; | ||
1397 | /* Update the producer index from SPC */ | ||
1398 | producer_index = pm8001_read_32(pi_virt); | ||
1399 | circularQ->producer_index = cpu_to_le32(producer_index); | ||
1373 | } | 1400 | } |
1374 | } while (circularQ->producer_index != circularQ->consumer_idx); | 1401 | } while (circularQ->producer_index != circularQ->consumer_idx); |
1375 | /* while we don't have any more not-yet-delivered message */ | 1402 | /* while we don't have any more not-yet-delivered message */ |
@@ -1441,7 +1468,7 @@ static int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha, void *data, | |||
1441 | * So we will tell the caller who maybe waiting the result to tell upper layer | 1468 | * So we will tell the caller who maybe waiting the result to tell upper layer |
1442 | * that the task has been finished. | 1469 | * that the task has been finished. |
1443 | */ | 1470 | */ |
1444 | static int | 1471 | static void |
1445 | mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) | 1472 | mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) |
1446 | { | 1473 | { |
1447 | struct sas_task *t; | 1474 | struct sas_task *t; |
@@ -1461,14 +1488,13 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1461 | pm8001_dev = ccb->device; | 1488 | pm8001_dev = ccb->device; |
1462 | param = le32_to_cpu(psspPayload->param); | 1489 | param = le32_to_cpu(psspPayload->param); |
1463 | 1490 | ||
1464 | PM8001_IO_DBG(pm8001_ha, pm8001_printk("OPC_OUB_SSP_COMP\n")); | ||
1465 | t = ccb->task; | 1491 | t = ccb->task; |
1466 | 1492 | ||
1467 | if (status) | 1493 | if (status && status != IO_UNDERFLOW) |
1468 | PM8001_FAIL_DBG(pm8001_ha, | 1494 | PM8001_FAIL_DBG(pm8001_ha, |
1469 | pm8001_printk("sas IO status 0x%x\n", status)); | 1495 | pm8001_printk("sas IO status 0x%x\n", status)); |
1470 | if (unlikely(!t || !t->lldd_task || !t->dev)) | 1496 | if (unlikely(!t || !t->lldd_task || !t->dev)) |
1471 | return -1; | 1497 | return; |
1472 | ts = &t->task_status; | 1498 | ts = &t->task_status; |
1473 | switch (status) { | 1499 | switch (status) { |
1474 | case IO_SUCCESS: | 1500 | case IO_SUCCESS: |
@@ -1541,7 +1567,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1541 | pm8001_printk("IO_OPEN_CNX_ERROR_BREAK\n")); | 1567 | pm8001_printk("IO_OPEN_CNX_ERROR_BREAK\n")); |
1542 | ts->resp = SAS_TASK_COMPLETE; | 1568 | ts->resp = SAS_TASK_COMPLETE; |
1543 | ts->stat = SAS_OPEN_REJECT; | 1569 | ts->stat = SAS_OPEN_REJECT; |
1544 | ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; | 1570 | ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; |
1545 | break; | 1571 | break; |
1546 | case IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: | 1572 | case IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: |
1547 | PM8001_IO_DBG(pm8001_ha, | 1573 | PM8001_IO_DBG(pm8001_ha, |
@@ -1581,6 +1607,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1581 | pm8001_printk("IO_XFER_ERROR_NAK_RECEIVED\n")); | 1607 | pm8001_printk("IO_XFER_ERROR_NAK_RECEIVED\n")); |
1582 | ts->resp = SAS_TASK_COMPLETE; | 1608 | ts->resp = SAS_TASK_COMPLETE; |
1583 | ts->stat = SAS_OPEN_REJECT; | 1609 | ts->stat = SAS_OPEN_REJECT; |
1610 | ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; | ||
1584 | break; | 1611 | break; |
1585 | case IO_XFER_ERROR_ACK_NAK_TIMEOUT: | 1612 | case IO_XFER_ERROR_ACK_NAK_TIMEOUT: |
1586 | PM8001_IO_DBG(pm8001_ha, | 1613 | PM8001_IO_DBG(pm8001_ha, |
@@ -1656,7 +1683,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1656 | break; | 1683 | break; |
1657 | } | 1684 | } |
1658 | PM8001_IO_DBG(pm8001_ha, | 1685 | PM8001_IO_DBG(pm8001_ha, |
1659 | pm8001_printk("scsi_satus = %x \n ", | 1686 | pm8001_printk("scsi_status = %x \n ", |
1660 | psspPayload->ssp_resp_iu.status)); | 1687 | psspPayload->ssp_resp_iu.status)); |
1661 | spin_lock_irqsave(&t->task_state_lock, flags); | 1688 | spin_lock_irqsave(&t->task_state_lock, flags); |
1662 | t->task_state_flags &= ~SAS_TASK_STATE_PENDING; | 1689 | t->task_state_flags &= ~SAS_TASK_STATE_PENDING; |
@@ -1675,11 +1702,10 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1675 | mb();/* in order to force CPU ordering */ | 1702 | mb();/* in order to force CPU ordering */ |
1676 | t->task_done(t); | 1703 | t->task_done(t); |
1677 | } | 1704 | } |
1678 | return 0; | ||
1679 | } | 1705 | } |
1680 | 1706 | ||
1681 | /*See the comments for mpi_ssp_completion */ | 1707 | /*See the comments for mpi_ssp_completion */ |
1682 | static int mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | 1708 | static void mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) |
1683 | { | 1709 | { |
1684 | struct sas_task *t; | 1710 | struct sas_task *t; |
1685 | unsigned long flags; | 1711 | unsigned long flags; |
@@ -1700,7 +1726,7 @@ static int mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1700 | PM8001_FAIL_DBG(pm8001_ha, | 1726 | PM8001_FAIL_DBG(pm8001_ha, |
1701 | pm8001_printk("sas IO status 0x%x\n", event)); | 1727 | pm8001_printk("sas IO status 0x%x\n", event)); |
1702 | if (unlikely(!t || !t->lldd_task || !t->dev)) | 1728 | if (unlikely(!t || !t->lldd_task || !t->dev)) |
1703 | return -1; | 1729 | return; |
1704 | ts = &t->task_status; | 1730 | ts = &t->task_status; |
1705 | PM8001_IO_DBG(pm8001_ha, | 1731 | PM8001_IO_DBG(pm8001_ha, |
1706 | pm8001_printk("port_id = %x,device_id = %x\n", | 1732 | pm8001_printk("port_id = %x,device_id = %x\n", |
@@ -1747,7 +1773,7 @@ static int mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1747 | pm8001_printk("IO_OPEN_CNX_ERROR_BREAK\n")); | 1773 | pm8001_printk("IO_OPEN_CNX_ERROR_BREAK\n")); |
1748 | ts->resp = SAS_TASK_COMPLETE; | 1774 | ts->resp = SAS_TASK_COMPLETE; |
1749 | ts->stat = SAS_OPEN_REJECT; | 1775 | ts->stat = SAS_OPEN_REJECT; |
1750 | ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; | 1776 | ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; |
1751 | break; | 1777 | break; |
1752 | case IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: | 1778 | case IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: |
1753 | PM8001_IO_DBG(pm8001_ha, | 1779 | PM8001_IO_DBG(pm8001_ha, |
@@ -1787,6 +1813,7 @@ static int mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1787 | pm8001_printk("IO_XFER_ERROR_NAK_RECEIVED\n")); | 1813 | pm8001_printk("IO_XFER_ERROR_NAK_RECEIVED\n")); |
1788 | ts->resp = SAS_TASK_COMPLETE; | 1814 | ts->resp = SAS_TASK_COMPLETE; |
1789 | ts->stat = SAS_OPEN_REJECT; | 1815 | ts->stat = SAS_OPEN_REJECT; |
1816 | ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; | ||
1790 | break; | 1817 | break; |
1791 | case IO_XFER_ERROR_ACK_NAK_TIMEOUT: | 1818 | case IO_XFER_ERROR_ACK_NAK_TIMEOUT: |
1792 | PM8001_IO_DBG(pm8001_ha, | 1819 | PM8001_IO_DBG(pm8001_ha, |
@@ -1840,7 +1867,7 @@ static int mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1840 | case IO_XFER_CMD_FRAME_ISSUED: | 1867 | case IO_XFER_CMD_FRAME_ISSUED: |
1841 | PM8001_IO_DBG(pm8001_ha, | 1868 | PM8001_IO_DBG(pm8001_ha, |
1842 | pm8001_printk(" IO_XFER_CMD_FRAME_ISSUED\n")); | 1869 | pm8001_printk(" IO_XFER_CMD_FRAME_ISSUED\n")); |
1843 | return 0; | 1870 | return; |
1844 | default: | 1871 | default: |
1845 | PM8001_IO_DBG(pm8001_ha, | 1872 | PM8001_IO_DBG(pm8001_ha, |
1846 | pm8001_printk("Unknown status 0x%x\n", event)); | 1873 | pm8001_printk("Unknown status 0x%x\n", event)); |
@@ -1866,11 +1893,10 @@ static int mpi_ssp_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
1866 | mb();/* in order to force CPU ordering */ | 1893 | mb();/* in order to force CPU ordering */ |
1867 | t->task_done(t); | 1894 | t->task_done(t); |
1868 | } | 1895 | } |
1869 | return 0; | ||
1870 | } | 1896 | } |
1871 | 1897 | ||
1872 | /*See the comments for mpi_ssp_completion */ | 1898 | /*See the comments for mpi_ssp_completion */ |
1873 | static int | 1899 | static void |
1874 | mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | 1900 | mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
1875 | { | 1901 | { |
1876 | struct sas_task *t; | 1902 | struct sas_task *t; |
@@ -1898,7 +1924,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
1898 | PM8001_FAIL_DBG(pm8001_ha, | 1924 | PM8001_FAIL_DBG(pm8001_ha, |
1899 | pm8001_printk("sata IO status 0x%x\n", status)); | 1925 | pm8001_printk("sata IO status 0x%x\n", status)); |
1900 | if (unlikely(!t || !t->lldd_task || !t->dev)) | 1926 | if (unlikely(!t || !t->lldd_task || !t->dev)) |
1901 | return -1; | 1927 | return; |
1902 | 1928 | ||
1903 | switch (status) { | 1929 | switch (status) { |
1904 | case IO_SUCCESS: | 1930 | case IO_SUCCESS: |
@@ -2015,7 +2041,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2015 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2041 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2016 | mb();/*in order to force CPU ordering*/ | 2042 | mb();/*in order to force CPU ordering*/ |
2017 | t->task_done(t); | 2043 | t->task_done(t); |
2018 | return 0; | 2044 | return; |
2019 | } | 2045 | } |
2020 | break; | 2046 | break; |
2021 | case IO_OPEN_CNX_ERROR_BAD_DESTINATION: | 2047 | case IO_OPEN_CNX_ERROR_BAD_DESTINATION: |
@@ -2033,7 +2059,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2033 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2059 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2034 | mb();/*ditto*/ | 2060 | mb();/*ditto*/ |
2035 | t->task_done(t); | 2061 | t->task_done(t); |
2036 | return 0; | 2062 | return; |
2037 | } | 2063 | } |
2038 | break; | 2064 | break; |
2039 | case IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED: | 2065 | case IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED: |
@@ -2059,7 +2085,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2059 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2085 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2060 | mb();/* ditto*/ | 2086 | mb();/* ditto*/ |
2061 | t->task_done(t); | 2087 | t->task_done(t); |
2062 | return 0; | 2088 | return; |
2063 | } | 2089 | } |
2064 | break; | 2090 | break; |
2065 | case IO_OPEN_CNX_ERROR_WRONG_DESTINATION: | 2091 | case IO_OPEN_CNX_ERROR_WRONG_DESTINATION: |
@@ -2124,7 +2150,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2124 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2150 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2125 | mb();/*ditto*/ | 2151 | mb();/*ditto*/ |
2126 | t->task_done(t); | 2152 | t->task_done(t); |
2127 | return 0; | 2153 | return; |
2128 | } | 2154 | } |
2129 | break; | 2155 | break; |
2130 | case IO_DS_IN_RECOVERY: | 2156 | case IO_DS_IN_RECOVERY: |
@@ -2146,7 +2172,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2146 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2172 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2147 | mb();/*ditto*/ | 2173 | mb();/*ditto*/ |
2148 | t->task_done(t); | 2174 | t->task_done(t); |
2149 | return 0; | 2175 | return; |
2150 | } | 2176 | } |
2151 | break; | 2177 | break; |
2152 | case IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY: | 2178 | case IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY: |
@@ -2180,11 +2206,10 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2180 | mb();/* ditto */ | 2206 | mb();/* ditto */ |
2181 | t->task_done(t); | 2207 | t->task_done(t); |
2182 | } | 2208 | } |
2183 | return 0; | ||
2184 | } | 2209 | } |
2185 | 2210 | ||
2186 | /*See the comments for mpi_ssp_completion */ | 2211 | /*See the comments for mpi_ssp_completion */ |
2187 | static int mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | 2212 | static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) |
2188 | { | 2213 | { |
2189 | struct sas_task *t; | 2214 | struct sas_task *t; |
2190 | unsigned long flags; | 2215 | unsigned long flags; |
@@ -2205,7 +2230,7 @@ static int mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
2205 | PM8001_FAIL_DBG(pm8001_ha, | 2230 | PM8001_FAIL_DBG(pm8001_ha, |
2206 | pm8001_printk("sata IO status 0x%x\n", event)); | 2231 | pm8001_printk("sata IO status 0x%x\n", event)); |
2207 | if (unlikely(!t || !t->lldd_task || !t->dev)) | 2232 | if (unlikely(!t || !t->lldd_task || !t->dev)) |
2208 | return -1; | 2233 | return; |
2209 | ts = &t->task_status; | 2234 | ts = &t->task_status; |
2210 | PM8001_IO_DBG(pm8001_ha, | 2235 | PM8001_IO_DBG(pm8001_ha, |
2211 | pm8001_printk("port_id = %x,device_id = %x\n", | 2236 | pm8001_printk("port_id = %x,device_id = %x\n", |
@@ -2268,7 +2293,7 @@ static int mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
2268 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2293 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2269 | mb();/*ditto*/ | 2294 | mb();/*ditto*/ |
2270 | t->task_done(t); | 2295 | t->task_done(t); |
2271 | return 0; | 2296 | return; |
2272 | } | 2297 | } |
2273 | break; | 2298 | break; |
2274 | case IO_OPEN_CNX_ERROR_BAD_DESTINATION: | 2299 | case IO_OPEN_CNX_ERROR_BAD_DESTINATION: |
@@ -2382,11 +2407,10 @@ static int mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
2382 | mb();/* in order to force CPU ordering */ | 2407 | mb();/* in order to force CPU ordering */ |
2383 | t->task_done(t); | 2408 | t->task_done(t); |
2384 | } | 2409 | } |
2385 | return 0; | ||
2386 | } | 2410 | } |
2387 | 2411 | ||
2388 | /*See the comments for mpi_ssp_completion */ | 2412 | /*See the comments for mpi_ssp_completion */ |
2389 | static int | 2413 | static void |
2390 | mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | 2414 | mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
2391 | { | 2415 | { |
2392 | u32 param; | 2416 | u32 param; |
@@ -2412,7 +2436,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2412 | PM8001_FAIL_DBG(pm8001_ha, | 2436 | PM8001_FAIL_DBG(pm8001_ha, |
2413 | pm8001_printk("smp IO status 0x%x\n", status)); | 2437 | pm8001_printk("smp IO status 0x%x\n", status)); |
2414 | if (unlikely(!t || !t->lldd_task || !t->dev)) | 2438 | if (unlikely(!t || !t->lldd_task || !t->dev)) |
2415 | return -1; | 2439 | return; |
2416 | 2440 | ||
2417 | switch (status) { | 2441 | switch (status) { |
2418 | case IO_SUCCESS: | 2442 | case IO_SUCCESS: |
@@ -2585,7 +2609,6 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2585 | mb();/* in order to force CPU ordering */ | 2609 | mb();/* in order to force CPU ordering */ |
2586 | t->task_done(t); | 2610 | t->task_done(t); |
2587 | } | 2611 | } |
2588 | return 0; | ||
2589 | } | 2612 | } |
2590 | 2613 | ||
2591 | static void | 2614 | static void |
@@ -2682,8 +2705,8 @@ mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2682 | pm8001_printk("Get NVMD success, IR=0, dataLen=%d\n", | 2705 | pm8001_printk("Get NVMD success, IR=0, dataLen=%d\n", |
2683 | (dlen_status & NVMD_LEN) >> 24)); | 2706 | (dlen_status & NVMD_LEN) >> 24)); |
2684 | } | 2707 | } |
2685 | memcpy((void *)(fw_control_context->usrAddr), | 2708 | memcpy(fw_control_context->usrAddr, |
2686 | (void *)(pm8001_ha->memoryMap.region[NVMD].virt_ptr), | 2709 | pm8001_ha->memoryMap.region[NVMD].virt_ptr, |
2687 | fw_control_context->len); | 2710 | fw_control_context->len); |
2688 | complete(pm8001_ha->nvmd_completion); | 2711 | complete(pm8001_ha->nvmd_completion); |
2689 | ccb->task = NULL; | 2712 | ccb->task = NULL; |
@@ -3184,28 +3207,28 @@ mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3184 | (struct task_abort_resp *)(piomb + 4); | 3207 | (struct task_abort_resp *)(piomb + 4); |
3185 | ccb = &pm8001_ha->ccb_info[pPayload->tag]; | 3208 | ccb = &pm8001_ha->ccb_info[pPayload->tag]; |
3186 | t = ccb->task; | 3209 | t = ccb->task; |
3187 | ts = &t->task_status; | ||
3188 | 3210 | ||
3189 | if (t == NULL) | ||
3190 | return -1; | ||
3191 | 3211 | ||
3192 | status = le32_to_cpu(pPayload->status); | 3212 | status = le32_to_cpu(pPayload->status); |
3193 | tag = le32_to_cpu(pPayload->tag); | 3213 | tag = le32_to_cpu(pPayload->tag); |
3194 | scp = le32_to_cpu(pPayload->scp); | 3214 | scp = le32_to_cpu(pPayload->scp); |
3195 | PM8001_IO_DBG(pm8001_ha, | 3215 | PM8001_IO_DBG(pm8001_ha, |
3196 | pm8001_printk(" status = 0x%x\n", status)); | 3216 | pm8001_printk(" status = 0x%x\n", status)); |
3217 | if (t == NULL) | ||
3218 | return -1; | ||
3219 | ts = &t->task_status; | ||
3197 | if (status != 0) | 3220 | if (status != 0) |
3198 | PM8001_FAIL_DBG(pm8001_ha, | 3221 | PM8001_FAIL_DBG(pm8001_ha, |
3199 | pm8001_printk("task abort failed tag = 0x%x," | 3222 | pm8001_printk("task abort failed status 0x%x ," |
3200 | " scp= 0x%x\n", tag, scp)); | 3223 | "tag = 0x%x, scp= 0x%x\n", status, tag, scp)); |
3201 | switch (status) { | 3224 | switch (status) { |
3202 | case IO_SUCCESS: | 3225 | case IO_SUCCESS: |
3203 | PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n")); | 3226 | PM8001_EH_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n")); |
3204 | ts->resp = SAS_TASK_COMPLETE; | 3227 | ts->resp = SAS_TASK_COMPLETE; |
3205 | ts->stat = SAM_GOOD; | 3228 | ts->stat = SAM_GOOD; |
3206 | break; | 3229 | break; |
3207 | case IO_NOT_VALID: | 3230 | case IO_NOT_VALID: |
3208 | PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_NOT_VALID\n")); | 3231 | PM8001_EH_DBG(pm8001_ha, pm8001_printk("IO_NOT_VALID\n")); |
3209 | ts->resp = TMF_RESP_FUNC_FAILED; | 3232 | ts->resp = TMF_RESP_FUNC_FAILED; |
3210 | break; | 3233 | break; |
3211 | } | 3234 | } |
@@ -3443,7 +3466,7 @@ static void process_one_iomb(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
3443 | u32 pHeader = (u32)*(u32 *)piomb; | 3466 | u32 pHeader = (u32)*(u32 *)piomb; |
3444 | u8 opc = (u8)((le32_to_cpu(pHeader)) & 0xFFF); | 3467 | u8 opc = (u8)((le32_to_cpu(pHeader)) & 0xFFF); |
3445 | 3468 | ||
3446 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk("process_one_iomb:\n")); | 3469 | PM8001_MSG_DBG(pm8001_ha, pm8001_printk("process_one_iomb:")); |
3447 | 3470 | ||
3448 | switch (opc) { | 3471 | switch (opc) { |
3449 | case OPC_OUB_ECHO: | 3472 | case OPC_OUB_ECHO: |
@@ -3609,17 +3632,16 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha) | |||
3609 | struct outbound_queue_table *circularQ; | 3632 | struct outbound_queue_table *circularQ; |
3610 | void *pMsg1 = NULL; | 3633 | void *pMsg1 = NULL; |
3611 | u8 bc = 0; | 3634 | u8 bc = 0; |
3612 | u32 ret = MPI_IO_STATUS_FAIL, processedMsgCount = 0; | 3635 | u32 ret = MPI_IO_STATUS_FAIL; |
3613 | 3636 | ||
3614 | circularQ = &pm8001_ha->outbnd_q_tbl[0]; | 3637 | circularQ = &pm8001_ha->outbnd_q_tbl[0]; |
3615 | do { | 3638 | do { |
3616 | ret = mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc); | 3639 | ret = mpi_msg_consume(pm8001_ha, circularQ, &pMsg1, &bc); |
3617 | if (MPI_IO_STATUS_SUCCESS == ret) { | 3640 | if (MPI_IO_STATUS_SUCCESS == ret) { |
3618 | /* process the outbound message */ | 3641 | /* process the outbound message */ |
3619 | process_one_iomb(pm8001_ha, (void *)((u8 *)pMsg1 - 4)); | 3642 | process_one_iomb(pm8001_ha, (void *)(pMsg1 - 4)); |
3620 | /* free the message from the outbound circular buffer */ | 3643 | /* free the message from the outbound circular buffer */ |
3621 | mpi_msg_free_set(pm8001_ha, circularQ, bc); | 3644 | mpi_msg_free_set(pm8001_ha, pMsg1, circularQ, bc); |
3622 | processedMsgCount++; | ||
3623 | } | 3645 | } |
3624 | if (MPI_IO_STATUS_BUSY == ret) { | 3646 | if (MPI_IO_STATUS_BUSY == ret) { |
3625 | u32 producer_idx; | 3647 | u32 producer_idx; |
@@ -3631,8 +3653,7 @@ static int process_oq(struct pm8001_hba_info *pm8001_ha) | |||
3631 | /* OQ is empty */ | 3653 | /* OQ is empty */ |
3632 | break; | 3654 | break; |
3633 | } | 3655 | } |
3634 | } while (100 > processedMsgCount);/*end message processing if hit the | 3656 | } while (1); |
3635 | count*/ | ||
3636 | return ret; | 3657 | return ret; |
3637 | } | 3658 | } |
3638 | 3659 | ||
@@ -3743,6 +3764,7 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3743 | struct pm8001_device *pm8001_dev = dev->lldd_dev; | 3764 | struct pm8001_device *pm8001_dev = dev->lldd_dev; |
3744 | struct ssp_ini_io_start_req ssp_cmd; | 3765 | struct ssp_ini_io_start_req ssp_cmd; |
3745 | u32 tag = ccb->ccb_tag; | 3766 | u32 tag = ccb->ccb_tag; |
3767 | int ret; | ||
3746 | __le64 phys_addr; | 3768 | __le64 phys_addr; |
3747 | struct inbound_queue_table *circularQ; | 3769 | struct inbound_queue_table *circularQ; |
3748 | u32 opc = OPC_INB_SSPINIIOSTART; | 3770 | u32 opc = OPC_INB_SSPINIIOSTART; |
@@ -3780,8 +3802,8 @@ static int pm8001_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, | |||
3780 | ssp_cmd.len = cpu_to_le32(task->total_xfer_len); | 3802 | ssp_cmd.len = cpu_to_le32(task->total_xfer_len); |
3781 | ssp_cmd.esgl = 0; | 3803 | ssp_cmd.esgl = 0; |
3782 | } | 3804 | } |
3783 | mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd); | 3805 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd); |
3784 | return 0; | 3806 | return ret; |
3785 | } | 3807 | } |
3786 | 3808 | ||
3787 | static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | 3809 | static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, |
@@ -3791,6 +3813,7 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | |||
3791 | struct domain_device *dev = task->dev; | 3813 | struct domain_device *dev = task->dev; |
3792 | struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; | 3814 | struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; |
3793 | u32 tag = ccb->ccb_tag; | 3815 | u32 tag = ccb->ccb_tag; |
3816 | int ret; | ||
3794 | struct sata_start_req sata_cmd; | 3817 | struct sata_start_req sata_cmd; |
3795 | u32 hdr_tag, ncg_tag = 0; | 3818 | u32 hdr_tag, ncg_tag = 0; |
3796 | __le64 phys_addr; | 3819 | __le64 phys_addr; |
@@ -3849,8 +3872,8 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, | |||
3849 | sata_cmd.len = cpu_to_le32(task->total_xfer_len); | 3872 | sata_cmd.len = cpu_to_le32(task->total_xfer_len); |
3850 | sata_cmd.esgl = 0; | 3873 | sata_cmd.esgl = 0; |
3851 | } | 3874 | } |
3852 | mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd); | 3875 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd); |
3853 | return 0; | 3876 | return ret; |
3854 | } | 3877 | } |
3855 | 3878 | ||
3856 | /** | 3879 | /** |
@@ -3864,6 +3887,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) | |||
3864 | { | 3887 | { |
3865 | struct phy_start_req payload; | 3888 | struct phy_start_req payload; |
3866 | struct inbound_queue_table *circularQ; | 3889 | struct inbound_queue_table *circularQ; |
3890 | int ret; | ||
3867 | u32 tag = 0x01; | 3891 | u32 tag = 0x01; |
3868 | u32 opcode = OPC_INB_PHYSTART; | 3892 | u32 opcode = OPC_INB_PHYSTART; |
3869 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 3893 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
@@ -3883,8 +3907,8 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) | |||
3883 | memcpy(payload.sas_identify.sas_addr, | 3907 | memcpy(payload.sas_identify.sas_addr, |
3884 | pm8001_ha->sas_addr, SAS_ADDR_SIZE); | 3908 | pm8001_ha->sas_addr, SAS_ADDR_SIZE); |
3885 | payload.sas_identify.phy_id = phy_id; | 3909 | payload.sas_identify.phy_id = phy_id; |
3886 | mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload); | 3910 | ret = mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload); |
3887 | return 0; | 3911 | return ret; |
3888 | } | 3912 | } |
3889 | 3913 | ||
3890 | /** | 3914 | /** |
@@ -3898,14 +3922,15 @@ static int pm8001_chip_phy_stop_req(struct pm8001_hba_info *pm8001_ha, | |||
3898 | { | 3922 | { |
3899 | struct phy_stop_req payload; | 3923 | struct phy_stop_req payload; |
3900 | struct inbound_queue_table *circularQ; | 3924 | struct inbound_queue_table *circularQ; |
3925 | int ret; | ||
3901 | u32 tag = 0x01; | 3926 | u32 tag = 0x01; |
3902 | u32 opcode = OPC_INB_PHYSTOP; | 3927 | u32 opcode = OPC_INB_PHYSTOP; |
3903 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 3928 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
3904 | memset(&payload, 0, sizeof(payload)); | 3929 | memset(&payload, 0, sizeof(payload)); |
3905 | payload.tag = cpu_to_le32(tag); | 3930 | payload.tag = cpu_to_le32(tag); |
3906 | payload.phy_id = cpu_to_le32(phy_id); | 3931 | payload.phy_id = cpu_to_le32(phy_id); |
3907 | mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload); | 3932 | ret = mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload); |
3908 | return 0; | 3933 | return ret; |
3909 | } | 3934 | } |
3910 | 3935 | ||
3911 | /** | 3936 | /** |
@@ -3919,7 +3944,7 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha, | |||
3919 | u32 stp_sspsmp_sata = 0x4; | 3944 | u32 stp_sspsmp_sata = 0x4; |
3920 | struct inbound_queue_table *circularQ; | 3945 | struct inbound_queue_table *circularQ; |
3921 | u32 linkrate, phy_id; | 3946 | u32 linkrate, phy_id; |
3922 | u32 rc, tag = 0xdeadbeef; | 3947 | int rc, tag = 0xdeadbeef; |
3923 | struct pm8001_ccb_info *ccb; | 3948 | struct pm8001_ccb_info *ccb; |
3924 | u8 retryFlag = 0x1; | 3949 | u8 retryFlag = 0x1; |
3925 | u16 firstBurstSize = 0; | 3950 | u16 firstBurstSize = 0; |
@@ -3963,8 +3988,8 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha, | |||
3963 | cpu_to_le32(ITNT | (firstBurstSize * 0x10000)); | 3988 | cpu_to_le32(ITNT | (firstBurstSize * 0x10000)); |
3964 | memcpy(&payload.sas_addr_hi, pm8001_dev->sas_device->sas_addr, | 3989 | memcpy(&payload.sas_addr_hi, pm8001_dev->sas_device->sas_addr, |
3965 | SAS_ADDR_SIZE); | 3990 | SAS_ADDR_SIZE); |
3966 | mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); | 3991 | rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); |
3967 | return 0; | 3992 | return rc; |
3968 | } | 3993 | } |
3969 | 3994 | ||
3970 | /** | 3995 | /** |
@@ -3975,16 +4000,17 @@ static int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha, | |||
3975 | { | 4000 | { |
3976 | struct dereg_dev_req payload; | 4001 | struct dereg_dev_req payload; |
3977 | u32 opc = OPC_INB_DEREG_DEV_HANDLE; | 4002 | u32 opc = OPC_INB_DEREG_DEV_HANDLE; |
4003 | int ret; | ||
3978 | struct inbound_queue_table *circularQ; | 4004 | struct inbound_queue_table *circularQ; |
3979 | 4005 | ||
3980 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4006 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
3981 | memset((u8 *)&payload, 0, sizeof(payload)); | 4007 | memset(&payload, 0, sizeof(payload)); |
3982 | payload.tag = 1; | 4008 | payload.tag = 1; |
3983 | payload.device_id = cpu_to_le32(device_id); | 4009 | payload.device_id = cpu_to_le32(device_id); |
3984 | PM8001_MSG_DBG(pm8001_ha, | 4010 | PM8001_MSG_DBG(pm8001_ha, |
3985 | pm8001_printk("unregister device device_id = %d\n", device_id)); | 4011 | pm8001_printk("unregister device device_id = %d\n", device_id)); |
3986 | mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); | 4012 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); |
3987 | return 0; | 4013 | return ret; |
3988 | } | 4014 | } |
3989 | 4015 | ||
3990 | /** | 4016 | /** |
@@ -3999,14 +4025,15 @@ static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha, | |||
3999 | { | 4025 | { |
4000 | struct local_phy_ctl_req payload; | 4026 | struct local_phy_ctl_req payload; |
4001 | struct inbound_queue_table *circularQ; | 4027 | struct inbound_queue_table *circularQ; |
4028 | int ret; | ||
4002 | u32 opc = OPC_INB_LOCAL_PHY_CONTROL; | 4029 | u32 opc = OPC_INB_LOCAL_PHY_CONTROL; |
4003 | memset((u8 *)&payload, 0, sizeof(payload)); | 4030 | memset((u8 *)&payload, 0, sizeof(payload)); |
4004 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4031 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
4005 | payload.tag = 1; | 4032 | payload.tag = 1; |
4006 | payload.phyop_phyid = | 4033 | payload.phyop_phyid = |
4007 | cpu_to_le32(((phy_op & 0xff) << 8) | (phyId & 0x0F)); | 4034 | cpu_to_le32(((phy_op & 0xff) << 8) | (phyId & 0x0F)); |
4008 | mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); | 4035 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); |
4009 | return 0; | 4036 | return ret; |
4010 | } | 4037 | } |
4011 | 4038 | ||
4012 | static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha) | 4039 | static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha) |
@@ -4028,12 +4055,16 @@ static u32 pm8001_chip_is_our_interupt(struct pm8001_hba_info *pm8001_ha) | |||
4028 | * @irq: irq number. | 4055 | * @irq: irq number. |
4029 | * @stat: stat. | 4056 | * @stat: stat. |
4030 | */ | 4057 | */ |
4031 | static void | 4058 | static irqreturn_t |
4032 | pm8001_chip_isr(struct pm8001_hba_info *pm8001_ha) | 4059 | pm8001_chip_isr(struct pm8001_hba_info *pm8001_ha) |
4033 | { | 4060 | { |
4061 | unsigned long flags; | ||
4062 | spin_lock_irqsave(&pm8001_ha->lock, flags); | ||
4034 | pm8001_chip_interrupt_disable(pm8001_ha); | 4063 | pm8001_chip_interrupt_disable(pm8001_ha); |
4035 | process_oq(pm8001_ha); | 4064 | process_oq(pm8001_ha); |
4036 | pm8001_chip_interrupt_enable(pm8001_ha); | 4065 | pm8001_chip_interrupt_enable(pm8001_ha); |
4066 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | ||
4067 | return IRQ_HANDLED; | ||
4037 | } | 4068 | } |
4038 | 4069 | ||
4039 | static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc, | 4070 | static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc, |
@@ -4041,7 +4072,7 @@ static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc, | |||
4041 | { | 4072 | { |
4042 | struct task_abort_req task_abort; | 4073 | struct task_abort_req task_abort; |
4043 | struct inbound_queue_table *circularQ; | 4074 | struct inbound_queue_table *circularQ; |
4044 | 4075 | int ret; | |
4045 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4076 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
4046 | memset(&task_abort, 0, sizeof(task_abort)); | 4077 | memset(&task_abort, 0, sizeof(task_abort)); |
4047 | if (ABORT_SINGLE == (flag & ABORT_MASK)) { | 4078 | if (ABORT_SINGLE == (flag & ABORT_MASK)) { |
@@ -4054,8 +4085,8 @@ static int send_task_abort(struct pm8001_hba_info *pm8001_ha, u32 opc, | |||
4054 | task_abort.device_id = cpu_to_le32(dev_id); | 4085 | task_abort.device_id = cpu_to_le32(dev_id); |
4055 | task_abort.tag = cpu_to_le32(cmd_tag); | 4086 | task_abort.tag = cpu_to_le32(cmd_tag); |
4056 | } | 4087 | } |
4057 | mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort); | 4088 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort); |
4058 | return 0; | 4089 | return ret; |
4059 | } | 4090 | } |
4060 | 4091 | ||
4061 | /** | 4092 | /** |
@@ -4068,7 +4099,8 @@ static int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha, | |||
4068 | { | 4099 | { |
4069 | u32 opc, device_id; | 4100 | u32 opc, device_id; |
4070 | int rc = TMF_RESP_FUNC_FAILED; | 4101 | int rc = TMF_RESP_FUNC_FAILED; |
4071 | PM8001_IO_DBG(pm8001_ha, pm8001_printk("Abort tag[%x]", task_tag)); | 4102 | PM8001_EH_DBG(pm8001_ha, pm8001_printk("cmd_tag = %x, abort task tag" |
4103 | " = %x", cmd_tag, task_tag)); | ||
4072 | if (pm8001_dev->dev_type == SAS_END_DEV) | 4104 | if (pm8001_dev->dev_type == SAS_END_DEV) |
4073 | opc = OPC_INB_SSP_ABORT; | 4105 | opc = OPC_INB_SSP_ABORT; |
4074 | else if (pm8001_dev->dev_type == SATA_DEV) | 4106 | else if (pm8001_dev->dev_type == SATA_DEV) |
@@ -4079,7 +4111,7 @@ static int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha, | |||
4079 | rc = send_task_abort(pm8001_ha, opc, device_id, flag, | 4111 | rc = send_task_abort(pm8001_ha, opc, device_id, flag, |
4080 | task_tag, cmd_tag); | 4112 | task_tag, cmd_tag); |
4081 | if (rc != TMF_RESP_FUNC_COMPLETE) | 4113 | if (rc != TMF_RESP_FUNC_COMPLETE) |
4082 | PM8001_IO_DBG(pm8001_ha, pm8001_printk("rc= %d\n", rc)); | 4114 | PM8001_EH_DBG(pm8001_ha, pm8001_printk("rc= %d\n", rc)); |
4083 | return rc; | 4115 | return rc; |
4084 | } | 4116 | } |
4085 | 4117 | ||
@@ -4098,17 +4130,17 @@ static int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha, | |||
4098 | u32 opc = OPC_INB_SSPINITMSTART; | 4130 | u32 opc = OPC_INB_SSPINITMSTART; |
4099 | struct inbound_queue_table *circularQ; | 4131 | struct inbound_queue_table *circularQ; |
4100 | struct ssp_ini_tm_start_req sspTMCmd; | 4132 | struct ssp_ini_tm_start_req sspTMCmd; |
4133 | int ret; | ||
4101 | 4134 | ||
4102 | memset(&sspTMCmd, 0, sizeof(sspTMCmd)); | 4135 | memset(&sspTMCmd, 0, sizeof(sspTMCmd)); |
4103 | sspTMCmd.device_id = cpu_to_le32(pm8001_dev->device_id); | 4136 | sspTMCmd.device_id = cpu_to_le32(pm8001_dev->device_id); |
4104 | sspTMCmd.relate_tag = cpu_to_le32(tmf->tag_of_task_to_be_managed); | 4137 | sspTMCmd.relate_tag = cpu_to_le32(tmf->tag_of_task_to_be_managed); |
4105 | sspTMCmd.tmf = cpu_to_le32(tmf->tmf); | 4138 | sspTMCmd.tmf = cpu_to_le32(tmf->tmf); |
4106 | sspTMCmd.ds_ads_m = cpu_to_le32(1 << 2); | ||
4107 | memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); | 4139 | memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); |
4108 | sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); | 4140 | sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); |
4109 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4141 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
4110 | mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd); | 4142 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd); |
4111 | return 0; | 4143 | return ret; |
4112 | } | 4144 | } |
4113 | 4145 | ||
4114 | static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, | 4146 | static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, |
@@ -4116,7 +4148,7 @@ static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, | |||
4116 | { | 4148 | { |
4117 | u32 opc = OPC_INB_GET_NVMD_DATA; | 4149 | u32 opc = OPC_INB_GET_NVMD_DATA; |
4118 | u32 nvmd_type; | 4150 | u32 nvmd_type; |
4119 | u32 rc; | 4151 | int rc; |
4120 | u32 tag; | 4152 | u32 tag; |
4121 | struct pm8001_ccb_info *ccb; | 4153 | struct pm8001_ccb_info *ccb; |
4122 | struct inbound_queue_table *circularQ; | 4154 | struct inbound_queue_table *circularQ; |
@@ -4183,8 +4215,8 @@ static int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, | |||
4183 | default: | 4215 | default: |
4184 | break; | 4216 | break; |
4185 | } | 4217 | } |
4186 | mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req); | 4218 | rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req); |
4187 | return 0; | 4219 | return rc; |
4188 | } | 4220 | } |
4189 | 4221 | ||
4190 | static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, | 4222 | static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, |
@@ -4192,7 +4224,7 @@ static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, | |||
4192 | { | 4224 | { |
4193 | u32 opc = OPC_INB_SET_NVMD_DATA; | 4225 | u32 opc = OPC_INB_SET_NVMD_DATA; |
4194 | u32 nvmd_type; | 4226 | u32 nvmd_type; |
4195 | u32 rc; | 4227 | int rc; |
4196 | u32 tag; | 4228 | u32 tag; |
4197 | struct pm8001_ccb_info *ccb; | 4229 | struct pm8001_ccb_info *ccb; |
4198 | struct inbound_queue_table *circularQ; | 4230 | struct inbound_queue_table *circularQ; |
@@ -4259,8 +4291,8 @@ static int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, | |||
4259 | default: | 4291 | default: |
4260 | break; | 4292 | break; |
4261 | } | 4293 | } |
4262 | mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req); | 4294 | rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req); |
4263 | return 0; | 4295 | return rc; |
4264 | } | 4296 | } |
4265 | 4297 | ||
4266 | /** | 4298 | /** |
@@ -4275,9 +4307,10 @@ pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha, | |||
4275 | struct fw_flash_Update_req payload; | 4307 | struct fw_flash_Update_req payload; |
4276 | struct fw_flash_updata_info *info; | 4308 | struct fw_flash_updata_info *info; |
4277 | struct inbound_queue_table *circularQ; | 4309 | struct inbound_queue_table *circularQ; |
4310 | int ret; | ||
4278 | u32 opc = OPC_INB_FW_FLASH_UPDATE; | 4311 | u32 opc = OPC_INB_FW_FLASH_UPDATE; |
4279 | 4312 | ||
4280 | memset((u8 *)&payload, 0, sizeof(struct fw_flash_Update_req)); | 4313 | memset(&payload, 0, sizeof(struct fw_flash_Update_req)); |
4281 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; | 4314 | circularQ = &pm8001_ha->inbnd_q_tbl[0]; |
4282 | info = fw_flash_updata_info; | 4315 | info = fw_flash_updata_info; |
4283 | payload.tag = cpu_to_le32(tag); | 4316 | payload.tag = cpu_to_le32(tag); |
@@ -4287,8 +4320,8 @@ pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha, | |||
4287 | payload.len = info->sgl.im_len.len ; | 4320 | payload.len = info->sgl.im_len.len ; |
4288 | payload.sgl_addr_lo = lower_32_bits(info->sgl.addr); | 4321 | payload.sgl_addr_lo = lower_32_bits(info->sgl.addr); |
4289 | payload.sgl_addr_hi = upper_32_bits(info->sgl.addr); | 4322 | payload.sgl_addr_hi = upper_32_bits(info->sgl.addr); |
4290 | mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); | 4323 | ret = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); |
4291 | return 0; | 4324 | return ret; |
4292 | } | 4325 | } |
4293 | 4326 | ||
4294 | static int | 4327 | static int |
@@ -4298,7 +4331,7 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, | |||
4298 | struct fw_flash_updata_info flash_update_info; | 4331 | struct fw_flash_updata_info flash_update_info; |
4299 | struct fw_control_info *fw_control; | 4332 | struct fw_control_info *fw_control; |
4300 | struct fw_control_ex *fw_control_context; | 4333 | struct fw_control_ex *fw_control_context; |
4301 | u32 rc; | 4334 | int rc; |
4302 | u32 tag; | 4335 | u32 tag; |
4303 | struct pm8001_ccb_info *ccb; | 4336 | struct pm8001_ccb_info *ccb; |
4304 | void *buffer = NULL; | 4337 | void *buffer = NULL; |
@@ -4321,8 +4354,8 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, | |||
4321 | return -ENOMEM; | 4354 | return -ENOMEM; |
4322 | } | 4355 | } |
4323 | } | 4356 | } |
4324 | memset((void *)buffer, 0, fw_control->len); | 4357 | memset(buffer, 0, fw_control->len); |
4325 | memcpy((void *)buffer, fw_control->buffer, fw_control->len); | 4358 | memcpy(buffer, fw_control->buffer, fw_control->len); |
4326 | flash_update_info.sgl.addr = cpu_to_le64(phys_addr); | 4359 | flash_update_info.sgl.addr = cpu_to_le64(phys_addr); |
4327 | flash_update_info.sgl.im_len.len = cpu_to_le32(fw_control->len); | 4360 | flash_update_info.sgl.im_len.len = cpu_to_le32(fw_control->len); |
4328 | flash_update_info.sgl.im_len.e = 0; | 4361 | flash_update_info.sgl.im_len.e = 0; |
@@ -4338,8 +4371,9 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, | |||
4338 | ccb = &pm8001_ha->ccb_info[tag]; | 4371 | ccb = &pm8001_ha->ccb_info[tag]; |
4339 | ccb->fw_control_context = fw_control_context; | 4372 | ccb->fw_control_context = fw_control_context; |
4340 | ccb->ccb_tag = tag; | 4373 | ccb->ccb_tag = tag; |
4341 | pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info, tag); | 4374 | rc = pm8001_chip_fw_flash_update_build(pm8001_ha, &flash_update_info, |
4342 | return 0; | 4375 | tag); |
4376 | return rc; | ||
4343 | } | 4377 | } |
4344 | 4378 | ||
4345 | static int | 4379 | static int |
@@ -4349,10 +4383,10 @@ pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha, | |||
4349 | struct set_dev_state_req payload; | 4383 | struct set_dev_state_req payload; |
4350 | struct inbound_queue_table *circularQ; | 4384 | struct inbound_queue_table *circularQ; |
4351 | struct pm8001_ccb_info *ccb; | 4385 | struct pm8001_ccb_info *ccb; |
4352 | u32 rc; | 4386 | int rc; |
4353 | u32 tag; | 4387 | u32 tag; |
4354 | u32 opc = OPC_INB_SET_DEVICE_STATE; | 4388 | u32 opc = OPC_INB_SET_DEVICE_STATE; |
4355 | memset((u8 *)&payload, 0, sizeof(payload)); | 4389 | memset(&payload, 0, sizeof(payload)); |
4356 | rc = pm8001_tag_alloc(pm8001_ha, &tag); | 4390 | rc = pm8001_tag_alloc(pm8001_ha, &tag); |
4357 | if (rc) | 4391 | if (rc) |
4358 | return -1; | 4392 | return -1; |
@@ -4363,8 +4397,9 @@ pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha, | |||
4363 | payload.tag = cpu_to_le32(tag); | 4397 | payload.tag = cpu_to_le32(tag); |
4364 | payload.device_id = cpu_to_le32(pm8001_dev->device_id); | 4398 | payload.device_id = cpu_to_le32(pm8001_dev->device_id); |
4365 | payload.nds = cpu_to_le32(state); | 4399 | payload.nds = cpu_to_le32(state); |
4366 | mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); | 4400 | rc = mpi_build_cmd(pm8001_ha, circularQ, opc, &payload); |
4367 | return 0; | 4401 | return rc; |
4402 | |||
4368 | } | 4403 | } |
4369 | 4404 | ||
4370 | static int | 4405 | static int |
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index ed6dbd193aa1..30f2ede55a75 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h | |||
@@ -119,7 +119,7 @@ struct pm8001_dispatch { | |||
119 | void (*chip_rst)(struct pm8001_hba_info *pm8001_ha); | 119 | void (*chip_rst)(struct pm8001_hba_info *pm8001_ha); |
120 | int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha); | 120 | int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha); |
121 | void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha); | 121 | void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha); |
122 | void (*isr)(struct pm8001_hba_info *pm8001_ha); | 122 | irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha); |
123 | u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha); | 123 | u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha); |
124 | int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha); | 124 | int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha); |
125 | void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha); | 125 | void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha); |