[SCSI] drivers/scsi/FlashPoint.c: remove ushort_ptr
[pandora-kernel.git] / drivers / scsi / FlashPoint.c
index 8d64f0b..6089af0 100644 (file)
 #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 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 MAX_CDBLEN  12
 
-#define SCAM_LEV_2     1
 
 #define CRCMASK        0xA001
 
-#define     BL_VENDOR_ID      0x104B
-#define     FP_DEVICE_ID      0x8130
-#define     MM_DEVICE_ID      0x1040
 
 
 #define FAILURE         0xFFFFFFFFL
 
 
-typedef 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;
 
 
-typedef unsigned char           * uchar_ptr;
-typedef unsigned short          * ushort_ptr;
-typedef unsigned long           * ulong_ptr;
 
 
 #define s08bits        char
@@ -84,13 +52,10 @@ typedef unsigned long           * ulong_ptr;
 #define u16bits        unsigned s16bits
 #define u32bits        unsigned s32bits
 
-typedef u08bits        * pu08bits;
-typedef u16bits        * pu16bits;
-typedef u32bits        * pu32bits;
 
 
-#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 */
+#define BIT(x)          ((unsigned char)(1<<(x)))    /* single-bit mask in bit position x */
+#define BITW(x)          ((unsigned short)(1<<(x)))  /* single-bit mask in bit position x */
 
 
 
@@ -100,27 +65,27 @@ typedef void (*CALL_BK_FN)(PSCCB);
 
 
 typedef struct SCCBMgr_info {
-   ULONG    si_baseaddr;
-   UCHAR    si_present;
-   UCHAR    si_intvect;
-   UCHAR    si_id;
-   UCHAR    si_lun;
-   USHORT   si_fw_revision;
-   USHORT   si_per_targ_init_sync;
-   USHORT   si_per_targ_fast_nego;
-   USHORT   si_per_targ_ultra_nego;
-   USHORT   si_per_targ_no_disc;
-   USHORT   si_per_targ_wide_nego;
-   USHORT   si_flags;
-   UCHAR    si_card_family;
-   UCHAR    si_bustype;
-   UCHAR    si_card_model[3];
-   UCHAR    si_relative_cardnum;
-   UCHAR    si_reserved[4];
-   ULONG    si_OS_reserved;
-   UCHAR    si_XlatInfo[4];
-   ULONG    si_reserved2[5];
-   ULONG    si_secondary_range;
+   unsigned long    si_baseaddr;
+   unsigned char    si_present;
+   unsigned char    si_intvect;
+   unsigned char    si_id;
+   unsigned char    si_lun;
+   unsigned short   si_fw_revision;
+   unsigned short   si_per_targ_init_sync;
+   unsigned short   si_per_targ_fast_nego;
+   unsigned short   si_per_targ_ultra_nego;
+   unsigned short   si_per_targ_no_disc;
+   unsigned short   si_per_targ_wide_nego;
+   unsigned short   si_flags;
+   unsigned char    si_card_family;
+   unsigned char    si_bustype;
+   unsigned char    si_card_model[3];
+   unsigned char    si_relative_cardnum;
+   unsigned char    si_reserved[4];
+   unsigned long    si_OS_reserved;
+   unsigned char    si_XlatInfo[4];
+   unsigned long    si_reserved2[5];
+   unsigned long    si_secondary_range;
 } SCCBMGR_INFO;
 
 typedef SCCBMGR_INFO *      PSCCBMGR_INFO;
@@ -144,10 +109,6 @@ typedef SCCBMGR_INFO *      PSCCBMGR_INFO;
 #define HARPOON_FAMILY        0x02
 
 
-#define ISA_BUS_CARD          0x01
-#define EISA_BUS_CARD         0x02
-#define PCI_BUS_CARD          0x03
-#define VESA_BUS_CARD         0x04
 
 /* SCCB struct used for both SCCB and UCB manager compiles! 
  * The UCB Manager treats the SCCB as it's 'native hardware structure' 
@@ -156,58 +117,55 @@ typedef SCCBMGR_INFO *      PSCCBMGR_INFO;
 
 #pragma pack(1)
 typedef struct _SCCB {
-   UCHAR OperationCode;
-   UCHAR ControlByte;
-   UCHAR CdbLength;
-   UCHAR RequestSenseLength;
-   ULONG DataLength;
-   ULONG DataPointer;
-   UCHAR CcbRes[2];
-   UCHAR HostStatus;
-   UCHAR TargetStatus;
-   UCHAR TargID;
-   UCHAR Lun;
-   UCHAR Cdb[12];
-   UCHAR CcbRes1;
-   UCHAR Reserved1;
-   ULONG Reserved2;
-   ULONG SensePointer;
+   unsigned char OperationCode;
+   unsigned char ControlByte;
+   unsigned char CdbLength;
+   unsigned char RequestSenseLength;
+   unsigned long DataLength;
+   unsigned long DataPointer;
+   unsigned char CcbRes[2];
+   unsigned char HostStatus;
+   unsigned char TargetStatus;
+   unsigned char TargID;
+   unsigned char Lun;
+   unsigned char Cdb[12];
+   unsigned char CcbRes1;
+   unsigned char Reserved1;
+   unsigned long Reserved2;
+   unsigned long SensePointer;
 
 
    CALL_BK_FN SccbCallback;                  /* VOID (*SccbCallback)(); */
-   ULONG  SccbIOPort;                        /* Identifies board base port */
-   UCHAR  SccbStatus;
-   UCHAR  SCCBRes2;
-   USHORT SccbOSFlags;
-
-
-   ULONG   Sccb_XferCnt;            /* actual transfer count */
-   ULONG   Sccb_ATC;
-   ULONG   SccbVirtDataPtr;         /* virtual addr for OS/2 */
-   ULONG   Sccb_res1;
-   USHORT  Sccb_MGRFlags;
-   USHORT  Sccb_sgseg;
-   UCHAR   Sccb_scsimsg;            /* identify msg for selection */
-   UCHAR   Sccb_tag;
-   UCHAR   Sccb_scsistat;
-   UCHAR   Sccb_idmsg;              /* image of last msg in */
+   unsigned long  SccbIOPort;                        /* Identifies board base port */
+   unsigned char  SccbStatus;
+   unsigned char  SCCBRes2;
+   unsigned short SccbOSFlags;
+
+
+   unsigned long   Sccb_XferCnt;            /* actual transfer count */
+   unsigned long   Sccb_ATC;
+   unsigned long   SccbVirtDataPtr;         /* virtual addr for OS/2 */
+   unsigned long   Sccb_res1;
+   unsigned short  Sccb_MGRFlags;
+   unsigned short  Sccb_sgseg;
+   unsigned char   Sccb_scsimsg;            /* identify msg for selection */
+   unsigned char   Sccb_tag;
+   unsigned char   Sccb_scsistat;
+   unsigned char   Sccb_idmsg;              /* image of last msg in */
    PSCCB   Sccb_forwardlink;
    PSCCB   Sccb_backlink;
-   ULONG   Sccb_savedATC;
-   UCHAR   Save_Cdb[6];
-   UCHAR   Save_CdbLen;
-   UCHAR   Sccb_XferState;
-   ULONG   Sccb_SGoffset;
+   unsigned long   Sccb_savedATC;
+   unsigned char   Save_Cdb[6];
+   unsigned char   Save_CdbLen;
+   unsigned char   Sccb_XferState;
+   unsigned long   Sccb_SGoffset;
    } SCCB;
 
-#define SCCB_SIZE sizeof(SCCB)
 
 #pragma pack()
 
 
 
-#define SCSI_INITIATOR_COMMAND    0x00
-#define TARGET_MODE_COMMAND       0x01
 #define SCATTER_GATHER_COMMAND    0x02
 #define RESIDUAL_COMMAND          0x03
 #define RESIDUAL_SG_COMMAND       0x04
@@ -216,12 +174,10 @@ typedef struct _SCCB {
 
 #define F_USE_CMD_Q              0x20     /*Inidcates TAGGED command. */
 #define TAG_TYPE_MASK            0xC0     /*Type of tag msg to send. */
-#define TAG_Q_MASK               0xE0
 #define SCCB_DATA_XFER_OUT       0x10     /* Write */
 #define SCCB_DATA_XFER_IN        0x08     /* Read */
 
 
-#define FOURTEEN_BYTES           0x00     /* Request Sense Buffer size */
 #define NO_AUTO_REQUEST_SENSE    0x01     /* No Request Sense Buffer */
 
 
@@ -235,9 +191,7 @@ typedef struct _SCCB {
 #define DATA_OUT_ST     7
 #define DATA_IN_ST      8
 #define DISCONNECT_ST   9
-#define STATUS_ST       10
 #define ABORT_ST        11
-#define MESSAGE_ST      12
 
 
 #define F_HOST_XFER_DIR                0x01
@@ -249,7 +203,6 @@ typedef struct _SCCB {
 
 
 #define F_STATUSLOADED                 0x01
-#define F_MSGLOADED                    0x02
 #define F_DEV_SELECTED                 0x04
 
 
@@ -257,92 +210,69 @@ typedef struct _SCCB {
 #define SCCB_DATA_UNDER_RUN         0x0C
 #define SCCB_SELECTION_TIMEOUT      0x11  /* Set SCSI selection timed out */
 #define SCCB_DATA_OVER_RUN          0x12
-#define SCCB_UNEXPECTED_BUS_FREE    0x13  /* Target dropped SCSI BSY */
 #define SCCB_PHASE_SEQUENCE_FAIL    0x14  /* Target bus phase sequence failure */
 
-#define SCCB_INVALID_OP_CODE        0x16  /* SCCB invalid operation code */
-#define SCCB_INVALID_SCCB           0x1A  /* Invalid SCCB - bad parameter */
 #define SCCB_GROSS_FW_ERR           0x27  /* Major problem! */
 #define SCCB_BM_ERR                 0x30  /* BusMaster error. */
 #define SCCB_PARITY_ERR             0x34  /* SCSI parity error */
 
 
 
-#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
 #define SCCB_SUCCESS               0x01
 #define SCCB_ABORT                 0x02
-#define SCCB_NOT_FOUND             0x03
 #define SCCB_ERROR                 0x04
-#define SCCB_INVALID               0x05
 
-#define SCCB_SIZE sizeof(SCCB)
 
 
 #define  ORION_FW_REV      3110
 
-#define HARP_REVD    1
 
 
 #define QUEUE_DEPTH     254+1            /*1 for Normal disconnect 32 for Q'ing. */
 
 #define        MAX_MB_CARDS    4                                       /* Max. no of cards suppoerted on Mother Board */
 
-#define WIDE_SCSI       1
 
 #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. */
-#else
 #define SG_BUF_CNT      16             /*Number of prefetched elements. */
-#endif
 
 #define SG_ELEMENT_SIZE 8              /*Eight byte per element. */
-#define SG_LOCAL_MASK   0x00000000L
-#define SG_ELEMENT_MASK 0xFFFFFFFFL
 
 
-#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 RD_HARPOON(ioport)          inb((u32bits)ioport)
+#define RDW_HARPOON(ioport)         inw((u32bits)ioport)
+#define RD_HARP32(ioport,offset,data) (data = inl((u32bits)(ioport + offset)))
+#define WR_HARPOON(ioport,val)      outb((u08bits) val, (u32bits)ioport)
+#define WRW_HARPOON(ioport,val)       outw((u16bits)val, (u32bits)ioport)
+#define WR_HARP32(ioport,offset,data)  outl(data, (u32bits)(ioport + offset))
 
 
 #define  TAR_SYNC_MASK     (BIT(7)+BIT(6))
-#define  SYNC_UNKNOWN      0x00
 #define  SYNC_TRYING               BIT(6)
 #define  SYNC_SUPPORTED    (BIT(7)+BIT(6))
 
 #define  TAR_WIDE_MASK     (BIT(5)+BIT(4))
-#define  WIDE_DISABLED     0x00
 #define  WIDE_ENABLED              BIT(4)
 #define  WIDE_NEGOCIATED   BIT(5)
 
 #define  TAR_TAG_Q_MASK    (BIT(3)+BIT(2))
-#define  TAG_Q_UNKNOWN     0x00
 #define  TAG_Q_TRYING              BIT(2)
 #define  TAG_Q_REJECT      BIT(3)
-#define  TAG_Q_SUPPORTED   (BIT(3)+BIT(2))
 
 #define  TAR_ALLOW_DISC    BIT(0)
 
 
 #define  EE_SYNC_MASK      (BIT(0)+BIT(1))
-#define  EE_SYNC_ASYNC     0x00
 #define  EE_SYNC_5MB       BIT(0)
 #define  EE_SYNC_10MB      BIT(1)
 #define  EE_SYNC_20MB      (BIT(0)+BIT(1))
 
-#define  EE_ALLOW_DISC     BIT(6)
 #define  EE_WIDE_SCSI      BIT(7)
 
 
@@ -353,27 +283,27 @@ typedef struct SCCBMgr_tar_info {
 
    PSCCB    TarSelQ_Head;
    PSCCB    TarSelQ_Tail;
-   UCHAR    TarLUN_CA;        /*Contingent Allgiance */
-   UCHAR    TarTagQ_Cnt;
-   UCHAR    TarSelQ_Cnt;
-   UCHAR    TarStatus;
-   UCHAR    TarEEValue;
-   UCHAR       TarSyncCtrl;
-   UCHAR       TarReserved[2];                 /* for alignment */ 
-   UCHAR       LunDiscQ_Idx[MAX_LUN];
-   UCHAR    TarLUNBusy[MAX_LUN];
+   unsigned char    TarLUN_CA;        /*Contingent Allgiance */
+   unsigned char    TarTagQ_Cnt;
+   unsigned char    TarSelQ_Cnt;
+   unsigned char    TarStatus;
+   unsigned char    TarEEValue;
+   unsigned char       TarSyncCtrl;
+   unsigned char       TarReserved[2];                 /* for alignment */
+   unsigned char       LunDiscQ_Idx[MAX_LUN];
+   unsigned char    TarLUNBusy[MAX_LUN];
 } SCCBMGR_TAR_INFO;
 
 typedef struct NVRAMInfo {
-       UCHAR           niModel;                                                                /* Model No. of card */
-       UCHAR           niCardNo;                                                       /* Card no. */
-       ULONG           niBaseAddr;                                                     /* Port Address of card */
-       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 */
-       UCHAR           niAdapId;                                                       /* Host Adapter ID - Byte 24 of eerpom map */
-       UCHAR           niSyncTbl[MAX_SCSI_TAR / 2];    /* Sync/Wide byte of targets */
-       UCHAR           niScamTbl[MAX_SCSI_TAR][4];     /* Compressed Scam name string of Targets */
+       unsigned char           niModel;                                                                /* Model No. of card */
+       unsigned char           niCardNo;                                                       /* Card no. */
+       unsigned long           niBaseAddr;                                                     /* Port Address of card */
+       unsigned char           niSysConf;                                                      /* Adapter Configuration byte - Byte 16 of eeprom map */
+       unsigned char           niScsiConf;                                                     /* SCSI Configuration byte - Byte 17 of eeprom map */
+       unsigned char           niScamConf;                                                     /* SCAM Configuration byte - Byte 20 of eeprom map */
+       unsigned char           niAdapId;                                                       /* Host Adapter ID - Byte 24 of eerpom map */
+       unsigned char           niSyncTbl[MAX_SCSI_TAR / 2];    /* Sync/Wide byte of targets */
+       unsigned char           niScamTbl[MAX_SCSI_TAR][4];     /* Compressed Scam name string of Targets */
 }NVRAMINFO;
 
 typedef NVRAMINFO *PNVRamInfo;
@@ -388,15 +318,15 @@ typedef struct SCCBcard {
    PSCCB currentSCCB;
    PSCCBMGR_INFO cardInfo;
 
-   ULONG ioPort;
+   unsigned long ioPort;
 
-   USHORT cmdCounter;
-   UCHAR  discQCount;
-   UCHAR  tagQ_Lst; 
-   UCHAR cardIndex;
-   UCHAR scanIndex;
-   UCHAR globalFlags;
-   UCHAR ourId;
+   unsigned short cmdCounter;
+   unsigned char  discQCount;
+   unsigned char  tagQ_Lst;
+   unsigned char cardIndex;
+   unsigned char scanIndex;
+   unsigned char globalFlags;
+   unsigned char ourId;
    PNVRamInfo pNvRamInfo;
    PSCCB discQ_Tbl[QUEUE_DEPTH]; 
       
@@ -418,7 +348,6 @@ typedef struct SCCBcard *PSCCBcard;
 #define  ID_STRING_LENGTH  32
 #define  TYPE_CODE0        0x63           /*Level2 Mstr (bits 7-6),  */
 
-#define  TYPE_CODE1        00             /*No ID yet */
 
 #define  SLV_TYPE_CODE0    0xA3           /*Priority Bit set (bits 7-6),  */
 
@@ -430,16 +359,9 @@ typedef struct SCCBcard *PSCCBcard;
 
 #define  ID_0_7      0x18
 #define  ID_8_F      0x11
-#define  ID_10_17    0x12
-#define  ID_18_1F    0x0B
 #define  MISC_CODE   0x14
 #define  CLR_P_FLAG  0x18
-#define  LOCATE_ON   0x12
-#define  LOCATE_OFF  0x0B
 
-#define  LVL_1_MST   0x00
-#define  LVL_2_MST   0x40
-#define  DOM_LVL_2   0xC0
 
 
 #define  INIT_SELTD  0x01
@@ -452,67 +374,27 @@ enum scam_id_st { ID0,ID1,ID2,ID3,ID4,ID5,ID6,ID7,ID8,ID9,ID10,ID11,ID12,
 
 typedef struct SCCBscam_info {
 
-   UCHAR    id_string[ID_STRING_LENGTH];
+   unsigned char    id_string[ID_STRING_LENGTH];
    enum scam_id_st state;
     
-} SCCBSCAM_INFO, *PSCCBSCAM_INFO;
+} SCCBSCAM_INFO;
 
 
-#define  SCSI_TEST_UNIT_READY    0x00
-#define  SCSI_REZERO_UNIT        0x01
 #define  SCSI_REQUEST_SENSE      0x03
-#define  SCSI_FORMAT_UNIT        0x04
-#define  SCSI_REASSIGN           0x07
 #define  SCSI_READ               0x08
 #define  SCSI_WRITE              0x0A
-#define  SCSI_SEEK               0x0B
-#define  SCSI_INQUIRY            0x12
-#define  SCSI_MODE_SELECT        0x15
-#define  SCSI_RESERVE_UNIT       0x16
-#define  SCSI_RELEASE_UNIT       0x17
-#define  SCSI_MODE_SENSE         0x1A
 #define  SCSI_START_STOP_UNIT    0x1B
-#define  SCSI_SEND_DIAGNOSTIC    0x1D
-#define  SCSI_READ_CAPACITY      0x25
 #define  SCSI_READ_EXTENDED      0x28
 #define  SCSI_WRITE_EXTENDED     0x2A
-#define  SCSI_SEEK_EXTENDED      0x2B
 #define  SCSI_WRITE_AND_VERIFY   0x2E
-#define  SCSI_VERIFY             0x2F
-#define  SCSI_READ_DEFECT_DATA   0x37
-#define  SCSI_WRITE_BUFFER       0x3B
-#define  SCSI_READ_BUFFER        0x3C
-#define  SCSI_RECV_DIAGNOSTIC    0x1C
-#define  SCSI_READ_LONG          0x3E
-#define  SCSI_WRITE_LONG         0x3F
-#define  SCSI_LAST_SCSI_CMND     SCSI_WRITE_LONG
-#define  SCSI_INVALID_CMND       0xFF
 
 
 
 #define  SSGOOD                  0x00
 #define  SSCHECK                 0x02
-#define  SSCOND_MET              0x04
-#define  SSBUSY                  0x08
-#define  SSRESERVATION_CONFLICT  0x18
-#define  SSCMD_TERM              0x22
 #define  SSQ_FULL                0x28
 
 
-#define  SKNO_SEN                0x00
-#define  SKRECOV_ERR             0x01
-#define  SKNOT_RDY               0x02
-#define  SKMED_ERR               0x03
-#define  SKHW_ERR                0x04
-#define  SKILL_REQ               0x05
-#define  SKUNIT_ATTN             0x06
-#define  SKDATA_PROTECT          0x07
-#define  SKBLNK_CHK              0x08
-#define  SKCPY_ABORT             0x0A
-#define  SKABORT_CMD             0x0B
-#define  SKEQUAL                 0x0C
-#define  SKVOL_OVF               0x0D
-#define  SKMIS_CMP               0x0E
 
 
 #define  SMCMD_COMP              0x00
@@ -520,7 +402,6 @@ typedef struct SCCBscam_info {
 #define  SMSAVE_DATA_PTR         0x02
 #define  SMREST_DATA_PTR         0x03
 #define  SMDISC                  0x04
-#define  SMINIT_DETEC_ERR        0x05
 #define  SMABORT                 0x06
 #define  SMREJECT                0x07
 #define  SMNO_OP                 0x08
@@ -535,35 +416,22 @@ typedef struct SCCBscam_info {
 
 
 #define  SMSYNC                  0x01
-#define  SM10MBS                 0x19     /* 100ns           */
-#define  SM5MBS                  0x32     /* 200ns           */
-#define  SMOFFSET                0x0F     /* Maxoffset value */
 #define  SMWDTR                  0x03
 #define  SM8BIT                  0x00
 #define  SM16BIT                 0x01
-#define  SM32BIT                 0x02
 #define  SMIGNORWR               0x23     /* Ignore Wide Residue */
 
 
-#define  ARBITRATION_DELAY       0x01     /* 2.4us using a 40Mhz clock */
-#define  BUS_SETTLE_DELAY        0x01     /* 400ns */
-#define  BUS_CLEAR_DELAY         0x01     /* 800ns */
 
 
 
-#define  SPHASE_TO               0x0A  /* 10 second timeout waiting for */
-#define  SCMD_TO                 0x0F  /* Overall command timeout */
 
 
 
 #define  SIX_BYTE_CMD            0x06
-#define  TEN_BYTE_CMD            0x0A
 #define  TWELVE_BYTE_CMD         0x0C
 
 #define  ASYNC                   0x00
-#define  PERI25NS                0x06  /* 25/4ns to next clock for xbow. */
-#define  SYNC10MBS               0x19
-#define  SYNC5MBS                0x32
 #define  MAX_OFFSET              0x0F  /* Maxbyteoffset for Sync Xfers */
 
 
@@ -572,19 +440,11 @@ typedef struct SCCBscam_info {
 #define  EEPROM_CHECK_SUM  0
 #define  FW_SIGNATURE      2
 #define  MODEL_NUMB_0      4
-#define  MODEL_NUMB_1      5
 #define  MODEL_NUMB_2      6
-#define  MODEL_NUMB_3      7
 #define  MODEL_NUMB_4      8
-#define  MODEL_NUMB_5      9
-#define  IO_BASE_ADDR      10
-#define  IRQ_NUMBER        12
-#define  PCI_INT_PIN       13
-#define  BUS_DELAY         14       /*On time in byte 14 off delay in 15 */
 #define  SYSTEM_CONFIG     16
 #define  SCSI_CONFIG       17
 #define  BIOS_CONFIG       18
-#define  SPIN_UP_DELAY     19
 #define  SCAM_CONFIG       20
 #define  ADAPTER_SCSI_ID   24
 
@@ -609,7 +469,6 @@ typedef struct SCCBscam_info {
 
 
 
-   #define  DOM_MASTER     (BIT(0) + BIT(1))
    #define  SCAM_ENABLED   BIT(2)
    #define  SCAM_LEVEL2    BIT(3)
 
@@ -644,16 +503,9 @@ typedef struct SCCBscam_info {
        /* Sub Vendor ID and Sub Device ID only available in
                Harpoon Version 2 and higher */
 
-   #define  hp_sub_vendor_id_0   0x04          /* LSB */
-   #define  hp_sub_vendor_id_1   0x05          /* MSB */
    #define  hp_sub_device_id_0   0x06          /* LSB */
-   #define  hp_sub_device_id_1   0x07          /* MSB */
 
 
-   #define  hp_dual_addr_lo      0x08
-   #define  hp_dual_addr_lmi     0x09
-   #define  hp_dual_addr_hmi     0x0A
-   #define  hp_dual_addr_hi      0x0B
 
    #define  hp_semaphore         0x0C
       #define SCCB_MGR_ACTIVE    BIT(0)
@@ -661,9 +513,7 @@ typedef struct SCCBscam_info {
       #define SCCB_MGR_PRESENT   BIT(3)
       #define BIOS_IN_USE        BIT(4)
 
-   #define  hp_user_defined_D    0x0D
 
-   #define  hp_reserved_E        0x0E
 
    #define  hp_sys_ctrl          0x0F
 
@@ -671,95 +521,49 @@ typedef struct SCCBscam_info {
       #define  DRVR_RST          BIT(1)      /*Firmware Reset to 80C15 chip */
       #define  HALT_MACH         BIT(3)      /*Halt State Machine      */
       #define  HARD_ABORT        BIT(4)      /*Hard Abort              */
-      #define  DIAG_MODE         BIT(5)      /*Diagnostic Mode         */
 
-      #define  BM_ABORT_TMOUT    0x50        /*Halt State machine time out */
 
-   #define  hp_sys_cfg           0x10
 
-      #define  DONT_RST_FIFO     BIT(7)      /*Don't reset FIFO      */
 
 
-   #define  hp_host_ctrl0        0x11
 
-      #define  DUAL_ADDR_MODE    BIT(0)   /*Enable 64-bit addresses */
-      #define  IO_MEM_SPACE      BIT(1)   /*I/O Memory Space    */
-      #define  RESOURCE_LOCK     BIT(2)   /*Enable Resource Lock */
-      #define  IGNOR_ACCESS_ERR  BIT(3)   /*Ignore Access Error */
-      #define  HOST_INT_EDGE     BIT(4)   /*Host interrupt level/edge mode sel */
-      #define  SIX_CLOCKS        BIT(5)   /*6 Clocks between Strobe   */
-      #define  DMA_EVEN_PARITY   BIT(6)   /*Enable DMA Enen Parity */
 
-/*
-      #define  BURST_MODE        BIT(0)
-*/
 
-   #define  hp_reserved_12       0x12
 
    #define  hp_host_blk_cnt      0x13
 
-      #define  XFER_BLK1         0x00     /*     0 0 0  1 byte per block*/
-      #define  XFER_BLK2         0x01     /*     0 0 1  2 byte per block*/
-      #define  XFER_BLK4         0x02     /*     0 1 0  4 byte per block*/
-      #define  XFER_BLK8         0x03     /*     0 1 1  8 byte per block*/
-      #define  XFER_BLK16        0x04     /*     1 0 0 16 byte per block*/
-      #define  XFER_BLK32        0x05     /*     1 0 1 32 byte per block*/
       #define  XFER_BLK64        0x06     /*     1 1 0 64 byte per block*/
    
       #define  BM_THRESHOLD      0x40     /* PCI mode can only xfer 16 bytes*/
 
 
-   #define  hp_reserved_14       0x14
-   #define  hp_reserved_15       0x15
-   #define  hp_reserved_16       0x16
 
    #define  hp_int_mask          0x17
 
       #define  INT_CMD_COMPL     BIT(0)   /* DMA command complete   */
       #define  INT_EXT_STATUS    BIT(1)   /* Extended Status Set    */
-      #define  INT_SCSI          BIT(2)   /* Scsi block interrupt   */
-      #define  INT_FIFO_RDY      BIT(4)   /* FIFO data ready        */
 
 
    #define  hp_xfer_cnt_lo       0x18
-   #define  hp_xfer_cnt_mi       0x19
    #define  hp_xfer_cnt_hi       0x1A
    #define  hp_xfer_cmd          0x1B
 
       #define  XFER_HOST_DMA     0x00     /*     0 0 0 Transfer Host -> DMA */
       #define  XFER_DMA_HOST     0x01     /*     0 0 1 Transfer DMA  -> Host */
-      #define  XFER_HOST_MPU     0x02     /*     0 1 0 Transfer Host -> MPU  */
-      #define  XFER_MPU_HOST     0x03     /*     0 1 1 Transfer MPU  -> Host */
-      #define  XFER_DMA_MPU      0x04     /*     1 0 0 Transfer DMA  -> MPU  */
-      #define  XFER_MPU_DMA      0x05     /*     1 0 1 Transfer MPU  -> DMA  */
-      #define  SET_SEMAPHORE     0x06     /*     1 1 0 Set Semaphore         */
-      #define  XFER_NOP          0x07     /*     1 1 1 Transfer NOP          */
-      #define  XFER_MB_MPU       0x06     /*     1 1 0 Transfer MB -> MPU */
-      #define  XFER_MB_DMA       0x07     /*     1 1 1 Transfer MB -> DMA */
 
 
       #define  XFER_HOST_AUTO    0x00     /*     0 0 Auto Transfer Size   */
-      #define  XFER_HOST_8BIT    0x08     /*     0 1 8 BIT Transfer Size  */
-      #define  XFER_HOST_16BIT   0x10     /*     1 0 16 BIT Transfer Size */
-      #define  XFER_HOST_32BIT   0x18     /*     1 1 32 BIT Transfer Size */
 
       #define  XFER_DMA_8BIT     0x20     /*     0 1 8 BIT  Transfer Size */
-      #define  XFER_DMA_16BIT    0x40     /*     1 0 16 BIT Transfer Size */
 
       #define  DISABLE_INT       BIT(7)   /*Do not interrupt at end of cmd. */
 
       #define  HOST_WRT_CMD      ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_8BIT))
       #define  HOST_RD_CMD       ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_8BIT))
-      #define  WIDE_HOST_WRT_CMD ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_16BIT))
-      #define  WIDE_HOST_RD_CMD  ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_16BIT))
 
    #define  hp_host_addr_lo      0x1C
-   #define  hp_host_addr_lmi     0x1D
    #define  hp_host_addr_hmi     0x1E
-   #define  hp_host_addr_hi      0x1F
 
-   #define  hp_pio_data          0x20
-   #define  hp_reserved_21       0x21
    #define  hp_ee_ctrl           0x22
 
       #define  EXT_ARB_ACK       BIT(7)
@@ -777,17 +581,8 @@ typedef struct SCCBscam_info {
       #define  EWDS              0x04
       #define  EWDS_ADDR         0x0000
 
-   #define  hp_brdctl            0x23
 
-      #define  DAT_7             BIT(7)
-      #define  DAT_6             BIT(6)
-      #define  DAT_5             BIT(5)
-      #define  BRD_STB           BIT(4)
-      #define  BRD_CS            BIT(3)
-      #define  BRD_WR            BIT(2)
 
-   #define  hp_reserved_24       0x24
-   #define  hp_reserved_25       0x25
 
 
 
@@ -796,70 +591,36 @@ typedef struct SCCBscam_info {
 
       #define  SCSI_TERM_ENA_L   BIT(0)   /*Enable/Disable external terminators */
       #define  FLUSH_XFER_CNTR   BIT(1)   /*Flush transfer counter */
-      #define  BM_XFER_MIN_8     BIT(2)   /*Enable bus master transfer of 9 */
-      #define  BIOS_ENA          BIT(3)   /*Enable BIOS/FLASH Enable */
       #define  FORCE1_XFER       BIT(5)   /*Always xfer one byte in byte mode */
       #define  FAST_SINGLE       BIT(6)   /*?? */
 
       #define  BMCTRL_DEFAULT    (FORCE1_XFER|FAST_SINGLE|SCSI_TERM_ENA_L)
 
-   #define  hp_reserved_27       0x27
 
    #define  hp_sg_addr           0x28
    #define  hp_page_ctrl         0x29
 
       #define  SCATTER_EN        BIT(0)   
       #define  SGRAM_ARAM        BIT(1)   
-      #define  BIOS_SHADOW       BIT(2)   
       #define  G_INT_DISABLE     BIT(3)   /* Enable/Disable all Interrupts */
       #define  NARROW_SCSI_CARD  BIT(4)   /* NARROW/WIDE SCSI config pin */
 
-   #define  hp_reserved_2A       0x2A
-   #define  hp_pci_cmd_cfg       0x2B
 
-      #define  IO_SPACE_ENA      BIT(0)   /*enable I/O space */
-      #define  MEM_SPACE_ENA     BIT(1)   /*enable memory space */
-      #define  BUS_MSTR_ENA      BIT(2)   /*enable bus master operation */
-      #define  MEM_WI_ENA        BIT(4)   /*enable Write and Invalidate */
-      #define  PAR_ERR_RESP      BIT(6)   /*enable parity error responce. */
 
-   #define  hp_reserved_2C       0x2C
 
    #define  hp_pci_stat_cfg      0x2D
 
-      #define  DATA_PARITY_ERR   BIT(0)   
-      #define  REC_TARGET_ABORT  BIT(4)   /*received Target abort */
       #define  REC_MASTER_ABORT  BIT(5)   /*received Master abort */
-      #define  SIG_SYSTEM_ERR    BIT(6)   
-      #define  DETECTED_PAR_ERR  BIT(7)   
 
-   #define  hp_reserved_2E       0x2E
 
-   #define  hp_sys_status        0x2F
 
-      #define  SLV_DATA_RDY      BIT(0)   /*Slave data ready */
-      #define  XFER_CNT_ZERO     BIT(1)   /*Transfer counter = 0 */
-      #define  BM_FIFO_EMPTY     BIT(2)   /*FIFO empty */
-      #define  BM_FIFO_FULL      BIT(3)   /*FIFO full */
-      #define  HOST_OP_DONE      BIT(4)   /*host operation done */
-      #define  DMA_OP_DONE       BIT(5)   /*DMA operation done */
-      #define  SLV_OP_DONE       BIT(6)   /*Slave operation done */
-      #define  PWR_ON_FLAG       BIT(7)   /*Power on flag */
 
-   #define  hp_reserved_30       0x30
 
-   #define  hp_host_status0      0x31
 
-      #define  HOST_TERM         BIT(5)   /*Host Terminal Count */
-      #define  HOST_TRSHLD       BIT(6)   /*Host Threshold      */
-      #define  CONNECTED_2_HOST  BIT(7)   /*Connected to Host   */
 
-   #define  hp_reserved_32       0x32
 
    #define  hp_rev_num           0x33
 
-      #define  REV_A_CONST       0x0E
-      #define  REV_B_CONST       0x0E
 
    #define  hp_stack_data        0x34
    #define  hp_stack_addr        0x35
@@ -869,8 +630,6 @@ typedef struct SCCBscam_info {
       #define  BM_FORCE_OFF      BIT(0)   /*Bus Master is forced to get off */
       #define  PCI_TGT_ABORT     BIT(0)   /*PCI bus master transaction aborted */
       #define  PCI_DEV_TMOUT     BIT(1)   /*PCI Device Time out */
-      #define  FIFO_TC_NOT_ZERO  BIT(2)   /*FIFO or transfer counter not zero */
-      #define  CHIP_RST_OCCUR    BIT(3)   /*Chip reset occurs */
       #define  CMD_ABORTED       BIT(4)   /*Command aborted */
       #define  BM_PARITY_ERR     BIT(5)   /*parity error on data received   */
       #define  PIO_OVERRUN       BIT(6)   /*Slave data overrun */
@@ -880,24 +639,13 @@ typedef struct SCCBscam_info {
 
    #define  hp_int_status        0x37
       
-      #define  BM_CMD_CMPL       BIT(0)   /*Bus Master command complete */
       #define  EXT_STATUS_ON     BIT(1)   /*Extended status is valid */
       #define  SCSI_INTERRUPT    BIT(2)   /*Global indication of a SCSI int. */
-      #define  BM_FIFO_RDY       BIT(4)   
       #define  INT_ASSERTED      BIT(5)   /* */
-      #define  SRAM_BUSY         BIT(6)   /*Scatter/Gather RAM busy */
-      #define  CMD_REG_BUSY      BIT(7)                                       
 
 
    #define  hp_fifo_cnt          0x38
-   #define  hp_curr_host_cnt     0x39
-   #define  hp_reserved_3A       0x3A
-   #define  hp_fifo_in_addr      0x3B
 
-   #define  hp_fifo_out_addr     0x3C
-   #define  hp_reserved_3D       0x3D
-   #define  hp_reserved_3E       0x3E
-   #define  hp_reserved_3F       0x3F
 
 
 
@@ -937,9 +685,7 @@ typedef struct SCCBscam_info {
       #define  SCSI_IOBIT        BIT(0)
 
       #define  S_SCSI_PHZ        (BIT(2)+BIT(1)+BIT(0))
-      #define  S_CMD_PH          (BIT(2)              )
       #define  S_MSGO_PH         (BIT(2)+BIT(1)       )
-      #define  S_STAT_PH         (BIT(2)       +BIT(0))
       #define  S_MSGI_PH         (BIT(2)+BIT(1)+BIT(0))
       #define  S_DATAI_PH        (              BIT(0))
       #define  S_DATAO_PH        0x00
@@ -947,7 +693,6 @@ typedef struct SCCBscam_info {
 
    #define  hp_scsictrl_0        0x45
 
-      #define  NO_ARB            BIT(7)
       #define  SEL_TAR           BIT(6)
       #define  ENA_ATN           BIT(4)
       #define  ENA_RESEL         BIT(2)
@@ -969,44 +714,33 @@ typedef struct SCCBscam_info {
 
    #define  hp_scsireset         0x47
 
-      #define  SCSI_TAR          BIT(7)
       #define  SCSI_INI          BIT(6)
       #define  SCAM_EN           BIT(5)
-      #define  ACK_HOLD          BIT(4)
       #define  DMA_RESET         BIT(3)
       #define  HPSCSI_RESET      BIT(2)
       #define  PROG_RESET        BIT(1)
       #define  FIFO_CLR          BIT(0)
 
    #define  hp_xfercnt_0         0x48
-   #define  hp_xfercnt_1         0x49
    #define  hp_xfercnt_2         0x4A
-   #define  hp_xfercnt_3         0x4B
 
    #define  hp_fifodata_0        0x4C
-   #define  hp_fifodata_1        0x4D
    #define  hp_addstat           0x4E
 
       #define  SCAM_TIMER        BIT(7)
-      #define  AUTO_RUNNING      BIT(6)
-      #define  FAST_SYNC         BIT(5)
       #define  SCSI_MODE8        BIT(3)
       #define  SCSI_PAR_ERR      BIT(0)
 
    #define  hp_prgmcnt_0         0x4F
 
-      #define  AUTO_PC_MASK      0x3F
 
    #define  hp_selfid_0          0x50
    #define  hp_selfid_1          0x51
    #define  hp_arb_id            0x52
 
-      #define  ARB_ID            (BIT(3) + BIT(2) + BIT(1) + BIT(0))
 
    #define  hp_select_id         0x53
 
-      #define  RESEL_ID          (BIT(7) + BIT(6) + BIT(5) + BIT(4))
-      #define  SELECT_ID         (BIT(3) + BIT(2) + BIT(1) + BIT(0))
 
    #define  hp_synctarg_base     0x54
    #define  hp_synctarg_12       0x54
@@ -1029,63 +763,38 @@ typedef struct SCCBscam_info {
    #define  hp_synctarg_2        0x62
    #define  hp_synctarg_3        0x63
 
-      #define  RATE_20MB         0x00
-      #define  RATE_10MB         (              BIT(5))
-      #define  RATE_6_6MB        (       BIT(6)       )   
-      #define  RATE_5MB          (       BIT(6)+BIT(5))
-      #define  RATE_4MB          (BIT(7)              )
-      #define  RATE_3_33MB       (BIT(7)       +BIT(5))
-      #define  RATE_2_85MB       (BIT(7)+BIT(6)       )
-      #define  RATE_2_5MB        (BIT(7)+BIT(5)+BIT(6))
-      #define  NEXT_CLK          BIT(5)
-      #define  SLOWEST_SYNC      (BIT(7)+BIT(6)+BIT(5))
       #define  NARROW_SCSI       BIT(4)
-      #define  SYNC_OFFSET       (BIT(3) + BIT(2) + BIT(1) + BIT(0))
-      #define  DEFAULT_ASYNC     0x00
       #define  DEFAULT_OFFSET    0x0F
 
    #define  hp_autostart_0       0x64
    #define  hp_autostart_1       0x65
-   #define  hp_autostart_2       0x66
    #define  hp_autostart_3       0x67
 
 
 
-      #define  DISABLE  0x00
       #define  AUTO_IMMED    BIT(5)
       #define  SELECT   BIT(6)
-      #define  RESELECT (BIT(6)+BIT(5))
-      #define  BUSFREE  BIT(7)
-      #define  XFER_0   (BIT(7)+BIT(5))
       #define  END_DATA (BIT(7)+BIT(6))
-      #define  MSG_PHZ  (BIT(7)+BIT(6)+BIT(5))
 
    #define  hp_gp_reg_0          0x68
    #define  hp_gp_reg_1          0x69
-   #define  hp_gp_reg_2          0x6A
    #define  hp_gp_reg_3          0x6B
 
    #define  hp_seltimeout        0x6C
 
 
-      #define  TO_2ms            0x54      /* 2.0503ms */
       #define  TO_4ms            0x67      /* 3.9959ms */
 
       #define  TO_5ms            0x03      /* 4.9152ms */
       #define  TO_10ms           0x07      /* 11.xxxms */
       #define  TO_250ms          0x99      /* 250.68ms */
       #define  TO_290ms          0xB1      /* 289.99ms */
-      #define  TO_350ms          0xD6      /* 350.62ms */
-      #define  TO_417ms          0xFF      /* 417.79ms */
 
    #define  hp_clkctrl_0         0x6D
 
       #define  PWR_DWN           BIT(6)
       #define  ACTdeassert       BIT(4)
-      #define  ATNonErr          BIT(3)
-      #define  CLK_30MHZ         BIT(1)
       #define  CLK_40MHZ         (BIT(1) + BIT(0))
-      #define  CLK_50MHZ         BIT(2)
 
       #define  CLKCTRL_DEFAULT   (ACTdeassert | CLK_40MHZ)
 
@@ -1095,38 +804,21 @@ typedef struct SCCBscam_info {
    #define  hp_offsetctr         0x70
    #define  hp_xferstat          0x71
 
-      #define  FIFO_FULL         BIT(7)
       #define  FIFO_EMPTY        BIT(6)
-      #define  FIFO_MASK         0x3F   /* Mask for the FIFO count value. */
-      #define  FIFO_LEN          0x20
 
    #define  hp_portctrl_1        0x72
 
-      #define  EVEN_HOST_P       BIT(5)
-      #define  INVT_SCSI         BIT(4)
       #define  CHK_SCSI_P        BIT(3)
       #define  HOST_MODE8        BIT(0)
-      #define  HOST_MODE16       0x00
 
    #define  hp_xfer_pad          0x73
 
       #define  ID_UNLOCK         BIT(3)
-      #define  XFER_PAD          BIT(2)
 
    #define  hp_scsidata_0        0x74
    #define  hp_scsidata_1        0x75
-   #define  hp_timer_0           0x76
-   #define  hp_timer_1           0x77
 
-   #define  hp_reserved_78       0x78
-   #define  hp_reserved_79       0x79
-   #define  hp_reserved_7A       0x7A
-   #define  hp_reserved_7B       0x7B
 
-   #define  hp_reserved_7C       0x7C
-   #define  hp_reserved_7D       0x7D
-   #define  hp_reserved_7E       0x7E
-   #define  hp_reserved_7F       0x7F
 
    #define  hp_aramBase          0x80
    #define  BIOS_DATA_OFFSET     0x60
@@ -1135,22 +827,15 @@ typedef struct SCCBscam_info {
 
 
 
-      #define  AUTO_LEN 0x80
-      #define  AR0      0x00
-      #define  AR1      BITW(8)
-      #define  AR2      BITW(9)
       #define  AR3      (BITW(9) + BITW(8))
       #define  SDATA    BITW(10)
 
-      #define  NOP_OP   0x00        /* Nop command */
 
       #define  CRD_OP   BITW(11)     /* Cmp Reg. w/ Data */
 
       #define  CRR_OP   BITW(12)     /* Cmp Reg. w. Reg. */
 
-      #define  CBE_OP   (BITW(14)+BITW(12)+BITW(11)) /* Cmp SCSI cmd class & Branch EQ */
       
-      #define  CBN_OP   (BITW(14)+BITW(13))  /* Cmp SCSI cmd class & Branch NOT EQ */
       
       #define  CPE_OP   (BITW(14)+BITW(11))  /* Cmp SCSI phs & Branch EQ */
 
@@ -1163,7 +848,6 @@ typedef struct SCCBscam_info {
       #define  ASTATUS     (BITW(10)+BITW(8))
       #define  AMSG_OUT    (BITW(10)+BITW(9))
       #define  AMSG_IN     (BITW(10)+BITW(9)+BITW(8))
-      #define  AILLEGAL    (BITW(9)+BITW(8))
 
 
       #define  BRH_OP   BITW(13)   /* Branch */
@@ -1176,17 +860,11 @@ typedef struct SCCBscam_info {
       #define  TCB_OP   (BITW(13)+BITW(11))    /* Test condition & branch */
 
       
-      #define  ATN_SET     BITW(8)
-      #define  ATN_RESET   BITW(9)
-      #define  XFER_CNT    (BITW(9)+BITW(8))
       #define  FIFO_0      BITW(10)
-      #define  FIFO_NOT0   (BITW(10)+BITW(8))
-      #define  T_USE_SYNC0 (BITW(10)+BITW(9))
 
 
       #define  MPM_OP   BITW(15)        /* Match phase and move data */
 
-      #define  MDR_OP   (BITW(12)+BITW(11)) /* Move data to Reg. */
 
       #define  MRR_OP   BITW(14)        /* Move DReg. to Reg. */
 
@@ -1196,34 +874,14 @@ typedef struct SCCBscam_info {
 
       #define  D_AR0    0x00
       #define  D_AR1    BIT(0)
-      #define  D_AR2    BIT(1)
-      #define  D_AR3    (BIT(1) + BIT(0))
-      #define  D_SDATA  BIT(2)
       #define  D_BUCKET (BIT(2) + BIT(1) + BIT(0))
 
 
-      #define  ADR_OP   (BITW(13)+BITW(12)) /* Logical AND Reg. w. Data */
 
-      #define  ADS_OP   (BITW(14)+BITW(13)+BITW(12)) 
 
-      #define  ODR_OP   (BITW(13)+BITW(12)+BITW(11))  
 
-      #define  ODS_OP   (BITW(14)+BITW(13)+BITW(12)+BITW(11))  
 
-      #define  STR_OP   (BITW(15)+BITW(14)) /* Store to A_Reg. */
 
-      #define  AINT_ENA1   0x00
-      #define  AINT_STAT1  BITW(8)
-      #define  ASCSI_SIG   BITW(9)
-      #define  ASCSI_CNTL  (BITW(9)+BITW(8))
-      #define  APORT_CNTL  BITW(10)
-      #define  ARST_CNTL   (BITW(10)+BITW(8))
-      #define  AXFERCNT0   (BITW(10)+BITW(9))
-      #define  AXFERCNT1   (BITW(10)+BITW(9)+BITW(8))
-      #define  AXFERCNT2   BITW(11)
-      #define  AFIFO_DATA  (BITW(11)+BITW(8))
-      #define  ASCSISELID  (BITW(11)+BITW(9))
-      #define  ASCSISYNC0  (BITW(11)+BITW(9)+BITW(8))
 
 
       #define  RAT_OP      (BITW(14)+BITW(13)+BITW(11))
@@ -1233,7 +891,6 @@ typedef struct SCCBscam_info {
 
       #define  SSI_ITAR_DISC   (ITAR_DISC >> 8)
       #define  SSI_IDO_STRT    (IDO_STRT >> 8)
-      #define  SSI_IDI_STRT    (IDO_STRT >> 8)
 
       #define  SSI_ICMD_COMP   (ICMD_COMP >> 8)
       #define  SSI_ITICKLE     (ITICKLE >> 8)
@@ -1248,13 +905,11 @@ typedef struct SCCBscam_info {
       #define  CMDPZ 0x04     /*Command phase */
       #define  DINT  0x12     /*Data Out/In interrupt */
       #define  DI    0x13     /*Data Out */
-      #define  MI    0x14     /*Message In */
       #define  DC    0x19     /*Disconnect Message */
       #define  ST    0x1D     /*Status Phase */
       #define  UNKNWN 0x24    /*Unknown bus action */
       #define  CC    0x25     /*Command Completion failure */
       #define  TICK  0x26     /*New target reselected us. */
-      #define  RFAIL 0x27     /*Reselection failed */
       #define  SELCHK 0x28     /*Select & Check SCSI ID latch reg */
 
 
@@ -1268,36 +923,29 @@ typedef struct SCCBscam_info {
 
 
       #define  TAG_STRT          0x00
-      #define  SELECTION_START   0x00
       #define  DISCONNECT_START  0x10/2
       #define  END_DATA_START    0x14/2
-      #define  NONTAG_STRT       0x02/2
       #define  CMD_ONLY_STRT     CMDPZ/2
-      #define  TICKLE_STRT     TICK/2
       #define  SELCHK_STRT     SELCHK/2
 
 
 
 
-#define mEEPROM_CLK_DELAY(port) (RD_HARPOON(port+hp_intstat_1))
 
-#define mWAIT_10MS(port) (RD_HARPOON(port+hp_intstat_1))
 
 
-#define CLR_XFER_CNT(port) (WR_HARPOON(port+hp_xfercnt_0, 0x00))
 
-#define SET_XFER_CNT(port, data) (WR_HARP32(port,hp_xfercnt_0,data))
 
 #define GET_XFER_CNT(port, xfercnt) {RD_HARP32(port,hp_xfercnt_0,xfercnt); xfercnt &= 0xFFFFFF;}
 /* #define GET_XFER_CNT(port, xfercnt) (xfercnt = RD_HARPOON(port+hp_xfercnt_2), \
                                  xfercnt <<= 16,\
-                                 xfercnt |= RDW_HARPOON((USHORT)(port+hp_xfercnt_0)))
+                                 xfercnt |= RDW_HARPOON((unsigned short)(port+hp_xfercnt_0)))
  */
-#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (USHORT)(addr & 0x0000FFFFL)),\
+#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (unsigned short)(addr & 0x0000FFFFL)),\
          addr >>= 16,\
-         WRW_HARPOON((port+hp_host_addr_hmi), (USHORT)(addr & 0x0000FFFFL)),\
+         WRW_HARPOON((port+hp_host_addr_hmi), (unsigned short)(addr & 0x0000FFFFL)),\
          WR_HARP32(port,hp_xfercnt_0,count),\
-         WRW_HARPOON((port+hp_xfer_cnt_lo), (USHORT)(count & 0x0000FFFFL)),\
+         WRW_HARPOON((port+hp_xfer_cnt_lo), (unsigned short)(count & 0x0000FFFFL)),\
          count >>= 16,\
          WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF)))
 
@@ -1308,11 +956,7 @@ typedef struct SCCBscam_info {
 #define ACCEPT_MSG_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
                           WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));}
 
-#define ACCEPT_STAT(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, S_ILL_PH);}
 
-#define ACCEPT_STAT_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));}
 
 #define DISABLE_AUTO(port) (WR_HARPOON(port+hp_scsireset, PROG_RESET),\
                         WR_HARPOON(port+hp_scsireset, 0x00))
@@ -1332,126 +976,118 @@ typedef struct SCCBscam_info {
 
 
 
-void  scsiStartAuto(ULONG port);
-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,
+static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, unsigned char syncFlag);
+static void  FPT_ssel(unsigned long port, unsigned char p_card);
+static void  FPT_sres(unsigned long port, unsigned char p_card, PSCCBcard pCurrCard);
+static void  FPT_shandem(unsigned long port, unsigned char p_card,PSCCB pCurrSCCB);
+static void  FPT_stsyncn(unsigned long port, unsigned char p_card);
+static void  FPT_sisyncr(unsigned long port,unsigned char sync_pulse, unsigned char offset);
+static void  FPT_sssyncv(unsigned long p_port, unsigned char p_id, unsigned char 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);
-
-static void FPT_SendMsg(ULONG port, UCHAR message);
-static void  FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg,
-                                   UCHAR error_code);
-
-static void  FPT_sinits(PSCCB p_sccb, UCHAR p_card);
+static void  FPT_sresb(unsigned long port, unsigned char p_card);
+static void  FPT_sxfrp(unsigned long p_port, unsigned char p_card);
+static void  FPT_schkdd(unsigned long port, unsigned char p_card);
+static unsigned char FPT_RdStack(unsigned long port, unsigned char index);
+static void  FPT_WrStack(unsigned long portBase, unsigned char index, unsigned char data);
+static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort);
+
+static void FPT_SendMsg(unsigned long port, unsigned char message);
+static void  FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
+                                   unsigned char error_code);
+
+static void  FPT_sinits(PSCCB p_sccb, unsigned char 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);
+static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card);
+static void  FPT_stwidn(unsigned long port, unsigned char p_card);
+static void  FPT_siwidr(unsigned long port, unsigned char width);
 
 
-static void  FPT_queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card);
-static void  FPT_queueDisconnect(PSCCB p_SCCB, UCHAR p_card);
+static void  FPT_queueSelectFail(PSCCBcard pCurrCard, unsigned char p_card);
+static void  FPT_queueDisconnect(PSCCB p_SCCB, unsigned char p_card);
 static void  FPT_queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_SCCB,
-                                 UCHAR p_card);
-static void  FPT_queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card);
-static void  FPT_queueFlushSccb(UCHAR p_card, UCHAR error_code);
-static void  FPT_queueAddSccb(PSCCB p_SCCB, UCHAR card);
-static UCHAR FPT_queueFindSccb(PSCCB p_SCCB, UCHAR p_card);
+                                 unsigned char p_card);
+static void  FPT_queueSearchSelect(PSCCBcard pCurrCard, unsigned char p_card);
+static void  FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code);
+static void  FPT_queueAddSccb(PSCCB p_SCCB, unsigned char card);
+static unsigned char FPT_queueFindSccb(PSCCB p_SCCB, unsigned char p_card);
 static void  FPT_utilUpdateResidual(PSCCB p_SCCB);
-static USHORT FPT_CalcCrc16(UCHAR buffer[]);
-static UCHAR  FPT_CalcLrc(UCHAR buffer[]);
+static unsigned short FPT_CalcCrc16(unsigned char buffer[]);
+static unsigned char  FPT_CalcLrc(unsigned char buffer[]);
 
 
-static void  FPT_Wait1Second(ULONG p_port);
-static void  FPT_Wait(ULONG p_port, UCHAR p_delay);
-static void  FPT_utilEEWriteOnOff(ULONG p_port,UCHAR p_mode);
-static void  FPT_utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr);
-static USHORT FPT_utilEERead(ULONG p_port, USHORT ee_addr);
-static USHORT FPT_utilEEReadOrg(ULONG p_port, USHORT ee_addr);
-static void  FPT_utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr);
+static void  FPT_Wait1Second(unsigned long p_port);
+static void  FPT_Wait(unsigned long p_port, unsigned char p_delay);
+static void  FPT_utilEEWriteOnOff(unsigned long p_port,unsigned char p_mode);
+static void  FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, unsigned short ee_addr);
+static unsigned short FPT_utilEERead(unsigned long p_port, unsigned short ee_addr);
+static unsigned short FPT_utilEEReadOrg(unsigned long p_port, unsigned short ee_addr);
+static void  FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, unsigned short ee_addr);
 
 
 
-static void  FPT_phaseDataOut(ULONG port, UCHAR p_card);
-static void  FPT_phaseDataIn(ULONG port, UCHAR p_card);
-static void  FPT_phaseCommand(ULONG port, UCHAR p_card);
-static void  FPT_phaseStatus(ULONG port, UCHAR p_card);
-static void  FPT_phaseMsgOut(ULONG port, UCHAR p_card);
-static void  FPT_phaseMsgIn(ULONG port, UCHAR p_card);
-static void  FPT_phaseIllegal(ULONG port, UCHAR p_card);
+static void  FPT_phaseDataOut(unsigned long port, unsigned char p_card);
+static void  FPT_phaseDataIn(unsigned long port, unsigned char p_card);
+static void  FPT_phaseCommand(unsigned long port, unsigned char p_card);
+static void  FPT_phaseStatus(unsigned long port, unsigned char p_card);
+static void  FPT_phaseMsgOut(unsigned long port, unsigned char p_card);
+static void  FPT_phaseMsgIn(unsigned long port, unsigned char p_card);
+static void  FPT_phaseIllegal(unsigned long port, unsigned char p_card);
 
-static void  FPT_phaseDecode(ULONG port, UCHAR p_card);
-static void  FPT_phaseChkFifo(ULONG port, UCHAR p_card);
-static void  FPT_phaseBusFree(ULONG p_port, UCHAR p_card);
+static void  FPT_phaseDecode(unsigned long port, unsigned char p_card);
+static void  FPT_phaseChkFifo(unsigned long port, unsigned char p_card);
+static void  FPT_phaseBusFree(unsigned long p_port, unsigned char p_card);
 
 
 
 
-static void  FPT_XbowInit(ULONG port, UCHAR scamFlg);
-static void  FPT_BusMasterInit(ULONG p_port);
-static void  FPT_DiagEEPROM(ULONG p_port);
+static void  FPT_XbowInit(unsigned long port, unsigned char scamFlg);
+static void  FPT_BusMasterInit(unsigned long p_port);
+static void  FPT_DiagEEPROM(unsigned long p_port);
 
 
 
 
-void  busMstrAbort(ULONG port);
-static void  FPT_dataXferProcessor(ULONG port, PSCCBcard pCurrCard);
-static void  FPT_busMstrSGDataXferStart(ULONG port, PSCCB pCurrSCCB);
-static void  FPT_busMstrDataXferStart(ULONG port, PSCCB pCurrSCCB);
-static void  FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB);
+static void  FPT_dataXferProcessor(unsigned long port, PSCCBcard pCurrCard);
+static void  FPT_busMstrSGDataXferStart(unsigned long port, PSCCB pCurrSCCB);
+static void  FPT_busMstrDataXferStart(unsigned long port, PSCCB pCurrSCCB);
+static void  FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, PSCCB pCurrSCCB);
 static void  FPT_hostDataXferRestart(PSCCB currSCCB);
 
 
-static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card,
-                                PSCCBcard pCurrCard, USHORT p_int);
+static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, unsigned char p_card,
+                                PSCCBcard pCurrCard, unsigned short p_int);
 
 static void  FPT_SccbMgrTableInitAll(void);
-static void  FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card);
-static void  FPT_SccbMgrTableInitTarget(UCHAR p_card, UCHAR target);
+static void  FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, unsigned char p_card);
+static void  FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char target);
 
 
 
-static void  FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up);
+static void  FPT_scini(unsigned char p_card, unsigned char p_our_id, unsigned char p_power_up);
 
-static int   FPT_scarb(ULONG p_port, UCHAR p_sel_type);
-static void  FPT_scbusf(ULONG p_port);
-static void  FPT_scsel(ULONG p_port);
-static void  FPT_scasid(UCHAR p_card, ULONG p_port);
-static UCHAR FPT_scxferc(ULONG p_port, UCHAR p_data);
-static UCHAR FPT_scsendi(ULONG p_port, UCHAR p_id_string[]);
-static UCHAR FPT_sciso(ULONG p_port, UCHAR p_id_string[]);
-static void  FPT_scwirod(ULONG p_port, UCHAR p_data_bit);
-static void  FPT_scwiros(ULONG p_port, UCHAR p_data_bit);
-static UCHAR FPT_scvalq(UCHAR p_quintet);
-static UCHAR FPT_scsell(ULONG p_port, UCHAR targ_id);
-static void  FPT_scwtsel(ULONG p_port);
-static void  FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id);
-static void  FPT_scsavdi(UCHAR p_card, ULONG p_port);
-static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[]);
+static int   FPT_scarb(unsigned long p_port, unsigned char p_sel_type);
+static void  FPT_scbusf(unsigned long p_port);
+static void  FPT_scsel(unsigned long p_port);
+static void  FPT_scasid(unsigned char p_card, unsigned long p_port);
+static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data);
+static unsigned char FPT_scsendi(unsigned long p_port, unsigned char p_id_string[]);
+static unsigned char FPT_sciso(unsigned long p_port, unsigned char p_id_string[]);
+static void  FPT_scwirod(unsigned long p_port, unsigned char p_data_bit);
+static void  FPT_scwiros(unsigned long p_port, unsigned char p_data_bit);
+static unsigned char FPT_scvalq(unsigned char p_quintet);
+static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id);
+static void  FPT_scwtsel(unsigned long p_port);
+static void  FPT_inisci(unsigned char p_card, unsigned long p_port, unsigned char p_our_id);
+static void  FPT_scsavdi(unsigned char p_card, unsigned long p_port);
+static unsigned char FPT_scmachid(unsigned char p_card, unsigned char p_id_string[]);
 
 
-static void  FPT_autoCmdCmplt(ULONG p_port, UCHAR p_card);
-static void  FPT_autoLoadDefaultMap(ULONG p_port);
+static void  FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card);
+static void  FPT_autoLoadDefaultMap(unsigned long p_port);
 
 
 
