summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-08-19 12:31:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-08-19 12:31:50 -0700
commitfaabe2db712e8310dbe38fb81d33e5313ff0f059 (patch)
tree8f917cb0126f652d041e8b2ed03f5aa6fa5a1e54 /include
parent59e6295fac26b8e85c1ea859cdd89fa1e47519d7 (diff)
parent73b6bf3c314ad34a9fd389f84de6e8dbfc204880 (diff)
downloadlinux-stable-faabe2db712e8310dbe38fb81d33e5313ff0f059.tar.gz
linux-stable-faabe2db712e8310dbe38fb81d33e5313ff0f059.zip
Merge tag 'ata-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux
Pull ata updates from Damien Le Moal: - Some code cleanups to rename the function used to identify ZAC devices and declare some local functions static (me) - Refactoring and improvement of the translation of the SCSI REPORT SUPPORTED OPCODES command to allow users access to the entire list of supported commands (me) - Fix the translation of the WRITE SAME command with UNMAP bit set (DSM TRIM) for devices with a sector size larger than 2K and devices that support multiple TRIM segments (Niklas) - Add support detecting support for and translating the SCSI commands related to the storage elements depopulation feature (GET PHYSICAL ELEMENT STATUS, REMOVE ELEMENT AND TRUCATE, REMOVE ELEMENT AND MODIFY ZONES and RESTORE ELEMENTS AND REBUILD) (me) - Improvements to the sata_mv driver probe code (clocks and IRQ initialization) (Rosen) - Improve resource initialization in the pata_rb532_cf, pata_pxa, sata_highbank and ahci_da850 drivers (Rosen) - Improve PIO data-in command completions to better hndle slow devices, e.g. CF cards (Richard) - Improve the DMA channel management using device resources in the pata_pxa driver (Rosen) - Fix the pata_ep93xx driver to correctly fallback to PIO mode if DMA initialization fails (Rosen) - Use named initializers to define the match tables of the ahci_xgene, ahci_qoriq and ahci_platform drivers (Pawel) * tag 'ata-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux: (28 commits) ata: use named initializers for acpi_device_id ata: pata_ep93xx: fix PIO fallback when DMA init fails ata: pata_pxa: use devres for DMA channel management ata: libata-sff: don't busy-wait for PIO data-in command completion ata: ahci_da850: use devm_platform_ioremap_resource() ata: sata_highbank: use devm_platform_ioremap_resource ata: pata_pxa: use devm_platform_ioremap_resource ata: pata_rb532_cf: use devm_platform_ioremap_resource() ata: sata_mv: use devm clock helpers ata: sata_mv: Use platform_get_irq() to get interrupt ata: pata_mpc52xx: Remove redundant dev_err() ata: libata-eh: make ata_eh_qc_complete() and ata_eh_qc_retry() static ata: libata-scsi: add support for the REMOVE ELEMENT AND MODIFY ZONES command ata: libata-scsi: add support for the RESTORE ELEMENTS AND REBUILD command ata: libata-scsi: add support for the REMOVE ELEMENT AND TRUNCATE command ata: libata-scsi: add support for the GET PHYSICAL ELEMENT STATUS command ata: libata-core: detect support for depopulation capabilities ata: libata-scsi: improve ata_get_xlat_func ata: libata: improve the definition of device flags scsi: define depopulation capabilities related service actions ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/ata.h17
-rw-r--r--include/linux/libata.h93
-rw-r--r--include/scsi/scsi_proto.h74
3 files changed, 141 insertions, 43 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 7daad4cad985..c4fac5f8d480 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -75,6 +75,7 @@ enum {
ATA_ID_HW_CONFIG = 93,
ATA_ID_SPG = 98,
ATA_ID_LBA_CAPACITY_2 = 100,
+ ATA_ID_MAX_PAGES_PER_DSM = 105,
ATA_ID_SECTOR_SIZE = 106,
ATA_ID_WWN = 108,
ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
@@ -288,6 +289,10 @@ enum {
ATA_CMD_SANITIZE_DEVICE = 0xB4,
ATA_CMD_ZAC_MGMT_IN = 0x4A,
ATA_CMD_ZAC_MGMT_OUT = 0x9F,
+ ATA_CMD_GET_PHYS_ELEMENT_STATUS = 0x12,
+ ATA_CMD_REMOVE_ELEMENT_AND_TRUNCATE = 0x7c,
+ ATA_CMD_RESTORE_ELEMENTS_AND_REBUILD = 0x7d,
+ ATA_CMD_REMOVE_ELEMENT_AND_MODIFY_ZONES = 0x7e,
/* marked obsolete in the ATA/ATAPI-7 spec */
ATA_CMD_RESTORE = 0x10,
@@ -928,6 +933,18 @@ static inline bool ata_id_has_trim(const u16 *id)
return false;
}
+static inline u16 ata_id_dsm_max_pages(const u16 *id)
+{
+ /*
+ * IDENTIFY DEVICE word 105: MAX PAGES PER DSM COMMAND. Maximum number
+ * of 512-byte pages of LBA Range Entries the device accepts in a
+ * single DATA SET MANAGEMENT command. Zero means the device does not
+ * specify a limit. The field is reserved unless TRIM is supported, so
+ * callers must gate on ata_id_has_trim().
+ */
+ return id[ATA_ID_MAX_PAGES_PER_DSM];
+}
+
static inline bool ata_id_has_zero_after_trim(const u16 *id)
{
/* DSM supported, deterministic read, and read zero after trim set */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 1827502b9cf2..313e96173b19 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -121,6 +121,55 @@ enum {
ATA_QUIRK_NO_FUA = BIT_ULL(__ATA_QUIRK_NO_FUA),
};
+/*
+ * struct ata_device flags
+ */
+enum {
+ ATA_DFLAG_LBA = (1UL << 0), /* device supports LBA */
+ ATA_DFLAG_LBA48 = (1UL << 1), /* device supports LBA48 */
+ ATA_DFLAG_CDB_INTR = (1UL << 2), /* device asserts INTRQ when ready for CDB */
+ ATA_DFLAG_NCQ = (1UL << 3), /* device supports NCQ */
+ ATA_DFLAG_FLUSH_EXT = (1UL << 4), /* do FLUSH_EXT instead of FLUSH */
+ ATA_DFLAG_ACPI_PENDING = (1UL << 5), /* ACPI resume action pending */
+ ATA_DFLAG_ACPI_FAILED = (1UL << 6), /* ACPI on devcfg has failed */
+ ATA_DFLAG_AN = (1UL << 7), /* AN configured */
+ ATA_DFLAG_TRUSTED = (1UL << 8), /* device supports trusted send/recv */
+ ATA_DFLAG_FUA = (1UL << 9), /* device supports FUA */
+ ATA_DFLAG_DMADIR = (1UL << 10), /* device requires DMADIR */
+ ATA_DFLAG_NCQ_SEND_RECV = (1UL << 11), /* device supports NCQ SEND and RECV */
+ ATA_DFLAG_NCQ_PRIO = (1UL << 12), /* device supports NCQ priority */
+ ATA_DFLAG_CDL = (1UL << 13), /* supports cmd duration limits */
+ ATA_DFLAG_DEPOP = (1UL << 14), /* supports depopulation capability */
+ ATA_DFLAG_DEPOP_RESTORE = (1UL << 15), /* supports depopulation restoration */
+ ATA_DFLAG_DEPOP_MODIFY = (1UL << 16), /* supports zoned depopulation */
+ ATA_DFLAG_CFG_MASK = (1UL << 17) - 1,
+
+ ATA_DFLAG_PIO = (1UL << 17), /* device limited to PIO mode */
+ ATA_DFLAG_NCQ_OFF = (1UL << 18), /* device limited to non-NCQ mode */
+ ATA_DFLAG_SLEEPING = (1UL << 19), /* device is sleeping */
+ ATA_DFLAG_DUBIOUS_XFER = (1UL << 20), /* data transfer not verified */
+ ATA_DFLAG_NO_UNLOAD = (1UL << 21), /* device doesn't support unload */
+ ATA_DFLAG_UNLOCK_HPA = (1UL << 22), /* unlock HPA */
+ ATA_DFLAG_INIT_MASK = (1UL << 23) - 1,
+
+ ATA_DFLAG_NCQ_PRIO_ENABLED = (1UL << 23), /* Priority cmds sent to dev */
+ ATA_DFLAG_CDL_ENABLED = (1UL << 24), /* cmd duration limits is enabled */
+ ATA_DFLAG_RESUMING = (1UL << 25), /* Device is resuming */
+ ATA_DFLAG_DETACH = (1UL << 26),
+ ATA_DFLAG_DETACHED = (1UL << 27),
+ ATA_DFLAG_DA = (1UL << 28), /* device supports Device Attention */
+ ATA_DFLAG_DEVSLP = (1UL << 29), /* device supports Device Sleep */
+ ATA_DFLAG_ACPI_DISABLED = (1UL << 30), /* ACPI for the device is disabled */
+ ATA_DFLAG_D_SENSE = (1UL << 31), /* Descriptor sense requested */
+
+ ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \
+ ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \
+ ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \
+ ATA_DFLAG_CDL | ATA_DFLAG_DEPOP | \
+ ATA_DFLAG_DEPOP_RESTORE |
+ ATA_DFLAG_DEPOP_MODIFY)
+};
+
enum {
/* various global constants */
LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
@@ -146,46 +195,7 @@ enum {
ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
- /* struct ata_device stuff */
- ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
- ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
- ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
- ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
- ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
- ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
- ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
- ATA_DFLAG_AN = (1 << 7), /* AN configured */
- ATA_DFLAG_TRUSTED = (1 << 8), /* device supports trusted send/recv */
- ATA_DFLAG_FUA = (1 << 9), /* device supports FUA */
- ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */
- ATA_DFLAG_NCQ_SEND_RECV = (1 << 11), /* device supports NCQ SEND and RECV */
- ATA_DFLAG_NCQ_PRIO = (1 << 12), /* device supports NCQ priority */
- ATA_DFLAG_CDL = (1 << 13), /* supports cmd duration limits */
- ATA_DFLAG_CFG_MASK = (1 << 14) - 1,
-
- ATA_DFLAG_PIO = (1 << 14), /* device limited to PIO mode */
- ATA_DFLAG_NCQ_OFF = (1 << 15), /* device limited to non-NCQ mode */
- ATA_DFLAG_SLEEPING = (1 << 16), /* device is sleeping */
- ATA_DFLAG_DUBIOUS_XFER = (1 << 17), /* data transfer not verified */
- ATA_DFLAG_NO_UNLOAD = (1 << 18), /* device doesn't support unload */
- ATA_DFLAG_UNLOCK_HPA = (1 << 19), /* unlock HPA */
- ATA_DFLAG_INIT_MASK = (1 << 20) - 1,
-
- ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */
- ATA_DFLAG_CDL_ENABLED = (1 << 21), /* cmd duration limits is enabled */
- ATA_DFLAG_RESUMING = (1 << 22), /* Device is resuming */
- ATA_DFLAG_DETACH = (1 << 24),
- ATA_DFLAG_DETACHED = (1 << 25),
- ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
- ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
- ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */
- ATA_DFLAG_D_SENSE = (1 << 29), /* Descriptor sense requested */
-
- ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \
- ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \
- ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \
- ATA_DFLAG_CDL),
-
+ /* sturct ata_device class. */
ATA_DEV_UNKNOWN = 0, /* unknown device */
ATA_DEV_ATA = 1, /* ATA device */
ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */
@@ -1421,9 +1431,6 @@ extern int ata_port_freeze(struct ata_port *ap);
extern void ata_eh_freeze_port(struct ata_port *ap);
extern void ata_eh_thaw_port(struct ata_port *ap);
-extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
-extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
-
extern void ata_std_error_handler(struct ata_port *ap)
__must_hold(&ap->host->eh_mutex);
extern void ata_std_sched_eh(struct ata_port *ap);
diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h
index f64385cde5b9..c6b4a4dc8d9c 100644
--- a/include/scsi/scsi_proto.h
+++ b/include/scsi/scsi_proto.h
@@ -129,6 +129,10 @@
#define SAI_GET_LBA_STATUS 0x12
#define SAI_REPORT_REFERRALS 0x13
#define SAI_GET_STREAM_STATUS 0x16
+#define SAI_GET_PHYSICAL_ELEMENT_STATUS 0x17
+#define SAI_REMOVE_ELEMENT_AND_TRUNCATE 0x18
+#define SAI_RESTORE_ELEMENTS_AND_REBUILD 0x19
+#define SAI_REMOVE_ELEMENT_AND_MODIFY_ZONES 0x1a
/* values for maintenance in */
#define MI_REPORT_IDENTIFYING_INFORMATION 0x05
#define MI_REPORT_TARGET_PGS 0x0a
@@ -234,6 +238,57 @@ enum sam_status {
#define COMPLETED 0x0f
/*
+ * Additional Sense Codes (ASC).
+ */
+#define NO_ADDITIONAL_SENSE 0x00
+#define OVERLAP_ATOMIC_COMMAND_ASC 0x00
+#define LOGICAL_UNIT_NOT_READY 0x04
+#define LOGICAL_UNIT_COMMUNICATION_FAILURE 0x8
+#define WRITE_ERROR_ASC 0x0c
+#define UNRECOVERED_READ_ERR 0x11
+#define PARAMETER_LIST_LENGTH_ERR 0x1a
+#define MISCOMPARE_VERIFY_ASC 0x1d
+#define INVALID_OPCODE 0x20
+#define LBA_OUT_OF_RANGE 0x21
+#define INVALID_FIELD_IN_CDB 0x24
+#define INVALID_FIELD_IN_PARAM_LIST 0x26
+#define WRITE_PROTECTED 0x27
+#define UA_READY_ASC 0x28
+#define UA_RESET_ASC 0x29
+#define UA_CHANGED_ASC 0x2a
+#define TOO_MANY_IN_PARTITION_ASC 0x3b
+#define TARGET_CHANGED_ASC 0x3f
+#define SAVING_PARAMS_UNSUP 0x39
+#define TRANSPORT_PROBLEM 0x4b
+#define INSUFF_RES_ASC 0x55
+#define LOW_POWER_COND_ON 0x5e
+#define THRESHOLD_EXCEEDED 0x5d
+
+/*
+ * Additional Sense Code Qualifiers (ASCQ).
+ */
+#define POWER_ON_RESET_ASCQ 0x00
+#define MODE_CHANGED_ASCQ 0x01 /* mode parameters changed */
+#define FILEMARK_DETECTED_ASCQ 0x01
+#define POWER_ON_OCCURRED_ASCQ 0x01
+#define MICROCODE_CHANGED_ASCQ 0x01 /* with TARGET_CHANGED_ASC */
+#define BUS_RESET_ASCQ 0x02 /* scsi bus reset occurred */
+#define EOP_EOM_DETECTED_ASCQ 0x02
+#define INSUFF_RES_ASCQ 0x03
+#define BEGINNING_OF_P_M_DETECTED_ASCQ 0x04
+#define UNALIGNED_WRITE_ASCQ 0x04
+#define EOD_DETECTED_ASCQ 0x05
+#define WRITE_BOUNDARY_ASCQ 0x05
+#define READ_INVDATA_ASCQ 0x06
+#define READ_BOUNDARY_ASCQ 0x07
+#define CAPACITY_CHANGED_ASCQ 0x09
+#define ATTEMPT_ACCESS_GAP 0x09
+#define LUNS_CHANGED_ASCQ 0x0e
+#define INSUFF_ZONE_ASCQ 0x0e
+#define MICROCODE_CHANGED_WO_RESET_ASCQ 0x16
+#define OVERLAP_ATOMIC_COMMAND_ASCQ 0x23
+
+/*
* DEVICE TYPES
* Please keep them in 0x%02x format for $MODALIAS to work
*/
@@ -413,6 +468,25 @@ enum zbc_zone_alignment_method {
ZBC_CONSTANT_ZONE_START_OFFSET = 0x8,
};
+/* SCSI physical element types */
+enum scsi_phys_element_type {
+ SCSI_PHYS_ELEM_TYPE_ALL_ACCESS_STORAGE = 0x1,
+ SCSI_PHYS_ELEM_TYPE_FRAC_ACCESS_STORAGE = 0x2,
+};
+
+/* SCSI physical element health. */
+enum scsi_phys_element_health {
+ SCSI_PHYS_ELEM_HEALTH_NOT_REPORTED = 0x00,
+ SCSI_PHYS_ELEM_HEALTH_WITHIN_SPEC_LIMITS = 0x01,
+ SCSI_PHYS_ELEM_HEALTH_AT_SPEC_LIMITS = 0x64,
+ SCSI_PHYS_ELEM_HEALTH_OUTSIDE_SPEC_LIMITS = 0x65,
+ SCSI_PHYS_ELEM_HEALTH_DEPOP_REVOKE_ERR = 0xFB,
+ SCSI_PHYS_ELEM_HEALTH_DEPOP_REVOKE_IN_PROGRESS = 0xFC,
+ SCSI_PHYS_ELEM_HEALTH_DEPOP_ERR = 0xFD,
+ SCSI_PHYS_ELEM_HEALTH_DEPOP_IN_PROGRESS = 0xFE,
+ SCSI_PHYS_ELEM_HEALTH_DEPOP_OK = 0xFF,
+};
+
/* Version descriptor values for INQUIRY */
enum scsi_version_descriptor {
SCSI_VERSION_DESCRIPTOR_FCP4 = 0x0a40,