Commit 8ab9f40f authored by Justin T. Gibbs's avatar Justin T. Gibbs

Merge http://linux.bkbits.net/linux-2.5

into overdrive.btc.adaptec.com:/usr/home/gibbs/bk/linux-2.5
parents 91e2be46 21718980
# #
# AIC7XXX and AIC79XX 2.5.X Kernel configuration File. # AIC7XXX and AIC79XX 2.5.X Kernel configuration File.
# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#5 $ # $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#6 $
# #
config SCSI_AIC7XXX config SCSI_AIC7XXX
tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)" tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)"
......
...@@ -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/aic7770.c#27 $ * $Id: //depot/aic7xxx/aic7xxx/aic7770.c#29 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
#define ID_OLV_274x 0x04907782 /* Olivetti OEM */ #define ID_OLV_274x 0x04907782 /* Olivetti OEM */
#define ID_OLV_274xD 0x04907783 /* Olivetti OEM (Differential) */ #define ID_OLV_274xD 0x04907783 /* Olivetti OEM (Differential) */
static int aic7770_chip_init(struct ahc_softc *ahc);
static int aic7770_suspend(struct ahc_softc *ahc);
static int aic7770_resume(struct ahc_softc *ahc);
static int aha2840_load_seeprom(struct ahc_softc *ahc); static int aha2840_load_seeprom(struct ahc_softc *ahc);
static ahc_device_setup_t ahc_aic7770_VL_setup; static ahc_device_setup_t ahc_aic7770_VL_setup;
static ahc_device_setup_t ahc_aic7770_EISA_setup;; static ahc_device_setup_t ahc_aic7770_EISA_setup;;
...@@ -144,6 +147,12 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io) ...@@ -144,6 +147,12 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
ahc->description = entry->name; ahc->description = entry->name;
error = ahc_softc_init(ahc); error = ahc_softc_init(ahc);
if (error != 0)
return (error);
ahc->bus_chip_init = aic7770_chip_init;
ahc->bus_suspend = aic7770_suspend;
ahc->bus_resume = aic7770_resume;
error = ahc_reset(ahc); error = ahc_reset(ahc);
if (error != 0) if (error != 0)
...@@ -226,6 +235,9 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io) ...@@ -226,6 +235,9 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
ahc_outb(ahc, BUSSPD, hostconf & DFTHRSH); ahc_outb(ahc, BUSSPD, hostconf & DFTHRSH);
ahc_outb(ahc, BUSTIME, (hostconf << 2) & BOFF); ahc_outb(ahc, BUSTIME, (hostconf << 2) & BOFF);
ahc->bus_softc.aic7770_softc.busspd = hostconf & DFTHRSH;
ahc->bus_softc.aic7770_softc.bustime = (hostconf << 2) & BOFF;
/* /*
* Generic aic7xxx initialization. * Generic aic7xxx initialization.
*/ */
...@@ -253,6 +265,28 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io) ...@@ -253,6 +265,28 @@ aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
return (0); return (0);
} }
static int
aic7770_chip_init(struct ahc_softc *ahc)
{
ahc_outb(ahc, BUSSPD, ahc->bus_softc.aic7770_softc.busspd);
ahc_outb(ahc, BUSTIME, ahc->bus_softc.aic7770_softc.bustime);
ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) & ~AUTOFLUSHDIS);
ahc_outb(ahc, BCTL, ENABLE);
return (ahc_chip_init(ahc));
}
static int
aic7770_suspend(struct ahc_softc *ahc)
{
return (ahc_suspend(ahc));
}
static int
aic7770_resume(struct ahc_softc *ahc)
{
return (ahc_resume(ahc));
}
/* /*
* Read the 284x SEEPROM. * Read the 284x SEEPROM.
*/ */
...@@ -371,5 +405,6 @@ ahc_aic7770_setup(struct ahc_softc *ahc) ...@@ -371,5 +405,6 @@ ahc_aic7770_setup(struct ahc_softc *ahc)
ahc->features = AHC_AIC7770_FE; ahc->features = AHC_AIC7770_FE;
ahc->bugs |= AHC_TMODE_WIDEODD_BUG; ahc->bugs |= AHC_TMODE_WIDEODD_BUG;
ahc->flags |= AHC_PAGESCBS; ahc->flags |= AHC_PAGESCBS;
ahc->instruction_ram_size = 448;
return (0); return (0);
} }
...@@ -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#78 $" 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;
} }
...@@ -1510,12 +1524,6 @@ data_phase_done: ...@@ -1510,12 +1524,6 @@ data_phase_done:
* the idle loop and there is no need to perform * the idle loop and there is no need to perform
* any fixups. * any fixups.
*/ */
calc_residual:
test SG_CACHE_SHADOW, LAST_SEG jz residual_before_last_seg;
/* Record if we've consumed all S/G entries */
test MDFFSTAT, SHVALID jz . + 2;
bmov SCB_RESIDUAL_DATACNT, SHCNT, 3 ret;
or SCB_RESIDUAL_SGPTR[0], SG_LIST_NULL ret;
residual_before_last_seg: residual_before_last_seg:
test MDFFSTAT, SHVALID jnz sgptr_fixup; test MDFFSTAT, SHVALID jnz sgptr_fixup;
/* /*
...@@ -1525,7 +1533,13 @@ residual_before_last_seg: ...@@ -1525,7 +1533,13 @@ residual_before_last_seg:
*/ */
call idle_loop_service_fifos; call idle_loop_service_fifos;
RESTORE_MODE(SAVED_MODE) RESTORE_MODE(SAVED_MODE)
jmp calc_residual; /* FALLTHROUGH */
calc_residual:
test SG_CACHE_SHADOW, LAST_SEG jz residual_before_last_seg;
/* Record if we've consumed all S/G entries */
test MDFFSTAT, SHVALID jz . + 2;
bmov SCB_RESIDUAL_DATACNT, SHCNT, 3 ret;
or SCB_RESIDUAL_SGPTR[0], SG_LIST_NULL ret;
sgptr_fixup: sgptr_fixup:
/* /*
...@@ -1570,7 +1584,51 @@ export timer_isr: ...@@ -1570,7 +1584,51 @@ export timer_isr:
} }
export seq_isr: export seq_isr:
nop; /* Jumps in the first ISR instruction fail on Rev A. */ if ((ahd->features & AHD_RTI) == 0) {
/*
* On RevA Silicon, if the target returns us to data-out
* after we have already trained for data-out, it is
* possible for us to transition the free running clock to
* data-valid before the required 100ns P1 setup time (8 P1
* assertions in fast-160 mode). This will only happen if
* this L-Q is a continuation of a data transfer for which
* we have already prefetched data into our FIFO (LQ/Data
* followed by LQ/Data for the same write transaction).
* This can cause some target implementations to miss the
* first few data transfers on the bus. We detect this
* situation by noticing that this is the first data transfer
* after an LQ (LQIWORKONLQ true), that the data transfer is
* a continuation of a transfer already setup in our FIFO
* (SAVEPTRS interrupt), and that the transaction is a write
* (DIRECTION set in DFCNTRL). The delay is performed by
* disabling SCSIEN until we see the first REQ from the
* target.
*
* First instruction in an ISR cannot be a branch on
* Rev A. Snapshot LQISTAT2 so the status is not missed
* and deffer the test by one instruction.
*/
mov REG_ISR, LQISTAT2;
test REG_ISR, LQIWORKONLQ jz data_valid;
test SEQINTSRC, SAVEPTRS jz data_valid;
test LONGJMP_ADDR[1], INVALID_ADDR jz saveptr_active_fifo;
/*
* Switch to the active FIFO.
*/
xor MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
test DFCNTRL, DIRECTION jz snapshot_other_fifo;
and DFCNTRL, ~SCSIEN;
test SSTAT1, REQINIT jz .;
or DFCNTRL, SCSIEN;
/* 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:
}
test SEQINTSRC, CFG4DATA jnz cfg4data_intr; test SEQINTSRC, CFG4DATA jnz cfg4data_intr;
test SEQINTSRC, CFG4ISTAT jnz cfg4istat_intr; test SEQINTSRC, CFG4ISTAT jnz cfg4istat_intr;
test SEQINTSRC, SAVEPTRS jnz saveptr_intr; test SEQINTSRC, SAVEPTRS jnz saveptr_intr;
...@@ -1583,21 +1641,23 @@ export seq_isr: ...@@ -1583,21 +1641,23 @@ export seq_isr:
* active and contains a snapshot of the current poniter information. * active and contains a snapshot of the current poniter information.
* This happens between packets in a stream for a single L_Q. Since we * This happens between packets in a stream for a single L_Q. Since we
* are not performing a pointer save, we can safely clear the channel * are not performing a pointer save, we can safely clear the channel
* so it can be used for other transactions. * so it can be used for other transactions. On RTI capable controllers,
* where snapshots can, and are, disabled, the code to handle this type
* 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.
*/ */
saveptr_intr: saveptr_intr:
test DFCNTRL, HDMAENACK jz snapshot_saveptr; if ((ahd->features & AHD_RTI) == 0) {
test LONGJMP_ADDR[1], INVALID_ADDR jnz snapshot_saveptr;
}
saveptr_active_fifo:
and SEQIMODE, ~ENSAVEPTRS; and SEQIMODE, ~ENSAVEPTRS;
or SEQINTCTL, IRET ret; or SEQINTCTL, IRET ret;
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;
...@@ -1672,7 +1732,7 @@ pkt_service_fifo: ...@@ -1672,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;
...@@ -1716,7 +1776,7 @@ pkt_saveptrs_clrchn: ...@@ -1716,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#156 $ * $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);
...@@ -6050,7 +6060,7 @@ ahd_chip_init(struct ahd_softc *ahd) ...@@ -6050,7 +6060,7 @@ ahd_chip_init(struct ahd_softc *ahd)
} else { } else {
ahd_outb(ahd, OPTIONMODE, AUTOACKEN|BUSFREEREV|AUTO_MSGOUT_DE); ahd_outb(ahd, OPTIONMODE, AUTOACKEN|BUSFREEREV|AUTO_MSGOUT_DE);
} }
ahd_outb(ahd, SCSCHKN, CURRFIFODEF|WIDERESEN); ahd_outb(ahd, SCSCHKN, CURRFIFODEF|WIDERESEN|SHVALIDSTDIS);
if ((ahd->chip & AHD_BUS_MASK) == AHD_PCIX) if ((ahd->chip & AHD_BUS_MASK) == AHD_PCIX)
/* /*
* Do not issue a target abort when a split completion * Do not issue a target abort when a split completion
...@@ -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
...@@ -2405,8 +2413,23 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template) ...@@ -2405,8 +2413,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);
...@@ -2847,16 +2870,21 @@ ahd_linux_dv_thread(void *data) ...@@ -2847,16 +2870,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) {
...@@ -4433,17 +4461,6 @@ static struct ahd_linux_target* ...@@ -4433,17 +4461,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)
...@@ -4453,7 +4470,7 @@ ahd_linux_alloc_target(struct ahd_softc *ahd, u_int channel, u_int target) ...@@ -4453,7 +4470,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);
} }
...@@ -4695,6 +4712,14 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb) ...@@ -4695,6 +4712,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#61 $ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#65 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -80,6 +80,7 @@ ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor) ...@@ -80,6 +80,7 @@ ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
#define ID_AIC7902_B 0x801D9005FFFF9005ull #define ID_AIC7902_B 0x801D9005FFFF9005ull
#define ID_AIC7902_B_IROC 0x809D9005FFFF9005ull #define ID_AIC7902_B_IROC 0x809D9005FFFF9005ull
#define ID_AHA_39320 0x8010900500409005ull #define ID_AHA_39320 0x8010900500409005ull
#define ID_AHA_39320A 0x8016900500409005ull
#define ID_AHA_39320D 0x8011900500419005ull #define ID_AHA_39320D 0x8011900500419005ull
#define ID_AHA_39320D_B 0x801C900500419005ull #define ID_AHA_39320D_B 0x801C900500419005ull
#define ID_AHA_39320D_HP 0x8011900500AC0E11ull #define ID_AHA_39320D_HP 0x8011900500AC0E11ull
...@@ -137,6 +138,12 @@ struct ahd_pci_identity ahd_pci_ident_table [] = ...@@ -137,6 +138,12 @@ struct ahd_pci_identity ahd_pci_ident_table [] =
"Adaptec 39320 Ultra320 SCSI adapter", "Adaptec 39320 Ultra320 SCSI adapter",
ahd_aic7902_setup ahd_aic7902_setup
}, },
{
ID_AHA_39320A,
ID_ALL_MASK,
"Adaptec 39320A Ultra320 SCSI adapter",
ahd_aic7902_setup
},
{ {
ID_AHA_39320D, ID_AHA_39320D,
ID_ALL_MASK, ID_ALL_MASK,
...@@ -698,7 +705,7 @@ static const char *split_status_strings[] = ...@@ -698,7 +705,7 @@ static const char *split_status_strings[] =
"%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[] =
...@@ -898,7 +905,7 @@ ahd_aic7902_setup(struct ahd_softc *ahd) ...@@ -898,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.
...@@ -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/aic7xxx.h#70 $ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#72 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -365,7 +365,8 @@ typedef enum { ...@@ -365,7 +365,8 @@ typedef enum {
AHC_LSCBS_ENABLED = 0x2000000, /* 64Byte SCBs enabled */ AHC_LSCBS_ENABLED = 0x2000000, /* 64Byte SCBs enabled */
AHC_SCB_CONFIG_USED = 0x4000000, /* No SEEPROM but SCB2 had info. */ AHC_SCB_CONFIG_USED = 0x4000000, /* No SEEPROM but SCB2 had info. */
AHC_NO_BIOS_INIT = 0x8000000, /* No BIOS left over settings. */ AHC_NO_BIOS_INIT = 0x8000000, /* No BIOS left over settings. */
AHC_DISABLE_PCI_PERR = 0x10000000 AHC_DISABLE_PCI_PERR = 0x10000000,
AHC_HAS_TERM_LOGIC = 0x20000000
} ahc_flag; } ahc_flag;
/************************* Hardware SCB Definition ***************************/ /************************* Hardware SCB Definition ***************************/
...@@ -877,31 +878,39 @@ typedef enum { ...@@ -877,31 +878,39 @@ typedef enum {
/*********************** Software Configuration Structure *********************/ /*********************** Software Configuration Structure *********************/
TAILQ_HEAD(scb_tailq, scb); TAILQ_HEAD(scb_tailq, scb);
struct ahc_suspend_channel_state { struct ahc_aic7770_softc {
uint8_t scsiseq; /*
uint8_t sxfrctl0; * Saved register state used for chip_init().
uint8_t sxfrctl1; */
uint8_t simode0; uint8_t busspd;
uint8_t simode1; uint8_t bustime;
uint8_t seltimer; };
uint8_t seqctl;
struct ahc_pci_softc {
/*
* Saved register state used for chip_init().
*/
uint32_t devconfig;
uint16_t targcrccnt;
uint8_t command;
uint8_t csize_lattime;
uint8_t optionmode;
uint8_t crccontrol1;
uint8_t dscommand0;
uint8_t dspcistatus;
uint8_t scbbaddr;
uint8_t dff_thrsh;
}; };
struct ahc_suspend_state { union ahc_bus_softc {
struct ahc_suspend_channel_state channel[2]; struct ahc_aic7770_softc aic7770_softc;
uint8_t optionmode; struct ahc_pci_softc pci_softc;
uint8_t dscommand0;
uint8_t dspcistatus;
/* hsmailbox */
uint8_t crccontrol1;
uint8_t scbbaddr;
/* Host and sequencer SCB counts */
uint8_t dff_thrsh;
uint8_t *scratch_ram;
uint8_t *btt;
}; };
typedef void (*ahc_bus_intr_t)(struct ahc_softc *); typedef void (*ahc_bus_intr_t)(struct ahc_softc *);
typedef int (*ahc_bus_chip_init_t)(struct ahc_softc *);
typedef int (*ahc_bus_suspend_t)(struct ahc_softc *);
typedef int (*ahc_bus_resume_t)(struct ahc_softc *);
typedef void ahc_callback_t (void *); typedef void ahc_callback_t (void *);
struct ahc_softc { struct ahc_softc {
...@@ -936,6 +945,11 @@ struct ahc_softc { ...@@ -936,6 +945,11 @@ struct ahc_softc {
*/ */
struct scb_tailq untagged_queues[AHC_NUM_TARGETS]; struct scb_tailq untagged_queues[AHC_NUM_TARGETS];
/*
* Bus attachment specific data.
*/
union ahc_bus_softc bus_softc;
/* /*
* Platform specific data. * Platform specific data.
*/ */
...@@ -951,6 +965,22 @@ struct ahc_softc { ...@@ -951,6 +965,22 @@ struct ahc_softc {
*/ */
ahc_bus_intr_t bus_intr; ahc_bus_intr_t bus_intr;
/*
* Bus specific initialization required
* after a chip reset.
*/
ahc_bus_chip_init_t bus_chip_init;
/*
* Bus specific suspend routine.
*/
ahc_bus_suspend_t bus_suspend;
/*
* Bus specific resume routine.
*/
ahc_bus_resume_t bus_resume;
/* /*
* Target mode related state kept on a per enabled lun basis. * Target mode related state kept on a per enabled lun basis.
* Targets that are not enabled will have null entries. * Targets that are not enabled will have null entries.
...@@ -1043,9 +1073,6 @@ struct ahc_softc { ...@@ -1043,9 +1073,6 @@ struct ahc_softc {
*/ */
bus_addr_t dma_bug_buf; bus_addr_t dma_bug_buf;
/* Information saved through suspend/resume cycles */
struct ahc_suspend_state suspend_state;
/* Number of enabled target mode device on this card */ /* Number of enabled target mode device on this card */
u_int enabled_luns; u_int enabled_luns;
...@@ -1055,7 +1082,8 @@ struct ahc_softc { ...@@ -1055,7 +1082,8 @@ struct ahc_softc {
/* PCI cacheline size. */ /* PCI cacheline size. */
u_int pci_cachesize; u_int pci_cachesize;
u_int stack_size; /* Maximum number of sequencer instructions supported. */
u_int instruction_ram_size;
/* Per-Unit descriptive information */ /* Per-Unit descriptive information */
const char *description; const char *description;
...@@ -1152,6 +1180,7 @@ int ahc_match_scb(struct ahc_softc *ahc, struct scb *scb, ...@@ -1152,6 +1180,7 @@ int ahc_match_scb(struct ahc_softc *ahc, struct scb *scb,
struct ahc_softc *ahc_alloc(void *platform_arg, char *name); struct ahc_softc *ahc_alloc(void *platform_arg, char *name);
int ahc_softc_init(struct ahc_softc *); int ahc_softc_init(struct ahc_softc *);
void ahc_controller_info(struct ahc_softc *ahc, char *buf); void ahc_controller_info(struct ahc_softc *ahc, char *buf);
int ahc_chip_init(struct ahc_softc *ahc);
int ahc_init(struct ahc_softc *ahc); int ahc_init(struct ahc_softc *ahc);
void ahc_intr_enable(struct ahc_softc *ahc, int enable); void ahc_intr_enable(struct ahc_softc *ahc, int enable);
void ahc_pause_and_flushwork(struct ahc_softc *ahc); void ahc_pause_and_flushwork(struct ahc_softc *ahc);
...@@ -1167,7 +1196,6 @@ int ahc_reset(struct ahc_softc *ahc); ...@@ -1167,7 +1196,6 @@ int ahc_reset(struct ahc_softc *ahc);
void ahc_shutdown(void *arg); void ahc_shutdown(void *arg);
/*************************** Interrupt Services *******************************/ /*************************** Interrupt Services *******************************/
void ahc_pci_intr(struct ahc_softc *ahc);
void ahc_clear_intstat(struct ahc_softc *ahc); void ahc_clear_intstat(struct ahc_softc *ahc);
void ahc_run_qoutfifo(struct ahc_softc *ahc); void ahc_run_qoutfifo(struct ahc_softc *ahc);
#ifdef AHC_TARGET_MODE #ifdef AHC_TARGET_MODE
......
This diff is collapsed.
...@@ -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/aic7xxx_inline.h#39 $ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_inline.h#40 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
......
/* /*
* Adaptec AIC7xxx device driver for Linux. * Adaptec AIC7xxx device driver for Linux.
* *
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#179 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#188 $
* *
* Copyright (c) 1994 John Aycock * Copyright (c) 1994 John Aycock
* The University of Calgary Department of Computer Science. * The University of Calgary Department of Computer Science.
...@@ -995,9 +995,13 @@ ahc_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) ...@@ -995,9 +995,13 @@ ahc_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *))
dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id, dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id,
cmd->device->lun, /*alloc*/TRUE); cmd->device->lun, /*alloc*/TRUE);
if (dev == NULL) { if (dev == NULL) {
ahc_cmd_set_transaction_status(cmd, CAM_RESRC_UNAVAIL);
ahc_linux_queue_cmd_complete(ahc, cmd);
ahc_schedule_completeq(ahc, NULL);
ahc_midlayer_entrypoint_unlock(ahc, &flags); ahc_midlayer_entrypoint_unlock(ahc, &flags);
printf("aic7xxx_linux_queue: Unable to allocate device!\n"); printf("%s: aic7xxx_linux_queue - Unable to allocate device!\n",
return (-ENOMEM); ahc_name(ahc));
return (0);
} }
cmd->result = CAM_REQ_INPROG << 16; cmd->result = CAM_REQ_INPROG << 16;
TAILQ_INSERT_TAIL(&dev->busyq, (struct ahc_cmd *)cmd, acmd_links.tqe); TAILQ_INSERT_TAIL(&dev->busyq, (struct ahc_cmd *)cmd, acmd_links.tqe);
...@@ -1892,6 +1896,20 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template) ...@@ -1892,6 +1896,20 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template)
if (target > 7 if (target > 7
&& (ahc->features & AHC_TWIN) != 0) && (ahc->features & AHC_TWIN) != 0)
channel = 1; channel = 1;
/*
* 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 ((channel == 0 && target == ahc->our_id)
|| (channel == 1 && target == ahc->our_id_b))
continue;
ahc_linux_alloc_target(ahc, channel, target); ahc_linux_alloc_target(ahc, channel, target);
} }
ahc_intr_enable(ahc, TRUE); ahc_intr_enable(ahc, TRUE);
...@@ -2360,7 +2378,17 @@ ahc_linux_dv_thread(void *data) ...@@ -2360,7 +2378,17 @@ ahc_linux_dv_thread(void *data)
* Complete thread creation. * Complete thread creation.
*/ */
lock_kernel(); lock_kernel();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/*
* Don't care about any signals.
*/
siginitsetinv(&current->blocked, 0);
daemonize();
sprintf(current->comm, "ahc_dv_%d", ahc->unit);
#else
daemonize("ahc_dv_%d", ahc->unit); daemonize("ahc_dv_%d", ahc->unit);
#endif
unlock_kernel(); unlock_kernel();
while (1) { while (1) {
...@@ -3993,15 +4021,6 @@ ahc_linux_alloc_target(struct ahc_softc *ahc, u_int channel, u_int target) ...@@ -3993,15 +4021,6 @@ ahc_linux_alloc_target(struct ahc_softc *ahc, u_int channel, u_int target)
target_offset = target; target_offset = target;
if (channel != 0) if (channel != 0)
target_offset += 8; target_offset += 8;
/*
* Never allow allocation of a target object for
* our own SCSIID.
*/
if ((channel == 0 && target == ahc->our_id)
|| (channel == 1 && target == ahc->our_id_b)) {
ahc->platform_data->targets[target_offset] = NULL;
return (NULL);
}
targ = malloc(sizeof(*targ), M_DEVBUG, M_NOWAIT); targ = malloc(sizeof(*targ), M_DEVBUG, M_NOWAIT);
if (targ == NULL) if (targ == NULL)
...@@ -4272,6 +4291,14 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb) ...@@ -4272,6 +4291,14 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)
#endif #endif
ahc_set_transaction_status(scb, CAM_UNCOR_PARITY); ahc_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;
ahc_print_path(ahc, scb);
printf("CDB:");
for (i = 0; i < scb->io_ctx->cmd_len; i++)
printf(" 0x%x", scb->io_ctx->cmnd[i]);
printf("\n");
ahc_print_path(ahc, scb);
printf("Saw underflow (%ld of %ld bytes). " printf("Saw underflow (%ld of %ld bytes). "
"Treated as error\n", "Treated as error\n",
ahc_get_residual(scb), ahc_get_residual(scb),
...@@ -4813,6 +4840,7 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag) ...@@ -4813,6 +4840,7 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag)
u_int active_scb_index; u_int active_scb_index;
u_int last_phase; u_int last_phase;
u_int saved_scsiid; u_int saved_scsiid;
u_int cdb_byte;
int retval; int retval;
int paused; int paused;
int wait; int wait;
...@@ -4829,6 +4857,11 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag) ...@@ -4829,6 +4857,11 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag)
cmd->device->id, cmd->device->lun, cmd->device->id, cmd->device->lun,
flag == SCB_ABORT ? "n ABORT" : " TARGET RESET"); flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
printf("CDB:");
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
* a major flaw in how the mid-layer is locked down * a major flaw in how the mid-layer is locked down
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,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/aic7xxx_osm.h#123 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#126 $
* *
*/ */
#ifndef _AIC7XXX_LINUX_H_ #ifndef _AIC7XXX_LINUX_H_
...@@ -299,7 +299,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec) ...@@ -299,7 +299,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h> #include <linux/smp.h>
#endif #endif
#define AIC7XXX_DRIVER_VERSION "6.2.28" #define AIC7XXX_DRIVER_VERSION "6.2.29"
/**************************** Front End Queues ********************************/ /**************************** Front End Queues ********************************/
/* /*
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,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/aic7xxx_pci.c#57 $ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#60 $
* *
* $FreeBSD$ * $FreeBSD$
*/ */
...@@ -696,8 +696,12 @@ static void aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present, ...@@ -696,8 +696,12 @@ static void aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present, static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
int *externalcable_present, int *externalcable_present,
int *eeprom_present); int *eeprom_present);
static void write_brdctl(struct ahc_softc *ahc, uint8_t value); static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
static uint8_t read_brdctl(struct ahc_softc *ahc); static uint8_t read_brdctl(struct ahc_softc *ahc);
static void ahc_pci_intr(struct ahc_softc *ahc);
static int ahc_pci_chip_init(struct ahc_softc *ahc);
static int ahc_pci_suspend(struct ahc_softc *ahc);
static int ahc_pci_resume(struct ahc_softc *ahc);
static int static int
ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor, ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor,
...@@ -854,6 +858,9 @@ ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry) ...@@ -854,6 +858,9 @@ ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry)
return (error); return (error);
ahc->bus_intr = ahc_pci_intr; ahc->bus_intr = ahc_pci_intr;
ahc->bus_chip_init = ahc_pci_chip_init;
ahc->bus_suspend = ahc_pci_suspend;
ahc->bus_resume = ahc_pci_resume;
/* Remeber how the card was setup in case there is no SEEPROM */ /* Remeber how the card was setup in case there is no SEEPROM */
if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) { if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) {
...@@ -993,6 +1000,35 @@ ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry) ...@@ -993,6 +1000,35 @@ ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry)
if ((sxfrctl1 & STPWEN) != 0) if ((sxfrctl1 & STPWEN) != 0)
ahc->flags |= AHC_TERM_ENB_A; ahc->flags |= AHC_TERM_ENB_A;
/*
* Save chip register configuration data for chip resets
* that occur during runtime and resume events.
*/
ahc->bus_softc.pci_softc.devconfig =
ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
ahc->bus_softc.pci_softc.command =
ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1);
ahc->bus_softc.pci_softc.csize_lattime =
ahc_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1);
ahc->bus_softc.pci_softc.dscommand0 = ahc_inb(ahc, DSCOMMAND0);
ahc->bus_softc.pci_softc.dspcistatus = ahc_inb(ahc, DSPCISTATUS);
if ((ahc->features & AHC_DT) != 0) {
u_int sfunct;
sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE);
ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT);
ahc_outb(ahc, SFUNCT, sfunct);
ahc->bus_softc.pci_softc.crccontrol1 =
ahc_inb(ahc, CRCCONTROL1);
}
if ((ahc->features & AHC_MULTI_FUNC) != 0)
ahc->bus_softc.pci_softc.scbbaddr = ahc_inb(ahc, SCBBADDR);
if ((ahc->features & AHC_ULTRA2) != 0)
ahc->bus_softc.pci_softc.dff_thrsh = ahc_inb(ahc, DFF_THRSH);
/* Core initialization */ /* Core initialization */
error = ahc_init(ahc); error = ahc_init(ahc);
if (error != 0) if (error != 0)
...@@ -1412,6 +1448,7 @@ check_extport(struct ahc_softc *ahc, u_int *sxfrctl1) ...@@ -1412,6 +1448,7 @@ check_extport(struct ahc_softc *ahc, u_int *sxfrctl1)
} }
if (have_autoterm) { if (have_autoterm) {
ahc->flags |= AHC_HAS_TERM_LOGIC;
ahc_acquire_seeprom(ahc, &sd); ahc_acquire_seeprom(ahc, &sd);
configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1); configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1);
ahc_release_seeprom(&sd); ahc_release_seeprom(&sd);
...@@ -1845,11 +1882,14 @@ aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present, ...@@ -1845,11 +1882,14 @@ aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
spiocap |= EXT_BRDCTL; spiocap |= EXT_BRDCTL;
ahc_outb(ahc, SPIOCAP, spiocap); ahc_outb(ahc, SPIOCAP, spiocap);
ahc_outb(ahc, BRDCTL, BRDRW|BRDCS); ahc_outb(ahc, BRDCTL, BRDRW|BRDCS);
ahc_flush_device_writes(ahc);
ahc_delay(500);
ahc_outb(ahc, BRDCTL, 0); ahc_outb(ahc, BRDCTL, 0);
ahc_flush_device_writes(ahc);
ahc_delay(500);
brdctl = ahc_inb(ahc, BRDCTL); brdctl = ahc_inb(ahc, BRDCTL);
*internal50_present = (brdctl & BRDDAT5) ? 0 : 1; *internal50_present = (brdctl & BRDDAT5) ? 0 : 1;
*externalcable_present = (brdctl & BRDDAT6) ? 0 : 1; *externalcable_present = (brdctl & BRDDAT6) ? 0 : 1;
*eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0; *eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0;
} }
...@@ -1943,7 +1983,7 @@ read_brdctl(ahc) ...@@ -1943,7 +1983,7 @@ read_brdctl(ahc)
return (value); return (value);
} }
void static void
ahc_pci_intr(struct ahc_softc *ahc) ahc_pci_intr(struct ahc_softc *ahc)
{ {
u_int error; u_int error;
...@@ -1995,6 +2035,73 @@ ahc_pci_intr(struct ahc_softc *ahc) ...@@ -1995,6 +2035,73 @@ ahc_pci_intr(struct ahc_softc *ahc)
ahc_unpause(ahc); ahc_unpause(ahc);
} }
static int
ahc_pci_chip_init(struct ahc_softc *ahc)
{
ahc_outb(ahc, DSCOMMAND0, ahc->bus_softc.pci_softc.dscommand0);
ahc_outb(ahc, DSPCISTATUS, ahc->bus_softc.pci_softc.dspcistatus);
if ((ahc->features & AHC_DT) != 0) {
u_int sfunct;
sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode);
ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt);
ahc_outb(ahc, SFUNCT, sfunct);
ahc_outb(ahc, CRCCONTROL1,
ahc->bus_softc.pci_softc.crccontrol1);
}
if ((ahc->features & AHC_MULTI_FUNC) != 0)
ahc_outb(ahc, SCBBADDR, ahc->bus_softc.pci_softc.scbbaddr);
if ((ahc->features & AHC_ULTRA2) != 0)
ahc_outb(ahc, DFF_THRSH, ahc->bus_softc.pci_softc.dff_thrsh);
return (ahc_chip_init(ahc));
}
static int
ahc_pci_suspend(struct ahc_softc *ahc)
{
return (ahc_suspend(ahc));
}
static int
ahc_pci_resume(struct ahc_softc *ahc)
{
ahc_power_state_change(ahc, AHC_POWER_STATE_D0);
/*
* We assume that the OS has restored our register
* mappings, etc. Just update the config space registers
* that the OS doesn't know about and rely on our chip
* reset handler to handle the rest.
*/
ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4,
ahc->bus_softc.pci_softc.devconfig);
ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1,
ahc->bus_softc.pci_softc.command);
ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1,
ahc->bus_softc.pci_softc.csize_lattime);
if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) {
struct seeprom_descriptor sd;
u_int sxfrctl1;
sd.sd_ahc = ahc;
sd.sd_control_offset = SEECTL;
sd.sd_status_offset = SEECTL;
sd.sd_dataout_offset = SEECTL;
ahc_acquire_seeprom(ahc, &sd);
configure_termination(ahc, &sd,
ahc->seep_config->adapter_control,
&sxfrctl1);
ahc_release_seeprom(&sd);
}
return (ahc_resume(ahc));
}
static int static int
ahc_aic785X_setup(struct ahc_softc *ahc) ahc_aic785X_setup(struct ahc_softc *ahc)
{ {
...@@ -2009,6 +2116,7 @@ ahc_aic785X_setup(struct ahc_softc *ahc) ...@@ -2009,6 +2116,7 @@ ahc_aic785X_setup(struct ahc_softc *ahc)
rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1); rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1);
if (rev >= 1) if (rev >= 1)
ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
ahc->instruction_ram_size = 512;
return (0); return (0);
} }
...@@ -2026,6 +2134,7 @@ ahc_aic7860_setup(struct ahc_softc *ahc) ...@@ -2026,6 +2134,7 @@ ahc_aic7860_setup(struct ahc_softc *ahc)
rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1); rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1);
if (rev >= 1) if (rev >= 1)
ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
ahc->instruction_ram_size = 512;
return (0); return (0);
} }
...@@ -2049,6 +2158,7 @@ ahc_aic7870_setup(struct ahc_softc *ahc) ...@@ -2049,6 +2158,7 @@ ahc_aic7870_setup(struct ahc_softc *ahc)
ahc->chip = AHC_AIC7870; ahc->chip = AHC_AIC7870;
ahc->features = AHC_AIC7870_FE; ahc->features = AHC_AIC7870_FE;
ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
ahc->instruction_ram_size = 512;
return (0); return (0);
} }
...@@ -2102,6 +2212,7 @@ ahc_aic7880_setup(struct ahc_softc *ahc) ...@@ -2102,6 +2212,7 @@ ahc_aic7880_setup(struct ahc_softc *ahc)
} else { } else {
ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
} }
ahc->instruction_ram_size = 512;
return (0); return (0);
} }
...@@ -2149,6 +2260,7 @@ ahc_aic7890_setup(struct ahc_softc *ahc) ...@@ -2149,6 +2260,7 @@ ahc_aic7890_setup(struct ahc_softc *ahc)
rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1); rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1);
if (rev == 0) if (rev == 0)
ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG; ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG;
ahc->instruction_ram_size = 768;
return (0); return (0);
} }
...@@ -2161,6 +2273,7 @@ ahc_aic7892_setup(struct ahc_softc *ahc) ...@@ -2161,6 +2273,7 @@ ahc_aic7892_setup(struct ahc_softc *ahc)
ahc->features = AHC_AIC7892_FE; ahc->features = AHC_AIC7892_FE;
ahc->flags |= AHC_NEWEEPROM_FMT; ahc->flags |= AHC_NEWEEPROM_FMT;
ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG; ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
ahc->instruction_ram_size = 1024;
return (0); return (0);
} }
...@@ -2216,6 +2329,7 @@ ahc_aic7895_setup(struct ahc_softc *ahc) ...@@ -2216,6 +2329,7 @@ ahc_aic7895_setup(struct ahc_softc *ahc)
ahc_pci_write_config(pci, DEVCONFIG, devconfig, /*bytes*/1); ahc_pci_write_config(pci, DEVCONFIG, devconfig, /*bytes*/1);
#endif #endif
ahc->flags |= AHC_NEWEEPROM_FMT; ahc->flags |= AHC_NEWEEPROM_FMT;
ahc->instruction_ram_size = 512;
return (0); return (0);
} }
...@@ -2230,6 +2344,7 @@ ahc_aic7896_setup(struct ahc_softc *ahc) ...@@ -2230,6 +2344,7 @@ ahc_aic7896_setup(struct ahc_softc *ahc)
ahc->features = AHC_AIC7896_FE; ahc->features = AHC_AIC7896_FE;
ahc->flags |= AHC_NEWEEPROM_FMT; ahc->flags |= AHC_NEWEEPROM_FMT;
ahc->bugs |= AHC_CACHETHEN_DIS_BUG; ahc->bugs |= AHC_CACHETHEN_DIS_BUG;
ahc->instruction_ram_size = 768;
return (0); return (0);
} }
...@@ -2244,6 +2359,7 @@ ahc_aic7899_setup(struct ahc_softc *ahc) ...@@ -2244,6 +2359,7 @@ ahc_aic7899_setup(struct ahc_softc *ahc)
ahc->features = AHC_AIC7899_FE; ahc->features = AHC_AIC7899_FE;
ahc->flags |= AHC_NEWEEPROM_FMT; ahc->flags |= AHC_NEWEEPROM_FMT;
ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG; ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
ahc->instruction_ram_size = 1024;
return (0); return (0);
} }
......
...@@ -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/aic7xxx_proc.c#23 $ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_proc.c#24 $
*/ */
#include "aic7xxx_osm.h" #include "aic7xxx_osm.h"
#include "aic7xxx_inline.h" #include "aic7xxx_inline.h"
...@@ -325,6 +325,7 @@ ahc_linux_proc_info(char *buffer, char **start, off_t offset, ...@@ -325,6 +325,7 @@ ahc_linux_proc_info(char *buffer, char **start, off_t offset,
copy_info(&info, "Adaptec AIC7xxx driver version: %s\n", copy_info(&info, "Adaptec AIC7xxx driver version: %s\n",
AIC7XXX_DRIVER_VERSION); AIC7XXX_DRIVER_VERSION);
copy_info(&info, "%s\n", ahc->description);
ahc_controller_info(ahc, ahc_info); ahc_controller_info(ahc, ahc_info);
copy_info(&info, "%s\n\n", ahc_info); copy_info(&info, "%s\n\n", ahc_info);
......
...@@ -10,9 +10,10 @@ GENHDRS= aicdb.h $(YSRCS:.y=.h) ...@@ -10,9 +10,10 @@ GENHDRS= aicdb.h $(YSRCS:.y=.h)
GENSRCS= $(YSRCS:.y=.c) $(LSRCS:.l=.c) GENSRCS= $(YSRCS:.y=.c) $(LSRCS:.l=.c)
SRCS= ${CSRCS} ${GENSRCS} SRCS= ${CSRCS} ${GENSRCS}
CLEANFILES= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) LIBS= -ldb
clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG)
# Override default kernel CFLAGS. This is a userland app. # Override default kernel CFLAGS. This is a userland app.
AICASM_CFLAGS:= -I/usr/include -I. -ldb AICASM_CFLAGS:= -I/usr/include -I.
YFLAGS= -d YFLAGS= -d
NOMAN= noman NOMAN= noman
...@@ -30,7 +31,7 @@ LFLAGS= -d ...@@ -30,7 +31,7 @@ LFLAGS= -d
endif endif
$(PROG): ${GENHDRS} $(SRCS) $(PROG): ${GENHDRS} $(SRCS)
$(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS)
aicdb.h: aicdb.h:
@if [ -e "/usr/include/db3/db_185.h" ]; then \ @if [ -e "/usr/include/db3/db_185.h" ]; then \
...@@ -46,7 +47,7 @@ aicdb.h: ...@@ -46,7 +47,7 @@ aicdb.h:
fi fi
clean: clean:
rm -f $(CLEANFILES) $(PROG) rm -f $(clean-files)
aicasm_gram.c aicasm_gram.h: aicasm_gram.y aicasm_gram.c aicasm_gram.h: aicasm_gram.y
$(YACC) $(YFLAGS) -b $(<:.y=) $< $(YACC) $(YFLAGS) -b $(<:.y=) $<
......
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