aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-12 00:16:23 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-12 00:16:23 -0400
commit6c08772e49622e90d39903e7ff0be1a0f463ac86 (patch)
tree768a9026b3d5f86473a3be25584cda3afcb10253 /drivers/ata/sata_mv.c
parentbbf25010f1a6b761914430f5fca081ec8c7accd1 (diff)
[libata] sata_mv: more S/G fixes
* corruption fix: we only want the lower 16 bits of length (0 == 64kb) * ditto: the upper layer sets max-phys-segments to LIBATA_MAX_PRD, so we must reset it to own hw-specific length. * delete unused mv_fill_sg() return value Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index cb7dec97fee6..d9832e234e44 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -69,10 +69,11 @@
69#include <linux/device.h> 69#include <linux/device.h>
70#include <scsi/scsi_host.h> 70#include <scsi/scsi_host.h>
71#include <scsi/scsi_cmnd.h> 71#include <scsi/scsi_cmnd.h>
72#include <scsi/scsi_device.h>
72#include <linux/libata.h> 73#include <linux/libata.h>
73 74
74#define DRV_NAME "sata_mv" 75#define DRV_NAME "sata_mv"
75#define DRV_VERSION "1.0" 76#define DRV_VERSION "1.01"
76 77
77enum { 78enum {
78 /* BAR's are enumerated in terms of pci_resource_start() terms */ 79 /* BAR's are enumerated in terms of pci_resource_start() terms */
@@ -420,6 +421,7 @@ static void mv_error_handler(struct ata_port *ap);
420static void mv_post_int_cmd(struct ata_queued_cmd *qc); 421static void mv_post_int_cmd(struct ata_queued_cmd *qc);
421static void mv_eh_freeze(struct ata_port *ap); 422static void mv_eh_freeze(struct ata_port *ap);
422static 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);
423static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 425static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
424 426
425static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, 427static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -457,7 +459,7 @@ static struct scsi_host_template mv5_sht = {
457 .use_clustering = 1, 459 .use_clustering = 1,
458 .proc_name = DRV_NAME, 460 .proc_name = DRV_NAME,
459 .dma_boundary = MV_DMA_BOUNDARY, 461 .dma_boundary = MV_DMA_BOUNDARY,
460 .slave_configure = ata_scsi_slave_config, 462 .slave_configure = mv_slave_config,
461 .slave_destroy = ata_scsi_slave_destroy, 463 .slave_destroy = ata_scsi_slave_destroy,
462 .bios_param = ata_std_bios_param, 464 .bios_param = ata_std_bios_param,
463}; 465};
@@ -475,7 +477,7 @@ static struct scsi_host_template mv6_sht = {
475 .use_clustering = 1, 477 .use_clustering = 1,
476 .proc_name = DRV_NAME, 478 .proc_name = DRV_NAME,
477 .dma_boundary = MV_DMA_BOUNDARY, 479 .dma_boundary = MV_DMA_BOUNDARY,
478 .slave_configure = ata_scsi_slave_config, 480 .slave_configure = mv_slave_config,
479 .slave_destroy = ata_scsi_slave_destroy, 481 .slave_destroy = ata_scsi_slave_destroy,
480 .bios_param = ata_std_bios_param, 482 .bios_param = ata_std_bios_param,
481}; 483};
@@ -763,6 +765,17 @@ static void mv_irq_clear(struct ata_port *ap)
763{ 765{
764} 766}
765 767
768static int mv_slave_config(struct scsi_device *sdev)
769{
770 int rc = ata_scsi_slave_config(sdev);
771 if (rc)
772 return rc;
773
774 blk_queue_max_phys_segments(sdev->request_queue, MV_MAX_SG_CT / 2);
775
776 return 0; /* scsi layer doesn't check return value, sigh */
777}
778
766static void mv_set_edma_ptrs(void __iomem *port_mmio, 779static void mv_set_edma_ptrs(void __iomem *port_mmio,
767 struct mv_host_priv *hpriv, 780 struct mv_host_priv *hpriv,
768 struct mv_port_priv *pp) 781 struct mv_port_priv *pp)
@@ -1130,10 +1143,9 @@ static void mv_port_stop(struct ata_port *ap)
1130 * LOCKING: 1143 * LOCKING:
1131 * Inherited from caller. 1144 * Inherited from caller.
1132 */ 1145 */
1133static unsigned int mv_fill_sg(struct ata_queued_cmd *qc) 1146static void mv_fill_sg(struct ata_queued_cmd *qc)
1134{ 1147{
1135 struct mv_port_priv *pp = qc->ap->private_data; 1148 struct mv_port_priv *pp = qc->ap->private_data;
1136 unsigned int n_sg = 0;
1137 struct scatterlist *sg; 1149 struct scatterlist *sg;
1138 struct mv_sg *mv_sg; 1150 struct mv_sg *mv_sg;
1139 1151
@@ -1151,7 +1163,7 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
1151 1163
1152 mv_sg->addr = cpu_to_le32(addr & 0xffffffff); 1164 mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
1153 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 1165 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
1154 mv_sg->flags_size = cpu_to_le32(len); 1166 mv_sg->flags_size = cpu_to_le32(len & 0xffff);
1155 1167
1156 sg_len -= len; 1168 sg_len -= len;
1157 addr += len; 1169 addr += len;
@@ -1160,12 +1172,9 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
1160 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); 1172 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1161 1173
1162 mv_sg++; 1174 mv_sg++;
1163 n_sg++;
1164 } 1175 }
1165 1176
1166 } 1177 }
1167
1168 return n_sg;
1169} 1178}
1170 1179
1171static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) 1180static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)