aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@suse.de>2010-07-27 16:51:13 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:07:49 -0400
commitdf64d3caab8db6ae17dacd229a03d7689a10c432 (patch)
tree247fe4f9f39b22186e42e7f4687dd62c2690e47b
parent653c42d552d0fd0b05485442aed45dd2d62269c0 (diff)
[SCSI] Unify SAM_ and SAM_STAT_ macros
We have two separate definitions for identical constants with nearly the same name. One comes from the generic headers in scsi.h; the other is an enum in libsas.h ... it's causing confusion about which one is correct (fortunately they both are). Fix this by eliminating the libsas.h duplicate Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c2
-rw-r--r--drivers/scsi/libsas/sas_ata.c12
-rw-r--r--drivers/scsi/libsas/sas_expander.c2
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c4
-rw-r--r--drivers/scsi/libsas/sas_task.c6
-rw-r--r--drivers/scsi/mvsas/mv_sas.c16
-rw-r--r--drivers/scsi/pm8001/pm8001_hwi.c14
-rw-r--r--drivers/scsi/pm8001/pm8001_sas.c4
-rw-r--r--include/scsi/libsas.h11
9 files changed, 31 insertions, 40 deletions
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index 75d20f72501f..532d212b6b2c 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -223,7 +223,7 @@ Again:
223 switch (opcode) { 223 switch (opcode) {
224 case TC_NO_ERROR: 224 case TC_NO_ERROR:
225 ts->resp = SAS_TASK_COMPLETE; 225 ts->resp = SAS_TASK_COMPLETE;
226 ts->stat = SAM_GOOD; 226 ts->stat = SAM_STAT_GOOD;
227 break; 227 break;
228 case TC_UNDERRUN: 228 case TC_UNDERRUN:
229 ts->resp = SAS_TASK_COMPLETE; 229 ts->resp = SAS_TASK_COMPLETE;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 8c496b56556c..042153cbbde1 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -71,7 +71,7 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts)
71 case SAS_SG_ERR: 71 case SAS_SG_ERR:
72 return AC_ERR_INVALID; 72 return AC_ERR_INVALID;
73 73
74 case SAM_CHECK_COND: 74 case SAM_STAT_CHECK_CONDITION:
75 case SAS_OPEN_TO: 75 case SAS_OPEN_TO:
76 case SAS_OPEN_REJECT: 76 case SAS_OPEN_REJECT:
77 SAS_DPRINTK("%s: Saw error %d. What to do?\n", 77 SAS_DPRINTK("%s: Saw error %d. What to do?\n",
@@ -107,7 +107,7 @@ static void sas_ata_task_done(struct sas_task *task)
107 sas_ha = dev->port->ha; 107 sas_ha = dev->port->ha;
108 108
109 spin_lock_irqsave(dev->sata_dev.ap->lock, flags); 109 spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
110 if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_GOOD) { 110 if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD) {
111 ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf); 111 ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf);
112 qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command); 112 qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command);
113 dev->sata_dev.sstatus = resp->sstatus; 113 dev->sata_dev.sstatus = resp->sstatus;
@@ -511,12 +511,12 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
511 goto ex_err; 511 goto ex_err;
512 } 512 }
513 } 513 }
514 if (task->task_status.stat == SAM_BUSY || 514 if (task->task_status.stat == SAM_STAT_BUSY ||
515 task->task_status.stat == SAM_TASK_SET_FULL || 515 task->task_status.stat == SAM_STAT_TASK_SET_FULL ||
516 task->task_status.stat == SAS_QUEUE_FULL) { 516 task->task_status.stat == SAS_QUEUE_FULL) {
517 SAS_DPRINTK("task: q busy, sleeping...\n"); 517 SAS_DPRINTK("task: q busy, sleeping...\n");
518 schedule_timeout_interruptible(HZ); 518 schedule_timeout_interruptible(HZ);
519 } else if (task->task_status.stat == SAM_CHECK_COND) { 519 } else if (task->task_status.stat == SAM_STAT_CHECK_CONDITION) {
520 struct scsi_sense_hdr shdr; 520 struct scsi_sense_hdr shdr;
521 521
522 if (!scsi_normalize_sense(ts->buf, ts->buf_valid_size, 522 if (!scsi_normalize_sense(ts->buf, ts->buf_valid_size,
@@ -549,7 +549,7 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
549 shdr.asc, shdr.ascq); 549 shdr.asc, shdr.ascq);
550 } 550 }
551 } else if (task->task_status.resp != SAS_TASK_COMPLETE || 551 } else if (task->task_status.resp != SAS_TASK_COMPLETE ||
552 task->task_status.stat != SAM_GOOD) { 552 task->task_status.stat != SAM_STAT_GOOD) {
553 SAS_DPRINTK("task finished with resp:0x%x, " 553 SAS_DPRINTK("task finished with resp:0x%x, "
554 "stat:0x%x\n", 554 "stat:0x%x\n",
555 task->task_status.resp, 555 task->task_status.resp,
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index c65af02dcfe8..83dd5070a15c 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -107,7 +107,7 @@ static int smp_execute_task(struct domain_device *dev, void *req, int req_size,
107 } 107 }
108 } 108 }
109 if (task->task_status.resp == SAS_TASK_COMPLETE && 109 if (task->task_status.resp == SAS_TASK_COMPLETE &&
110 task->task_status.stat == SAM_GOOD) { 110 task->task_status.stat == SAM_STAT_GOOD) {
111 res = 0; 111 res = 0;
112 break; 112 break;
113 } if (task->task_status.resp == SAS_TASK_COMPLETE && 113 } if (task->task_status.resp == SAS_TASK_COMPLETE &&
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index a7890c6d878e..f0cfba9a1fc8 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -113,10 +113,10 @@ static void sas_scsi_task_done(struct sas_task *task)
113 case SAS_ABORTED_TASK: 113 case SAS_ABORTED_TASK:
114 hs = DID_ABORT; 114 hs = DID_ABORT;
115 break; 115 break;
116 case SAM_CHECK_COND: 116 case SAM_STAT_CHECK_CONDITION:
117 memcpy(sc->sense_buffer, ts->buf, 117 memcpy(sc->sense_buffer, ts->buf,
118 min(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size)); 118 min(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
119 stat = SAM_CHECK_COND; 119 stat = SAM_STAT_CHECK_CONDITION;
120 break; 120 break;
121 default: 121 default:
122 stat = ts->stat; 122 stat = ts->stat;
diff --git a/drivers/scsi/libsas/sas_task.c b/drivers/scsi/libsas/sas_task.c
index 594524d5bfa1..b13a3346894c 100644
--- a/drivers/scsi/libsas/sas_task.c
+++ b/drivers/scsi/libsas/sas_task.c
@@ -15,13 +15,13 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task,
15 else if (iu->datapres == 1) 15 else if (iu->datapres == 1)
16 tstat->stat = iu->resp_data[3]; 16 tstat->stat = iu->resp_data[3];
17 else if (iu->datapres == 2) { 17 else if (iu->datapres == 2) {
18 tstat->stat = SAM_CHECK_COND; 18 tstat->stat = SAM_STAT_CHECK_CONDITION;
19 tstat->buf_valid_size = 19 tstat->buf_valid_size =
20 min_t(int, SAS_STATUS_BUF_SIZE, 20 min_t(int, SAS_STATUS_BUF_SIZE,
21 be32_to_cpu(iu->sense_data_len)); 21 be32_to_cpu(iu->sense_data_len));
22 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size); 22 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size);
23 23
24 if (iu->status != SAM_CHECK_COND) 24 if (iu->status != SAM_STAT_CHECK_CONDITION)
25 dev_printk(KERN_WARNING, dev, 25 dev_printk(KERN_WARNING, dev,
26 "dev %llx sent sense data, but " 26 "dev %llx sent sense data, but "
27 "stat(%x) is not CHECK CONDITION\n", 27 "stat(%x) is not CHECK CONDITION\n",
@@ -30,7 +30,7 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task,
30 } 30 }
31 else 31 else
32 /* when datapres contains corrupt/unknown value... */ 32 /* when datapres contains corrupt/unknown value... */
33 tstat->stat = SAM_CHECK_COND; 33 tstat->stat = SAM_STAT_CHECK_CONDITION;
34} 34}
35EXPORT_SYMBOL_GPL(sas_ssp_task_response); 35EXPORT_SYMBOL_GPL(sas_ssp_task_response);
36 36
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index cab924239862..adedaa916ecb 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1483,7 +1483,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
1483 } 1483 }
1484 1484
1485 if (task->task_status.resp == SAS_TASK_COMPLETE && 1485 if (task->task_status.resp == SAS_TASK_COMPLETE &&
1486 task->task_status.stat == SAM_GOOD) { 1486 task->task_status.stat == SAM_STAT_GOOD) {
1487 res = TMF_RESP_FUNC_COMPLETE; 1487 res = TMF_RESP_FUNC_COMPLETE;
1488 break; 1488 break;
1489 } 1489 }
@@ -1758,7 +1758,7 @@ static int mvs_sata_done(struct mvs_info *mvi, struct sas_task *task,
1758 struct mvs_device *mvi_dev = task->dev->lldd_dev; 1758 struct mvs_device *mvi_dev = task->dev->lldd_dev;
1759 struct task_status_struct *tstat = &task->task_status; 1759 struct task_status_struct *tstat = &task->task_status;
1760 struct ata_task_resp *resp = (struct ata_task_resp *)tstat->buf; 1760 struct ata_task_resp *resp = (struct ata_task_resp *)tstat->buf;
1761 int stat = SAM_GOOD; 1761 int stat = SAM_STAT_GOOD;
1762 1762
1763 1763
1764 resp->frame_len = sizeof(struct dev_to_host_fis); 1764 resp->frame_len = sizeof(struct dev_to_host_fis);
@@ -1790,13 +1790,13 @@ static int mvs_slot_err(struct mvs_info *mvi, struct sas_task *task,
1790 1790
1791 MVS_CHIP_DISP->command_active(mvi, slot_idx); 1791 MVS_CHIP_DISP->command_active(mvi, slot_idx);
1792 1792
1793 stat = SAM_CHECK_COND; 1793 stat = SAM_STAT_CHECK_CONDITION;
1794 switch (task->task_proto) { 1794 switch (task->task_proto) {
1795 case SAS_PROTOCOL_SSP: 1795 case SAS_PROTOCOL_SSP:
1796 stat = SAS_ABORTED_TASK; 1796 stat = SAS_ABORTED_TASK;
1797 break; 1797 break;
1798 case SAS_PROTOCOL_SMP: 1798 case SAS_PROTOCOL_SMP:
1799 stat = SAM_CHECK_COND; 1799 stat = SAM_STAT_CHECK_CONDITION;
1800 break; 1800 break;
1801 1801
1802 case SAS_PROTOCOL_SATA: 1802 case SAS_PROTOCOL_SATA:
@@ -1881,7 +1881,7 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
1881 case SAS_PROTOCOL_SSP: 1881 case SAS_PROTOCOL_SSP:
1882 /* hw says status == 0, datapres == 0 */ 1882 /* hw says status == 0, datapres == 0 */
1883 if (rx_desc & RXQ_GOOD) { 1883 if (rx_desc & RXQ_GOOD) {
1884 tstat->stat = SAM_GOOD; 1884 tstat->stat = SAM_STAT_GOOD;
1885 tstat->resp = SAS_TASK_COMPLETE; 1885 tstat->resp = SAS_TASK_COMPLETE;
1886 } 1886 }
1887 /* response frame present */ 1887 /* response frame present */
@@ -1890,12 +1890,12 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
1890 sizeof(struct mvs_err_info); 1890 sizeof(struct mvs_err_info);
1891 sas_ssp_task_response(mvi->dev, task, iu); 1891 sas_ssp_task_response(mvi->dev, task, iu);
1892 } else 1892 } else
1893 tstat->stat = SAM_CHECK_COND; 1893 tstat->stat = SAM_STAT_CHECK_CONDITION;
1894 break; 1894 break;
1895 1895
1896 case SAS_PROTOCOL_SMP: { 1896 case SAS_PROTOCOL_SMP: {
1897 struct scatterlist *sg_resp = &task->smp_task.smp_resp; 1897 struct scatterlist *sg_resp = &task->smp_task.smp_resp;
1898 tstat->stat = SAM_GOOD; 1898 tstat->stat = SAM_STAT_GOOD;
1899 to = kmap_atomic(sg_page(sg_resp), KM_IRQ0); 1899 to = kmap_atomic(sg_page(sg_resp), KM_IRQ0);
1900 memcpy(to + sg_resp->offset, 1900 memcpy(to + sg_resp->offset,
1901 slot->response + sizeof(struct mvs_err_info), 1901 slot->response + sizeof(struct mvs_err_info),
@@ -1912,7 +1912,7 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
1912 } 1912 }
1913 1913
1914 default: 1914 default:
1915 tstat->stat = SAM_CHECK_COND; 1915 tstat->stat = SAM_STAT_CHECK_CONDITION;
1916 break; 1916 break;
1917 } 1917 }
1918 if (!slot->port->port_attached) { 1918 if (!slot->port->port_attached) {
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 5ff8261c5d67..356ad268de6d 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1480,7 +1480,7 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb)
1480 ",param = %d \n", param)); 1480 ",param = %d \n", param));
1481 if (param == 0) { 1481 if (param == 0) {
1482 ts->resp = SAS_TASK_COMPLETE; 1482 ts->resp = SAS_TASK_COMPLETE;
1483 ts->stat = SAM_GOOD; 1483 ts->stat = SAM_STAT_GOOD;
1484 } else { 1484 } else {
1485 ts->resp = SAS_TASK_COMPLETE; 1485 ts->resp = SAS_TASK_COMPLETE;
1486 ts->stat = SAS_PROTO_RESPONSE; 1486 ts->stat = SAS_PROTO_RESPONSE;
@@ -1909,7 +1909,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
1909 PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n")); 1909 PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n"));
1910 if (param == 0) { 1910 if (param == 0) {
1911 ts->resp = SAS_TASK_COMPLETE; 1911 ts->resp = SAS_TASK_COMPLETE;
1912 ts->stat = SAM_GOOD; 1912 ts->stat = SAM_STAT_GOOD;
1913 } else { 1913 } else {
1914 u8 len; 1914 u8 len;
1915 ts->resp = SAS_TASK_COMPLETE; 1915 ts->resp = SAS_TASK_COMPLETE;
@@ -2450,7 +2450,7 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2450 case IO_SUCCESS: 2450 case IO_SUCCESS:
2451 PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n")); 2451 PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n"));
2452 ts->resp = SAS_TASK_COMPLETE; 2452 ts->resp = SAS_TASK_COMPLETE;
2453 ts->stat = SAM_GOOD; 2453 ts->stat = SAM_STAT_GOOD;
2454 if (pm8001_dev) 2454 if (pm8001_dev)
2455 pm8001_dev->running_req--; 2455 pm8001_dev->running_req--;
2456 break; 2456 break;
@@ -2479,19 +2479,19 @@ mpi_smp_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
2479 PM8001_IO_DBG(pm8001_ha, 2479 PM8001_IO_DBG(pm8001_ha,
2480 pm8001_printk("IO_ERROR_HW_TIMEOUT\n")); 2480 pm8001_printk("IO_ERROR_HW_TIMEOUT\n"));
2481 ts->resp = SAS_TASK_COMPLETE; 2481 ts->resp = SAS_TASK_COMPLETE;
2482 ts->stat = SAM_BUSY; 2482 ts->stat = SAM_STAT_BUSY;
2483 break; 2483 break;
2484 case IO_XFER_ERROR_BREAK: 2484 case IO_XFER_ERROR_BREAK:
2485 PM8001_IO_DBG(pm8001_ha, 2485 PM8001_IO_DBG(pm8001_ha,
2486 pm8001_printk("IO_XFER_ERROR_BREAK\n")); 2486 pm8001_printk("IO_XFER_ERROR_BREAK\n"));
2487 ts->resp = SAS_TASK_COMPLETE; 2487 ts->resp = SAS_TASK_COMPLETE;
2488 ts->stat = SAM_BUSY; 2488 ts->stat = SAM_STAT_BUSY;
2489 break; 2489 break;
2490 case IO_XFER_ERROR_PHY_NOT_READY: 2490 case IO_XFER_ERROR_PHY_NOT_READY:
2491 PM8001_IO_DBG(pm8001_ha, 2491 PM8001_IO_DBG(pm8001_ha,
2492 pm8001_printk("IO_XFER_ERROR_PHY_NOT_READY\n")); 2492 pm8001_printk("IO_XFER_ERROR_PHY_NOT_READY\n"));
2493 ts->resp = SAS_TASK_COMPLETE; 2493 ts->resp = SAS_TASK_COMPLETE;
2494 ts->stat = SAM_BUSY; 2494 ts->stat = SAM_STAT_BUSY;
2495 break; 2495 break;
2496 case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED: 2496 case IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED:
2497 PM8001_IO_DBG(pm8001_ha, 2497 PM8001_IO_DBG(pm8001_ha,
@@ -3260,7 +3260,7 @@ mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)
3260 case IO_SUCCESS: 3260 case IO_SUCCESS:
3261 PM8001_EH_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n")); 3261 PM8001_EH_DBG(pm8001_ha, pm8001_printk("IO_SUCCESS\n"));
3262 ts->resp = SAS_TASK_COMPLETE; 3262 ts->resp = SAS_TASK_COMPLETE;
3263 ts->stat = SAM_GOOD; 3263 ts->stat = SAM_STAT_GOOD;
3264 break; 3264 break;
3265 case IO_NOT_VALID: 3265 case IO_NOT_VALID:
3266 PM8001_EH_DBG(pm8001_ha, pm8001_printk("IO_NOT_VALID\n")); 3266 PM8001_EH_DBG(pm8001_ha, pm8001_printk("IO_NOT_VALID\n"));
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index cd02ceaf67ff..6ae059ebb4bb 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -763,7 +763,7 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev,
763 } 763 }
764 764
765 if (task->task_status.resp == SAS_TASK_COMPLETE && 765 if (task->task_status.resp == SAS_TASK_COMPLETE &&
766 task->task_status.stat == SAM_GOOD) { 766 task->task_status.stat == SAM_STAT_GOOD) {
767 res = TMF_RESP_FUNC_COMPLETE; 767 res = TMF_RESP_FUNC_COMPLETE;
768 break; 768 break;
769 } 769 }
@@ -853,7 +853,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha,
853 } 853 }
854 854
855 if (task->task_status.resp == SAS_TASK_COMPLETE && 855 if (task->task_status.resp == SAS_TASK_COMPLETE &&
856 task->task_status.stat == SAM_GOOD) { 856 task->task_status.stat == SAM_STAT_GOOD) {
857 res = TMF_RESP_FUNC_COMPLETE; 857 res = TMF_RESP_FUNC_COMPLETE;
858 break; 858 break;
859 859
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 3b586859669c..d06e13be717b 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -422,16 +422,7 @@ enum service_response {
422}; 422};
423 423
424enum exec_status { 424enum exec_status {
425 SAM_GOOD = 0, 425 /* The SAM_STAT_.. codes fit in the lower 6 bits */
426 SAM_CHECK_COND = 2,
427 SAM_COND_MET = 4,
428 SAM_BUSY = 8,
429 SAM_INTERMEDIATE = 0x10,
430 SAM_IM_COND_MET = 0x12,
431 SAM_RESV_CONFLICT= 0x14,
432 SAM_TASK_SET_FULL= 0x28,
433 SAM_ACA_ACTIVE = 0x30,
434 SAM_TASK_ABORTED = 0x40,
435 426
436 SAS_DEV_NO_RESPONSE = 0x80, 427 SAS_DEV_NO_RESPONSE = 0x80,
437 SAS_DATA_UNDERRUN, 428 SAS_DATA_UNDERRUN,