Skip to content

Commit

Permalink
[SCSI] aic7xxx: upport all sequencer and core fixes from adaptec vers…
Browse files Browse the repository at this point in the history
…ion 6.3.9

This patch upports all relevant code fixes and bumps the driver version
to 7.0 to signify starting a new tree.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
James Bottomley authored and James Bottomley committed Aug 4, 2005
1 parent 52b5cfb commit 79778a2
Show file tree
Hide file tree
Showing 11 changed files with 549 additions and 513 deletions.
6 changes: 5 additions & 1 deletion Documentation/scsi/aic7xxx.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
====================================================================
= Adaptec Aic7xxx Fast -> Ultra160 Family Manager Set v6.2.28 =
= Adaptec Aic7xxx Fast -> Ultra160 Family Manager Set v7.0 =
= README for =
= The Linux Operating System =
====================================================================
Expand Down Expand Up @@ -131,6 +131,10 @@ The following information is available in this file:
SCSI "stub" effects.

2. Version History
7.0 (4th August, 2005)
- Updated driver to use SCSI transport class infrastructure
- Upported sequencer and core fixes from last adaptec released
version of the driver.
6.2.36 (June 3rd, 2003)
- Correct code that disables PCI parity error checking.
- Correct and simplify handling of the ignore wide residue
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aic7xxx/aic7xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#79 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#85 $
*
* $FreeBSD$
*/
Expand Down Expand Up @@ -243,7 +243,7 @@ typedef enum {
*/
AHC_AIC7850_FE = AHC_SPIOCAP|AHC_AUTOPAUSE|AHC_TARGETMODE|AHC_ULTRA,
AHC_AIC7860_FE = AHC_AIC7850_FE,
AHC_AIC7870_FE = AHC_TARGETMODE,
AHC_AIC7870_FE = AHC_TARGETMODE|AHC_AUTOPAUSE,
AHC_AIC7880_FE = AHC_AIC7870_FE|AHC_ULTRA,
/*
* Although we have space for both the initiator and
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aic7xxx/aic7xxx.reg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* $FreeBSD$
*/
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#39 $"
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $"

/*
* This file is processed by the aic7xxx_asm utility for use in assembling
Expand Down Expand Up @@ -1306,7 +1306,6 @@ scratch_ram {
*/
MWI_RESIDUAL {
size 1
alias TARG_IMMEDIATE_SCB
}
/*
* SCBID of the next SCB to be started by the controller.
Expand Down Expand Up @@ -1461,6 +1460,7 @@ scratch_ram {
*/
LAST_MSG {
size 1
alias TARG_IMMEDIATE_SCB
}

/*
Expand Down
5 changes: 3 additions & 2 deletions drivers/scsi/aic7xxx/aic7xxx.seq
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* $FreeBSD$
*/

VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#56 $"
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#58 $"
PATCH_ARG_LIST = "struct ahc_softc *ahc"
PREFIX = "ahc_"

Expand Down Expand Up @@ -679,6 +679,7 @@ await_busfree:
clr SCSIBUSL; /* Prevent bit leakage durint SELTO */
}
and SXFRCTL0, ~SPIOEN;
mvi SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT;
test SSTAT1,REQINIT|BUSFREE jz .;
test SSTAT1, BUSFREE jnz poll_for_work;
mvi MISSED_BUSFREE call set_seqint;
Expand Down Expand Up @@ -1097,7 +1098,7 @@ ultra2_dmahalt:
test SCB_RESIDUAL_DATACNT[3], SG_LAST_SEG jz dma_mid_sg;
if ((ahc->flags & AHC_TARGETROLE) != 0) {
test SSTAT0, TARGET jz dma_last_sg;
if ((ahc->flags & AHC_TMODE_WIDEODD_BUG) != 0) {
if ((ahc->bugs & AHC_TMODE_WIDEODD_BUG) != 0) {
test DMAPARAMS, DIRECTION jz dma_mid_sg;
}
}
Expand Down
36 changes: 27 additions & 9 deletions drivers/scsi/aic7xxx/aic7xxx_93cx6.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx_93cx6.c#17 $
*
* $FreeBSD$
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx_93cx6.c#19 $
*/

/*
Expand Down Expand Up @@ -64,7 +62,6 @@
* is preceded by an initial zero (leading 0, followed by 16-bits, MSB
* first). The clock cycling from low to high initiates the next data
* bit to be sent from the chip.
*
*/

#ifdef __linux__
Expand All @@ -81,14 +78,22 @@
* Right now, we only have to read the SEEPROM. But we make it easier to
* add other 93Cx6 functions.
*/
static struct seeprom_cmd {
struct seeprom_cmd {
uint8_t len;
uint8_t bits[9];
} seeprom_read = {3, {1, 1, 0}};
uint8_t bits[11];
};

/* Short opcodes for the c46 */
static struct seeprom_cmd seeprom_ewen = {9, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
static struct seeprom_cmd seeprom_ewds = {9, {1, 0, 0, 0, 0, 0, 0, 0, 0}};

/* Long opcodes for the C56/C66 */
static struct seeprom_cmd seeprom_long_ewen = {11, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
static struct seeprom_cmd seeprom_long_ewds = {11, {1, 0, 0, 0, 0, 0, 0, 0, 0}};

/* Common opcodes */
static struct seeprom_cmd seeprom_write = {3, {1, 0, 1}};
static struct seeprom_cmd seeprom_read = {3, {1, 1, 0}};

/*
* Wait for the SEERDY to go high; about 800 ns.
Expand Down Expand Up @@ -222,12 +227,25 @@ int
ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
u_int start_addr, u_int count)
{
struct seeprom_cmd *ewen, *ewds;
uint16_t v;
uint8_t temp;
int i, k;

/* Place the chip into write-enable mode */
send_seeprom_cmd(sd, &seeprom_ewen);
if (sd->sd_chip == C46) {
ewen = &seeprom_ewen;
ewds = &seeprom_ewds;
} else if (sd->sd_chip == C56_66) {
ewen = &seeprom_long_ewen;
ewds = &seeprom_long_ewds;
} else {
printf("ahc_write_seeprom: unsupported seeprom type %d\n",
sd->sd_chip);
return (0);
}

send_seeprom_cmd(sd, ewen);
reset_seeprom(sd);

/* Write all requested data out to the seeprom. */
Expand Down Expand Up @@ -277,7 +295,7 @@ ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
}

/* Put the chip back into write-protect mode */
send_seeprom_cmd(sd, &seeprom_ewds);
send_seeprom_cmd(sd, ewds);
reset_seeprom(sd);

return (1);
Expand Down
60 changes: 35 additions & 25 deletions drivers/scsi/aic7xxx/aic7xxx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#134 $
*
* $FreeBSD$
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#155 $
*/

#ifdef __linux__
Expand Down Expand Up @@ -287,10 +285,19 @@ ahc_restart(struct ahc_softc *ahc)
ahc_outb(ahc, SEQ_FLAGS2,
ahc_inb(ahc, SEQ_FLAGS2) & ~SCB_DMA);
}

/*
* Clear any pending sequencer interrupt. It is no
* longer relevant since we're resetting the Program
* Counter.
*/
ahc_outb(ahc, CLRINT, CLRSEQINT);

ahc_outb(ahc, MWI_RESIDUAL, 0);
ahc_outb(ahc, SEQCTL, ahc->seqctl);
ahc_outb(ahc, SEQADDR0, 0);
ahc_outb(ahc, SEQADDR1, 0);

ahc_unpause(ahc);
}

