⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aic79xx.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * Core definitions and data structures shareable across OS platforms. * * Copyright (c) 1994-2002 Justin T. Gibbs. * Copyright (c) 2000-2002 Adaptec Inc. * 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. * 2. Redistributions in binary form must reproduce at minimum a disclaimer *    substantially similar to the "NO WARRANTY" disclaimer below *    ("Disclaimer") and any redistribution must be conditioned upon *    including a substantially similar Disclaimer requirement for further *    binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names *    of any contributors may be used to endorse or promote products derived *    from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. * * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#95 $ * * $FreeBSD$ */#ifndef _AIC79XX_H_#define _AIC79XX_H_/* Register Definitions */#include "aic79xx_reg.h"/************************* Forward Declarations *******************************/struct ahd_platform_data;struct scb_platform_data;/****************************** Useful Macros *********************************/#ifndef MAX#define MAX(a,b) (((a) > (b)) ? (a) : (b))#endif#ifndef MIN#define MIN(a,b) (((a) < (b)) ? (a) : (b))#endif#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(*array))#define ALL_CHANNELS '\0'#define ALL_TARGETS_MASK 0xFFFF#define INITIATOR_WILDCARD	(~0)#define	SCB_LIST_NULL		0xFF00#define	SCB_LIST_NULL_LE	(ahd_htole16(SCB_LIST_NULL))#define QOUTFIFO_ENTRY_VALID 0x8000#define QOUTFIFO_ENTRY_VALID_LE (ahd_htole16(0x8000))#define SCBID_IS_NULL(scbid) (((scbid) & 0xFF00 ) == SCB_LIST_NULL)#define SCSIID_TARGET(ahd, scsiid)	\	(((scsiid) & TID) >> TID_SHIFT)#define SCSIID_OUR_ID(scsiid)		\	((scsiid) & OID)#define SCSIID_CHANNEL(ahd, scsiid) ('A')#define	SCB_IS_SCSIBUS_B(ahd, scb) (0)#define	SCB_GET_OUR_ID(scb) \	SCSIID_OUR_ID((scb)->hscb->scsiid)#define	SCB_GET_TARGET(ahd, scb) \	SCSIID_TARGET((ahd), (scb)->hscb->scsiid)#define	SCB_GET_CHANNEL(ahd, scb) \	SCSIID_CHANNEL(ahd, (scb)->hscb->scsiid)#define	SCB_GET_LUN(scb) \	((scb)->hscb->lun)#define SCB_GET_TARGET_OFFSET(ahd, scb)	\	SCB_GET_TARGET(ahd, scb)#define SCB_GET_TARGET_MASK(ahd, scb) \	(0x01 << (SCB_GET_TARGET_OFFSET(ahd, scb)))#ifdef AHD_DEBUG#define SCB_IS_SILENT(scb)					\	((ahd_debug & AHD_SHOW_MASKED_ERRORS) == 0		\      && (((scb)->flags & SCB_SILENT) != 0))#else#define SCB_IS_SILENT(scb)					\	(((scb)->flags & SCB_SILENT) != 0)#endif/* * TCLs have the following format: TTTTLLLLLLLL */#define TCL_TARGET_OFFSET(tcl) \	((((tcl) >> 4) & TID) >> 4)#define TCL_LUN(tcl) \	(tcl & (AHD_NUM_LUNS - 1))#define BUILD_TCL(scsiid, lun) \	((lun) | (((scsiid) & TID) << 4))#define BUILD_TCL_RAW(target, channel, lun) \	((lun) | ((target) << 8))#define SCB_GET_TAG(scb) \	ahd_le16toh(scb->hscb->tag)#ifndef	AHD_TARGET_MODE#undef	AHD_TMODE_ENABLE#define	AHD_TMODE_ENABLE 0#endif#define AHD_BUILD_COL_IDX(target, lun)				\	(((lun) << 4) | target)#define AHD_GET_SCB_COL_IDX(ahd, scb)				\	((SCB_GET_LUN(scb) << 4) | SCB_GET_TARGET(ahd, scb))#define AHD_SET_SCB_COL_IDX(scb, col_idx)				\do {									\	(scb)->hscb->scsiid = ((col_idx) << TID_SHIFT) & TID;		\	(scb)->hscb->lun = ((col_idx) >> 4) & (AHD_NUM_LUNS_NONPKT-1);	\} while (0)#define AHD_COPY_SCB_COL_IDX(dst, src)				\do {								\	dst->hscb->scsiid = src->hscb->scsiid;			\	dst->hscb->lun = src->hscb->lun;			\} while (0)#define	AHD_NEVER_COL_IDX 0xFFFF/**************************** Driver Constants ********************************//* * The maximum number of supported targets. */#define AHD_NUM_TARGETS 16/* * The maximum number of supported luns. * The identify message only supports 64 luns in non-packetized transfers. * You can have 2^64 luns when information unit transfers are enabled, * but until we see a need to support that many, we support 256. */#define AHD_NUM_LUNS_NONPKT 64#define AHD_NUM_LUNS 256/* * The maximum transfer per S/G segment. */#define AHD_MAXTRANSFER_SIZE	 0x00ffffff	/* limited by 24bit counter *//* * The maximum amount of SCB storage in hardware on a controller. * This value represents an upper bound.  Due to software design, * we may not be able to use this number. */#define AHD_SCB_MAX	512/* * The maximum number of concurrent transactions supported per driver instance. * Sequencer Control Blocks (SCBs) store per-transaction information. */#define AHD_MAX_QUEUE	AHD_SCB_MAX/* * Define the size of our QIN and QOUT FIFOs.  They must be a power of 2 * in size and accommodate as many transactions as can be queued concurrently. */#define	AHD_QIN_SIZE	AHD_MAX_QUEUE#define	AHD_QOUT_SIZE	AHD_MAX_QUEUE#define AHD_QIN_WRAP(x) ((x) & (AHD_QIN_SIZE-1))/* * The maximum amount of SCB storage we allocate in host memory. */#define AHD_SCB_MAX_ALLOC AHD_MAX_QUEUE/* * Ring Buffer of incoming target commands. * We allocate 256 to simplify the logic in the sequencer * by using the natural wrap point of an 8bit counter. */#define AHD_TMODE_CMDS	256/* Reset line assertion time in us */#define AHD_BUSRESET_DELAY	25/******************* Chip Characteristics/Operating Settings  *****************//* * Chip Type * The chip order is from least sophisticated to most sophisticated. */typedef enum {	AHD_NONE	= 0x0000,	AHD_CHIPID_MASK	= 0x00FF,	AHD_AIC7901	= 0x0001,	AHD_AIC7902	= 0x0002,	AHD_AIC7901A	= 0x0003,	AHD_PCI		= 0x0100,	/* Bus type PCI */	AHD_PCIX	= 0x0200,	/* Bus type PCIX */	AHD_BUS_MASK	= 0x0F00} ahd_chip;/* * Features available in each chip type. */typedef enum {	AHD_FENONE		= 0x00000,	AHD_WIDE  		= 0x00001,/* Wide Channel */	AHD_MULTI_FUNC		= 0x00100,/* Multi-Function/Channel Device */	AHD_TARGETMODE		= 0x01000,/* Has tested target mode support */	AHD_MULTIROLE		= 0x02000,/* Space for two roles at a time */	AHD_RTI			= 0x04000,/* Retained Training Support */	AHD_NEW_IOCELL_OPTS	= 0x08000,/* More Signal knobs in the IOCELL */	AHD_NEW_DFCNTRL_OPTS	= 0x10000,/* SCSIENWRDIS bit */	AHD_FAST_CDB_DELIVERY	= 0x20000,/* CDB acks released to Output Sync */	AHD_REMOVABLE		= 0x00000,/* Hot-Swap supported - None so far*/	AHD_AIC7901_FE		= AHD_FENONE,	AHD_AIC7901A_FE		= AHD_FENONE,	AHD_AIC7902_FE		= AHD_MULTI_FUNC} ahd_feature;/* * Bugs in the silicon that we work around in software. */typedef enum {	AHD_BUGNONE		= 0x0000,	/*	 * Rev A hardware fails to update LAST/CURR/NEXTSCB	 * correctly in certain packetized selection cases.	 */	AHD_SENT_SCB_UPDATE_BUG	= 0x0001,	/* The wrong SCB is accessed to check the abort pending bit. */	AHD_ABORT_LQI_BUG	= 0x0002,	/* Packetized bitbucket crosses packet boundaries. */	AHD_PKT_BITBUCKET_BUG	= 0x0004,	/* The selection timer runs twice as long as its setting. */	AHD_LONG_SETIMO_BUG	= 0x0008,	/* The Non-LQ CRC error status is delayed until phase change. */	AHD_NLQICRC_DELAYED_BUG	= 0x0010,	/* The chip must be reset for all outgoing bus resets.  */	AHD_SCSIRST_BUG		= 0x0020,	/* Some PCIX fields must be saved and restored across chip reset. */	AHD_PCIX_CHIPRST_BUG	= 0x0040,	/* MMAPIO is not functional in PCI-X mode.  */	AHD_PCIX_MMAPIO_BUG	= 0x0080,	/* Reads to SCBRAM fail to reset the discard timer. */	AHD_PCIX_SCBRAM_RD_BUG  = 0x0100,	/* Bug workarounds that can be disabled on non-PCIX busses. */	AHD_PCIX_BUG_MASK	= AHD_PCIX_CHIPRST_BUG				| AHD_PCIX_MMAPIO_BUG				| AHD_PCIX_SCBRAM_RD_BUG,	/*	 * LQOSTOP0 status set even for forced selections with ATN	 * to perform non-packetized message delivery.	 */	AHD_LQO_ATNO_BUG	= 0x0200,	/* FIFO auto-flush does not always trigger.  */	AHD_AUTOFLUSH_BUG	= 0x0400,	/* The CLRLQO registers are not self-clearing. */	AHD_CLRLQO_AUTOCLR_BUG	= 0x0800,	/* The PACKETIZED status bit refers to the previous connection. */	AHD_PKTIZED_STATUS_BUG  = 0x1000,	/* "Short Luns" are not placed into outgoing LQ packets correctly. */	AHD_PKT_LUN_BUG		= 0x2000,	/*	 * Only the FIFO allocated to the non-packetized connection may	 * be in use during a non-packetzied connection.	 */	AHD_NONPACKFIFO_BUG	= 0x4000,	/*	 * Writing to a DFF SCBPTR register may fail if concurent with	 * a hardware write to the other DFF SCBPTR register.  This is	 * not currently a concern in our sequencer since all chips with	 * this bug have the AHD_NONPACKFIFO_BUG and all writes of concern	 * occur in non-packetized connections.	 */	AHD_MDFF_WSCBPTR_BUG	= 0x8000,	/* SGHADDR updates are slow. */	AHD_REG_SLOW_SETTLE_BUG	= 0x10000,	/*	 * Changing the MODE_PTR coincident with an interrupt that	 * switches to a different mode will cause the interrupt to	 * be in the mode written outside of interrupt context.	 */	AHD_SET_MODE_BUG	= 0x20000,	/* Non-packetized busfree revision does not work. */	AHD_BUSFREEREV_BUG	= 0x40000,	/*	 * Paced transfers are indicated with a non-standard PPR	 * option bit in the neg table, 160MHz is indicated by	 * sync factor 0x7, and the offset if off by a factor of 2.	 */	AHD_PACED_NEGTABLE_BUG	= 0x80000,	/* LQOOVERRUN false positives. */	AHD_LQOOVERRUN_BUG	= 0x100000,	/*	 * Controller write to INTSTAT will lose to a host	 * write to CLRINT.	 */	AHD_INTCOLLISION_BUG	= 0x200000,	/*	 * The GEM318 violates the SCSI spec by not waiting	 * the mandated bus settle delay between phase changes	 * in some situations.  Some aic79xx chip revs. are more	 * strict in this regard and will treat REQ assertions	 * that fall within the bus settle delay window as	 * glitches.  This flag tells the firmware to tolerate	 * early REQ assertions.	 */	AHD_EARLY_REQ_BUG	= 0x400000,	/*	 * The LED does not stay on long enough in packetized modes.	 */	AHD_FAINT_LED_BUG	= 0x800000} ahd_bug;/* * Configuration specific settings. * The driver determines these settings by probing the * chip/controller's configuration. */typedef enum {	AHD_FNONE	      = 0x00000,	AHD_BOOT_CHANNEL      = 0x00001,/* We were set as the boot channel. */	AHD_USEDEFAULTS	      = 0x00004,/*					 * For cards without an seeprom					 * or a BIOS to initialize the chip's					 * SRAM, we use the default target					 * settings.					 */	AHD_SEQUENCER_DEBUG   = 0x00008,	AHD_RESET_BUS_A	      = 0x00010,	AHD_EXTENDED_TRANS_A  = 0x00020,	AHD_TERM_ENB_A	      = 0x00040,	AHD_SPCHK_ENB_A	      = 0x00080,	AHD_STPWLEVEL_A	      = 0x00100,	AHD_INITIATORROLE     = 0x00200,/*					 * Allow initiator operations on					 * this controller.					 */	AHD_TARGETROLE	      = 0x00400,/*					 * Allow target operations on this					 * controller.					 */	AHD_RESOURCE_SHORTAGE = 0x00800,	AHD_TQINFIFO_BLOCKED  = 0x01000,/* Blocked waiting for ATIOs */	AHD_INT50_SPEEDFLEX   = 0x02000,/*					 * Internal 50pin connector					 * sits behind an aic3860					 */	AHD_BIOS_ENABLED      = 0x04000,	AHD_ALL_INTERRUPTS    = 0x08000,	AHD_39BIT_ADDRESSING  = 0x10000,/* Use 39 bit addressing scheme. */	AHD_64BIT_ADDRESSING  = 0x20000,/* Use 64 bit addressing scheme. */	AHD_CURRENT_SENSING   = 0x40000,	AHD_SCB_CONFIG_USED   = 0x80000,/* No SEEPROM but SCB had info. */	AHD_HP_BOARD	      = 0x100000,	AHD_RESET_POLL_ACTIVE = 0x200000,	AHD_UPDATE_PEND_CMDS  = 0x400000,	AHD_RUNNING_QOUTFIFO  = 0x800000,	AHD_HAD_FIRST_SEL     = 0x1000000} ahd_flag;/************************* Hardware  SCB Definition ***************************//*

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -