Commit e69dc6dc authored by Justin T. Gibbs's avatar Justin T. Gibbs

aic7xxx and aic79xx driver updates:

	o Correct memory mapped I/O test for legacy controllers
	  that do not have the "auto-access-pause" feature.
	o Prevent NMIs from triggering should the MMAP I/O test fail.
	o Fix aic7770 (EISA/VLB) controller regression.
	o Kill a few compiler warnings.
parent e8cc7930
......@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#100 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#102 $
*
*/
#ifndef _AIC79XX_LINUX_H_
......@@ -288,7 +288,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h>
#endif
#define AIC79XX_DRIVER_VERSION "1.3.0.ALPHA6"
#define AIC79XX_DRIVER_VERSION "1.3.0.BETA2"
/**************************** Front End Queues ********************************/
/*
......
......@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#19 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#20 $
*/
#include "aic79xx_osm.h"
......@@ -170,6 +170,9 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahd->platform_data->hw_dma_mask =
(bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
}
} else {
ahd_pci_set_dma_mask(pdev, 0xFFFFFFFF);
ahd->platform_data->hw_dma_mask = 0xFFFFFFFF;
}
#endif
ahd->dev_softc = pci;
......
......@@ -38,7 +38,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#60 $
* $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#61 $
*
* $FreeBSD$
*/
......@@ -379,15 +379,20 @@ int
ahd_pci_test_register_access(struct ahd_softc *ahd)
{
ahd_mode_state saved_modes;
uint32_t cmd;
int error;
uint8_t seqctl;
uint8_t hcntrl;
saved_modes = ahd_save_modes(ahd);
error = EIO;
/* Enable PCI error interrupt status */
seqctl = ahd_inb(ahd, SEQCTL0);
ahd_outb(ahd, SEQCTL0, seqctl & ~FAILDIS);
/*
* Enable PCI error interrupt status, but suppress NMIs
* generated by SERR raised due to target aborts.
*/
cmd = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2);
ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND,
cmd & ~PCIM_CMD_SERRESPEN, /*bytes*/2);
/*
* First a simple test to see if any
......@@ -397,7 +402,8 @@ ahd_pci_test_register_access(struct ahd_softc *ahd)
* be zero so it is a good register to
* use for this test.
*/
if (ahd_inb(ahd, HCNTRL) == 0xFF)
hcntrl = ahd_inb(ahd, HCNTRL);
if (hcntrl == 0xFF)
goto fail;
/*
......@@ -407,6 +413,10 @@ ahd_pci_test_register_access(struct ahd_softc *ahd)
* either, so look for data corruption and/or flaged
* PCI errors.
*/
ahd_outb(ahd, HCNTRL, hcntrl|PAUSE);
while (ahd_is_paused(ahd) == 0)
;
ahd_outb(ahd, SEQCTL0, PERRORDIS);
ahd_outl(ahd, SRAM_BASE, 0x5aa555aa);
if (ahd_inl(ahd, SRAM_BASE) != 0x5aa555aa)
goto fail;
......@@ -440,7 +450,8 @@ ahd_pci_test_register_access(struct ahd_softc *ahd)
}
ahd_restore_modes(ahd, saved_modes);
ahd_outb(ahd, SEQCTL0, seqctl);
ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS);
ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
return (error);
}
......
......@@ -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#66 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#67 $
*
* $FreeBSD$
*/
......@@ -1053,7 +1053,6 @@ struct ahc_softc {
u_int pci_cachesize;
u_int stack_size;
uint16_t *saved_stack;
/* Per-Unit descriptive information */
const char *description;
......
......@@ -39,7 +39,7 @@
*
* $FreeBSD$
*/
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#36 $"
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $"
/*
* This file is processed by the aic7xxx_asm utility for use in assembling
......@@ -673,6 +673,8 @@ register STACK {
access_mode RO
}
const STACK_SIZE 4
/*
* Board Control (p. 3-43)
*/
......
......@@ -40,7 +40,7 @@
* $FreeBSD$
*/
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#52 $"
VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#53 $"
PATCH_ARG_LIST = "struct ahc_softc *ahc"
PREFIX = "ahc_"
......@@ -70,7 +70,7 @@ bus_free_sel:
* Turn off the selection hardware. We need to reset the
* selection request in order to perform a new selection.
*/
and SCSISEQ, TEMODE|ENSELI|ENRSELI|ENAUTOATNP, SCSISEQ;
and SCSISEQ, TEMODE|ENSELI|ENRSELI|ENAUTOATNP;
and SIMODE1, ~ENBUSFREE;
poll_for_work:
call clear_target_state;
......
......@@ -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.c#107 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#108 $
*
* $FreeBSD$
*/
......@@ -230,7 +230,6 @@ static int ahc_check_patch(struct ahc_softc *ahc,
u_int start_instr, u_int *skip_addr);
static void ahc_download_instr(struct ahc_softc *ahc,
u_int instrptr, uint8_t *dconsts);
static int ahc_probe_stack_size(struct ahc_softc *ahc);
#ifdef AHC_TARGET_MODE
static void ahc_queue_lstate_event(struct ahc_softc *ahc,
struct ahc_tmode_lstate *lstate,
......@@ -1166,6 +1165,13 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat)
ahc_name(ahc), scbptr, scb_index);
ahc_dump_card_state(ahc);
} else {
#ifdef AHC_DEBUG
if ((ahc_debug & AHC_SHOW_SELTO) != 0) {
ahc_print_path(ahc, scb);
printf("Saw Selection Timeout for SCB 0x%x\n",
scb_index);
}
#endif
/*
* Force a renegotiation with this target just in
* case the cable was pulled and will later be
......@@ -1178,13 +1184,6 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat)
ahc_force_renegotiation(ahc);
ahc_set_transaction_status(scb, CAM_SEL_TIMEOUT);
ahc_freeze_devq(ahc, scb);
#ifdef AHC_DEBUG
if ((ahc_debug & AHC_SHOW_SELTO) != 0) {
ahc_print_path(ahc, scb);
printf("Saw Selection Timeout for SCB 0x%x\n",
scb_index);
}
#endif
}
ahc_outb(ahc, CLRINT, CLRSCSIINT);
ahc_restart(ahc);
......@@ -4005,8 +4004,6 @@ ahc_free(struct ahc_softc *ahc)
free(ahc->name, M_DEVBUF);
if (ahc->seep_config != NULL)
free(ahc->seep_config, M_DEVBUF);
if (ahc->saved_stack != NULL)
free(ahc->saved_stack, M_DEVBUF);
#ifndef __FreeBSD__
free(ahc, M_DEVBUF);
#endif
......@@ -4542,12 +4539,6 @@ ahc_init(struct ahc_softc *ahc)
size_t driver_data_size;
uint32_t physaddr;
ahc->stack_size = ahc_probe_stack_size(ahc);
ahc->saved_stack = malloc(ahc->stack_size * sizeof(uint16_t),
M_DEVBUF, M_NOWAIT);
if (ahc->saved_stack == NULL)
return (ENOMEM);
#ifdef AHC_DEBUG_SEQUENCER
ahc->flags |= AHC_SEQUENCER_DEBUG;
#endif
......@@ -6657,41 +6648,6 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
}
}
static int
ahc_probe_stack_size(struct ahc_softc *ahc)
{
int last_probe;
last_probe = 0;
while (1) {
int i;
/*
* We avoid using 0 as a pattern to avoid
* confusion if the stack implementation
* "back-fills" with zeros when "poping'
* entries.
*/
for (i = 1; i <= last_probe+1; i++) {
ahc_outb(ahc, STACK, i & 0xFF);
ahc_outb(ahc, STACK, (i >> 8) & 0xFF);
}
/* Verify */
for (i = last_probe+1; i > 0; i--) {
u_int stack_entry;
stack_entry = ahc_inb(ahc, STACK)
|(ahc_inb(ahc, STACK) << 8);
if (stack_entry != i)
goto sized;
}
last_probe++;
}
sized:
return (last_probe);
}
int
ahc_print_register(ahc_reg_parse_entry_t *table, u_int num_entries,
const char *name, u_int address, u_int value,
......@@ -6770,6 +6726,7 @@ ahc_dump_card_state(struct ahc_softc *ahc)
cur_col = 0;
if ((ahc->features & AHC_DT) != 0)
ahc_scsisigi_print(ahc_inb(ahc, SCSISIGI), &cur_col, 50);
ahc_error_print(ahc_inb(ahc, ERROR), &cur_col, 50);
ahc_scsiphase_print(ahc_inb(ahc, SCSIPHASE), &cur_col, 50);
ahc_scsibusl_print(ahc_inb(ahc, SCSIBUSL), &cur_col, 50);
ahc_lastphase_print(ahc_inb(ahc, LASTPHASE), &cur_col, 50);
......@@ -6789,11 +6746,8 @@ ahc_dump_card_state(struct ahc_softc *ahc)
if (cur_col != 0)
printf("\n");
printf("STACK:");
for (i = 0; i < ahc->stack_size; i++) {
ahc->saved_stack[i] =
ahc_inb(ahc, STACK)|(ahc_inb(ahc, STACK) << 8);
printf(" 0x%x", ahc->saved_stack[i]);
}
for (i = 0; i < STACK_SIZE; i++)
printf(" 0x%x", ahc_inb(ahc, STACK)|(ahc_inb(ahc, STACK) << 8));
printf("\nSCB count = %d\n", ahc->scb_data->numscbs);
printf("Kernel NEXTQSCB = %d\n", ahc->next_queued_scb->hscb->tag);
printf("Card NEXTQSCB = %d\n", ahc_inb(ahc, NEXT_QUEUED_SCB));
......
/*
* Adaptec AIC7xxx device driver for Linux.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#167 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#169 $
*
* Copyright (c) 1994 John Aycock
* The University of Calgary Department of Computer Science.
......@@ -576,6 +576,7 @@ static void ahc_linux_run_device_queue(struct ahc_softc*,
static void ahc_linux_setup_tag_info(char *p, char *end, char *s);
static void ahc_linux_setup_tag_info_global(char *p);
static void ahc_linux_setup_dv(char *p, char *end, char *s);
static int aic7xxx_setup(char *s);
static int ahc_linux_next_unit(void);
static void ahc_runq_tasklet(unsigned long data);
static int ahc_linux_halt(struct notifier_block *nb, u_long event, void *buf);
......@@ -1766,7 +1767,7 @@ ahc_linux_setup_dv(char *p, char *end, char *s)
* to a parameter with a ':' between the parameter and the value.
* ie. aic7xxx=stpwlev:1,extended
*/
int
static int
aic7xxx_setup(char *s)
{
int i, n;
......@@ -1890,7 +1891,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template)
* negotiation will occur for the first command, and DV
* will comence should that first command be successful.
*/
for (target = 0; target < host->max_id; target++) {
for (target = 0; target < host->max_id*host->max_channel+1; target++) {
u_int channel;
channel = 0;
......
......@@ -53,7 +53,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#115 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#118 $
*
*/
#ifndef _AIC7XXX_LINUX_H_
......@@ -301,7 +301,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
#include <linux/smp.h>
#endif
#define AIC7XXX_DRIVER_VERSION "6.2.25"
#define AIC7XXX_DRIVER_VERSION "6.2.26"
/**************************** Front End Queues ********************************/
/*
......@@ -864,6 +864,7 @@ ahc_list_unlock(unsigned long *flags)
#define PCIM_CMD_BUSMASTEREN 0x0004
#define PCIM_CMD_MWRICEN 0x0010
#define PCIM_CMD_PERRESPEN 0x0040
#define PCIM_CMD_SERRESPEN 0x0100
#define PCIR_STATUS 0x06
#define PCIR_REVID 0x08
#define PCIR_PROGIF 0x09
......
......@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#42 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#43 $
*/
#include "aic7xxx_osm.h"
......@@ -167,8 +167,8 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahc->platform_data->hw_dma_mask =
(bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
} else {
ahc_pci_set_dma_mask(pdev, 0xffffffffULL);
ahc->platform_data->hw_dma_mask = 0xffffffffULL;
ahc_pci_set_dma_mask(pdev, 0xFFFFFFFF);
ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
}
#endif
ahc->dev_softc = pci;
......
......@@ -39,7 +39,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_pci.c#54 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#55 $
*
* $FreeBSD$
*/
......@@ -1204,13 +1204,18 @@ ahc_pci_test_register_access(struct ahc_softc *ahc)
{
int error;
u_int status1;
uint8_t seqctl;
uint32_t cmd;
uint8_t hcntrl;
error = EIO;
/* Enable PCI error interrupt status */
seqctl = ahc_inb(ahc, SEQCTL);
ahc_outb(ahc, SEQCTL, seqctl & ~FAILDIS);
/*
* Enable PCI error interrupt status, but suppress NMIs
* generated by SERR raised due to target aborts.
*/
cmd = ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2);
ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
cmd & ~PCIM_CMD_SERRESPEN, /*bytes*/2);
/*
* First a simple test to see if any
......@@ -1220,7 +1225,8 @@ ahc_pci_test_register_access(struct ahc_softc *ahc)
* be zero so it is a good register to
* use for this test.
*/
if (ahc_inb(ahc, HCNTRL) == 0xFF)
hcntrl = ahc_inb(ahc, HCNTRL);
if (hcntrl == 0xFF)
goto fail;
/*
......@@ -1230,8 +1236,13 @@ ahc_pci_test_register_access(struct ahc_softc *ahc)
* either, so look for data corruption and/or flagged
* PCI errors.
*/
ahc_outl(ahc, SRAM_BASE, 0x5aa555aa);
if (ahc_inl(ahc, SRAM_BASE) != 0x5aa555aa)
ahc_outb(ahc, HCNTRL, hcntrl|PAUSE);
while (ahc_is_paused(ahc) == 0)
;
ahc_outb(ahc, SEQCTL, PERRORDIS);
ahc_outb(ahc, SCBPTR, 0);
ahc_outl(ahc, SCB_BASE, 0x5aa555aa);
if (ahc_inl(ahc, SCB_BASE) != 0x5aa555aa)
goto fail;
status1 = ahc_pci_read_config(ahc->dev_softc,
......@@ -1248,7 +1259,8 @@ ahc_pci_test_register_access(struct ahc_softc *ahc)
ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
status1, /*bytes*/1);
ahc_outb(ahc, CLRINT, CLRPARERR);
ahc_outb(ahc, SEQCTL, seqctl);
ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
return (error);
}
......
......@@ -2,8 +2,8 @@
* DO NOT EDIT - This file is automatically generated
* from the following source files:
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#52 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#36 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#53 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $
*/
typedef int (ahc_reg_print_t)(u_int, u_int *, u_int);
typedef struct ahc_reg_parse_entry {
......@@ -1779,6 +1779,7 @@ ahc_reg_print_t ahc_sg_cache_pre_print;
#define MAX_OFFSET 0xff
#define BUS_16_BIT 0x01
#define SCB_UPLOAD_SIZE 0x20
#define STACK_SIZE 0x04
/* Downloaded Constant Definitions */
......
......@@ -2,8 +2,8 @@
* DO NOT EDIT - This file is automatically generated
* from the following source files:
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#52 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#36 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#53 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $
*/
#include "aic7xxx_osm.h"
......
......@@ -2,8 +2,8 @@
* DO NOT EDIT - This file is automatically generated
* from the following source files:
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#52 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#36 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#53 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $
*/
static uint8_t seqprog[] = {
0xb2, 0x00, 0x00, 0x08,
......
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