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

📄 scsi.h

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 H
📖 第 1 页 / 共 3 页
字号:
/* *  scsi.h Copyright (C) 1992 Drew Eckhardt  *         Copyright (C) 1993, 1994, 1995, 1998, 1999 Eric Youngdale *  generic SCSI package header file by *      Initial versions: Drew Eckhardt *      Subsequent revisions: Eric Youngdale * *  <drew@colorado.edu> * *       Modified by Eric Youngdale eric@andante.org to *       add scatter-gather, multiple outstanding request, and other *       enhancements. */#ifndef _SCSI_H#define _SCSI_H#include <linux/config.h>	/* for CONFIG_SCSI_LOGGING */#include <linux/devfs_fs_kernel.h>#include <linux/proc_fs.h>/* * Some of the public constants are being moved to this file. * We include it here so that what came from where is transparent. */#include <scsi/scsi.h>#include <linux/random.h>#include <asm/hardirq.h>#include <asm/scatterlist.h>#include <asm/io.h>/* * These are the values that the SCpnt->sc_data_direction and  * SRpnt->sr_data_direction can take.  These need to be set * The SCSI_DATA_UNKNOWN value is essentially the default. * In the event that the command creator didn't bother to * set a value, you will see SCSI_DATA_UNKNOWN. */#define SCSI_DATA_UNKNOWN       0#define SCSI_DATA_WRITE         1#define SCSI_DATA_READ          2#define SCSI_DATA_NONE          3#ifdef CONFIG_PCI#include <linux/pci.h>#if ((SCSI_DATA_UNKNOWN == PCI_DMA_BIDIRECTIONAL) && (SCSI_DATA_WRITE == PCI_DMA_TODEVICE) && (SCSI_DATA_READ == PCI_DMA_FROMDEVICE) && (SCSI_DATA_NONE == PCI_DMA_NONE))#define scsi_to_pci_dma_dir(scsi_dir)	((int)(scsi_dir))#elseextern __inline__ int scsi_to_pci_dma_dir(unsigned char scsi_dir){        if (scsi_dir == SCSI_DATA_UNKNOWN)                return PCI_DMA_BIDIRECTIONAL;        if (scsi_dir == SCSI_DATA_WRITE)                return PCI_DMA_TODEVICE;        if (scsi_dir == SCSI_DATA_READ)                return PCI_DMA_FROMDEVICE;        return PCI_DMA_NONE;}#endif#endif#if defined(CONFIG_SBUS) && !defined(CONFIG_SUN3) && !defined(CONFIG_SUN3X)#include <asm/sbus.h>#if ((SCSI_DATA_UNKNOWN == SBUS_DMA_BIDIRECTIONAL) && (SCSI_DATA_WRITE == SBUS_DMA_TODEVICE) && (SCSI_DATA_READ == SBUS_DMA_FROMDEVICE) && (SCSI_DATA_NONE == SBUS_DMA_NONE))#define scsi_to_sbus_dma_dir(scsi_dir)	((int)(scsi_dir))#elseextern __inline__ int scsi_to_sbus_dma_dir(unsigned char scsi_dir){        if (scsi_dir == SCSI_DATA_UNKNOWN)                return SBUS_DMA_BIDIRECTIONAL;        if (scsi_dir == SCSI_DATA_WRITE)                return SBUS_DMA_TODEVICE;        if (scsi_dir == SCSI_DATA_READ)                return SBUS_DMA_FROMDEVICE;        return SBUS_DMA_NONE;}#endif#endif/* * Some defs, in case these are not defined elsewhere. */#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#define MAX_SCSI_DEVICE_CODE 14extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];#ifdef DEBUG#define SCSI_TIMEOUT (5*HZ)#else#define SCSI_TIMEOUT (2*HZ)#endif/* * Used for debugging the new queueing code.  We want to make sure * that the lock state is consistent with design.  Only do this in * the user space simulator. */#define ASSERT_LOCK(_LOCK, _COUNT)#if defined(CONFIG_SMP) && defined(CONFIG_USER_DEBUG)#undef ASSERT_LOCK#define ASSERT_LOCK(_LOCK,_COUNT)       \        { if( (_LOCK)->lock != _COUNT )   \                panic("Lock count inconsistent %s %d\n", __FILE__, __LINE__); \                                                                                       }#endif/* *  Use these to separate status msg and our bytes * *  These are set by: * *      status byte = set from target device *      msg_byte    = return status from host adapter itself. *      host_byte   = set by low-level driver to indicate status. *      driver_byte = set by mid-level. */#define status_byte(result) (((result) >> 1) & 0x1f)#define msg_byte(result)    (((result) >> 8) & 0xff)#define host_byte(result)   (((result) >> 16) & 0xff)#define driver_byte(result) (((result) >> 24) & 0xff)#define suggestion(result)  (driver_byte(result) & SUGGEST_MASK)#define sense_class(sense)  (((sense) >> 4) & 0x7)#define sense_error(sense)  ((sense) & 0xf)#define sense_valid(sense)  ((sense) & 0x80);#define NEEDS_RETRY     0x2001#define SUCCESS         0x2002#define FAILED          0x2003#define QUEUED          0x2004#define SOFT_ERROR      0x2005#define ADD_TO_MLQUEUE  0x2006/* * These are the values that scsi_cmd->state can take. */#define SCSI_STATE_TIMEOUT         0x1000#define SCSI_STATE_FINISHED        0x1001#define SCSI_STATE_FAILED          0x1002#define SCSI_STATE_QUEUED          0x1003#define SCSI_STATE_UNUSED          0x1006#define SCSI_STATE_DISCONNECTING   0x1008#define SCSI_STATE_INITIALIZING    0x1009#define SCSI_STATE_BHQUEUE         0x100a#define SCSI_STATE_MLQUEUE         0x100b/* * These are the values that the owner field can take. * They are used as an indication of who the command belongs to. */#define SCSI_OWNER_HIGHLEVEL      0x100#define SCSI_OWNER_MIDLEVEL       0x101#define SCSI_OWNER_LOWLEVEL       0x102#define SCSI_OWNER_ERROR_HANDLER  0x103#define SCSI_OWNER_BH_HANDLER     0x104#define SCSI_OWNER_NOBODY         0x105#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7]#define IDENTIFY_BASE       0x80#define IDENTIFY(can_disconnect, lun)   (IDENTIFY_BASE |\		     ((can_disconnect) ?  0x40 : 0) |\		     ((lun) & 0x07))/* * This defines the scsi logging feature.  It is a means by which the * user can select how much information they get about various goings on, * and it can be really useful for fault tracing.  The logging word is divided * into 8 nibbles, each of which describes a loglevel.  The division of things * is somewhat arbitrary, and the division of the word could be changed if it * were really needed for any reason.  The numbers below are the only place where these * are specified.  For a first go-around, 3 bits is more than enough, since this * gives 8 levels of logging (really 7, since 0 is always off).  Cutting to 2 bits * might be wise at some point. */#define SCSI_LOG_ERROR_SHIFT              0#define SCSI_LOG_TIMEOUT_SHIFT            3#define SCSI_LOG_SCAN_SHIFT               6#define SCSI_LOG_MLQUEUE_SHIFT            9#define SCSI_LOG_MLCOMPLETE_SHIFT         12#define SCSI_LOG_LLQUEUE_SHIFT            15#define SCSI_LOG_LLCOMPLETE_SHIFT         18#define SCSI_LOG_HLQUEUE_SHIFT            21#define SCSI_LOG_HLCOMPLETE_SHIFT         24#define SCSI_LOG_IOCTL_SHIFT              27#define SCSI_LOG_ERROR_BITS               3#define SCSI_LOG_TIMEOUT_BITS             3#define SCSI_LOG_SCAN_BITS                3#define SCSI_LOG_MLQUEUE_BITS             3#define SCSI_LOG_MLCOMPLETE_BITS          3#define SCSI_LOG_LLQUEUE_BITS             3#define SCSI_LOG_LLCOMPLETE_BITS          3#define SCSI_LOG_HLQUEUE_BITS             3#define SCSI_LOG_HLCOMPLETE_BITS          3#define SCSI_LOG_IOCTL_BITS               3#if CONFIG_SCSI_LOGGING#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)     \{                                                       \        unsigned int mask;                              \                                                        \        mask = (1 << (BITS)) - 1;                       \        if( ((scsi_logging_level >> (SHIFT)) & mask) > (LEVEL) ) \        {                                               \                (CMD);                                  \        }						\}#define SCSI_SET_LOGGING(SHIFT, BITS, LEVEL)            \{                                                       \        unsigned int mask;                              \                                                        \        mask = ((1 << (BITS)) - 1) << SHIFT;            \        scsi_logging_level = ((scsi_logging_level & ~mask) \                              | ((LEVEL << SHIFT) & mask));     \}#else/* * With no logging enabled, stub these out so they don't do anything. */#define SCSI_SET_LOGGING(SHIFT, BITS, LEVEL)#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)#endif/* * These are the macros that are actually used throughout the code to * log events.  If logging isn't enabled, they are no-ops and will be * completely absent from the user's code. * * The 'set' versions of the macros are really intended to only be called * from the /proc filesystem, and in production kernels this will be about * all that is ever used.  It could be useful in a debugging environment to * bump the logging level when certain strange events are detected, however. */#define SCSI_LOG_ERROR_RECOVERY(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_ERROR_SHIFT, SCSI_LOG_ERROR_BITS, LEVEL,CMD);#define SCSI_LOG_TIMEOUT(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_TIMEOUT_SHIFT, SCSI_LOG_TIMEOUT_BITS, LEVEL,CMD);#define SCSI_LOG_SCAN_BUS(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_SCAN_SHIFT, SCSI_LOG_SCAN_BITS, LEVEL,CMD);#define SCSI_LOG_MLQUEUE(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_MLQUEUE_SHIFT, SCSI_LOG_MLQUEUE_BITS, LEVEL,CMD);#define SCSI_LOG_MLCOMPLETE(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_MLCOMPLETE_SHIFT, SCSI_LOG_MLCOMPLETE_BITS, LEVEL,CMD);#define SCSI_LOG_LLQUEUE(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_LLQUEUE_SHIFT, SCSI_LOG_LLQUEUE_BITS, LEVEL,CMD);#define SCSI_LOG_LLCOMPLETE(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_LLCOMPLETE_SHIFT, SCSI_LOG_LLCOMPLETE_BITS, LEVEL,CMD);#define SCSI_LOG_HLQUEUE(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_HLQUEUE_SHIFT, SCSI_LOG_HLQUEUE_BITS, LEVEL,CMD);#define SCSI_LOG_HLCOMPLETE(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_HLCOMPLETE_SHIFT, SCSI_LOG_HLCOMPLETE_BITS, LEVEL,CMD);#define SCSI_LOG_IOCTL(LEVEL,CMD)  \        SCSI_CHECK_LOGGING(SCSI_LOG_IOCTL_SHIFT, SCSI_LOG_IOCTL_BITS, LEVEL,CMD);#define SCSI_SET_ERROR_RECOVERY_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_ERROR_SHIFT, SCSI_LOG_ERROR_BITS, LEVEL);#define SCSI_SET_TIMEOUT_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_TIMEOUT_SHIFT, SCSI_LOG_TIMEOUT_BITS, LEVEL);#define SCSI_SET_SCAN_BUS_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_SCAN_SHIFT, SCSI_LOG_SCAN_BITS, LEVEL);#define SCSI_SET_MLQUEUE_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_MLQUEUE_SHIFT, SCSI_LOG_MLQUEUE_BITS, LEVEL);#define SCSI_SET_MLCOMPLETE_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_MLCOMPLETE_SHIFT, SCSI_LOG_MLCOMPLETE_BITS, LEVEL);#define SCSI_SET_LLQUEUE_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_LLQUEUE_SHIFT, SCSI_LOG_LLQUEUE_BITS, LEVEL);#define SCSI_SET_LLCOMPLETE_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_LLCOMPLETE_SHIFT, SCSI_LOG_LLCOMPLETE_BITS, LEVEL);#define SCSI_SET_HLQUEUE_LOGGING(LEVEL)  \        SCSI_SET_LOGGING(SCSI_LOG_HLQUEUE_SHIFT, SCSI_LOG_HLQUEUE_BITS, LEVEL);#define SCSI_SET_HLCOMPLETE_LOGGING(LEVEL)  \

⌨️ 快捷键说明

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