summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-12-01 17:57:09 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-12-01 17:57:09 +0000
commita62a0f262e0179df8c632f529c95abf54ef78332 (patch)
tree80e6a7a7d407d08e218332bb3fcccdaf9f28fcc1 /drivers
parentfd095d09f2d475dc2e8599b1b8bae1cd65e91685 (diff)
Part #2 merging back my changes ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/block/floppy.c43
-rw-r--r--drivers/char/apm_bios.c2
-rw-r--r--drivers/char/cyclades.c47
-rw-r--r--drivers/char/ftape/ecc.c10
-rw-r--r--drivers/char/pc_keyb.c36
-rw-r--r--drivers/char/psaux.c12
-rw-r--r--drivers/char/tpqic02.c6
-rw-r--r--drivers/isdn/avmb1/capi.c5
-rw-r--r--drivers/isdn/avmb1/capiutil.c5
-rw-r--r--drivers/isdn/hisax/l3_1tr6.c7
-rw-r--r--drivers/isdn/hisax/l3dss1.c7
-rw-r--r--drivers/isdn/isdn_common.c11
-rw-r--r--drivers/isdn/isdn_ppp.c7
-rw-r--r--drivers/isdn/sc/Makefile2
-rw-r--r--drivers/net/Config.in1
-rw-r--r--drivers/net/pcnet32.c12
-rw-r--r--drivers/net/plip.c2
-rw-r--r--drivers/net/ppp.c2
-rw-r--r--drivers/net/scc.c2
-rw-r--r--drivers/pnp/parport_probe.c2
-rw-r--r--drivers/scsi/FlashPoint.c82
-rw-r--r--drivers/scsi/aic7xxx.c6
-rw-r--r--drivers/scsi/aic7xxx.h4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.reg1135
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.seq1156
-rw-r--r--drivers/scsi/aic7xxx/scsi_message.h41
-rw-r--r--drivers/scsi/aic7xxx/sequencer.h102
-rw-r--r--drivers/scsi/aic7xxx_proc.c2
-rw-r--r--drivers/scsi/eata_dma.c6
-rw-r--r--drivers/scsi/g_NCR5380.c5
-rw-r--r--drivers/scsi/hosts.c2
-rw-r--r--drivers/scsi/scsi.c2
-rw-r--r--drivers/scsi/sgiwd93.c2
-rw-r--r--drivers/scsi/wd33c93.c1
-rw-r--r--drivers/sgi/Makefile2
36 files changed, 2614 insertions, 157 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index f95448f18..69a78f46e 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -9,7 +9,7 @@
SUB_DIRS := block char net misc #streams
MOD_SUB_DIRS := $(SUB_DIRS) sbus
-ALL_SUB_DIRS := $(SUB_DIRS) pci sgi scsi sound cdrom isdn pnp macintosh
+ALL_SUB_DIRS := $(SUB_DIRS) pci sgi scsi sound cdrom isdn misc pnp macintosh
ifdef CONFIG_PCI
SUB_DIRS += pci
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 7af5aeee1..7a4d082f0 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -114,8 +114,8 @@ static int print_unex=1;
* motor of these drives causes system hangs on some PCI computers. drive
* 0 is the low bit (0x1), and drive 7 is the high bit (0x80). Bits are on if
* a drive is allowed. */
-int FLOPPY_IRQ=6;
-int FLOPPY_DMA=2;
+static int FLOPPY_IRQ=6;
+static int FLOPPY_DMA=2;
static int allowed_drive_mask = 0x33;
@@ -1025,15 +1025,16 @@ static void setup_DMA(void)
}
#endif
INT_OFF;
- fd_disable_dma();
- fd_clear_dma_ff();
+ fd_disable_dma(FLOPPY_DMA);
+ fd_clear_dma_ff(FLOPPY_DMA);
fd_cacheflush(raw_cmd->kernel_data, raw_cmd->length);
- fd_set_dma_mode((raw_cmd->flags & FD_RAW_READ)?
- DMA_MODE_READ : DMA_MODE_WRITE);
- fd_set_dma_addr(raw_cmd->kernel_data);
- fd_set_dma_count(raw_cmd->length);
+ fd_set_dma_mode(FLOPPY_DMA, (raw_cmd->flags & FD_RAW_READ)
+ ? DMA_MODE_READ
+ : DMA_MODE_WRITE);
+ fd_set_dma_addr(FLOPPY_DMA, raw_cmd->kernel_data);
+ fd_set_dma_count(FLOPPY_DMA, raw_cmd->length);
virtual_dma_port = FDCS->address;
- fd_enable_dma();
+ fd_enable_dma(FLOPPY_DMA);
INT_ON;
floppy_disable_hlt();
}
@@ -1636,7 +1637,7 @@ void floppy_interrupt(int irq, void *dev_id, struct pt_regs * regs)
lasthandler = handler;
interruptjiffies = jiffies;
- fd_disable_dma();
+ fd_disable_dma(FLOPPY_DMA);
floppy_enable_hlt();
CLEAR_INTR;
if (fdc >= N_FDC || FDCS->address == -1){
@@ -1722,7 +1723,7 @@ static void reset_fdc(void)
/* Pseudo-DMA may intercept 'reset finished' interrupt. */
/* Irrelevant for systems with true DMA (i386). */
- fd_disable_dma();
+ fd_disable_dma(FLOPPY_DMA);
if (FDCS->version >= FDC_82072A)
fd_outb(0x80 | (FDCS->dtr &3), FD_STATUS);
@@ -1787,7 +1788,7 @@ static void floppy_shutdown(void)
sti();
floppy_enable_hlt();
- fd_disable_dma();
+ fd_disable_dma(FLOPPY_DMA);
/* avoid dma going to a random drive after shutdown */
if (!initialising)
@@ -2896,7 +2897,7 @@ static void raw_cmd_done(int flag)
raw_cmd->reply[i] = reply_buffer[i];
if (raw_cmd->flags & (FD_RAW_READ | FD_RAW_WRITE))
- raw_cmd->length = fd_get_dma_residue();
+ raw_cmd->length = fd_get_dma_residue(FLOPPY_DMA);
if ((raw_cmd->flags & FD_RAW_SOFTFAILURE) &&
(!raw_cmd->reply_count || (raw_cmd->reply[0] & 0xc0)))
@@ -4055,17 +4056,17 @@ static int floppy_grab_irq_and_dma(void)
fdc = 0;
set_dor(0, ~0, 8); /* avoid immediate interrupt */
- if (fd_request_irq()) {
+ if (fd_request_irq(FLOPPY_IRQ)) {
DPRINT("Unable to grab IRQ%d for the floppy driver\n",
FLOPPY_IRQ);
MOD_DEC_USE_COUNT;
usage_count--;
return -1;
}
- if (fd_request_dma()) {
+ if (fd_request_dma(FLOPPY_DMA)) {
DPRINT("Unable to grab DMA%d for the floppy driver\n",
FLOPPY_DMA);
- fd_free_irq();
+ fd_free_irq(FLOPPY_IRQ);
MOD_DEC_USE_COUNT;
usage_count--;
return -1;
@@ -4074,7 +4075,7 @@ static int floppy_grab_irq_and_dma(void)
if (FDCS->address != -1)
fd_outb(FDCS->dor, FD_DOR);
fdc = 0;
- fd_enable_irq();
+ fd_enable_irq(FLOPPY_IRQ);
return 0;
}
@@ -4095,10 +4096,10 @@ static void floppy_release_irq_and_dma(void)
return;
}
INT_ON;
- fd_disable_dma();
- fd_free_dma();
- fd_disable_irq();
- fd_free_irq();
+ fd_disable_dma(FLOPPY_DMA);
+ fd_free_dma(FLOPPY_DMA);
+ fd_disable_irq(FLOPPY_IRQ);
+ fd_free_irq(FLOPPY_IRQ);
set_dor(0, ~0, 8);
#if N_FDC > 1
diff --git a/drivers/char/apm_bios.c b/drivers/char/apm_bios.c
index 565600738..0a722b5e6 100644
--- a/drivers/char/apm_bios.c
+++ b/drivers/char/apm_bios.c
@@ -13,7 +13,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * $Id: apm_bios.c,v 1.2 1997/09/12 01:31:41 ralf Exp $
+ * $Id: apm_bios.c,v 0.22 1995/03/09 14:12:02 sfr Exp $
*
* October 1995, Rik Faith (faith@cs.unc.edu):
* Minor enhancements and updates (to the patch set) for 1.3.x
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 94969bf28..fa4134dda 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1,6 +1,6 @@
#define BLOCKMOVE
static char rcsid[] =
-"$Revision: 1.1.1.1 $$Date: 1997/06/01 03:17:29 $";
+"$Revision: 1.36.4.33 $$Date: 1997/06/27 19:00:00 $";
/*
* linux/drivers/char/cyclades.c
@@ -29,8 +29,49 @@ static char rcsid[] =
* void cleanup_module(void);
*
* $Log: cyclades.c,v $
- * Revision 1.1.1.1 1997/06/01 03:17:29 ralf
- * Initial import of Linux/MIPS pre-2.1.40.
+ * Revision 1.36.4.33 1997/06/27 19:00:00 ivan
+ * Fixes related to kernel version conditional
+ * compilation.
+ *
+ * Revision 1.36.4.32 1997/06/14 19:30:00 ivan
+ * Compatibility issues between kernels 2.0.x and
+ * 2.1.x (mainly related to clear_bit function).
+ *
+ * Revision 1.36.4.31 1997/06/03 15:30:00 ivan
+ * Changes to define the memory window according to the
+ * board type.
+ *
+ * Revision 1.36.4.30 1997/05/16 15:30:00 daniel
+ * Changes to suport new cycladesZ boards.
+ *
+ * Revision 1.36.4.29 1997/05/12 11:30:00 daniel
+ * Merge of Bentson's and Daniel's version 1.36.4.28.
+ * Corrects bug in cy_detect_pci: check if there are more
+ * ports than the number of static structs allocated.
+ * Warning message during initialization if this driver is
+ * used with the new generation of cycladesZ boards. Those
+ * will be supported only in next release of the driver.
+ * Corrects bug in cy_detect_pci and cy_detect_isa that
+ * returned wrong number of VALID boards, when a cyclomY
+ * was found with no serial modules connected.
+ * Changes to use current (2.1.x) kernel subroutine names
+ * and created macros for compilation with 2.0.x kernel,
+ * instead of the other way around.
+ *
+ * Revision 1.36.4.28 1997/05/?? ??:00:00 bentson
+ * Change queue_task_irq_off to queue_task_irq.
+ * The inline function queue_task_irq_off (tqueue.h)
+ * was removed from latest releases of 2.1.x kernel.
+ * Use of macro __initfunc to mark the initialization
+ * routines, so memory can be reused.
+ * Also incorporate implementation of critical region
+ * in function cleanup_module() created by anonymous
+ * linuxer.
+ *
+ * Revision 1.36.4.28 1997/04/25 16:00:00 daniel
+ * Change to support new firmware that solves DCD problem:
+ * application could fail to receive SIGHUP signal when DCD
+ * varying too fast.
*
* Revision 1.36.4.27 1997/03/26 10:30:00 daniel
* Changed for suport linux versions 2.1.X.
diff --git a/drivers/char/ftape/ecc.c b/drivers/char/ftape/ecc.c
index 040ea0c85..19708ee68 100644
--- a/drivers/char/ftape/ecc.c
+++ b/drivers/char/ftape/ecc.c
@@ -21,12 +21,12 @@
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
* USA.
*
- * $Source: /src/cvs/linux/drivers/char/ftape/ecc.c,v $
- * $Author: ralf $
+ * $Source: /home/bas/distr/ftape-2.03b/RCS/ecc.c,v $
+ * $Author: bas $
*
- * $Revision: 1.1.1.1 $
- * $Date: 1997/06/01 03:17:30 $
- * $State: Exp $
+ * $Revision: 1.32 $
+ * $Date: 1995/04/22 07:30:15 $
+ * $State: Beta $
*
* This file contains the Reed-Solomon error correction code
* for the QIC-40/80 floppy-tape driver for Linux.
diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c
index 866a4170f..849487b19 100644
--- a/drivers/char/pc_keyb.c
+++ b/drivers/char/pc_keyb.c
@@ -27,6 +27,18 @@
#include "pc_keyb.h"
+/*
+ * In case we run on a non-x86 hardware we need to initialize both the keyboard
+ * controller and the keyboard. On a x86, the BIOS will already have initialized
+ * them.
+ */
+
+#ifndef __i386__
+#define INIT_KBD
+#endif
+
+#ifdef INIT_KBD
+
/* Simple translation table for the SysRq keys */
#ifdef CONFIG_MAGIC_SYSRQ
@@ -40,25 +52,13 @@ unsigned char pckbd_sysrq_xlate[128] =
"\r\000/"; /* 0x60 - 0x6f */
#endif
-/*
- * In case we run on a non-x86 hardware we need to initialize both the keyboard
- * controller and the keyboard. On a x86, the BIOS will already have initialized
- * them.
- */
-
-#ifndef __i386__
-#define INIT_KBD
-#endif
-
-#ifdef INIT_KBD
-
__initfunc(static int kbd_wait_for_input(void))
{
- int n;
- int status, data;
+ int n;
+ int status, data;
unsigned long start = jiffies;
- do {
+ do {
status = kbd_read_status();
/*
* Wait for input data to become available. This bit will
@@ -526,10 +526,8 @@ static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned char scancode;
/* mouse data? */
- if (status & kbd_read_mask & KBD_STAT_MOUSE_OBF){
- printk ("MOUSE!\n");
+ if (status & kbd_read_mask & KBD_STAT_MOUSE_OBF)
break;
- }
scancode = kbd_read_input();
if ((status & KBD_STAT_OBF) && do_acknowledge(scancode))
@@ -585,7 +583,7 @@ void pckbd_leds(unsigned char leds)
__initfunc(void pckbd_init_hw(void))
{
- request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, "keyboard-aaa", NULL);
+ request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, "keyboard", NULL);
keyboard_setup();
#ifdef INIT_KBD
initialize_kbd();
diff --git a/drivers/char/psaux.c b/drivers/char/psaux.c
index 972f38ad3..d297670a8 100644
--- a/drivers/char/psaux.c
+++ b/drivers/char/psaux.c
@@ -306,8 +306,6 @@ static int open_aux(struct inode * inode, struct file * file)
return -EBUSY;
}
MOD_INC_USE_COUNT;
-
-
poll_aux_status();
kbd_write_command(KBD_CCMD_MOUSE_ENABLE); /* Enable Aux */
aux_write_dev(AUX_ENABLE_DEV); /* Enable aux device */
@@ -627,7 +625,11 @@ __initfunc(int psaux_init(void))
psaux_fops.release = release_qp;
} else
#endif
+#if defined(CONFIG_SGI) && defined(CONFIG_PSMOUSE)
+ if (1) {
+#else
if (aux_device_present == 0xaa) {
+#endif
printk(KERN_INFO "PS/2 auxiliary pointing device detected -- driver installed.\n");
aux_present = 1;
#ifdef CONFIG_VT
@@ -654,10 +656,10 @@ __initfunc(int psaux_init(void))
#endif /* INITIALIZE_DEVICE */
kbd_write_command(KBD_CCMD_MOUSE_DISABLE); /* Disable Aux device */
poll_aux_status();
- kbd_write_command(KBD_CCMD_WRITE_MODE); /* Disable controller interrupts */
+ kbd_write_command(KBD_CCMD_WRITE_MODE); /* Disable controller interrupts */
poll_aux_status();
- kbd_write_output (AUX_INTS_OFF);
- kbd_pause ();
+ kbd_write_output(AUX_INTS_OFF);
+ kbd_pause();
poll_aux_status();
aux_end_atomic();
}
diff --git a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
index 3a8d02b22..e3032bb85 100644
--- a/drivers/char/tpqic02.c
+++ b/drivers/char/tpqic02.c
@@ -1,4 +1,4 @@
-/* $Id: tpqic02.c,v 1.1.1.1 1997/06/01 03:17:28 ralf Exp $
+/* $Id: tpqic02.c,v 1.10 1997/01/26 07:13:20 davem Exp $
*
* Driver for tape drive support for Linux-i386
*
@@ -134,8 +134,8 @@ static volatile struct mtget ioctl_status; /* current generic status */
static volatile struct tpstatus tperror; /* last drive status */
-static char rcs_revision[] = "$Revision: 1.1.1.1 $";
-static char rcs_date[] = "$Date: 1997/06/01 03:17:28 $";
+static char rcs_revision[] = "$Revision: 1.10 $";
+static char rcs_date[] = "$Date: 1997/01/26 07:13:20 $";
/* Flag bits for status and outstanding requests.
* (Could all be put in one bit-field-struct.)
diff --git a/drivers/isdn/avmb1/capi.c b/drivers/isdn/avmb1/capi.c
index 19202f515..b21a9f868 100644
--- a/drivers/isdn/avmb1/capi.c
+++ b/drivers/isdn/avmb1/capi.c
@@ -1,14 +1,11 @@
/*
- * $Id: capi.c,v 1.1 1997/06/08 14:58:39 ralf Exp $
+ * $Id: capi.c,v 1.4 1997/05/27 15:17:50 fritz Exp $
*
* CAPI 2.0 Interface for Linux
*
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log: capi.c,v $
- * Revision 1.1 1997/06/08 14:58:39 ralf
- * These files were missing in the 2.1.42 merge.
- *
* Revision 1.4 1997/05/27 15:17:50 fritz
* Added changes for recent 2.1.x kernels:
* changed return type of isdn_close
diff --git a/drivers/isdn/avmb1/capiutil.c b/drivers/isdn/avmb1/capiutil.c
index 51d57fe9c..9eb60afed 100644
--- a/drivers/isdn/avmb1/capiutil.c
+++ b/drivers/isdn/avmb1/capiutil.c
@@ -1,5 +1,5 @@
/*
- * $Id: capiutil.c,v 1.1 1997/06/08 14:58:41 ralf Exp $
+ * $Id: capiutil.c,v 1.3 1997/05/18 09:24:18 calle Exp $
*
* CAPI 2.0 convert capi message to capi message struct
*
@@ -7,9 +7,6 @@
* Rewritten for Linux 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log: capiutil.c,v $
- * Revision 1.1 1997/06/08 14:58:41 ralf
- * These files were missing in the 2.1.42 merge.
- *
* Revision 1.3 1997/05/18 09:24:18 calle
* added verbose disconnect reason reporting to avmb1.
* some fixes in capi20 interface.
diff --git a/drivers/isdn/hisax/l3_1tr6.c b/drivers/isdn/hisax/l3_1tr6.c
index b3479fbd2..0af1b4534 100644
--- a/drivers/isdn/hisax/l3_1tr6.c
+++ b/drivers/isdn/hisax/l3_1tr6.c
@@ -1,4 +1,4 @@
-/* $Id: l3_1tr6.c,v 1.2 1997/06/03 09:24:33 ralf Exp $
+/* $Id: l3_1tr6.c,v 1.11 1997/04/06 22:54:18 keil Exp $
* German 1TR6 D-channel protocol
*
@@ -6,9 +6,6 @@
*
*
* $Log: l3_1tr6.c,v $
- * Revision 1.2 1997/06/03 09:24:33 ralf
- * Sync with Linux 2.1.42.
- *
* Revision 1.11 1997/04/06 22:54:18 keil
* Using SKB's
*
@@ -52,7 +49,7 @@
#include <linux/ctype.h>
extern char *HiSax_getrev(const char *revision);
-const char *l3_1tr6_revision = "$Revision: 1.2 $";
+const char *l3_1tr6_revision = "$Revision: 1.11 $";
#define MsgHead(ptr, cref, mty, dis) \
*ptr++ = dis; \
diff --git a/drivers/isdn/hisax/l3dss1.c b/drivers/isdn/hisax/l3dss1.c
index ea1f7490e..d79bd468e 100644
--- a/drivers/isdn/hisax/l3dss1.c
+++ b/drivers/isdn/hisax/l3dss1.c
@@ -1,4 +1,4 @@
-/* $Id: l3dss1.c,v 1.2 1997/06/03 09:24:34 ralf Exp $
+/* $Id: l3dss1.c,v 1.15 1997/04/17 11:50:48 keil Exp $
* EURO/DSS1 D-channel protocol
*
@@ -9,9 +9,6 @@
* Fritz Elfert
*
* $Log: l3dss1.c,v $
- * Revision 1.2 1997/06/03 09:24:34 ralf
- * Sync with Linux 2.1.42.
- *
* Revision 1.15 1997/04/17 11:50:48 keil
* pa->loc was undefined, if it was not send by the exchange
*
@@ -67,7 +64,7 @@
#include <linux/ctype.h>
extern char *HiSax_getrev(const char *revision);
-const char *dss1_revision = "$Revision: 1.2 $";
+const char *dss1_revision = "$Revision: 1.15 $";
#define MsgHead(ptr, cref, mty) \
*ptr++ = 0x8; \
diff --git a/drivers/isdn/isdn_common.c b/drivers/isdn/isdn_common.c
index f096101d5..89271da9c 100644
--- a/drivers/isdn/isdn_common.c
+++ b/drivers/isdn/isdn_common.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_common.c,v 1.3 1997/09/12 01:31:49 ralf Exp $
+/* $Id: isdn_common.c,v 1.44 1997/05/27 15:17:23 fritz Exp $
* Linux ISDN subsystem, common used functions (linklevel).
*
@@ -21,13 +21,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdn_common.c,v $
- * Revision 1.3 1997/09/12 01:31:49 ralf
- * Merge with Linux 2.1.55. More bugfixes and goodies from my private
- * CVS archive.
- *
- * Revision 1.2 1997/06/03 09:24:18 ralf
- * Sync with Linux 2.1.42.
- *
* Revision 1.44 1997/05/27 15:17:23 fritz
* Added changes for recent 2.1.x kernels:
* changed return type of isdn_close
@@ -225,7 +218,7 @@
isdn_dev *dev = (isdn_dev *) 0;
-static char *isdn_revision = "$Revision: 1.3 $";
+static char *isdn_revision = "$Revision: 1.44 $";
extern char *isdn_net_revision;
extern char *isdn_tty_revision;
diff --git a/drivers/isdn/isdn_ppp.c b/drivers/isdn/isdn_ppp.c
index f527a8e8e..f9eadc034 100644
--- a/drivers/isdn/isdn_ppp.c
+++ b/drivers/isdn/isdn_ppp.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_ppp.c,v 1.2 1997/06/03 09:24:20 ralf Exp $
+/* $Id: isdn_ppp.c,v 1.27 1997/03/30 16:51:17 calle Exp $
*
* Linux ISDN subsystem, functions for synchronous PPP (linklevel).
*
@@ -19,9 +19,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdn_ppp.c,v $
- * Revision 1.2 1997/06/03 09:24:20 ralf
- * Sync with Linux 2.1.42.
- *
* Revision 1.27 1997/03/30 16:51:17 calle
* changed calls to copy_from_user/copy_to_user and removed verify_area
* were possible.
@@ -163,7 +160,7 @@ static int isdn_ppp_fill_mpqueue(isdn_net_dev *, struct sk_buff **skb,
static void isdn_ppp_free_mpqueue(isdn_net_dev *);
#endif
-char *isdn_ppp_revision = "$Revision: 1.2 $";
+char *isdn_ppp_revision = "$Revision: 1.27 $";
static struct ippp_struct *ippp_table[ISDN_MAX_CHANNELS];
static struct isdn_ppp_compressor *ipc_head = NULL;
diff --git a/drivers/isdn/sc/Makefile b/drivers/isdn/sc/Makefile
index 5af3d2e6c..ff87210b8 100644
--- a/drivers/isdn/sc/Makefile
+++ b/drivers/isdn/sc/Makefile
@@ -1,5 +1,5 @@
#
-# $Id: Makefile,v 1.3 1997/05/27 23:25:01 fritz Exp $
+# $Id: Makefile,v 1.1 1997/03/22 02:01:22 fritz Exp $
# Copyright (C) 1996 SpellCaster Telecommunications Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/drivers/net/Config.in b/drivers/net/Config.in
index b90affadc..f0e760d5a 100644
--- a/drivers/net/Config.in
+++ b/drivers/net/Config.in
@@ -97,6 +97,7 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
tristate 'CS89x0 support' CONFIG_CS89x0
tristate 'Generic DECchip & DIGITAL EtherWORKS PCI/EISA' CONFIG_DE4X5
tristate 'DECchip Tulip (dc21x4x) PCI support' CONFIG_DEC_ELCP
+ tristate 'DECchip Tulip (dc21x4x) PCI support' CONFIG_DEC_ELCP
tristate 'Digi Intl. RightSwitch SE-X support' CONFIG_DGRS
tristate 'EtherExpressPro/100 support' CONFIG_EEXPRESS_PRO100
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index d10663ff5..b4c973e5f 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -321,13 +321,14 @@ __initfunc(static int pcnet32_probe1(struct device *dev, unsigned int ioaddr, un
/* Make certain the data structures used by the PCnet32 are 16byte aligned and DMAble. */
lp = (struct pcnet32_private *) (((unsigned long)kmalloc(sizeof(*lp)+15, GFP_DMA | GFP_KERNEL)+15) & ~15);
+ flush_cache_post_dma_in(lp, sizeof(*lp)+15);
#ifdef __mips__
/* XXX Maybe modify kmalloc() to return KSEG1 memory? This would
* make lots of modifications to drivers unnecessary but possibly
* have negative impact on the performance due to drivers not being
- * aware of the CPU performance impact of GFP_DMA memory ...
+ * aware of the CPU performance impact of GFP_DMA memory. It also
+ * adds a bit of extra overhead to kmalloc().
*/
- flush_cache_range(current->mm, lp, sizeof(*lp)+15);
lp = KSEG1ADDR(lp);
#endif
@@ -641,10 +642,8 @@ pcnet32_start_xmit(struct sk_buff *skb, struct device *dev)
lp->tx_ring[entry].base = (u32)le32_to_cpu(virt_to_bus(skb->data));
lp->tx_ring[entry].status = le16_to_cpu(0x8300);
-#ifdef __mips__
- flush_cache_range(current->mm, (void *)skb->data,
- (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len);
-#endif
+ flush_cache_pre_dma_out((void *)skb->data,
+ (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len);
lp->cur_tx++;
@@ -856,6 +855,7 @@ pcnet32_rx(struct device *dev)
pkt_len,0);
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
+ flush_cache_post_dma_in(bus_to_virt(le32_to_cpu(lp->rx_ring[entry].base)), pkt_len);
lp->stats.rx_packets++;
}
}
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 72b8a3314..223210e91 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -1,4 +1,4 @@
-/* $Id: plip.c,v 1.2 1997/08/06 19:15:51 miguel Exp $ */
+/* $Id: plip.c,v 1.3.6.2 1997/04/16 15:07:56 phil Exp $ */
/* PLIP: A parallel port "network" driver for Linux. */
/* This driver is for parallel port with 5-bit cable (LapLink (R) cable). */
/*
diff --git a/drivers/net/ppp.c b/drivers/net/ppp.c
index 4d2cb31f1..740bfc1ff 100644
--- a/drivers/net/ppp.c
+++ b/drivers/net/ppp.c
@@ -51,7 +51,7 @@
#define PPP_MAX_DEV 256
#endif
-/* $Id: ppp.c,v 1.1.1.1 1997/06/01 03:17:18 ralf Exp $
+/* $Id: ppp.c,v 1.27 1997/01/26 07:13:29 davem Exp $
* Added dynamic allocation of channels to eliminate
* compiled-in limits on the number of channels.
*
diff --git a/drivers/net/scc.c b/drivers/net/scc.c
index 7f1b70b90..3c5e81848 100644
--- a/drivers/net/scc.c
+++ b/drivers/net/scc.c
@@ -1,4 +1,4 @@
-#define RCS_ID "$Id: scc.c,v 1.1.1.1 1997/06/01 03:17:20 ralf Exp $"
+#define RCS_ID "$Id: scc.c,v 1.69 1997/04/06 19:22:45 jreuter Exp jreuter $"
#define VERSION "3.0"
#define BANNER "Z8530 SCC driver version "VERSION".dl1bke (experimental) by DL1BKE\n"
diff --git a/drivers/pnp/parport_probe.c b/drivers/pnp/parport_probe.c
index fc2f82702..70aebe874 100644
--- a/drivers/pnp/parport_probe.c
+++ b/drivers/pnp/parport_probe.c
@@ -1,4 +1,4 @@
-/* $Id: parport_probe.c,v 1.4 1997/09/12 01:32:20 ralf Exp $
+/* $Id: parport_probe.c,v 1.1.2.9 1997/03/29 21:08:16 phil Exp $
* Parallel port device probing code
*
* Authors: Carsten Gross, carsten@sol.wohnheim.uni-ulm.de
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index 3b9696920..c4655ec25 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -187,9 +187,9 @@
*
* Description: Common shared global defines.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1996/09/04 01:26:13 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.11 $
*
*----------------------------------------------------------------------*/
#ifndef __GLOBALS_H__
@@ -426,9 +426,9 @@ extern void OS_OutPortLong(unsigned long ioport, unsigned long val);
* Description: Common shared SCCB Interface defines and SCCB
* Manager specifics defines.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1996/10/24 23:09:33 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.14 $
*
*----------------------------------------------------------------------*/
@@ -744,9 +744,9 @@ typedef struct _SCCB {
* Description: This module contains SCCB/UCB Manager implementation
* specific stuff.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1996/11/13 18:34:22 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.10 $
*
*----------------------------------------------------------------------*/
@@ -901,9 +901,9 @@ typedef struct _SCCB {
*
* Description: Definitions for Target related structures
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1996/12/11 22:06:20 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.9 $
*
*----------------------------------------------------------------------*/
@@ -1100,9 +1100,9 @@ typedef struct SCCBscam_info {
*
* Description: Register definitions for HARPOON ASIC.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1996/11/13 18:32:57 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.4 $
*
*----------------------------------------------------------------------*/
@@ -1232,9 +1232,9 @@ typedef struct SCCBscam_info {
*
* Description: Definitions for EEPROM related structures
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1996/11/13 18:28:39 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.4 $
*
*----------------------------------------------------------------------*/
@@ -1317,9 +1317,9 @@ typedef struct SCCBscam_info {
*
* Description: Register definitions for HARPOON ASIC.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:14:28 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.6 $
*
*----------------------------------------------------------------------*/
@@ -2339,7 +2339,7 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data);
extern unsigned int SccbGlobalFlags;
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: sccb.c 1.17 1997/02/11 21:06:41 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -2353,9 +2353,9 @@ extern unsigned int SccbGlobalFlags;
* Description: Functions relating to handling of the SCCB interface
* between the device driver and the HARPOON.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/02/11 21:06:41 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.17 $
*
*----------------------------------------------------------------------*/
@@ -5347,7 +5347,7 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data)
}
#endif
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: sccb_dat.c 1.9 1997/01/31 02:12:58 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -5361,9 +5361,9 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data)
* Description: Functions relating to handling of the SCCB interface
* between the device driver and the HARPOON.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:12:58 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.9 $
*
*----------------------------------------------------------------------*/
@@ -5418,7 +5418,7 @@ UCHAR debug_int[MAX_CARDS][debug_size];
UCHAR debug_index[MAX_CARDS];
UCHAR reserved_1[3];
#endif
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: scsi.c 1.19 1997/01/31 02:08:14 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -5433,9 +5433,9 @@ UCHAR reserved_1[3];
* selection/reselection, sync negotiation, message-in
* decoding.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:08:14 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.19 $
*
*----------------------------------------------------------------------*/
@@ -7389,7 +7389,7 @@ void sinits(PSCCB p_sccb, UCHAR p_card)
}
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: phase.c 1.11 1997/01/31 02:08:49 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -7404,9 +7404,9 @@ void sinits(PSCCB p_sccb, UCHAR p_card)
* the target asserts request (and the automation is not
* enabled to handle the situation).
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:08:49 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.11 $
*
*----------------------------------------------------------------------*/
@@ -8138,7 +8138,7 @@ void phaseBusFree(ULONG port, UCHAR p_card)
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: automate.c 1.14 1997/01/31 02:11:46 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -8152,9 +8152,9 @@ void phaseBusFree(ULONG port, UCHAR p_card)
* Description: Functions relating to programming the automation of
* the HARPOON.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:11:46 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.14 $
*
*----------------------------------------------------------------------*/
@@ -8530,7 +8530,7 @@ void autoCmdCmplt(ULONG p_port, UCHAR p_card)
queueCmdComplete(&BL_Card[p_card], currSCCB, p_card);
}
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: busmstr.c 1.8 1997/01/31 02:10:27 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -8543,9 +8543,9 @@ void autoCmdCmplt(ULONG p_port, UCHAR p_card)
*
* Description: Functions to start, stop, and abort BusMaster operations.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:10:27 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.8 $
*
*----------------------------------------------------------------------*/
@@ -9222,7 +9222,7 @@ void hostDataXferRestart(PSCCB currSCCB)
currSCCB->Sccb_XferCnt = currSCCB->DataLength - currSCCB->Sccb_ATC;
}
}
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: scam.c 1.16 1997/01/31 02:11:12 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -9237,9 +9237,9 @@ void hostDataXferRestart(PSCCB currSCCB)
* and the determination of the SCSI IDs to be assigned
* to all perspective SCSI targets.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:11:12 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.16 $
*
*----------------------------------------------------------------------*/
@@ -10362,7 +10362,7 @@ void scsavdi(UCHAR p_card, ULONG p_port)
utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM/2);
utilEEWriteOnOff(p_port,0); /* Turn off write access */
}
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: diagnose.c 1.9 1997/01/31 02:09:48 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -10376,9 +10376,9 @@ void scsavdi(UCHAR p_card, ULONG p_port)
* Description: Diagnostic funtions for testing the integrity of
* the HARPOON.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:09:48 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.9 $
*
*----------------------------------------------------------------------*/
@@ -10807,7 +10807,7 @@ void DiagEEPROM(ULONG p_port)
}
-#ident "$Id: FlashPoint.c,v 1.1.1.1 1997/06/01 03:17:39 ralf Exp $"
+#ident "$Id: utility.c 1.22 1997/01/31 02:12:23 mohan Exp $"
/*----------------------------------------------------------------------
*
*
@@ -10821,9 +10821,9 @@ void DiagEEPROM(ULONG p_port)
* Description: Utility functions relating to queueing and EEPROM
* manipulation and any other garbage functions.
*
- * $Date: 1997/06/01 03:17:39 $
+ * $Date: 1997/01/31 02:12:23 $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.22 $
*
*----------------------------------------------------------------------*/
/*#include <globals.h>*/
diff --git a/drivers/scsi/aic7xxx.c b/drivers/scsi/aic7xxx.c
index 612af9baa..5551cbad8 100644
--- a/drivers/scsi/aic7xxx.c
+++ b/drivers/scsi/aic7xxx.c
@@ -73,7 +73,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aic7xxx.c,v 1.2 1997/08/06 19:16:00 miguel Exp $
+ * $Id: aic7xxx.c,v 1.119 1997/06/27 19:39:18 gibbs Exp $
*---------------------------------------------------------------------------
*
* Thanks also go to (in alphabetical order) the following:
@@ -93,7 +93,7 @@
*
* Daniel M. Eischen, deischen@iworks.InterWorks.org, 1/23/97
*
- * $Id: aic7xxx.c,v 1.2 1997/08/06 19:16:00 miguel Exp $
+ * $Id: aic7xxx.c,v 4.1 1997/06/12 08:23:42 deang Exp $
*-M*************************************************************************/
#ifdef MODULE
@@ -139,7 +139,7 @@ struct proc_dir_entry proc_scsi_aic7xxx = {
0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
-#define AIC7XXX_C_VERSION "$Revision: 1.2 $"
+#define AIC7XXX_C_VERSION "$Revision: 4.1 $"
#define NUMBER(arr) (sizeof(arr) / sizeof(arr[0]))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
diff --git a/drivers/scsi/aic7xxx.h b/drivers/scsi/aic7xxx.h
index 11836c405..5ba54acfa 100644
--- a/drivers/scsi/aic7xxx.h
+++ b/drivers/scsi/aic7xxx.h
@@ -18,12 +18,12 @@
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: aic7xxx.h,v 1.1.1.1 1997/06/01 03:17:41 ralf Exp $
+ * $Id: aic7xxx.h,v 3.2 1996/07/23 03:37:26 deang Exp $
*-M*************************************************************************/
#ifndef _aic7xxx_h
#define _aic7xxx_h
-#define AIC7XXX_H_VERSION "$Revision: 1.1.1.1 $"
+#define AIC7XXX_H_VERSION "$Revision: 3.2 $"
/*
* Scsi_Host_Template (see hosts.h) for AIC-7xxx - some fields
diff --git a/drivers/scsi/aic7xxx/aic7xxx.reg b/drivers/scsi/aic7xxx/aic7xxx.reg
new file mode 100644
index 000000000..d3486e078
--- /dev/null
+++ b/drivers/scsi/aic7xxx/aic7xxx.reg
@@ -0,0 +1,1135 @@
+/*
+ * Aic7xxx register and scratch ram definitions.
+ *
+ * Copyright (c) 1994-1997 Justin Gibbs.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Where this Software is combined with software released under the terms of
+ * the GNU Public License ("GPL") and the terms of the GPL would require the
+ * combined work to also be released under the terms of the GPL, the terms
+ * and conditions of this License will apply in addition to those of the
+ * GPL with the exception of any terms or conditions of this License that
+ * conflict with, or are expressly prohibited by, the GPL.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: aic7xxx.reg,v 1.2 1997/08/30 02:17:28 ralf Exp $
+ */
+
+/*
+ * This file is processed by the aic7xxx_asm utility for use in assembling
+ * firmware for the aic7xxx family of SCSI host adapters as well as to generate
+ * a C header file for use in the kernel portion of the Aic7xxx driver.
+ *
+ * All page numbers refer to the Adaptec AIC-7770 Data Book available from
+ * Adaptec's Technical Documents Department 1-800-934-2766
+ */
+
+/*
+ * SCSI Sequence Control (p. 3-11).
+ * Each bit, when set starts a specific SCSI sequence on the bus
+ */
+register SCSISEQ {
+ address 0x000
+ access_mode RW
+ bit TEMODE 0x80
+ bit ENSELO 0x40
+ bit ENSELI 0x20
+ bit ENRSELI 0x10
+ bit ENAUTOATNO 0x08
+ bit ENAUTOATNI 0x04
+ bit ENAUTOATNP 0x02
+ bit SCSIRSTO 0x01
+}
+
+/*
+ * SCSI Transfer Control 0 Register (pp. 3-13).
+ * Controls the SCSI module data path.
+ */
+register SXFRCTL0 {
+ address 0x001
+ access_mode RW
+ bit DFON 0x80
+ bit DFPEXP 0x40
+ bit FAST20 0x20
+ bit CLRSTCNT 0x10
+ bit SPIOEN 0x08
+ bit SCAMEN 0x04
+ bit CLRCHN 0x02
+}
+
+/*
+ * SCSI Transfer Control 1 Register (pp. 3-14,15).
+ * Controls the SCSI module data path.
+ */
+register SXFRCTL1 {
+ address 0x002
+ access_mode RW
+ bit BITBUCKET 0x80
+ bit SWRAPEN 0x40
+ bit ENSPCHK 0x20
+ mask STIMESEL 0x18
+ bit ENSTIMER 0x04
+ bit ACTNEGEN 0x02
+ bit STPWEN 0x01 /* Powered Termination */
+}
+
+/*
+ * SCSI Control Signal Read Register (p. 3-15).
+ * Reads the actual state of the SCSI bus pins
+ */
+register SCSISIGI {
+ address 0x003
+ access_mode RO
+ bit CDI 0x80
+ bit IOI 0x40
+ bit MSGI 0x20
+ bit ATNI 0x10
+ bit SELI 0x08
+ bit BSYI 0x04
+ bit REQI 0x02
+ bit ACKI 0x01
+/*
+ * Possible phases in SCSISIGI
+ */
+ mask PHASE_MASK CDI|IOI|MSGI
+ mask P_DATAOUT 0x00
+ mask P_DATAIN IOI
+ mask P_COMMAND CDI
+ mask P_MESGOUT CDI|MSGI
+ mask P_STATUS CDI|IOI
+ mask P_MESGIN CDI|IOI|MSGI
+}
+
+/*
+ * SCSI Control Signal Write Register (p. 3-16).
+ * Writing to this register modifies the control signals on the bus. Only
+ * those signals that are allowed in the current mode (Initiator/Target) are
+ * asserted.
+ */
+register SCSISIGO {
+ address 0x003
+ access_mode WO
+ bit CDO 0x80
+ bit IOO 0x40
+ bit MSGO 0x20
+ bit ATNO 0x10
+ bit SELO 0x08
+ bit BSYO 0x04
+ bit REQO 0x02
+ bit ACKO 0x01
+/*
+ * Possible phases to write into SCSISIG0
+ */
+ mask PHASE_MASK CDI|IOI|MSGI
+ mask P_DATAOUT 0x00
+ mask P_DATAIN IOI
+ mask P_COMMAND CDI
+ mask P_MESGOUT CDI|MSGI
+ mask P_STATUS CDI|IOI
+ mask P_MESGIN CDI|IOI|MSGI
+}
+
+/*
+ * SCSI Rate Control (p. 3-17).
+ * Contents of this register determine the Synchronous SCSI data transfer
+ * rate and the maximum synchronous Req/Ack offset. An offset of 0 in the
+ * SOFS (3:0) bits disables synchronous data transfers. Any offset value
+ * greater than 0 enables synchronous transfers.
+ */
+register SCSIRATE {
+ address 0x004
+ access_mode RW
+ bit WIDEXFER 0x80 /* Wide transfer control */
+ mask SXFR 0x70 /* Sync transfer rate */
+ mask SOFS 0x0f /* Sync offset */
+}
+
+/*
+ * SCSI ID (p. 3-18).
+ * Contains the ID of the board and the current target on the
+ * selected channel.
+ */
+register SCSIID {
+ address 0x005
+ access_mode RW
+ mask TID 0xf0 /* Target ID mask */
+ mask OID 0x0f /* Our ID mask */
+}
+
+/*
+ * SCSI Latched Data (p. 3-19).
+ * Read/Write latches used to transfer data on the SCSI bus during
+ * Automatic or Manual PIO mode. SCSIDATH can be used for the
+ * upper byte of a 16bit wide asynchronouse data phase transfer.
+ */
+register SCSIDATL {
+ address 0x006
+ access_mode RW
+}
+
+register SCSIDATH {
+ address 0x007
+ access_mode RW
+}
+
+/*
+ * SCSI Transfer Count (pp. 3-19,20)
+ * These registers count down the number of bytes transferred
+ * across the SCSI bus. The counter is decremented only once
+ * the data has been safely transferred. SDONE in SSTAT0 is
+ * set when STCNT goes to 0
+ */
+register STCNT {
+ address 0x008
+ size 3
+ access_mode RW
+}
+
+/*
+ * Clear SCSI Interrupt 0 (p. 3-20)
+ * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT0.
+ */
+register CLRSINT0 {
+ address 0x00b
+ access_mode WO
+ bit CLRSELDO 0x40
+ bit CLRSELDI 0x20
+ bit CLRSELINGO 0x10
+ bit CLRSWRAP 0x08
+ bit CLRSPIORDY 0x02
+}
+
+/*
+ * SCSI Status 0 (p. 3-21)
+ * Contains one set of SCSI Interrupt codes
+ * These are most likely of interest to the sequencer
+ */
+register SSTAT0 {
+ address 0x00b
+ access_mode RO
+ bit TARGET 0x80 /* Board acting as target */
+ bit SELDO 0x40 /* Selection Done */
+ bit SELDI 0x20 /* Board has been selected */
+ bit SELINGO 0x10 /* Selection In Progress */
+ bit SWRAP 0x08 /* 24bit counter wrap */
+ bit SDONE 0x04 /* STCNT = 0x000000 */
+ bit SPIORDY 0x02 /* SCSI PIO Ready */
+ bit DMADONE 0x01 /* DMA transfer completed */
+}
+
+/*
+ * Clear SCSI Interrupt 1 (p. 3-23)
+ * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1.
+ */
+register CLRSINT1 {
+ address 0x00c
+ access_mode WO
+ bit CLRSELTIMEO 0x80
+ bit CLRATNO 0x40
+ bit CLRSCSIRSTI 0x20
+ bit CLRBUSFREE 0x08
+ bit CLRSCSIPERR 0x04
+ bit CLRPHASECHG 0x02
+ bit CLRREQINIT 0x01
+}
+
+/*
+ * SCSI Status 1 (p. 3-24)
+ */
+register SSTAT1 {
+ address 0x00c
+ access_mode RO
+ bit SELTO 0x80
+ bit ATNTARG 0x40
+ bit SCSIRSTI 0x20
+ bit PHASEMIS 0x10
+ bit BUSFREE 0x08
+ bit SCSIPERR 0x04
+ bit PHASECHG 0x02
+ bit REQINIT 0x01
+}
+
+/*
+ * SCSI Status 2 (pp. 3-25,26)
+ */
+register SSTAT2 {
+ address 0x00d
+ access_mode RO
+ bit OVERRUN 0x80
+ mask SFCNT 0x1f
+}
+
+/*
+ * SCSI Status 3 (p. 3-26)
+ */
+register SSTAT3 {
+ address 0x00e
+ access_mode RO
+ mask SCSICNT 0xf0
+ mask OFFCNT 0x0f
+}
+
+/*
+ * SCSI Test Control (p. 3-27)
+ */
+register SCSITEST {
+ address 0x00f
+ access_mode RW
+ bit RQAKCNT 0x04
+ bit CNTRTEST 0x02
+ bit CMODE 0x01
+}
+
+/*
+ * SCSI Interrupt Mode 1 (p. 3-28)
+ * Setting any bit will enable the corresponding function
+ * in SIMODE0 to interrupt via the IRQ pin.
+ */
+register SIMODE0 {
+ address 0x010
+ access_mode RW
+ bit ENSELDO 0x40
+ bit ENSELDI 0x20
+ bit ENSELINGO 0x10
+ bit ENSWRAP 0x08
+ bit ENSDONE 0x04
+ bit ENSPIORDY 0x02
+ bit ENDMADONE 0x01
+}
+
+/*
+ * SCSI Interrupt Mode 1 (pp. 3-28,29)
+ * Setting any bit will enable the corresponding function
+ * in SIMODE1 to interrupt via the IRQ pin.
+ */
+register SIMODE1 {
+ address 0x011
+ access_mode RW
+ bit ENSELTIMO 0x80
+ bit ENATNTARG 0x40
+ bit ENSCSIRST 0x20
+ bit ENPHASEMIS 0x10
+ bit ENBUSFREE 0x08
+ bit ENSCSIPERR 0x04
+ bit ENPHASECHG 0x02
+ bit ENREQINIT 0x01
+}
+
+/*
+ * SCSI Data Bus (High) (p. 3-29)
+ * This register reads data on the SCSI Data bus directly.
+ */
+register SCSIBUSL {
+ address 0x012
+ access_mode RO
+}
+
+register SCSIBUSH {
+ address 0x013
+ access_mode RO
+}
+
+/*
+ * SCSI/Host Address (p. 3-30)
+ * These registers hold the host address for the byte about to be
+ * transferred on the SCSI bus. They are counted up in the same
+ * manner as STCNT is counted down. SHADDR should always be used
+ * to determine the address of the last byte transferred since HADDR
+ * can be skewed by write ahead.
+ */
+register SHADDR {
+ address 0x014
+ size 4
+ access_mode RO
+}
+
+/*
+ * Selection Timeout Timer (p. 3-30)
+ */
+register SELTIMER {
+ address 0x018
+ access_mode RW
+ bit STAGE6 0x20
+ bit STAGE5 0x10
+ bit STAGE4 0x08
+ bit STAGE3 0x04
+ bit STAGE2 0x02
+ bit STAGE1 0x01
+}
+
+/*
+ * Selection/Reselection ID (p. 3-31)
+ * Upper four bits are the device id. The ONEBIT is set when the re/selecting
+ * device did not set its own ID.
+ */
+register SELID {
+ address 0x019
+ access_mode RW
+ mask SELID_MASK 0xf0
+ bit ONEBIT 0x08
+}
+
+/*
+ * SCSI Block Control (p. 3-32)
+ * Controls Bus type and channel selection. In a twin channel configuration
+ * addresses 0x00-0x1e are gated to the appropriate channel based on this
+ * register. SELWIDE allows for the coexistence of 8bit and 16bit devices
+ * on a wide bus.
+ */
+register SBLKCTL {
+ address 0x01f
+ access_mode RW
+ bit DIAGLEDEN 0x80 /* Aic78X0 only */
+ bit DIAGLEDON 0x40 /* Aic78X0 only */
+ bit AUTOFLUSHDIS 0x20
+ bit SELBUSB 0x08
+ bit SELWIDE 0x02
+}
+
+/*
+ * Sequencer Control (p. 3-33)
+ * Error detection mode and speed configuration
+ */
+register SEQCTL {
+ address 0x060
+ access_mode RW
+ bit PERRORDIS 0x80
+ bit PAUSEDIS 0x40
+ bit FAILDIS 0x20
+ bit FASTMODE 0x10
+ bit BRKADRINTEN 0x08
+ bit STEP 0x04
+ bit SEQRESET 0x02
+ bit LOADRAM 0x01
+}
+
+/*
+ * Sequencer RAM Data (p. 3-34)
+ * Single byte window into the Scratch Ram area starting at the address
+ * specified by SEQADDR0 and SEQADDR1. To write a full word, simply write
+ * four bytes in sucessesion. The SEQADDRs will increment after the most
+ * significant byte is written
+ */
+register SEQRAM {
+ address 0x061
+ access_mode RW
+}
+
+/*
+ * Sequencer Address Registers (p. 3-35)
+ * Only the first bit of SEQADDR1 holds addressing information
+ */
+register SEQADDR0 {
+ address 0x062
+ access_mode RW
+}
+
+register SEQADDR1 {
+ address 0x063
+ access_mode RW
+ mask SEQADDR1_MASK 0x01
+}
+
+/*
+ * Accumulator
+ * We cheat by passing arguments in the Accumulator up to the kernel driver
+ */
+register ACCUM {
+ address 0x064
+ access_mode RW
+ accumulator
+}
+
+register SINDEX {
+ address 0x065
+ access_mode RW
+ sindex
+}
+
+register DINDEX {
+ address 0x066
+ access_mode RW
+}
+
+register ALLONES {
+ address 0x069
+ access_mode RO
+ allones
+}
+
+register ALLZEROS {
+ address 0x06a
+ access_mode RO
+ allzeros
+}
+
+register NONE {
+ address 0x06a
+ access_mode WO
+ none
+}
+
+register FLAGS {
+ address 0x06b
+ access_mode RO
+ bit ZERO 0x02
+ bit CARRY 0x01
+}
+
+register SINDIR {
+ address 0x06c
+ access_mode RO
+}
+
+register DINDIR {
+ address 0x06d
+ access_mode WO
+}
+
+register FUNCTION1 {
+ address 0x06e
+ access_mode RW
+}
+
+register STACK {
+ address 0x06f
+ access_mode RO
+}
+
+/*
+ * Board Control (p. 3-43)
+ */
+register BCTL {
+ address 0x084
+ access_mode RW
+ bit ACE 0x08
+ bit ENABLE 0x01
+}
+
+/*
+ * On the aic78X0 chips, Board Control is replaced by the DSCommand
+ * register (p. 4-64)
+ */
+register DSCOMMAND {
+ address 0x084
+ access_mode RW
+ bit CACHETHEN 0x80 /* Cache Threshold enable */
+ bit DPARCKEN 0x40 /* Data Parity Check Enable */
+ bit MPARCKEN 0x20 /* Memory Parity Check Enable */
+ bit EXTREQLCK 0x10 /* External Request Lock */
+}
+
+/*
+ * Bus On/Off Time (p. 3-44)
+ */
+register BUSTIME {
+ address 0x085
+ access_mode RW
+ mask BOFF 0xf0
+ mask BON 0x0f
+}
+
+/*
+ * Bus Speed (p. 3-45)
+ */
+register BUSSPD {
+ address 0x086
+ access_mode RW
+ mask DFTHRSH 0xc0
+ mask STBOFF 0x38
+ mask STBON 0x07
+ mask DFTHRSH_100 0xc0
+}
+
+/*
+ * Host Control (p. 3-47) R/W
+ * Overall host control of the device.
+ */
+register HCNTRL {
+ address 0x087
+ access_mode RW
+ bit POWRDN 0x40
+ bit SWINT 0x10
+ bit IRQMS 0x08
+ bit PAUSE 0x04
+ bit INTEN 0x02
+ bit CHIPRST 0x01
+ bit CHIPRSTACK 0x01
+}
+
+/*
+ * Host Address (p. 3-48)
+ * This register contains the address of the byte about
+ * to be transferred across the host bus.
+ */
+register HADDR {
+ address 0x088
+ size 4
+ access_mode RW
+}
+
+register HCNT {
+ address 0x08c
+ size 3
+ access_mode RW
+}
+
+/*
+ * SCB Pointer (p. 3-49)
+ * Gate one of the four SCBs into the SCBARRAY window.
+ */
+register SCBPTR {
+ address 0x090
+ access_mode RW
+}
+
+/*
+ * Interrupt Status (p. 3-50)
+ * Status for system interrupts
+ */
+register INTSTAT {
+ address 0x091
+ access_mode RW
+ bit BRKADRINT 0x08
+ bit SCSIINT 0x04
+ bit CMDCMPLT 0x02
+ bit SEQINT 0x01
+ mask BAD_PHASE SEQINT /* unknown scsi bus phase */
+ mask SEND_REJECT 0x10|SEQINT /* sending a message reject */
+ mask NO_IDENT 0x20|SEQINT /* no IDENTIFY after reconnect*/
+ mask NO_MATCH 0x30|SEQINT /* no cmd match for reconnect */
+ mask EXTENDED_MSG 0x40|SEQINT /* Extended message received */
+ mask NO_MATCH_BUSY 0x50|SEQINT /* Couldn't find BUSY SCB */
+ mask REJECT_MSG 0x60|SEQINT /* Reject message received */
+ mask BAD_STATUS 0x70|SEQINT /* Bad status from target */
+ mask RESIDUAL 0x80|SEQINT /* Residual byte count != 0 */
+ mask ABORT_CMDCMPLT 0x91 /*
+ * Command tagged for abort
+ * completed successfully.
+ */
+ mask AWAITING_MSG 0xa0|SEQINT /*
+ * Kernel requested to specify
+ * a message to this target
+ * (command was null), so tell
+ * it that it can fill the
+ * message buffer.
+ */
+ mask MSG_BUFFER_BUSY 0xc0|SEQINT /*
+ * Sequencer wants to use the
+ * message buffer, but it
+ * already contains a message
+ */
+ mask MSGIN_PHASEMIS 0xd0|SEQINT /*
+ * Target changed phase on us
+ * when we were expecting
+ * another msgin byte.
+ */
+ mask DATA_OVERRUN 0xe0|SEQINT /*
+ * Target attempted to write
+ * beyond the bounds of its
+ * command.
+ */
+
+ mask SEQINT_MASK 0xf0|SEQINT /* SEQINT Status Codes */
+ mask INT_PEND (BRKADRINT|SEQINT|SCSIINT|CMDCMPLT)
+}
+
+/*
+ * Hard Error (p. 3-53)
+ * Reporting of catastrophic errors. You usually cannot recover from
+ * these without a full board reset.
+ */
+register ERROR {
+ address 0x092
+ access_mode RO
+ bit PARERR 0x08
+ bit ILLOPCODE 0x04
+ bit ILLSADDR 0x02
+ bit ILLHADDR 0x01
+}
+
+/*
+ * Clear Interrupt Status (p. 3-52)
+ */
+register CLRINT {
+ address 0x092
+ access_mode WO
+ bit CLRBRKADRINT 0x08
+ bit CLRSCSIINT 0x04
+ bit CLRCMDINT 0x02
+ bit CLRSEQINT 0x01
+}
+
+register DFCNTRL {
+ address 0x093
+ access_mode RW
+ bit WIDEODD 0x40
+ bit SCSIEN 0x20
+ bit SDMAEN 0x10
+ bit SDMAENACK 0x10
+ bit HDMAEN 0x08
+ bit HDMAENACK 0x08
+ bit DIRECTION 0x04
+ bit FIFOFLUSH 0x02
+ bit FIFORESET 0x01
+}
+
+register DFSTATUS {
+ address 0x094
+ access_mode RO
+ bit DWORDEMP 0x20
+ bit MREQPEND 0x10
+ bit HDONE 0x08
+ bit DFTHRESH 0x04
+ bit FIFOFULL 0x02
+ bit FIFOEMP 0x01
+}
+
+register DFDAT {
+ address 0x099
+ access_mode RW
+}
+
+/*
+ * SCB Auto Increment (p. 3-59)
+ * Byte offset into the SCB Array and an optional bit to allow auto
+ * incrementing of the address during download and upload operations
+ */
+register SCBCNT {
+ address 0x09a
+ access_mode RW
+ bit SCBAUTO 0x80
+ mask SCBCNT_MASK 0x1f
+}
+
+/*
+ * Queue In FIFO (p. 3-60)
+ * Input queue for queued SCBs (commands that the seqencer has yet to start)
+ */
+register QINFIFO {
+ address 0x09b
+ access_mode RW
+}
+
+/*
+ * Queue In Count (p. 3-60)
+ * Number of queued SCBs
+ */
+register QINCNT {
+ address 0x09c
+ access_mode RO
+}
+
+/*
+ * Queue Out FIFO (p. 3-61)
+ * Queue of SCBs that have completed and await the host
+ */
+register QOUTFIFO {
+ address 0x09d
+ access_mode WO
+}
+
+/*
+ * Queue Out Count (p. 3-61)
+ * Number of queued SCBs in the Out FIFO
+ */
+register QOUTCNT {
+ address 0x09e
+ access_mode RO
+}
+
+/*
+ * SCB Definition (p. 5-4)
+ */
+scb {
+ address 0x0a0
+ SCB_CONTROL {
+ size 1
+ bit MK_MESSAGE 0x80
+ bit DISCENB 0x40
+ bit TAG_ENB 0x20
+ bit MUST_DMAUP_SCB 0x10
+ bit ABORT_SCB 0x08
+ bit DISCONNECTED 0x04
+ mask SCB_TAG_TYPE 0x03
+ }
+ SCB_TCL {
+ size 1
+ bit SELBUSB 0x08
+ mask TID 0xf0
+ mask LID 0x07
+ }
+ SCB_TARGET_STATUS {
+ size 1
+ }
+ SCB_SGCOUNT {
+ size 1
+ }
+ SCB_SGPTR {
+ size 4
+ }
+ SCB_RESID_SGCNT {
+ size 1
+ }
+ SCB_RESID_DCNT {
+ size 3
+ }
+ SCB_DATAPTR {
+ size 4
+ }
+ SCB_DATACNT {
+ size 3
+ }
+ SCB_LINKED_NEXT {
+ size 1
+ }
+ SCB_CMDPTR {
+ size 4
+ }
+ SCB_CMDLEN {
+ size 1
+ }
+ SCB_TAG {
+ size 1
+ }
+ SCB_NEXT {
+ size 1
+ }
+ SCB_PREV {
+ size 1
+ }
+ SCB_BUSYTARGETS {
+ size 4
+ }
+}
+
+const SG_SIZEOF 0x08 /* sizeof(struct ahc_dma) */
+
+/* --------------------- AHA-2840-only definitions -------------------- */
+
+register SEECTL_2840 {
+ address 0x0c0
+ access_mode RW
+ bit CS_2840 0x04
+ bit CK_2840 0x02
+ bit DO_2840 0x01
+}
+
+register STATUS_2840 {
+ address 0x0c1
+ access_mode RW
+ bit EEPROM_TF 0x80
+ mask BIOS_SEL 0x60
+ mask ADSEL 0x1e
+ bit DI_2840 0x01
+}
+
+/* --------------------- AIC-7870-only definitions -------------------- */
+
+register DSPCISTATUS {
+ address 0x086
+}
+
+register BRDCTL {
+ address 0x01d
+ bit BRDDAT7 0x80
+ bit BRDDAT6 0x40
+ bit BRDDAT5 0x20
+ bit BRDSTB 0x10
+ bit BRDCS 0x08
+ bit BRDRW 0x04
+ bit BRDCTL1 0x02
+ bit BRDCTL0 0x01
+}
+
+/*
+ * Serial EEPROM Control (p. 4-92 in 7870 Databook)
+ * Controls the reading and writing of an external serial 1-bit
+ * EEPROM Device. In order to access the serial EEPROM, you must
+ * first set the SEEMS bit that generates a request to the memory
+ * port for access to the serial EEPROM device. When the memory
+ * port is not busy servicing another request, it reconfigures
+ * to allow access to the serial EEPROM. When this happens, SEERDY
+ * gets set high to verify that the memory port access has been
+ * granted.
+ *
+ * After successful arbitration for the memory port, the SEECS bit of
+ * the SEECTL register is connected to the chip select. The SEECK,
+ * SEEDO, and SEEDI are connected to the clock, data out, and data in
+ * lines respectively. The SEERDY bit of SEECTL is useful in that it
+ * gives us an 800 nsec timer. After a write to the SEECTL register,
+ * the SEERDY goes high 800 nsec later. The one exception to this is
+ * when we first request access to the memory port. The SEERDY goes
+ * high to signify that access has been granted and, for this case, has
+ * no implied timing.
+ *
+ * See 93cx6.c for detailed information on the protocol necessary to
+ * read the serial EEPROM.
+ */
+register SEECTL {
+ address 0x01e
+ bit EXTARBACK 0x80
+ bit EXTARBREQ 0x40
+ bit SEEMS 0x20
+ bit SEERDY 0x10
+ bit SEECS 0x08
+ bit SEECK 0x04
+ bit SEEDO 0x02
+ bit SEEDI 0x01
+}
+/* ---------------------- Scratch RAM Offsets ------------------------- */
+/* These offsets are either to values that are initialized by the board's
+ * BIOS or are specified by the sequencer code.
+ *
+ * The host adapter card (at least the BIOS) uses 20-2f for SCSI
+ * device information, 32-33 and 5a-5f as well. As it turns out, the
+ * BIOS trashes 20-2f, writing the synchronous negotiation results
+ * on top of the BIOS values, so we re-use those for our per-target
+ * scratchspace (actually a value that can be copied directly into
+ * SCSIRATE). The kernel driver will enable synchronous negotiation
+ * for all targets that have a value other than 0 in the lower four
+ * bits of the target scratch space. This should work regardless of
+ * whether the bios has been installed.
+ */
+
+scratch_ram {
+ address 0x020
+
+ /*
+ * 1 byte per target starting at this address for configuration values
+ */
+ TARG_SCRATCH {
+ size 16
+ }
+ ULTRA_ENB {
+ size 2
+ }
+ /*
+ * Bit vector of targets that have disconnection disabled.
+ */
+ DISC_DSB {
+ size 2
+ }
+ /*
+ * Length of pending message
+ */
+ MSG_LEN {
+ size 1
+ }
+ /* We reserve 8bytes to store outgoing messages */
+ MSG_OUT {
+ size 8
+ }
+ /* Parameters for DMA Logic */
+ DMAPARAMS {
+ size 1
+ bit WIDEODD 0x40
+ bit SCSIEN 0x20
+ bit SDMAEN 0x10
+ bit SDMAENACK 0x10
+ bit HDMAEN 0x08
+ bit HDMAENACK 0x08
+ bit DIRECTION 0x04
+ bit FIFOFLUSH 0x02
+ bit FIFORESET 0x01
+ }
+ /*
+ * Number of SCBs supported by
+ * this card.
+ */
+ SCBCOUNT {
+ size 1
+ }
+ /*
+ * Two's complement of SCBCOUNT
+ */
+ COMP_SCBCOUNT {
+ size 1
+ }
+ /*
+ * Mask of bits to test against
+ * when looking at the Queue Count
+ * registers. Works around a bug
+ * on aic7850 chips.
+ */
+ QCNTMASK {
+ size 1
+ }
+ SEQ_FLAGS {
+ size 1
+ bit RESELECTED 0x80
+ bit IDENTIFY_SEEN 0x40
+ bit TAGGED_SCB 0x20
+ bit DPHASE 0x10
+ bit PAGESCBS 0x04
+ bit WIDE_BUS 0x02
+ bit TWIN_BUS 0x01
+ }
+ /*
+ * Temporary storage for the
+ * target/channel/lun of a
+ * reconnecting target
+ */
+ SAVED_TCL {
+ size 1
+ }
+ SG_COUNT {
+ size 1
+ }
+ /* working value of SG pointer */
+ SG_NEXT {
+ size 4
+ }
+ /*
+ * head of list of SCBs awaiting
+ * selection
+ */
+ WAITING_SCBH {
+ size 1
+ }
+ SAVED_LINKPTR {
+ size 1
+ }
+ SAVED_SCBPTR {
+ size 1
+ }
+ /*
+ * The sequencer will stick the frist byte of any rejected message here
+ * so we can see what is getting thrown away.
+ */
+ REJBYTE {
+ size 1
+ }
+ /*
+ * The last bus phase as seen by the sequencer.
+ */
+ LASTPHASE {
+ size 1
+ bit CDI 0x80
+ bit IOI 0x40
+ bit MSGI 0x20
+ mask PHASE_MASK CDI|IOI|MSGI
+ mask P_DATAOUT 0x00
+ mask P_DATAIN IOI
+ mask P_COMMAND CDI
+ mask P_MESGOUT CDI|MSGI
+ mask P_STATUS CDI|IOI
+ mask P_MESGIN CDI|IOI|MSGI
+ mask P_BUSFREE 0x01
+ }
+ MSGIN_EXT_LEN {
+ size 1
+ }
+ MSGIN_EXT_OPCODE {
+ size 1
+ }
+ /*
+ * location 3, stores the last
+ * byte of an extended message if
+ * it passes the two bytes of space
+ * we allow now. This byte isn't
+ * used for anything, it just makes
+ * the code shorter for tossing
+ * extra bytes.
+ */
+ MSGIN_EXT_BYTES {
+ size 3
+ }
+ /*
+ * head of list of SCBs that are
+ * disconnected. Used for SCB
+ * paging.
+ */
+ DISCONNECTED_SCBH {
+ size 1
+ }
+ /*
+ * head of list of SCBs that are
+ * not in use. Used for SCB paging.
+ */
+ FREE_SCBH {
+ size 1
+ }
+ HSCB_ADDR {
+ size 4
+ }
+ CUR_SCBID {
+ size 1
+ }
+ /*
+ * Running count of commands placed in
+ * the QOUTFIFO. This is cleared by the
+ * kernel driver every FIFODEPTH commands.
+ */
+ CMDOUTCNT {
+ size 1
+ }
+ /*
+ * Maximum number of entries allowed in
+ * the QOUT/INFIFO.
+ */
+ FIFODEPTH {
+ size 1
+ }
+ ARG_1 {
+ size 1
+ mask SEND_MSG 0x80
+ mask SEND_SENSE 0x40
+ mask SEND_REJ 0x20
+ alias RETURN_1
+ }
+ /*
+ * These are reserved registers in the card's scratch ram. Some of
+ * the values are specified in the AHA2742 technical reference manual
+ * and are initialized by the BIOS at boot time.
+ */
+ SCSICONF {
+ address 0x05a
+ size 1
+ bit RESET_SCSI 0x40
+ }
+ HOSTCONF {
+ address 0x05d
+ size 1
+ }
+ HA_274_BIOSCTRL {
+ address 0x05f
+ size 1
+ mask BIOSMODE 0x30
+ mask BIOSDISABLED 0x30
+ bit CHANNEL_B_PRIMARY 0x08
+ }
+}
+
+const SCB_LIST_NULL 0xff
+
+
+/* WDTR Message values */
+const BUS_8_BIT 0x00
+const BUS_16_BIT 0x01
+const BUS_32_BIT 0x02
+const MAX_OFFSET_8BIT 0x0f
+const MAX_OFFSET_16BIT 0x08
diff --git a/drivers/scsi/aic7xxx/aic7xxx.seq b/drivers/scsi/aic7xxx/aic7xxx.seq
new file mode 100644
index 000000000..d08fd7aaf
--- /dev/null
+++ b/drivers/scsi/aic7xxx/aic7xxx.seq
@@ -0,0 +1,1156 @@
+/*
+ * Adaptec 274x/284x/294x device driver firmware for Linux and FreeBSD.
+ *
+ * Copyright (c) 1994-1997 Justin Gibbs.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Where this Software is combined with software released under the terms of
+ * the GNU Public License ("GPL") and the terms of the GPL would require the
+ * combined work to also be released under the terms of the GPL, the terms
+ * and conditions of this License will apply in addition to those of the
+ * GPL with the exception of any terms or conditions of this License that
+ * conflict with, or are expressly prohibited by, the GPL.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: aic7xxx.seq,v 1.2 1997/08/30 02:17:29 ralf Exp $
+ */
+
+#include <aic7xxx.reg>
+#include <scsi_message.h>
+
+/*
+ * A few words on the waiting SCB list:
+ * After starting the selection hardware, we check for reconnecting targets
+ * as well as for our selection to complete just in case the reselection wins
+ * bus arbitration. The problem with this is that we must keep track of the
+ * SCB that we've already pulled from the QINFIFO and started the selection
+ * on just in case the reselection wins so that we can retry the selection at
+ * a later time. This problem cannot be resolved by holding a single entry
+ * in scratch ram since a reconnecting target can request sense and this will
+ * create yet another SCB waiting for selection. The solution used here is to
+ * use byte 27 of the SCB as a psuedo-next pointer and to thread a list
+ * of SCBs that are awaiting selection. Since 0-0xfe are valid SCB indexes,
+ * SCB_LIST_NULL is 0xff which is out of range. An entry is also added to
+ * this list everytime a request sense occurs or after completing a non-tagged
+ * command for which a second SCB has been queued. The sequencer will
+ * automatically consume the entries.
+ */
+
+/*
+ * We assume that the kernel driver may reset us at any time, even in the
+ * middle of a DMA, so clear DFCNTRL too.
+ */
+reset:
+ clr SCSISIGO; /* De-assert BSY */
+ /* Always allow reselection */
+ mvi SCSISEQ, ENRSELI|ENAUTOATNP;
+ call clear_target_state;
+poll_for_work:
+ test SSTAT0,SELDO jnz select;
+ test SSTAT0,SELDI jnz reselect;
+ test SCSISEQ, ENSELO jnz poll_for_work;
+.if ( TWIN_CHANNEL )
+ /*
+ * Twin channel devices cannot handle things like SELTO
+ * interrupts on the "background" channel. So, if we
+ * are selecting, keep polling the current channel util
+ * either a selection or reselection occurs.
+ */
+ xor SBLKCTL,SELBUSB; /* Toggle to the other bus */
+ test SSTAT0,SELDO jnz select;
+ test SSTAT0,SELDI jnz reselect;
+ test SCSISEQ, ENSELO jnz poll_for_work;
+ xor SBLKCTL,SELBUSB; /* Toggle back */
+.endif
+ cmp WAITING_SCBH,SCB_LIST_NULL jne start_waiting;
+test_queue:
+ /* Has the driver posted any work for us? */
+ mov A, QCNTMASK;
+ test QINCNT,A jz poll_for_work;
+
+/*
+ * We have at least one queued SCB now and we don't have any
+ * SCBs in the list of SCBs awaiting selection. If we have
+ * any SCBs available for use, pull the tag from the QINFIFO
+ * and get to work on it.
+ */
+.if ( SCB_PAGING )
+ mov ALLZEROS call get_free_or_disc_scb;
+ cmp SINDEX, SCB_LIST_NULL je poll_for_work;
+.endif
+dequeue_scb:
+ mov CUR_SCBID,QINFIFO;
+.if !( SCB_PAGING )
+ /* In the non-paging case, the SCBID == hardware SCB index */
+ mov SCBPTR, CUR_SCBID;
+.endif
+dma_queued_scb:
+/*
+ * DMA the SCB from host ram into the current SCB location.
+ */
+ mvi DMAPARAMS, HDMAEN|DIRECTION|FIFORESET;
+ mov CUR_SCBID call dma_scb;
+
+/*
+ * See if there is not already an active SCB for this target. This code
+ * locks out on a per target basis instead of target/lun. Although this
+ * is not ideal for devices that have multiple luns active at the same
+ * time, it is faster than looping through all SCB's looking for active
+ * commands. We also don't have enough spare SCB space for us to store the
+ * SCBID of the currently busy transaction for each target/lun making it
+ * impossible to link up the SCBs.
+ */
+test_busy:
+ test SCB_CONTROL, TAG_ENB|ABORT_SCB jnz start_scb;
+ mvi SEQCTL, PAUSEDIS|FASTMODE;
+ mov SAVED_SCBPTR, SCBPTR;
+ mov SCB_TCL call index_untagged_scb;
+ mov ARG_1, SINDIR; /*
+ * ARG_1 should
+ * now have the SCB ID of
+ * any active, non-tagged,
+ * command for this target.
+ */
+ cmp ARG_1, SCB_LIST_NULL je make_busy;
+.if ( SCB_PAGING )
+ /*
+ * Put this SCB back onto the free list. It
+ * may be necessary to satisfy the search for
+ * the active SCB.
+ */
+ mov SCBPTR, SAVED_SCBPTR;
+ call add_scb_to_free_list;
+ /* Find the active SCB */
+ mov ALLZEROS call findSCB;
+ /*
+ * If we couldn't find it, tell the kernel. This should
+ * never happen.
+ */
+ cmp SINDEX, SCB_LIST_NULL jne paged_busy_link;
+ mvi INTSTAT, NO_MATCH_BUSY;
+paged_busy_link:
+ /* Link us in */
+ mov SCB_LINKED_NEXT, CUR_SCBID;
+ /* Put it back on the disconnected list */
+ call add_scb_to_disc_list;
+ mvi SEQCTL, FASTMODE;
+ jmp poll_for_work;
+.else
+simple_busy_link:
+ mov SCBPTR, ARG_1;
+ mov SCB_LINKED_NEXT, CUR_SCBID;
+ mvi SEQCTL, FASTMODE;
+ jmp poll_for_work;
+.endif
+make_busy:
+ mov DINDIR, CUR_SCBID;
+ mov SCBPTR, SAVED_SCBPTR;
+ mvi SEQCTL, FASTMODE;
+
+start_scb:
+ /*
+ * Place us on the waiting list in case our selection
+ * doesn't win during bus arbitration.
+ */
+ mov SCB_NEXT,WAITING_SCBH;
+ mov WAITING_SCBH, SCBPTR;
+start_waiting:
+ /*
+ * Pull the first entry off of the waiting SCB list
+ * We don't have to "test_busy" because only transactions that
+ * have passed that test can be in the WAITING_SCB list.
+ */
+ mov SCBPTR, WAITING_SCBH;
+ call start_selection;
+ jmp poll_for_work;
+
+start_selection:
+.if ( TWIN_CHANNEL )
+ and SINDEX,~SELBUSB,SBLKCTL;/* Clear the channel select bit */
+ and A,SELBUSB,SCB_TCL; /* Get new channel bit */
+ or SINDEX,A;
+ mov SBLKCTL,SINDEX; /* select channel */
+.endif
+initialize_scsiid:
+ and A, TID, SCB_TCL; /* Get target ID */
+ and SCSIID, OID; /* Clear old target */
+ or SCSIID, A;
+ mvi SCSISEQ, ENSELO|ENAUTOATNO|ENRSELI|ENAUTOATNP ret;
+/*
+ * Reselection has been initiated by a target. Make a note that we've been
+ * reselected, but haven't seen an IDENTIFY message from the target yet.
+ */
+reselect:
+ clr MSG_LEN; /* Don't have anything in the mesg buffer */
+ mvi CLRSINT0, CLRSELDI;
+ /* XXX test for and handle ONE BIT condition */
+ and SAVED_TCL, SELID_MASK, SELID;
+ or SEQ_FLAGS,RESELECTED;
+ jmp select2;
+
+/*
+ * After the selection, remove this SCB from the "waiting SCB"
+ * list. This is achieved by simply moving our "next" pointer into
+ * WAITING_SCBH. Our next pointer will be set to null the next time this
+ * SCB is used, so don't bother with it now.
+ */
+select:
+ /* Turn off the selection hardware */
+ mvi SCSISEQ, ENRSELI|ENAUTOATNP; /*
+ * ATN on parity errors
+ * for "in" phases
+ */
+ mvi CLRSINT0, CLRSELDO;
+ mov SCBPTR, WAITING_SCBH;
+ mov WAITING_SCBH,SCB_NEXT;
+ mov SAVED_TCL, SCB_TCL;
+/*
+ * As soon as we get a successful selection, the target should go
+ * into the message out phase since we have ATN asserted. Prepare
+ * the message to send.
+ *
+ * Messages are stored in scratch RAM starting with a length byte
+ * followed by the message itself.
+ */
+
+mk_identify:
+ and MSG_OUT,0x7,SCB_TCL; /* lun */
+ and A,DISCENB,SCB_CONTROL; /* mask off disconnect privledge */
+ or MSG_OUT,A; /* or in disconnect privledge */
+ or MSG_OUT,MSG_IDENTIFYFLAG;
+ mvi MSG_LEN, 1;
+
+/*
+ * Send a tag message if TAG_ENB is set in the SCB control block.
+ * Use SCB_TAG (the position in the kernel's SCB array) as the tag value.
+ */
+mk_tag:
+ test SCB_CONTROL,TAG_ENB jz mk_message;
+ and MSG_OUT[1],TAG_ENB|SCB_TAG_TYPE,SCB_CONTROL;
+ mov MSG_OUT[2],SCB_TAG;
+ add MSG_LEN,2; /* update message length */
+
+/*
+ * Interrupt the driver, and allow it to tweak the message buffer
+ * if it asks.
+ */
+mk_message:
+ test SCB_CONTROL,MK_MESSAGE jz select2;
+ mvi INTSTAT,AWAITING_MSG;
+
+select2:
+ mvi CLRSINT1,CLRBUSFREE;
+ or SIMODE1, ENBUSFREE; /*
+ * We aren't expecting a
+ * bus free, so interrupt
+ * the kernel driver if it
+ * happens.
+ */
+/*
+ * Initialize Ultra mode setting and clear the SCSI channel.
+ */
+ or SXFRCTL0, CLRSTCNT|SPIOEN|CLRCHN;
+.if ( ULTRA )
+ultra:
+ mvi SINDEX, ULTRA_ENB+1;
+ test SAVED_TCL, 0x80 jnz ultra_2; /* Target ID > 7 */
+ dec SINDEX;
+ultra_2:
+ mov FUNCTION1,SAVED_TCL;
+ mov A,FUNCTION1;
+ test SINDIR, A jz ndx_dtr;
+ or SXFRCTL0, FAST20;
+.endif
+
+/*
+ * Initialize SCSIRATE with the appropriate value for this target.
+ * The SCSIRATE settings for each target are stored in an array
+ * based at TARG_SCRATCH.
+ */
+ndx_dtr:
+ shr A,4,SAVED_TCL;
+ test SBLKCTL,SELBUSB jz ndx_dtr_2;
+ or SAVED_TCL, SELBUSB; /* Add the channel bit while we're here */
+ or A,0x08; /* Channel B entries add 8 */
+ndx_dtr_2:
+ add SINDEX,TARG_SCRATCH,A;
+ mov SCSIRATE,SINDIR;
+
+
+/*
+ * Main loop for information transfer phases. If BSY is false, then
+ * we have a bus free condition, expected or not. Otherwise, wait
+ * for the target to assert REQ before checking MSG, C/D and I/O
+ * for the bus phase.
+ *
+ */
+ITloop:
+ test SSTAT1,REQINIT jz ITloop;
+ test SSTAT1, SCSIPERR jnz ITloop;
+
+ and A,PHASE_MASK,SCSISIGI;
+ mov LASTPHASE,A;
+ mov SCSISIGO,A;
+
+ cmp ALLZEROS,A je p_dataout;
+ cmp A,P_DATAIN je p_datain;
+ cmp A,P_COMMAND je p_command;
+ cmp A,P_MESGOUT je p_mesgout;
+ cmp A,P_STATUS je p_status;
+ cmp A,P_MESGIN je p_mesgin;
+
+ mvi INTSTAT,BAD_PHASE; /* unknown phase - signal driver */
+ jmp ITloop; /* Try reading the bus again. */
+
+await_busfree:
+ and SIMODE1, ~ENBUSFREE;
+ call clear_target_state;
+ mov NONE, SCSIDATL; /* Ack the last byte */
+ test SSTAT1,REQINIT|BUSFREE jz .;
+ test SSTAT1, BUSFREE jnz poll_for_work;
+ mvi INTSTAT, BAD_PHASE;
+
+clear_target_state:
+ clr DFCNTRL;
+ clr SCSIRATE; /*
+ * We don't know the target we will
+ * connect to, so default to narrow
+ * transfers to avoid parity problems.
+ */
+ and SXFRCTL0, ~FAST20;
+ mvi LASTPHASE, P_BUSFREE;
+ /* clear target specific flags */
+ and SEQ_FLAGS,~(RESELECTED|IDENTIFY_SEEN|TAGGED_SCB|DPHASE) ret;
+
+p_dataout:
+ mvi DMAPARAMS, WIDEODD|SCSIEN|SDMAEN|HDMAEN|DIRECTION|FIFORESET;
+ jmp data_phase_init;
+
+/*
+ * If we re-enter the data phase after going through another phase, the
+ * STCNT may have been cleared, so restore it from the residual field.
+ */
+data_phase_reinit:
+ mvi DINDEX, STCNT;
+ mvi SCB_RESID_DCNT call bcopy_3;
+ jmp data_phase_loop;
+
+p_datain:
+ mvi DMAPARAMS, WIDEODD|SCSIEN|SDMAEN|HDMAEN|FIFORESET;
+data_phase_init:
+ call assert; /*
+ * Ensure entering a data
+ * phase is okay - seen identify, etc.
+ */
+
+ test SEQ_FLAGS, DPHASE jnz data_phase_reinit;
+
+ /*
+ * Initialize the DMA address and counter from the SCB.
+ * Also set SG_COUNT and SG_NEXT in memory since we cannot
+ * modify the values in the SCB itself until we see a
+ * save data pointers message.
+ */
+ mvi DINDEX, HADDR;
+ mvi SCB_DATAPTR call bcopy_7;
+
+ call set_stcnt_from_hcnt;
+
+ mov SG_COUNT,SCB_SGCOUNT;
+
+ mvi DINDEX, SG_NEXT;
+ mvi SCB_SGPTR call bcopy_4;
+
+data_phase_loop:
+/* Guard against overruns */
+ test SG_COUNT, 0xff jnz data_phase_inbounds;
+/*
+ * Turn on 'Bit Bucket' mode, set the transfer count to
+ * 16meg and let the target run until it changes phase.
+ * When the transfer completes, notify the host that we
+ * had an overrun.
+ */
+ or SXFRCTL1,BITBUCKET;
+ mvi HCNT[0], 0xff;
+ mvi HCNT[1], 0xff;
+ mvi HCNT[2], 0xff;
+ call set_stcnt_from_hcnt;
+
+data_phase_inbounds:
+/* If we are the last SG block, ensure wideodd is off. */
+ cmp SG_COUNT,0x01 jne data_phase_wideodd;
+ and DMAPARAMS, ~WIDEODD;
+data_phase_wideodd:
+ mov DMAPARAMS call dma;
+
+/* Go tell the host about any overruns */
+ test SXFRCTL1,BITBUCKET jnz data_phase_overrun;
+
+/* Exit if we had an underrun. dma clears SINDEX in this case. */
+ test SINDEX,0xff jz data_phase_finish;
+
+/*
+ * Advance the scatter-gather pointers if needed
+ */
+sg_advance:
+ dec SG_COUNT; /* one less segment to go */
+
+ test SG_COUNT, 0xff jz data_phase_finish; /* Are we done? */
+
+ clr A; /* add sizeof(struct scatter) */
+ add SG_NEXT[0],SG_SIZEOF;
+ adc SG_NEXT[1],A;
+
+/*
+ * Load a struct scatter and set up the data address and length.
+ * If the working value of the SG count is nonzero, then
+ * we need to load a new set of values.
+ *
+ * This, like all DMA's, assumes little-endian host data storage.
+ */
+sg_load:
+ mvi DINDEX, HADDR;
+ mvi SG_NEXT call bcopy_4;
+
+ mvi HCNT[0],SG_SIZEOF;
+ clr HCNT[1];
+ clr HCNT[2];
+
+ or DFCNTRL, HDMAEN|DIRECTION|FIFORESET;
+
+ call dma_finish;
+
+/*
+ * Copy data from FIFO into SCB data pointer and data count. This assumes
+ * that the SG segments are of the form:
+ *
+ * struct ahc_dma_seg {
+ * u_int32_t addr; four bytes, little-endian order
+ * u_int32_t len; four bytes, little endian order
+ * };
+ */
+ mvi HADDR call dfdat_in_7;
+
+/* Load STCNT as well. It is a mirror of HCNT */
+ call set_stcnt_from_hcnt;
+ test SSTAT1,PHASEMIS jz data_phase_loop;
+
+data_phase_finish:
+/*
+ * After a DMA finishes, save the SG and STCNT residuals back into the SCB
+ * We use STCNT instead of HCNT, since it's a reflection of how many bytes
+ * were transferred on the SCSI (as opposed to the host) bus.
+ */
+ mov SCB_RESID_DCNT[0],STCNT[0];
+ mov SCB_RESID_DCNT[1],STCNT[1];
+ mov SCB_RESID_DCNT[2],STCNT[2];
+ mov SCB_RESID_SGCNT, SG_COUNT;
+
+ /* We have seen a data phase */
+ or SEQ_FLAGS, DPHASE;
+
+ jmp ITloop;
+
+data_phase_overrun:
+/*
+ * Turn off BITBUCKET mode and notify the host
+ */
+ and SXFRCTL1, ~BITBUCKET;
+ mvi INTSTAT,DATA_OVERRUN;
+ jmp ITloop;
+
+/*
+ * Command phase. Set up the DMA registers and let 'er rip.
+ */
+p_command:
+ call assert;
+
+/*
+ * Load HADDR and HCNT.
+ */
+ mvi DINDEX, HADDR;
+ mvi SCB_CMDPTR call bcopy_5;
+ clr HCNT[1];
+ clr HCNT[2];
+
+ call set_stcnt_from_hcnt;
+
+ mvi (SCSIEN|SDMAEN|HDMAEN|DIRECTION|FIFORESET) call dma;
+ jmp ITloop;
+
+/*
+ * Status phase. Wait for the data byte to appear, then read it
+ * and store it into the SCB.
+ */
+p_status:
+ call assert;
+
+ mov SCB_TARGET_STATUS, SCSIDATL;
+ jmp ITloop;
+
+/*
+ * Message out phase. If there is not an active message, but the target
+ * took us into this phase anyway, build a no-op message and send it.
+ */
+p_mesgout:
+ test MSG_LEN, 0xff jnz p_mesgout_start;
+ mvi MSG_NOOP call mk_mesg; /* build NOP message */
+p_mesgout_start:
+/*
+ * Set up automatic PIO transfer from MSG_OUT. Bit 3 in
+ * SXFRCTL0 (SPIOEN) is already on.
+ */
+ mvi SINDEX,MSG_OUT;
+ mov DINDEX,MSG_LEN;
+
+/*
+ * When target asks for a byte, drop ATN if it's the last one in
+ * the message. Otherwise, keep going until the message is exhausted.
+ * ATN must be dropped *at least* 90ns before we ack the last byte, so
+ * the code is aranged to execute two instructions before the byte is
+ * transferred to give a good margin of safety
+ *
+ * Keep an eye out for a phase change, in case the target issues
+ * a MESSAGE REJECT.
+ */
+p_mesgout_loop:
+ test SSTAT1, REQINIT jz p_mesgout_loop;
+ test SSTAT1, SCSIPERR jnz p_mesgout_loop;
+ and LASTPHASE, PHASE_MASK, SCSISIGI;
+ cmp LASTPHASE, P_MESGOUT jne p_mesgout_done;
+p_mesgout_testretry:
+ test DINDEX,0xff jnz p_mesgout_dropatn;
+ or SCSISIGO,ATNO,LASTPHASE;/* turn on ATN for the retry */
+ jmp p_mesgout_start;
+/*
+ * If the next bus phase after ATN drops is a message out, it means
+ * that the target is requesting that the last message(s) be resent.
+ */
+p_mesgout_dropatn:
+ cmp DINDEX,1 jne p_mesgout_outb; /* last byte? */
+ mvi CLRSINT1,CLRATNO; /* drop ATN */
+p_mesgout_outb:
+ dec DINDEX;
+ mov SCSIDATL,SINDIR;
+ jmp p_mesgout_loop;
+
+p_mesgout_done:
+ mvi CLRSINT1,CLRATNO; /* Be sure to turn ATNO off */
+ clr MSG_LEN; /* no active msg */
+ jmp ITloop;
+
+/*
+ * Message in phase. Bytes are read using Automatic PIO mode.
+ */
+p_mesgin:
+ mvi ACCUM call inb_first; /* read the 1st message byte */
+ mov REJBYTE,A; /* save it for the driver */
+
+ test A,MSG_IDENTIFYFLAG jnz mesgin_identify;
+ cmp A,MSG_DISCONNECT je mesgin_disconnect;
+ cmp A,MSG_SAVEDATAPOINTER je mesgin_sdptrs;
+ cmp ALLZEROS,A je mesgin_complete;
+ cmp A,MSG_RESTOREPOINTERS je mesgin_rdptrs;
+ cmp A,MSG_EXTENDED je mesgin_extended;
+ cmp A,MSG_MESSAGE_REJECT je mesgin_reject;
+ cmp A,MSG_NOOP je mesgin_done;
+
+rej_mesgin:
+/*
+ * We have no idea what this message in is, so we issue a message reject
+ * and hope for the best. In any case, rejection should be a rare
+ * occurrence - signal the driver when it happens.
+ */
+ mvi INTSTAT,SEND_REJECT; /* let driver know */
+
+ mvi MSG_MESSAGE_REJECT call mk_mesg;
+
+mesgin_done:
+ mov NONE,SCSIDATL; /*dummy read from latch to ACK*/
+ jmp ITloop;
+
+
+mesgin_complete:
+/*
+ * We got a "command complete" message, so put the SCB_TAG into the QOUTFIFO,
+ * and trigger a completion interrupt. Before doing so, check to see if there
+ * is a residual or the status byte is something other than NO_ERROR (0). In
+ * either of these conditions, we upload the SCB back to the host so it can
+ * process this information. In the case of a non zero status byte, we
+ * additionally interrupt the kernel driver synchronously, allowing it to
+ * decide if sense should be retrieved. If the kernel driver wishes to request
+ * sense, it will fill the kernel SCB with a request sense command and set
+ * RETURN_1 to SEND_SENSE. If RETURN_1 is set to SEND_SENSE we redownload
+ * the SCB, and process it as the next command by adding it to the waiting list.
+ * If the kernel driver does not wish to request sense, it need only clear
+ * RETURN_1, and the command is allowed to complete normally. We don't bother
+ * to post to the QOUTFIFO in the error cases since it would require extra
+ * work in the kernel driver to ensure that the entry was removed before the
+ * command complete code tried processing it.
+ */
+
+/*
+ * First check for residuals
+ */
+ test SCB_RESID_SGCNT,0xff jnz upload_scb;
+ test SCB_TARGET_STATUS,0xff jz status_ok; /* Good Status? */
+upload_scb:
+ mvi DMAPARAMS, FIFORESET;
+ mov SCB_TAG call dma_scb;
+check_status:
+ test SCB_TARGET_STATUS,0xff jz status_ok; /* Just a residual? */
+ mvi INTSTAT,BAD_STATUS; /* let driver know */
+ cmp RETURN_1, SEND_SENSE jne status_ok;
+ /* This SCB becomes the next to execute as it will retrieve sense */
+ mov SCB_LINKED_NEXT, SCB_TAG;
+ jmp dma_next_scb;
+
+status_ok:
+/* First, mark this target as free. */
+ test SCB_CONTROL,TAG_ENB jnz complete; /*
+ * Tagged commands
+ * don't busy the
+ * target.
+ */
+ mov SAVED_SCBPTR, SCBPTR;
+ mov SAVED_LINKPTR, SCB_LINKED_NEXT;
+ mov SCB_TCL call index_untagged_scb;
+ mov DINDIR, SAVED_LINKPTR;
+ mov SCBPTR, SAVED_SCBPTR;
+
+complete:
+ /* Post the SCB and issue an interrupt */
+.if ( SCB_PAGING )
+ /*
+ * Spin loop until there is space
+ * in the QOUTFIFO.
+ */
+ mov A, FIFODEPTH;
+ cmp CMDOUTCNT, A je .;
+ inc CMDOUTCNT;
+.endif
+ mov QOUTFIFO,SCB_TAG;
+ mvi INTSTAT,CMDCMPLT;
+ test SCB_CONTROL, ABORT_SCB jz dma_next_scb;
+ mvi INTSTAT, ABORT_CMDCMPLT;
+
+dma_next_scb:
+ cmp SCB_LINKED_NEXT, SCB_LIST_NULL je add_to_free_list;
+.if !( SCB_PAGING )
+ /* Only DMA on top of ourselves if we are the SCB to download */
+ mov A, SCB_LINKED_NEXT;
+ cmp SCB_TAG, A je dma_next_scb2;
+ call add_scb_to_free_list;
+ mov SCBPTR, A;
+ jmp add_to_waiting_list;
+.endif
+dma_next_scb2:
+ mvi DMAPARAMS, HDMAEN|DIRECTION|FIFORESET;
+ mov SCB_LINKED_NEXT call dma_scb;
+add_to_waiting_list:
+ mov SCB_NEXT,WAITING_SCBH;
+ mov WAITING_SCBH, SCBPTR;
+ /*
+ * Prepare our selection hardware before the busfree so we have a
+ * high probability of winning arbitration.
+ */
+ call start_selection;
+ jmp await_busfree;
+add_to_free_list:
+ call add_scb_to_free_list;
+ jmp await_busfree;
+
+/*
+ * Is it an extended message? Copy the message to our message buffer and
+ * notify the host. The host will tell us whether to reject this message,
+ * respond to it with the message that the host placed in our message buffer,
+ * or simply to do nothing.
+ */
+mesgin_extended:
+ mvi MSGIN_EXT_LEN call inb_next;
+ mov A, MSGIN_EXT_LEN;
+mesgin_extended_loop:
+ mov DINDEX call inb_next;
+ dec A;
+ cmp DINDEX, MSGIN_EXT_BYTES+3 jne mesgin_extended_loop_test;
+ dec DINDEX; /* dump by repeatedly filling the last byte */
+mesgin_extended_loop_test:
+ test A, 0xFF jnz mesgin_extended_loop;
+mesgin_extended_intr:
+ mvi INTSTAT,EXTENDED_MSG; /* let driver know */
+ cmp RETURN_1,SEND_REJ je rej_mesgin;
+ cmp RETURN_1,SEND_MSG jne mesgin_done;
+/* The kernel has setup a message to be sent */
+ or SCSISIGO,ATNO,LASTPHASE; /* turn on ATNO */
+ jmp mesgin_done;
+
+/*
+ * Is it a disconnect message? Set a flag in the SCB to remind us
+ * and await the bus going free.
+ */
+mesgin_disconnect:
+ or SCB_CONTROL,DISCONNECTED;
+.if ( SCB_PAGING )
+ call add_scb_to_disc_list;
+.endif
+ jmp await_busfree;
+
+/*
+ * Save data pointers message:
+ * Copying RAM values back to SCB, for Save Data Pointers message, but
+ * only if we've actually been into a data phase to change them. This
+ * protects against bogus data in scratch ram and the residual counts
+ * since they are only initialized when we go into data_in or data_out.
+ */
+mesgin_sdptrs:
+ test SEQ_FLAGS, DPHASE jz mesgin_done;
+ mov SCB_SGCOUNT,SG_COUNT;
+
+ /* The SCB SGPTR becomes the next one we'll download */
+ mvi DINDEX, SCB_SGPTR;
+ mvi SG_NEXT call bcopy_4;
+
+ /* The SCB DATAPTR0 becomes the current SHADDR */
+ mvi DINDEX, SCB_DATAPTR;
+ mvi SHADDR call bcopy_4;
+
+/*
+ * Use the residual number since STCNT is corrupted by any message transfer.
+ */
+ mvi SCB_RESID_DCNT call bcopy_3;
+
+ jmp mesgin_done;
+
+/*
+ * Restore pointers message? Data pointers are recopied from the
+ * SCB anytime we enter a data phase for the first time, so all
+ * we need to do is clear the DPHASE flag and let the data phase
+ * code do the rest.
+ */
+mesgin_rdptrs:
+ and SEQ_FLAGS, ~DPHASE; /*
+ * We'll reload them
+ * the next time through
+ * the dataphase.
+ */
+ jmp mesgin_done;
+
+/*
+ * Identify message? For a reconnecting target, this tells us the lun
+ * that the reconnection is for - find the correct SCB and switch to it,
+ * clearing the "disconnected" bit so we don't "find" it by accident later.
+ */
+mesgin_identify:
+ test A,0x78 jnz rej_mesgin; /*!DiscPriv|!LUNTAR|!Reserved*/
+ and A,0x07; /* lun in lower three bits */
+ or SAVED_TCL,A; /* SAVED_TCL should be complete now */
+ mov SAVED_TCL call index_untagged_scb;
+ mov ARG_1, SINDIR;
+.if ( SCB_PAGING )
+ cmp ARG_1,SCB_LIST_NULL jne use_findSCB;
+.else
+ cmp ARG_1,SCB_LIST_NULL je snoop_tag;
+ /* Directly index the SCB */
+ mov SCBPTR,ARG_1;
+ test SCB_CONTROL,DISCONNECTED jz not_found;
+ jmp setup_SCB;
+.endif
+/*
+ * Here we "snoop" the bus looking for a SIMPLE QUEUE TAG message.
+ * If we get one, we use the tag returned to find the proper
+ * SCB. With SCB paging, this requires using findSCB for both tagged
+ * and non-tagged transactions since the SCB may exist in any slot.
+ * If we're not using SCB paging, we can use the tag as the direct
+ * index to the SCB.
+ */
+snoop_tag:
+ mov NONE,SCSIDATL; /* ACK Identify MSG */
+snoop_tag_loop:
+ test SSTAT1,REQINIT jz snoop_tag_loop;
+ test SSTAT1, SCSIPERR jnz snoop_tag_loop;
+ and LASTPHASE, PHASE_MASK, SCSISIGI;
+ cmp LASTPHASE, P_MESGIN jne not_found;
+ cmp SCSIBUSL,MSG_SIMPLE_Q_TAG jne not_found;
+get_tag:
+ or SEQ_FLAGS, TAGGED_SCB;
+ mvi ARG_1 call inb_next; /* tag value */
+/*
+ * See if the tag is in range. The tag is < SCBCOUNT if we add
+ * the complement of SCBCOUNT to the incomming tag and there is
+ * no carry.
+ */
+ mov A,COMP_SCBCOUNT;
+ add SINDEX,A,ARG_1;
+ jc not_found;
+
+.if ! ( SCB_PAGING )
+index_by_tag:
+ mov SCBPTR,ARG_1;
+ mov A, SAVED_TCL;
+ cmp SCB_TCL,A jne not_found;
+ test SCB_CONTROL,TAG_ENB jz not_found;
+ test SCB_CONTROL,DISCONNECTED jz not_found;
+.else
+/*
+ * Ensure that the SCB the tag points to is for an SCB transaction
+ * to the reconnecting target.
+ */
+use_findSCB:
+ mov ALLZEROS call findSCB; /* Have to search */
+ cmp SINDEX, SCB_LIST_NULL je not_found;
+.endif
+setup_SCB:
+ and SCB_CONTROL,~DISCONNECTED;
+ or SEQ_FLAGS,IDENTIFY_SEEN; /* make note of IDENTIFY */
+ jmp mesgin_done;
+
+not_found:
+ mvi INTSTAT, NO_MATCH;
+ mvi MSG_BUS_DEV_RESET call mk_mesg;
+ jmp mesgin_done;
+
+/*
+ * Message reject? Let the kernel driver handle this. If we have an
+ * outstanding WDTR or SDTR negotiation, assume that it's a response from
+ * the target selecting 8bit or asynchronous transfer, otherwise just ignore
+ * it since we have no clue what it pertains to.
+ */
+mesgin_reject:
+ mvi INTSTAT, REJECT_MSG;
+ jmp mesgin_done;
+
+/*
+ * [ ADD MORE MESSAGE HANDLING HERE ]
+ */
+
+/*
+ * Locking the driver out, build a one-byte message passed in SINDEX
+ * if there is no active message already. SINDEX is returned intact.
+ */
+mk_mesg:
+ mvi SEQCTL, PAUSEDIS|FASTMODE;
+ test MSG_LEN,0xff jz mk_mesg1; /* Should always succeed */
+
+ /*
+ * Hmmm. For some reason the mesg buffer is in use.
+ * Tell the driver. It should look at SINDEX to find
+ * out what we wanted to use the buffer for and resolve
+ * the conflict.
+ */
+ mvi SEQCTL,FASTMODE;
+ mvi INTSTAT,MSG_BUFFER_BUSY;
+
+mk_mesg1:
+ or SCSISIGO,ATNO,LASTPHASE;/* turn on ATNO */
+ mvi MSG_LEN,1; /* length = 1 */
+ mov MSG_OUT,SINDEX; /* 1-byte message */
+ mvi SEQCTL,FASTMODE ret;
+
+/*
+ * Functions to read data in Automatic PIO mode.
+ *
+ * According to Adaptec's documentation, an ACK is not sent on input from
+ * the target until SCSIDATL is read from. So we wait until SCSIDATL is
+ * latched (the usual way), then read the data byte directly off the bus
+ * using SCSIBUSL. When we have pulled the ATN line, or we just want to
+ * acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI
+ * spec guarantees that the target will hold the data byte on the bus until
+ * we send our ACK.
+ *
+ * The assumption here is that these are called in a particular sequence,
+ * and that REQ is already set when inb_first is called. inb_{first,next}
+ * use the same calling convention as inb.
+ */
+
+inb_next:
+ mov NONE,SCSIDATL; /*dummy read from latch to ACK*/
+inb_next_wait:
+ /*
+ * If there is a parity error, wait for the kernel to
+ * see the interrupt and prepare our message response
+ * before continuing.
+ */
+ test SSTAT1, REQINIT jz inb_next_wait;
+ test SSTAT1, SCSIPERR jnz inb_next_wait;
+ and LASTPHASE, PHASE_MASK, SCSISIGI;
+ cmp LASTPHASE, P_MESGIN jne mesgin_phasemis;
+inb_first:
+ mov DINDEX,SINDEX;
+ mov DINDIR,SCSIBUSL ret; /*read byte directly from bus*/
+inb_last:
+ mov NONE,SCSIDATL ret; /*dummy read from latch to ACK*/
+
+mesgin_phasemis:
+/*
+ * We expected to receive another byte, but the target changed phase
+ */
+ mvi INTSTAT, MSGIN_PHASEMIS;
+ jmp ITloop;
+
+/*
+ * DMA data transfer. HADDR and HCNT must be loaded first, and
+ * SINDEX should contain the value to load DFCNTRL with - 0x3d for
+ * host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared
+ * during initialization.
+ */
+dma:
+ mov DFCNTRL,SINDEX;
+dma_loop:
+ test SSTAT0,DMADONE jnz dma_dmadone;
+ test SSTAT1,PHASEMIS jz dma_loop; /* ie. underrun */
+dma_phasemis:
+ test SSTAT0,SDONE jnz dma_checkfifo;
+ mov SINDEX,ALLZEROS; /* Notify caller of phasemiss */
+
+/*
+ * We will be "done" DMAing when the transfer count goes to zero, or
+ * the target changes the phase (in light of this, it makes sense that
+ * the DMA circuitry doesn't ACK when PHASEMIS is active). If we are
+ * doing a SCSI->Host transfer, the data FIFO should be flushed auto-
+ * magically on STCNT=0 or a phase change, so just wait for FIFO empty
+ * status.
+ */
+dma_checkfifo:
+ test DFCNTRL,DIRECTION jnz dma_fifoempty;
+dma_fifoflush:
+ test DFSTATUS,FIFOEMP jz dma_fifoflush;
+
+dma_fifoempty:
+ /* Don't clobber an inprogress host data transfer */
+ test DFSTATUS, MREQPEND jnz dma_fifoempty;
+/*
+ * Now shut the DMA enables off and make sure that the DMA enables are
+ * actually off first lest we get an ILLSADDR.
+ */
+dma_dmadone:
+ and DFCNTRL, ~(SCSIEN|SDMAEN|HDMAEN);
+dma_halt:
+ test DFCNTRL, (SCSIEN|SDMAEN|HDMAEN) jnz dma_halt;
+return:
+ ret;
+
+/*
+ * Assert that if we've been reselected, then we've seen an IDENTIFY
+ * message.
+ */
+assert:
+ test SEQ_FLAGS,RESELECTED jz return; /* reselected? */
+ test SEQ_FLAGS,IDENTIFY_SEEN jnz return; /* seen IDENTIFY? */
+
+ mvi INTSTAT,NO_IDENT ret; /* no - tell the kernel */
+
+.if ( SCB_PAGING )
+/*
+ * Locate a disconnected SCB either by SAVED_TCL (ARG_1 is SCB_LIST_NULL)
+ * or by the SCBIDn ARG_1. The search begins at the SCB index passed in
+ * via SINDEX. If the SCB cannot be found, SINDEX will be SCB_LIST_NULL,
+ * otherwise, SCBPTR is set to the proper SCB.
+ */
+findSCB:
+ mov SCBPTR,SINDEX; /* switch to next SCB */
+ mov A, ARG_1; /* Tag passed in ARG_1 */
+ cmp SCB_TAG,A jne findSCB_loop;
+ test SCB_CONTROL,DISCONNECTED jnz foundSCB;/*should be disconnected*/
+findSCB_loop:
+ inc SINDEX;
+ mov A,SCBCOUNT;
+ cmp SINDEX,A jne findSCB;
+/*
+ * We didn't find it. If we're paging, pull an SCB and DMA down the
+ * one we want. If we aren't paging or the SCB we dma down has the
+ * abort flag set, return not found.
+ */
+ mov ALLZEROS call get_free_or_disc_scb;
+ mvi DMAPARAMS, HDMAEN|DIRECTION|FIFORESET;
+ mov ARG_1 call dma_scb;
+ test SCB_RESID_SGCNT, 0xff jz . + 2;
+ or SCB_CONTROL, MUST_DMAUP_SCB;
+ test SCB_CONTROL, ABORT_SCB jz return;
+find_error:
+ mvi SINDEX, SCB_LIST_NULL ret;
+foundSCB:
+ test SCB_CONTROL, ABORT_SCB jnz find_error;
+rem_scb_from_disc_list:
+/* Remove this SCB from the disconnection list */
+ cmp SCB_NEXT,SCB_LIST_NULL je unlink_prev;
+ mov SAVED_LINKPTR, SCB_PREV;
+ mov SCBPTR, SCB_NEXT;
+ mov SCB_PREV, SAVED_LINKPTR;
+ mov SCBPTR, SINDEX;
+unlink_prev:
+ cmp SCB_PREV,SCB_LIST_NULL je rHead;/* At the head of the list */
+ mov SAVED_LINKPTR, SCB_NEXT;
+ mov SCBPTR, SCB_PREV;
+ mov SCB_NEXT, SAVED_LINKPTR;
+ mov SCBPTR, SINDEX ret;
+rHead:
+ mov DISCONNECTED_SCBH,SCB_NEXT ret;
+.else
+ ret;
+.endif
+
+set_stcnt_from_hcnt:
+ mov STCNT[0], HCNT[0];
+ mov STCNT[1], HCNT[1];
+ mov STCNT[2], HCNT[2] ret;
+
+bcopy_7:
+ mov DINDIR, SINDIR;
+ mov DINDIR, SINDIR;
+bcopy_5:
+ mov DINDIR, SINDIR;
+bcopy_4:
+ mov DINDIR, SINDIR;
+bcopy_3:
+ mov DINDIR, SINDIR;
+ mov DINDIR, SINDIR;
+ mov DINDIR, SINDIR ret;
+
+dma_scb:
+ /*
+ * SCB index is in SINDEX. Determine the physical address in
+ * the host where this SCB is located and load HADDR with it.
+ */
+ shr DINDEX, 3, SINDEX;
+ shl A, 5, SINDEX;
+ add HADDR[0], A, HSCB_ADDR[0];
+ mov A, DINDEX;
+ adc HADDR[1], A, HSCB_ADDR[1];
+ clr A;
+ adc HADDR[2], A, HSCB_ADDR[2];
+ adc HADDR[3], A, HSCB_ADDR[3];
+ /* Setup Count */
+ mvi HCNT[0], 28;
+ clr HCNT[1];
+ clr HCNT[2];
+ mov DFCNTRL, DMAPARAMS;
+ test DMAPARAMS, DIRECTION jnz dma_scb_fromhost;
+ /* Fill it with the SCB data */
+copy_scb_tofifo:
+ mvi SINDEX, SCB_CONTROL;
+ add A, 28, SINDEX;
+copy_scb_tofifo_loop:
+ mov DFDAT,SINDIR;
+ mov DFDAT,SINDIR;
+ mov DFDAT,SINDIR;
+ mov DFDAT,SINDIR;
+ mov DFDAT,SINDIR;
+ mov DFDAT,SINDIR;
+ mov DFDAT,SINDIR;
+ cmp SINDEX, A jne copy_scb_tofifo_loop;
+ or DFCNTRL, HDMAEN|FIFOFLUSH;
+dma_scb_fromhost:
+ call dma_finish;
+ /* If we were putting the SCB, we are done */
+ test DMAPARAMS, DIRECTION jz return;
+ mvi SCB_CONTROL call dfdat_in_7;
+ call dfdat_in_7_continued;
+ call dfdat_in_7_continued;
+ jmp dfdat_in_7_continued;
+dfdat_in_7:
+ mov DINDEX,SINDEX;
+dfdat_in_7_continued:
+ mov DINDIR,DFDAT;
+ mov DINDIR,DFDAT;
+ mov DINDIR,DFDAT;
+ mov DINDIR,DFDAT;
+ mov DINDIR,DFDAT;
+ mov DINDIR,DFDAT;
+ mov DINDIR,DFDAT ret;
+
+/*
+ * Wait for DMA from host memory to data FIFO to complete, then disable
+ * DMA and wait for it to acknowledge that it's off.
+ */
+dma_finish:
+ test DFSTATUS,HDONE jz dma_finish;
+ /* Turn off DMA */
+ and DFCNTRL, ~HDMAEN;
+ test DFCNTRL, HDMAEN jnz .;
+ ret;
+
+index_untagged_scb:
+ mov DINDEX, SINDEX;
+ shr DINDEX, 4;
+ and DINDEX, 0x03; /* Bottom two bits of tid */
+ add DINDEX, SCB_BUSYTARGETS;
+ shr A, 6, SINDEX; /* Target ID divided by 4 */
+ test SINDEX, SELBUSB jz index_untagged_scb2;
+ add A, 2; /* Add 2 positions */
+index_untagged_scb2:
+ mov SCBPTR, A; /*
+ * Select the SCB with this
+ * target's information.
+ */
+ mov SINDEX, DINDEX ret;
+
+add_scb_to_free_list:
+ mov SCB_NEXT, FREE_SCBH;
+ mvi SCB_TAG, SCB_LIST_NULL;
+ mov FREE_SCBH, SCBPTR ret;
+
+.if ( SCB_PAGING )
+get_free_or_disc_scb:
+ cmp FREE_SCBH, SCB_LIST_NULL jne dequeue_free_scb;
+ cmp DISCONNECTED_SCBH, SCB_LIST_NULL jne dequeue_disc_scb;
+return_error:
+ mvi SINDEX, SCB_LIST_NULL ret;
+dequeue_disc_scb:
+ mov SCBPTR, DISCONNECTED_SCBH;
+/*
+ * If we have a residual, then we are in the middle of some I/O
+ * and we have to send this SCB back up to the kernel so that the
+ * saved data pointers and residual information isn't lost.
+ */
+ test SCB_CONTROL, MUST_DMAUP_SCB jz . + 3;
+ and SCB_CONTROL, ~MUST_DMAUP_SCB;
+ jmp dma_up_scb;
+ test SCB_RESID_SGCNT,0xff jnz dma_up_scb;
+ cmp SCB_LINKED_NEXT, SCB_LIST_NULL je unlink_disc_scb;
+dma_up_scb:
+ mvi DMAPARAMS, FIFORESET;
+ mov SCB_TAG call dma_scb;
+unlink_disc_scb:
+ /* jmp instead of call since we want to return anyway */
+ mov SCBPTR jmp rem_scb_from_disc_list;
+dequeue_free_scb:
+ mov SCBPTR, FREE_SCBH;
+ mov FREE_SCBH, SCB_NEXT ret;
+
+add_scb_to_disc_list:
+/*
+ * Link this SCB into the DISCONNECTED list. This list holds the
+ * candidates for paging out an SCB if one is needed for a new command.
+ * Modifying the disconnected list is a critical(pause dissabled) section.
+ */
+ mvi SCB_PREV, SCB_LIST_NULL;
+ mov SCB_NEXT, DISCONNECTED_SCBH;
+ mov DISCONNECTED_SCBH, SCBPTR;
+ cmp SCB_NEXT,SCB_LIST_NULL je return;
+ mov SCBPTR,SCB_NEXT;
+ mov SCB_PREV,DISCONNECTED_SCBH;
+ mov SCBPTR,DISCONNECTED_SCBH ret;
+.endif
diff --git a/drivers/scsi/aic7xxx/scsi_message.h b/drivers/scsi/aic7xxx/scsi_message.h
new file mode 100644
index 000000000..267a01591
--- /dev/null
+++ b/drivers/scsi/aic7xxx/scsi_message.h
@@ -0,0 +1,41 @@
+/*
+ * SCSI messages definitions.
+ */
+
+/* Messages (1 byte) */ /* I/T (M)andatory or (O)ptional */
+#define MSG_CMDCOMPLETE 0x00 /* M/M */
+#define MSG_EXTENDED 0x01 /* O/O */
+#define MSG_SAVEDATAPOINTER 0x02 /* O/O */
+#define MSG_RESTOREPOINTERS 0x03 /* O/O */
+#define MSG_DISCONNECT 0x04 /* O/O */
+#define MSG_INITIATOR_DET_ERR 0x05 /* M/M */
+#define MSG_ABORT 0x06 /* O/M */
+#define MSG_MESSAGE_REJECT 0x07 /* M/M */
+#define MSG_NOOP 0x08 /* M/M */
+#define MSG_PARITY_ERROR 0x09 /* M/M */
+#define MSG_LINK_CMD_COMPLETE 0x0a /* O/O */
+#define MSG_LINK_CMD_COMPLETEF 0x0b /* O/O */
+#define MSG_BUS_DEV_RESET 0x0c /* O/M */
+#define MSG_ABORT_TAG 0x0d /* O/O */
+#define MSG_CLEAR_QUEUE 0x0e /* O/O */
+#define MSG_INIT_RECOVERY 0x0f /* O/O */
+#define MSG_REL_RECOVERY 0x10 /* O/O */
+#define MSG_TERM_IO_PROC 0x11 /* O/O */
+
+/* Messages (2 byte) */
+#define MSG_SIMPLE_Q_TAG 0x20 /* O/O */
+#define MSG_HEAD_OF_Q_TAG 0x21 /* O/O */
+#define MSG_ORDERED_Q_TAG 0x22 /* O/O */
+#define MSG_IGN_WIDE_RESIDUE 0x23 /* O/O */
+
+/* Identify message */ /* M/M */
+#define MSG_IDENTIFYFLAG 0x80
+#define MSG_IDENTIFY(lun, disc) (((disc) ? 0xc0 : MSG_IDENTIFYFLAG) | (lun))
+#define MSG_ISIDENTIFY(m) ((m) & MSG_IDENTIFYFLAG)
+
+/* Extended messages (opcode and length) */
+#define MSG_EXT_SDTR 0x01
+#define MSG_EXT_SDTR_LEN 0x03
+
+#define MSG_EXT_WDTR 0x03
+#define MSG_EXT_WDTR_LEN 0x02
diff --git a/drivers/scsi/aic7xxx/sequencer.h b/drivers/scsi/aic7xxx/sequencer.h
new file mode 100644
index 000000000..dea901fe8
--- /dev/null
+++ b/drivers/scsi/aic7xxx/sequencer.h
@@ -0,0 +1,102 @@
+/*
+ * Instruction formats for the sequencer program downloaded to
+ * Aic7xxx SCSI host adapters
+ *
+ * Copyright (c) 1997 Justin T. Gibbs.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification, immediately at the beginning of the file.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Where this Software is combined with software released under the terms of
+ * the GNU Public License ("GPL") and the terms of the GPL would require the
+ * combined work to also be released under the terms of the GPL, the terms
+ * and conditions of this License will apply in addition to those of the
+ * GPL with the exception of any terms or conditions of this License that
+ * conflict with, or are expressly prohibited by, the GPL.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: sequencer.h,v 1.1 1997/08/05 09:44:13 ralf Exp $
+ */
+
+#if defined(__KERNEL__)
+typedef unsigned char u_int8_t;
+#endif
+
+struct ins_format1 {
+ u_int8_t immediate;
+ u_int8_t source;
+ u_int8_t destination;
+ u_int8_t opcode_ret;
+};
+
+struct ins_format2 {
+ u_int8_t shift_control;
+ u_int8_t source;
+ u_int8_t destination;
+ u_int8_t opcode_ret;
+#define RETURN_BIT 0x01
+};
+
+struct ins_format3 {
+ u_int8_t immediate;
+ u_int8_t source;
+ u_int8_t address;
+ u_int8_t opcode_addr;
+#define ADDR_HIGH_BIT 0x01
+};
+
+struct instruction {
+ union {
+ struct ins_format1 format1;
+ struct ins_format2 format2;
+ struct ins_format3 format3;
+ u_int8_t bytes[4];
+ } format;
+ u_int srcline;
+ struct symbol *patch_label;
+ struct {
+ struct instruction *stqe_next; /* next element */
+ } links;
+};
+
+#define AIC_OP_OR 0x0
+#define AIC_OP_AND 0x1
+#define AIC_OP_XOR 0x2
+#define AIC_OP_ADD 0x3
+#define AIC_OP_ADC 0x4
+#define AIC_OP_ROL 0x5
+
+#define AIC_OP_JMP 0x8
+#define AIC_OP_JC 0x9
+#define AIC_OP_JNC 0xa
+#define AIC_OP_CALL 0xb
+#define AIC_OP_JNE 0xc
+#define AIC_OP_JNZ 0xd
+#define AIC_OP_JE 0xe
+#define AIC_OP_JZ 0xf
+
+/* Pseudo Ops */
+#define AIC_OP_SHL 0x10
+#define AIC_OP_SHR 0x20
+#define AIC_OP_ROR 0x30
diff --git a/drivers/scsi/aic7xxx_proc.c b/drivers/scsi/aic7xxx_proc.c
index 5c766c039..dee247534 100644
--- a/drivers/scsi/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx_proc.c
@@ -24,7 +24,7 @@
*
* Dean W. Gehnert, deang@teleport.com, 05/01/96
*
- * $Id: aic7xxx_proc.c,v 1.2 1997/08/06 19:16:03 miguel Exp $
+ * $Id: aic7xxx_proc.c,v 4.1 1997/06/97 08:23:42 deang Exp $
*-M*************************************************************************/
#define BLS buffer + len + size
diff --git a/drivers/scsi/eata_dma.c b/drivers/scsi/eata_dma.c
index 11ff51b1a..104664463 100644
--- a/drivers/scsi/eata_dma.c
+++ b/drivers/scsi/eata_dma.c
@@ -259,7 +259,11 @@ void eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
sp = &SD(sh)->sp;
#ifdef __mips__
- cacheflush((unsigned long)sp, sizeof(struct eata_sp), CF_DCACHE|CF_ALL);
+ /*
+ * We flush too much, this should be something like:
+ * cacheflush_before_dma((unsigned long)sp, sizeof(struct eata_sp));
+ */
+ flush_cache_all();
#endif
ccb = sp->ccb;
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index aee77ba5c..0d65f36a9 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -70,10 +70,7 @@
*/
/*
- * $Log: g_NCR5380.c,v $
- * Revision 1.3 1997/06/17 13:25:29 ralf
- * Merge with 2.1.43.
- *
+ * $Log: generic_NCR5380.c,v $
*/
#define AUTOPROBE_IRQ
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 513ebf8ad..e67ec54b5 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -204,7 +204,7 @@
/*
-static const char RCSid[] = "$Header: /src/cvs/linux/drivers/scsi/hosts.c,v 1.1.1.1 1997/06/01 03:17:37 ralf Exp $";
+static const char RCSid[] = "$Header: /vger/u4/cvs/linux/drivers/scsi/hosts.c,v 1.20 1996/12/12 19:18:32 davem Exp $";
*/
/*
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1f0080bd9..a81df6241 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -66,7 +66,7 @@
#undef USE_STATIC_SCSI_MEMORY
/*
-static const char RCSid[] = "$Header: /src/cvs/linux/drivers/scsi/scsi.c,v 1.1.1.1 1997/06/01 03:17:37 ralf Exp $";
+static const char RCSid[] = "$Header: /vger/u4/cvs/linux/drivers/scsi/scsi.c,v 1.38 1997/01/19 23:07:18 davem Exp $";
*/
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index ed5b1ec97..ed95b9165 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -1,4 +1,4 @@
-/* $Id: sgiwd93.c,v 1.1.1.1 1997/06/01 03:17:36 ralf Exp $
+/* $Id: sgiwd93.c,v 1.7 1996/07/23 09:00:16 dm Exp $
* sgiwd93.c: SGI WD93 scsi driver.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 733a9e186..6d60d12ae 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -292,6 +292,7 @@ int wd33c93_queuecommand (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
Scsi_Cmnd *tmp;
unsigned long flags;
+ disable_irq(cmd->host->irq);
DB(DB_QCMD,printk("Q-%d-%02x-%ld( ",cmd->target,cmd->cmnd[0],cmd->pid));
/* Set up a few fields in the Scsi_Cmnd structure for our own use:
diff --git a/drivers/sgi/Makefile b/drivers/sgi/Makefile
index 466e477ca..40cb89eaa 100644
--- a/drivers/sgi/Makefile
+++ b/drivers/sgi/Makefile
@@ -17,6 +17,6 @@ L_TARGET := sgi.a
# Character devices for SGI machines.
#
SUB_DIRS += char
-L_OBJS += char/sgichar.o
+L_OBJS += char/sgichar.o
include $(TOPDIR)/Rules.make