From: Paolo Bonzini <pbonzini@redhat.com>
To: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ATAPI: Add support for ASCQ in sense codes
Date: Tue, 31 Jul 2012 09:14:56 +0200 [thread overview]
Message-ID: <501785F0.8050607@redhat.com> (raw)
In-Reply-To: <1343700436-25315-2-git-send-email-ronniesahlberg@gmail.com>
Il 31/07/2012 04:07, Ronnie Sahlberg ha scritto:
> Add support for setting the ASCQ for SCSI sense codes in the ATAPI driver.
> Use this to set ASCQ==2 for the medium removal prevention that is recommended in MMC for this condition.
>
> asc:0x53 ascq:0x02 is the recommended error for MEDIUM_REMOVAL_PREVENTED and is listed in Annex F in MMC
You also need to cover migration.
You could either add a subsection, or something like this:
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index f7f714c..89c0157 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -1143,3 +1143,20 @@ void ide_atapi_cmd(IDEState *s)
ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_ILLEGAL_OPCODE);
}
+
+void ide_atapi_post_load(IDEState *s, int version_id)
+{
+ if (version_id < 3) {
+ if (s->sense_key == UNIT_ATTENTION &&
+ s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED) {
+ s->cdrom_changed = 1;
+ }
+ }
+
+ /* This is simpler than adding a subsection just for the ascq. */
+ if (s->asc == ASC_MEDIA_REMOVAL_PREVENTED) {
+ s->ascq = 2;
+ } else {
+ s->ascq = 0;
+ }
+}
diff --git a/hw/ide/core.c b/hw/ide/core.c
index cb5ca4b..959ac48 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2154,12 +2154,7 @@ static int ide_drive_post_load(void *opaque, int version_id)
{
IDEState *s = opaque;
- if (version_id < 3) {
- if (s->sense_key == UNIT_ATTENTION &&
- s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED) {
- s->cdrom_changed = 1;
- }
- }
+ ide_atapi_post_load(s, version_id);
if (s->identify_set) {
bdrv_set_enable_write_cache(s->bs, !!(s->identify_data[85] & (1 << 5)));
}
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 7170bd9..2572461 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -572,6 +572,7 @@ BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
/* hw/ide/atapi.c */
void ide_atapi_cmd(IDEState *s);
void ide_atapi_cmd_reply_end(IDEState *s);
+void ide_atapi_post_load(IDEState *s, int version_id);
/* hw/ide/qdev.c */
void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id);
In fact, I wonder if it is simpler to "make up" the ascq directly in
cmd_request_sense, instead of changing all invocations of
ide_atapi_cmd_error. Kevin, any preferences?
Paolo
next prev parent reply other threads:[~2012-07-31 7:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 2:07 [Qemu-devel] [PATCH] ATAPI: Add support for ASCQ and improve a medium removal sense code Ronnie Sahlberg
2012-07-31 2:07 ` [Qemu-devel] [PATCH] ATAPI: Add support for ASCQ in sense codes Ronnie Sahlberg
2012-07-31 7:14 ` Paolo Bonzini [this message]
2012-08-27 10:37 ` Kevin Wolf
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=501785F0.8050607@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.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).