-void  OS_start_timer(unsigned long ioport, unsigned long timeout);
-void  OS_stop_timer(unsigned long ioport, unsigned long timeout);
-void  OS_disable_int(unsigned char intvec);
-void  OS_enable_int(unsigned char intvec);
-void  OS_delay(unsigned long count);
-int   OS_VirtToPhys(u32bits CardHandle, u32bits *physaddr, u32bits *virtaddr);
 
 static SCCBMGR_TAR_INFO FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = { { { 0 } } };
 static SCCBCARD FPT_BL_Card[MAX_CARDS] = { { 0 } };
@@ -1459,33 +1095,33 @@ static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { { { 0 } } };
 static NVRAMINFO FPT_nvRamInfo[MAX_MB_CARDS] = { { 0 } };
 
 
-static UCHAR FPT_mbCards = 0;
-static UCHAR FPT_scamHAString[] = {0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C', \
+static unsigned char FPT_mbCards = 0;
+static unsigned char FPT_scamHAString[] = {0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C', \
                                   ' ', 'B', 'T', '-', '9', '3', '0', \
                                   0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \
                                   0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20};
 
-static USHORT FPT_default_intena = 0;
+static unsigned short FPT_default_intena = 0;
 
 
-static void (*FPT_s_PhaseTbl[8]) (ULONG, UCHAR)= { 0 };
+static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char)= { 0 };
 
 
 /*---------------------------------------------------------------------
  *
- * Function: SccbMgr_sense_adapter
+ * Function: FlashPoint_ProbeHostAdapter
  *
  * Description: Setup and/or Search for cards and return info to caller.
  *
  *---------------------------------------------------------------------*/
 
-static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
+static int FlashPoint_ProbeHostAdapter(PSCCBMGR_INFO pCardInfo)
 {
-   static UCHAR first_time = 1;
+   static unsigned char first_time = 1;
 
-   UCHAR i,j,id,ScamFlg;
-   USHORT temp,temp2,temp3,temp4,temp5,temp6;
-   ULONG ioport;
+   unsigned char i,j,id,ScamFlg;
+   unsigned short temp,temp2,temp3,temp4,temp5,temp6;
+   unsigned long ioport;
        PNVRamInfo pCurrNvRam;
 
    ioport = pCardInfo->si_baseaddr;
@@ -1549,8 +1185,8 @@ static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
        if(pCurrNvRam)
                pCardInfo->si_id = pCurrNvRam->niAdapId;
        else
-          pCardInfo->si_id = (UCHAR)(FPT_utilEERead(ioport, (ADAPTER_SCSI_ID/2)) &
-          (UCHAR)0x0FF);
+          pCardInfo->si_id = (unsigned char)(FPT_utilEERead(ioport, (ADAPTER_SCSI_ID/2)) &
+          (unsigned char)0x0FF);
 
    pCardInfo->si_lun = 0x00;
    pCardInfo->si_fw_revision = ORION_FW_REV;
@@ -1563,11 +1199,11 @@ static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
    for (id = 0; id < (16/2); id++) {
 
                if(pCurrNvRam){
-                       temp = (USHORT) pCurrNvRam->niSyncTbl[id];
+                       temp = (unsigned short) pCurrNvRam->niSyncTbl[id];
                        temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
                                         (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
                }else
-             temp = FPT_utilEERead(ioport, (USHORT)((SYNC_RATE_TBL/2)+id));
+             temp = FPT_utilEERead(ioport, (unsigned short)((SYNC_RATE_TBL/2)+id));
 
       for (i = 0; i < 2; temp >>=8,i++) {
 
@@ -1606,12 +1242,12 @@ static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
        if(pCurrNvRam)
                i = pCurrNvRam->niSysConf;
        else
-          i = (UCHAR)(FPT_utilEERead(ioport, (SYSTEM_CONFIG/2)));
+          i = (unsigned char)(FPT_utilEERead(ioport, (SYSTEM_CONFIG/2)));
 
        if(pCurrNvRam)
                ScamFlg = pCurrNvRam->niScamConf;
        else
-          ScamFlg = (UCHAR) FPT_utilEERead(ioport, SCAM_CONFIG/2);
+          ScamFlg = (unsigned char) FPT_utilEERead(ioport, SCAM_CONFIG/2);
 
    pCardInfo->si_flags = 0x0000;
 
@@ -1671,11 +1307,11 @@ static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
                }
        }else{
           temp = FPT_utilEERead(ioport, (MODEL_NUMB_0/2));
-       pCardInfo->si_card_model[0] = (UCHAR)(temp >> 8);
+       pCardInfo->si_card_model[0] = (unsigned char)(temp >> 8);
           temp = FPT_utilEERead(ioport, (MODEL_NUMB_2/2));
 
-       pCardInfo->si_card_model[1] = (UCHAR)(temp & 0x00FF);
-          pCardInfo->si_card_model[2] = (UCHAR)(temp >> 8);
+       pCardInfo->si_card_model[1] = (unsigned char)(temp & 0x00FF);
+          pCardInfo->si_card_model[2] = (unsigned char)(temp >> 8);
        }
 
    if (pCardInfo->si_card_model[1] == '3')
@@ -1730,7 +1366,7 @@ static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
           logical card number sorted by BIOS (zero-based) */
 
        pCardInfo->si_relative_cardnum =
-       (UCHAR)(RD_HARPOON(ioport+hp_aramBase+BIOS_RELATIVE_CARD)-1);
+       (unsigned char)(RD_HARPOON(ioport+hp_aramBase+BIOS_RELATIVE_CARD)-1);
 
    SGRAM_ACCESS(ioport);
 
@@ -1751,19 +1387,19 @@ static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo)
 
 /*---------------------------------------------------------------------
  *
- * Function: SccbMgr_config_adapter
+ * Function: FlashPoint_HardwareResetHostAdapter
  *
  * Description: Setup adapter for normal operation (hard reset).
  *
  *---------------------------------------------------------------------*/
 
-static ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo)
+static unsigned long FlashPoint_HardwareResetHostAdapter(PSCCBMGR_INFO pCardInfo)
 {
    PSCCBcard CurrCard = NULL;
        PNVRamInfo pCurrNvRam;
-   UCHAR i,j,thisCard, ScamFlg;
-   USHORT temp,sync_bit_map,id;
-   ULONG ioport;
+   unsigned char i,j,thisCard, ScamFlg;
+   unsigned short temp,sync_bit_map,id;
+   unsigned long ioport;
 
    ioport = pCardInfo->si_baseaddr;
 
@@ -1805,7 +1441,7 @@ static ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo)
                ScamFlg = pCurrNvRam->niScamConf;
        }
        else{
-          ScamFlg = (UCHAR) FPT_utilEERead(ioport, SCAM_CONFIG/2);
+          ScamFlg = (unsigned char) FPT_utilEERead(ioport, SCAM_CONFIG/2);
        }
 
 
