Skip to contentSkip to conversation

libata updates

PATCH In review Jeff Garzik 1 participant 2 messages Mar 23, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libata updates

Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

to receive the following updates:

 drivers/scsi/Kconfig        |    4 -
 drivers/scsi/ahci.c         |  135 +++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/libata-bmdma.c |   39 ++++++++++++
 drivers/scsi/libata-core.c  |  142 +++++++++++++++++++++++++++-----------------
 drivers/scsi/libata-scsi.c  |  138 ++++++++++++++++++++++++++----------------
 drivers/scsi/pdc_adma.c     |    2 
 drivers/scsi/sata_mv.c      |    5 +
 drivers/scsi/sata_svw.c     |   54 ++++++++--------
 drivers/scsi/sata_vsc.c     |  122 ++++++++++++++++++++-----------------
 include/linux/ata.h         |    7 +-
 include/linux/libata.h      |    4 -
 11 files changed, 459 insertions(+), 193 deletions(-)

Alan Cox:
libata: Add the useful macros/constants needed for merging PATA stuff
libata: pick a less confusion "um dunno" error
libata: make code actually compile with debugging on
libata: Note weakness in our PCI handling that one day wants fixing
libata: two new PCI helpers
libata: report which drive is causing mode problems
libata: make irqtrap mode compile
libata: note missing posting in mmio cmd write
libata: Fix a drive detection problem
Update libata DMA blacklist to cover versions, and resync with IDE layer
libata: Symbol exports

Albert Lee:
libata-dev: add flush task to ata_exec_internal()
libata-dev: Remove ATA_PROT_PIO_MULT

Brian King:
libata: Add some dummy noop functions
libata: ata_scsi_slave_config cleanup

Dan Williams:
[libata] sata_vsc: fix inconsistent NULL checking

Jeff Garzik:
[libata] SCSI VPD page 0x83 fixes
[libata] add prototypes for helpers
[libata] fix oops on non-DMA bmdma hardware
[libata sata_vsc, sata_svw] Convert #define'd constants to enums

Mark Lord:
[libata] sata_mv: off-by-1 fix

Tejun Heo:
libata: do not ignore PIO-only devices
ahci: add softreset

drivers/scsi/Kconfig +2 -2
index 5c94a5d..4035920 100644
@@ -595,10 +595,10 @@ config SCSI_SATA_VIA
 	  If unsure, say N.
 
 config SCSI_SATA_VITESSE
-	tristate "VITESSE VSC-7174 SATA support"
+	tristate "VITESSE VSC-7174 / INTEL 31244 SATA support"
 	depends on SCSI_SATA && PCI
 	help
-	  This option enables support for Vitesse VSC7174 Serial ATA.
+	  This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA.
 
 	  If unsure, say N.
 
drivers/scsi/ahci.c +134 -1

147 lines not on this page · raw message

drivers/scsi/libata-bmdma.c +39 -0
index a93336a..96b4d21 100644
@@ -214,6 +214,8 @@ static void ata_exec_command_pio(struct 
  *	Issues MMIO write to ATA command register, with proper
  *	synchronization with interrupt handler / other threads.
  *
+ *	FIXME: missing write posting for 400nS delay enforcement
+ *
  *	LOCKING:
  *	spin_lock_irqsave(host_set lock)
  */
@@ -648,6 +650,7 @@ int ata_pci_init_one (struct pci_dev *pd
 		goto err_out_regions;
 	}
 
+	/* FIXME: If we get no DMA mask we should fall back to PIO */
 	rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
 	if (rc)
 		goto err_out_regions;
@@ -699,5 +702,41 @@ err_out:
 	return rc;
 }
 
+/**
+ *	ata_pci_clear_simplex	-	attempt to kick device out of simplex
+ *	@pdev: PCI device
+ *
+ *	Some PCI ATA devices report simplex mode but in fact can be told to
+ *	enter non simplex mode. This implements the neccessary logic to 
+ *	perform the task on such devices. Calling it on other devices will
+ *	have -undefined- behaviour.
+ */
+
+int ata_pci_clear_simplex(struct pci_dev *pdev)
+{
+	unsigned long bmdma = pci_resource_start(pdev, 4);
+	u8 simplex;
+
+	if (bmdma == 0)
+		return -ENOENT;
+
+	simplex = inb(bmdma + 0x02);
+	outb(simplex & 0x60, bmdma + 0x02);
+	simplex = inb(bmdma + 0x02);
+	if (simplex & 0x80)
+		return -EOPNOTSUPP;
+	return 0;
+}
+
+unsigned long ata_pci_default_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long xfer_mask)
+{
+	/* Filter out DMA modes if the device has been configured by
+	   the BIOS as PIO only */
+	   
+	if (ap->ioaddr.bmdma_addr == 0)
+		xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
+	return xfer_mask;
+}
+
 #endif /* CONFIG_PCI */
 
drivers/scsi/libata-core.c +89 -53

220 lines not on this page · raw message

drivers/scsi/libata-scsi.c +86 -52

226 lines not on this page · raw message

