linux/drivers/scsi/ips.h

/*****************************************************************************/
/* ips.h -- driver for the Adaptec / IBM ServeRAID controller                */
/*                                                                           */
/* Written By: Keith Mitchell, IBM Corporation                               */
/*             Jack Hammer, Adaptec, Inc.                                    */
/*             David Jeffery, Adaptec, Inc.                                  */
/*                                                                           */
/* Copyright (C) 1999 IBM Corporation                                        */
/* Copyright (C) 2003 Adaptec, Inc.                                          */
/*                                                                           */
/* 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 of the License, 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.                              */
/*                                                                           */
/* NO WARRANTY                                                               */
/* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR        */
/* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT      */
/* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,      */
/* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is    */
/* solely responsible for determining the appropriateness of using and       */
/* distributing the Program and assumes all risks associated with its        */
/* exercise of rights under this Agreement, including but not limited to     */
/* the risks and costs of program errors, damage to or loss of data,         */
/* programs or equipment, and unavailability or interruption of operations.  */
/*                                                                           */
/* DISCLAIMER OF LIABILITY                                                   */
/* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY   */
/* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL        */
/* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED  */
/* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES             */
/*                                                                           */
/* You should have received a copy of the GNU General Public License         */
/* along with this program; if not, write to the Free Software               */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
/*                                                                           */
/* Bugs/Comments/Suggestions should be mailed to:                            */
/*      [email protected]                                                 */
/*                                                                           */
/*****************************************************************************/

#ifndef _IPS_H_
   #define _IPS_H_

#include <linux/nmi.h>
#include <linux/uaccess.h>
   #include <asm/io.h>

   /*
    * Some handy macros
    */
   #define IPS_HA(x)
   #define IPS_COMMAND_ID(ha, scb)
   #define IPS_IS_TROMBONE(ha)
   #define IPS_IS_CLARINET(ha)
   #define IPS_IS_MORPHEUS(ha)
   #define IPS_IS_MARCO(ha)
   #define IPS_USE_I2O_DELIVER(ha)
   #define IPS_USE_MEMIO(ha)

    #define IPS_HAS_ENH_SGLIST(ha)
    #define IPS_USE_ENH_SGLIST(ha)
    #define IPS_SGLIST_SIZE(ha)

  #define IPS_PRINTK(level, pcidev, format, arg...)

   #define MDELAY(n)

   #ifndef min
      #define min
   #endif

   #ifndef __iomem       /* For clean compiles in earlier kernels without __iomem annotations */
      #define __iomem
   #endif

   /*
    * Adapter address map equates
    */
   #define IPS_REG_HISR
   #define IPS_REG_CCSAR
   #define IPS_REG_CCCR
   #define IPS_REG_SQHR
   #define IPS_REG_SQTR
   #define IPS_REG_SQER
   #define IPS_REG_SQSR
   #define IPS_REG_SCPR
   #define IPS_REG_ISPR
   #define IPS_REG_CBSP
   #define IPS_REG_FLAP
   #define IPS_REG_FLDP
   #define IPS_REG_NDAE
   #define IPS_REG_I2O_INMSGQ
   #define IPS_REG_I2O_OUTMSGQ
   #define IPS_REG_I2O_HIR
   #define IPS_REG_I960_IDR
   #define IPS_REG_I960_MSG0
   #define IPS_REG_I960_MSG1
   #define IPS_REG_I960_OIMR

   /*
    * Adapter register bit equates
    */
   #define IPS_BIT_GHI
   #define IPS_BIT_SQO
   #define IPS_BIT_SCE
   #define IPS_BIT_SEM
   #define IPS_BIT_ILE
   #define IPS_BIT_START_CMD
   #define IPS_BIT_START_STOP
   #define IPS_BIT_RST
   #define IPS_BIT_EBM
   #define IPS_BIT_EI
   #define IPS_BIT_OP
   #define IPS_BIT_I2O_OPQI
   #define IPS_BIT_I960_MSG0I
   #define IPS_BIT_I960_MSG1I

   /*
    * Adapter Command ID Equates
    */
   #define IPS_CMD_GET_LD_INFO
   #define IPS_CMD_GET_SUBSYS
   #define IPS_CMD_READ_CONF
   #define IPS_CMD_RW_NVRAM_PAGE
   #define IPS_CMD_READ
   #define IPS_CMD_WRITE
   #define IPS_CMD_FFDC
   #define IPS_CMD_ENQUIRY
   #define IPS_CMD_FLUSH
   #define IPS_CMD_READ_SG
   #define IPS_CMD_WRITE_SG
   #define IPS_CMD_DCDB
   #define IPS_CMD_DCDB_SG
   #define IPS_CMD_EXTENDED_DCDB
   #define IPS_CMD_EXTENDED_DCDB_SG
   #define IPS_CMD_CONFIG_SYNC
   #define IPS_CMD_ERROR_TABLE
   #define IPS_CMD_DOWNLOAD
   #define IPS_CMD_RW_BIOSFW
   #define IPS_CMD_GET_VERSION_INFO
   #define IPS_CMD_RESET_CHANNEL

   /*
    * Adapter Equates
    */
   #define IPS_CSL
   #define IPS_POCL
   #define IPS_NORM_STATE
   #define IPS_MAX_ADAPTER_TYPES
   #define IPS_MAX_ADAPTERS
   #define IPS_MAX_IOCTL
   #define IPS_MAX_IOCTL_QUEUE
   #define IPS_MAX_QUEUE
   #define IPS_BLKSIZE
   #define IPS_MAX_SG
   #define IPS_MAX_LD
   #define IPS_MAX_CHANNELS
   #define IPS_MAX_TARGETS
   #define IPS_MAX_CHUNKS
   #define IPS_MAX_CMDS
   #define IPS_MAX_XFER
   #define IPS_NVRAM_P5_SIG
   #define IPS_MAX_POST_BYTES
   #define IPS_MAX_CONFIG_BYTES
   #define IPS_GOOD_POST_STATUS
   #define IPS_SEM_TIMEOUT
   #define IPS_IOCTL_COMMAND
   #define IPS_INTR_ON
   #define IPS_INTR_IORL
   #define IPS_FFDC
   #define IPS_ADAPTER_ID
   #define IPS_VENDORID_IBM
   #define IPS_VENDORID_ADAPTEC
   #define IPS_DEVICEID_COPPERHEAD
   #define IPS_DEVICEID_MORPHEUS
   #define IPS_DEVICEID_MARCO
   #define IPS_SUBDEVICEID_4M
   #define IPS_SUBDEVICEID_4L
   #define IPS_SUBDEVICEID_4MX
   #define IPS_SUBDEVICEID_4LX
   #define IPS_SUBDEVICEID_5I2
   #define IPS_SUBDEVICEID_5I1
   #define IPS_SUBDEVICEID_6M
   #define IPS_SUBDEVICEID_6I
   #define IPS_SUBDEVICEID_7k
   #define IPS_SUBDEVICEID_7M
   #define IPS_IOCTL_SIZE
   #define IPS_STATUS_SIZE
   #define IPS_STATUS_Q_SIZE
   #define IPS_IMAGE_SIZE
   #define IPS_MEMMAP_SIZE
   #define IPS_ONE_MSEC
   #define IPS_ONE_SEC

   /*
    * Geometry Settings
    */
   #define IPS_COMP_HEADS
   #define IPS_COMP_SECTORS
   #define IPS_NORM_HEADS
   #define IPS_NORM_SECTORS

   /*
    * Adapter Basic Status Codes
    */
   #define IPS_BASIC_STATUS_MASK
   #define IPS_GSC_STATUS_MASK
   #define IPS_CMD_SUCCESS
   #define IPS_CMD_RECOVERED_ERROR
   #define IPS_INVAL_OPCO
   #define IPS_INVAL_CMD_BLK
   #define IPS_INVAL_PARM_BLK
   #define IPS_BUSY
   #define IPS_CMD_CMPLT_WERROR
   #define IPS_LD_ERROR
   #define IPS_CMD_TIMEOUT
   #define IPS_PHYS_DRV_ERROR

   /*
    * Adapter Extended Status Equates
    */
   #define IPS_ERR_SEL_TO
   #define IPS_ERR_OU_RUN
   #define IPS_ERR_HOST_RESET
   #define IPS_ERR_DEV_RESET
   #define IPS_ERR_RECOVERY
   #define IPS_ERR_CKCOND

   /*
    * Operating System Defines
    */
   #define IPS_OS_WINDOWS_NT
   #define IPS_OS_NETWARE
   #define IPS_OS_OPENSERVER
   #define IPS_OS_UNIXWARE
   #define IPS_OS_SOLARIS
   #define IPS_OS_OS2
   #define IPS_OS_LINUX
   #define IPS_OS_FREEBSD

   /*
    * Adapter Revision ID's
    */
   #define IPS_REVID_SERVERAID
   #define IPS_REVID_NAVAJO
   #define IPS_REVID_SERVERAID2
   #define IPS_REVID_CLARINETP1
   #define IPS_REVID_CLARINETP2
   #define IPS_REVID_CLARINETP3
   #define IPS_REVID_TROMBONE32
   #define IPS_REVID_TROMBONE64

   /*
    * NVRAM Page 5 Adapter Defines
    */
   #define IPS_ADTYPE_SERVERAID
   #define IPS_ADTYPE_SERVERAID2
   #define IPS_ADTYPE_NAVAJO
   #define IPS_ADTYPE_KIOWA
   #define IPS_ADTYPE_SERVERAID3
   #define IPS_ADTYPE_SERVERAID3L
   #define IPS_ADTYPE_SERVERAID4H
   #define IPS_ADTYPE_SERVERAID4M
   #define IPS_ADTYPE_SERVERAID4L
   #define IPS_ADTYPE_SERVERAID4MX
   #define IPS_ADTYPE_SERVERAID4LX
   #define IPS_ADTYPE_SERVERAID5I2
   #define IPS_ADTYPE_SERVERAID5I1
   #define IPS_ADTYPE_SERVERAID6M
   #define IPS_ADTYPE_SERVERAID6I
   #define IPS_ADTYPE_SERVERAID7t
   #define IPS_ADTYPE_SERVERAID7k
   #define IPS_ADTYPE_SERVERAID7M

   /*
    * Adapter Command/Status Packet Definitions
    */
   #define IPS_SUCCESS
   #define IPS_SUCCESS_IMM
   #define IPS_FAILURE

   /*
    * Logical Drive Equates
    */
   #define IPS_LD_OFFLINE
   #define IPS_LD_OKAY
   #define IPS_LD_FREE
   #define IPS_LD_SYS
   #define IPS_LD_CRS

   /*
    * DCDB Table Equates
    */
   #define IPS_NO_DISCONNECT
   #define IPS_DISCONNECT_ALLOWED
   #define IPS_NO_AUTO_REQSEN
   #define IPS_DATA_NONE
   #define IPS_DATA_UNK
   #define IPS_DATA_IN
   #define IPS_DATA_OUT
   #define IPS_TRANSFER64K
   #define IPS_NOTIMEOUT
   #define IPS_TIMEOUT10
   #define IPS_TIMEOUT60
   #define IPS_TIMEOUT20M

   /*
    * SCSI Inquiry Data Flags
    */
   #define IPS_SCSI_INQ_TYPE_DASD
   #define IPS_SCSI_INQ_TYPE_PROCESSOR
   #define IPS_SCSI_INQ_LU_CONNECTED
   #define IPS_SCSI_INQ_RD_REV2
   #define IPS_SCSI_INQ_REV2
   #define IPS_SCSI_INQ_REV3
   #define IPS_SCSI_INQ_Address16
   #define IPS_SCSI_INQ_Address32
   #define IPS_SCSI_INQ_MedChanger
   #define IPS_SCSI_INQ_MultiPort
   #define IPS_SCSI_INQ_EncServ
   #define IPS_SCSI_INQ_SoftReset
   #define IPS_SCSI_INQ_CmdQue
   #define IPS_SCSI_INQ_Linked
   #define IPS_SCSI_INQ_Sync
   #define IPS_SCSI_INQ_WBus16
   #define IPS_SCSI_INQ_WBus32
   #define IPS_SCSI_INQ_RelAdr

   /*
    * SCSI Request Sense Data Flags
    */
   #define IPS_SCSI_REQSEN_VALID
   #define IPS_SCSI_REQSEN_CURRENT_ERR
   #define IPS_SCSI_REQSEN_NO_SENSE

   /*
    * SCSI Mode Page Equates
    */
   #define IPS_SCSI_MP3_SoftSector
   #define IPS_SCSI_MP3_HardSector
   #define IPS_SCSI_MP3_Removeable
   #define IPS_SCSI_MP3_AllocateSurface

   /*
    * HA Flags
    */

   #define IPS_HA_ENH_SG

   /*
    * SCB Flags
    */
   #define IPS_SCB_MAP_SG
   #define IPS_SCB_MAP_SINGLE

   /*
    * Passthru stuff
    */
   #define IPS_COPPUSRCMD
   #define IPS_COPPIOCCMD
   #define IPS_NUMCTRLS
   #define IPS_CTRLINFO

   /* flashing defines */
   #define IPS_FW_IMAGE
   #define IPS_BIOS_IMAGE
   #define IPS_WRITE_FW
   #define IPS_WRITE_BIOS
   #define IPS_ERASE_BIOS
   #define IPS_BIOS_HEADER

   /* time oriented stuff */
   #define IPS_SECS_8HOURS

   /*
    * Scsi_Host Template
    */
   static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
		sector_t capacity, int geom[]);
   static int ips_slave_configure(struct scsi_device *SDptr);

/*
 * Raid Command Formats
 */
PIPS_IO_CMD;

PIPS_LD_CMD;

PIPS_IOCTL_CMD;

PIPS_RESET_CMD;

PIPS_DCDB_CMD;

PIPS_CS_CMD;

PIPS_US_CMD;

PIPS_FC_CMD;

PIPS_STATUS_CMD;

PIPS_NVRAM_CMD;

PIPS_VERSION_INFO;

PIPS_FFDC_CMD;

PIPS_FLASHFW_CMD;

PIPS_FLASHBIOS_CMD;

PIPS_HOST_COMMAND;

PIPS_DRIVE_INFO;

PIPS_LD_INFO;

PIPS_DCDB_TABLE;

PIPS_DCDB_TABLE_TAPE;

PIPS_STATUS;

PIPS_ADAPTER;

PIPS_ENQ;

PIPS_DEVSTATE;

PIPS_CHUNK;

PIPS_LD;

PIPS_HARDWARE;

PIPS_CONF;

PIPS_NVRAM_P5;

/*--------------------------------------------------------------------------*/
/* Data returned from a GetVersion Command                                  */
/*--------------------------------------------------------------------------*/

                                             /* SubSystem Parameter[4]      */
#define IPS_GET_VERSION_SUPPORT

IPS_VERSION_DATA;


