aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/pdc_adma.c9
-rw-r--r--drivers/ata/sata_mv.c26
-rw-r--r--drivers/ata/sata_sil24.c11
-rw-r--r--drivers/scsi/ipr.c11
-rw-r--r--include/linux/libata.h12
5 files changed, 27 insertions, 42 deletions
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 8d1b03d5bcb1..199f7e150eb3 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -318,7 +318,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
318 struct scatterlist *sg; 318 struct scatterlist *sg;
319 struct ata_port *ap = qc->ap; 319 struct ata_port *ap = qc->ap;
320 struct adma_port_priv *pp = ap->private_data; 320 struct adma_port_priv *pp = ap->private_data;
321 u8 *buf = pp->pkt; 321 u8 *buf = pp->pkt, *last_buf = NULL;
322 int i = (2 + buf[3]) * 8; 322 int i = (2 + buf[3]) * 8;
323 u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); 323 u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0);
324 324
@@ -334,8 +334,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
334 *(__le32 *)(buf + i) = cpu_to_le32(len); 334 *(__le32 *)(buf + i) = cpu_to_le32(len);
335 i += 4; 335 i += 4;
336 336
337 if (ata_sg_is_last(sg, qc)) 337 last_buf = &buf[i];
338 pFLAGS |= pEND;
339 buf[i++] = pFLAGS; 338 buf[i++] = pFLAGS;
340 buf[i++] = qc->dev->dma_mode & 0xf; 339 buf[i++] = qc->dev->dma_mode & 0xf;
341 buf[i++] = 0; /* pPKLW */ 340 buf[i++] = 0; /* pPKLW */
@@ -348,6 +347,10 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
348 VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, 347 VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
349 (unsigned long)addr, len); 348 (unsigned long)addr, len);
350 } 349 }
350
351 if (likely(last_buf))
352 *last_buf |= pEND;
353
351 return i; 354 return i;
352} 355}
353 356
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 4df8311968e9..7f1b13e89cf7 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -421,7 +421,6 @@ static void mv_error_handler(struct ata_port *ap);
421static void mv_post_int_cmd(struct ata_queued_cmd *qc); 421static void mv_post_int_cmd(struct ata_queued_cmd *qc);
422static void mv_eh_freeze(struct ata_port *ap); 422static void mv_eh_freeze(struct ata_port *ap);
423static void mv_eh_thaw(struct ata_port *ap); 423static void mv_eh_thaw(struct ata_port *ap);
424static int mv_slave_config(struct scsi_device *sdev);
425static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 424static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
426 425
427static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, 426static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -459,7 +458,7 @@ static struct scsi_host_template mv5_sht = {
459 .use_clustering = 1, 458 .use_clustering = 1,
460 .proc_name = DRV_NAME, 459 .proc_name = DRV_NAME,
461 .dma_boundary = MV_DMA_BOUNDARY, 460 .dma_boundary = MV_DMA_BOUNDARY,
462 .slave_configure = mv_slave_config, 461 .slave_configure = ata_scsi_slave_config,
463 .slave_destroy = ata_scsi_slave_destroy, 462 .slave_destroy = ata_scsi_slave_destroy,
464 .bios_param = ata_std_bios_param, 463 .bios_param = ata_std_bios_param,
465}; 464};
@@ -477,7 +476,7 @@ static struct scsi_host_template mv6_sht = {
477 .use_clustering = 1, 476 .use_clustering = 1,
478 .proc_name = DRV_NAME, 477 .proc_name = DRV_NAME,
479 .dma_boundary = MV_DMA_BOUNDARY, 478 .dma_boundary = MV_DMA_BOUNDARY,
480 .slave_configure = mv_slave_config, 479 .slave_configure = ata_scsi_slave_config,
481 .slave_destroy = ata_scsi_slave_destroy, 480 .slave_destroy = ata_scsi_slave_destroy,
482 .bios_param = ata_std_bios_param, 481 .bios_param = ata_std_bios_param,
483}; 482};
@@ -756,17 +755,6 @@ static void mv_irq_clear(struct ata_port *ap)
756{ 755{
757} 756}
758 757
759static int mv_slave_config(struct scsi_device *sdev)
760{
761 int rc = ata_scsi_slave_config(sdev);
762 if (rc)
763 return rc;
764
765 blk_queue_max_phys_segments(sdev->request_queue, MV_MAX_SG_CT / 2);
766
767 return 0; /* scsi layer doesn't check return value, sigh */
768}
769
770static void mv_set_edma_ptrs(void __iomem *port_mmio, 758static void mv_set_edma_ptrs(void __iomem *port_mmio,
771 struct mv_host_priv *hpriv, 759 struct mv_host_priv *hpriv,
772 struct mv_port_priv *pp) 760 struct mv_port_priv *pp)
@@ -1138,7 +1126,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1138{ 1126{
1139 struct mv_port_priv *pp = qc->ap->private_data; 1127 struct mv_port_priv *pp = qc->ap->private_data;
1140 struct scatterlist *sg; 1128 struct scatterlist *sg;
1141 struct mv_sg *mv_sg; 1129 struct mv_sg *mv_sg, *last_sg = NULL;
1142 1130
1143 mv_sg = pp->sg_tbl; 1131 mv_sg = pp->sg_tbl;
1144 ata_for_each_sg(sg, qc) { 1132 ata_for_each_sg(sg, qc) {
@@ -1159,13 +1147,13 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1159 sg_len -= len; 1147 sg_len -= len;
1160 addr += len; 1148 addr += len;
1161 1149
1162 if (!sg_len && ata_sg_is_last(sg, qc)) 1150 last_sg = mv_sg;
1163 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1164
1165 mv_sg++; 1151 mv_sg++;
1166 } 1152 }
1167
1168 } 1153 }
1154
1155 if (likely(last_sg))
1156 last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1169} 1157}
1170 1158
1171static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) 1159static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b0619278454a..26ebffc10f3e 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -796,16 +796,19 @@ static inline void sil24_fill_sg(struct ata_queued_cmd *qc,
796 struct sil24_sge *sge) 796 struct sil24_sge *sge)
797{ 797{
798 struct scatterlist *sg; 798 struct scatterlist *sg;
799 struct sil24_sge *last_sge = NULL;
799 800
800 ata_for_each_sg(sg, qc) { 801 ata_for_each_sg(sg, qc) {
801 sge->addr = cpu_to_le64(sg_dma_address(sg)); 802 sge->addr = cpu_to_le64(sg_dma_address(sg));
802 sge->cnt = cpu_to_le32(sg_dma_len(sg)); 803 sge->cnt = cpu_to_le32(sg_dma_len(sg));
803 if (ata_sg_is_last(sg, qc)) 804 sge->flags = 0;
804 sge->flags = cpu_to_le32(SGE_TRM); 805
805 else 806 last_sge = sge;
806 sge->flags = 0;
807 sge++; 807 sge++;
808 } 808 }
809
810 if (likely(last_sge))
811 last_sge->flags = cpu_to_le32(SGE_TRM);
809} 812}
810 813
811static int sil24_qc_defer(struct ata_queued_cmd *qc) 814static int sil24_qc_defer(struct ata_queued_cmd *qc)
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index b41dfb539021..c316a0bcae6c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5134,6 +5134,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5134 u32 ioadl_flags = 0; 5134 u32 ioadl_flags = 0;
5135 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 5135 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
5136 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 5136 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
5137 struct ipr_ioadl_desc *last_ioadl = NULL;
5137 int len = qc->nbytes + qc->pad_len; 5138 int len = qc->nbytes + qc->pad_len;
5138 struct scatterlist *sg; 5139 struct scatterlist *sg;
5139 5140
@@ -5156,11 +5157,13 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5156 ata_for_each_sg(sg, qc) { 5157 ata_for_each_sg(sg, qc) {
5157 ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg)); 5158 ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg));
5158 ioadl->address = cpu_to_be32(sg_dma_address(sg)); 5159 ioadl->address = cpu_to_be32(sg_dma_address(sg));
5159 if (ata_sg_is_last(sg, qc)) 5160
5160 ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); 5161 last_ioadl = ioadl;
5161 else 5162 ioadl++;
5162 ioadl++;
5163 } 5163 }
5164
5165 if (likely(last_ioadl))
5166 last_ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST);
5164} 5167}
5165 5168
5166/** 5169/**
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 377e6d4d9be3..bc3b6fc7b98d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1037,18 +1037,6 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
1037/* 1037/*
1038 * qc helpers 1038 * qc helpers
1039 */ 1039 */
1040static inline int
1041ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
1042{
1043 if (sg == &qc->pad_sgent)
1044 return 1;
1045 if (qc->pad_len)
1046 return 0;
1047 if (qc->n_iter == qc->n_elem)
1048 return 1;
1049 return 0;
1050}
1051
1052static inline struct scatterlist * 1040static inline struct scatterlist *
1053ata_qc_first_sg(struct ata_queued_cmd *qc) 1041ata_qc_first_sg(struct ata_queued_cmd *qc)
1054{ 1042{