Skip to contentSkip to conversation

2.4.x libata updates

PATCH In review Jeff Garzik 1 participant 2 messages Aug 18, 2004

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

PATCH 1/1 2.4.x libata updates

Please do a

bk pull bk://gkernel.bkbits.net/libata-upstream-2.4

This will update the following files:

 drivers/scsi/ata_piix.c     |    5 
 drivers/scsi/libata-core.c  |  138 ++++++++++++++-----
 drivers/scsi/libata-scsi.c  |  219 +++++++++++++++++++++++++++---
 drivers/scsi/libata.h       |    2 
 drivers/scsi/sata_nv.c      |  311 ++++++++++++++++++++++++++++++++++----------
 drivers/scsi/sata_promise.c |    1 
 drivers/scsi/sata_sil.c     |    3 
 drivers/scsi/sata_sis.c     |    1 
 drivers/scsi/sata_svw.c     |    1 
 drivers/scsi/sata_sx4.c     |    1 
 drivers/scsi/sata_via.c     |    1 
 drivers/scsi/sata_vsc.c     |    1 
 include/linux/ata.h         |    7 
 include/linux/libata.h      |    8 +
 include/scsi/scsi.h         |    1 
 15 files changed, 575 insertions(+), 125 deletions(-)

through these ChangeSets:

<[email protected]> (04/08/18 1.1481)
[libata] fix INQUIRY handling

Changes:
- send vendor, product and rev strings back for 36 byte INQUIRYs
- set the additional length field to indicate 96 byte response is available

<[email protected]> (04/08/18 1.1480)
[libata] fix error recovery reference count and in-recovery flag

This bug could potentially lead to soft hangs (processes stuck in D state) if an error occurred.

Yet another undocumented nuance of the ->eh_strategy_handler.

Thanks to excellent detective work by Brad Campbell tracking this down. Thanks also to Doug Ledford.

<[email protected]> (04/08/16 1.1479)
[PATCH] libata build fix

drivers/scsi/libata-core.c: In function `swap_buf_le16':
drivers/scsi/libata-core.c:2073: `words' undeclared (first use in this function) drivers/scsi/libata-core.c:2073: (Each undeclared identifier is reported only once

<[email protected]> (04/08/14 1.1478)
[libata] add ioctl infrastructure

Mainly adding the infrastructure for various ATA ioctls. Currently only supports two ATA-specific ioctls:
HDIO_GET_32BIT and HDIO_SET_32BIT (hdparm -c)

<[email protected]> (04/08/14 1.1477)
[libata] ATAPI PIO data xfer

Abstract out PIO data xfer to xfer-a-sector and other-stuff pieces, then add new ATAPI code that uses the common xfer-a-sector code.

<[email protected]> (04/08/14 1.1476)
[libata] fix PIO data xfer on big endian

We were reading the data swapped, which was correct for the data page read from IDENTIFY DEVICE and incorrect for all other situations.

Noticed by Ben Herrenschmidt.

<[email protected]> (04/08/14 1.1475)
[libata] support commands SYNCHRONIZE CACHE, VERIFY, VERIFY(16)

<[email protected]> (04/08/13 1.1474)
[libata sata_nv] support for hardware, bug fixes

<[email protected]> (04/08/13 1.1473)
[libata] (cosmetic) sync with 2.6.x

drivers/scsi/ata_piix.c +5 -0
diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
@@ -2,6 +2,10 @@
 
     ata_piix.c - Intel PATA/SATA controllers
 
+    Maintained by:  Jeff Garzik <[email protected]>
+    		    Please ALWAYS copy [email protected]
+		    on emails.
+
 
 	Copyright 2003-2004 Red Hat Inc
 	Copyright 2003-2004 Jeff Garzik
@@ -102,6 +106,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/libata-core.c +101 -37

212 lines not on this page · raw message

drivers/scsi/libata-scsi.c +197 -22

339 lines not on this page · raw message

drivers/scsi/libata.h +1 -1
diff -Nru a/drivers/scsi/libata.h b/drivers/scsi/libata.h
@@ -35,7 +35,6 @@
 	void			(*done)(struct scsi_cmnd *);
 };
 
-
 /* libata-core.c */
 extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
 				      struct ata_device *dev);
@@ -43,6 +42,7 @@
 extern void ata_dev_select(struct ata_port *ap, unsigned int device,
                            unsigned int wait, unsigned int can_sleep);
 extern void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf);
+extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
 
 
 /* libata-scsi.c */
drivers/scsi/sata_nv.c +247 -64

448 lines not on this page · raw message

drivers/scsi/sata_promise.c +1 -0
diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
@@ -91,6 +91,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/sata_sil.c +2 -1
diff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
@@ -6,7 +6,7 @@
  *		    on emails.
  *
  *  Copyright 2003 Red Hat, Inc.
- *  Copyright 2003 Benjamin Herrenschmidt <[email protected]>
+ *  Copyright 2003 Benjamin Herrenschmidt
  *
  *  The contents of this file are subject to the Open
  *  Software License version 1.1 that can be found at
@@ -108,6 +108,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/sata_sis.c +1 -0
diff -Nru a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
@@ -78,6 +78,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/sata_svw.c +1 -0
diff -Nru a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
@@ -207,6 +207,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/sata_sx4.c +1 -0
diff -Nru a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
@@ -176,6 +176,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/sata_via.c +1 -0
diff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
@@ -83,6 +83,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
drivers/scsi/sata_vsc.c +1 -0
diff -Nru a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
@@ -192,6 +192,7 @@
 	.name			= DRV_NAME,
 	.detect			= ata_scsi_detect,
 	.release		= ata_scsi_release,
+	.ioctl                  = ata_scsi_ioctl,
 	.queuecommand		= ata_scsi_queuecmd,
 	.eh_strategy_handler	= ata_scsi_error,
 	.can_queue		= ATA_DEF_QUEUE,
include/linux/ata.h +7 -0
diff -Nru a/include/linux/ata.h b/include/linux/ata.h
@@ -182,6 +182,11 @@
 	ATA_PROT_ATAPI_DMA,	/* packet command with special DMA sauce */
 };
 
+enum ata_ioctls {
+	ATA_IOC_GET_IO32	= 0x309,
+	ATA_IOC_SET_IO32	= 0x324,
+};
+
 /* core structures */
 
 struct ata_prd {
@@ -215,6 +220,8 @@
 #define ata_id_is_ata(dev)	(((dev)->id[0] & (1 << 15)) == 0)
 #define ata_id_rahead_enabled(dev) ((dev)->id[85] & (1 << 6))
 #define ata_id_wcache_enabled(dev) ((dev)->id[85] & (1 << 5))
+#define ata_id_has_flush(dev) ((dev)->id[83] & (1 << 12))
+#define ata_id_has_flush_ext(dev) ((dev)->id[83] & (1 << 13))
 #define ata_id_has_lba48(dev)	((dev)->id[83] & (1 << 10))
 #define ata_id_has_wcache(dev)	((dev)->id[82] & (1 << 5))
 #define ata_id_has_pm(dev)	((dev)->id[82] & (1 << 3))
include/linux/libata.h +8 -0
diff -Nru a/include/linux/libata.h b/include/linux/libata.h
@@ -371,6 +371,7 @@
 extern void ata_pci_remove_one (struct pci_dev *pdev);
 extern int ata_device_add(struct ata_probe_ent *ent);
 extern int ata_scsi_detect(Scsi_Host_Template *sht);
+extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
 extern int ata_scsi_error(struct Scsi_Host *host);
 extern int ata_scsi_release(struct Scsi_Host *host);
@@ -609,6 +610,13 @@
 	} else
 		host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
 	return host_stat;
+}
+
+static inline int ata_try_flush_cache(struct ata_device *dev)
+{
+	return ata_id_wcache_enabled(dev) ||
+	       ata_id_has_flush(dev) ||
+	       ata_id_has_flush_ext(dev);
 }
 
 #endif /* __LINUX_LIBATA_H__ */
include/scsi/scsi.h +1 -0
diff -Nru a/include/scsi/scsi.h b/include/scsi/scsi.h
@@ -91,6 +91,7 @@
 #define WRITE_LONG_2          0xea
 #define READ_16               0x88
 #define WRITE_16              0x8a
+#define VERIFY_16	      0x8f
 #define SERVICE_ACTION_IN     0x9e
 /* values for service action in */
 #define SAI_READ_CAPACITY_16  0x10
#1 lore raw
Quoted 3 lines · Jeff Garzik

Please do a

bk pull bk://gkernel.bkbits.net/libata-upstream-2.4

Crap!

This should be:

bk pull bk://kernel.bkbits.net/jgarzik/libata-upstream-2.4