PIPS_SUBSYS;

/**
 ** SCSI Structures
 **/

/*
 * Inquiry Data Format
 */
PIPS_SCSI_INQ_DATA;

/*
 * Read Capacity Data Format
 */
IPS_SCSI_CAPACITY;

/*
 * Request Sense Data Format
 */
IPS_SCSI_REQSEN;

/*
 * Sense Data Format - Page 3
 */
IPS_SCSI_MODE_PAGE3;

/*
 * Sense Data Format - Page 4
 */
IPS_SCSI_MODE_PAGE4;

/*
 * Sense Data Format - Page 8
 */
IPS_SCSI_MODE_PAGE8;

/*
 * Sense Data Format - Block Descriptor (DASD)
 */
IPS_SCSI_MODE_PAGE_BLKDESC;

/*
 * Sense Data Format - Mode Page Header
 */
IPS_SCSI_MODE_PAGE_HEADER;

IPS_SCSI_MODE_PAGE_DATA;

/*
 * Scatter Gather list format
 */
IPS_STD_SG_LIST;

IPS_ENH_SG_LIST;

IPS_SG_LIST;

IPS_OPTION;

/*
 * Status Info
 */
ips_stat_t;

/*
 * SCB Queue Format
 */
ips_scb_queue_t;

/*
 * Wait queue_format
 */
