git: ad0df04a5dc0 - main - da: Add comments about asc/ascq values
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Oct 2024 15:34:56 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=ad0df04a5dc05a5dc903f42abf55541ce6328d93
commit ad0df04a5dc05a5dc903f42abf55541ce6328d93
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-10-22 14:45:22 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-10-22 15:33:44 +0000
da: Add comments about asc/ascq values
Having had to look some of these up several times, add comments from the
latest standard for all the asc/ascq values we test against. In a couple
of cases, this is a little redundant with the printf on the following
line(s), but makes it clear what the ASC/ASCQ codes are.
Sponsored by: Netflix
---
sys/cam/scsi/scsi_da.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 1a6df6171b66..5e562122c5d5 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -2188,16 +2188,19 @@ daasync(void *callback_arg, uint32_t code,
scsi_extract_sense_ccb(ccb,
&error_code, &sense_key, &asc, &ascq)) {
if (asc == 0x2A && ascq == 0x09) {
+ /* 2a/9: CAPACITY DATA HAS CHANGED */
xpt_print(ccb->ccb_h.path,
"Capacity data has changed\n");
cam_periph_assert(periph, MA_OWNED);
softc->flags &= ~DA_FLAG_PROBED;
dareprobe(periph);
} else if (asc == 0x28 && ascq == 0x00) {
+ /* 28/0: NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */
cam_periph_assert(periph, MA_OWNED);
softc->flags &= ~DA_FLAG_PROBED;
disk_media_changed(softc->disk, M_NOWAIT);
} else if (asc == 0x3F && ascq == 0x03) {
+ /* 3f/3: INQUIRY DATA HAS CHANGED */
xpt_print(ccb->ccb_h.path,
"INQUIRY data has changed\n");
cam_periph_assert(periph, MA_OWNED);
@@ -4951,15 +4954,18 @@ dadone_proberc(struct cam_periph *periph, union ccb *done_ccb)
}
/*
- * Attach to anything that claims to be a
- * direct access or optical disk device,
- * as long as it doesn't return a "Logical
- * unit not supported" (0x25) error.
- * "Internal Target Failure" (0x44) is also
- * special and typically means that the
- * device is a SATA drive behind a SATL
- * translation that's fallen into a
+ * Attach to anything that claims to be a direct access
+ * or optical disk device, as long as it doesn't return
+ * a "Logical unit not supported" (25/0) error.
+ * "Internal Target Failure" (44/0) is also special and
+ * typically means that the device is a SATA drive
+ * behind a SATL translation that's fallen into a
* terminally fatal state.
+ *
+ * 25/0: LOGICAL UNIT NOT SUPPORTED
+ * 44/0: INTERNAL TARGET FAILURE
+ * 44/1: PERSISTENT RESERVATION INFORMATION LOST
+ * 44/71: ATA DEVICE FAILED SET FEATURES
*/
if ((have_sense)
&& (asc != 0x25) && (asc != 0x44)
@@ -5995,22 +6001,30 @@ daerror(union ccb *ccb, uint32_t cam_flags, uint32_t sense_flags)
*/
else if (sense_key == SSD_KEY_UNIT_ATTENTION &&
asc == 0x2A && ascq == 0x09) {
+ /* 2a/9: CAPACITY DATA HAS CHANGED */
xpt_print(periph->path, "Capacity data has changed\n");
softc->flags &= ~DA_FLAG_PROBED;
dareprobe(periph);
sense_flags |= SF_NO_PRINT;
} else if (sense_key == SSD_KEY_UNIT_ATTENTION &&
asc == 0x28 && ascq == 0x00) {
+ /* 28/0: NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED */
softc->flags &= ~DA_FLAG_PROBED;
disk_media_changed(softc->disk, M_NOWAIT);
} else if (sense_key == SSD_KEY_UNIT_ATTENTION &&
asc == 0x3F && ascq == 0x03) {
+ /* 3f/3: INQUIRY DATA HAS CHANGED */
xpt_print(periph->path, "INQUIRY data has changed\n");
softc->flags &= ~DA_FLAG_PROBED;
dareprobe(periph);
sense_flags |= SF_NO_PRINT;
} else if (sense_key == SSD_KEY_NOT_READY &&
asc == 0x3a && (softc->flags & DA_FLAG_PACK_INVALID) == 0) {
+ /* 3a/0: MEDIUM NOT PRESENT */
+ /* 3a/1: MEDIUM NOT PRESENT - TRAY CLOSED */
+ /* 3a/2: MEDIUM NOT PRESENT - TRAY OPEN */
+ /* 3a/3: MEDIUM NOT PRESENT - LOADABLE */
+ /* 3a/4: MEDIUM NOT PRESENT - MEDIUM AUXILIARY MEMORY ACCESSIBLE */
softc->flags |= DA_FLAG_PACK_INVALID;
disk_media_gone(softc->disk, M_NOWAIT);
}