summaryrefslogtreecommitdiff
path: root/sys/dev/microcode
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>2005-11-18 23:10:32 +0000
committerbouyer <bouyer@NetBSD.org>2005-11-18 23:10:32 +0000
commit98fae666e4c4ad14254901090709c3bab7416a91 (patch)
treecf9bc36a872a6bc69b55777700f8db7ac373e9e6 /sys/dev/microcode
parent10e1da626ce38bc3e5b349a16447ebc8af4d8ee9 (diff)
Some drives disconnect after the last data phase without a save data pointer
message. In such case we would not update resid with the proper value (eventually resid would not be updated at all if there was only one data phase). To fix this, have the script save the offset in the data tables at disconnect time if there was a transfer, and use this to compute the resid if the current offset is 0. Problem reported and patch tested by edwin, Roy Bixler and YAMAMOTO Takashi. Fix kern/31990 by YAMAMOTO Takashi.
Diffstat (limited to 'sys/dev/microcode')
-rw-r--r--sys/dev/microcode/siop/esiop.ss16
-rw-r--r--sys/dev/microcode/siop/siop.ss10
2 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/microcode/siop/esiop.ss b/sys/dev/microcode/siop/esiop.ss
index a6ce1f951b0..bb778eb7768 100644
--- a/sys/dev/microcode/siop/esiop.ss
+++ b/sys/dev/microcode/siop/esiop.ss
@@ -1,4 +1,4 @@
-; $NetBSD: esiop.ss,v 1.19 2005/02/27 00:27:29 perry Exp $
+; $NetBSD: esiop.ss,v 1.20 2005/11/18 23:10:32 bouyer Exp $
;
; Copyright (c) 2002 Manuel Bouyer.
@@ -112,6 +112,7 @@ ENTRY script_sched;
ENTRY load_targtable;
EXTERN tlq_offset;
+EXTERN saved_offset_offset;
EXTERN abs_msgin2;
EXTERN abs_sem; a 32bits word used a semaphore between script and driver
@@ -208,7 +209,11 @@ waitphase:
handle_cmpl:
CALL REL(disconnect);
- STORE NOFLUSH SCRATCHA0, 4, from tlq_offset; save current offset
+; update offset if we did some data transfer
+ MOVE SCRATCHA1 TO SFBR;
+ JUMP REL(handle_cmpl_noxfer), if 0x00;
+ STORE NOFLUSH SCRATCHA0, 4, FROM saved_offset_offset;
+handle_cmpl_noxfer:
MOVE SCRATCHE1 to SFBR;
INT int_done, IF NOT 0x00; if status is not "done", let host handle it
MOVE SCRATCHF0 to SFBR; load pointer in done ring
@@ -344,9 +349,12 @@ handle_msgin:
CALL REL(disconnect) ; disconnect message
; if we didn't get sdp, no need to interrupt
MOVE SCRATCHC0 & f_c_sdp TO SFBR;
+ INT int_disc, IF not 0x00;
+; update offset if we did some data transfer
+ MOVE SCRATCHA1 TO SFBR;
JUMP REL(script_sched), if 0x00;
-; Ok, we need to save data pointers
- INT int_disc;
+ STORE NOFLUSH SCRATCHA0, 4, FROM saved_offset_offset;
+ JUMP REL(script_sched);
cmdout:
MOVE FROM t_cmd, WHEN CMD;
diff --git a/sys/dev/microcode/siop/siop.ss b/sys/dev/microcode/siop/siop.ss
index 90ff680b277..8a109f43053 100644
--- a/sys/dev/microcode/siop/siop.ss
+++ b/sys/dev/microcode/siop/siop.ss
@@ -1,4 +1,4 @@
-; $NetBSD: siop.ss,v 1.19 2005/02/27 00:27:29 perry Exp $
+; $NetBSD: siop.ss,v 1.20 2005/11/18 23:10:32 bouyer Exp $
;
; Copyright (c) 2000 Manuel Bouyer.
@@ -47,6 +47,7 @@ ABSOLUTE int_msgin = 0xff01;
ABSOLUTE int_extmsgin = 0xff02;
ABSOLUTE int_extmsgdata = 0xff03;
ABSOLUTE int_disc = 0xff04;
+ABSOLUTE int_saveoffset = 0xff05;
; interrupts that don't have a valid DSA
ABSOLUTE int_reseltarg = 0xff80;
ABSOLUTE int_resellun = 0xff81;
@@ -262,9 +263,12 @@ handle_msgin:
CALL REL(disconnect) ; disconnect message;
; if we didn't get sdp, no need to interrupt
MOVE SCRATCHA0 & flag_sdp TO SFBR;
+ INT int_disc, IF not 0x00;
+; update offset if we did some data transfer
+ MOVE SCRATCHA1 TO SFBR;
JUMP REL(script_sched), if 0x00;
-; Ok, we need to save data pointers
- INT int_disc;
+ INT int_saveoffset;
+
msgin_ack:
selected:
CLEAR ACK;