From d9504c65be2a0794822363f3d75bb41e9c8b3691 Mon Sep 17 00:00:00 2001 From: Damien Le Moal Date: Mon, 26 Sep 2022 20:53:05 +0000 Subject: scsi: Define the COMPLETED sense key Add the definition for the COMPLETED sense key in scsi_proto.h. While at it, cleanup the white lines around the sense keys macro definitions. Signed-off-by: Damien Le Moal Signed-off-by: Niklas Cassel Acked-by: Martin K. Petersen --- include/scsi/scsi_proto.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h index c03e35fc382c..919ed4137f9a 100644 --- a/include/scsi/scsi_proto.h +++ b/include/scsi/scsi_proto.h @@ -205,10 +205,10 @@ enum sam_status { }; #define STATUS_MASK 0xfe + /* * SENSE KEYS */ - #define NO_SENSE 0x00 #define RECOVERED_ERROR 0x01 #define NOT_READY 0x02 @@ -223,7 +223,7 @@ enum sam_status { #define ABORTED_COMMAND 0x0b #define VOLUME_OVERFLOW 0x0d #define MISCOMPARE 0x0e - +#define COMPLETED 0x0f /* * DEVICE TYPES -- cgit v1.2.3 From fddb1a6424787d8089a9032bd5d21c428670f854 Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Fri, 7 Oct 2022 15:23:37 +0200 Subject: ata: add ata_port_is_frozen() helper At the request of the libata maintainer, introduce a ata_port_is_frozen() helper function. Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal --- include/linux/libata.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/linux/libata.h b/include/linux/libata.h index fe990176e6ee..af4953b95f76 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1043,6 +1043,11 @@ static inline int ata_port_is_dummy(struct ata_port *ap) return ap->ops == &ata_dummy_port_ops; } +static inline bool ata_port_is_frozen(const struct ata_port *ap) +{ + return ap->pflags & ATA_PFLAG_FROZEN; +} + extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, int (*check_ready)(struct ata_link *link)); -- cgit v1.2.3 From 67776a9ee69512b144250f1b9fbce4db76c0f3f8 Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Tue, 18 Oct 2022 21:10:52 +0200 Subject: ata: remove unused helper ata_id_lba48_enabled() Not only is this function unused, but even worse, the bit it is checking is actually used for signaling if the feature is supported, not enabled. Therefore, remove the unused helper function ata_id_lba48_enabled(). ata_id_has_lba48() is left unmodified, since this extra supported bit (Bit 10 of word 86) is simply a copy of the bit that ata_id_has_lba48() already checks (Bit 10 of word 83), see ACS-5 r10: 7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal --- include/linux/ata.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include') diff --git a/include/linux/ata.h b/include/linux/ata.h index e3050e153a71..c04aca58448a 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -698,15 +698,6 @@ static inline bool ata_id_has_lba48(const u16 *id) return id[ATA_ID_COMMAND_SET_2] & (1 << 10); } -static inline bool ata_id_lba48_enabled(const u16 *id) -{ - if (ata_id_has_lba48(id) == 0) - return false; - if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) - return false; - return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); -} - static inline bool ata_id_hpa_enabled(const u16 *id) { /* Yes children, word 83 valid bits cover word 82 data */ -- cgit v1.2.3 From 73eb5507fa5f86cd1b4e1a75348ff2e0d620c662 Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Tue, 18 Oct 2022 21:10:53 +0200 Subject: ata: remove unused helper ata_id_flush_enabled() Not only is this function unused, but even worse, the bit it is checking is actually used for signaling if the feature is supported, not enabled. Therefore, remove the unused helper function ata_id_flush_enabled(). ata_id_has_flush() is left unmodified, since this extra supported bit (Bit 12 of word 86) is simply a copy of the bit that ata_id_has_flush() already checks (Bit 12 of word 83), see ACS-5 r10: 7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal --- include/linux/ata.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include') diff --git a/include/linux/ata.h b/include/linux/ata.h index c04aca58448a..b32d62542e26 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -615,15 +615,6 @@ static inline bool ata_id_has_flush(const u16 *id) return id[ATA_ID_COMMAND_SET_2] & (1 << 12); } -static inline bool ata_id_flush_enabled(const u16 *id) -{ - if (ata_id_has_flush(id) == 0) - return false; - if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) - return false; - return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); -} - static inline bool ata_id_has_flush_ext(const u16 *id) { if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) -- cgit v1.2.3 From 90c313d353051c0eb5f6bbcb4b0f4cc0242f030c Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Tue, 18 Oct 2022 21:10:54 +0200 Subject: ata: remove unused helper ata_id_flush_ext_enabled() Not only is this function unused, but even worse, the bit it is checking is actually used for signaling if the feature is supported, not enabled. Therefore, remove the unused helper function ata_id_flush_ext_enabled(). ata_id_has_flush_ext() is left unmodified, since this extra supported bit (Bit 13 of word 86) is simply a copy of the bit that ata_id_has_flush_ext() already checks (Bit 13 of word 83), see ACS-5 r10: 7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal --- include/linux/ata.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'include') diff --git a/include/linux/ata.h b/include/linux/ata.h index b32d62542e26..0c18499f60b6 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -622,19 +622,6 @@ static inline bool ata_id_has_flush_ext(const u16 *id) return id[ATA_ID_COMMAND_SET_2] & (1 << 13); } -static inline bool ata_id_flush_ext_enabled(const u16 *id) -{ - if (ata_id_has_flush_ext(id) == 0) - return false; - if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) - return false; - /* - * some Maxtor disks have bit 13 defined incorrectly - * so check bit 10 too - */ - return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400; -} - static inline u32 ata_id_logical_sector_size(const u16 *id) { /* T13/1699-D Revision 6a, Sep 6, 2008. Page 128. -- cgit v1.2.3 From d5b560c014eddce747b2fd528d3071ded215b219 Mon Sep 17 00:00:00 2001 From: Sergey Shtylyov Date: Thu, 10 Nov 2022 00:47:42 +0300 Subject: ata: libata-sff: kill unused ata_sff_busy_sleep() Nobody seems to call ata_sff_busy_sleep(), so we can get rid of it... Signed-off-by: Sergey Shtylyov Signed-off-by: Damien Le Moal --- drivers/ata/libata-sff.c | 56 ------------------------------------------------ include/linux/libata.h | 2 -- 2 files changed, 58 deletions(-) (limited to 'include') diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 7916e369e15e..153f49e00713 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -184,62 +184,6 @@ void ata_sff_dma_pause(struct ata_port *ap) } EXPORT_SYMBOL_GPL(ata_sff_dma_pause); -/** - * ata_sff_busy_sleep - sleep until BSY clears, or timeout - * @ap: port containing status register to be polled - * @tmout_pat: impatience timeout in msecs - * @tmout: overall timeout in msecs - * - * Sleep until ATA Status register bit BSY clears, - * or a timeout occurs. - * - * LOCKING: - * Kernel thread context (may sleep). - * - * RETURNS: - * 0 on success, -errno otherwise. - */ -int ata_sff_busy_sleep(struct ata_port *ap, - unsigned long tmout_pat, unsigned long tmout) -{ - unsigned long timer_start, timeout; - u8 status; - - status = ata_sff_busy_wait(ap, ATA_BUSY, 300); - timer_start = jiffies; - timeout = ata_deadline(timer_start, tmout_pat); - while (status != 0xff && (status & ATA_BUSY) && - time_before(jiffies, timeout)) { - ata_msleep(ap, 50); - status = ata_sff_busy_wait(ap, ATA_BUSY, 3); - } - - if (status != 0xff && (status & ATA_BUSY)) - ata_port_warn(ap, - "port is slow to respond, please be patient (Status 0x%x)\n", - status); - - timeout = ata_deadline(timer_start, tmout); - while (status != 0xff && (status & ATA_BUSY) && - time_before(jiffies, timeout)) { - ata_msleep(ap, 50); - status = ap->ops->sff_check_status(ap); - } - - if (status == 0xff) - return -ENODEV; - - if (status & ATA_BUSY) { - ata_port_err(ap, - "port failed to respond (%lu secs, Status 0x%x)\n", - DIV_ROUND_UP(tmout, 1000), status); - return -EBUSY; - } - - return 0; -} -EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); - static int ata_sff_check_ready(struct ata_link *link) { u8 status = link->ap->ops->sff_check_status(link->ap); diff --git a/include/linux/libata.h b/include/linux/libata.h index af4953b95f76..c9149ebe7423 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1918,8 +1918,6 @@ extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); extern u8 ata_sff_check_status(struct ata_port *ap); extern void ata_sff_pause(struct ata_port *ap); extern void ata_sff_dma_pause(struct ata_port *ap); -extern int ata_sff_busy_sleep(struct ata_port *ap, - unsigned long timeout_pat, unsigned long timeout); extern int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline); extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf); -- cgit v1.2.3