Commit 38604fb9 authored by Justin T. Gibbs's avatar Justin T. Gibbs

Aic79xx Driver Update to version 1.3.2

 o Fix data corruption issue with Rev A hardware on
   IBM and Fujitsu U320 Drives.
 o Fix bug in ahd_pause_and_flushwork() that could prevent recovery
   actions from being effective.
 o Correct hang condition caused by attempts by the mid-layer to probe
   the controller's own ID.
parent deb6ace6
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#78 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#79 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -309,7 +309,17 @@ typedef enum { ...@@ -309,7 +309,17 @@ typedef enum {
* Controller write to INTSTAT will lose to a host * Controller write to INTSTAT will lose to a host
* write to CLRINT. * write to CLRINT.
*/ */
AHD_INTCOLLISION_BUG = 0x100000 AHD_INTCOLLISION_BUG = 0x100000,
/*
* The GEM318 violates the SCSI spec by not waiting
* the mandated bus settle delay between phase changes
* in some situations. Some aic79xx chip revs. are more
* strict in this regard and will treat REQ assertions
* that fall within the bus settle delay window as
* glitches. This flag enables causes the firmware
* to tolerate early REQ assertions.
*/
AHD_EARLY_REQ_BUG = 0x200000
} ahd_bug; } ahd_bug;
/* /*
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* $FreeBSD$ * $FreeBSD$
*/ */
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#79 $" VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#86 $"
PATCH_ARG_LIST = "struct ahd_softc *ahd" PATCH_ARG_LIST = "struct ahd_softc *ahd"
PREFIX = "ahd_" PREFIX = "ahd_"
...@@ -122,22 +122,24 @@ gsfifo_complete_normally: ...@@ -122,22 +122,24 @@ gsfifo_complete_normally:
/* /*
* Since this status did not consume a FIFO, we have to * Since this status did not consume a FIFO, we have to
* be a bit more dilligent in how we check for FIFOs pertaining * be a bit more dilligent in how we check for FIFOs pertaining
* to this transaction. There are three states that a FIFO still * to this transaction. There are two states that a FIFO still
* transferring data may be in. * transferring data may be in.
* *
* 1) Configured and draining to the host, with a pending CLRCHN. * 1) Configured and draining to the host, with a FIFO handler.
* 2) Configured and draining to the host, no pending CLRCHN. * 2) Pending cfg4data, fifo not empty.
* 3) Pending cfg4data, fifo not empty.
* *
* Cases 1 and 2 can be detected by noticing that a longjmp is * Case 1 can be detected by noticing that a longjmp is active for
* active for the FIFO and LONGJMP_SCB matches our SCB. In this * the FIFO and LONGJMP_SCB matches our SCB. In this case, we allow
* case, we allow the routine servicing the FIFO to complete the SCB. * the routine servicing the FIFO to complete the SCB.
* *
* Case 3 implies either a pending or yet to occur save data * Case 2 implies either a pending or yet to occur save data
* pointers for this same context in the other FIFO. So, if * pointers for this same context in the other FIFO. So, if
* we detect case 2, we will properly defer the post of the SCB * we detect case 1, we will properly defer the post of the SCB
* and achieve the desired result. The pending cfg4data will * and achieve the desired result. The pending cfg4data will
* notice that status has been received and complete the SCB. * notice that status has been received and complete the SCB.
*
* If the data-transfer has been completed, or no data transfer
* was needed for this SCB, it is safe to complete the command.
*/ */
test SCB_SGPTR, SG_LIST_NULL jz good_status_check_fifos; test SCB_SGPTR, SG_LIST_NULL jz good_status_check_fifos;
/* /*
...@@ -519,7 +521,7 @@ BEGIN_CRITICAL; ...@@ -519,7 +521,7 @@ BEGIN_CRITICAL;
/* /*
* For packetized, the LQO manager clears ENSELO on * For packetized, the LQO manager clears ENSELO on
* the assertion of SELDO. If we are non-packetized, * the assertion of SELDO. If we are non-packetized,
* LASTSCB and CURRSCB are acuate. * LASTSCB and CURRSCB are accurate.
*/ */
test SCSISEQ0, ENSELO jnz use_lastscb; test SCSISEQ0, ENSELO jnz use_lastscb;
...@@ -1030,14 +1032,6 @@ queue_arg1_scb_completion: ...@@ -1030,14 +1032,6 @@ queue_arg1_scb_completion:
SET_MODE(M_SCSI, M_SCSI) SET_MODE(M_SCSI, M_SCSI)
bmov SCBPTR, ARG_1, 2; bmov SCBPTR, ARG_1, 2;
queue_scb_completion: queue_scb_completion:
if ((ahd->bugs & AHD_ABORT_LQI_BUG) == 0) {
/*
* Set MK_MESSAGE to trigger an abort should this SCB
* be referenced by a target even though it is not currently
* active.
*/
or SCB_CONTROL, MK_MESSAGE;
}
test SCB_SCSI_STATUS,0xff jnz bad_status; test SCB_SCSI_STATUS,0xff jnz bad_status;
/* /*
* Check for residuals * Check for residuals
...@@ -1163,7 +1157,28 @@ clear_target_state: ...@@ -1163,7 +1157,28 @@ clear_target_state:
mvi SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT ret; mvi SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT ret;
phase_lock: phase_lock:
test SCSIPHASE, 0xFF jz .; if ((ahd->bugs & AHD_EARLY_REQ_BUG) != 0) {
/*
* Don't ignore persistent REQ assertions just because
* they were asserted within the bus settle delay window.
* This allows us to tolerate devices like the GEM318
* that violate the SCSI spec. We are careful not to
* count REQ while we are waiting for it to fall during
* an async phase due to our asserted ACK. Each
* sequencer instruction takes ~25ns, so the REQ must
* last at least 100ns in order to be counted as a true
* REQ.
*/
test SCSIPHASE, 0xFF jnz phase_locked;
test SCSISIGI, ACKI jnz phase_lock;
test SCSISIGI, REQI jz phase_lock;
test SCSIPHASE, 0xFF jnz phase_locked;
test SCSISIGI, ACKI jnz phase_lock;
test SCSISIGI, REQI jz phase_lock;
phase_locked:
} else {
test SCSIPHASE, 0xFF jz .;
}
test SSTAT1, SCSIPERR jnz phase_lock; test SSTAT1, SCSIPERR jnz phase_lock;
phase_lock_latch_phase: phase_lock_latch_phase:
and LASTPHASE, PHASE_MASK, SCSISIGI ret; and LASTPHASE, PHASE_MASK, SCSISIGI ret;
...@@ -1247,7 +1262,7 @@ service_fifo: ...@@ -1247,7 +1262,7 @@ service_fifo:
nop; nop;
} }
and SGHADDR[0], SG_PREFETCH_ALIGN_MASK, SCB_RESIDUAL_SGPTR; and SGHADDR[0], SG_PREFETCH_ALIGN_MASK, SCB_RESIDUAL_SGPTR;
mvi CCSGCTL, CCSGEN|SG_CACHE_AVAIL|CCSGRESET; mvi CCSGCTL, CCSGEN|CCSGRESET;
or SG_STATE, FETCH_INPROG ret; or SG_STATE, FETCH_INPROG ret;
idle_sgfetch_complete: idle_sgfetch_complete:
/* /*
...@@ -1261,6 +1276,15 @@ idle_sgfetch_complete: ...@@ -1261,6 +1276,15 @@ idle_sgfetch_complete:
idle_sg_avail: idle_sg_avail:
/* Does the hardware have space for another SG entry? */ /* Does the hardware have space for another SG entry? */
test DFSTATUS, PRELOAD_AVAIL jz return; test DFSTATUS, PRELOAD_AVAIL jz return;
/*
* On the A, preloading a segment before HDMAENACK
* comes true can clobber the shaddow address of the
* first segment in the S/G FIFO. Wait until it is
* safe to proceed.
*/
if ((ahd->features & AHD_NEW_DFCNTRL_OPTS) == 0) {
test DFCNTRL, HDMAENACK jz return;
}
if ((ahd->flags & AHD_64BIT_ADDRESSING) != 0) { if ((ahd->flags & AHD_64BIT_ADDRESSING) != 0) {
bmov HADDR, CCSGRAM, 8; bmov HADDR, CCSGRAM, 8;
} else { } else {
...@@ -1290,22 +1314,12 @@ sg_advance: ...@@ -1290,22 +1314,12 @@ sg_advance:
or SINDEX, LAST_SEG; or SINDEX, LAST_SEG;
clr SG_STATE; clr SG_STATE;
mov SG_CACHE_PRE, SINDEX; mov SG_CACHE_PRE, SINDEX;
/*
* Load the segment. Or in HDMAEN here too
* just in case HDMAENACK has not come true
* by the time this segment is loaded. If
* HDMAENACK is not true, this or will disable
* HDMAEN mid-transfer. We do not want to simply
* mvi our original settings as SCSIEN automatically
* de-asserts and we don't want to accidentally
* re-enable it.
*/
if ((ahd->features & AHD_NEW_DFCNTRL_OPTS) != 0) { if ((ahd->features & AHD_NEW_DFCNTRL_OPTS) != 0) {
/* /*
* Use SCSIENWRDIS so that SCSIEN is never * Use SCSIENWRDIS so that SCSIEN is never
* modified by this operation. * modified by this operation.
*/ */
or DFCNTRL, PRELOADEN|SCSIENWRDIS|HDMAEN; or DFCNTRL, PRELOADEN|HDMAEN|SCSIENWRDIS;
} else { } else {
or DFCNTRL, PRELOADEN|HDMAEN; or DFCNTRL, PRELOADEN|HDMAEN;
} }
...@@ -1606,7 +1620,13 @@ export seq_isr: ...@@ -1606,7 +1620,13 @@ export seq_isr:
and DFCNTRL, ~SCSIEN; and DFCNTRL, ~SCSIEN;
test SSTAT1, REQINIT jz .; test SSTAT1, REQINIT jz .;
or DFCNTRL, SCSIEN; or DFCNTRL, SCSIEN;
jmp snapshot_other_fifo; /* FALLTHROUGH */
snapshot_other_fifo:
xor MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
/* FALLTHROUGH */
snapshot_saveptr:
mvi DFFSXFRCTL, CLRCHN;
or SEQINTCTL, IRET ret;
data_valid: data_valid:
} }
test SEQINTSRC, CFG4DATA jnz cfg4data_intr; test SEQINTSRC, CFG4DATA jnz cfg4data_intr;
...@@ -1626,7 +1646,7 @@ data_valid: ...@@ -1626,7 +1646,7 @@ data_valid:
* of snapshot is not active. * of snapshot is not active.
* *
* The second case is a save pointers on an active FIFO which occurs * The second case is a save pointers on an active FIFO which occurs
* if the target changes to a new L_Q or busfrees/QAS' and the transfer * if the target changes to a new L_Q or busfrees/QASes and the transfer
* has a residual. This should occur coincident with a ctxtdone. We * has a residual. This should occur coincident with a ctxtdone. We
* disable the interrupt and allow our active routine to handle the * disable the interrupt and allow our active routine to handle the
* save. * save.
...@@ -1638,14 +1658,6 @@ saveptr_intr: ...@@ -1638,14 +1658,6 @@ saveptr_intr:
saveptr_active_fifo: saveptr_active_fifo:
and SEQIMODE, ~ENSAVEPTRS; and SEQIMODE, ~ENSAVEPTRS;
or SEQINTCTL, IRET ret; or SEQINTCTL, IRET ret;
if ((ahd->features & AHD_RTI) == 0) {
snapshot_other_fifo:
xor MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
/* FALLTHROUGH */
snapshot_saveptr:
mvi DFFSXFRCTL, CLRCHN;
or SEQINTCTL, IRET ret;
}
cfg4data_intr: cfg4data_intr:
test SCB_SGPTR[0], SG_LIST_NULL jnz pkt_handle_overrun; test SCB_SGPTR[0], SG_LIST_NULL jnz pkt_handle_overrun;
...@@ -1720,7 +1732,7 @@ pkt_service_fifo: ...@@ -1720,7 +1732,7 @@ pkt_service_fifo:
pkt_last_seg: pkt_last_seg:
call setjmp; call setjmp;
test SEQINTSRC, SAVEPTRS jnz pkt_saveptrs; test SEQINTSRC, SAVEPTRS jnz pkt_saveptrs;
test SG_CACHE_SHADOW, LAST_SEG_DONE jnz last_pkt_done; test SG_CACHE_SHADOW, LAST_SEG_DONE jnz last_pkt_xfer_done;
test SCSIPHASE, ~DATA_PHASE_MASK jz . + 2; test SCSIPHASE, ~DATA_PHASE_MASK jz . + 2;
test SCSISIGO, ATNO jnz . + 2; test SCSISIGO, ATNO jnz . + 2;
test SSTAT2, NONPACKREQ jz return; test SSTAT2, NONPACKREQ jz return;
...@@ -1764,7 +1776,7 @@ pkt_saveptrs_clrchn: ...@@ -1764,7 +1776,7 @@ pkt_saveptrs_clrchn:
mvi DFFSXFRCTL, CLRCHN ret; mvi DFFSXFRCTL, CLRCHN ret;
END_CRITICAL; END_CRITICAL;
last_pkt_done: last_pkt_xfer_done:
BEGIN_CRITICAL; BEGIN_CRITICAL;
if ((ahd->bugs & AHD_AUTOFLUSH_BUG) != 0) { if ((ahd->bugs & AHD_AUTOFLUSH_BUG) != 0) {
or DFCNTRL, FIFOFLUSH; or DFCNTRL, FIFOFLUSH;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#157 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#161 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -1249,6 +1249,14 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat) ...@@ -1249,6 +1249,14 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
ahd_outb(ahd, CLRSINT3, status3); ahd_outb(ahd, CLRSINT3, status3);
} else if ((lqistat1 & (LQIPHASE_LQ|LQIPHASE_NLQ)) != 0) { } else if ((lqistat1 & (LQIPHASE_LQ|LQIPHASE_NLQ)) != 0) {
ahd_handle_lqiphase_error(ahd, lqistat1); ahd_handle_lqiphase_error(ahd, lqistat1);
} else if ((lqistat1 & LQICRCI_NLQ) != 0) {
/*
* This status can be delayed during some
* streaming operations. The SCSIPHASE
* handler has already dealt with this case
* so just clear the error.
*/
ahd_outb(ahd, CLRLQIINT1, CLRLQICRCI_NLQ);
} else if ((status & BUSFREE) != 0) { } else if ((status & BUSFREE) != 0) {
u_int lqostat1; u_int lqostat1;
int restart; int restart;
...@@ -1626,14 +1634,6 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime) ...@@ -1626,14 +1634,6 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime)
scb = ahd_lookup_scb(ahd, scbid); scb = ahd_lookup_scb(ahd, scbid);
if (scb == NULL) if (scb == NULL)
panic("SCB not valid during LQOBUSFREE"); panic("SCB not valid during LQOBUSFREE");
/*
* Return the LQO manager to its idle loop. It will
* not do this automatically if the busfree occurs
* after the first REQ of either the LQ or command
* packet or between the LQ and command packet.
*/
ahd_outb(ahd, LQCTL2, ahd_inb(ahd, LQCTL2) | LQOTOIDLE);
/* /*
* Clear the status. * Clear the status.
*/ */
...@@ -1641,8 +1641,17 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime) ...@@ -1641,8 +1641,17 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime)
if ((ahd->bugs & AHD_CLRLQO_AUTOCLR_BUG) != 0) if ((ahd->bugs & AHD_CLRLQO_AUTOCLR_BUG) != 0)
ahd_outb(ahd, CLRLQOINT1, 0); ahd_outb(ahd, CLRLQOINT1, 0);
ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO); ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
ahd_flush_device_writes(ahd);
ahd_outb(ahd, CLRSINT0, CLRSELDO); ahd_outb(ahd, CLRSINT0, CLRSELDO);
/*
* Return the LQO manager to its idle loop. It will
* not do this automatically if the busfree occurs
* after the first REQ of either the LQ or command
* packet or between the LQ and command packet.
*/
ahd_outb(ahd, LQCTL2, ahd_inb(ahd, LQCTL2) | LQOTOIDLE);
/* /*
* Update the waiting for selection queue so * Update the waiting for selection queue so
* we restart on the correct SCB. * we restart on the correct SCB.
...@@ -1653,9 +1662,9 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime) ...@@ -1653,9 +1662,9 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime)
ahd_outw(ahd, WAITING_TID_HEAD, scbid); ahd_outw(ahd, WAITING_TID_HEAD, scbid);
waiting_t = ahd_inw(ahd, WAITING_TID_TAIL); waiting_t = ahd_inw(ahd, WAITING_TID_TAIL);
next = SCB_LIST_NULL;
if (waiting_t == waiting_h) { if (waiting_t == waiting_h) {
ahd_outw(ahd, WAITING_TID_TAIL, scbid); ahd_outw(ahd, WAITING_TID_TAIL, scbid);
next = SCB_LIST_NULL;
} else { } else {
ahd_set_scbptr(ahd, waiting_h); ahd_set_scbptr(ahd, waiting_h);
next = ahd_inw(ahd, SCB_NEXT2); next = ahd_inw(ahd, SCB_NEXT2);
...@@ -1704,6 +1713,7 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime) ...@@ -1704,6 +1713,7 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime)
scb = ahd_lookup_scb(ahd, scbid); scb = ahd_lookup_scb(ahd, scbid);
ahd_print_path(ahd, scb); ahd_print_path(ahd, scb);
printf("Unexpected PKT busfree condition\n"); printf("Unexpected PKT busfree condition\n");
ahd_dump_card_state(ahd);
ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A', ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A',
SCB_GET_LUN(scb), SCB_GET_TAG(scb), SCB_GET_LUN(scb), SCB_GET_TAG(scb),
ROLE_INITIATOR, CAM_UNEXP_BUSFREE); ROLE_INITIATOR, CAM_UNEXP_BUSFREE);
...@@ -5049,7 +5059,7 @@ ahd_reset(struct ahd_softc *ahd) ...@@ -5049,7 +5059,7 @@ ahd_reset(struct ahd_softc *ahd)
/* /*
* If a recovery action has forced a chip reset, * If a recovery action has forced a chip reset,
* re-initialize the chip to our likeing. * re-initialize the chip to our liking.
*/ */
if (ahd->init_level > 0) if (ahd->init_level > 0)
ahd_chip_init(ahd); ahd_chip_init(ahd);
...@@ -6565,13 +6575,13 @@ ahd_enable_coalessing(struct ahd_softc *ahd, int enable) ...@@ -6565,13 +6575,13 @@ ahd_enable_coalessing(struct ahd_softc *ahd, int enable)
void void
ahd_pause_and_flushwork(struct ahd_softc *ahd) ahd_pause_and_flushwork(struct ahd_softc *ahd)
{ {
u_int intstat; ahd_mode_state saved_modes;
u_int maxloops; u_int intstat;
int paused; u_int maxloops;
int paused;
maxloops = 1000; maxloops = 1000;
ahd->flags |= AHD_ALL_INTERRUPTS; ahd->flags |= AHD_ALL_INTERRUPTS;
intstat = 0;
paused = FALSE; paused = FALSE;
do { do {
struct scb *waiting_scb; struct scb *waiting_scb;
...@@ -6582,6 +6592,8 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) ...@@ -6582,6 +6592,8 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd)
ahd_pause(ahd); ahd_pause(ahd);
paused = TRUE; paused = TRUE;
ahd_clear_critical_section(ahd); ahd_clear_critical_section(ahd);
saved_modes = ahd_save_modes(ahd);
ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
if ((ahd_inb(ahd, SSTAT0) & (SELDO|SELINGO)) == 0) if ((ahd_inb(ahd, SSTAT0) & (SELDO|SELINGO)) == 0)
ahd_outb(ahd, SCSISEQ0, ahd_outb(ahd, SCSISEQ0,
ahd_inb(ahd, SCSISEQ0) & ~ENSELO); ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
...@@ -6598,10 +6610,10 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) ...@@ -6598,10 +6610,10 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd)
ahd_outb(ahd, SCSISEQ0, ahd_outb(ahd, SCSISEQ0,
ahd_inb(ahd, SCSISEQ0) | ENSELO); ahd_inb(ahd, SCSISEQ0) | ENSELO);
if (intstat == 0xFF && (ahd->features & AHD_REMOVABLE) != 0) intstat = ahd_inb(ahd, INTSTAT);
break;
} while (--maxloops } while (--maxloops
&& (((intstat = ahd_inb(ahd, INTSTAT)) & INT_PEND) != 0 && (intstat != 0xFF || (ahd->features & AHD_REMOVABLE) == 0)
&& ((intstat & INT_PEND) != 0
|| (ahd_inb(ahd, SSTAT0) & (SELDO|SELINGO)))); || (ahd_inb(ahd, SSTAT0) & (SELDO|SELINGO))));
if (maxloops == 0) { if (maxloops == 0) {
printf("Infinite interrupt loop, INTSTAT = %x", printf("Infinite interrupt loop, INTSTAT = %x",
...@@ -6612,6 +6624,7 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) ...@@ -6612,6 +6624,7 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd)
ahd_platform_flushwork(ahd); ahd_platform_flushwork(ahd);
ahd->flags &= ~AHD_ALL_INTERRUPTS; ahd->flags &= ~AHD_ALL_INTERRUPTS;
ahd_restore_modes(ahd, saved_modes);
} }
int int
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#41 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#42 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
......
/* /*
* Adaptec AIC79xx device driver for Linux. * Adaptec AIC79xx device driver for Linux.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#115 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#123 $
* *
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Copyright (c) 1994-2000 Justin T. Gibbs. * Copyright (c) 1994-2000 Justin T. Gibbs.
...@@ -992,9 +992,13 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) ...@@ -992,9 +992,13 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *))
cmd->device->id, cmd->device->lun, cmd->device->id, cmd->device->lun,
/*alloc*/TRUE); /*alloc*/TRUE);
if (dev == NULL) { if (dev == NULL) {
ahd_cmd_set_transaction_status(cmd, CAM_RESRC_UNAVAIL);
ahd_linux_queue_cmd_complete(ahd, cmd);
ahd_schedule_completeq(ahd, NULL);
ahd_midlayer_entrypoint_unlock(ahd, &flags); ahd_midlayer_entrypoint_unlock(ahd, &flags);
printf("aic79xx_linux_queue: Unable to allocate device!\n"); printf("%s: aic79xx_linux_queue - Unable to allocate device!\n",
return (-ENOMEM); ahd_name(ahd));
return (0);
} }
if (cmd->cmd_len > MAX_CDB_LEN) if (cmd->cmd_len > MAX_CDB_LEN)
return (-EINVAL); return (-EINVAL);
...@@ -1213,6 +1217,7 @@ ahd_linux_abort(Scsi_Cmnd *cmd) ...@@ -1213,6 +1217,7 @@ ahd_linux_abort(Scsi_Cmnd *cmd)
u_int saved_scbptr; u_int saved_scbptr;
u_int active_scbptr; u_int active_scbptr;
u_int last_phase; u_int last_phase;
u_int cdb_byte;
int retval; int retval;
int paused; int paused;
int wait; int wait;
...@@ -1225,9 +1230,12 @@ ahd_linux_abort(Scsi_Cmnd *cmd) ...@@ -1225,9 +1230,12 @@ ahd_linux_abort(Scsi_Cmnd *cmd)
ahd = *(struct ahd_softc **)cmd->device->host->hostdata; ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
acmd = (struct ahd_cmd *)cmd; acmd = (struct ahd_cmd *)cmd;
printf("%s:%d:%d:%d: Attempting to abort cmd %p\n", printf("%s:%d:%d:%d: Attempting to abort cmd %p:",
ahd_name(ahd), cmd->device->channel, cmd->device->id, ahd_name(ahd), cmd->device->channel, cmd->device->id,
cmd->device->lun, cmd); cmd->device->lun, cmd);
for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++)
printf(" 0x%x", cmd->cmnd[cdb_byte]);
printf("\n");
/* /*
* In all versions of Linux, we have to work around * In all versions of Linux, we have to work around
...@@ -1560,7 +1568,7 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd) ...@@ -1560,7 +1568,7 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd)
hscb = scb->hscb; hscb = scb->hscb;
hscb->control = 0; hscb->control = 0;
hscb->scsiid = BUILD_SCSIID(ahd, cmd); hscb->scsiid = BUILD_SCSIID(ahd, cmd);
hscb->lun = cmd->lun; hscb->lun = cmd->device->lun;
hscb->cdb_len = 0; hscb->cdb_len = 0;
hscb->task_management = SIU_TASKMGMT_LUN_RESET; hscb->task_management = SIU_TASKMGMT_LUN_RESET;
scb->flags |= SCB_DEVICE_RESET|SCB_RECOVERY_SCB|SCB_ACTIVE; scb->flags |= SCB_DEVICE_RESET|SCB_RECOVERY_SCB|SCB_ACTIVE;
...@@ -2403,8 +2411,23 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template) ...@@ -2403,8 +2411,23 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template)
* negotiation will occur for the first command, and DV * negotiation will occur for the first command, and DV
* will comence should that first command be successful. * will comence should that first command be successful.
*/ */
for (target = 0; target < host->max_id; target++) for (target = 0; target < host->max_id; target++) {
/*
* Skip our own ID. Some Compaq/HP storage devices
* have enclosure management devices that respond to
* single bit selection (i.e. selecting ourselves).
* It is expected that either an external application
* or a modified kernel will be used to probe this
* ID if it is appropriate. To accomodate these installations,
* ahc_linux_alloc_target() will allocate for our ID if
* asked to do so.
*/
if (target == ahd->our_id)
continue;
ahd_linux_alloc_target(ahd, 0, target); ahd_linux_alloc_target(ahd, 0, target);
}
ahd_intr_enable(ahd, TRUE); ahd_intr_enable(ahd, TRUE);
ahd_linux_start_dv(ahd); ahd_linux_start_dv(ahd);
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
...@@ -2845,16 +2868,21 @@ ahd_linux_dv_thread(void *data) ...@@ -2845,16 +2868,21 @@ ahd_linux_dv_thread(void *data)
printf("In DV Thread\n"); printf("In DV Thread\n");
#endif #endif
/*
* Complete thread creation.
*/
lock_kernel();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
/* /*
* Don't care about any signals. * Don't care about any signals.
*/ */
siginitsetinv(&current->blocked, 0); siginitsetinv(&current->blocked, 0);
/* daemonize();
* Complete thread creation. sprintf(current->comm, "ahd_dv_%d", ahd->unit);
*/ #else
lock_kernel();
daemonize("ahd_dv_%d", ahd->unit); daemonize("ahd_dv_%d", ahd->unit);
#endif
unlock_kernel(); unlock_kernel();
while (1) { while (1) {
...@@ -4268,6 +4296,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev) ...@@ -4268,6 +4296,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
*/ */
hscb->control = 0; hscb->control = 0;
hscb->scsiid = BUILD_SCSIID(ahd, cmd); hscb->scsiid = BUILD_SCSIID(ahd, cmd);
hscb->lun = cmd->device->lun;
scb->hscb->task_management = 0; scb->hscb->task_management = 0;
mask = SCB_GET_TARGET_MASK(ahd, scb); mask = SCB_GET_TARGET_MASK(ahd, scb);
...@@ -4430,17 +4459,6 @@ static struct ahd_linux_target* ...@@ -4430,17 +4459,6 @@ static struct ahd_linux_target*
ahd_linux_alloc_target(struct ahd_softc *ahd, u_int channel, u_int target) ahd_linux_alloc_target(struct ahd_softc *ahd, u_int channel, u_int target)
{ {
struct ahd_linux_target *targ; struct ahd_linux_target *targ;
u_int target_offset;
target_offset = target;
/*
* Never allow allocation of a target object for
* our own SCSIID.
*/
if (target == ahd->our_id) {
ahd->platform_data->targets[target_offset] = NULL;
return (NULL);
}
targ = malloc(sizeof(*targ), M_DEVBUF, M_NOWAIT); targ = malloc(sizeof(*targ), M_DEVBUF, M_NOWAIT);
if (targ == NULL) if (targ == NULL)
...@@ -4450,7 +4468,7 @@ ahd_linux_alloc_target(struct ahd_softc *ahd, u_int channel, u_int target) ...@@ -4450,7 +4468,7 @@ ahd_linux_alloc_target(struct ahd_softc *ahd, u_int channel, u_int target)
targ->target = target; targ->target = target;
targ->ahd = ahd; targ->ahd = ahd;
targ->flags = AHD_DV_REQUIRED; targ->flags = AHD_DV_REQUIRED;
ahd->platform_data->targets[target_offset] = targ; ahd->platform_data->targets[target] = targ;
return (targ); return (targ);
} }
...@@ -4692,6 +4710,14 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) ...@@ -4692,6 +4710,14 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)
#endif #endif
ahd_set_transaction_status(scb, CAM_UNCOR_PARITY); ahd_set_transaction_status(scb, CAM_UNCOR_PARITY);
} else if (amount_xferred < scb->io_ctx->underflow) { } else if (amount_xferred < scb->io_ctx->underflow) {
u_int i;
ahd_print_path(ahd, scb);
printf("CDB:");
for (i = 0; i < scb->io_ctx->cmd_len; i++)
printf(" 0x%x", scb->io_ctx->cmnd[i]);
printf("\n");
ahd_print_path(ahd, scb);
printf("Saw underflow (%ld of %ld bytes). " printf("Saw underflow (%ld of %ld bytes). "
"Treated as error\n", "Treated as error\n",
ahd_get_residual(scb), ahd_get_residual(scb),
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#108 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#112 $
* *
*/ */
#ifndef _AIC79XX_LINUX_H_ #ifndef _AIC79XX_LINUX_H_
...@@ -286,7 +286,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec) ...@@ -286,7 +286,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h> #include <linux/smp.h>
#endif #endif
#define AIC79XX_DRIVER_VERSION "1.3.0" #define AIC79XX_DRIVER_VERSION "1.3.2"
/**************************** Front End Queues ********************************/ /**************************** Front End Queues ********************************/
/* /*
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES. * POSSIBILITY OF SUCH DAMAGES.
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#63 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#65 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -698,14 +698,14 @@ static const char *pci_status_source[] = ...@@ -698,14 +698,14 @@ static const char *pci_status_source[] =
static const char *split_status_strings[] = static const char *split_status_strings[] =
{ {
"%s: Received split response in %s.\n" "%s: Received split response in %s.\n",
"%s: Received split completion error message in %s\n", "%s: Received split completion error message in %s\n",
"%s: Receive overrun in %s\n", "%s: Receive overrun in %s\n",
"%s: Count not complete in %s\n", "%s: Count not complete in %s\n",
"%s: Split completion data bucket in %s\n", "%s: Split completion data bucket in %s\n",
"%s: Split completion address error in %s\n", "%s: Split completion address error in %s\n",
"%s: Split completion byte count error in %s\n", "%s: Split completion byte count error in %s\n",
"%s: Signaled Target-abort to early terminate a split in %s\n", "%s: Signaled Target-abort to early terminate a split in %s\n"
}; };
static const char *pci_status_strings[] = static const char *pci_status_strings[] =
...@@ -905,7 +905,7 @@ ahd_aic7902_setup(struct ahd_softc *ahd) ...@@ -905,7 +905,7 @@ ahd_aic7902_setup(struct ahd_softc *ahd)
ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS
| AHD_NEW_DFCNTRL_OPTS; | AHD_NEW_DFCNTRL_OPTS;
ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_ABORT_LQI_BUG ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_ABORT_LQI_BUG
| AHD_INTCOLLISION_BUG; | AHD_INTCOLLISION_BUG|AHD_EARLY_REQ_BUG;
/* /*
* IO Cell paramter setup. * IO Cell paramter setup.
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr> * String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr>
* sym driver. * sym driver.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_proc.c#11 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_proc.c#12 $
*/ */
#include "aic79xx_osm.h" #include "aic79xx_osm.h"
#include "aic79xx_inline.h" #include "aic79xx_inline.h"
...@@ -311,6 +311,7 @@ ahd_linux_proc_info(char *buffer, char **start, off_t offset, ...@@ -311,6 +311,7 @@ ahd_linux_proc_info(char *buffer, char **start, off_t offset,
copy_info(&info, "Adaptec AIC79xx driver version: %s\n", copy_info(&info, "Adaptec AIC79xx driver version: %s\n",
AIC79XX_DRIVER_VERSION); AIC79XX_DRIVER_VERSION);
copy_info(&info, "%s\n", ahd->description);
ahd_controller_info(ahd, ahd_info); ahd_controller_info(ahd, ahd_info);
copy_info(&info, "%s\n\n", ahd_info); copy_info(&info, "%s\n\n", ahd_info);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* DO NOT EDIT - This file is automatically generated * DO NOT EDIT - This file is automatically generated
* from the following source files: * from the following source files:
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#78 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#86 $
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $
*/ */
typedef int (ahd_reg_print_t)(u_int, u_int *, u_int); typedef int (ahd_reg_print_t)(u_int, u_int *, u_int);
...@@ -3774,5 +3774,5 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; ...@@ -3774,5 +3774,5 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print;
/* Exported Labels */ /* Exported Labels */
#define LABEL_seq_isr 0x263 #define LABEL_seq_isr 0x268
#define LABEL_timer_isr 0x25f #define LABEL_timer_isr 0x264
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* DO NOT EDIT - This file is automatically generated * DO NOT EDIT - This file is automatically generated
* from the following source files: * from the following source files:
* *
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#78 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#86 $
* $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $
*/ */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment