linux/drivers/scsi/initio.h

/**************************************************************************
 * Initio 9100 device driver for Linux.
 *
 * Copyright (c) 1994-1998 Initio Corporation
 * All rights reserved.
 *
 * Cleanups (c) Copyright 2007 Red Hat <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 **************************************************************************/


#include <linux/types.h>

#define TOTAL_SG_ENTRY
#define MAX_SUPPORTED_ADAPTERS
#define MAX_OFFSET
#define MAX_TARGETS

i91u_config;

/***************************************/
/*  Tulip Configuration Register Set */
/***************************************/
#define TUL_PVID
#define TUL_PDID
#define TUL_PCMD
#define TUL_PSTUS
#define TUL_PRID
#define TUL_PPI
#define TUL_PSC
#define TUL_PBC
#define TUL_PCLS
#define TUL_PLTR
#define TUL_PHDT
#define TUL_PBIST
#define TUL_PBAD
#define TUL_PBAD1
#define TUL_PBAD2
#define TUL_PBAD3
#define TUL_PBAD4
#define TUL_PBAD5
#define TUL_PRSVD
#define TUL_PRSVD1
#define TUL_PRAD
#define TUL_PRSVD2
#define TUL_PRSVD3
#define TUL_PINTL
#define TUL_PINTP
#define TUL_PIGNT
#define TUL_PMGNT

/************************/
/*  Jasmin Register Set */
/************************/
#define TUL_HACFG0
#define TUL_HACFG1
#define TUL_HACFG2

#define TUL_SDCFG0
#define TUL_SDCFG1
#define TUL_SDCFG2
#define TUL_SDCFG3

#define TUL_GINTS
#define TUL_GIMSK
#define TUL_GCTRL
#define TUL_GCTRL_EEPROM_BIT
#define TUL_GCTRL1
#define TUL_DMACFG
#define TUL_NVRAM

#define TUL_SCnt0
#define TUL_SCnt1
#define TUL_SCnt2
#define TUL_SFifoCnt
#define TUL_SIntEnable
#define TUL_SInt
#define TUL_SCtrl0
#define TUL_SStatus0
#define TUL_SCtrl1
#define TUL_SStatus1
#define TUL_SConfig
#define TUL_SStatus2
#define TUL_SPeriod
#define TUL_SOffset
#define TUL_SScsiId
#define TUL_SBusId
#define TUL_STimeOut
#define TUL_SIdent
#define TUL_SAvail
#define TUL_SData
#define TUL_SFifo
#define TUL_SSignal
#define TUL_SCmd
#define TUL_STest0
#define TUL_STest1
#define TUL_SCFG1

#define TUL_XAddH
#define TUL_XAddW
#define TUL_XCntH
#define TUL_XCntW
#define TUL_XCmd
#define TUL_Int
#define TUL_XStatus
#define TUL_Mask
#define TUL_XCtrl
#define TUL_XCtrl1
#define TUL_XFifo

#define TUL_WCtrl
#define TUL_DCtrl

/*----------------------------------------------------------------------*/
/*   bit definition for Command register of Configuration Space Header  */
/*----------------------------------------------------------------------*/
#define BUSMS
#define IOSPA

/*----------------------------------------------------------------------*/
/* Command Codes of Tulip SCSI Command register                         */
/*----------------------------------------------------------------------*/
#define TSC_EN_RESEL
#define TSC_CMD_COMP
#define TSC_SEL
#define TSC_SEL_ATN
#define TSC_SEL_ATN_DMA
#define TSC_SEL_ATN3
#define TSC_SEL_ATNSTOP
#define TSC_SELATNSTOP

#define TSC_SEL_ATN_DIRECT_IN
#define TSC_SEL_ATN_DIRECT_OUT
#define TSC_SEL_ATN3_DIRECT_IN
#define TSC_SEL_ATN3_DIRECT_OUT
#define TSC_XF_DMA_OUT_DIRECT
#define TSC_XF_DMA_IN_DIRECT

#define TSC_XF_DMA_OUT
#define TSC_XF_DMA_IN
#define TSC_XF_FIFO_OUT
#define TSC_XF_FIFO_IN