Expand Down Expand Up @@ -1174,19 +1181,20 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat)
scb_index);
}
#endif
/*
* Force a renegotiation with this target just in
* case the cable was pulled and will later be
* re-attached. The target may forget its negotiation
* settings with us should it attempt to reselect
* during the interruption. The target will not issue
* a unit attention in this case, so we must always
* renegotiate.
*/
ahc_scb_devinfo(ahc, &devinfo, scb);
ahc_force_renegotiation(ahc, &devinfo);
ahc_set_transaction_status(scb, CAM_SEL_TIMEOUT);
ahc_freeze_devq(ahc, scb);

/*
* Cancel any pending transactions on the device
* now that it seems to be missing. This will
* also revert us to async/narrow transfers until
* we can renegotiate with the device.
*/
ahc_handle_devreset(ahc, &devinfo,
CAM_SEL_TIMEOUT,
"Selection Timeout",
/*verbose_level*/1);
}
ahc_outb(ahc, CLRINT, CLRSCSIINT);
ahc_restart(ahc);
Expand Down Expand Up @@ -3763,8 +3771,9 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
/*period*/0, /*offset*/0, /*ppr_options*/0,
AHC_TRANS_CUR, /*paused*/TRUE);

ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_SENT_BDR, NULL);
if (status != CAM_SEL_TIMEOUT)
ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_SENT_BDR, NULL);

