📄 ncr53c8xx.h
字号:
/******************************************************************************** Device driver for the PCI-SCSI NCR538XX controller family.**** 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.****-----------------------------------------------------------------------------**** This driver has been ported to Linux from the FreeBSD NCR53C8XX driver** and is currently maintained 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>**** And has been ported to NetBSD by** Charles M. Hannum <mycroft@gnu.ai.mit.edu>**********************************************************************************/#ifndef NCR53C8XX_H#define NCR53C8XX_H/*** Name and revision of the driver*/#define SCSI_NCR_DRIVER_NAME "ncr53c8xx - revision 2.5f.1"/*** Check supported Linux versions*/#if !defined(LINUX_VERSION_CODE)#include <linux/version.h>#endif#include <linux/config.h>/*** During make dep of linux-1.2.13, LINUX_VERSION_CODE is undefined** Under linux-1.3.X, all seems to be OK.** So, we have only to define it under 1.2.13*/#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))#if !defined(LINUX_VERSION_CODE)#define LINUX_VERSION_CODE LinuxVersionCode(1,2,13)#endif/*** Normal IO or memory mapped IO.**** Memory mapped IO only works with linux-1.3.X** If your motherboard does not work with memory mapped IO,** define SCSI_NCR_IOMAPPED for PATCHLEVEL 3 too.*/#if LINUX_VERSION_CODE < LinuxVersionCode(1,3,0)# define SCSI_NCR_IOMAPPED#endif#if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0)# define SCSI_NCR_PROC_INFO_SUPPORT#endif#if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,72)# define SCSI_NCR_SHARE_IRQ#endif/*** 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# define SCSI_NCR_PROFILE_SUPPORT# define SCSI_NCR_USER_COMMAND_SUPPORT# define SCSI_NCR_USER_INFO_SUPPORT/* # define SCSI_NCR_DEBUG_ERROR_RECOVERY_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. */#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 12, default 4 */#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 > 12#define SCSI_NCR_MAX_TAGS (12)#else#define SCSI_NCR_MAX_TAGS CONFIG_SCSI_NCR53C8XX_MAX_TAGS#endif#else#define SCSI_NCR_MAX_TAGS (4)#endif/* * Allow tagged command queuing support if configured with default number * of tags set to max (see above). */#ifdef 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#endif/* * Sync transfer frequency at startup. * Allow from 5Mhz to 40Mhz default 10 Mhz. */#ifndef CONFIG_SCSI_NCR53C8XX_SYNC#define CONFIG_SCSI_NCR53C8XX_SYNC (5)#elif CONFIG_SCSI_NCR53C8XX_SYNC > SCSI_NCR_MAX_SYNC#define SCSI_NCR_SETUP_DEFAULT_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)#define SCSI_NCR_MAX_HOST (2)#define SCSI_NCR_TIMEOUT_ALERT (3*HZ)#define SCSI_NCR_CAN_QUEUE (7*SCSI_NCR_MAX_TAGS)#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+5-1)/5)#if 1 /* defined CONFIG_SCSI_MULTI_LUN */#define SCSI_NCR_MAX_LUN (8)#else#define SCSI_NCR_MAX_LUN (1)#endif/*** Define Scsi_Host_Template parameters**** Used by hosts.c and ncr53c8xx.c with module configuration.*/#if defined(HOSTS_C) || defined(MODULE)#if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,98)#include <scsi/scsicam.h>#else#include <linux/scsicam.h>#endifint ncr53c8xx_abort(Scsi_Cmnd *);int ncr53c8xx_detect(Scsi_Host_Template *tpnt);int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));#if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,98)int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);#elseint ncr53c8xx_reset(Scsi_Cmnd *);#endif#ifdef MODULEint ncr53c8xx_release(struct Scsi_Host *);#else#define ncr53c8xx_release NULL#endif#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)#define NCR53C8XX { name: SCSI_NCR_DRIVER_NAME, \ detect: ncr53c8xx_detect, \ release: ncr53c8xx_release, \ queuecommand: ncr53c8xx_queue_command,\ abort: ncr53c8xx_abort, \ reset: ncr53c8xx_reset, \ bios_param: scsicam_bios_param, \ can_queue: SCSI_NCR_CAN_QUEUE, \ this_id: 7, \ sg_tablesize: SCSI_NCR_SG_TABLESIZE, \ cmd_per_lun: SCSI_NCR_CMD_PER_LUN, \ use_clustering: DISABLE_CLUSTERING} #elif LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0)#define NCR53C8XX { NULL, NULL, NULL, NULL, \ SCSI_NCR_DRIVER_NAME, ncr53c8xx_detect, \ ncr53c8xx_release, NULL, NULL, \ ncr53c8xx_queue_command,ncr53c8xx_abort, \ ncr53c8xx_reset, NULL, scsicam_bios_param, \ SCSI_NCR_CAN_QUEUE, 7, \ SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \ 0, 0, DISABLE_CLUSTERING} #else#define NCR53C8XX { NULL, NULL, \ SCSI_NCR_DRIVER_NAME, ncr53c8xx_detect, \ ncr53c8xx_release, NULL, NULL, \ ncr53c8xx_queue_command,ncr53c8xx_abort, \ ncr53c8xx_reset, NULL, scsicam_bios_param, \ SCSI_NCR_CAN_QUEUE, 7, \ SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \ 0, 0, DISABLE_CLUSTERING} #endif /* LINUX_VERSION_CODE */#endif /* defined(HOSTS_C) || defined(MODULE) */ #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#ifdef __powerpc__#define inw_l2b inw#define inl_l2b inl#define outw_b2l outw#define outl_b2l outl#else#error "Support for BIG ENDIAN is only available for the PowerPC"#endif#else /* Assumed x86 or 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#ifdef SCSI_NCR_BIG_ENDIAN#error "The NCR in BIG ENDIAN adressing 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -