From: Laurent Vivier <Laurent.Vivier@bull.net>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Paul Brook <paul@codesourcery.com>
Subject: [Qemu-devel] [PATCH][RFC] lsi53c895a: manage aborted read
Date: Wed, 24 Sep 2008 16:09:36 +0200 [thread overview]
Message-ID: <1222265376.4166.11.camel@frecb07144> (raw)
[-- Attachment #1: Type: text/plain, Size: 560 bytes --]
When we connect a "real" tape device to the LSI controller using
scsi-generic, we can have aborted read.
When controller sends a read it is waiting for a given amount of data,
but if the tape meets the end of data before this value the controller
is not able to manage it.
This patch is trying to correct this.
All comments are welcome...
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
--
------------- Laurent.Vivier@bull.net --------------
"In short: just say NO TO DRUGS and maybe you won't
end up like the Hurd people." -- Linus Torvald
[-- Attachment #2: scsi-generic-empty-DMA.patch --]
[-- Type: text/x-vhdl, Size: 2105 bytes --]
---
---
hw/lsi53c895a.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
Index: qemu/hw/lsi53c895a.c
===================================================================
--- qemu.orig/hw/lsi53c895a.c 2008-09-24 13:25:09.000000000 +0200
+++ qemu/hw/lsi53c895a.c 2008-09-24 16:00:55.000000000 +0200
@@ -452,6 +452,10 @@ static void lsi_do_dma(LSIState *s, int
if (!s->current_dma_len) {
/* Wait until data is available. */
DPRINTF("DMA no data available\n");
+ if (s->command_complete == 2) {
+ /* no data available, call the complete function */
+ s->current_dev->read_data(s->current_dev, s->current_tag);
+ }
return;
}
@@ -598,7 +602,7 @@ static void lsi_command_complete(void *o
if (reason == SCSI_REASON_DONE) {
DPRINTF("Command complete sense=%d\n", (int)arg);
s->sense = arg;
- s->command_complete = 2;
+ s->command_complete = 3;
if (s->waiting && s->dbc != 0) {
/* Raise phase mismatch for short transfers. */
lsi_bad_phase(s, out, PHASE_ST);
@@ -615,7 +619,7 @@ static void lsi_command_complete(void *o
}
DPRINTF("Data ready tag=0x%x len=%d\n", tag, arg);
s->current_dma_len = arg;
- s->command_complete = 1;
+ s->command_complete = s->current_dma_len ? 1 : 2;
if (!s->waiting)
return;
if (s->waiting == 1 || s->dbc == 0) {
@@ -829,7 +833,7 @@ static void lsi_wait_reselect(LSIState *
break;
}
}
- if (s->current_dma_len == 0) {
+ if (s->current_dma_len == 0 && s->command_complete != 2) {
s->waiting = 1;
}
}
@@ -935,7 +939,8 @@ again:
switch (opcode) {
case 0: /* Select */
s->sdid = id;
- if (s->current_dma_len && (s->ssid & 0xf) == id) {
+ if ((s->current_dma_len || s->command_complete == 2) &&
+ (s->ssid & 0xf) == id) {
DPRINTF("Already reselected by target %d\n", id);
break;
}
reply other threads:[~2008-09-24 14:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1222265376.4166.11.camel@frecb07144 \
--to=laurent.vivier@bull.net \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/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).