From nobody Tue Oct 22 15:34:56 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XXx7j1rVDz5Pc8Q; Tue, 22 Oct 2024 15:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XXx7j0kP5z4Kcw; Tue, 22 Oct 2024 15:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729611297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EvWNRGWRu1wcea6lfrfsI4AZssFpjR2+nXM+syMWSvM=; b=SpQvuyl0iy9t7cX2drCVdmSonunW4p5w65S6v7Ni5K8quqTrLm03BajdDyCBkM/uEtF05d cWa6fIGcWyoS6ibqyMRo6jqbwQtwglOmAKScrORkWCRINO7T8p/uCYF8Dc1Ps5EQA0m42j djGMhH056HfqYBe26R+AWWYh9bEj9R7kyOE3dnd4DfH48Dy87ehgyqU7JNRfRNsl32tJt1 BedhkBotep+FhTHL+k83tLrvaD3FE5hy8pY9zHjAc7WFfjPZGyjfbeWyKnZ97w7+runTmG QE+IfaZdlPk8rSa21wANTIS06JjvYvIUYsjhkdP0zdx7lzV3KYEn8FpH4zUkPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729611297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=EvWNRGWRu1wcea6lfrfsI4AZssFpjR2+nXM+syMWSvM=; b=nqLkW470hxNP6uV40vPDnJkaN5/EA0QIVnGpc8L4r5jO0lvWJmph+xqf2oAxQ+Jn5C0++G +0/u2dtSVeGSNBsSbIxmTuqppea6RcrF4v6qSZ6uqMpUWyVBi7CgcOiNbbFaNg2Ebzkcw8 avUCXHMPQk7RnJNfbPqvf8eU+SSuvkj0VY1+w1V4QdbyHb2gpnpIpGBV3A6BWEtaGbuvuG yZOzg0NDzV/3QuBu8ivIr39QuTyhDNGcwhK07wTm636EyrTrqGquHK2tJv1FZNJ4LsgCoC b0ygDMhAHRosML39AjY34VtdTtDdPXaNI5eckrb1Ow+d2U8Y2zSy94Fp8STIqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729611297; a=rsa-sha256; cv=none; b=JB3L3RCk7VMAulQ/lq3jJTBogcW8OmNB4pUjK53vSvvUMgHu349Gevgjuf8ah0GzRHUVPR skUNmN5qSbDmyKmhWbAodXWkofuMUB1MGCnlbLx4KOurXugCsHDEOKNDfApJs2LawsMBo0 T4veabxOXGrDA2oSj9HXziGUuhFV0xIfoSNUUNnmhKELxGSqSY3quSC9LaoUEEa8Y1BAio I0nGtWuHk9Y73ZCjO5mtRsMDCv9QMRrvhJJQtp+Qvmbwb+4QDr8RVTM6qN6Uq3qOOgpxqj NKMXjnlK9b7s4pMiO67kaziPpI2OIMrJZoHLDgy54/hJsIVjK50ov497bElmBA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XXx7j0Km9zKlN; Tue, 22 Oct 2024 15:34:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49MFYuDH071633; Tue, 22 Oct 2024 15:34:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49MFYuM2071630; Tue, 22 Oct 2024 15:34:56 GMT (envelope-from git) Date: Tue, 22 Oct 2024 15:34:56 GMT Message-Id: <202410221534.49MFYuM2071630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ad0df04a5dc0 - main - da: Add comments about asc/ascq values List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ad0df04a5dc05a5dc903f42abf55541ce6328d93 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ad0df04a5dc05a5dc903f42abf55541ce6328d93 commit ad0df04a5dc05a5dc903f42abf55541ce6328d93 Author: Warner Losh AuthorDate: 2024-10-22 14:45:22 +0000 Commit: Warner Losh 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); }