@@ -1822,7 +1458,7 @@ static ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo)
    WR_HARPOON(ioport+hp_arb_id, pCardInfo->si_id);
    CurrCard->ourId = pCardInfo->si_id;
 
-   i = (UCHAR) pCardInfo->si_flags;
+   i = (unsigned char) pCardInfo->si_flags;
    if (i & SCSI_PARITY_ENA)
        WR_HARPOON(ioport+hp_portctrl_1,(HOST_MODE8 | CHK_SCSI_P));
 
@@ -1892,23 +1528,23 @@ static ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo)
    for (id = 0; id < (MAX_SCSI_TAR/2); id++) {
 
                if(pCurrNvRam){
-                       temp = (USHORT) pCurrNvRam->niSyncTbl[id];
+                       temp = (unsigned short) pCurrNvRam->niSyncTbl[id];
                        temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
                                         (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
                }else
-             temp = FPT_utilEERead(ioport, (USHORT)((SYNC_RATE_TBL/2)+id));
+             temp = FPT_utilEERead(ioport, (unsigned short)((SYNC_RATE_TBL/2)+id));
 
       for (i = 0; i < 2; temp >>=8,i++) {
 
          if (pCardInfo->si_per_targ_init_sync & sync_bit_map) {
 
-            FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue = (UCHAR)temp;
+            FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue = (unsigned char)temp;
             }
 
          else {
            FPT_sccbMgrTbl[thisCard][id*2+i].TarStatus |= SYNC_SUPPORTED;
             FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue =
-               (UCHAR)(temp & ~EE_SYNC_MASK);
+               (unsigned char)(temp & ~EE_SYNC_MASK);
             }
 
 /*         if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) ||
@@ -1933,18 +1569,18 @@ static ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo)
       }
 
    WR_HARPOON((ioport+hp_semaphore),
-      (UCHAR)(RD_HARPOON((ioport+hp_semaphore)) | SCCB_MGR_PRESENT));
+      (unsigned char)(RD_HARPOON((ioport+hp_semaphore)) | SCCB_MGR_PRESENT));
 
-   return((ULONG)CurrCard);
+   return((unsigned long)CurrCard);
 }
 
-static void SccbMgr_unload_card(ULONG pCurrCard)
+static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard)
 {
-       UCHAR i;
-       ULONG portBase;
-       ULONG regOffset;
-       ULONG scamData;
-       ULONG *pScamTbl;
+       unsigned char i;
+       unsigned long portBase;
+       unsigned long regOffset;
+       unsigned long scamData;
+       unsigned long *pScamTbl;
        PNVRamInfo pCurrNvRam;
 
        pCurrNvRam = ((PSCCBcard)pCurrCard)->pNvRamInfo;
@@ -1957,13 +1593,13 @@ static void SccbMgr_unload_card(ULONG pCurrCard)
                FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId);
 
                for(i = 0; i < MAX_SCSI_TAR / 2; i++)
-                       FPT_WrStack(pCurrNvRam->niBaseAddr, (UCHAR)(i+5), pCurrNvRam->niSyncTbl[i]);
+                       FPT_WrStack(pCurrNvRam->niBaseAddr, (unsigned char)(i+5), pCurrNvRam->niSyncTbl[i]);
 
                portBase = pCurrNvRam->niBaseAddr;
 
                for(i = 0; i < MAX_SCSI_TAR; i++){
                        regOffset = hp_aramBase + 64 + i*4;
-                       pScamTbl = (ULONG *) &pCurrNvRam->niScamTbl[i];
+                       pScamTbl = (unsigned long *) &pCurrNvRam->niScamTbl[i];
                        scamData = *pScamTbl;
                        WR_HARP32(portBase, regOffset, scamData);
                }
@@ -1976,11 +1612,11 @@ static void SccbMgr_unload_card(ULONG pCurrCard)
 
 static void FPT_RNVRamData(PNVRamInfo pNvRamInfo)
 {
-       UCHAR i;
-       ULONG portBase;
-       ULONG regOffset;
-       ULONG scamData;
-       ULONG *pScamTbl;
+       unsigned char i;
+       unsigned long portBase;
+       unsigned long regOffset;
+       unsigned long scamData;
+       unsigned long *pScamTbl;
 
        pNvRamInfo->niModel    = FPT_RdStack(pNvRamInfo->niBaseAddr, 0);
        pNvRamInfo->niSysConf  = FPT_RdStack(pNvRamInfo->niBaseAddr, 1);
@@ -1989,33 +1625,33 @@ static void FPT_RNVRamData(PNVRamInfo pNvRamInfo)
        pNvRamInfo->niAdapId   = FPT_RdStack(pNvRamInfo->niBaseAddr, 4);
 
        for(i = 0; i < MAX_SCSI_TAR / 2; i++)
-               pNvRamInfo->niSyncTbl[i] = FPT_RdStack(pNvRamInfo->niBaseAddr, (UCHAR)(i+5));
+               pNvRamInfo->niSyncTbl[i] = FPT_RdStack(pNvRamInfo->niBaseAddr, (unsigned char)(i+5));
 
        portBase = pNvRamInfo->niBaseAddr;
 
        for(i = 0; i < MAX_SCSI_TAR; i++){
                regOffset = hp_aramBase + 64 + i*4;
                RD_HARP32(portBase, regOffset, scamData);
-               pScamTbl = (ULONG *) &pNvRamInfo->niScamTbl[i];
+               pScamTbl = (unsigned long *) &pNvRamInfo->niScamTbl[i];
                *pScamTbl = scamData;
        }
 
 }
 
-static UCHAR FPT_RdStack(ULONG portBase, UCHAR index)
+static unsigned char FPT_RdStack(unsigned long portBase, unsigned char index)
 {
        WR_HARPOON(portBase + hp_stack_addr, index);
        return(RD_HARPOON(portBase + hp_stack_data));
 }
 
-static void FPT_WrStack(ULONG portBase, UCHAR index, UCHAR data)
+static void FPT_WrStack(unsigned long portBase, unsigned char index, unsigned char data)
 {
        WR_HARPOON(portBase + hp_stack_addr, index);
        WR_HARPOON(portBase + hp_stack_data, data);
 }
 
 
-static UCHAR FPT_ChkIfChipInitialized(ULONG ioPort)
+static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort)
 {
        if((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4))
                return(0);
@@ -2030,17 +1666,17 @@ static UCHAR FPT_ChkIfChipInitialized(ULONG ioPort)
 }
 /*---------------------------------------------------------------------
  *
- * Function: SccbMgr_start_sccb
+ * Function: FlashPoint_StartCCB
  *
  * Description: Start a command pointed to by p_Sccb. When the
  *              command is completed it will be returned via the
  *              callback function.
  *
  *---------------------------------------------------------------------*/
-static void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb)
+static void FlashPoint_StartCCB(unsigned long pCurrCard, PSCCB p_Sccb)
 {
-   ULONG ioport;
-   UCHAR thisCard, lun;
+   unsigned long ioport;
+   unsigned char thisCard, lun;
        PSCCB pSaveSccb;
    CALL_BK_FN callback;
 
@@ -2150,20 +1786,20 @@ static void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb)
 
 /*---------------------------------------------------------------------
  *
- * Function: SccbMgr_abort_sccb
+ * Function: FlashPoint_AbortCCB
  *
  * Description: Abort the command pointed to by p_Sccb.  When the
  *              command is completed it will be returned via the
  *              callback function.
  *
  *---------------------------------------------------------------------*/
-static int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb)
+static int FlashPoint_AbortCCB(unsigned long pCurrCard, PSCCB p_Sccb)
 {
-       ULONG ioport;
+       unsigned long ioport;
 
-       UCHAR thisCard;
+       unsigned char thisCard;
        CALL_BK_FN callback;
-       UCHAR TID;
+       unsigned char TID;
        PSCCB pSaveSCCB;
        PSCCBMgr_tar_info currTar_Info;
 
@@ -2182,7 +1818,7 @@ static int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb)
 
                        if (!((PSCCBcard)pCurrCard)->cmdCounter)
                                WR_HARPOON(ioport+hp_semaphore,(RD_HARPOON(ioport+hp_semaphore)
-                                       & (UCHAR)(~(SCCB_MGR_ACTIVE | TICKLE_ME)) ));
+                                       & (unsigned char)(~(SCCB_MGR_ACTIVE | TICKLE_ME)) ));
 
                        p_Sccb->SccbStatus = SCCB_ABORT;
                        callback = p_Sccb->SccbCallback;
