📄 flashpoint.c
字号:
/* FlashPoint.c -- FlashPoint SCCB Manager for Linux This file contains the FlashPoint SCCB Manager from BusLogic's FlashPoint Driver Developer's Kit, with minor modifications by Leonard N. Zubkoff for Linux compatibility. It was provided by BusLogic in the form of 16 separate source files, which would have unnecessarily cluttered the scsi directory, so the individual files have been combined into this single file. Copyright 1995-1996 by Mylex Corporation. All Rights Reserved This file is available under both the GNU General Public License and a BSD-style copyright; see LICENSE.FlashPoint for details.*/#include <linux/config.h>#ifndef CONFIG_SCSI_OMIT_FLASHPOINT#define UNIX#define FW_TYPE _SCCB_MGR_#define MAX_CARDS 8#undef BUSTYPE_PCI#define OS_InPortByte(port) inb(port)#define OS_InPortWord(port) inw(port)#define OS_InPortLong(port) inl(port)#define OS_OutPortByte(port, value) outb(value, port)#define OS_OutPortWord(port, value) outw(value, port)#define OS_OutPortLong(port, value) outl(value, port)#define OS_Lock(x)#define OS_UnLock(x)/* Define name replacements for compatibility with the Linux BusLogic Driver.*/#define SccbMgr_sense_adapter FlashPoint_ProbeHostAdapter#define SccbMgr_config_adapter FlashPoint_HardwareResetHostAdapter#define SccbMgr_unload_card FlashPoint_ReleaseHostAdapter#define SccbMgr_start_sccb FlashPoint_StartCCB#define SccbMgr_abort_sccb FlashPoint_AbortCCB#define SccbMgr_my_int FlashPoint_InterruptPending#define SccbMgr_isr FlashPoint_HandleInterrupt/* Define name replacements to avoid kernel namespace pollution.*/#define BL_Card FPT_BL_Card#define BusMasterInit FPT_BusMasterInit#define CalcCrc16 FPT_CalcCrc16#define CalcLrc FPT_CalcLrc#define ChkIfChipInitialized FPT_ChkIfChipInitialized#define DiagBusMaster FPT_DiagBusMaster#define DiagEEPROM FPT_DiagEEPROM#define DiagXbow FPT_DiagXbow#define GetTarLun FPT_GetTarLun#define RNVRamData FPT_RNVRamData#define RdStack FPT_RdStack#define SccbMgrTableInitAll FPT_SccbMgrTableInitAll#define SccbMgrTableInitCard FPT_SccbMgrTableInitCard#define SccbMgrTableInitTarget FPT_SccbMgrTableInitTarget#define SccbMgr_bad_isr FPT_SccbMgr_bad_isr#define SccbMgr_scsi_reset FPT_SccbMgr_scsi_reset#define SccbMgr_timer_expired FPT_SccbMgr_timer_expired#define SendMsg FPT_SendMsg#define Wait FPT_Wait#define Wait1Second FPT_Wait1Second#define WrStack FPT_WrStack#define XbowInit FPT_XbowInit#define autoCmdCmplt FPT_autoCmdCmplt#define autoLoadDefaultMap FPT_autoLoadDefaultMap#define busMstrDataXferStart FPT_busMstrDataXferStart#define busMstrSGDataXferStart FPT_busMstrSGDataXferStart#define busMstrTimeOut FPT_busMstrTimeOut#define dataXferProcessor FPT_dataXferProcessor#define default_intena FPT_default_intena#define hostDataXferAbort FPT_hostDataXferAbort#define hostDataXferRestart FPT_hostDataXferRestart#define inisci FPT_inisci#define mbCards FPT_mbCards#define nvRamInfo FPT_nvRamInfo#define phaseBusFree FPT_phaseBusFree#define phaseChkFifo FPT_phaseChkFifo#define phaseCommand FPT_phaseCommand#define phaseDataIn FPT_phaseDataIn#define phaseDataOut FPT_phaseDataOut#define phaseDecode FPT_phaseDecode#define phaseIllegal FPT_phaseIllegal#define phaseMsgIn FPT_phaseMsgIn#define phaseMsgOut FPT_phaseMsgOut#define phaseStatus FPT_phaseStatus#define queueAddSccb FPT_queueAddSccb#define queueCmdComplete FPT_queueCmdComplete#define queueDisconnect FPT_queueDisconnect#define queueFindSccb FPT_queueFindSccb#define queueFlushSccb FPT_queueFlushSccb#define queueFlushTargSccb FPT_queueFlushTargSccb#define queueSearchSelect FPT_queueSearchSelect#define queueSelectFail FPT_queueSelectFail#define s_PhaseTbl FPT_s_PhaseTbl#define scamHAString FPT_scamHAString#define scamInfo FPT_scamInfo#define scarb FPT_scarb#define scasid FPT_scasid#define scbusf FPT_scbusf#define sccbMgrTbl FPT_sccbMgrTbl#define schkdd FPT_schkdd#define scini FPT_scini#define sciso FPT_sciso#define scmachid FPT_scmachid#define scsavdi FPT_scsavdi#define scsel FPT_scsel#define scsell FPT_scsell#define scsendi FPT_scsendi#define scvalq FPT_scvalq#define scwirod FPT_scwirod#define scwiros FPT_scwiros#define scwtsel FPT_scwtsel#define scxferc FPT_scxferc#define sdecm FPT_sdecm#define sfm FPT_sfm#define shandem FPT_shandem#define sinits FPT_sinits#define sisyncn FPT_sisyncn#define sisyncr FPT_sisyncr#define siwidn FPT_siwidn#define siwidr FPT_siwidr#define sres FPT_sres#define sresb FPT_sresb#define ssel FPT_ssel#define ssenss FPT_ssenss#define sssyncv FPT_sssyncv#define stsyncn FPT_stsyncn#define stwidn FPT_stwidn#define sxfrp FPT_sxfrp#define utilEERead FPT_utilEERead#define utilEEReadOrg FPT_utilEEReadOrg#define utilEESendCmdAddr FPT_utilEESendCmdAddr#define utilEEWrite FPT_utilEEWrite#define utilEEWriteOnOff FPT_utilEEWriteOnOff#define utilUpdateResidual FPT_utilUpdateResidual/*---------------------------------------------------------------------- * * * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved * * This file is available under both the GNU General Public License * and a BSD-style copyright; see LICENSE.FlashPoint for details. * * $Workfile: globals.h $ * * Description: Common shared global defines. * * $Date: 1999/04/26 05:53:56 $ * * $Revision: 1.1 $ * *----------------------------------------------------------------------*/#ifndef __GLOBALS_H__#define __GLOBALS_H__#define _UCB_MGR_ 1#define _SCCB_MGR_ 2/*#include <osflags.h>*/#define MAX_CDBLEN 12#define SCAM_LEV_2 1#define CRCMASK 0xA001/* In your osflags.h file, please ENSURE that only ONE OS FLAG is on at a time !!! Also, please make sure you turn set the variable FW_TYPE to either _UCB_MGR_ or _SCCB_MGR_ !!! */#if defined(DOS) || defined(WIN95_16) || defined(OS2) || defined(OTHER_16) #define COMPILER_16_BIT 1#elif defined(NETWARE) || defined(NT) || defined(WIN95_32) || defined(UNIX) || defined(OTHER_32) || defined(SOLARIS_REAL_MODE) #define COMPILER_32_BIT 1#endif#define BL_VENDOR_ID 0x104B#define FP_DEVICE_ID 0x8130#define MM_DEVICE_ID 0x1040#ifndef FALSE#define FALSE 0#endif#ifndef TRUE#define TRUE (!(FALSE))#endif#ifndef NULL#define NULL 0#endif#define FAILURE 0xFFFFFFFFLtypedef unsigned char UCHAR;typedef unsigned short USHORT;typedef unsigned int UINT;typedef unsigned long ULONG;typedef unsigned char * PUCHAR;typedef unsigned short* PUSHORT;typedef unsigned long * PULONG;typedef void * PVOID;#if defined(COMPILER_16_BIT)typedef unsigned char far * uchar_ptr;typedef unsigned short far * ushort_ptr;typedef unsigned long far * ulong_ptr;#endif /* 16_BIT_COMPILER */#if defined(COMPILER_32_BIT)typedef unsigned char * uchar_ptr;typedef unsigned short * ushort_ptr;typedef unsigned long * ulong_ptr;#endif /* 32_BIT_COMPILER *//* NEW TYPE DEFINITIONS (shared with Mylex North)** Use following type defines to avoid confusion in 16 and 32-bit** environments. Avoid using 'int' as it denotes 16 bits in 16-bit** environment and 32 in 32-bit environments.*/#define s08bits char#define s16bits short#define s32bits long#define u08bits unsigned s08bits#define u16bits unsigned s16bits#define u32bits unsigned s32bits#if defined(COMPILER_16_BIT)typedef u08bits far * pu08bits;typedef u16bits far * pu16bits;typedef u32bits far * pu32bits;#endif /* COMPILER_16_BIT */#if defined(COMPILER_32_BIT)typedef u08bits * pu08bits;typedef u16bits * pu16bits;typedef u32bits * pu32bits;#endif /* COMPILER_32_BIT */#define BIT(x) ((UCHAR)(1<<(x))) /* single-bit mask in bit position x */#define BITW(x) ((USHORT)(1<<(x))) /* single-bit mask in bit position x */#if defined(DOS)/*#include <dos.h>*/ #undef inportb /* undefine for Borland Lib */ #undef inport /* they may have define I/O function in LIB */ #undef outportb #undef outport #define OS_InPortByte(ioport) inportb(ioport) #define OS_InPortWord(ioport) inport(ioport) #define OS_InPortLong(ioport) inportq(ioport, val) #define OS_OutPortByte(ioport, val) outportb(ioport, val) #define OS_OutPortWord(ioport, val) outport(ioport, val) #define OS_OutPortLong(ioport) outportq(ioport, val)#endif /* DOS */#if defined(NETWARE) || defined(OTHER_32) || defined(OTHER_16) extern u08bits OS_InPortByte(u32bits ioport); extern u16bits OS_InPortWord(u32bits ioport); extern u32bits OS_InPortLong(u32bits ioport); extern OS_InPortByteBuffer(u32bits ioport, pu08bits buffer, u32bits count); extern OS_InPortWordBuffer(u32bits ioport, pu16bits buffer, u32bits count); extern OS_OutPortByte(u32bits ioport, u08bits val); extern OS_OutPortWord(u32bits ioport, u16bits val); extern OS_OutPortLong(u32bits ioport, u32bits val); extern OS_OutPortByteBuffer(u32bits ioport, pu08bits buffer, u32bits count); extern OS_OutPortWordBuffer(u32bits ioport, pu16bits buffer, u32bits count);#endif /* NETWARE || OTHER_32 || OTHER_16 */#if defined (NT) || defined(WIN95_32) || defined(WIN95_16) #if defined(NT) extern __declspec(dllimport) u08bits ScsiPortReadPortUchar(pu08bits ioport); extern __declspec(dllimport) u16bits ScsiPortReadPortUshort(pu16bits ioport); extern __declspec(dllimport) u32bits ScsiPortReadPortUlong(pu32bits ioport); extern __declspec(dllimport) void ScsiPortWritePortUchar(pu08bits ioport, u08bits val); extern __declspec(dllimport) void ScsiPortWritePortUshort(pu16bits port, u16bits val); extern __declspec(dllimport) void ScsiPortWritePortUlong(pu32bits port, u32bits val); #else extern u08bits ScsiPortReadPortUchar(pu08bits ioport); extern u16bits ScsiPortReadPortUshort(pu16bits ioport); extern u32bits ScsiPortReadPortUlong(pu32bits ioport); extern void ScsiPortWritePortUchar(pu08bits ioport, u08bits val); extern void ScsiPortWritePortUshort(pu16bits port, u16bits val); extern void ScsiPortWritePortUlong(pu32bits port, u32bits val); #endif #define OS_InPortByte(ioport) ScsiPortReadPortUchar((pu08bits) ioport) #define OS_InPortWord(ioport) ScsiPortReadPortUshort((pu16bits) ioport) #define OS_InPortLong(ioport) ScsiPortReadPortUlong((pu32bits) ioport) #define OS_OutPortByte(ioport, val) ScsiPortWritePortUchar((pu08bits) ioport, (u08bits) val) #define OS_OutPortWord(ioport, val) ScsiPortWritePortUshort((pu16bits) ioport, (u16bits) val) #define OS_OutPortLong(ioport, val) ScsiPortWritePortUlong((pu32bits) ioport, (u32bits) val) #define OS_OutPortByteBuffer(ioport, buffer, count) \ ScsiPortWritePortBufferUchar((pu08bits)&port, (pu08bits) buffer, (u32bits) count) #define OS_OutPortWordBuffer(ioport, buffer, count) \ ScsiPortWritePortBufferUshort((pu16bits)&port, (pu16bits) buffer, (u32bits) count) #define OS_Lock(x) #define OS_UnLock(x)#endif /* NT || WIN95_32 || WIN95_16 */#if defined (UNIX) && !defined(OS_InPortByte) #define OS_InPortByte(ioport) inb((u16bits)ioport) #define OS_InPortWord(ioport) inw((u16bits)ioport) #define OS_InPortLong(ioport) inl((u16bits)ioport) #define OS_OutPortByte(ioport,val) outb((u16bits)ioport, (u08bits)val) #define OS_OutPortWord(ioport,val) outw((u16bits)ioport, (u16bits)val) #define OS_OutPortLong(ioport,val) outl((u16bits)ioport, (u32bits)val) #define OS_Lock(x) #define OS_UnLock(x)#endif /* UNIX */#if defined(OS2) extern u08bits inb(u32bits ioport); extern u16bits inw(u32bits ioport); extern void outb(u32bits ioport, u08bits val); extern void outw(u32bits ioport, u16bits val); #define OS_InPortByte(ioport) inb(ioport) #define OS_InPortWord(ioport) inw(ioport) #define OS_OutPortByte(ioport, val) outb(ioport, val) #define OS_OutPortWord(ioport, val) outw(ioport, val) extern u32bits OS_InPortLong(u32bits ioport); extern void OS_OutPortLong(u32bits ioport, u32bits val); #define OS_Lock(x) #define OS_UnLock(x)#endif /* OS2 */#if defined(SOLARIS_REAL_MODE)extern unsigned char inb(unsigned long ioport);extern unsigned short inw(unsigned long ioport);#define OS_InPortByte(ioport) inb(ioport)#define OS_InPortWord(ioport) inw(ioport)extern void OS_OutPortByte(unsigned long ioport, unsigned char val);extern void OS_OutPortWord(unsigned long ioport, unsigned short val);extern unsigned long OS_InPortLong(unsigned long ioport);extern void OS_OutPortLong(unsigned long ioport, unsigned long val);#define OS_Lock(x)#define OS_UnLock(x)#endif /* SOLARIS_REAL_MODE */#endif /* __GLOBALS_H__ *//*---------------------------------------------------------------------- * * * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved * * This file is available under both the GNU General Public License * and a BSD-style copyright; see LICENSE.FlashPoint for details. * * $Workfile: sccbmgr.h $ * * Description: Common shared SCCB Interface defines and SCCB * Manager specifics defines. *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -