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

📄 sym53c8xx_defs.h

📁 基于组件方式开发操作系统的OSKIT源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/********************************************************************************  High Performance device driver for the Symbios 53C896 controller.****  Copyright (C) 1998  Gerard Roudier <groudier@club-internet.fr>****  This driver also supports all the Symbios 53C8XX controller family, **  except 53C810 revisions < 16, 53C825 revisions < 16 and all **  revisions of 53C815 controllers.****  This driver is based on the Linux port of the FreeBSD ncr driver.** **  Copyright (C) 1994  Wolfgang Stanglmeier**  **-----------------------------------------------------------------------------**  **  This program is free software; you can redistribute it and/or modify**  it under the terms of the GNU General Public License as published by**  the Free Software Foundation; either version 2 of the License, or**  (at your option) any later version.****  This program is distributed in the hope that it will be useful,**  but WITHOUT ANY WARRANTY; without even the implied warranty of**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the**  GNU General Public License for more details.****  You should have received a copy of the GNU General Public License**  along with this program; if not, write to the Free Software**  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.****-----------------------------------------------------------------------------****  The Linux port of the FreeBSD ncr driver has been achieved in **  november 1995 by:****          Gerard Roudier              <groudier@club-internet.fr>****  Being given that this driver originates from the FreeBSD version, and**  in order to keep synergy on both, any suggested enhancements and corrections**  received on Linux are automatically a potential candidate for the FreeBSD **  version.****  The original driver has been written for 386bsd and FreeBSD by**          Wolfgang Stanglmeier        <wolf@cologne.de>**          Stefan Esser                <se@mi.Uni-Koeln.de>****-----------------------------------------------------------------------------****  Major contributions:**  --------------------****  NVRAM detection and reading.**    Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>**********************************************************************************/#ifndef SYM53C8XX_DEFS_H#define SYM53C8XX_DEFS_H/***	Check supported Linux versions*/#if !defined(LINUX_VERSION_CODE)#include <linux/version.h>#endif#include <linux/config.h>#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))/* * NCR PQS/PDS special device support. */#ifdef CONFIG_SCSI_NCR53C8XX_PQS_PDS#define SCSI_NCR_PQS_PDS_SUPPORT#endif/* *	No more an option, enabled by default. */#ifndef CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT#define CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT#endif/***	These options are not tunable from 'make config'*/#define	SCSI_NCR_PROC_INFO_SUPPORT/***	If you want a driver as small as possible, donnot define the **	following options.*/#define SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT#define SCSI_NCR_DEBUG_INFO_SUPPORT#define SCSI_NCR_PCI_FIX_UP_SUPPORT#ifdef	SCSI_NCR_PROC_INFO_SUPPORT#	ifdef	CONFIG_SCSI_NCR53C8XX_PROFILE#		define	SCSI_NCR_PROFILE_SUPPORT#	endif#	define	SCSI_NCR_USER_COMMAND_SUPPORT#	define	SCSI_NCR_USER_INFO_SUPPORT#endif/*==========================================================**** nvram settings - #define SCSI_NCR_NVRAM_SUPPORT to enable****==========================================================*/#ifdef CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT#define SCSI_NCR_NVRAM_SUPPORT/* #define SCSI_NCR_DEBUG_NVRAM */#endif/* ---------------------------------------------------------------------** Take into account kernel configured parameters.** Most of these options can be overridden at startup by a command line.** ---------------------------------------------------------------------*//* * For Ultra2 SCSI support option, use special features and allow 40Mhz  * synchronous data transfers. * * Value 5 (default) means: *	bit 0 : all features enabled, except: *		bit 1 : PCI Write And Invalidate. *		bit 2 : Data Phase Mismatch handling from SCRIPTS. * * Use boot options ncr53c8xx=specf:1 if you want all chip features to be  * enabled by the driver. */#define	SCSI_NCR_SETUP_SPECIAL_FEATURES		(3)#define SCSI_NCR_SETUP_ULTRA_SCSI		(2)#define SCSI_NCR_MAX_SYNC			(40)/* * Allow tags from 2 to 64, default 8 */#ifdef	CONFIG_SCSI_NCR53C8XX_MAX_TAGS#if	CONFIG_SCSI_NCR53C8XX_MAX_TAGS < 2#define SCSI_NCR_MAX_TAGS	(2)#elif	CONFIG_SCSI_NCR53C8XX_MAX_TAGS > 64#define SCSI_NCR_MAX_TAGS	(64)#else#define	SCSI_NCR_MAX_TAGS	CONFIG_SCSI_NCR53C8XX_MAX_TAGS#endif#else#define SCSI_NCR_MAX_TAGS	(8)#endif/* * Allow tagged command queuing support if configured with default number  * of tags set to max (see above). */#ifdef	CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS#define	SCSI_NCR_SETUP_DEFAULT_TAGS	CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS#elif	defined CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE#define	SCSI_NCR_SETUP_DEFAULT_TAGS	SCSI_NCR_MAX_TAGS#else#define	SCSI_NCR_SETUP_DEFAULT_TAGS	(0)#endif/* * Use normal IO if configured. Forced for alpha and ppc. */#if defined(CONFIG_SCSI_NCR53C8XX_IOMAPPED)#define	SCSI_NCR_IOMAPPED#elif defined(__alpha__) || defined(__powerpc__)#define	SCSI_NCR_IOMAPPED#elif defined(__sparc__)#undef SCSI_NCR_IOMAPPED#endif/* * Sync transfer frequency at startup. * Allow from 5Mhz to 40Mhz default 20 Mhz. */#ifndef	CONFIG_SCSI_NCR53C8XX_SYNC#define	CONFIG_SCSI_NCR53C8XX_SYNC	(20)#elif	CONFIG_SCSI_NCR53C8XX_SYNC > SCSI_NCR_MAX_SYNC#undef	CONFIG_SCSI_NCR53C8XX_SYNC#define	CONFIG_SCSI_NCR53C8XX_SYNC	SCSI_NCR_MAX_SYNC#endif#if	CONFIG_SCSI_NCR53C8XX_SYNC == 0#define	SCSI_NCR_SETUP_DEFAULT_SYNC	(255)#elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 5#define	SCSI_NCR_SETUP_DEFAULT_SYNC	(50)#elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 20#define	SCSI_NCR_SETUP_DEFAULT_SYNC	(250/(CONFIG_SCSI_NCR53C8XX_SYNC))#elif	CONFIG_SCSI_NCR53C8XX_SYNC <= 33#define	SCSI_NCR_SETUP_DEFAULT_SYNC	(11)#else#define	SCSI_NCR_SETUP_DEFAULT_SYNC	(10)#endif/* * Disallow disconnections at boot-up */#ifdef CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT#define SCSI_NCR_SETUP_DISCONNECTION	(0)#else#define SCSI_NCR_SETUP_DISCONNECTION	(1)#endif/* * Force synchronous negotiation for all targets */#ifdef CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO#define SCSI_NCR_SETUP_FORCE_SYNC_NEGO	(1)#else#define SCSI_NCR_SETUP_FORCE_SYNC_NEGO	(0)#endif/* * Disable master parity checking (flawed hardwares need that) */#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK#define SCSI_NCR_SETUP_MASTER_PARITY	(0)#else#define SCSI_NCR_SETUP_MASTER_PARITY	(1)#endif/* * Disable scsi parity checking (flawed devices may need that) */#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK#define SCSI_NCR_SETUP_SCSI_PARITY	(0)#else#define SCSI_NCR_SETUP_SCSI_PARITY	(1)#endif/* * Vendor specific stuff */#ifdef CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT#define SCSI_NCR_SETUP_LED_PIN		(1)#define SCSI_NCR_SETUP_DIFF_SUPPORT	(3)#else#define SCSI_NCR_SETUP_LED_PIN		(0)#define SCSI_NCR_SETUP_DIFF_SUPPORT	(0)#endif/* * Settle time after reset at boot-up */#define SCSI_NCR_SETUP_SETTLE_TIME	(2)/***	Other parameters not configurable with "make config"**	Avoid to change these constants, unless you know what you are doing.*/#define SCSI_NCR_ALWAYS_SIMPLE_TAG#define SCSI_NCR_MAX_SCATTER	(127)#define SCSI_NCR_MAX_TARGET	(16)/* No need to use a too large adapter queue */#if SCSI_NCR_MAX_TAGS <= 32#define SCSI_NCR_CAN_QUEUE	(7*SCSI_NCR_MAX_TAGS)#else#define SCSI_NCR_CAN_QUEUE	(250)#endif#define SCSI_NCR_CMD_PER_LUN	(SCSI_NCR_MAX_TAGS)#define SCSI_NCR_SG_TABLESIZE	(SCSI_NCR_MAX_SCATTER)#define SCSI_NCR_TIMER_INTERVAL	(HZ)#if 1 /* defined CONFIG_SCSI_MULTI_LUN */#define SCSI_NCR_MAX_LUN	(16)#else#define SCSI_NCR_MAX_LUN	(1)#endif#ifndef HOSTS_C/***	IO functions definition for big/little endian support.**	For now, the NCR is only supported in little endian addressing mode, **	and big endian byte ordering is only supported for the PPC.**	MMIO is not used on PPC.*/#ifdef	__BIG_ENDIAN#if	LINUX_VERSION_CODE < LinuxVersionCode(2,1,0)#error	"BIG ENDIAN byte ordering needs kernel version >= 2.1.0"#endif#if defined(__powerpc__)#define	inw_l2b		inw#define	inl_l2b		inl#define	outw_b2l	outw#define	outl_b2l	outl#elif defined(__sparc__)#define	readw_l2b	readw#define	readl_l2b	readl#define	writew_b2l	writew#define	writel_b2l	writel#else#error	"Support for BIG ENDIAN is only available for PowerPC and SPARC"#endif#else	/* little endian */#if defined(__i386__)	/* i386 implements full FLAT memory/MMIO model */#define	inw_raw		inw#define	inl_raw		inl#define	outw_raw	outw#define	outl_raw	outl#define readb_raw(a)	(*(volatile unsigned char *) (a))#define readw_raw(a)	(*(volatile unsigned short *) (a))#define readl_raw(a)	(*(volatile unsigned int *) (a))#define writeb_raw(b,a)	((*(volatile unsigned char *) (a)) = (b))#define writew_raw(b,a)	((*(volatile unsigned short *) (a)) = (b))#define writel_raw(b,a)	((*(volatile unsigned int *) (a)) = (b))#else	/* Other little-endian (for now alpha) */#define	inw_raw		inw#define	inl_raw		inl#define	outw_raw	outw#define	outl_raw	outl#define	readw_raw	readw#define	readl_raw	readl#define	writew_raw	writew#define	writel_raw	writel#endif#endif#ifdef	SCSI_NCR_BIG_ENDIAN#error	"The NCR in BIG ENDIAN addressing mode is not (yet) supported"#endif/***	NCR53C8XX Device Ids*/#ifndef PCI_DEVICE_ID_NCR_53C810#define PCI_DEVICE_ID_NCR_53C810 1#endif#ifndef PCI_DEVICE_ID_NCR_53C810AP#define PCI_DEVICE_ID_NCR_53C810AP 5#endif#ifndef PCI_DEVICE_ID_NCR_53C815#define PCI_DEVICE_ID_NCR_53C815 4#endif#ifndef PCI_DEVICE_ID_NCR_53C820#define PCI_DEVICE_ID_NCR_53C820 2#endif#ifndef PCI_DEVICE_ID_NCR_53C825#define PCI_DEVICE_ID_NCR_53C825 3#endif#ifndef PCI_DEVICE_ID_NCR_53C860#define PCI_DEVICE_ID_NCR_53C860 6#endif#ifndef PCI_DEVICE_ID_NCR_53C875#define PCI_DEVICE_ID_NCR_53C875 0xf#endif#ifndef PCI_DEVICE_ID_NCR_53C875J#define PCI_DEVICE_ID_NCR_53C875J 0x8f#endif#ifndef PCI_DEVICE_ID_NCR_53C885#define PCI_DEVICE_ID_NCR_53C885 0xd#endif#ifndef PCI_DEVICE_ID_NCR_53C895#define PCI_DEVICE_ID_NCR_53C895 0xc#endif#ifndef PCI_DEVICE_ID_NCR_53C896#define PCI_DEVICE_ID_NCR_53C896 0xb#endif#ifndef PCI_DEVICE_ID_NCR_53C895A#define PCI_DEVICE_ID_NCR_53C895A 0x12#endif/***   NCR53C8XX devices features table.*/typedef struct {	unsigned short	device_id;	unsigned short	revision_id;	char	*name;	unsigned char	burst_max;	unsigned char	offset_max;	unsigned char	nr_divisor;	unsigned int	features;#define FE_LED0		(1<<0)#define FE_WIDE		(1<<1)#define FE_ULTRA	(1<<2)#define FE_ULTRA2	(1<<3)#define FE_DBLR		(1<<4)#define FE_QUAD		(1<<5)#define FE_ERL		(1<<6)#define FE_CLSE		(1<<7)#define FE_WRIE		(1<<8)#define FE_ERMP		(1<<9)#define FE_BOF		(1<<10)#define FE_DFS		(1<<11)#define FE_PFEN		(1<<12)#define FE_LDSTR	(1<<13)#define FE_RAM		(1<<14)#define FE_CLK80	(1<<15)#define FE_RAM8K	(1<<16)#define FE_64BIT	(1<<17)#define FE_IO256	(1<<18)#define FE_NOPM		(1<<19)#define FE_LEDC		(1<<20)#define FE_CACHE_SET	(FE_ERL|FE_CLSE|FE_WRIE|FE_ERMP)#define FE_SCSI_SET	(FE_WIDE|FE_ULTRA|FE_ULTRA2|FE_DBLR|FE_QUAD|F_CLK80)#define FE_SPECIAL_SET	(FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM)} ncr_chip;/***	DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 3.**	Memory Read transaction terminated by a retry followed by **	Memory Read Line command.*/#define FE_CACHE0_SET	(FE_CACHE_SET & ~FE_ERL)/***	DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 5.**	On paper, this errata is harmless. But it is a good reason for **	using a shorter programmed burst length (64 DWORDS instead of 128).*/#define SCSI_NCR_CHIP_TABLE						\{									\ {PCI_DEVICE_ID_NCR_53C810, 0x0f, "810",  4,  8, 4,			\ FE_ERL}								\ ,									\ {PCI_DEVICE_ID_NCR_53C810, 0xff, "810a", 4,  8, 4,			\ FE_CACHE_SET|FE_LDSTR|FE_PFEN|FE_BOF}					\ ,									\ {PCI_DEVICE_ID_NCR_53C815, 0xff, "815",  4,  8, 4,			\ FE_ERL|FE_BOF}								\ ,									\ {PCI_DEVICE_ID_NCR_53C820, 0xff, "820",  4,  8, 4,			\ FE_WIDE|FE_ERL}							\ ,									\ {PCI_DEVICE_ID_NCR_53C825, 0x0f, "825",  4,  8, 4,			\ FE_WIDE|FE_ERL|FE_BOF}							\ ,									\ {PCI_DEVICE_ID_NCR_53C825, 0xff, "825a", 6,  8, 4,			\ FE_WIDE|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}		\

⌨️ 快捷键说明

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