@@ -2251,15 +1887,15 @@ static int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb)
 
 /*---------------------------------------------------------------------
  *
- * Function: SccbMgr_my_int
+ * Function: FlashPoint_InterruptPending
  *
  * Description: Do a quick check to determine if there is a pending
  *              interrupt for this card and disable the IRQ Pin if so.
  *
  *---------------------------------------------------------------------*/
-static UCHAR SccbMgr_my_int(ULONG pCurrCard)
+static unsigned char FlashPoint_InterruptPending(unsigned long pCurrCard)
 {
-   ULONG ioport;
+   unsigned long ioport;
 
    ioport = ((PSCCBcard)pCurrCard)->ioPort;
 
@@ -2277,20 +1913,20 @@ static UCHAR SccbMgr_my_int(ULONG pCurrCard)
 
 /*---------------------------------------------------------------------
  *
- * Function: SccbMgr_isr
+ * Function: FlashPoint_HandleInterrupt
  *
  * Description: This is our entry point when an interrupt is generated
  *              by the card and the upper level driver passes it on to
  *              us.
  *
  *---------------------------------------------------------------------*/
-static int SccbMgr_isr(ULONG pCurrCard)
+static int FlashPoint_HandleInterrupt(unsigned long pCurrCard)
 {
    PSCCB currSCCB;
-   UCHAR thisCard,result,bm_status, bm_int_st;
-   USHORT hp_int;
-   UCHAR i, target;
-   ULONG ioport;
+   unsigned char thisCard,result,bm_status, bm_int_st;
+   unsigned short hp_int;
+   unsigned char i, target;
+   unsigned long ioport;
 
    thisCard = ((PSCCBcard)pCurrCard)->cardIndex;
    ioport = ((PSCCBcard)pCurrCard)->ioPort;
@@ -2298,7 +1934,7 @@ static int SccbMgr_isr(ULONG pCurrCard)
    MDISABLE_INT(ioport);
 
    if ((bm_int_st=RD_HARPOON(ioport+hp_int_status)) & EXT_STATUS_ON)
-               bm_status = RD_HARPOON(ioport+hp_ext_status) & (UCHAR)BAD_EXT_STATUS;
+               bm_status = RD_HARPOON(ioport+hp_ext_status) & (unsigned char)BAD_EXT_STATUS;
    else
       bm_status = 0;
 
@@ -2439,7 +2075,7 @@ static int SccbMgr_isr(ULONG pCurrCard)
       else if ( (hp_int & IUNKWN) || (hp_int & PROG_HLT) )
                   {
                   WRW_HARPOON((ioport+hp_intstat), (PHASE | IUNKWN | PROG_HLT));
-                  if ((RD_HARPOON(ioport+hp_prgmcnt_0) & (UCHAR)0x3f)< (UCHAR)SELCHK)
+                  if ((RD_HARPOON(ioport+hp_prgmcnt_0) & (unsigned char)0x3f)< (unsigned char)SELCHK)
                        {
                        FPT_phaseDecode(ioport,thisCard);
                        }
@@ -2452,11 +2088,11 @@ static int SccbMgr_isr(ULONG pCurrCard)
    reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we
    need to read this reg first then restore it later. After update to 0x53 */
 
-                       i = (UCHAR)(RD_HARPOON(ioport+hp_fifowrite));
-                       target = (UCHAR)(RD_HARPOON(ioport+hp_gp_reg_3));
-                       WR_HARPOON(ioport+hp_xfer_pad, (UCHAR) ID_UNLOCK);
-                       WR_HARPOON(ioport+hp_select_id, (UCHAR)(target | target<<4));
-                       WR_HARPOON(ioport+hp_xfer_pad, (UCHAR) 0x00);
+                       i = (unsigned char)(RD_HARPOON(ioport+hp_fifowrite));
+                       target = (unsigned char)(RD_HARPOON(ioport+hp_gp_reg_3));
+                       WR_HARPOON(ioport+hp_xfer_pad, (unsigned char) ID_UNLOCK);
+                       WR_HARPOON(ioport+hp_select_id, (unsigned char)(target | target<<4));
+                       WR_HARPOON(ioport+hp_xfer_pad, (unsigned char) 0x00);
                        WR_HARPOON(ioport+hp_fifowrite, i);
                        WR_HARPOON(ioport+hp_autostart_3, (AUTO_IMMED+TAG_STRT));
                        }
@@ -2529,10 +2165,10 @@ static int SccbMgr_isr(ULONG pCurrCard)
  *              processing time.
  *
  *---------------------------------------------------------------------*/
-static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card,
-                                PSCCBcard pCurrCard, USHORT p_int)
+static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, unsigned char p_card,
+                                PSCCBcard pCurrCard, unsigned short p_int)
 {
-   UCHAR temp, ScamFlg;
+   unsigned char temp, ScamFlg;
    PSCCBMgr_tar_info currTar_Info;
    PNVRamInfo pCurrNvRam;
 
@@ -2565,9 +2201,9 @@ static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card,
 
          FPT_sxfrp(p_port,p_card);
 
-            temp = (UCHAR)(RD_HARPOON(p_port+hp_ee_ctrl) &
+            temp = (unsigned char)(RD_HARPOON(p_port+hp_ee_ctrl) &
                                                        (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-       WR_HARPOON(p_port+hp_ee_ctrl, ((UCHAR)temp | SEE_MS | SEE_CS));
+       WR_HARPOON(p_port+hp_ee_ctrl, ((unsigned char)temp | SEE_MS | SEE_CS));
          WR_HARPOON(p_port+hp_ee_ctrl, temp);
 
          if (!(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET)))
@@ -2602,7 +2238,7 @@ static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card,
                                        ScamFlg = pCurrNvRam->niScamConf;
                                }
                                else{
-                                  ScamFlg = (UCHAR) FPT_utilEERead(p_port, SCAM_CONFIG/2);
+                                  ScamFlg = (unsigned char) FPT_utilEERead(p_port, SCAM_CONFIG/2);
                                }
 
            FPT_XbowInit(p_port, ScamFlg);
@@ -2683,7 +2319,7 @@ static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card,
 
 static void FPT_SccbMgrTableInitAll()
 {
-   UCHAR thisCard;
+   unsigned char thisCard;
 
    for (thisCard = 0; thisCard < MAX_CARDS; thisCard++)
       {
@@ -2706,9 +2342,9 @@ static void FPT_SccbMgrTableInitAll()
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card)
+static void FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, unsigned char p_card)
 {
-   UCHAR scsiID, qtag;
+   unsigned char scsiID, qtag;
 
        for (qtag = 0; qtag < QUEUE_DEPTH; qtag++)
        {
@@ -2741,10 +2377,10 @@ static void FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_SccbMgrTableInitTarget(UCHAR p_card, UCHAR target)
+static void FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char target)
 {
 
-       UCHAR lun, qtag;
+       unsigned char lun, qtag;
        PSCCBMgr_tar_info currTar_Info;
 
        currTar_Info = &FPT_sccbMgrTbl[p_card][target];
@@ -2787,10 +2423,10 @@ static void FPT_SccbMgrTableInitTarget(UCHAR p_card, UCHAR target)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_sfm(ULONG port, PSCCB pCurrSCCB)
+static unsigned char FPT_sfm(unsigned long port, PSCCB pCurrSCCB)
 {
-       UCHAR message;
-       USHORT TimeOutLoop;
+       unsigned char message;
+       unsigned short TimeOutLoop;
 
        TimeOutLoop = 0;
        while( (!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) &&
@@ -2860,16 +2496,16 @@ static UCHAR FPT_sfm(ULONG port, PSCCB pCurrSCCB)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_ssel(ULONG port, UCHAR p_card)
+static void FPT_ssel(unsigned long port, unsigned char p_card)
 {
 
-   UCHAR auto_loaded, i, target, *theCCB;
+   unsigned char auto_loaded, i, target, *theCCB;
 
-   ULONG cdb_reg;
+   unsigned long cdb_reg;
    PSCCBcard CurrCard;
    PSCCB currSCCB;
    PSCCBMgr_tar_info currTar_Info;
-   UCHAR lastTag, lun;
+   unsigned char lastTag, lun;
 
    CurrCard = &FPT_BL_Card[p_card];
    currSCCB = CurrCard->currentSCCB;
@@ -3015,8 +2651,8 @@ static void FPT_ssel(ULONG port, UCHAR p_card)
       WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+CMDPZ);
 
                        WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+
-                                                               (((UCHAR)(currSCCB->ControlByte & TAG_TYPE_MASK)
-                                                               >> 6) | (UCHAR)0x20)));
+                                                               (((unsigned char)(currSCCB->ControlByte & TAG_TYPE_MASK)
+                                                               >> 6) | (unsigned char)0x20)));
                        WRW_HARPOON((port+SYNC_MSGS+2),
                                                        (MPM_OP+AMSG_OUT+currSCCB->Sccb_tag));
                        WRW_HARPOON((port+SYNC_MSGS+4), (BRH_OP+ALWAYS+NP ));
@@ -3072,8 +2708,8 @@ static void FPT_ssel(ULONG port, UCHAR p_card)
             WRW_HARPOON((port+ID_MSG_STRT), (MPM_OP+AMSG_OUT+currSCCB->Sccb_idmsg));
 
             WRW_HARPOON((port+ID_MSG_STRT+2), (MPM_OP+AMSG_OUT+
-                        (((UCHAR)(currSCCB->ControlByte & TAG_TYPE_MASK)
-                        >> 6) | (UCHAR)0x20)));
+                        (((unsigned char)(currSCCB->ControlByte & TAG_TYPE_MASK)
+                        >> 6) | (unsigned char)0x20)));
 
                                for (i = 1; i < QUEUE_DEPTH; i++)
                                {
@@ -3119,7 +2755,7 @@ static void FPT_ssel(ULONG port, UCHAR p_card)
          }
 
 
-      theCCB = (UCHAR *)&currSCCB->Cdb[0];
+      theCCB = (unsigned char *)&currSCCB->Cdb[0];
 
       cdb_reg = port + CMD_STRT;
 
@@ -3135,7 +2771,7 @@ static void FPT_ssel(ULONG port, UCHAR p_card)
 
       }  /* auto_loaded */
 
-   WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00);
+   WRW_HARPOON((port+hp_fiforead), (unsigned short) 0x00);
    WR_HARPOON(port+hp_xferstat, 0x00);
 
    WRW_HARPOON((port+hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE));
@@ -3150,7 +2786,7 @@ static void FPT_ssel(ULONG port, UCHAR p_card)
    else
       {
 
-/*      auto_loaded =  (RD_HARPOON(port+hp_autostart_3) & (UCHAR)0x1F);
+/*      auto_loaded =  (RD_HARPOON(port+hp_autostart_3) & (unsigned char)0x1F);
       auto_loaded |= AUTO_IMMED; */
       auto_loaded = AUTO_IMMED;
 
@@ -3171,10 +2807,10 @@ static void FPT_ssel(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard)
+static void FPT_sres(unsigned long port, unsigned char p_card, PSCCBcard pCurrCard)
 {
 
-   UCHAR our_target, message, lun = 0, tag, msgRetryCount;
+   unsigned char our_target, message, lun = 0, tag, msgRetryCount;
 
 
    PSCCBMgr_tar_info currTar_Info;
@@ -3237,10 +2873,10 @@ static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard)
       FPT_queueSelectFail(&FPT_BL_Card[p_card],p_card);
        }
 
-       WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00);
+       WRW_HARPOON((port+hp_fiforead), (unsigned short) 0x00);
 
 
-       our_target = (UCHAR)(RD_HARPOON(port+hp_select_id) >> 4);
+       our_target = (unsigned char)(RD_HARPOON(port+hp_select_id) >> 4);
        currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
 
 
@@ -3272,7 +2908,7 @@ static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard)
 
                                if (message <= (0x80 | LUN_MASK))
                                {
-                                       lun = message & (UCHAR)LUN_MASK;
+                                       lun = message & (unsigned char)LUN_MASK;
 
                                        if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING)
                                        {
@@ -3432,7 +3068,7 @@ static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard)
          (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) ;
 }
 
-static void FPT_SendMsg(ULONG port, UCHAR message)
+static void FPT_SendMsg(unsigned long port, unsigned char message)
 {
        while(!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ))
        {
@@ -3481,7 +3117,7 @@ static void FPT_SendMsg(ULONG port, UCHAR message)
  *              target device.
  *
  *---------------------------------------------------------------------*/
-static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card)
+static void FPT_sdecm(unsigned char message, unsigned long port, unsigned char p_card)
 {
        PSCCB currSCCB;
        PSCCBcard CurrCard;
@@ -3511,8 +3147,8 @@ static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card)
 
                if (currSCCB->Sccb_scsistat == SELECT_Q_ST)
                {
-                       currTar_Info->TarStatus &= ~(UCHAR)TAR_TAG_Q_MASK;
-                       currTar_Info->TarStatus |= (UCHAR)TAG_Q_REJECT;
+                       currTar_Info->TarStatus &= ~(unsigned char)TAR_TAG_Q_MASK;
+                       currTar_Info->TarStatus |= (unsigned char)TAG_Q_REJECT;
                }
 
                ACCEPT_MSG(port);
