📄 in2000.h
字号:
#define CTRL_EDI 0x08#define CTRL_HHP 0x10#define CTRL_POLLED 0x00#define CTRL_BURST 0x20#define CTRL_BUS 0x40#define CTRL_DMA 0x80 /* Timeout Period register */#define TIMEOUT_PERIOD_VALUE 20 /* results in 200 ms. */ /* Synchronous Transfer Register */#define STR_FSS 0x80 /* Destination ID register */#define DSTID_DPD 0x40#define DATA_OUT_DIR 0#define DATA_IN_DIR 1#define DSTID_SCC 0x80 /* Source ID register */#define SRCID_MASK 0x07#define SRCID_SIV 0x08#define SRCID_DSP 0x20#define SRCID_ES 0x40#define SRCID_ER 0x80#define ILLEGAL_STATUS_BYTE 0xff#define DEFAULT_SX_PER 500 /* (ns) fairly safe */#define DEFAULT_SX_OFF 0 /* aka async */#define OPTIMUM_SX_PER 252 /* (ns) best we can do (mult-of-4) */#define OPTIMUM_SX_OFF 12 /* size of in2000 fifo */struct sx_period { unsigned int period_ns; uchar reg_value; };struct IN2000_hostdata { struct Scsi_Host *next; uchar chip; /* what kind of wd33c93 chip? */ uchar microcode; /* microcode rev if 'B' */ unsigned short io_base; /* IO port base */ unsigned int dip_switch; /* dip switch settings */ unsigned int hrev; /* hardware revision of card */ volatile uchar busy[8]; /* index = target, bit = lun */ volatile Scsi_Cmnd *input_Q; /* commands waiting to be started */ volatile Scsi_Cmnd *selecting; /* trying to select this command */ volatile Scsi_Cmnd *connected; /* currently connected command */ volatile Scsi_Cmnd *disconnected_Q;/* commands waiting for reconnect */ uchar state; /* what we are currently doing */ uchar fifo; /* what the FIFO is up to */ uchar level2; /* extent to which Level-2 commands are used */ uchar disconnect; /* disconnect/reselect policy */ unsigned int args; /* set from command-line argument */ uchar incoming_msg[8]; /* filled during message_in phase */ int incoming_ptr; /* mainly used with EXTENDED messages */ uchar outgoing_msg[8]; /* send this during next message_out */ int outgoing_len; /* length of outgoing message */ unsigned int default_sx_per; /* default transfer period for SCSI bus */ uchar sync_xfer[8]; /* sync_xfer reg settings per target */ uchar sync_stat[8]; /* status of sync negotiation per target */ uchar sync_off; /* bit mask: don't use sync with these targets */#ifdef PROC_INTERFACE uchar proc; /* bit mask: what's in proc output */#ifdef PROC_STATISTICS unsigned long cmd_cnt[8]; /* # of commands issued per target */ unsigned long int_cnt; /* # of interrupts serviced */ unsigned long disc_allowed_cnt[8]; /* # of disconnects allowed per target */ unsigned long disc_done_cnt[8]; /* # of disconnects done per target*/#endif#endif };/* defines for hostdata->chip */#define C_WD33C93 0#define C_WD33C93A 1#define C_WD33C93B 2#define C_UNKNOWN_CHIP 100/* defines for hostdata->state */#define S_UNCONNECTED 0#define S_SELECTING 1#define S_RUNNING_LEVEL2 2#define S_CONNECTED 3#define S_PRE_TMP_DISC 4#define S_PRE_CMP_DISC 5/* defines for hostdata->fifo */#define FI_FIFO_UNUSED 0#define FI_FIFO_READING 1#define FI_FIFO_WRITING 2/* defines for hostdata->level2 *//* NOTE: only the first 3 are trustworthy at this point - * having trouble when more than 1 device is reading/writing * at the same time... */#define L2_NONE 0 /* no combination commands - we get lots of ints */#define L2_SELECT 1 /* start with SEL_ATN_XFER, but never resume it */#define L2_BASIC 2 /* resume after STATUS ints & RDP messages */#define L2_DATA 3 /* resume after DATA_IN/OUT ints */#define L2_MOST 4 /* resume after anything except a RESELECT int */#define L2_RESELECT 5 /* resume after everything, including RESELECT ints */#define L2_ALL 6 /* always resume *//* defines for hostdata->disconnect */#define DIS_NEVER 0#define DIS_ADAPTIVE 1#define DIS_ALWAYS 2/* defines for hostdata->args */#define DB_TEST 1<<0#define DB_FIFO 1<<1#define DB_QUEUE_COMMAND 1<<2#define DB_EXECUTE 1<<3#define DB_INTR 1<<4#define DB_TRANSFER 1<<5#define DB_MASK 0x3f#define A_NO_SCSI_RESET 1<<15/* defines for hostdata->sync_xfer[] */#define SS_UNSET 0#define SS_FIRST 1#define SS_WAITING 2#define SS_SET 3/* defines for hostdata->proc */#define PR_VERSION 1<<0#define PR_INFO 1<<1#define PR_STATISTICS 1<<2#define PR_CONNECTED 1<<3#define PR_INPUTQ 1<<4#define PR_DISCQ 1<<5#define PR_TEST 1<<6#define PR_STOP 1<<7#include <linux/version.h>#if LINUX_VERSION_CODE < 0x020100 /* 2.0.xx */# define in2000__INITFUNC(function) function# define in2000__INIT# define in2000__INITDATA# define CLISPIN_LOCK(flags) do { save_flags(flags); cli(); } while(0)# define CLISPIN_UNLOCK(flags) restore_flags(flags)#else /* 2.1.xxx */# include <linux/init.h># include <asm/spinlock.h># define in2000__INITFUNC(function) __initfunc(function)# define in2000__INIT __init# define in2000__INITDATA __initdata# define CLISPIN_LOCK(flags) spin_lock_irqsave(&io_request_lock, flags)# define CLISPIN_UNLOCK(flags) spin_unlock_irqrestore(&io_request_lock, flags)#endifint in2000_detect(Scsi_Host_Template *) in2000__INIT;int in2000_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));int in2000_abort(Scsi_Cmnd *);void in2000_setup(char *, int *) in2000__INIT;int in2000_proc_info(char *, char **, off_t, int, int, int);struct proc_dir_entry proc_scsi_in2000;int in2000_biosparam(struct scsi_disk *, kdev_t, int *);int in2000_reset(Scsi_Cmnd *, unsigned int);#define IN2000_CAN_Q 16#define IN2000_SG SG_ALL#define IN2000_CPL 2#define IN2000_HOST_ID 7#if LINUX_VERSION_CODE < 0x020100 /* 2.0.xx */#define IN2000 { NULL, /* link pointer for modules */ \ NULL, /* usage_count for modules */ \ &proc_scsi_in2000, /* pointer to /proc/scsi directory entry */ \ in2000_proc_info, /* pointer to proc info function */ \ "Always IN2000", /* device name */ \ in2000_detect, /* returns number of in2000's found */ \ NULL, /* optional unload function for modules */ \ NULL, /* optional misc info function */ \ NULL, /* send scsi command, wait for completion */ \ in2000_queuecommand, /* queue scsi command, don't wait */ \ in2000_abort, /* abort current command */ \ in2000_reset, /* reset scsi bus */ \ NULL, /* slave_attach - unused */ \ in2000_biosparam, /* figures out BIOS parameters for lilo, etc */ \ IN2000_CAN_Q, /* max commands we can queue up */ \ IN2000_HOST_ID, /* host-adapter scsi id */ \ IN2000_SG, /* scatter-gather table size */ \ IN2000_CPL, /* commands per lun */ \ 0, /* board counter */ \ 0, /* unchecked dma */ \ DISABLE_CLUSTERING \ }#else /* 2.1.xxx */#define IN2000 { proc_dir: &proc_scsi_in2000, /* pointer to /proc/scsi directory entry */ \ proc_info: in2000_proc_info, /* pointer to proc info function */ \ name: "Always IN2000", /* device name */ \ detect: in2000_detect, /* returns number of in2000's found */ \ queuecommand: in2000_queuecommand, /* queue scsi command, don't wait */ \ abort: in2000_abort, /* abort current command */ \ reset: in2000_reset, /* reset scsi bus */ \ bios_param: in2000_biosparam, /* figures out BIOS parameters for lilo, etc */ \ can_queue: IN2000_CAN_Q, /* max commands we can queue up */ \ this_id: IN2000_HOST_ID, /* host-adapter scsi id */ \ sg_tablesize: IN2000_SG, /* scatter-gather table size */ \ cmd_per_lun: IN2000_CPL, /* commands per lun */ \ use_clustering: DISABLE_CLUSTERING, /* ENABLE_CLUSTERING may speed things up */ \ use_new_eh_code: 0 /* new error code - not using it yet */ \ }#endif#endif /* IN2000_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -