summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/FlashPoint.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.(none)>2005-04-24 02:38:05 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-05-20 12:53:34 -0500
commit47b5d69c4aa753fcfc9b2b8d28c0660a1e25c129 (patch)
treefe7b76c571de6ce105fb0b8917e0fb94a6895f55 /drivers/scsi/FlashPoint.c
parent7dfaa5f40da87e85b3883b102bbf1bf3f3b42534 (diff)
[SCSI] drivers/scsi/FlashPoint.c: cleanups
From: Adrian Bunk <bunk@stusta.de> This patch contains cleanups including the following: - remove #ifdef'ed code for other OS's - remove other unused code - make needlessly global code static Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/FlashPoint.c')
-rw-r--r--drivers/scsi/FlashPoint.c5676
1 files changed, 875 insertions, 4801 deletions
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index 56a695c6ab52..5beed4f6d985 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -22,8 +22,6 @@
#ifndef CONFIG_SCSI_OMIT_FLASHPOINT
-#define UNIX
-#define FW_TYPE _SCCB_MGR_
#define MAX_CARDS 8
#undef BUSTYPE_PCI
@@ -34,8 +32,6 @@
#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)
/*
@@ -51,164 +47,17 @@
#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: 1996/09/04 01:26:13 $
- *
- * $Revision: 1.11 $
- *
- *----------------------------------------------------------------------*/
-#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 0xFFFFFFFFL
@@ -222,27 +71,11 @@ 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
@@ -251,195 +84,19 @@ typedef unsigned long * ulong_ptr;
#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.
- *
- * $Date: 1996/10/24 23:09:33 $
- *
- * $Revision: 1.14 $
- *
- *----------------------------------------------------------------------*/
-
-#ifndef __SCCB_H__
-#define __SCCB_H__
-
-/*#include <osflags.h>*/
-/*#include <globals.h>*/
-
-#if defined(BUGBUG)
-#define debug_size 32
-#endif
-
-#if defined(DOS)
-
- typedef struct _SCCB near *PSCCB;
- #if (FW_TYPE == _SCCB_MGR_)
- typedef void (*CALL_BK_FN)(PSCCB);
- #endif
-
-#elif defined(OS2)
-
- typedef struct _SCCB far *PSCCB;
- #if (FW_TYPE == _SCCB_MGR_)
- typedef void (far *CALL_BK_FN)(PSCCB);
- #endif
-
-#else
-
- typedef struct _SCCB *PSCCB;
- #if (FW_TYPE == _SCCB_MGR_)
- typedef void (*CALL_BK_FN)(PSCCB);
- #endif
-
-#endif
+typedef struct _SCCB *PSCCB;
+typedef void (*CALL_BK_FN)(PSCCB);
typedef struct SCCBMgr_info {
@@ -466,25 +123,13 @@ typedef struct SCCBMgr_info {
ULONG si_secondary_range;
} SCCBMGR_INFO;
-#if defined(DOS)
- typedef SCCBMGR_INFO * PSCCBMGR_INFO;
-#else
- #if defined (COMPILER_16_BIT)
- typedef SCCBMGR_INFO far * PSCCBMGR_INFO;
- #else
- typedef SCCBMGR_INFO * PSCCBMGR_INFO;
- #endif
-#endif // defined(DOS)
+typedef SCCBMGR_INFO * PSCCBMGR_INFO;
-
-
-#if (FW_TYPE==_SCCB_MGR_)
- #define SCSI_PARITY_ENA 0x0001
- #define LOW_BYTE_TERM 0x0010
- #define HIGH_BYTE_TERM 0x0020
- #define BUSTYPE_PCI 0x3
-#endif
+#define SCSI_PARITY_ENA 0x0001
+#define LOW_BYTE_TERM 0x0010
+#define HIGH_BYTE_TERM 0x0020
+#define BUSTYPE_PCI 0x3
#define SUPPORT_16TAR_32LUN 0x0002
#define SOFT_RESET 0x0004
@@ -553,9 +198,6 @@ typedef struct _SCCB {
UCHAR Save_CdbLen;
UCHAR Sccb_XferState;
ULONG Sccb_SGoffset;
-#if (FW_TYPE == _UCB_MGR_)
- PUCB Sccb_ucb_ptr;
-#endif
} SCCB;
#define SCCB_SIZE sizeof(SCCB)
@@ -626,25 +268,9 @@ typedef struct _SCCB {
-#if (FW_TYPE==_UCB_MGR_)
- #define HBA_AUTO_SENSE_FAIL 0x1B
- #define HBA_TQ_REJECTED 0x1C
- #define HBA_UNSUPPORTED_MSG 0x1D
- #define HBA_HW_ERROR 0x20
- #define HBA_ATN_NOT_RESPONDED 0x21
- #define HBA_SCSI_RESET_BY_ADAPTER 0x22
- #define HBA_SCSI_RESET_BY_TARGET 0x23
- #define HBA_WRONG_CONNECTION 0x24
- #define HBA_BUS_DEVICE_RESET 0x25
- #define HBA_ABORT_QUEUE 0x26
-
-#else // these are not defined in BUDI/UCB
-
- #define SCCB_INVALID_DIRECTION 0x18 /* Invalid target direction */
- #define SCCB_DUPLICATE_SCCB 0x19 /* Duplicate SCCB */
- #define SCCB_SCSI_RST 0x35 /* SCSI RESET detected. */
-
-#endif // (FW_TYPE==_UCB_MGR_)
+#define SCCB_INVALID_DIRECTION 0x18 /* Invalid target direction */
+#define SCCB_DUPLICATE_SCCB 0x19 /* Duplicate SCCB */
+#define SCCB_SCSI_RST 0x35 /* SCSI RESET detected. */
#define SCCB_IN_PROCESS 0x00
@@ -657,115 +283,20 @@ typedef struct _SCCB {
#define SCCB_SIZE sizeof(SCCB)
-
-
-#if (FW_TYPE == _UCB_MGR_)
- void SccbMgr_start_sccb(CARD_HANDLE pCurrCard, PUCB p_ucb);
- s32bits SccbMgr_abort_sccb(CARD_HANDLE pCurrCard, PUCB p_ucb);
- u08bits SccbMgr_my_int(CARD_HANDLE pCurrCard);
- s32bits SccbMgr_isr(CARD_HANDLE pCurrCard);
- void SccbMgr_scsi_reset(CARD_HANDLE pCurrCard);
- void SccbMgr_timer_expired(CARD_HANDLE pCurrCard);
- void SccbMgr_unload_card(CARD_HANDLE pCurrCard);
- void SccbMgr_restore_foreign_state(CARD_HANDLE pCurrCard);
- void SccbMgr_restore_native_state(CARD_HANDLE pCurrCard);
- void SccbMgr_save_foreign_state(PADAPTER_INFO pAdapterInfo);
-
-#endif
-
-
-#if (FW_TYPE == _SCCB_MGR_)
-
- #if defined (DOS)
- int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo);
- USHORT SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo);
- void SccbMgr_start_sccb(USHORT pCurrCard, PSCCB p_SCCB);
- int SccbMgr_abort_sccb(USHORT pCurrCard, PSCCB p_SCCB);
- UCHAR SccbMgr_my_int(USHORT pCurrCard);
- int SccbMgr_isr(USHORT pCurrCard);
- void SccbMgr_scsi_reset(USHORT pCurrCard);
- void SccbMgr_timer_expired(USHORT pCurrCard);
- USHORT SccbMgr_status(USHORT pCurrCard);
- void SccbMgr_unload_card(USHORT pCurrCard);
-
- #else //non-DOS
-
- int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo);
- ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo);
- void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_SCCB);
- int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_SCCB);
- UCHAR SccbMgr_my_int(ULONG pCurrCard);
- int SccbMgr_isr(ULONG pCurrCard);
- void SccbMgr_scsi_reset(ULONG pCurrCard);
- void SccbMgr_enable_int(ULONG pCurrCard);
- void SccbMgr_disable_int(ULONG pCurrCard);
- void SccbMgr_timer_expired(ULONG pCurrCard);
- void SccbMgr_unload_card(ULONG pCurrCard);
-
- #endif
-#endif // (FW_TYPE == _SCCB_MGR_)
-
-#endif /* __SCCB_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: blx30.h $
- *
- * Description: This module contains SCCB/UCB Manager implementation
- * specific stuff.
- *
- * $Date: 1996/11/13 18:34:22 $
- *
- * $Revision: 1.10 $
- *
- *----------------------------------------------------------------------*/
-
-
-#ifndef __blx30_H__
-#define __blx30_H__
-
-/*#include <globals.h>*/
-
#define ORION_FW_REV 3110
-
-
-
#define HARP_REVD 1
-#if defined(DOS)
-#define QUEUE_DEPTH 8+1 /*1 for Normal disconnect 0 for Q'ing. */
-#else
#define QUEUE_DEPTH 254+1 /*1 for Normal disconnect 32 for Q'ing. */
-#endif // defined(DOS)
#define MAX_MB_CARDS 4 /* Max. no of cards suppoerted on Mother Board */
#define WIDE_SCSI 1
-#if defined(WIDE_SCSI)
- #if defined(DOS)
- #define MAX_SCSI_TAR 16
- #define MAX_LUN 8
- #define LUN_MASK 0x07
- #else
- #define MAX_SCSI_TAR 16
- #define MAX_LUN 32
- #define LUN_MASK 0x1f
-
- #endif
-#else
- #define MAX_SCSI_TAR 8
- #define MAX_LUN 8
- #define LUN_MASK 0x07
-#endif
+#define MAX_SCSI_TAR 16
+#define MAX_LUN 32
+#define LUN_MASK 0x1f
#if defined(HARP_REVA)
#define SG_BUF_CNT 15 /*Number of prefetched elements. */
@@ -778,116 +309,12 @@ typedef struct _SCCB {
#define SG_ELEMENT_MASK 0xFFFFFFFFL
-#if (FW_TYPE == _UCB_MGR_)
- #define OPC_DECODE_NORMAL 0x0f7f
-#endif // _UCB_MGR_
-
-
-
-#if defined(DOS)
-
-/*#include <dos.h>*/
- #define RD_HARPOON(ioport) (OS_InPortByte(ioport))
- #define RDW_HARPOON(ioport) (OS_InPortWord(ioport))
- #define WR_HARPOON(ioport,val) (OS_OutPortByte(ioport,val))
- #define WRW_HARPOON(ioport,val) (OS_OutPortWord(ioport,val))
-
- #define RD_HARP32(port,offset,data) asm{db 66h; \
- push ax; \
- mov dx,port; \
- add dx, offset; \
- db 66h; \
- in ax,dx; \
- db 66h; \
- mov word ptr data,ax;\
- db 66h; \
- pop ax}
-
- #define WR_HARP32(port,offset,data) asm{db 66h; \
- push ax; \
- mov dx,port; \
- add dx, offset; \
- db 66h; \
- mov ax,word ptr data;\
- db 66h; \
- out dx,ax; \
- db 66h; \
- pop ax}
-#endif /* DOS */
-
-#if defined(NETWARE) || defined(OTHER_32) || defined(OTHER_16)
- #define RD_HARPOON(ioport) OS_InPortByte((unsigned long)ioport)
- #define RDW_HARPOON(ioport) OS_InPortWord((unsigned long)ioport)
- #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong(ioport + offset))
- #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val)
- #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val)
- #define WR_HARP32(ioport,offset,data) OS_OutPortLong((ioport + offset), data)
-#endif /* NETWARE || OTHER_32 || OTHER_16 */
-
-#if defined(NT) || defined(WIN95_32) || defined(WIN95_16)
- #define RD_HARPOON(ioport) OS_InPortByte((ULONG)ioport)
- #define RDW_HARPOON(ioport) OS_InPortWord((ULONG)ioport)
- #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((ULONG)(ioport + offset)))
- #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val)
- #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val)
- #define WR_HARP32(ioport,offset,data) OS_OutPortLong((ULONG)(ioport + offset), data)
-#endif /* NT || WIN95_32 || WIN95_16 */
-
-#if defined (UNIX)
- #define RD_HARPOON(ioport) OS_InPortByte((u32bits)ioport)
- #define RDW_HARPOON(ioport) OS_InPortWord((u32bits)ioport)
- #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((u32bits)(ioport + offset)))
- #define WR_HARPOON(ioport,val) OS_OutPortByte((u32bits)ioport,(u08bits) val)
- #define WRW_HARPOON(ioport,val) OS_OutPortWord((u32bits)ioport,(u16bits)val)
- #define WR_HARP32(ioport,offset,data) OS_OutPortLong((u32bits)(ioport + offset), data)
-#endif /* UNIX */
-
-#if defined(OS2)
- #define RD_HARPOON(ioport) OS_InPortByte((unsigned long)ioport)
- #define RDW_HARPOON(ioport) OS_InPortWord((unsigned long)ioport)
- #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((ULONG)(ioport + offset)))
- #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val)
- #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val)
- #define WR_HARP32(ioport,offset,data) OS_OutPortLong(((ULONG)(ioport + offset)), data)
-#endif /* OS2 */
-
-#if defined(SOLARIS_REAL_MODE)
-
- #define RD_HARPOON(ioport) OS_InPortByte((unsigned long)ioport)
- #define RDW_HARPOON(ioport) OS_InPortWord((unsigned long)ioport)
- #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((ULONG)(ioport + offset)))
- #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val)
- #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val)
- #define WR_HARP32(ioport,offset,data) OS_OutPortLong((ULONG)(ioport + offset), (ULONG)data)
-
-#endif /* SOLARIS_REAL_MODE */
-
-#endif /* __BLX30_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: target.h $
- *
- * Description: Definitions for Target related structures
- *
- * $Date: 1996/12/11 22:06:20 $
- *
- * $Revision: 1.9 $
- *
- *----------------------------------------------------------------------*/
-
-#ifndef __TARGET__
-#define __TARGET__
-
-/*#include <globals.h>*/
-/*#include <blx30.h>*/
+#define RD_HARPOON(ioport) OS_InPortByte((u32bits)ioport)
+#define RDW_HARPOON(ioport) OS_InPortWord((u32bits)ioport)
+#define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((u32bits)(ioport + offset)))
+#define WR_HARPOON(ioport,val) OS_OutPortByte((u32bits)ioport,(u08bits) val)
+#define WRW_HARPOON(ioport,val) OS_OutPortWord((u32bits)ioport,(u16bits)val)
+#define WR_HARP32(ioport,offset,data) OS_OutPortLong((u32bits)(ioport + offset), data)
#define TAR_SYNC_MASK (BIT(7)+BIT(6))
@@ -919,16 +346,7 @@ typedef struct _SCCB {
#define EE_WIDE_SCSI BIT(7)
-#if defined(DOS)
- typedef struct SCCBMgr_tar_info near *PSCCBMgr_tar_info;
-
-#elif defined(OS2)
- typedef struct SCCBMgr_tar_info far *PSCCBMgr_tar_info;
-
-#else
- typedef struct SCCBMgr_tar_info *PSCCBMgr_tar_info;
-
-#endif
+typedef struct SCCBMgr_tar_info *PSCCBMgr_tar_info;
typedef struct SCCBMgr_tar_info {
@@ -949,11 +367,7 @@ typedef struct SCCBMgr_tar_info {
typedef struct NVRAMInfo {
UCHAR niModel; /* Model No. of card */
UCHAR niCardNo; /* Card no. */
-#if defined(DOS)
- USHORT niBaseAddr; /* Port Address of card */
-#else
ULONG niBaseAddr; /* Port Address of card */
-#endif
UCHAR niSysConf; /* Adapter Configuration byte - Byte 16 of eeprom map */
UCHAR niScsiConf; /* SCSI Configuration byte - Byte 17 of eeprom map */
UCHAR niScamConf; /* SCAM Configuration byte - Byte 20 of eeprom map */
@@ -962,13 +376,7 @@ typedef struct NVRAMInfo {
UCHAR niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name string of Targets */
}NVRAMINFO;
-#if defined(DOS)
-typedef NVRAMINFO near *PNVRamInfo;
-#elif defined (OS2)
-typedef NVRAMINFO far *PNVRamInfo;
-#else
typedef NVRAMINFO *PNVRamInfo;
-#endif
#define MODEL_LT 1
#define MODEL_DL 2
@@ -978,17 +386,9 @@ typedef NVRAMINFO *PNVRamInfo;
typedef struct SCCBcard {
PSCCB currentSCCB;
-#if (FW_TYPE==_SCCB_MGR_)
PSCCBMGR_INFO cardInfo;
-#else
- PADAPTER_INFO cardInfo;
-#endif
-#if defined(DOS)
- USHORT ioPort;
-#else
ULONG ioPort;
-#endif
USHORT cmdCounter;
UCHAR discQCount;
@@ -1002,13 +402,7 @@ typedef struct SCCBcard {
}SCCBCARD;
-#if defined(DOS)
-typedef struct SCCBcard near *PSCCBcard;
-#elif defined (OS2)
-typedef struct SCCBcard far *PSCCBcard;
-#else
typedef struct SCCBcard *PSCCBcard;
-#endif
#define F_TAG_STARTED 0x01
@@ -1063,29 +457,6 @@ typedef struct SCCBscam_info {
} SCCBSCAM_INFO, *PSCCBSCAM_INFO;
-#endif
-/*----------------------------------------------------------------------
- *
- *
- * 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: scsi2.h $
- *
- * Description: Register definitions for HARPOON ASIC.
- *
- * $Date: 1996/11/13 18:32:57 $
- *
- * $Revision: 1.4 $
- *
- *----------------------------------------------------------------------*/
-
-#ifndef __SCSI_H__
-#define __SCSI_H__
-
-
#define SCSI_TEST_UNIT_READY 0x00
#define SCSI_REZERO_UNIT 0x01
@@ -1195,29 +566,6 @@ typedef struct SCCBscam_info {
#define SYNC5MBS 0x32
#define MAX_OFFSET 0x0F /* Maxbyteoffset for Sync Xfers */
-#endif
-/*----------------------------------------------------------------------
- *
- *
- * 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: eeprom.h $
- *
- * Description: Definitions for EEPROM related structures
- *
- * $Date: 1996/11/13 18:28:39 $
- *
- * $Revision: 1.4 $
- *
- *----------------------------------------------------------------------*/
-
-#ifndef __EEPROM__
-#define __EEPROM__
-
-/*#include <globals.h>*/
#define EEPROM_WD_CNT 256
@@ -1280,31 +628,6 @@ typedef struct SCCBscam_info {
#define DISC_ENABLE_BIT BIT(6)
-#endif
-/*----------------------------------------------------------------------
- *
- *
- * 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: harpoon.h $
- *
- * Description: Register definitions for HARPOON ASIC.
- *
- * $Date: 1997/07/09 21:44:36 $
- *
- * $Revision: 1.9 $
- *
- *----------------------------------------------------------------------*/
-
-
-/*#include <globals.h>*/
-
-#ifndef __HARPOON__
-#define __HARPOON__
-
#define hp_vendor_id_0 0x00 /* LSB */
#define ORION_VEND_0 0x4B
@@ -1578,8 +901,6 @@ typedef struct SCCBscam_info {
- extern USHORT default_intena;
-
#define hp_intena 0x40
#define RESET BITW(7)
@@ -1972,15 +1293,6 @@ typedef struct SCCBscam_info {
xfercnt <<= 16,\
xfercnt |= RDW_HARPOON((USHORT)(port+hp_xfercnt_0)))
*/
-#if defined(DOS)
-#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((USHORT)(port+hp_host_addr_lo), (USHORT)(addr & 0x0000FFFFL)),\
- addr >>= 16,\
- WRW_HARPOON((USHORT)(port+hp_host_addr_hmi), (USHORT)(addr & 0x0000FFFFL)),\
- WR_HARP32(port,hp_xfercnt_0,count),\
- WRW_HARPOON((USHORT)(port+hp_xfer_cnt_lo), (USHORT)(count & 0x0000FFFFL)),\
- count >>= 16,\
- WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF)))
-#else
#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (USHORT)(addr & 0x0000FFFFL)),\
addr >>= 16,\
WRW_HARPOON((port+hp_host_addr_hmi), (USHORT)(addr & 0x0000FFFFL)),\
@@ -1988,7 +1300,6 @@ typedef struct SCCBscam_info {
WRW_HARPOON((port+hp_xfer_cnt_lo), (USHORT)(count & 0x0000FFFFL)),\
count >>= 16,\
WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF)))
-#endif
#define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
WR_HARPOON(port+hp_scsisig, S_ILL_PH);}
@@ -2020,383 +1331,145 @@ typedef struct SCCBscam_info {
-#endif
-
-#if (FW_TYPE==_UCB_MGR_)
-void ReadNVRam(PSCCBcard pCurrCard,PUCB p_ucb);
-void WriteNVRam(PSCCBcard pCurrCard,PUCB p_ucb);
-void UpdateCheckSum(u32bits baseport);
-#endif // (FW_TYPE==_UCB_MGR_)
-
-#if defined(DOS)
-UCHAR sfm(USHORT port, PSCCB pcurrSCCB);
-void scsiStartAuto(USHORT port);
-UCHAR sisyncn(USHORT port, UCHAR p_card, UCHAR syncFlag);
-void ssel(USHORT port, UCHAR p_card);
-void sres(USHORT port, UCHAR p_card, PSCCBcard pCurrCard);
-void sdecm(UCHAR message, USHORT port, UCHAR p_card);
-void shandem(USHORT port, UCHAR p_card,PSCCB pCurrSCCB);
-void stsyncn(USHORT port, UCHAR p_card);
-void sisyncr(USHORT port,UCHAR sync_pulse, UCHAR offset);
-void sssyncv(USHORT p_port, UCHAR p_id, UCHAR p_sync_value, PSCCBMgr_tar_info currTar_Info);
-void sresb(USHORT port, UCHAR p_card);
-void sxfrp(USHORT p_port, UCHAR p_card);
-void schkdd(USHORT port, UCHAR p_card);
-UCHAR RdStack(USHORT port, UCHAR index);
-void WrStack(USHORT portBase, UCHAR index, UCHAR data);
-UCHAR ChkIfChipInitialized(USHORT ioPort);
-
-#if defined(V302)
-UCHAR GetTarLun(USHORT port, UCHAR p_card, UCHAR our_target, PSCCBcard pCurrCard, PUCHAR tag, PUCHAR lun);
-#endif
-
-void SendMsg(USHORT port, UCHAR message);
-void queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, UCHAR error_code);
-UCHAR scsellDOS(USHORT p_port, UCHAR targ_id);
-#else
-UCHAR sfm(ULONG port, PSCCB pcurrSCCB);
void scsiStartAuto(ULONG port);
-UCHAR sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag);
-void ssel(ULONG port, UCHAR p_card);
-void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard);
-void sdecm(UCHAR message, ULONG port, UCHAR p_card);
-void shandem(ULONG port, UCHAR p_card,PSCCB pCurrSCCB);
-void stsyncn(ULONG port, UCHAR p_card);
-void sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset);
-void sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value, PSCCBMgr_tar_info currTar_Info);
-void sresb(ULONG port, UCHAR p_card);
-void sxfrp(ULONG p_port, UCHAR p_card);
-void schkdd(ULONG port, UCHAR p_card);
-UCHAR RdStack(ULONG port, UCHAR index);
-void WrStack(ULONG portBase, UCHAR index, UCHAR data);
-UCHAR ChkIfChipInitialized(ULONG ioPort);
-
-#if defined(V302)
-UCHAR GetTarLun(ULONG port, UCHAR p_card, UCHAR our_target, PSCCBcard pCurrCard, PUCHAR tar, PUCHAR lun);
-#endif
+static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag);
+static void FPT_ssel(ULONG port, UCHAR p_card);
+static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard);
+static void FPT_shandem(ULONG port, UCHAR p_card,PSCCB pCurrSCCB);
+static void FPT_stsyncn(ULONG port, UCHAR p_card);
+static void FPT_sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset);
+static void FPT_sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value,
+ PSCCBMgr_tar_info currTar_Info);
+static void FPT_sresb(ULONG port, UCHAR p_card);
+static void FPT_sxfrp(ULONG p_port, UCHAR p_card);
+static void FPT_schkdd(ULONG port, UCHAR p_card);
+static UCHAR FPT_RdStack(ULONG port, UCHAR index);
+static void FPT_WrStack(ULONG portBase, UCHAR index, UCHAR data);
+static UCHAR FPT_ChkIfChipInitialized(ULONG ioPort);
-void SendMsg(ULONG port, UCHAR message);
-void queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, UCHAR error_code);
-#endif
+static void FPT_SendMsg(ULONG port, UCHAR message);
+static void FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg,
+ UCHAR error_code);
-void ssenss(PSCCBcard pCurrCard);
-void sinits(PSCCB p_sccb, UCHAR p_card);
-void RNVRamData(PNVRamInfo pNvRamInfo);
-
-#if defined(WIDE_SCSI)
- #if defined(DOS)
- UCHAR siwidn(USHORT port, UCHAR p_card);
- void stwidn(USHORT port, UCHAR p_card);
- void siwidr(USHORT port, UCHAR width);
- #else
- UCHAR siwidn(ULONG port, UCHAR p_card);
- void stwidn(ULONG port, UCHAR p_card);
- void siwidr(ULONG port, UCHAR width);
- #endif
-#endif
+static void FPT_sinits(PSCCB p_sccb, UCHAR p_card);
+static void FPT_RNVRamData(PNVRamInfo pNvRamInfo);
+static UCHAR FPT_siwidn(ULONG port, UCHAR p_card);
+static void FPT_stwidn(ULONG port, UCHAR p_card);
+static void FPT_siwidr(ULONG port, UCHAR width);
-void queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card);
-void queueDisconnect(PSCCB p_SCCB, UCHAR p_card);
-void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_SCCB, UCHAR p_card);
-void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card);
-void queueFlushSccb(UCHAR p_card, UCHAR error_code);
-void queueAddSccb(PSCCB p_SCCB, UCHAR card);
-UCHAR queueFindSccb(PSCCB p_SCCB, UCHAR p_card);
-void utilUpdateResidual(PSCCB p_SCCB);
-USHORT CalcCrc16(UCHAR buffer[]);
-UCHAR CalcLrc(UCHAR buffer[]);
-
-
-#if defined(DOS)
-void Wait1Second(USHORT p_port);
-void Wait(USHORT p_port, UCHAR p_delay);
-void utilEEWriteOnOff(USHORT p_port,UCHAR p_mode);
-void utilEEWrite(USHORT