@@ -3549,7 +3185,7 @@ static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card)
                                if ((currSCCB->Sccb_scsistat == SELECT_SN_ST))
                                {
 
-                                       currTar_Info->TarStatus |= (UCHAR)SYNC_SUPPORTED;
+                                       currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED;
 
                                        currTar_Info->TarEEValue &= ~EE_SYNC_MASK;
                                }
@@ -3568,7 +3204,7 @@ static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card)
                                else if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING )
                                {
                                        currTar_Info->TarStatus = (currTar_Info->TarStatus &
-                                                                                                       ~(UCHAR)TAR_TAG_Q_MASK) | TAG_Q_REJECT;
+                                                                                                       ~(unsigned char)TAR_TAG_Q_MASK) | TAG_Q_REJECT;
 
 
                                        currSCCB->ControlByte &= ~F_USE_CMD_Q;
@@ -3600,7 +3236,7 @@ static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card)
                                        currTar_Info->TarLUNBusy[0] = 1;
 
 
-                               currSCCB->ControlByte &= ~(UCHAR)F_USE_CMD_Q;
+                               currSCCB->ControlByte &= ~(unsigned char)F_USE_CMD_Q;
 
                                WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START));
 
@@ -3660,9 +3296,9 @@ static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card)
  * Description: Decide what to do with the extended message.
  *
  *---------------------------------------------------------------------*/
-static void FPT_shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
+static void FPT_shandem(unsigned long port, unsigned char p_card, PSCCB pCurrSCCB)
 {
-       UCHAR length,message;
+       unsigned char length,message;
 
        length = FPT_sfm(port,pCurrSCCB);
        if (length) 
@@ -3739,7 +3375,7 @@ static void FPT_shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag)
+static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, unsigned char syncFlag)
 {
    PSCCB currSCCB;
    PSCCBMgr_tar_info currTar_Info;
@@ -3751,7 +3387,7 @@ static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag)
 
 
       WRW_HARPOON((port+ID_MSG_STRT),
-                 (MPM_OP+AMSG_OUT+(currSCCB->Sccb_idmsg & ~(UCHAR)DISC_PRIV)));
+                 (MPM_OP+AMSG_OUT+(currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
 
       WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+CMDPZ);
 
@@ -3785,7 +3421,7 @@ static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag)
                {
                   WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT));
              currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-             ~(UCHAR)TAR_SYNC_MASK) | (UCHAR)SYNC_TRYING);
+             ~(unsigned char)TAR_SYNC_MASK) | (unsigned char)SYNC_TRYING);
                }
                else
                {
@@ -3798,7 +3434,7 @@ static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag)
 
    else {
 
-      currTar_Info->TarStatus |=        (UCHAR)SYNC_SUPPORTED;
+      currTar_Info->TarStatus |=        (unsigned char)SYNC_SUPPORTED;
       currTar_Info->TarEEValue &= ~EE_SYNC_MASK;
       return(0);
       }
@@ -3814,9 +3450,9 @@ static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag)
  *              necessary.
  *
  *---------------------------------------------------------------------*/
-static void FPT_stsyncn(ULONG port, UCHAR p_card)
+static void FPT_stsyncn(unsigned long port, unsigned char p_card)
 {
-   UCHAR sync_msg,offset,sync_reg,our_sync_msg;
+   unsigned char sync_msg,offset,sync_reg,our_sync_msg;
    PSCCB currSCCB;
    PSCCBMgr_tar_info currTar_Info;
 
@@ -3921,7 +3557,7 @@ static void FPT_stsyncn(ULONG port, UCHAR p_card)
       ACCEPT_MSG(port);
 
       currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-         ~(UCHAR)TAR_SYNC_MASK) | (UCHAR)SYNC_SUPPORTED);
+         ~(unsigned char)TAR_SYNC_MASK) | (unsigned char)SYNC_SUPPORTED);
 
       WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START));
       }
@@ -3934,7 +3570,7 @@ static void FPT_stsyncn(ULONG port, UCHAR p_card)
       FPT_sisyncr(port,sync_msg,offset);
 
       currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-         ~(UCHAR)TAR_SYNC_MASK) | (UCHAR)SYNC_SUPPORTED);
+         ~(unsigned char)TAR_SYNC_MASK) | (unsigned char)SYNC_SUPPORTED);
       }
 }
 
@@ -3946,7 +3582,7 @@ static void FPT_stsyncn(ULONG port, UCHAR p_card)
  * Description: Answer the targets sync message.
  *
  *---------------------------------------------------------------------*/
-static void FPT_sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset)
+static void FPT_sisyncr(unsigned long port,unsigned char sync_pulse, unsigned char offset)
 {
    ARAM_ACCESS(port);
    WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT ));
@@ -3977,7 +3613,7 @@ static void FPT_sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_siwidn(ULONG port, UCHAR p_card)
+static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card)
 {
    PSCCB currSCCB;
    PSCCBMgr_tar_info currTar_Info;
@@ -3989,7 +3625,7 @@ static UCHAR FPT_siwidn(ULONG port, UCHAR p_card)
 
 
       WRW_HARPOON((port+ID_MSG_STRT),
-                     (MPM_OP+AMSG_OUT+(currSCCB->Sccb_idmsg & ~(UCHAR)DISC_PRIV)));
+                     (MPM_OP+AMSG_OUT+(currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
 
       WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+CMDPZ);
 
@@ -4004,7 +3640,7 @@ static UCHAR FPT_siwidn(ULONG port, UCHAR p_card)
 
 
       currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-         ~(UCHAR)TAR_WIDE_MASK) | (UCHAR)WIDE_ENABLED);
+         ~(unsigned char)TAR_WIDE_MASK) | (unsigned char)WIDE_ENABLED);
 
       return(1);
       }
@@ -4012,7 +3648,7 @@ static UCHAR FPT_siwidn(ULONG port, UCHAR p_card)
    else {
 
       currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-               ~(UCHAR)TAR_WIDE_MASK) | WIDE_NEGOCIATED);
+               ~(unsigned char)TAR_WIDE_MASK) | WIDE_NEGOCIATED);
 
       currTar_Info->TarEEValue &= ~EE_WIDE_SCSI;
       return(0);
@@ -4029,9 +3665,9 @@ static UCHAR FPT_siwidn(ULONG port, UCHAR p_card)
  *              necessary.
  *
  *---------------------------------------------------------------------*/
-static void FPT_stwidn(ULONG port, UCHAR p_card)
+static void FPT_stwidn(unsigned long port, unsigned char p_card)
 {
-   UCHAR width;
+   unsigned char width;
    PSCCB currSCCB;
    PSCCBMgr_tar_info currTar_Info;
 
@@ -4109,7 +3745,7 @@ static void FPT_stwidn(ULONG port, UCHAR p_card)
  * Description: Answer the targets Wide nego message.
  *
  *---------------------------------------------------------------------*/
-static void FPT_siwidr(ULONG port, UCHAR width)
+static void FPT_siwidr(unsigned long port, unsigned char width)
 {
    ARAM_ACCESS(port);
    WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT ));
@@ -4138,10 +3774,10 @@ static void FPT_siwidr(ULONG port, UCHAR width)
  *              ID specified.
  *
  *---------------------------------------------------------------------*/
