* [Qemu-devel] [PATCH][RFC] lsi53c895a: manage aborted read
@ 2008-09-24 14:09 Laurent Vivier
0 siblings, 0 replies; only message in thread
From: Laurent Vivier @ 2008-09-24 14:09 UTC (permalink / raw)
To: qemu-devel@nongnu.org; +Cc: Paul Brook
[-- 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-09-24 14:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24 14:09 [Qemu-devel] [PATCH][RFC] lsi53c895a: manage aborted read Laurent Vivier
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).