From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, jejb@linux.vnet.ibm.com,
hare@suse.de, bvanassche@acm.org
Subject: [PATCH v2 9/9] scsi_debug: add environmental reporting log subpage
Date: Sat, 8 Jan 2022 20:28:53 -0500 [thread overview]
Message-ID: <20220109012853.301953-10-dgilbert@interlog.com> (raw)
In-Reply-To: <20220109012853.301953-1-dgilbert@interlog.com>
Log subpages are starting to appear in real devices (e.g. SSDs)
so add support for one. Adopt approach where all "wild"
sub-pages are themselves listed as long as there is at least
one non-wild page or subpage for a given page number.
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
---
drivers/scsi/scsi_debug.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 4f3703830347..a06ef7e8f66c 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2800,6 +2800,18 @@ static int resp_ie_l_pg(unsigned char *arr)
return sizeof(ie_l_pg);
}
+static int resp_env_rep_l_spg(unsigned char *arr)
+{
+ unsigned char env_rep_l_spg[] = {0x0, 0x0, 0x23, 0x8,
+ 0x0, 40, 72, 0xff, 45, 18, 0, 0,
+ 0x1, 0x0, 0x23, 0x8,
+ 0x0, 55, 72, 35, 55, 45, 0, 0,
+ };
+
+ memcpy(arr, env_rep_l_spg, sizeof(env_rep_l_spg));
+ return sizeof(env_rep_l_spg);
+}
+
#define SDEBUG_MAX_LSENSE_SZ 512
static int resp_log_sense(struct scsi_cmnd *scp,
@@ -2852,26 +2864,47 @@ static int resp_log_sense(struct scsi_cmnd *scp,
arr[n++] = 0xff; /* this page */
arr[n++] = 0xd;
arr[n++] = 0x0; /* Temperature */
+ arr[n++] = 0xd;
+ arr[n++] = 0x1; /* Environment reporting */
+ arr[n++] = 0xd;
+ arr[n++] = 0xff; /* all 0xd subpages */
arr[n++] = 0x2f;
arr[n++] = 0x0; /* Informational exceptions */
+ arr[n++] = 0x2f;
+ arr[n++] = 0xff; /* all 0x2f subpages */
arr[3] = n - 4;
break;
case 0xd: /* Temperature subpages */
n = 4;
arr[n++] = 0xd;
arr[n++] = 0x0; /* Temperature */
+ arr[n++] = 0xd;
+ arr[n++] = 0x1; /* Environment reporting */
+ arr[n++] = 0xd;
+ arr[n++] = 0xff; /* these subpages */
arr[3] = n - 4;
break;
case 0x2f: /* Informational exceptions subpages */
n = 4;
arr[n++] = 0x2f;
arr[n++] = 0x0; /* Informational exceptions */
+ arr[n++] = 0x2f;
+ arr[n++] = 0xff; /* these subpages */
arr[3] = n - 4;
break;
default:
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
return check_condition_result;
}
+ } else if (subpcode > 0) {
+ arr[0] |= 0x40;
+ arr[1] = subpcode;
+ if (pcode == 0xd && subpcode == 1)
+ arr[3] = resp_env_rep_l_spg(arr + 4);
+ else {
+ mk_sense_invalid_fld(scp, SDEB_IN_CDB, 2, 5);
+ return check_condition_result;
+ }
} else {
mk_sense_invalid_fld(scp, SDEB_IN_CDB, 3, -1);
return check_condition_result;
--
2.25.1
next prev parent reply other threads:[~2022-01-09 1:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-09 1:28 [PATCH v2 0/9] scsi_debug: collection of additions Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 1/9] scsi_debug: address races following module load Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 2/9] scsi_debug: strengthen defer_t accesses Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 3/9] scsi_debug: use task set full more Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 4/9] scsi_debug: refine sdebug_blk_mq_poll Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 5/9] scsi_debug: divide power on reset unit attention Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 6/9] scsi_debug: add no_rwlock parameter Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 7/9] scsi_debug: add sdeb_sgl_copy_sgl and friends Douglas Gilbert
2022-01-09 1:28 ` [PATCH v2 8/9] scsi_debug: change store from vmalloc to sgl Douglas Gilbert
2022-01-09 1:28 ` Douglas Gilbert [this message]
2022-01-25 5:38 ` [PATCH v2 0/9] scsi_debug: collection of additions Martin K. Petersen
2022-02-01 2:04 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220109012853.301953-10-dgilbert@interlog.com \
--to=dgilbert@interlog.com \
--cc=bvanassche@acm.org \
--cc=hare@suse.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).