History

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

Linus Torvalds committed 2 months ago

Commit faabe2d2 parents 59e6295 73b6bf320 files · +915 −345Browse files

Showing the changes to include (3 of 20 files). Show all

Unified · Split

3 files
  1. include/linux/ata.h +17 −0
  2. include/linux/libata.h +50 −43
  3. include/scsi/scsi_proto.h +74 −0
include/linux/ata.h+17−0
@@ -75,6 +75,7 @@ enum { · 74 unmodified lines
7575 ATA_ID_HW_CONFIG = 93,
7676 ATA_ID_SPG = 98,
7777 ATA_ID_LBA_CAPACITY_2 = 100,
78+ ATA_ID_MAX_PAGES_PER_DSM = 105,
7879 ATA_ID_SECTOR_SIZE = 106,
7980 ATA_ID_WWN = 108,
8081 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
@@ -288,6 +289,10 @@ enum { · 207 unmodified lines
288289 ATA_CMD_SANITIZE_DEVICE = 0xB4,
289290 ATA_CMD_ZAC_MGMT_IN = 0x4A,
290291 ATA_CMD_ZAC_MGMT_OUT = 0x9F,
292+ ATA_CMD_GET_PHYS_ELEMENT_STATUS = 0x12,
293+ ATA_CMD_REMOVE_ELEMENT_AND_TRUNCATE = 0x7c,
294+ ATA_CMD_RESTORE_ELEMENTS_AND_REBUILD = 0x7d,
295+ ATA_CMD_REMOVE_ELEMENT_AND_MODIFY_ZONES = 0x7e,
291296
292297 /* marked obsolete in the ATA/ATAPI-7 spec */
293298 ATA_CMD_RESTORE = 0x10,
@@ -928,6 +933,18 @@ static inline bool ata_id_has_trim(const u16 *id) · 634 unmodified lines
928933 return false;
929934 }
930935
936+static inline u16 ata_id_dsm_max_pages(const u16 *id)
937+{
938+ /*
939+ * IDENTIFY DEVICE word 105: MAX PAGES PER DSM COMMAND. Maximum number
940+ * of 512-byte pages of LBA Range Entries the device accepts in a
941+ * single DATA SET MANAGEMENT command. Zero means the device does not
942+ * specify a limit. The field is reserved unless TRIM is supported, so
943+ * callers must gate on ata_id_has_trim().
944+ */
945+ return id[ATA_ID_MAX_PAGES_PER_DSM];
946+}
947+
931948 static inline bool ata_id_has_zero_after_trim(const u16 *id)
932949 {
933950 /* DSM supported, deterministic read, and read zero after trim set */
include/linux/libata.h+50−43
@@ -121,6 +121,55 @@ enum { · 120 unmodified lines
121121 ATA_QUIRK_NO_FUA = BIT_ULL(__ATA_QUIRK_NO_FUA),
122122 };
123123
124+/*
125+ * struct ata_device flags
126+ */
127+enum {
128+ ATA_DFLAG_LBA = (1UL << 0), /* device supports LBA */
129+ ATA_DFLAG_LBA48 = (1UL << 1), /* device supports LBA48 */
130+ ATA_DFLAG_CDB_INTR = (1UL << 2), /* device asserts INTRQ when ready for CDB */
131+ ATA_DFLAG_NCQ = (1UL << 3), /* device supports NCQ */
132+ ATA_DFLAG_FLUSH_EXT = (1UL << 4), /* do FLUSH_EXT instead of FLUSH */
133+ ATA_DFLAG_ACPI_PENDING = (1UL << 5), /* ACPI resume action pending */
134+ ATA_DFLAG_ACPI_FAILED = (1UL << 6), /* ACPI on devcfg has failed */
135+ ATA_DFLAG_AN = (1UL << 7), /* AN configured */
136+ ATA_DFLAG_TRUSTED = (1UL << 8), /* device supports trusted send/recv */
137+ ATA_DFLAG_FUA = (1UL << 9), /* device supports FUA */
138+ ATA_DFLAG_DMADIR = (1UL << 10), /* device requires DMADIR */
139+ ATA_DFLAG_NCQ_SEND_RECV = (1UL << 11), /* device supports NCQ SEND and RECV */
140+ ATA_DFLAG_NCQ_PRIO = (1UL << 12), /* device supports NCQ priority */
141+ ATA_DFLAG_CDL = (1UL << 13), /* supports cmd duration limits */
142+ ATA_DFLAG_DEPOP = (1UL << 14), /* supports depopulation capability */
143+ ATA_DFLAG_DEPOP_RESTORE = (1UL << 15), /* supports depopulation restoration */
144+ ATA_DFLAG_DEPOP_MODIFY = (1UL << 16), /* supports zoned depopulation */
145+ ATA_DFLAG_CFG_MASK = (1UL << 17) - 1,
146+
147+ ATA_DFLAG_PIO = (1UL << 17), /* device limited to PIO mode */
148+ ATA_DFLAG_NCQ_OFF = (1UL << 18), /* device limited to non-NCQ mode */
149+ ATA_DFLAG_SLEEPING = (1UL << 19), /* device is sleeping */
150+ ATA_DFLAG_DUBIOUS_XFER = (1UL << 20), /* data transfer not verified */
151+ ATA_DFLAG_NO_UNLOAD = (1UL << 21), /* device doesn't support unload */
152+ ATA_DFLAG_UNLOCK_HPA = (1UL << 22), /* unlock HPA */
153+ ATA_DFLAG_INIT_MASK = (1UL << 23) - 1,
154+
155+ ATA_DFLAG_NCQ_PRIO_ENABLED = (1UL << 23), /* Priority cmds sent to dev */
156+ ATA_DFLAG_CDL_ENABLED = (1UL << 24), /* cmd duration limits is enabled */
157+ ATA_DFLAG_RESUMING = (1UL << 25), /* Device is resuming */
158+ ATA_DFLAG_DETACH = (1UL << 26),
159+ ATA_DFLAG_DETACHED = (1UL << 27),
160+ ATA_DFLAG_DA = (1UL << 28), /* device supports Device Attention */
161+ ATA_DFLAG_DEVSLP = (1UL << 29), /* device supports Device Sleep */
162+ ATA_DFLAG_ACPI_DISABLED = (1UL << 30), /* ACPI for the device is disabled */
163+ ATA_DFLAG_D_SENSE = (1UL << 31), /* Descriptor sense requested */
164+
165+ ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \
166+ ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \
167+ ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \
168+ ATA_DFLAG_CDL | ATA_DFLAG_DEPOP | \
169+ ATA_DFLAG_DEPOP_RESTORE |
170+ ATA_DFLAG_DEPOP_MODIFY)
171+};
172+
124173 enum {
125174 /* various global constants */
126175 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
@@ -146,46 +195,7 @@ enum { · 19 unmodified lines
146195 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
147196 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
148197
149− /* struct ata_device stuff */
150− ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
151− ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
152− ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
153− ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
154− ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
155− ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
156− ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
157− ATA_DFLAG_AN = (1 << 7), /* AN configured */
158− ATA_DFLAG_TRUSTED = (1 << 8), /* device supports trusted send/recv */
159− ATA_DFLAG_FUA = (1 << 9), /* device supports FUA */
160− ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */
161− ATA_DFLAG_NCQ_SEND_RECV = (1 << 11), /* device supports NCQ SEND and RECV */
162− ATA_DFLAG_NCQ_PRIO = (1 << 12), /* device supports NCQ priority */
163− ATA_DFLAG_CDL = (1 << 13), /* supports cmd duration limits */
164− ATA_DFLAG_CFG_MASK = (1 << 14) - 1,
165−
166− ATA_DFLAG_PIO = (1 << 14), /* device limited to PIO mode */
167− ATA_DFLAG_NCQ_OFF = (1 << 15), /* device limited to non-NCQ mode */
168− ATA_DFLAG_SLEEPING = (1 << 16), /* device is sleeping */
169− ATA_DFLAG_DUBIOUS_XFER = (1 << 17), /* data transfer not verified */
170− ATA_DFLAG_NO_UNLOAD = (1 << 18), /* device doesn't support unload */
171− ATA_DFLAG_UNLOCK_HPA = (1 << 19), /* unlock HPA */
172− ATA_DFLAG_INIT_MASK = (1 << 20) - 1,
173−
174− ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */
175− ATA_DFLAG_CDL_ENABLED = (1 << 21), /* cmd duration limits is enabled */
176− ATA_DFLAG_RESUMING = (1 << 22), /* Device is resuming */
177− ATA_DFLAG_DETACH = (1 << 24),
178− ATA_DFLAG_DETACHED = (1 << 25),
179− ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
180− ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
181− ATA_DFLAG_ACPI_DISABLED = (1 << 28), /* ACPI for the device is disabled */
182− ATA_DFLAG_D_SENSE = (1 << 29), /* Descriptor sense requested */
183−
184− ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA | \
185− ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \
186− ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \
187− ATA_DFLAG_CDL),
188−
198+ /* sturct ata_device class. */
189199 ATA_DEV_UNKNOWN = 0, /* unknown device */
190200 ATA_DEV_ATA = 1, /* ATA device */
191201 ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */
@@ -1421,9 +1431,6 @@ extern int ata_port_freeze(struct ata_port *ap); · 1229 unmodified lines
14211431 extern void ata_eh_freeze_port(struct ata_port *ap);
14221432 extern void ata_eh_thaw_port(struct ata_port *ap);
14231433
1424−extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
1425−extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
1426−
14271434 extern void ata_std_error_handler(struct ata_port *ap)
14281435 __must_hold(&ap->host->eh_mutex);
14291436 extern void ata_std_sched_eh(struct ata_port *ap);
include/scsi/scsi_proto.h+74−0
@@ -129,6 +129,10 @@ · 128 unmodified lines
129129 #define SAI_GET_LBA_STATUS 0x12
130130 #define SAI_REPORT_REFERRALS 0x13
131131 #define SAI_GET_STREAM_STATUS 0x16
132+#define SAI_GET_PHYSICAL_ELEMENT_STATUS 0x17
133+#define SAI_REMOVE_ELEMENT_AND_TRUNCATE 0x18
134+#define SAI_RESTORE_ELEMENTS_AND_REBUILD 0x19
135+#define SAI_REMOVE_ELEMENT_AND_MODIFY_ZONES 0x1a
132136 /* values for maintenance in */
133137 #define MI_REPORT_IDENTIFYING_INFORMATION 0x05
134138 #define MI_REPORT_TARGET_PGS 0x0a
@@ -233,6 +237,57 @@ enum sam_status { · 98 unmodified lines
233237 #define MISCOMPARE 0x0e
234238 #define COMPLETED 0x0f
235239
240+/*
241+ * Additional Sense Codes (ASC).
242+ */
243+#define NO_ADDITIONAL_SENSE 0x00
244+#define OVERLAP_ATOMIC_COMMAND_ASC 0x00
245+#define LOGICAL_UNIT_NOT_READY 0x04
246+#define LOGICAL_UNIT_COMMUNICATION_FAILURE 0x8
247+#define WRITE_ERROR_ASC 0x0c
248+#define UNRECOVERED_READ_ERR 0x11
249+#define PARAMETER_LIST_LENGTH_ERR 0x1a
250+#define MISCOMPARE_VERIFY_ASC 0x1d
251+#define INVALID_OPCODE 0x20
252+#define LBA_OUT_OF_RANGE 0x21
253+#define INVALID_FIELD_IN_CDB 0x24
254+#define INVALID_FIELD_IN_PARAM_LIST 0x26
255+#define WRITE_PROTECTED 0x27
256+#define UA_READY_ASC 0x28
257+#define UA_RESET_ASC 0x29
258+#define UA_CHANGED_ASC 0x2a
259+#define TOO_MANY_IN_PARTITION_ASC 0x3b
260+#define TARGET_CHANGED_ASC 0x3f
261+#define SAVING_PARAMS_UNSUP 0x39
262+#define TRANSPORT_PROBLEM 0x4b
263+#define INSUFF_RES_ASC 0x55
264+#define LOW_POWER_COND_ON 0x5e
265+#define THRESHOLD_EXCEEDED 0x5d
266+
267+/*
268+ * Additional Sense Code Qualifiers (ASCQ).
269+ */
270+#define POWER_ON_RESET_ASCQ 0x00
271+#define MODE_CHANGED_ASCQ 0x01 /* mode parameters changed */
272+#define FILEMARK_DETECTED_ASCQ 0x01
273+#define POWER_ON_OCCURRED_ASCQ 0x01
274+#define MICROCODE_CHANGED_ASCQ 0x01 /* with TARGET_CHANGED_ASC */
275+#define BUS_RESET_ASCQ 0x02 /* scsi bus reset occurred */
276+#define EOP_EOM_DETECTED_ASCQ 0x02
277+#define INSUFF_RES_ASCQ 0x03
278+#define BEGINNING_OF_P_M_DETECTED_ASCQ 0x04
279+#define UNALIGNED_WRITE_ASCQ 0x04
280+#define EOD_DETECTED_ASCQ 0x05
281+#define WRITE_BOUNDARY_ASCQ 0x05
282+#define READ_INVDATA_ASCQ 0x06
283+#define READ_BOUNDARY_ASCQ 0x07
284+#define CAPACITY_CHANGED_ASCQ 0x09
285+#define ATTEMPT_ACCESS_GAP 0x09
286+#define LUNS_CHANGED_ASCQ 0x0e
287+#define INSUFF_ZONE_ASCQ 0x0e
288+#define MICROCODE_CHANGED_WO_RESET_ASCQ 0x16
289+#define OVERLAP_ATOMIC_COMMAND_ASCQ 0x23
290+
236291 /*
237292 * DEVICE TYPES
238293 * Please keep them in 0x%02x format for $MODALIAS to work
@@ -413,6 +468,25 @@ enum zbc_zone_alignment_method { · 174 unmodified lines
413468 ZBC_CONSTANT_ZONE_START_OFFSET = 0x8,
414469 };
415470
471+/* SCSI physical element types */
472+enum scsi_phys_element_type {
473+ SCSI_PHYS_ELEM_TYPE_ALL_ACCESS_STORAGE = 0x1,
474+ SCSI_PHYS_ELEM_TYPE_FRAC_ACCESS_STORAGE = 0x2,
475+};
476+
477+/* SCSI physical element health. */
478+enum scsi_phys_element_health {
479+ SCSI_PHYS_ELEM_HEALTH_NOT_REPORTED = 0x00,
480+ SCSI_PHYS_ELEM_HEALTH_WITHIN_SPEC_LIMITS = 0x01,
481+ SCSI_PHYS_ELEM_HEALTH_AT_SPEC_LIMITS = 0x64,
482+ SCSI_PHYS_ELEM_HEALTH_OUTSIDE_SPEC_LIMITS = 0x65,
483+ SCSI_PHYS_ELEM_HEALTH_DEPOP_REVOKE_ERR = 0xFB,
484+ SCSI_PHYS_ELEM_HEALTH_DEPOP_REVOKE_IN_PROGRESS = 0xFC,
485+ SCSI_PHYS_ELEM_HEALTH_DEPOP_ERR = 0xFD,
486+ SCSI_PHYS_ELEM_HEALTH_DEPOP_IN_PROGRESS = 0xFE,
487+ SCSI_PHYS_ELEM_HEALTH_DEPOP_OK = 0xFF,
488+};
489+
416490 /* Version descriptor values for INQUIRY */
417491 enum scsi_version_descriptor {
418492 SCSI_VERSION_DESCRIPTOR_FCP4 = 0x0a40,