lsi53c895a: manage aborted read
RFC PATCH 1/1 lsi53c895a: manage aborted read
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 <[email protected]>
Signature · 3 lines
------------- [email protected] -------------- "In short: just say NO TO DRUGS and maybe you won't end up like the Hurd people." -- Linus Torvald
---
--- hw/lsi53c895a.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
hw/lsi53c895a.c +9 -4
@@ -452,6 +452,10 @@ static void lsi_do_dma(LSIState *s, intif (!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 *oif (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 ; }