-static void FPT_sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value,
+static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, unsigned char p_sync_value,
                        PSCCBMgr_tar_info currTar_Info)
 {
-   UCHAR index;
+   unsigned char index;
 
    index = p_id;
 
@@ -4210,9 +3846,9 @@ static void FPT_sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value,
  * Description: Reset the desired card's SCSI bus.
  *
  *---------------------------------------------------------------------*/
-static void FPT_sresb(ULONG port, UCHAR p_card)
+static void FPT_sresb(unsigned long port, unsigned char p_card)
 {
-   UCHAR scsiID, i;
+   unsigned char scsiID, i;
 
    PSCCBMgr_tar_info currTar_Info;
 
@@ -4285,7 +3921,7 @@ static void FPT_sresb(ULONG port, UCHAR p_card)
  *---------------------------------------------------------------------*/
 static void FPT_ssenss(PSCCBcard pCurrCard)
 {
-   UCHAR i;
+   unsigned char i;
    PSCCB currSCCB;
 
    currSCCB = pCurrCard->currentSCCB;
@@ -4300,7 +3936,7 @@ static void FPT_ssenss(PSCCBcard pCurrCard)
 
    currSCCB->CdbLength = SIX_BYTE_CMD;
    currSCCB->Cdb[0]    = SCSI_REQUEST_SENSE;
-   currSCCB->Cdb[1]    = currSCCB->Cdb[1] & (UCHAR)0xE0; /*Keep LUN. */
+   currSCCB->Cdb[1]    = currSCCB->Cdb[1] & (unsigned char)0xE0; /*Keep LUN. */
    currSCCB->Cdb[2]    = 0x00;
    currSCCB->Cdb[3]    = 0x00;
    currSCCB->Cdb[4]    = currSCCB->RequestSenseLength;
@@ -4314,7 +3950,7 @@ static void FPT_ssenss(PSCCBcard pCurrCard)
 
    currSCCB->Sccb_XferState &= ~F_SG_XFER;
 
-   currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(UCHAR)DISC_PRIV;
+   currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV;
 
    currSCCB->ControlByte = 0x00;
 
@@ -4332,9 +3968,9 @@ static void FPT_ssenss(PSCCBcard pCurrCard)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_sxfrp(ULONG p_port, UCHAR p_card)
+static void FPT_sxfrp(unsigned long p_port, unsigned char p_card)
 {
-   UCHAR curr_phz;
+   unsigned char curr_phz;
 
 
    DISABLE_AUTO(p_port);
@@ -4353,7 +3989,7 @@ static void FPT_sxfrp(ULONG p_port, UCHAR p_card)
 
    WR_HARPOON(p_port+hp_xfercnt_0, 0x00);
 
-   curr_phz = RD_HARPOON(p_port+hp_scsisig) & (UCHAR)S_SCSI_PHZ;
+   curr_phz = RD_HARPOON(p_port+hp_scsisig) & (unsigned char)S_SCSI_PHZ;
 
    WRW_HARPOON((p_port+hp_intstat), XFER_CNT_0);
 
@@ -4361,9 +3997,9 @@ static void FPT_sxfrp(ULONG p_port, UCHAR p_card)
    WR_HARPOON(p_port+hp_scsisig, curr_phz);
 
    while ( !(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET)) &&
-      (curr_phz == (RD_HARPOON(p_port+hp_scsisig) & (UCHAR)S_SCSI_PHZ)) )
+      (curr_phz == (RD_HARPOON(p_port+hp_scsisig) & (unsigned char)S_SCSI_PHZ)) )
       {
-      if (curr_phz & (UCHAR)SCSI_IOBIT)
+      if (curr_phz & (unsigned char)SCSI_IOBIT)
          {
        WR_HARPOON(p_port+hp_portctrl_0, (SCSI_PORT | HOST_PORT | SCSI_INBIT));
 
@@ -4414,10 +4050,10 @@ static void FPT_sxfrp(ULONG p_port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_schkdd(ULONG port, UCHAR p_card)
+static void FPT_schkdd(unsigned long port, unsigned char p_card)
 {
-   USHORT TimeOutLoop;
-       UCHAR sPhase;
+   unsigned short TimeOutLoop;
+       unsigned char sPhase;
 
    PSCCB currSCCB;
 
@@ -4439,7 +4075,7 @@ static void FPT_schkdd(ULONG port, UCHAR p_card)
       currSCCB->Sccb_XferCnt = 1;
 
       currSCCB->Sccb_XferState &= ~F_ODD_BALL_CNT;
-      WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00);
+      WRW_HARPOON((port+hp_fiforead), (unsigned short) 0x00);
       WR_HARPOON(port+hp_xferstat, 0x00);
       }
 
@@ -4471,7 +4107,7 @@ static void FPT_schkdd(ULONG port, UCHAR p_card)
       if (RDW_HARPOON((port+hp_intstat)) & BUS_FREE) {
              return;
           }
-      if (RD_HARPOON(port+hp_offsetctr) & (UCHAR)0x1F) {
+      if (RD_HARPOON(port+hp_offsetctr) & (unsigned char)0x1F) {
              break;
           }
       if (RDW_HARPOON((port+hp_intstat)) & RESET) {
@@ -4483,7 +4119,7 @@ static void FPT_schkdd(ULONG port, UCHAR p_card)
 
        sPhase = RD_HARPOON(port+hp_scsisig) & (SCSI_BSY | S_SCSI_PHZ);
    if ((!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY))                     ||
-      (RD_HARPOON(port+hp_offsetctr) & (UCHAR)0x1F)                       ||
+      (RD_HARPOON(port+hp_offsetctr) & (unsigned char)0x1F)                       ||
       (sPhase == (SCSI_BSY | S_DATAO_PH)) ||
       (sPhase == (SCSI_BSY | S_DATAI_PH)))
       {
@@ -4527,7 +4163,7 @@ static void FPT_schkdd(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_sinits(PSCCB p_sccb, UCHAR p_card)
+static void FPT_sinits(PSCCB p_sccb, unsigned char p_card)
 {
    PSCCBMgr_tar_info currTar_Info;
 
@@ -4572,12 +4208,12 @@ static void FPT_sinits(PSCCB p_sccb, UCHAR p_card)
 */
    if ((currTar_Info->TarStatus & TAR_ALLOW_DISC) ||
       (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-      p_sccb->Sccb_idmsg      = (UCHAR)(SMIDENT | DISC_PRIV) | p_sccb->Lun;
+      p_sccb->Sccb_idmsg      = (unsigned char)(SMIDENT | DISC_PRIV) | p_sccb->Lun;
       }
 
    else {
 
-      p_sccb->Sccb_idmsg      = (UCHAR)SMIDENT | p_sccb->Lun;
+      p_sccb->Sccb_idmsg      = (unsigned char)SMIDENT | p_sccb->Lun;
       }
 
    p_sccb->HostStatus         = 0x00;
@@ -4607,15 +4243,15 @@ static void FPT_sinits(PSCCB p_sccb, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseDecode(ULONG p_port, UCHAR p_card)
+static void FPT_phaseDecode(unsigned long p_port, unsigned char p_card)
 {
    unsigned char phase_ref;
-   void (*phase) (ULONG, UCHAR);
+   void (*phase) (unsigned long, unsigned char);
 
 
    DISABLE_AUTO(p_port);
 
-   phase_ref = (UCHAR) (RD_HARPOON(p_port+hp_scsisig) & S_SCSI_PHZ);
+   phase_ref = (unsigned char) (RD_HARPOON(p_port+hp_scsisig) & S_SCSI_PHZ);
 
    phase = FPT_s_PhaseTbl[phase_ref];
 
@@ -4632,7 +4268,7 @@ static void FPT_phaseDecode(ULONG p_port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseDataOut(ULONG port, UCHAR p_card)
+static void FPT_phaseDataOut(unsigned long port, unsigned char p_card)
 {
 
    PSCCB currSCCB;
@@ -4676,7 +4312,7 @@ static void FPT_phaseDataOut(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseDataIn(ULONG port, UCHAR p_card)
+static void FPT_phaseDataIn(unsigned long port, unsigned char p_card)
 {
 
    PSCCB currSCCB;
@@ -4723,11 +4359,11 @@ static void FPT_phaseDataIn(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseCommand(ULONG p_port, UCHAR p_card)
+static void FPT_phaseCommand(unsigned long p_port, unsigned char p_card)
 {
    PSCCB currSCCB;
-   ULONG cdb_reg;
-   UCHAR i;
+   unsigned long cdb_reg;
+   unsigned char i;
 
    currSCCB = FPT_BL_Card[p_card].currentSCCB;
 
@@ -4775,7 +4411,7 @@ static void FPT_phaseCommand(ULONG p_port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseStatus(ULONG port, UCHAR p_card)
+static void FPT_phaseStatus(unsigned long port, unsigned char p_card)
 {
    /* Start-up the automation to finish off this command and let the
       isr handle the interrupt for command complete when it comes in.
@@ -4797,9 +4433,9 @@ static void FPT_phaseStatus(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseMsgOut(ULONG port, UCHAR p_card)
+static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card)
 {
-       UCHAR message,scsiID;
+       unsigned char message,scsiID;
        PSCCB currSCCB;
        PSCCBMgr_tar_info currTar_Info;
 
@@ -4945,9 +4581,9 @@ static void FPT_phaseMsgOut(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseMsgIn(ULONG port, UCHAR p_card)
+static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card)
 {
-       UCHAR message;
+       unsigned char message;
        PSCCB currSCCB;
 
        currSCCB = FPT_BL_Card[p_card].currentSCCB;
@@ -4998,7 +4634,7 @@ static void FPT_phaseMsgIn(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseIllegal(ULONG port, UCHAR p_card)
+static void FPT_phaseIllegal(unsigned long port, unsigned char p_card)
 {
    PSCCB currSCCB;
 
@@ -5026,9 +4662,9 @@ static void FPT_phaseIllegal(ULONG port, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_phaseChkFifo(ULONG port, UCHAR p_card)
+static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card)
 {
-   ULONG xfercnt;
+   unsigned long xfercnt;
    PSCCB currSCCB;
 
    currSCCB = FPT_BL_Card[p_card].currentSCCB;
@@ -5104,7 +4740,7 @@ static void FPT_phaseChkFifo(ULONG port, UCHAR p_card)
  *              because of command complete or from a disconnect.
  *
  *---------------------------------------------------------------------*/
-static void FPT_phaseBusFree(ULONG port, UCHAR p_card)
+static void FPT_phaseBusFree(unsigned long port, unsigned char p_card)
 {
    PSCCB currSCCB;
 
@@ -5134,7 +4770,7 @@ static void FPT_phaseBusFree(ULONG port, UCHAR p_card)
       else if(currSCCB->Sccb_scsistat == SELECT_SN_ST)
              {
              FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-                                (UCHAR)SYNC_SUPPORTED;
+                                (unsigned char)SYNC_SUPPORTED;
              FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK;
              }
 
@@ -5202,9 +4838,9 @@ static void FPT_phaseBusFree(ULONG port, UCHAR p_card)
  * Description: Load the Automation RAM with the defualt map values.
  *
  *---------------------------------------------------------------------*/
-static void FPT_autoLoadDefaultMap(ULONG p_port)
+static void FPT_autoLoadDefaultMap(unsigned long p_port)
 {
-   ULONG map_addr;
+   unsigned long map_addr;
 
    ARAM_ACCESS(p_port);
    map_addr = p_port + hp_aramBase;
@@ -5310,10 +4946,10 @@ static void FPT_autoLoadDefaultMap(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_autoCmdCmplt(ULONG p_port, UCHAR p_card)
+static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card)
 {
    PSCCB currSCCB;
-   UCHAR status_byte;
+   unsigned char status_byte;
 
    currSCCB = FPT_BL_Card[p_card].currentSCCB;
 
@@ -5360,7 +4996,7 @@ static void FPT_autoCmdCmplt(ULONG p_port, UCHAR p_card)
       if(currSCCB->Sccb_scsistat == SELECT_SN_ST)
          {
          FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-            (UCHAR)SYNC_SUPPORTED;
+            (unsigned char)SYNC_SUPPORTED;
 
              FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK;
          FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
@@ -5525,7 +5161,7 @@ static void FPT_autoCmdCmplt(ULONG p_port, UCHAR p_card)
  *              
  *---------------------------------------------------------------------*/
 
-static void FPT_dataXferProcessor(ULONG port, PSCCBcard pCurrCard)
+static void FPT_dataXferProcessor(unsigned long port, PSCCBcard pCurrCard)
 {
    PSCCB currSCCB;
 
@@ -5536,7 +5172,7 @@ static void FPT_dataXferProcessor(ULONG port, PSCCBcard pCurrCard)
                        if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
 
                                {
-                       currSCCB->Sccb_sgseg += (UCHAR)SG_BUF_CNT;
+                       currSCCB->Sccb_sgseg += (unsigned char)SG_BUF_CNT;
                currSCCB->Sccb_SGoffset = 0x00; 
                                }
                        pCurrCard->globalFlags |= F_HOST_XFER_ACT;
@@ -5563,21 +5199,21 @@ static void FPT_dataXferProcessor(ULONG port, PSCCBcard pCurrCard)
  * Description:
  *
  *---------------------------------------------------------------------*/
-static void FPT_busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB)
+static void FPT_busMstrSGDataXferStart(unsigned long p_port, PSCCB pcurrSCCB)
 {
-   ULONG count,addr,tmpSGCnt;
-   UINT sg_index;
-   UCHAR sg_count, i;
-   ULONG reg_offset;
+   unsigned long count,addr,tmpSGCnt;
+   unsigned int sg_index;
+   unsigned char sg_count, i;
+   unsigned long reg_offset;
 
 
    if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
 
-      count =  ((ULONG) HOST_RD_CMD)<<24;
+      count =  ((unsigned long) HOST_RD_CMD)<<24;
       }
 
    else {
-      count =  ((ULONG) HOST_WRT_CMD)<<24;
+      count =  ((unsigned long) HOST_WRT_CMD)<<24;
       }
 
    sg_count = 0;
@@ -5586,21 +5222,21 @@ static void FPT_busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB)
    reg_offset = hp_aramBase;
 
 
-       i = (UCHAR) (RD_HARPOON(p_port+hp_page_ctrl) & ~(SGRAM_ARAM|SCATTER_EN));
+       i = (unsigned char) (RD_HARPOON(p_port+hp_page_ctrl) & ~(SGRAM_ARAM|SCATTER_EN));
 
 
        WR_HARPOON(p_port+hp_page_ctrl, i);
 
-   while ((sg_count < (UCHAR)SG_BUF_CNT) &&
-      ((ULONG)(sg_index * (UINT)SG_ELEMENT_SIZE) < pcurrSCCB->DataLength) ) {
+   while ((sg_count < (unsigned char)SG_BUF_CNT) &&
+      ((unsigned long)(sg_index * (unsigned int)SG_ELEMENT_SIZE) < pcurrSCCB->DataLength) ) {
 
-      tmpSGCnt += *(((ULONG *)pcurrSCCB->DataPointer)+
+      tmpSGCnt += *(((unsigned long *)pcurrSCCB->DataPointer)+
          (sg_index * 2));
 
-      count |= *(((ULONG *)pcurrSCCB->DataPointer)+
+      count |= *(((unsigned long *)pcurrSCCB->DataPointer)+
          (sg_index * 2));
 
-      addr = *(((ULONG *)pcurrSCCB->DataPointer)+
+      addr = *(((unsigned long *)pcurrSCCB->DataPointer)+
          ((sg_index * 2) + 1));
 
 
@@ -5656,7 +5292,7 @@ static void FPT_busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB)
       }
 
 
-   WR_HARPOON(p_port+hp_page_ctrl, (UCHAR) (i | SCATTER_EN));
+   WR_HARPOON(p_port+hp_page_ctrl, (unsigned char) (i | SCATTER_EN));
 
 }
 
@@ -5668,15 +5304,15 @@ static void FPT_busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB)
  * Description: 
  *
  *---------------------------------------------------------------------*/
-static void FPT_busMstrDataXferStart(ULONG p_port, PSCCB pcurrSCCB)
+static void FPT_busMstrDataXferStart(unsigned long p_port, PSCCB pcurrSCCB)
 {
-   ULONG addr,count;
+   unsigned long addr,count;
 
    if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) {
 
       count = pcurrSCCB->Sccb_XferCnt;
 
-      addr = (ULONG) pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC;
+      addr = (unsigned long) pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC;
       }
 
    else {
@@ -5721,9 +5357,9 @@ static void FPT_busMstrDataXferStart(ULONG p_port, PSCCB pcurrSCCB)
  *               command busy is also time out, it'll just give up.
  *
  *---------------------------------------------------------------------*/
-static UCHAR FPT_busMstrTimeOut(ULONG p_port)
+static unsigned char FPT_busMstrTimeOut(unsigned long p_port)
 {
-   ULONG timeout;
+   unsigned long timeout;
 
    timeout = LONG_WAIT;
 
@@ -5759,12 +5395,12 @@ static UCHAR FPT_busMstrTimeOut(ULONG p_port)
  * Description: Abort any in progress transfer.
  *
  *---------------------------------------------------------------------*/
-static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
+static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, PSCCB pCurrSCCB)
 {
 
-   ULONG timeout;
-   ULONG remain_cnt;
-   UINT sg_ptr;
+   unsigned long timeout;
+   unsigned long remain_cnt;
+   unsigned int sg_ptr;
 
    FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT;
 
@@ -5815,9 +5451,9 @@ static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
 
          sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT;
 
-         if (sg_ptr > (UINT)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE)) {
+         if (sg_ptr > (unsigned int)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE)) {
 
-            sg_ptr = (UINT)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE);
+            sg_ptr = (unsigned int)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE);
             }
 
          remain_cnt = pCurrSCCB->Sccb_XferCnt;
@@ -5826,10 +5462,10 @@ static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
 
             sg_ptr--;
 
-            if (remain_cnt > (ULONG)(*(((ULONG *)pCurrSCCB->
+            if (remain_cnt > (unsigned long)(*(((unsigned long *)pCurrSCCB->
                DataPointer) + (sg_ptr * 2)))) {
 
-               remain_cnt -= (ULONG)(*(((ULONG *)pCurrSCCB->
+               remain_cnt -= (unsigned long)(*(((unsigned long *)pCurrSCCB->
                   DataPointer) + (sg_ptr * 2)));
                }
 
@@ -5846,10 +5482,10 @@ static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
 
             pCurrSCCB->Sccb_SGoffset = remain_cnt;
 
-            pCurrSCCB->Sccb_sgseg = (USHORT)sg_ptr;
+            pCurrSCCB->Sccb_sgseg = (unsigned short)sg_ptr;
 
 
-            if ((ULONG)(sg_ptr * SG_ELEMENT_SIZE) == pCurrSCCB->DataLength 
+            if ((unsigned long)(sg_ptr * SG_ELEMENT_SIZE) == pCurrSCCB->DataLength
                 && (remain_cnt == 0))
 
                pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
@@ -5986,12 +5622,12 @@ static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
          pCurrSCCB->Sccb_SGoffset = 0x00; 
 
 
-         if ((ULONG)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >=
+         if ((unsigned long)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >=
             pCurrSCCB->DataLength) {
 
             pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
 
-            pCurrSCCB->Sccb_sgseg = (USHORT)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE);
+            pCurrSCCB->Sccb_sgseg = (unsigned short)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE);
 
             }
          }
@@ -6019,9 +5655,9 @@ static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB)
  *---------------------------------------------------------------------*/
 static void FPT_hostDataXferRestart(PSCCB currSCCB)
 {
-   ULONG data_count;
-   UINT  sg_index;
-   ULONG *sg_ptr;
+   unsigned long data_count;
+   unsigned int  sg_index;
+   unsigned long *sg_ptr;
 
    if (currSCCB->Sccb_XferState & F_SG_XFER) {
 
@@ -6030,7 +5666,7 @@ static void FPT_hostDataXferRestart(PSCCB currSCCB)
       sg_index = 0xffff;         /*Index by long words into sg list. */
       data_count = 0;            /*Running count of SG xfer counts. */
 
-      sg_ptr = (ULONG *)currSCCB->DataPointer;
+      sg_ptr = (unsigned long *)currSCCB->DataPointer;
 
       while (data_count < currSCCB->Sccb_ATC) {
 
@@ -6048,7 +5684,7 @@ static void FPT_hostDataXferRestart(PSCCB currSCCB)
          currSCCB->Sccb_SGoffset = data_count - currSCCB->Sccb_ATC;
          }
 
-      currSCCB->Sccb_sgseg = (USHORT)sg_index;
+      currSCCB->Sccb_sgseg = (unsigned short)sg_index;
       }
 
    else {
@@ -6066,13 +5702,13 @@ static void FPT_hostDataXferRestart(PSCCB currSCCB)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up)
+static void FPT_scini(unsigned char p_card, unsigned char p_our_id, unsigned char p_power_up)
 {
 
-   UCHAR loser,assigned_id;
-   ULONG p_port;
+   unsigned char loser,assigned_id;
+   unsigned long p_port;
 
-   UCHAR i,k,ScamFlg ;
+   unsigned char i,k,ScamFlg ;
    PSCCBcard currCard;
        PNVRamInfo pCurrNvRam;
 
@@ -6086,8 +5722,8 @@ static void FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up)
                i = pCurrNvRam->niSysConf;
        }
        else{
-          ScamFlg = (UCHAR) FPT_utilEERead(p_port, SCAM_CONFIG/2);
-          i = (UCHAR)(FPT_utilEERead(p_port, (SYSTEM_CONFIG/2)));
+          ScamFlg = (unsigned char) FPT_utilEERead(p_port, SCAM_CONFIG/2);
+          i = (unsigned char)(FPT_utilEERead(p_port, (SYSTEM_CONFIG/2)));
        }
        if(!(i & 0x02)) /* check if reset bus in AutoSCSI parameter set */
                return;
@@ -6205,7 +5841,7 @@ static void FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up)
                      if (FPT_scvalq(k))
                         {
                         currCard->ourId =
-                           ((UCHAR)(i<<3)+(k & (UCHAR)7)) & (UCHAR) 0x3F;
+                           ((unsigned char)(i<<3)+(k & (unsigned char)7)) & (unsigned char) 0x3F;
                         FPT_inisci(p_card, p_port, p_our_id);
                         FPT_scamInfo[currCard->ourId].state = ID_ASSIGNED;
                         FPT_scamInfo[currCard->ourId].id_string[0]
@@ -6262,7 +5898,7 @@ static void FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up)
  *
  *---------------------------------------------------------------------*/
 
-static int FPT_scarb(ULONG p_port, UCHAR p_sel_type)
+static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type)
 {
    if (p_sel_type == INIT_SELTD)
       {
@@ -6323,7 +5959,7 @@ static int FPT_scarb(ULONG p_port, UCHAR p_sel_type)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scbusf(ULONG p_port)
+static void FPT_scbusf(unsigned long p_port)
 {
    WR_HARPOON(p_port+hp_page_ctrl,
       (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE));
@@ -6359,14 +5995,14 @@ static void FPT_scbusf(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scasid(UCHAR p_card, ULONG p_port)
+static void FPT_scasid(unsigned char p_card, unsigned long p_port)
 {
-   UCHAR temp_id_string[ID_STRING_LENGTH];
+   unsigned char temp_id_string[ID_STRING_LENGTH];
 
-   UCHAR i,k,scam_id;
-       UCHAR crcBytes[3];
+   unsigned char i,k,scam_id;
+       unsigned char crcBytes[3];
        PNVRamInfo pCurrNvRam;
-       ushort_ptr pCrcBytes;
+       unsigned short * pCrcBytes;
 
        pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
 
@@ -6377,7 +6013,7 @@ static void FPT_scasid(UCHAR p_card, ULONG p_port)
 
       for (k=0; k < ID_STRING_LENGTH; k++)
          {
-         temp_id_string[k] = (UCHAR) 0x00;
+         temp_id_string[k] = (unsigned char) 0x00;
          }
 
       FPT_scxferc(p_port,SYNC_PTRN);
@@ -6386,14 +6022,14 @@ static void FPT_scasid(UCHAR p_card, ULONG p_port)
       if (!(FPT_sciso(p_port,&temp_id_string[0])))
          {
                        if(pCurrNvRam){
-                               pCrcBytes = (ushort_ptr)&crcBytes[0];
+                               pCrcBytes = (unsigned short *)&crcBytes[0];
                                *pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]);
                                crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]);
                                temp_id_string[1] = crcBytes[2];
                                temp_id_string[2] = crcBytes[0];
                                temp_id_string[3] = crcBytes[1];
                                for(k = 4; k < ID_STRING_LENGTH; k++)
-                                       temp_id_string[k] = (UCHAR) 0x00;
+                                       temp_id_string[k] = (unsigned char) 0x00;
                        }
          i = FPT_scmachid(p_card,temp_id_string);
 
@@ -6411,7 +6047,7 @@ static void FPT_scasid(UCHAR p_card, ULONG p_port)
             else
                FPT_scxferc(p_port,ID_8_F);
 
-            scam_id = (i & (UCHAR) 0x07);
+            scam_id = (i & (unsigned char) 0x07);
 
 
             for (k=1; k < 0x08; k <<= 1)
@@ -6447,7 +6083,7 @@ static void FPT_scasid(UCHAR p_card, ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scsel(ULONG p_port)
+static void FPT_scsel(unsigned long p_port)
 {
 
    WR_HARPOON(p_port+hp_scsisig, SCSI_SEL);
@@ -6457,15 +6093,15 @@ static void FPT_scsel(ULONG p_port)
 
 
    WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-   WR_HARPOON(p_port+hp_scsidata_0, (UCHAR)(RD_HARPOON(p_port+hp_scsidata_0) |
-      (UCHAR)(BIT(7)+BIT(6))));
+   WR_HARPOON(p_port+hp_scsidata_0, (unsigned char)(RD_HARPOON(p_port+hp_scsidata_0) |
+      (unsigned char)(BIT(7)+BIT(6))));
 
 
    WR_HARPOON(p_port+hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD));
    FPT_scwiros(p_port, SCSI_SEL);
 
-   WR_HARPOON(p_port+hp_scsidata_0, (UCHAR)(RD_HARPOON(p_port+hp_scsidata_0) &
-      ~(UCHAR)BIT(6)));
+   WR_HARPOON(p_port+hp_scsidata_0, (unsigned char)(RD_HARPOON(p_port+hp_scsidata_0) &
+      ~(unsigned char)BIT(6)));
    FPT_scwirod(p_port, BIT(6));
 
    WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
@@ -6481,9 +6117,9 @@ static void FPT_scsel(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_scxferc(ULONG p_port, UCHAR p_data)
+static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data)
 {
-   UCHAR curr_data, ret_data;
+   unsigned char curr_data, ret_data;
 
    curr_data = p_data | BIT(7) | BIT(5);   /*Start with DB7 & DB5 asserted. */
 
@@ -6496,7 +6132,7 @@ static UCHAR FPT_scxferc(ULONG p_port, UCHAR p_data)
    FPT_scwirod(p_port,BIT(7));              /*Wait for DB7 to be released. */
        while (!(RD_HARPOON(p_port+hp_scsidata_0) & BIT(5)));
 
-   ret_data = (RD_HARPOON(p_port+hp_scsidata_0) & (UCHAR) 0x1F);
+   ret_data = (RD_HARPOON(p_port+hp_scsidata_0) & (unsigned char) 0x1F);
 
    curr_data |= BIT(6);
 
@@ -6532,9 +6168,9 @@ static UCHAR FPT_scxferc(ULONG p_port, UCHAR p_data)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_scsendi(ULONG p_port, UCHAR p_id_string[])
+static unsigned char FPT_scsendi(unsigned long p_port, unsigned char p_id_string[])
 {
-   UCHAR ret_data,byte_cnt,bit_cnt,defer;
+   unsigned char ret_data,byte_cnt,bit_cnt,defer;
 
    defer = 0;
 
@@ -6585,9 +6221,9 @@ static UCHAR FPT_scsendi(ULONG p_port, UCHAR p_id_string[])
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_sciso(ULONG p_port, UCHAR p_id_string[])
+static unsigned char FPT_sciso(unsigned long p_port, unsigned char p_id_string[])
 {
-   UCHAR ret_data,the_data,byte_cnt,bit_cnt;
+   unsigned char ret_data,the_data,byte_cnt,bit_cnt;
 
    the_data = 0;
 
@@ -6646,9 +6282,9 @@ static UCHAR FPT_sciso(ULONG p_port, UCHAR p_id_string[])
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scwirod(ULONG p_port, UCHAR p_data_bit)
+static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit)
 {
-   UCHAR i;
+   unsigned char i;
 
    i = 0;
    while ( i < MAX_SCSI_TAR ) {
@@ -6675,9 +6311,9 @@ static void FPT_scwirod(ULONG p_port, UCHAR p_data_bit)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scwiros(ULONG p_port, UCHAR p_data_bit)
+static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit)
 {
-   UCHAR i;
+   unsigned char i;
 
    i = 0;
    while ( i < MAX_SCSI_TAR ) {
@@ -6702,9 +6338,9 @@ static void FPT_scwiros(ULONG p_port, UCHAR p_data_bit)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_scvalq(UCHAR p_quintet)
+static unsigned char FPT_scvalq(unsigned char p_quintet)
 {
-   UCHAR count;
+   unsigned char count;
 
    for (count=1; count < 0x08; count<<=1) {
       if (!(p_quintet & count))
@@ -6729,9 +6365,9 @@ static UCHAR FPT_scvalq(UCHAR p_quintet)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_scsell(ULONG p_port, UCHAR targ_id)
+static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id)
 {
-   ULONG i;
+   unsigned long i;
 
    WR_HARPOON(p_port+hp_page_ctrl,
       (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE));
@@ -6808,7 +6444,7 @@ static UCHAR FPT_scsell(ULONG p_port, UCHAR targ_id)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scwtsel(ULONG p_port)
+static void FPT_scwtsel(unsigned long p_port)
 {
    while(!(RDW_HARPOON((p_port+hp_intstat)) & SCAM_SEL)) {}
 }
@@ -6822,10 +6458,10 @@ static void FPT_scwtsel(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id)
+static void FPT_inisci(unsigned char p_card, unsigned long p_port, unsigned char p_our_id)
 {
-   UCHAR i,k,max_id;
-   USHORT ee_data;
+   unsigned char i,k,max_id;
+   unsigned short ee_data;
        PNVRamInfo pCurrNvRam;
 
        pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
@@ -6842,7 +6478,7 @@ static void FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id)
                        for(k = 0; k < 4; k++)
                                FPT_scamInfo[i].id_string[k] = pCurrNvRam->niScamTbl[i][k];
                        for(k = 4; k < ID_STRING_LENGTH; k++)
-                               FPT_scamInfo[i].id_string[k] = (UCHAR) 0x00;
+                               FPT_scamInfo[i].id_string[k] = (unsigned char) 0x00;
 
              if(FPT_scamInfo[i].id_string[0] == 0x00)
           FPT_scamInfo[i].state = ID_UNUSED;  /*Default to unused ID. */
@@ -6855,11 +6491,11 @@ static void FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id)
           {
        for (k=0; k < ID_STRING_LENGTH; k+=2)
                 {
-             ee_data = FPT_utilEERead(p_port, (USHORT)((EE_SCAMBASE/2) +
-            (USHORT) (i*((USHORT)ID_STRING_LENGTH/2)) + (USHORT)(k/2)));
-               FPT_scamInfo[i].id_string[k] = (UCHAR) ee_data;
+             ee_data = FPT_utilEERead(p_port, (unsigned short)((EE_SCAMBASE/2) +
+            (unsigned short) (i*((unsigned short)ID_STRING_LENGTH/2)) + (unsigned short)(k/2)));
+               FPT_scamInfo[i].id_string[k] = (unsigned char) ee_data;
                 ee_data >>= 8;
-             FPT_scamInfo[i].id_string[k+1] = (UCHAR) ee_data;
+             FPT_scamInfo[i].id_string[k+1] = (unsigned char) ee_data;
           }
 
              if ((FPT_scamInfo[i].id_string[0] == 0x00) ||
@@ -6886,10 +6522,10 @@ static void FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[])
+static unsigned char FPT_scmachid(unsigned char p_card, unsigned char p_id_string[])
 {
 
-   UCHAR i,k,match;
+   unsigned char i,k,match;
 
 
    for (i=0; i < MAX_SCSI_TAR; i++) {
@@ -6918,7 +6554,7 @@ static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[])
       i = MAX_SCSI_TAR;
 
    if (((p_id_string[0] & 0x06) == 0x02) || ((p_id_string[0] & 0x06) == 0x04))
-      match = p_id_string[1] & (UCHAR) 0x1F;
+      match = p_id_string[1] & (unsigned char) 0x1F;
    else
       match = 7;
 
@@ -6967,7 +6603,7 @@ static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[])
       i = MAX_SCSI_TAR;
 
    if (((p_id_string[0] & 0x06) == 0x02) || ((p_id_string[0] & 0x06) == 0x04))
-      match = p_id_string[1] & (UCHAR) 0x1F;
+      match = p_id_string[1] & (unsigned char) 0x1F;
    else
       match = 7;
 
@@ -7015,10 +6651,10 @@ static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[])
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_scsavdi(UCHAR p_card, ULONG p_port)
+static void FPT_scsavdi(unsigned char p_card, unsigned long p_port)
 {
-   UCHAR i,k,max_id;
-   USHORT ee_data,sum_data;
+   unsigned char i,k,max_id;
+   unsigned short ee_data,sum_data;
 
 
    sum_data = 0x0000;
@@ -7046,8 +6682,8 @@ static void FPT_scsavdi(UCHAR p_card, ULONG p_port)
          ee_data <<= 8;
          ee_data |= FPT_scamInfo[i].id_string[k];
          sum_data += ee_data;
-         FPT_utilEEWrite(p_port, ee_data, (USHORT)((EE_SCAMBASE/2) +
-            (USHORT)(i*((USHORT)ID_STRING_LENGTH/2)) + (USHORT)(k/2)));
+         FPT_utilEEWrite(p_port, ee_data, (unsigned short)((EE_SCAMBASE/2) +
+            (unsigned short)(i*((unsigned short)ID_STRING_LENGTH/2)) + (unsigned short)(k/2)));
          }
       }
 
@@ -7064,12 +6700,12 @@ static void FPT_scsavdi(UCHAR p_card, ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_XbowInit(ULONG port, UCHAR ScamFlg)
+static void FPT_XbowInit(unsigned long port, unsigned char ScamFlg)
 {
-UCHAR i;
+unsigned char i;
 
        i = RD_HARPOON(port+hp_page_ctrl);
-       WR_HARPOON(port+hp_page_ctrl, (UCHAR) (i | G_INT_DISABLE));
+       WR_HARPOON(port+hp_page_ctrl, (unsigned char) (i | G_INT_DISABLE));
 
    WR_HARPOON(port+hp_scsireset,0x00);
    WR_HARPOON(port+hp_portctrl_1,HOST_MODE8);
@@ -7114,7 +6750,7 @@ UCHAR i;
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_BusMasterInit(ULONG p_port)
+static void FPT_BusMasterInit(unsigned long p_port)
 {
 
 
@@ -7145,9 +6781,9 @@ static void FPT_BusMasterInit(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_DiagEEPROM(ULONG p_port)
+static void FPT_DiagEEPROM(unsigned long p_port)
 {
-   USHORT index,temp,max_wd_cnt;
+   unsigned short index,temp,max_wd_cnt;
 
    if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD)
       max_wd_cnt = EEPROM_WD_CNT;
@@ -7171,7 +6807,7 @@ static void FPT_DiagEEPROM(ULONG p_port)
       }
 
 
-   FPT_utilEEWriteOnOff(p_port,(UCHAR)1);
+   FPT_utilEEWriteOnOff(p_port,(unsigned char)1);
 
    for (index = 0; index < max_wd_cnt; index++) {
 
@@ -7292,7 +6928,7 @@ static void FPT_DiagEEPROM(ULONG p_port)
 
    FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM/2);
 
-   FPT_utilEEWriteOnOff(p_port,(UCHAR)0);
+   FPT_utilEEWriteOnOff(p_port,(unsigned char)0);
 
 }
 
@@ -7305,9 +6941,9 @@ static void FPT_DiagEEPROM(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card)
+static void FPT_queueSearchSelect(PSCCBcard pCurrCard, unsigned char p_card)
 {
-   UCHAR scan_ptr, lun;
+   unsigned char scan_ptr, lun;
    PSCCBMgr_tar_info currTar_Info;
        PSCCB pOldSccb;
 
@@ -7436,14 +7072,14 @@ static void FPT_queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card)
+static void FPT_queueSelectFail(PSCCBcard pCurrCard, unsigned char p_card)
 {
-   UCHAR thisTarg;
+   unsigned char thisTarg;
    PSCCBMgr_tar_info currTar_Info;
 
    if (pCurrCard->currentSCCB != NULL)
          {
-         thisTarg = (UCHAR)(((PSCCB)(pCurrCard->currentSCCB))->TargID);
+         thisTarg = (unsigned char)(((PSCCB)(pCurrCard->currentSCCB))->TargID);
       currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
 
       pCurrCard->currentSCCB->Sccb_backlink = (PSCCB)NULL;
@@ -7476,10 +7112,10 @@ static void FPT_queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card)
  *---------------------------------------------------------------------*/
 
 static void FPT_queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb,
-                                UCHAR p_card)
+                                unsigned char p_card)
 {
 
-   UCHAR i, SCSIcmd;
+   unsigned char i, SCSIcmd;
    CALL_BK_FN callback;
    PSCCBMgr_tar_info currTar_Info;
 
@@ -7577,7 +7213,7 @@ static void FPT_queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb,
  * Description: Add SCCB to our disconnect array.
  *
  *---------------------------------------------------------------------*/
-static void FPT_queueDisconnect(PSCCB p_sccb, UCHAR p_card)
+static void FPT_queueDisconnect(PSCCB p_sccb, unsigned char p_card)
 {
    PSCCBMgr_tar_info currTar_Info;
 
@@ -7612,16 +7248,16 @@ static void FPT_queueDisconnect(PSCCB p_sccb, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static void  FPT_queueFlushSccb(UCHAR p_card, UCHAR error_code)
+static void  FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code)
 {
-   UCHAR qtag,thisTarg;
+   unsigned char qtag,thisTarg;
    PSCCB currSCCB;
    PSCCBMgr_tar_info currTar_Info;
 
    currSCCB = FPT_BL_Card[p_card].currentSCCB;
        if(currSCCB != NULL)
        {
-          thisTarg = (UCHAR)currSCCB->TargID;
+          thisTarg = (unsigned char)currSCCB->TargID;
        currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
 
           for (qtag=0; qtag<QUEUE_DEPTH; qtag++) {
@@ -7630,7 +7266,7 @@ static void  FPT_queueFlushSccb(UCHAR p_card, UCHAR error_code)
                                        (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg))
                         {
 
-                        FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (UCHAR)error_code;
+                        FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (unsigned char)error_code;
                        
                         FPT_queueCmdComplete(&FPT_BL_Card[p_card],FPT_BL_Card[p_card].discQ_Tbl[qtag], p_card);
 
@@ -7651,10 +7287,10 @@ static void  FPT_queueFlushSccb(UCHAR p_card, UCHAR error_code)
  *
  *---------------------------------------------------------------------*/
 
-static void  FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg,
-                                   UCHAR error_code)
+static void  FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
+                                   unsigned char error_code)
 {
-   UCHAR qtag;
+   unsigned char qtag;
    PSCCBMgr_tar_info currTar_Info;
 
    currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
@@ -7665,7 +7301,7 @@ static void  FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg,
                                (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg))
                 {
 
-                FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (UCHAR)error_code;
+                FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (unsigned char)error_code;
 
                 FPT_queueCmdComplete(&FPT_BL_Card[p_card],FPT_BL_Card[p_card].discQ_Tbl[qtag], p_card);
 
@@ -7681,7 +7317,7 @@ static void  FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg,
 
 
 
-static void FPT_queueAddSccb(PSCCB p_SCCB, UCHAR p_card)
+static void FPT_queueAddSccb(PSCCB p_SCCB, unsigned char p_card)
 {
    PSCCBMgr_tar_info currTar_Info;
    currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
@@ -7715,7 +7351,7 @@ static void FPT_queueAddSccb(PSCCB p_SCCB, UCHAR p_card)
  *
  *---------------------------------------------------------------------*/
 
-static UCHAR FPT_queueFindSccb(PSCCB p_SCCB, UCHAR p_card)
+static unsigned char FPT_queueFindSccb(PSCCB p_SCCB, unsigned char p_card)
 {
    PSCCB q_ptr;
    PSCCBMgr_tar_info currTar_Info;
@@ -7778,9 +7414,9 @@ static UCHAR FPT_queueFindSccb(PSCCB p_SCCB, UCHAR p_card)
 
 static void  FPT_utilUpdateResidual(PSCCB p_SCCB)
 {
-   ULONG partial_cnt;
-   UINT  sg_index;
-   ULONG *sg_ptr;
+   unsigned long partial_cnt;
+   unsigned int  sg_index;
+   unsigned long *sg_ptr;
 
    if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) {
 
@@ -7793,7 +7429,7 @@ static void  FPT_utilUpdateResidual(PSCCB p_SCCB)
 
                 sg_index = p_SCCB->Sccb_sgseg;
 
-                sg_ptr = (ULONG *)p_SCCB->DataPointer;
+                sg_ptr = (unsigned long *)p_SCCB->DataPointer;
 
                 if (p_SCCB->Sccb_SGoffset) {
 
@@ -7801,7 +7437,7 @@ static void  FPT_utilUpdateResidual(PSCCB p_SCCB)
                        sg_index++;
                        }
 
-                while ( ((ULONG)sg_index * (ULONG)SG_ELEMENT_SIZE) <
+                while ( ((unsigned long)sg_index * (unsigned long)SG_ELEMENT_SIZE) <
                        p_SCCB->DataLength ) {
 
                        partial_cnt += *(sg_ptr+(sg_index * 2));
@@ -7826,9 +7462,9 @@ static void  FPT_utilUpdateResidual(PSCCB p_SCCB)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_Wait1Second(ULONG p_port)
+static void FPT_Wait1Second(unsigned long p_port)
 {
-   UCHAR i;
+   unsigned char i;
 
    for(i=0; i < 4; i++) {
 
@@ -7851,10 +7487,10 @@ static void FPT_Wait1Second(ULONG p_port)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_Wait(ULONG p_port, UCHAR p_delay)
+static void FPT_Wait(unsigned long p_port, unsigned char p_delay)
 {
-   UCHAR old_timer;
-   UCHAR green_flag;
+   unsigned char old_timer;
+   unsigned char green_flag;
 
    old_timer = RD_HARPOON(p_port+hp_seltimeout);
 
@@ -7899,11 +7535,11 @@ static void FPT_Wait(ULONG p_port, UCHAR p_delay)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_utilEEWriteOnOff(ULONG p_port,UCHAR p_mode)
+static void FPT_utilEEWriteOnOff(unsigned long p_port,unsigned char p_mode)
 {
-   UCHAR ee_value;
+   unsigned char ee_value;
 
-   ee_value = (UCHAR)(RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H));
+   ee_value = (unsigned char)(RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H));
 
    if (p_mode)
 
@@ -7928,13 +7564,13 @@ static void FPT_utilEEWriteOnOff(ULONG p_port,UCHAR p_mode)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr)
+static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, unsigned short ee_addr)
 {
 
-   UCHAR ee_value;
-   USHORT i;
+   unsigned char ee_value;
+   unsigned short i;
 
-   ee_value = (UCHAR)((RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H))|
+   ee_value = (unsigned char)((RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H))|
                   (SEE_MS | SEE_CS));
 
 
@@ -7979,9 +7615,9 @@ static void FPT_utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr)
  *
  *---------------------------------------------------------------------*/
 
-static USHORT FPT_utilEERead(ULONG p_port, USHORT ee_addr)
+static unsigned short FPT_utilEERead(unsigned long p_port, unsigned short ee_addr)
 {
-   USHORT i, ee_data1, ee_data2;
+   unsigned short i, ee_data1, ee_data2;
 
        i = 0;
        ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr);
@@ -8009,13 +7645,13 @@ static USHORT FPT_utilEERead(ULONG p_port, USHORT ee_addr)
  *
  *---------------------------------------------------------------------*/
 
-static USHORT FPT_utilEEReadOrg(ULONG p_port, USHORT ee_addr)
+static unsigned short FPT_utilEEReadOrg(unsigned long p_port, unsigned short ee_addr)
 {
 
-   UCHAR ee_value;
-   USHORT i, ee_data;
+   unsigned char ee_value;
+   unsigned short i, ee_data;
 
-   ee_value = (UCHAR)((RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H))|
+   ee_value = (unsigned char)((RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H))|
                   (SEE_MS | SEE_CS));
 
 
@@ -8057,15 +7693,15 @@ static USHORT FPT_utilEEReadOrg(ULONG p_port, USHORT ee_addr)
  *
  *---------------------------------------------------------------------*/
 
-static void FPT_utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr)
+static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, unsigned short ee_addr)
 {
-   UCHAR ee_value;
-   UCHAR narrow_flg;
+   unsigned char ee_value;
+   unsigned char narrow_flg;
 
-   USHORT i;
+   unsigned short i;
 
 
-   narrow_flg= (UCHAR)(RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD);
+   narrow_flg= (unsigned char)(RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD);
 
 
    ee_value = SEE_MS;
@@ -8120,14 +7756,14 @@ static void FPT_utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr)
          }
 }
 
-static USHORT FPT_CalcCrc16(UCHAR buffer[])
+static unsigned short FPT_CalcCrc16(unsigned char buffer[])
 {
-   USHORT crc=0;
+   unsigned short crc=0;
        int i,j;
-   USHORT ch;
+   unsigned short ch;
    for (i=0; i < ID_STRING_LENGTH; i++)
    {
-      ch = (USHORT) buffer[i];
+      ch = (unsigned short) buffer[i];
           for(j=0; j < 8; j++)
           {
                   if ((crc ^ ch) & 1)
@@ -8140,10 +7776,10 @@ static USHORT FPT_CalcCrc16(UCHAR buffer[])
        return(crc);
 }
 
-static UCHAR FPT_CalcLrc(UCHAR buffer[])
+static unsigned char FPT_CalcLrc(unsigned char buffer[])
 {
        int i;
-       UCHAR lrc;
+       unsigned char lrc;
        lrc = 0;
        for(i = 0; i < ID_STRING_LENGTH; i++)
                lrc ^= buffer[i];