drivers/scsi/pdc_adma.c +1 -1
index b3dc5f8..3c85c4b 100644
@@ -321,7 +321,7 @@ static int adma_fill_sg(struct ata_queue
 			= (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4);
 		i += 4;
 
-		VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", nelem,
+		VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
 					(unsigned long)addr, len);
 	}
 	return i;
drivers/scsi/sata_mv.c +4 -1
index 874c5be..275ed9b 100644
@@ -1262,6 +1262,7 @@ static u8 mv_get_crpb_status(struct ata_
 	void __iomem *port_mmio = mv_ap_base(ap);
 	struct mv_port_priv *pp = ap->private_data;
 	u32 out_ptr;
+	u8 ata_status;
 
 	out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
 
@@ -1269,6 +1270,8 @@ static u8 mv_get_crpb_status(struct ata_
 	WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) !=
 		pp->rsp_consumer);
 
+	ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT;
+
 	/* increment our consumer index... */
 	pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer);
 
@@ -1283,7 +1286,7 @@ static u8 mv_get_crpb_status(struct ata_
 	writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS);
 
 	/* Return ATA status register for completed CRPB */
-	return (pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT);
+	return ata_status;
 }
 
 /**
drivers/scsi/sata_svw.c +28 -26

61 lines not on this page · raw message

drivers/scsi/sata_vsc.c +67 -55

145 lines not on this page · raw message

include/linux/ata.h +6 -1
index b02a16c..312a2c0 100644
@@ -146,6 +146,8 @@ enum {
  	ATA_CMD_STANDBYNOW1	= 0xE0,
  	ATA_CMD_IDLEIMMEDIATE	= 0xE1,
 	ATA_CMD_INIT_DEV_PARAMS	= 0x91,
+	ATA_CMD_READ_NATIVE_MAX	= 0xF8,
+	ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
 
 	/* SETFEATURES stuff */
 	SETFEATURES_XFER	= 0x03,
@@ -204,7 +206,6 @@ enum ata_tf_protocols {
 	ATA_PROT_UNKNOWN,	/* unknown/invalid */
 	ATA_PROT_NODATA,	/* no data */
 	ATA_PROT_PIO,		/* PIO single sector */
-	ATA_PROT_PIO_MULT,	/* PIO multiple sector */
 	ATA_PROT_DMA,		/* DMA */
 	ATA_PROT_ATAPI,		/* packet command, PIO data xfer*/
 	ATA_PROT_ATAPI_NODATA,	/* packet command, no data */
@@ -247,18 +248,22 @@ struct ata_taskfile {
 };
 
 #define ata_id_is_ata(id)	(((id)[0] & (1 << 15)) == 0)
+#define ata_id_is_cfa(id)	((id)[0] == 0x848A)
 #define ata_id_is_sata(id)	((id)[93] == 0)
 #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
 #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
+#define ata_id_hpa_enabled(id)	((id)[85] & (1 << 10))
 #define ata_id_has_fua(id)	((id)[84] & (1 << 6))
 #define ata_id_has_flush(id)	((id)[83] & (1 << 12))
 #define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
 #define ata_id_has_lba48(id)	((id)[83] & (1 << 10))
+#define ata_id_has_hpa(id)	((id)[82] & (1 << 10))
 #define ata_id_has_wcache(id)	((id)[82] & (1 << 5))
 #define ata_id_has_pm(id)	((id)[82] & (1 << 3))
 #define ata_id_has_lba(id)	((id)[49] & (1 << 9))
 #define ata_id_has_dma(id)	((id)[49] & (1 << 8))
 #define ata_id_removeable(id)	((id)[0] & (1 << 7))
+#define ata_id_has_dword_io(id)	((id)[50] & (1 << 0))
 #define ata_id_u32(id,n)	\
 	(((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
 #define ata_id_u64(id,n)	\
include/linux/libata.h +3 -1
index 204c37a..7a54244 100644
@@ -502,6 +502,7 @@ extern int ata_pci_init_one (struct pci_
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
 extern int ata_pci_device_resume(struct pci_dev *pdev);
+extern int ata_pci_clear_simplex(struct pci_dev *pdev);
 #endif /* CONFIG_PCI */
 extern int ata_device_add(const struct ata_probe_ent *ent);
 extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -542,6 +543,7 @@ extern void ata_port_stop (struct ata_po
 extern void ata_host_stop (struct ata_host_set *host_set);
 extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs);
 extern void ata_qc_prep(struct ata_queued_cmd *qc);
+extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
 extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
 extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
 		unsigned int buflen);
@@ -608,7 +610,7 @@ extern void ata_pci_host_stop (struct at
 extern struct ata_probe_ent *
 ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int portmask);
 extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
-
+extern unsigned long ata_pci_default_filter(const struct ata_port *, struct ata_device *, unsigned long);
 #endif /* CONFIG_PCI */
 
 
#1 lore raw
Quoted 2 lines · Jeff Garzik

Please pull from 'upstream-linus' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git

In case it isn't obvious from the git history, this includes merging with James B's SCSI pull (2152f8536668a957ea3214735b4761e7b22ef7d8) and testing the result.

Jeff