#define TSC_MSG_ACCEPT

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Control 0 Register                     */
/*----------------------------------------------------------------------*/
#define TSC_RST_SEQ
#define TSC_FLUSH_FIFO
#define TSC_ABT_CMD
#define TSC_RST_CHIP
#define TSC_RST_BUS

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Control 1 Register                     */
/*----------------------------------------------------------------------*/
#define TSC_EN_SCAM
#define TSC_TIMER
#define TSC_EN_SCSI2
#define TSC_PWDN
#define TSC_WIDE_CPU
#define TSC_HW_RESELECT
#define TSC_EN_BUS_OUT
#define TSC_EN_BUS_IN

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Configuration Register                 */
/*----------------------------------------------------------------------*/
#define TSC_EN_LATCH
#define TSC_INITIATOR
#define TSC_EN_SCSI_PAR
#define TSC_DMA_8BIT
#define TSC_DMA_16BIT
#define TSC_EN_WDACK
#define TSC_ALT_PERIOD
#define TSC_DIS_SCSIRST

#define TSC_INITDEFAULT

#define TSC_WIDE_SCSI

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI signal Register                        */
/*----------------------------------------------------------------------*/
#define TSC_RST_ACK
#define TSC_RST_ATN
#define TSC_RST_BSY

#define TSC_SET_ACK
#define TSC_SET_ATN

#define TSC_REQI
#define TSC_ACKI
#define TSC_BSYI
#define TSC_SELI
#define TSC_ATNI
#define TSC_MSGI
#define TSC_CDI
#define TSC_IOI


/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Status 0 Register                      */
/*----------------------------------------------------------------------*/
#define TSS_INT_PENDING
#define TSS_SEQ_ACTIVE
#define TSS_XFER_CNT
#define TSS_FIFO_EMPTY
#define TSS_PAR_ERROR
#define TSS_PH_MASK

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Status 1 Register                      */
/*----------------------------------------------------------------------*/
#define TSS_STATUS_RCV
#define TSS_MSG_SEND
#define TSS_CMD_PH_CMP
#define TSS_DATA_PH_CMP
#define TSS_STATUS_SEND
#define TSS_XFER_CMP
#define TSS_SEL_CMP
#define TSS_ARB_CMP

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Status 2 Register                      */
/*----------------------------------------------------------------------*/
#define TSS_CMD_ABTED
#define TSS_OFFSET_0
#define TSS_FIFO_FULL
#define TSS_TIMEOUT_0
#define TSS_BUSY_RLS
#define TSS_PH_MISMATCH
#define TSS_SCSI_BUS_EN
#define TSS_SCSIRST

/*----------------------------------------------------------------------*/
/* bit definition for Tulip SCSI Interrupt Register                     */
/*----------------------------------------------------------------------*/
#define TSS_RESEL_INT
#define TSS_SEL_TIMEOUT
#define TSS_BUS_SERV
#define TSS_SCSIRST_INT
#define TSS_DISC_INT
#define TSS_SEL_INT
#define TSS_SCAM_SEL
#define TSS_FUNC_COMP

/*----------------------------------------------------------------------*/
/* SCSI Phase Codes.                                                    */
/*----------------------------------------------------------------------*/
#define DATA_OUT
#define DATA_IN
#define CMD_OUT
#define STATUS_IN
#define MSG_OUT
#define MSG_IN



/*----------------------------------------------------------------------*/
/* Command Codes of Tulip xfer Command register                         */
/*----------------------------------------------------------------------*/
#define TAX_X_FORC
#define TAX_X_ABT
#define TAX_X_CLR_FIFO

#define TAX_X_IN
#define TAX_X_OUT
#define TAX_SG_IN
#define TAX_SG_OUT

/*----------------------------------------------------------------------*/
/* Tulip Interrupt Register                                             */
/*----------------------------------------------------------------------*/
#define XCMP
#define FCMP
#define XABT
#define XERR
#define SCMP
#define IPEND

/*----------------------------------------------------------------------*/
/* Tulip DMA Status Register                                            */
/*----------------------------------------------------------------------*/
#define XPEND
#define FEMPTY



/*----------------------------------------------------------------------*/
/* bit definition for TUL_GCTRL                                         */
/*----------------------------------------------------------------------*/
#define EXTSG
#define EXTAD
#define SEG4K
#define EEPRG
#define MRMUL

/*----------------------------------------------------------------------*/
/* bit definition for TUL_NVRAM                                         */
/*----------------------------------------------------------------------*/
#define SE2CS
#define SE2CLK
#define SE2DO
#define SE2DI


/************************************************************************/
/*              Scatter-Gather Element Structure                        */
/************************************************************************/
struct sg_entry {};

/***********************************************************************
		SCSI Control Block
************************************************************************/
struct scsi_ctrl_blk {};

/* Bit Definition for status */
#define SCB_RENT
#define SCB_PEND
#define SCB_CONTIG
#define SCB_SELECT
#define SCB_BUSY
#define SCB_DONE


/* Opcodes for opcode */
#define ExecSCSI
#define BusDevRst
#define AbortCmd