if (message != NULL
&& (verbose_level <= bootverbose))
Expand Down Expand Up @@ -4003,14 +4012,6 @@ ahc_reset(struct ahc_softc *ahc, int reinit)
* to disturb the integrity of the bus.
*/
ahc_pause(ahc);
if ((ahc_inb(ahc, HCNTRL) & CHIPRST) != 0) {
/*
* The chip has not been initialized since
* PCI/EISA/VLB bus reset. Don't trust
* "left over BIOS data".
*/
ahc->flags |= AHC_NO_BIOS_INIT;
}
sxfrctl1_b = 0;
if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7770) {
u_int sblkctl;
Expand Down Expand Up @@ -5036,14 +5037,23 @@ ahc_pause_and_flushwork(struct ahc_softc *ahc)
ahc->flags |= AHC_ALL_INTERRUPTS;
paused = FALSE;
do {
if (paused)
if (paused) {
ahc_unpause(ahc);
/*
* Give the sequencer some time to service
* any active selections.
*/
ahc_delay(500);
}
ahc_intr(ahc);
ahc_pause(ahc);
paused = TRUE;
ahc_outb(ahc, SCSISEQ, ahc_inb(ahc, SCSISEQ) & ~ENSELO);
ahc_clear_critical_section(ahc);
intstat = ahc_inb(ahc, INTSTAT);
if ((intstat & INT_PEND) == 0) {
ahc_clear_critical_section(ahc);
intstat = ahc_inb(ahc, INTSTAT);
}
} while (--maxloops
&& (intstat != 0xFF || (ahc->features & AHC_REMOVABLE) == 0)
&& ((intstat & INT_PEND) != 0
Expand Down
2 changes: 2 additions & 0 deletions drivers/scsi/aic7xxx/aic7xxx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)

targ->sdev[sdev->lun] = sdev;

spi_period(starget) = 0;

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/aic7xxx/aic7xxx_osm.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
/***************************** SMP support ************************************/
#include <linux/spinlock.h>

#define AIC7XXX_DRIVER_VERSION "6.2.36"
#define AIC7XXX_DRIVER_VERSION "7.0"

/*************************** Device Data Structures ***************************/
/*
Expand Down
6 changes: 3 additions & 3 deletions drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* DO NOT EDIT - This file is automatically generated
* from the following source files:
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#56 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#39 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#58 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $
*/
typedef int (ahc_reg_print_t)(u_int, u_int *, u_int);
typedef struct ahc_reg_parse_entry {
Expand Down Expand Up @@ -1298,7 +1298,6 @@ ahc_reg_print_t ahc_sg_cache_pre_print;
#define CMDSIZE_TABLE_TAIL 0x34

#define MWI_RESIDUAL 0x38
#define TARG_IMMEDIATE_SCB 0x38

#define NEXT_QUEUED_SCB 0x39

Expand Down Expand Up @@ -1380,6 +1379,7 @@ ahc_reg_print_t ahc_sg_cache_pre_print;
#define RETURN_2 0x52

#define LAST_MSG 0x53
#define TARG_IMMEDIATE_SCB 0x53

#define SCSISEQ_TEMPLATE 0x54
#define ENSELO 0x40
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* DO NOT EDIT - This file is automatically generated
* from the following source files:
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#56 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#39 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#58 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#40 $
*/

#include "aic7xxx_osm.h"
Expand Down
Loading

0 comments on commit 79778a2

Please sign in to comment.