Skip to contentSkip to conversation

2.4.x libata update (updated :))

PATCH New Jeff Garzik 1 participant 1 message Aug 19, 2004

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

PATCH 1/1 2.4.x libata update (updated :))

(updated, and with correct 'bk pull' URL)

Please do a

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

This will update the following files:

 Documentation/Configure.help |   10 +
 drivers/scsi/ata_piix.c      |    5 
 drivers/scsi/libata-core.c   |  138 +++++++++++----
 drivers/scsi/libata-scsi.c   |  377 ++++++++++++++++++++++++++++++++++++++-----
 drivers/scsi/libata.h        |    4 
 drivers/scsi/sata_nv.c       |  315 ++++++++++++++++++++++++++++-------
 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          |    9 -
 include/linux/libata.h       |    8 
 include/scsi/scsi.h          |    1 
 16 files changed, 732 insertions(+), 144 deletions(-)

through these ChangeSets:

<[email protected]> (04/08/18 1.1485)
[libata sata_nv] fix leak on error

Spotted by Francois Romieu.

<[email protected]> (04/08/18 1.1484)
[libata] improve translation of ATA errors to SCSI sense codes

<[email protected]> (04/08/18 1.1483)
[ata] remove 'packed' attributed from struct ata_prd

It's not needed, and it generates very poor code on some platforms.

Noticed by Bart and David Miller.

<[email protected]> (04/08/18 1.1482)
[PATCH] 2.4.28-pre1: add two SATA Configure.help entries

The trivial patch below adds the missing Configure.help entries for two new options.

<[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

Documentation/Configure.help +10 -0
diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help
@@ -9299,6 +9299,16 @@
 
   If unsure, say N.
 
+CONFIG_SCSI_ATA_PIIX
+  This option enables support for ICH5 Serial ATA.
+
+  If unsure, say N.
+
+CONFIG_SCSI_SATA_NV
+  This option enables support for NVIDIA Serial ATA.
+
+  If unsure, say N.
+
 CONFIG_SCSI_SATA_PROMISE
   This option enables support for Promise Serial ATA TX2/TX4.
 
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 +338 -39

521 lines not on this page · raw message

drivers/scsi/libata.h +2 -2
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,10 +42,11 @@
 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 */
-extern void ata_to_sense_error(struct ata_queued_cmd *qc);
+extern void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat);
 extern int ata_scsi_error(struct Scsi_Host *host);
 extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
 			       unsigned int buflen);
drivers/scsi/sata_nv.c +251 -64

452 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 +8 -1
diff -Nru a/include/linux/ata.h b/include/linux/ata.h
@@ -182,12 +182,17 @@
 	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 {
 	u32			addr;
 	u32			flags_len;
-} __attribute__((packed));
+};
 
 struct ata_taskfile {
 	unsigned long		flags;		/* ATA_TFLAG_xxx */
@@ -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