/* Bit Definition for mode */
#define SCM_RSENS


/* Bit Definition for flags */
#define SCF_DONE
#define SCF_POST
#define SCF_SENSE
#define SCF_DIR
#define SCF_NO_DCHK
#define SCF_DIN
#define SCF_DOUT
#define SCF_NO_XF
#define SCF_WR_VF
#define SCF_POLL
#define SCF_SG

/* Error Codes for SCB_HaStat */
#define HOST_SEL_TOUT
#define HOST_DO_DU
#define HOST_BUS_FREE
#define HOST_BAD_PHAS
#define HOST_INV_CMD
#define HOST_ABORTED
#define HOST_SCSI_RST
#define HOST_DEV_RST

/* Error Codes for SCB_TaStat */
#define TARGET_CHKCOND
#define TARGET_BUSY
#define INI_QUEUE_FULL

/***********************************************************************
		Target Device Control Structure
**********************************************************************/

struct target_control {};

/***********************************************************************
		Target Device Control Structure
**********************************************************************/

/* Bit Definition for TCF_Flags */
#define TCF_SCSI_RATE
#define TCF_EN_DISC
#define TCF_NO_SYNC_NEGO
#define TCF_NO_WDTR
#define TCF_EN_255
#define TCF_EN_START
#define TCF_WDTR_DONE
#define TCF_SYNC_DONE
#define TCF_BUSY


/* Bit Definition for TCF_DrvFlags */
#define TCF_DRV_BUSY
#define TCF_DRV_EN_TAG
#define TCF_DRV_255_63

/***********************************************************************
	      Host Adapter Control Structure
************************************************************************/
struct initio_host {};

/* Bit Definition for HCB_Config */
#define HCC_SCSI_RESET
#define HCC_EN_PAR
#define HCC_ACT_TERM1
#define HCC_ACT_TERM2
#define HCC_AUTO_TERM
#define HCC_EN_PWR

/* Bit Definition for HCB_Flags */
#define HCF_EXPECT_DISC
#define HCF_EXPECT_SELECT
#define HCF_EXPECT_RESET
#define HCF_EXPECT_DONE_DISC

/******************************************************************
	Serial EEProm
*******************************************************************/

NVRAM_SCSI;

PNVRAM;

/* Bios Configuration for nvram->BIOSConfig1                            */
#define NBC1_ENABLE
#define NBC1_8DRIVE
#define NBC1_REMOVABLE
#define NBC1_INT19
#define NBC1_BIOSSCAN
#define NBC1_LUNSUPPORT

/* HA Configuration Byte 1                                              */
#define NHC1_BOOTIDMASK
#define NHC1_LUNMASK
#define NHC1_CHANMASK

/* Bit definition for nvram->SCSIconfig1                                */
#define NCC1_BUSRESET
#define NCC1_PARITYCHK
#define NCC1_ACTTERM1
#define NCC1_ACTTERM2
#define NCC1_AUTOTERM
#define NCC1_PWRMGR

/* Bit definition for SCSI Target configuration byte                    */
#define NTC_DISCONNECT
#define NTC_SYNC
#define NTC_NO_WDTR
#define NTC_1GIGA
#define NTC_SPINUP

/*      Default NVRam values                                            */
#define INI_SIGNATURE
#define NBC1_DEFAULT
#define NCC1_DEFAULT
#define NTC_DEFAULT

/* SCSI related definition                                              */
#define DISC_NOT_ALLOW
#define DISC_ALLOW
#define SCSICMD_RequestSense

#define SCSI_ABORT_SNOOZE
#define SCSI_ABORT_SUCCESS
#define SCSI_ABORT_PENDING
#define SCSI_ABORT_BUSY
#define SCSI_ABORT_NOT_RUNNING
#define SCSI_ABORT_ERROR

#define SCSI_RESET_SNOOZE
#define SCSI_RESET_PUNT
#define SCSI_RESET_SUCCESS
#define SCSI_RESET_PENDING
#define SCSI_RESET_WAKEUP
#define SCSI_RESET_NOT_RUNNING
#define SCSI_RESET_ERROR

#define SCSI_RESET_SYNCHRONOUS
#define SCSI_RESET_ASYNCHRONOUS
#define SCSI_RESET_SUGGEST_BUS_RESET
#define SCSI_RESET_SUGGEST_HOST_RESET

#define SCSI_RESET_BUS_RESET
#define SCSI_RESET_HOST_RESET
#define SCSI_RESET_ACTION

struct initio_cmd_priv {};

static inline struct initio_cmd_priv *initio_priv(struct scsi_cmnd *cmd)
{}