1998-12-09 11:37:50 +03:00
|
|
|
/* $NetBSD: aic7xxxvar.h,v 1.19 1998/12/09 08:47:19 thorpej Exp $ */
|
1996-05-20 04:56:39 +04:00
|
|
|
|
1995-10-09 12:49:30 +03:00
|
|
|
/*
|
1996-05-16 07:59:03 +04:00
|
|
|
* Interface to the generic driver for the aic7xxx based adaptec
|
|
|
|
* SCSI controllers. This is used to implement product specific
|
1995-10-09 12:49:30 +03:00
|
|
|
* probe and attach routines.
|
|
|
|
*
|
1996-05-16 07:59:03 +04:00
|
|
|
* Copyright (c) 1994, 1995, 1996 Justin T. Gibbs.
|
1995-10-09 12:49:30 +03:00
|
|
|
* 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 immediately at the beginning of the file, without modification,
|
|
|
|
* this list of conditions, and the following disclaimer.
|
|
|
|
* 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.
|
1996-05-16 07:59:03 +04:00
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* 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.
|
1996-07-11 02:50:44 +04:00
|
|
|
*
|
|
|
|
* from Id: aic7xxx.h,v 1.28 1996/05/30 07:19:59 gibbs Exp
|
1995-10-09 12:49:30 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _AIC7XXX_H_
|
|
|
|
#define _AIC7XXX_H_
|
|
|
|
|
1996-05-16 07:59:03 +04:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#include "ahc.h" /* for NAHC from config */
|
|
|
|
#endif
|
|
|
|
|
1996-07-11 02:50:44 +04:00
|
|
|
#if defined(__NetBSD__)
|
1998-06-23 00:02:54 +04:00
|
|
|
|
|
|
|
#include "opt_ahc.h" /* For AHC_DEBUG, AHC_TAGENABLE, AHC_BROKEN_CACHE */
|
|
|
|
|
1996-07-11 02:50:44 +04:00
|
|
|
/*
|
|
|
|
* convert FreeBSD's <sys/queue.h> symbols to NetBSD's
|
|
|
|
*/
|
|
|
|
#define STAILQ_ENTRY SIMPLEQ_ENTRY
|
|
|
|
#define STAILQ_HEAD SIMPLEQ_HEAD
|
|
|
|
#define STAILQ_INIT SIMPLEQ_INIT
|
|
|
|
#define STAILQ_INSERT_HEAD SIMPLEQ_INSERT_HEAD
|
|
|
|
#define STAILQ_INSERT_TAIL SIMPLEQ_INSERT_TAIL
|
|
|
|
#define STAILQ_REMOVE_HEAD(head, field) \
|
|
|
|
SIMPLEQ_REMOVE_HEAD(head, (head)->sqh_first, field)
|
|
|
|
#define stqh_first sqh_first
|
|
|
|
#define stqe_next sqe_next
|
|
|
|
#endif
|
|
|
|
|
1996-05-16 07:59:03 +04:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#define AHC_INB(ahc, port) \
|
|
|
|
inb((ahc)->baseport+(port))
|
|
|
|
#define AHC_INSB(ahc, port, valp, size) \
|
|
|
|
insb((ahc)->baseport+(port), valp, size)
|
|
|
|
#define AHC_OUTB(ahc, port, val) \
|
|
|
|
outb((ahc)->baseport+(port), val)
|
|
|
|
#define AHC_OUTSB(ahc, port, valp, size) \
|
|
|
|
outsb((ahc)->baseport+(port), valp, size)
|
|
|
|
#define AHC_OUTSL(ahc, port, valp, size) \
|
|
|
|
outsl((ahc)->baseport+(port), valp, size)
|
|
|
|
#elif defined(__NetBSD__)
|
1998-04-16 11:13:57 +04:00
|
|
|
|
|
|
|
#ifndef __BUS_SPACE_HAS_STREAM_METHODS
|
|
|
|
#define bus_space_write_multi_stream_4 bus_space_write_multi_4
|
|
|
|
#endif
|
|
|
|
|
1996-05-16 07:59:03 +04:00
|
|
|
#define AHC_INB(ahc, port) \
|
1997-04-10 06:48:38 +04:00
|
|
|
bus_space_read_1((ahc)->sc_st, (ahc)->sc_sh, port)
|
1996-05-16 07:59:03 +04:00
|
|
|
#define AHC_INSB(ahc, port, valp, size) \
|
1997-04-10 06:48:38 +04:00
|
|
|
bus_space_read_multi_1((ahc)->sc_st, (ahc)->sc_sh, port, (u_int8_t *) valp, size)
|
1996-05-16 07:59:03 +04:00
|
|
|
#define AHC_OUTB(ahc, port, val) \
|
1997-04-10 06:48:38 +04:00
|
|
|
bus_space_write_1((ahc)->sc_st, (ahc)->sc_sh, port, val)
|
1996-05-16 07:59:03 +04:00
|
|
|
#define AHC_OUTSB(ahc, port, valp, size) \
|
1997-04-10 06:48:38 +04:00
|
|
|
bus_space_write_multi_1((ahc)->sc_st, (ahc)->sc_sh, port, (u_int8_t *) valp, size)
|
1996-05-16 07:59:03 +04:00
|
|
|
#define AHC_OUTSL(ahc, port, valp, size) \
|
1998-04-16 11:13:57 +04:00
|
|
|
bus_space_write_multi_stream_4((ahc)->sc_st, (ahc)->sc_sh, port, (u_int32_t *) valp, size)
|
1996-05-16 07:59:03 +04:00
|
|
|
#endif
|
|
|
|
|
1995-10-09 12:49:30 +03:00
|
|
|
#define AHC_NSEG 256 /* number of dma segments supported */
|
|
|
|
|
1996-05-16 07:59:03 +04:00
|
|
|
#define AHC_SCB_MAX 255 /*
|
|
|
|
* Up to 255 SCBs on some types of aic7xxx
|
|
|
|
* based boards. The aic7870 have 16 internal
|
|
|
|
* SCBs, but external SRAM bumps this to 255.
|
|
|
|
* The aic7770 family have only 4, and the
|
|
|
|
* aic7850 has only 3.
|
1995-10-09 12:49:30 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
dev/microcode/aic7xxx/aic7xxx.seq,
dev/microcode/aic7xxx_seq.h,
dev/ic/aic7xxxreg.h:
Remove intrinsic knowledge about SDTR and WDTR messages and replace it
with a generic message system that allows the kernel driver to handle
SDTR, WDTR and any other type of extended message it chooses too. This
makes the sequencer code much simpler, makes extended message handling
debuggable since the bulk of the work is in the kernel driver, and saves
lots of instruction space.
Regen microcode header file.
dev/ic/aic7xxx.c, dev/ic/aic7xxxvar.h:
Add code to handle WDTR and SDTR negotiation in light of the changes in
the message interface to the sequencer. Don't reject targets that
negotiate async by sending an SDTR with a 0 offset. Use an sdtr message
with 0,0 to negotiate async when a target suggests a period that is too
long for us to handle. Some tape and cdrom drives don't like us doing
the message reject that we did in the past.
Fix a problem with handing the QUEUE FULL condition.
Fix a race condition (most likely the cause of the SCB paging problems) that
might allow the sequencer to get unpaused before the condition that caused
it to be paused (a SEQINT) was handled.
Race condition pointed out by Doug Ledford <dledford@dialnet.net> and
by "Dan Willis" <dan@plutotech.com>.
dev/pci/ahc_pci.c:
Add support for the 2940AU, an aic7860 based controller.
dev/pci/pcidevs.h, dev/pci/pcidevs_data.h:
Add product IDs for the 2940AU, aic7860 and aic7855.
Regen data file.
scsi/scsi_message.h:
Add MSG_EXT_SDTR_LEN and MSG_EXT_WDTR_LEN - the length of bytes in these
extended messages.
Thanks to Chuck Cranor <chuck@maria.wustl.edu> for testing these changes
out for me.
1996-10-08 07:04:02 +04:00
|
|
|
typedef u_int32_t physaddr;
|
1996-05-16 07:59:03 +04:00
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
extern u_long ahc_unit;
|
|
|
|
#endif
|
1995-10-09 12:49:30 +03:00
|
|
|
|
|
|
|
struct ahc_dma_seg {
|
dev/microcode/aic7xxx/aic7xxx.seq,
dev/microcode/aic7xxx_seq.h,
dev/ic/aic7xxxreg.h:
Remove intrinsic knowledge about SDTR and WDTR messages and replace it
with a generic message system that allows the kernel driver to handle
SDTR, WDTR and any other type of extended message it chooses too. This
makes the sequencer code much simpler, makes extended message handling
debuggable since the bulk of the work is in the kernel driver, and saves
lots of instruction space.
Regen microcode header file.
dev/ic/aic7xxx.c, dev/ic/aic7xxxvar.h:
Add code to handle WDTR and SDTR negotiation in light of the changes in
the message interface to the sequencer. Don't reject targets that
negotiate async by sending an SDTR with a 0 offset. Use an sdtr message
with 0,0 to negotiate async when a target suggests a period that is too
long for us to handle. Some tape and cdrom drives don't like us doing
the message reject that we did in the past.
Fix a problem with handing the QUEUE FULL condition.
Fix a race condition (most likely the cause of the SCB paging problems) that
might allow the sequencer to get unpaused before the condition that caused
it to be paused (a SEQINT) was handled.
Race condition pointed out by Doug Ledford <dledford@dialnet.net> and
by "Dan Willis" <dan@plutotech.com>.
dev/pci/ahc_pci.c:
Add support for the 2940AU, an aic7860 based controller.
dev/pci/pcidevs.h, dev/pci/pcidevs_data.h:
Add product IDs for the 2940AU, aic7860 and aic7855.
Regen data file.
scsi/scsi_message.h:
Add MSG_EXT_SDTR_LEN and MSG_EXT_WDTR_LEN - the length of bytes in these
extended messages.
Thanks to Chuck Cranor <chuck@maria.wustl.edu> for testing these changes
out for me.
1996-10-08 07:04:02 +04:00
|
|
|
physaddr addr;
|
|
|
|
u_int32_t len;
|
1995-10-09 12:49:30 +03:00
|
|
|
};
|
1996-05-16 07:59:03 +04:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
AHC_NONE = 0x000,
|
|
|
|
AHC_ULTRA = 0x001, /* Supports 20MHz Transfers */
|
|
|
|
AHC_WIDE = 0x002, /* Wide Channel */
|
|
|
|
AHC_TWIN = 0x008, /* Twin Channel */
|
|
|
|
AHC_AIC7770 = 0x010,
|
|
|
|
AHC_AIC7850 = 0x020,
|
|
|
|
AHC_AIC7860 = 0x021, /* ULTRA version of the aic7850 */
|
|
|
|
AHC_AIC7870 = 0x040,
|
|
|
|
AHC_AIC7880 = 0x041,
|
|
|
|
AHC_AIC78X0 = 0x060, /* PCI Based Controller */
|
|
|
|
AHC_274 = 0x110, /* EISA Based Controller */
|
|
|
|
AHC_284 = 0x210, /* VL/ISA Based Controller */
|
dev/microcode/aic7xxx/aic7xxx.seq,
dev/microcode/aic7xxx_seq.h,
dev/ic/aic7xxxreg.h:
Remove intrinsic knowledge about SDTR and WDTR messages and replace it
with a generic message system that allows the kernel driver to handle
SDTR, WDTR and any other type of extended message it chooses too. This
makes the sequencer code much simpler, makes extended message handling
debuggable since the bulk of the work is in the kernel driver, and saves
lots of instruction space.
Regen microcode header file.
dev/ic/aic7xxx.c, dev/ic/aic7xxxvar.h:
Add code to handle WDTR and SDTR negotiation in light of the changes in
the message interface to the sequencer. Don't reject targets that
negotiate async by sending an SDTR with a 0 offset. Use an sdtr message
with 0,0 to negotiate async when a target suggests a period that is too
long for us to handle. Some tape and cdrom drives don't like us doing
the message reject that we did in the past.
Fix a problem with handing the QUEUE FULL condition.
Fix a race condition (most likely the cause of the SCB paging problems) that
might allow the sequencer to get unpaused before the condition that caused
it to be paused (a SEQINT) was handled.
Race condition pointed out by Doug Ledford <dledford@dialnet.net> and
by "Dan Willis" <dan@plutotech.com>.
dev/pci/ahc_pci.c:
Add support for the 2940AU, an aic7860 based controller.
dev/pci/pcidevs.h, dev/pci/pcidevs_data.h:
Add product IDs for the 2940AU, aic7860 and aic7855.
Regen data file.
scsi/scsi_message.h:
Add MSG_EXT_SDTR_LEN and MSG_EXT_WDTR_LEN - the length of bytes in these
extended messages.
Thanks to Chuck Cranor <chuck@maria.wustl.edu> for testing these changes
out for me.
1996-10-08 07:04:02 +04:00
|
|
|
AHC_294AU = 0x421, /* aic7860 based '2940' */
|
1996-05-16 07:59:03 +04:00
|
|
|
AHC_294 = 0x440, /* PCI Based Controller */
|
|
|
|
AHC_294U = 0x441, /* ULTRA PCI Based Controller */
|
|
|
|
AHC_394 = 0x840, /* Twin Channel PCI Controller */
|
|
|
|
AHC_394U = 0x841, /* Twin, ULTRA Channel PCI Controller */
|
|
|
|
}ahc_type;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
AHC_FNONE = 0x00,
|
|
|
|
AHC_INIT = 0x01,
|
|
|
|
AHC_RUNNING = 0x02,
|
|
|
|
AHC_PAGESCBS = 0x04, /* Enable SCB paging */
|
|
|
|
AHC_CHANNEL_B_PRIMARY = 0x08, /*
|
|
|
|
* On twin channel adapters, probe
|
|
|
|
* channel B first since it is the
|
|
|
|
* primary bus.
|
|
|
|
*/
|
|
|
|
AHC_USEDEFAULTS = 0x10, /*
|
|
|
|
* For cards without an seeprom
|
|
|
|
* or a BIOS to initialize the chip's
|
|
|
|
* SRAM, we use the default target
|
|
|
|
* settings.
|
|
|
|
*/
|
|
|
|
AHC_CHNLB = 0x20, /*
|
|
|
|
* Second controller on 3940
|
|
|
|
* Also encodes the offset in the
|
|
|
|
* SEEPROM for CHNLB info (32)
|
|
|
|
*/
|
|
|
|
}ahc_flag;
|
|
|
|
|
|
|
|
typedef enum {
|
dev/microcode/aic7xxx/aic7xxx.seq,
dev/microcode/aic7xxx_seq.h,
dev/ic/aic7xxxreg.h:
Remove intrinsic knowledge about SDTR and WDTR messages and replace it
with a generic message system that allows the kernel driver to handle
SDTR, WDTR and any other type of extended message it chooses too. This
makes the sequencer code much simpler, makes extended message handling
debuggable since the bulk of the work is in the kernel driver, and saves
lots of instruction space.
Regen microcode header file.
dev/ic/aic7xxx.c, dev/ic/aic7xxxvar.h:
Add code to handle WDTR and SDTR negotiation in light of the changes in
the message interface to the sequencer. Don't reject targets that
negotiate async by sending an SDTR with a 0 offset. Use an sdtr message
with 0,0 to negotiate async when a target suggests a period that is too
long for us to handle. Some tape and cdrom drives don't like us doing
the message reject that we did in the past.
Fix a problem with handing the QUEUE FULL condition.
Fix a race condition (most likely the cause of the SCB paging problems) that
might allow the sequencer to get unpaused before the condition that caused
it to be paused (a SEQINT) was handled.
Race condition pointed out by Doug Ledford <dledford@dialnet.net> and
by "Dan Willis" <dan@plutotech.com>.
dev/pci/ahc_pci.c:
Add support for the 2940AU, an aic7860 based controller.
dev/pci/pcidevs.h, dev/pci/pcidevs_data.h:
Add product IDs for the 2940AU, aic7860 and aic7855.
Regen data file.
scsi/scsi_message.h:
Add MSG_EXT_SDTR_LEN and MSG_EXT_WDTR_LEN - the length of bytes in these
extended messages.
Thanks to Chuck Cranor <chuck@maria.wustl.edu> for testing these changes
out for me.
1996-10-08 07:04:02 +04:00
|
|
|
SCB_FREE = 0x0000,
|
|
|
|
SCB_ACTIVE = 0x0001,
|
|
|
|
SCB_ABORTED = 0x0002,
|
|
|
|
SCB_DEVICE_RESET = 0x0004,
|
|
|
|
SCB_IMMED = 0x0008,
|
|
|
|
SCB_SENSE = 0x0010,
|
|
|
|
SCB_TIMEDOUT = 0x0020,
|
|
|
|
SCB_QUEUED_FOR_DONE = 0x0040,
|
|
|
|
SCB_PAGED_OUT = 0x0080,
|
|
|
|
SCB_WAITINGQ = 0x0100,
|
|
|
|
SCB_ASSIGNEDQ = 0x0200,
|
|
|
|
SCB_SENTORDEREDTAG = 0x0400,
|
|
|
|
SCB_MSGOUT_SDTR = 0x0800,
|
|
|
|
SCB_MSGOUT_WDTR = 0x1000
|
1996-05-16 07:59:03 +04:00
|
|
|
}scb_flag;
|
1995-10-09 12:49:30 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The driver keeps up to MAX_SCB scb structures per card in memory. Only the
|
1996-05-16 07:59:03 +04:00
|
|
|
* first 28 bytes of the structure need to be transfered to the card during
|
|
|
|
* normal operation. The fields starting at byte 28 are used for kernel level
|
|
|
|
* bookkeeping.
|
1995-10-09 12:49:30 +03:00
|
|
|
*/
|
1996-05-16 07:59:03 +04:00
|
|
|
struct scb {
|
1995-10-09 12:49:30 +03:00
|
|
|
/* ------------ Begin hardware supported fields ---------------- */
|
1996-05-16 07:59:03 +04:00
|
|
|
/*0*/ u_char control;
|
|
|
|
/*1*/ u_char tcl; /* 4/1/3 bits */
|
|
|
|
/*2*/ u_char status;
|
1995-10-09 12:49:30 +03:00
|
|
|
/*3*/ u_char SG_segment_count;
|
1996-05-16 07:59:03 +04:00
|
|
|
/*4*/ physaddr SG_list_pointer;
|
|
|
|
/*8*/ u_char residual_SG_segment_count;
|
|
|
|
/*9*/ u_char residual_data_count[3];
|
|
|
|
/*12*/ physaddr data;
|
dev/microcode/aic7xxx/aic7xxx.seq,
dev/microcode/aic7xxx_seq.h,
dev/ic/aic7xxxreg.h:
Remove intrinsic knowledge about SDTR and WDTR messages and replace it
with a generic message system that allows the kernel driver to handle
SDTR, WDTR and any other type of extended message it chooses too. This
makes the sequencer code much simpler, makes extended message handling
debuggable since the bulk of the work is in the kernel driver, and saves
lots of instruction space.
Regen microcode header file.
dev/ic/aic7xxx.c, dev/ic/aic7xxxvar.h:
Add code to handle WDTR and SDTR negotiation in light of the changes in
the message interface to the sequencer. Don't reject targets that
negotiate async by sending an SDTR with a 0 offset. Use an sdtr message
with 0,0 to negotiate async when a target suggests a period that is too
long for us to handle. Some tape and cdrom drives don't like us doing
the message reject that we did in the past.
Fix a problem with handing the QUEUE FULL condition.
Fix a race condition (most likely the cause of the SCB paging problems) that
might allow the sequencer to get unpaused before the condition that caused
it to be paused (a SEQINT) was handled.
Race condition pointed out by Doug Ledford <dledford@dialnet.net> and
by "Dan Willis" <dan@plutotech.com>.
dev/pci/ahc_pci.c:
Add support for the 2940AU, an aic7860 based controller.
dev/pci/pcidevs.h, dev/pci/pcidevs_data.h:
Add product IDs for the 2940AU, aic7860 and aic7855.
Regen data file.
scsi/scsi_message.h:
Add MSG_EXT_SDTR_LEN and MSG_EXT_WDTR_LEN - the length of bytes in these
extended messages.
Thanks to Chuck Cranor <chuck@maria.wustl.edu> for testing these changes
out for me.
1996-10-08 07:04:02 +04:00
|
|
|
/*16*/ u_int32_t datalen; /* Really only three bits, but its
|
1996-05-16 07:59:03 +04:00
|
|
|
* faster to treat it as a long on
|
|
|
|
* a quad boundary.
|
1995-10-09 12:49:30 +03:00
|
|
|
*/
|
1996-05-16 07:59:03 +04:00
|
|
|
/*20*/ physaddr cmdpointer;
|
|
|
|
/*24*/ u_char cmdlen;
|
|
|
|
/*25*/ u_char tag; /* Index into our kernel SCB array.
|
|
|
|
* Also used as the tag for tagged I/O
|
1995-10-09 12:49:30 +03:00
|
|
|
*/
|
1996-05-16 07:59:03 +04:00
|
|
|
#define SCB_PIO_TRANSFER_SIZE 26 /* amount we need to upload/download
|
|
|
|
* via PIO to initialize a transaction.
|
1995-10-09 12:49:30 +03:00
|
|
|
*/
|
1996-05-16 07:59:03 +04:00
|
|
|
/*26*/ u_char next; /* Used for threading SCBs in the
|
|
|
|
* "Waiting for Selection" and
|
|
|
|
* "Disconnected SCB" lists down
|
|
|
|
* in the sequencer.
|
|
|
|
*/
|
|
|
|
/*27*/ u_char prev;
|
|
|
|
/*-----------------end of hardware supported fields----------------*/
|
1996-07-11 02:50:44 +04:00
|
|
|
STAILQ_ENTRY(scb) links; /* for chaining */
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_xfer *xs; /* the scsipi_xfer for this cmd */
|
1996-05-16 07:59:03 +04:00
|
|
|
scb_flag flags;
|
|
|
|
u_char position; /* Position in card's scbarray */
|
1997-03-13 03:38:48 +03:00
|
|
|
struct ahc_dma_seg ahc_dma[AHC_NSEG];
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_sense sense_cmd; /* SCSI command block */
|
1998-03-16 18:36:17 +03:00
|
|
|
|
|
|
|
#if defined(__NetBSD__)
|
|
|
|
/*
|
|
|
|
* This DMA map maps the buffer involved in the transfer.
|
|
|
|
* Its contents are loaded into "ahc_dma" above.
|
|
|
|
*/
|
|
|
|
bus_dmamap_t dmamap_xfer;
|
|
|
|
|
|
|
|
struct scsi_generic scsi_cmd; /* dma-able copy of xs->cmd */
|
|
|
|
struct scsipi_sense_data scsi_sense;
|
|
|
|
#endif
|
1995-10-09 12:49:30 +03:00
|
|
|
};
|
|
|
|
|
1996-05-16 07:59:03 +04:00
|
|
|
struct ahc_data {
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
int unit;
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
struct device sc_dev;
|
|
|
|
void *sc_ih;
|
1997-04-10 06:48:38 +04:00
|
|
|
bus_space_tag_t sc_st;
|
|
|
|
bus_space_handle_t sc_sh;
|
1998-03-16 18:36:17 +03:00
|
|
|
bus_dma_tag_t sc_dt;
|
|
|
|
int sc_dmaflags;
|
|
|
|
|
|
|
|
bus_dmamap_t sc_dmamap_control; /* Maps the control blocks */
|
1998-12-09 11:37:50 +03:00
|
|
|
TAILQ_HEAD(, scsipi_xfer) sc_q; /* XXX software request queue */
|
1995-10-09 12:49:30 +03:00
|
|
|
#endif
|
|
|
|
ahc_type type;
|
1996-05-16 07:59:03 +04:00
|
|
|
ahc_flag flags;
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
u_long baseport;
|
|
|
|
#endif
|
|
|
|
struct scb *scbarray[AHC_SCB_MAX]; /* Mirror boards scbarray */
|
|
|
|
struct scb *pagedout_ntscbs[16];/*
|
|
|
|
* Paged out, non-tagged scbs
|
|
|
|
* indexed by target.
|
|
|
|
*/
|
1996-07-11 02:50:44 +04:00
|
|
|
STAILQ_HEAD(, scb) free_scbs; /*
|
1996-05-16 07:59:03 +04:00
|
|
|
* SCBs assigned to free slots
|
|
|
|
* on the card. (no paging required)
|
|
|
|
*/
|
1996-07-11 02:50:44 +04:00
|
|
|
STAILQ_HEAD(, scb) page_scbs; /*
|
1996-05-16 07:59:03 +04:00
|
|
|
* SCBs that will require paging
|
|
|
|
* before use (no assigned slot)
|
|
|
|
*/
|
1996-07-11 02:50:44 +04:00
|
|
|
STAILQ_HEAD(, scb) waiting_scbs;/*
|
1996-05-16 07:59:03 +04:00
|
|
|
* SCBs waiting to be paged in
|
|
|
|
* and started.
|
|
|
|
*/
|
1996-07-11 02:50:44 +04:00
|
|
|
STAILQ_HEAD(, scb)assigned_scbs;/*
|
1996-05-16 07:59:03 +04:00
|
|
|
* SCBs that were waiting but have
|
|
|
|
* now been assigned a slot by
|
|
|
|
* ahc_free_scb.
|
|
|
|
*/
|
1997-08-27 15:22:52 +04:00
|
|
|
#ifdef __NetBSD__
|
|
|
|
struct scsipi_link sc_link;
|
|
|
|
struct scsipi_link sc_link_b; /* Second bus for Twin channel cards */
|
1998-11-20 00:43:00 +03:00
|
|
|
struct scsipi_adapter sc_adapter;
|
1997-08-27 15:22:52 +04:00
|
|
|
#else
|
1995-10-09 12:49:30 +03:00
|
|
|
struct scsi_link sc_link;
|
|
|
|
struct scsi_link sc_link_b; /* Second bus for Twin channel cards */
|
1997-08-27 15:22:52 +04:00
|
|
|
#endif
|
1995-10-09 12:49:30 +03:00
|
|
|
u_short needsdtr_orig; /* Targets we initiate sync neg with */
|
|
|
|
u_short needwdtr_orig; /* Targets we initiate wide neg with */
|
|
|
|
u_short needsdtr; /* Current list of negotiated targets */
|
|
|
|
u_short needwdtr; /* Current list of negotiated targets */
|
|
|
|
u_short sdtrpending; /* Pending SDTR to these targets */
|
|
|
|
u_short wdtrpending; /* Pending WDTR to these targets */
|
|
|
|
u_short tagenable; /* Targets that can handle tagqueing */
|
1996-05-16 07:59:03 +04:00
|
|
|
u_short orderedtag; /* Targets to use ordered tag on */
|
|
|
|
u_short discenable; /* Targets allowed to disconnect */
|
|
|
|
u_char our_id; /* our scsi id */
|
|
|
|
u_char our_id_b; /* B channel scsi id */
|
|
|
|
u_char numscbs;
|
|
|
|
u_char activescbs;
|
|
|
|
u_char maxhscbs; /* Number of SCBs on the card */
|
|
|
|
u_char maxscbs; /*
|
|
|
|
* Max SCBs we allocate total including
|
|
|
|
* any that will force us to page SCBs
|
|
|
|
*/
|
|
|
|
u_char qcntmask;
|
1995-10-09 12:49:30 +03:00
|
|
|
u_char unpause;
|
|
|
|
u_char pause;
|
1996-05-16 07:59:03 +04:00
|
|
|
u_char in_timeout;
|
1995-10-09 12:49:30 +03:00
|
|
|
};
|
|
|
|
|
1996-05-16 07:59:03 +04:00
|
|
|
/* #define AHC_DEBUG */
|
|
|
|
#ifdef AHC_DEBUG
|
|
|
|
/* Different debugging levels used when AHC_DEBUG is defined */
|
|
|
|
#define AHC_SHOWMISC 0x0001
|
|
|
|
#define AHC_SHOWCMDS 0x0002
|
|
|
|
#define AHC_SHOWSCBS 0x0004
|
|
|
|
#define AHC_SHOWABORTS 0x0008
|
|
|
|
#define AHC_SHOWSENSE 0x0010
|
|
|
|
#define AHC_SHOWSCBCNT 0x0020
|
|
|
|
|
|
|
|
extern int ahc_debug; /* Initialized in i386/scsi/aic7xxx.c */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
|
|
|
|
char *ahc_name __P((struct ahc_data *ahc));
|
|
|
|
|
|
|
|
void ahc_reset __P((u_long iobase));
|
|
|
|
struct ahc_data *ahc_alloc __P((int unit, u_long io_base, ahc_type type, ahc_flag flags));
|
|
|
|
#elif defined(__NetBSD__)
|
|
|
|
|
|
|
|
#define ahc_name(ahc) (ahc)->sc_dev.dv_xname
|
|
|
|
|
1997-04-10 06:48:38 +04:00
|
|
|
void ahc_reset __P((char *devname, bus_space_tag_t st,
|
|
|
|
bus_space_handle_t sh));
|
|
|
|
void ahc_construct __P((struct ahc_data *ahc, bus_space_tag_t st,
|
1998-03-16 18:36:17 +03:00
|
|
|
bus_space_handle_t sh, bus_dma_tag_t dt, ahc_type type,
|
|
|
|
ahc_flag flags));
|
1996-05-16 07:59:03 +04:00
|
|
|
#endif
|
1996-10-22 02:24:37 +04:00
|
|
|
void ahc_free __P((struct ahc_data *));
|
|
|
|
int ahc_init __P((struct ahc_data *));
|
|
|
|
int ahc_attach __P((struct ahc_data *));
|
1996-05-16 07:59:03 +04:00
|
|
|
#if defined(__FreeBSD__)
|
1996-10-22 02:24:37 +04:00
|
|
|
void ahc_intr __P((void *arg));
|
1996-05-16 07:59:03 +04:00
|
|
|
#elif defined(__NetBSD__)
|
1996-10-22 02:24:37 +04:00
|
|
|
int ahc_intr __P((void *arg));
|
1996-05-16 07:59:03 +04:00
|
|
|
#endif
|
|
|
|
|
1995-10-09 12:49:30 +03:00
|
|
|
#endif /* _AIC7XXX_H_ */
|