ips_wait_queue_entry_t;

ips_copp_wait_item_t;

ips_copp_queue_t;

/* forward decl for host structure */
struct ips_ha;

ips_hw_func_t;

ips_ha_t;

ips_scb_callback;

/*
 * SCB Format
 */
ips_scb_t;

ips_scb_pt_t;

/*
 * Passthru Command Format
 */
ips_passthru_t;

#endif

/* The Version Information below gets created by SED during the build process. */
/* Do not modify the next line; it's what SED is looking for to do the insert. */
/* Version Info                                                                */
/*************************************************************************
*
* VERSION.H -- version numbers and copyright notices in various formats
*
*************************************************************************/

#define IPS_VER_MAJOR
#define IPS_VER_MAJOR_STRING
#define IPS_VER_MINOR
#define IPS_VER_MINOR_STRING
#define IPS_VER_BUILD
#define IPS_VER_BUILD_STRING
#define IPS_VER_STRING
#define IPS_RELEASE_ID
#define IPS_BUILD_IDENT
#define IPS_LEGALCOPYRIGHT_STRING
#define IPS_ADAPTECCOPYRIGHT_STRING
#define IPS_DELLCOPYRIGHT_STRING
#define IPS_NT_LEGALCOPYRIGHT_STRING

/* Version numbers for various adapters */
#define IPS_VER_SERVERAID1
#define IPS_VER_SERVERAID2
#define IPS_VER_NAVAJO
#define IPS_VER_SERVERAID3
#define IPS_VER_SERVERAID4H
#define IPS_VER_SERVERAID4MLx
#define IPS_VER_SARASOTA
#define IPS_VER_MARCO
#define IPS_VER_SEBRING
#define IPS_VER_KEYWEST

/* Compatibility IDs for various adapters */
#define IPS_COMPAT_UNKNOWN
#define IPS_COMPAT_CURRENT
#define IPS_COMPAT_SERVERAID1
#define IPS_COMPAT_SERVERAID2
#define IPS_COMPAT_NAVAJO
#define IPS_COMPAT_KIOWA
#define IPS_COMPAT_SERVERAID3H
#define IPS_COMPAT_SERVERAID3L
#define IPS_COMPAT_SERVERAID4H
#define IPS_COMPAT_SERVERAID4M
#define IPS_COMPAT_SERVERAID4L
#define IPS_COMPAT_SERVERAID4Mx
#define IPS_COMPAT_SERVERAID4Lx
#define IPS_COMPAT_SARASOTA
#define IPS_COMPAT_MARCO
#define IPS_COMPAT_SEBRING
#define IPS_COMPAT_TAMPA
#define IPS_COMPAT_KEYWEST
#define IPS_COMPAT_BIOS

#define IPS_COMPAT_MAX_ADAPTER_TYPE
#define IPS_COMPAT_ID_LENGTH

#define IPS_DEFINE_COMPAT_TABLE(tablename)