xref: /linux/drivers/scsi/ips.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
11da177e4SLinus Torvalds /*****************************************************************************/
21da177e4SLinus Torvalds /* ips.h -- driver for the Adaptec / IBM ServeRAID controller                */
31da177e4SLinus Torvalds /*                                                                           */
41da177e4SLinus Torvalds /* Written By: Keith Mitchell, IBM Corporation                               */
51da177e4SLinus Torvalds /*             Jack Hammer, Adaptec, Inc.                                    */
61da177e4SLinus Torvalds /*             David Jeffery, Adaptec, Inc.                                  */
71da177e4SLinus Torvalds /*                                                                           */
81da177e4SLinus Torvalds /* Copyright (C) 1999 IBM Corporation                                        */
91da177e4SLinus Torvalds /* Copyright (C) 2003 Adaptec, Inc.                                          */
101da177e4SLinus Torvalds /*                                                                           */
111da177e4SLinus Torvalds /* This program is free software; you can redistribute it and/or modify      */
121da177e4SLinus Torvalds /* it under the terms of the GNU General Public License as published by      */
131da177e4SLinus Torvalds /* the Free Software Foundation; either version 2 of the License, or         */
141da177e4SLinus Torvalds /* (at your option) any later version.                                       */
151da177e4SLinus Torvalds /*                                                                           */
161da177e4SLinus Torvalds /* This program is distributed in the hope that it will be useful,           */
171da177e4SLinus Torvalds /* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
181da177e4SLinus Torvalds /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
191da177e4SLinus Torvalds /* GNU General Public License for more details.                              */
201da177e4SLinus Torvalds /*                                                                           */
211da177e4SLinus Torvalds /* NO WARRANTY                                                               */
221da177e4SLinus Torvalds /* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR        */
231da177e4SLinus Torvalds /* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT      */
241da177e4SLinus Torvalds /* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,      */
251da177e4SLinus Torvalds /* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is    */
261da177e4SLinus Torvalds /* solely responsible for determining the appropriateness of using and       */
271da177e4SLinus Torvalds /* distributing the Program and assumes all risks associated with its        */
281da177e4SLinus Torvalds /* exercise of rights under this Agreement, including but not limited to     */
291da177e4SLinus Torvalds /* the risks and costs of program errors, damage to or loss of data,         */
301da177e4SLinus Torvalds /* programs or equipment, and unavailability or interruption of operations.  */
311da177e4SLinus Torvalds /*                                                                           */
321da177e4SLinus Torvalds /* DISCLAIMER OF LIABILITY                                                   */
331da177e4SLinus Torvalds /* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY   */
341da177e4SLinus Torvalds /* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL        */
351da177e4SLinus Torvalds /* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND   */
361da177e4SLinus Torvalds /* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     */
371da177e4SLinus Torvalds /* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE    */
381da177e4SLinus Torvalds /* USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED  */
391da177e4SLinus Torvalds /* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES             */
401da177e4SLinus Torvalds /*                                                                           */
411da177e4SLinus Torvalds /* You should have received a copy of the GNU General Public License         */
421da177e4SLinus Torvalds /* along with this program; if not, write to the Free Software               */
431da177e4SLinus Torvalds /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
441da177e4SLinus Torvalds /*                                                                           */
451da177e4SLinus Torvalds /* Bugs/Comments/Suggestions should be mailed to:                            */
461da177e4SLinus Torvalds /*      ipslinux@adaptec.com                                                 */
471da177e4SLinus Torvalds /*                                                                           */
481da177e4SLinus Torvalds /*****************************************************************************/
491da177e4SLinus Torvalds 
501da177e4SLinus Torvalds #ifndef _IPS_H_
511da177e4SLinus Torvalds    #define _IPS_H_
521da177e4SLinus Torvalds 
53297295aeSAndrew Morton #include <linux/nmi.h>
547c0f6ba6SLinus Torvalds #include <linux/uaccess.h>
551da177e4SLinus Torvalds    #include <asm/io.h>
561da177e4SLinus Torvalds 
571da177e4SLinus Torvalds    /*
581da177e4SLinus Torvalds     * Some handy macros
591da177e4SLinus Torvalds     */
601da177e4SLinus Torvalds    #define IPS_HA(x)                   ((ips_ha_t *) x->hostdata)
611da177e4SLinus Torvalds    #define IPS_COMMAND_ID(ha, scb)     (int) (scb - ha->scbs)
628a694cc8SJeff Garzik    #define IPS_IS_TROMBONE(ha)         (((ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) && \
638a694cc8SJeff Garzik                                          (ha->pcidev->revision >= IPS_REVID_TROMBONE32) && \
648a694cc8SJeff Garzik                                          (ha->pcidev->revision <= IPS_REVID_TROMBONE64)) ? 1 : 0)
658a694cc8SJeff Garzik    #define IPS_IS_CLARINET(ha)         (((ha->pcidev->device == IPS_DEVICEID_COPPERHEAD) && \
668a694cc8SJeff Garzik                                          (ha->pcidev->revision >= IPS_REVID_CLARINETP1) && \
678a694cc8SJeff Garzik                                          (ha->pcidev->revision <= IPS_REVID_CLARINETP3)) ? 1 : 0)
688a694cc8SJeff Garzik    #define IPS_IS_MORPHEUS(ha)         (ha->pcidev->device == IPS_DEVICEID_MORPHEUS)
698a694cc8SJeff Garzik    #define IPS_IS_MARCO(ha)            (ha->pcidev->device == IPS_DEVICEID_MARCO)
701da177e4SLinus Torvalds    #define IPS_USE_I2O_DELIVER(ha)     ((IPS_IS_MORPHEUS(ha) || \
711da177e4SLinus Torvalds                                          (IPS_IS_TROMBONE(ha) && \
721da177e4SLinus Torvalds                                           (ips_force_i2o))) ? 1 : 0)
731da177e4SLinus Torvalds    #define IPS_USE_MEMIO(ha)           ((IPS_IS_MORPHEUS(ha) || \
741da177e4SLinus Torvalds                                          ((IPS_IS_TROMBONE(ha) || IPS_IS_CLARINET(ha)) && \
751da177e4SLinus Torvalds                                           (ips_force_memio))) ? 1 : 0)
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds     #define IPS_HAS_ENH_SGLIST(ha)    (IPS_IS_MORPHEUS(ha) || IPS_IS_MARCO(ha))
781da177e4SLinus Torvalds     #define IPS_USE_ENH_SGLIST(ha)    ((ha)->flags & IPS_HA_ENH_SG)
791da177e4SLinus Torvalds     #define IPS_SGLIST_SIZE(ha)       (IPS_USE_ENH_SGLIST(ha) ? \
801da177e4SLinus Torvalds                                          sizeof(IPS_ENH_SG_LIST) : sizeof(IPS_STD_SG_LIST))
811da177e4SLinus Torvalds 
821da177e4SLinus Torvalds   #define IPS_PRINTK(level, pcidev, format, arg...)                 \
831da177e4SLinus Torvalds             dev_printk(level , &((pcidev)->dev) , format , ## arg)
841da177e4SLinus Torvalds 
85297295aeSAndrew Morton    #define MDELAY(n)			\
86297295aeSAndrew Morton 	do {				\
87297295aeSAndrew Morton 		mdelay(n);		\
88297295aeSAndrew Morton 		touch_nmi_watchdog();	\
89297295aeSAndrew Morton 	} while (0)
901da177e4SLinus Torvalds 
911da177e4SLinus Torvalds    #ifndef min
921da177e4SLinus Torvalds       #define min(x,y) ((x) < (y) ? x : y)
931da177e4SLinus Torvalds    #endif
941da177e4SLinus Torvalds 
95c1a15468SJack Hammer    #ifndef __iomem       /* For clean compiles in earlier kernels without __iomem annotations */
96c1a15468SJack Hammer       #define __iomem
97c1a15468SJack Hammer    #endif
98c1a15468SJack Hammer 
991da177e4SLinus Torvalds    /*
1001da177e4SLinus Torvalds     * Adapter address map equates
1011da177e4SLinus Torvalds     */
1021da177e4SLinus Torvalds    #define IPS_REG_HISR                 0x08    /* Host Interrupt Status Reg   */
1031da177e4SLinus Torvalds    #define IPS_REG_CCSAR                0x10    /* Cmd Channel System Addr Reg */
1041da177e4SLinus Torvalds    #define IPS_REG_CCCR                 0x14    /* Cmd Channel Control Reg     */
1051da177e4SLinus Torvalds    #define IPS_REG_SQHR                 0x20    /* Status Q Head Reg           */
1061da177e4SLinus Torvalds    #define IPS_REG_SQTR                 0x24    /* Status Q Tail Reg           */
1071da177e4SLinus Torvalds    #define IPS_REG_SQER                 0x28    /* Status Q End Reg            */
1081da177e4SLinus Torvalds    #define IPS_REG_SQSR                 0x2C    /* Status Q Start Reg          */
1091da177e4SLinus Torvalds    #define IPS_REG_SCPR                 0x05    /* Subsystem control port reg  */
1101da177e4SLinus Torvalds    #define IPS_REG_ISPR                 0x06    /* interrupt status port reg   */
1111da177e4SLinus Torvalds    #define IPS_REG_CBSP                 0x07    /* CBSP register               */
1121da177e4SLinus Torvalds    #define IPS_REG_FLAP                 0x18    /* Flash address port          */
1131da177e4SLinus Torvalds    #define IPS_REG_FLDP                 0x1C    /* Flash data port             */
1141da177e4SLinus Torvalds    #define IPS_REG_NDAE                 0x38    /* Anaconda 64 NDAE Register   */
1151da177e4SLinus Torvalds    #define IPS_REG_I2O_INMSGQ           0x40    /* I2O Inbound Message Queue   */
1161da177e4SLinus Torvalds    #define IPS_REG_I2O_OUTMSGQ          0x44    /* I2O Outbound Message Queue  */
1171da177e4SLinus Torvalds    #define IPS_REG_I2O_HIR              0x30    /* I2O Interrupt Status        */
1181da177e4SLinus Torvalds    #define IPS_REG_I960_IDR             0x20    /* i960 Inbound Doorbell       */
1191da177e4SLinus Torvalds    #define IPS_REG_I960_MSG0            0x18    /* i960 Outbound Reg 0         */
1201da177e4SLinus Torvalds    #define IPS_REG_I960_MSG1            0x1C    /* i960 Outbound Reg 1         */
1211da177e4SLinus Torvalds    #define IPS_REG_I960_OIMR            0x34    /* i960 Oubound Int Mask Reg   */
1221da177e4SLinus Torvalds 
1231da177e4SLinus Torvalds    /*
1241da177e4SLinus Torvalds     * Adapter register bit equates
1251da177e4SLinus Torvalds     */
1261da177e4SLinus Torvalds    #define IPS_BIT_GHI                  0x04    /* HISR General Host Interrupt */
1271da177e4SLinus Torvalds    #define IPS_BIT_SQO                  0x02    /* HISR Status Q Overflow      */
1281da177e4SLinus Torvalds    #define IPS_BIT_SCE                  0x01    /* HISR Status Channel Enqueue */
1291da177e4SLinus Torvalds    #define IPS_BIT_SEM                  0x08    /* CCCR Semaphore Bit          */
1301da177e4SLinus Torvalds    #define IPS_BIT_ILE                  0x10    /* CCCR ILE Bit                */
1311da177e4SLinus Torvalds    #define IPS_BIT_START_CMD            0x101A  /* CCCR Start Command Channel  */
1321da177e4SLinus Torvalds    #define IPS_BIT_START_STOP           0x0002  /* CCCR Start/Stop Bit         */
1331da177e4SLinus Torvalds    #define IPS_BIT_RST                  0x80    /* SCPR Reset Bit              */
1341da177e4SLinus Torvalds    #define IPS_BIT_EBM                  0x02    /* SCPR Enable Bus Master      */
1351da177e4SLinus Torvalds    #define IPS_BIT_EI                   0x80    /* HISR Enable Interrupts      */
1361da177e4SLinus Torvalds    #define IPS_BIT_OP                   0x01    /* OP bit in CBSP              */
1371da177e4SLinus Torvalds    #define IPS_BIT_I2O_OPQI             0x08    /* General Host Interrupt      */
1381da177e4SLinus Torvalds    #define IPS_BIT_I960_MSG0I           0x01    /* Message Register 0 Interrupt*/
1391da177e4SLinus Torvalds    #define IPS_BIT_I960_MSG1I           0x02    /* Message Register 1 Interrupt*/
1401da177e4SLinus Torvalds 
1411da177e4SLinus Torvalds    /*
1421da177e4SLinus Torvalds     * Adapter Command ID Equates
1431da177e4SLinus Torvalds     */
1441da177e4SLinus Torvalds    #define IPS_CMD_GET_LD_INFO          0x19
1451da177e4SLinus Torvalds    #define IPS_CMD_GET_SUBSYS           0x40
1461da177e4SLinus Torvalds    #define IPS_CMD_READ_CONF            0x38
1471da177e4SLinus Torvalds    #define IPS_CMD_RW_NVRAM_PAGE        0xBC
1481da177e4SLinus Torvalds    #define IPS_CMD_READ                 0x02
1491da177e4SLinus Torvalds    #define IPS_CMD_WRITE                0x03
1501da177e4SLinus Torvalds    #define IPS_CMD_FFDC                 0xD7
1511da177e4SLinus Torvalds    #define IPS_CMD_ENQUIRY              0x05
1521da177e4SLinus Torvalds    #define IPS_CMD_FLUSH                0x0A
1531da177e4SLinus Torvalds    #define IPS_CMD_READ_SG              0x82
1541da177e4SLinus Torvalds    #define IPS_CMD_WRITE_SG             0x83
1551da177e4SLinus Torvalds    #define IPS_CMD_DCDB                 0x04
1561da177e4SLinus Torvalds    #define IPS_CMD_DCDB_SG              0x84
1571da177e4SLinus Torvalds    #define IPS_CMD_EXTENDED_DCDB 	    0x95
1581da177e4SLinus Torvalds    #define IPS_CMD_EXTENDED_DCDB_SG	    0x96
1591da177e4SLinus Torvalds    #define IPS_CMD_CONFIG_SYNC          0x58
1601da177e4SLinus Torvalds    #define IPS_CMD_ERROR_TABLE          0x17
1611da177e4SLinus Torvalds    #define IPS_CMD_DOWNLOAD             0x20
1621da177e4SLinus Torvalds    #define IPS_CMD_RW_BIOSFW            0x22
1631da177e4SLinus Torvalds    #define IPS_CMD_GET_VERSION_INFO     0xC6
1641da177e4SLinus Torvalds    #define IPS_CMD_RESET_CHANNEL        0x1A
1651da177e4SLinus Torvalds 
1661da177e4SLinus Torvalds    /*
1671da177e4SLinus Torvalds     * Adapter Equates
1681da177e4SLinus Torvalds     */
1691da177e4SLinus Torvalds    #define IPS_CSL                      0xFF
1701da177e4SLinus Torvalds    #define IPS_POCL                     0x30
1711da177e4SLinus Torvalds    #define IPS_NORM_STATE               0x00
1721da177e4SLinus Torvalds    #define IPS_MAX_ADAPTER_TYPES        3
1731da177e4SLinus Torvalds    #define IPS_MAX_ADAPTERS             16
1741da177e4SLinus Torvalds    #define IPS_MAX_IOCTL                1
1751da177e4SLinus Torvalds    #define IPS_MAX_IOCTL_QUEUE          8
1761da177e4SLinus Torvalds    #define IPS_MAX_QUEUE                128
1771da177e4SLinus Torvalds    #define IPS_BLKSIZE                  512
1781da177e4SLinus Torvalds    #define IPS_MAX_SG                   17
1791da177e4SLinus Torvalds    #define IPS_MAX_LD                   8
1801da177e4SLinus Torvalds    #define IPS_MAX_CHANNELS             4
1811da177e4SLinus Torvalds    #define IPS_MAX_TARGETS              15
1821da177e4SLinus Torvalds    #define IPS_MAX_CHUNKS               16
1831da177e4SLinus Torvalds    #define IPS_MAX_CMDS                 128
1841da177e4SLinus Torvalds    #define IPS_MAX_XFER                 0x10000
1851da177e4SLinus Torvalds    #define IPS_NVRAM_P5_SIG             0xFFDDBB99
1861da177e4SLinus Torvalds    #define IPS_MAX_POST_BYTES           0x02
1871da177e4SLinus Torvalds    #define IPS_MAX_CONFIG_BYTES         0x02
1881da177e4SLinus Torvalds    #define IPS_GOOD_POST_STATUS         0x80
1891da177e4SLinus Torvalds    #define IPS_SEM_TIMEOUT              2000
1901da177e4SLinus Torvalds    #define IPS_IOCTL_COMMAND            0x0D
1911da177e4SLinus Torvalds    #define IPS_INTR_ON                  0
1921da177e4SLinus Torvalds    #define IPS_INTR_IORL                1
1931da177e4SLinus Torvalds    #define IPS_FFDC                     99
1941da177e4SLinus Torvalds    #define IPS_ADAPTER_ID               0xF
1951da177e4SLinus Torvalds    #define IPS_VENDORID_IBM             0x1014
1961da177e4SLinus Torvalds    #define IPS_VENDORID_ADAPTEC         0x9005
1971da177e4SLinus Torvalds    #define IPS_DEVICEID_COPPERHEAD      0x002E
1981da177e4SLinus Torvalds    #define IPS_DEVICEID_MORPHEUS        0x01BD
1991da177e4SLinus Torvalds    #define IPS_DEVICEID_MARCO           0x0250
2001da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_4M           0x01BE
2011da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_4L           0x01BF
2021da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_4MX          0x0208
2031da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_4LX          0x020E
2041da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_5I2          0x0259
2051da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_5I1          0x0258
2061da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_6M           0x0279
2071da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_6I           0x028C
2081da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_7k           0x028E
2091da177e4SLinus Torvalds    #define IPS_SUBDEVICEID_7M           0x028F
2101da177e4SLinus Torvalds    #define IPS_IOCTL_SIZE               8192
2111da177e4SLinus Torvalds    #define IPS_STATUS_SIZE              4
2121da177e4SLinus Torvalds    #define IPS_STATUS_Q_SIZE            (IPS_MAX_CMDS+1) * IPS_STATUS_SIZE
2131da177e4SLinus Torvalds    #define IPS_IMAGE_SIZE               500 * 1024
2141da177e4SLinus Torvalds    #define IPS_MEMMAP_SIZE              128
2151da177e4SLinus Torvalds    #define IPS_ONE_MSEC                 1
2161da177e4SLinus Torvalds    #define IPS_ONE_SEC                  1000
2171da177e4SLinus Torvalds 
2181da177e4SLinus Torvalds    /*
2191da177e4SLinus Torvalds     * Geometry Settings
2201da177e4SLinus Torvalds     */
2211da177e4SLinus Torvalds    #define IPS_COMP_HEADS               128
2221da177e4SLinus Torvalds    #define IPS_COMP_SECTORS             32
2231da177e4SLinus Torvalds    #define IPS_NORM_HEADS               254
2241da177e4SLinus Torvalds    #define IPS_NORM_SECTORS             63
2251da177e4SLinus Torvalds 
2261da177e4SLinus Torvalds    /*
2271da177e4SLinus Torvalds     * Adapter Basic Status Codes
2281da177e4SLinus Torvalds     */
2291da177e4SLinus Torvalds    #define IPS_BASIC_STATUS_MASK        0xFF
2301da177e4SLinus Torvalds    #define IPS_GSC_STATUS_MASK          0x0F
2311da177e4SLinus Torvalds    #define IPS_CMD_SUCCESS              0x00
2321da177e4SLinus Torvalds    #define IPS_CMD_RECOVERED_ERROR      0x01
2331da177e4SLinus Torvalds    #define IPS_INVAL_OPCO               0x03
2341da177e4SLinus Torvalds    #define IPS_INVAL_CMD_BLK            0x04
2351da177e4SLinus Torvalds    #define IPS_INVAL_PARM_BLK           0x05
2361da177e4SLinus Torvalds    #define IPS_BUSY                     0x08
2371da177e4SLinus Torvalds    #define IPS_CMD_CMPLT_WERROR         0x0C
2381da177e4SLinus Torvalds    #define IPS_LD_ERROR                 0x0D
2391da177e4SLinus Torvalds    #define IPS_CMD_TIMEOUT              0x0E
2401da177e4SLinus Torvalds    #define IPS_PHYS_DRV_ERROR           0x0F
2411da177e4SLinus Torvalds 
2421da177e4SLinus Torvalds    /*
2431da177e4SLinus Torvalds     * Adapter Extended Status Equates
2441da177e4SLinus Torvalds     */
2451da177e4SLinus Torvalds    #define IPS_ERR_SEL_TO               0xF0
2461da177e4SLinus Torvalds    #define IPS_ERR_OU_RUN               0xF2
2471da177e4SLinus Torvalds    #define IPS_ERR_HOST_RESET           0xF7
2481da177e4SLinus Torvalds    #define IPS_ERR_DEV_RESET            0xF8
2491da177e4SLinus Torvalds    #define IPS_ERR_RECOVERY             0xFC
2501da177e4SLinus Torvalds    #define IPS_ERR_CKCOND               0xFF
2511da177e4SLinus Torvalds 
2521da177e4SLinus Torvalds    /*
2531da177e4SLinus Torvalds     * Operating System Defines
2541da177e4SLinus Torvalds     */
2551da177e4SLinus Torvalds    #define IPS_OS_WINDOWS_NT            0x01
2561da177e4SLinus Torvalds    #define IPS_OS_NETWARE               0x02
2571da177e4SLinus Torvalds    #define IPS_OS_OPENSERVER            0x03
2581da177e4SLinus Torvalds    #define IPS_OS_UNIXWARE              0x04
2591da177e4SLinus Torvalds    #define IPS_OS_SOLARIS               0x05
2601da177e4SLinus Torvalds    #define IPS_OS_OS2                   0x06
2611da177e4SLinus Torvalds    #define IPS_OS_LINUX                 0x07
2621da177e4SLinus Torvalds    #define IPS_OS_FREEBSD               0x08
2631da177e4SLinus Torvalds 
2641da177e4SLinus Torvalds    /*
2651da177e4SLinus Torvalds     * Adapter Revision ID's
2661da177e4SLinus Torvalds     */
2671da177e4SLinus Torvalds    #define IPS_REVID_SERVERAID          0x02
2681da177e4SLinus Torvalds    #define IPS_REVID_NAVAJO             0x03
2691da177e4SLinus Torvalds    #define IPS_REVID_SERVERAID2         0x04
2701da177e4SLinus Torvalds    #define IPS_REVID_CLARINETP1         0x05
2711da177e4SLinus Torvalds    #define IPS_REVID_CLARINETP2         0x07
2721da177e4SLinus Torvalds    #define IPS_REVID_CLARINETP3         0x0D
2731da177e4SLinus Torvalds    #define IPS_REVID_TROMBONE32         0x0F
2741da177e4SLinus Torvalds    #define IPS_REVID_TROMBONE64         0x10
2751da177e4SLinus Torvalds 
2761da177e4SLinus Torvalds    /*
2771da177e4SLinus Torvalds     * NVRAM Page 5 Adapter Defines
2781da177e4SLinus Torvalds     */
2791da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID         0x01
2801da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID2        0x02
2811da177e4SLinus Torvalds    #define IPS_ADTYPE_NAVAJO            0x03
2821da177e4SLinus Torvalds    #define IPS_ADTYPE_KIOWA             0x04
2831da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID3        0x05
2841da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID3L       0x06
2851da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID4H       0x07
2861da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID4M       0x08
2871da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID4L       0x09
2881da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID4MX      0x0A
2891da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID4LX      0x0B
2901da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID5I2      0x0C
2911da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID5I1      0x0D
2921da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID6M       0x0E
2931da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID6I       0x0F
2941da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID7t       0x10
2951da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID7k       0x11
2961da177e4SLinus Torvalds    #define IPS_ADTYPE_SERVERAID7M       0x12
2971da177e4SLinus Torvalds 
2981da177e4SLinus Torvalds    /*
2991da177e4SLinus Torvalds     * Adapter Command/Status Packet Definitions
3001da177e4SLinus Torvalds     */
3011da177e4SLinus Torvalds    #define IPS_SUCCESS                  0x01 /* Successfully completed       */
3021da177e4SLinus Torvalds    #define IPS_SUCCESS_IMM              0x02 /* Success - Immediately        */
3031da177e4SLinus Torvalds    #define IPS_FAILURE                  0x04 /* Completed with Error         */
3041da177e4SLinus Torvalds 
3051da177e4SLinus Torvalds    /*
3061da177e4SLinus Torvalds     * Logical Drive Equates
3071da177e4SLinus Torvalds     */
3081da177e4SLinus Torvalds    #define IPS_LD_OFFLINE               0x02
3091da177e4SLinus Torvalds    #define IPS_LD_OKAY                  0x03
3101da177e4SLinus Torvalds    #define IPS_LD_FREE                  0x00
3111da177e4SLinus Torvalds    #define IPS_LD_SYS                   0x06
3121da177e4SLinus Torvalds    #define IPS_LD_CRS                   0x24
3131da177e4SLinus Torvalds 
3141da177e4SLinus Torvalds    /*
3151da177e4SLinus Torvalds     * DCDB Table Equates
3161da177e4SLinus Torvalds     */
3171da177e4SLinus Torvalds    #define IPS_NO_DISCONNECT            0x00
3181da177e4SLinus Torvalds    #define IPS_DISCONNECT_ALLOWED       0x80
3191da177e4SLinus Torvalds    #define IPS_NO_AUTO_REQSEN           0x40
3201da177e4SLinus Torvalds    #define IPS_DATA_NONE                0x00
3211da177e4SLinus Torvalds    #define IPS_DATA_UNK                 0x00
3221da177e4SLinus Torvalds    #define IPS_DATA_IN                  0x01
3231da177e4SLinus Torvalds    #define IPS_DATA_OUT                 0x02
3241da177e4SLinus Torvalds    #define IPS_TRANSFER64K              0x08
3251da177e4SLinus Torvalds    #define IPS_NOTIMEOUT                0x00
3261da177e4SLinus Torvalds    #define IPS_TIMEOUT10                0x10
3271da177e4SLinus Torvalds    #define IPS_TIMEOUT60                0x20
3281da177e4SLinus Torvalds    #define IPS_TIMEOUT20M               0x30
3291da177e4SLinus Torvalds 
3301da177e4SLinus Torvalds    /*
3311da177e4SLinus Torvalds     * SCSI Inquiry Data Flags
3321da177e4SLinus Torvalds     */
3331da177e4SLinus Torvalds    #define IPS_SCSI_INQ_TYPE_DASD       0x00
3341da177e4SLinus Torvalds    #define IPS_SCSI_INQ_TYPE_PROCESSOR  0x03
3351da177e4SLinus Torvalds    #define IPS_SCSI_INQ_LU_CONNECTED    0x00
3361da177e4SLinus Torvalds    #define IPS_SCSI_INQ_RD_REV2         0x02
3371da177e4SLinus Torvalds    #define IPS_SCSI_INQ_REV2            0x02
3381da177e4SLinus Torvalds    #define IPS_SCSI_INQ_REV3            0x03
3391da177e4SLinus Torvalds    #define IPS_SCSI_INQ_Address16       0x01
3401da177e4SLinus Torvalds    #define IPS_SCSI_INQ_Address32       0x02
3411da177e4SLinus Torvalds    #define IPS_SCSI_INQ_MedChanger      0x08
3421da177e4SLinus Torvalds    #define IPS_SCSI_INQ_MultiPort       0x10
3431da177e4SLinus Torvalds    #define IPS_SCSI_INQ_EncServ         0x40
3441da177e4SLinus Torvalds    #define IPS_SCSI_INQ_SoftReset       0x01
3451da177e4SLinus Torvalds    #define IPS_SCSI_INQ_CmdQue          0x02
3461da177e4SLinus Torvalds    #define IPS_SCSI_INQ_Linked          0x08
3471da177e4SLinus Torvalds    #define IPS_SCSI_INQ_Sync            0x10
3481da177e4SLinus Torvalds    #define IPS_SCSI_INQ_WBus16          0x20
3491da177e4SLinus Torvalds    #define IPS_SCSI_INQ_WBus32          0x40
3501da177e4SLinus Torvalds    #define IPS_SCSI_INQ_RelAdr          0x80
3511da177e4SLinus Torvalds 
3521da177e4SLinus Torvalds    /*
3531da177e4SLinus Torvalds     * SCSI Request Sense Data Flags
3541da177e4SLinus Torvalds     */
3551da177e4SLinus Torvalds    #define IPS_SCSI_REQSEN_VALID        0x80
3561da177e4SLinus Torvalds    #define IPS_SCSI_REQSEN_CURRENT_ERR  0x70
3571da177e4SLinus Torvalds    #define IPS_SCSI_REQSEN_NO_SENSE     0x00
3581da177e4SLinus Torvalds 
3591da177e4SLinus Torvalds    /*
3601da177e4SLinus Torvalds     * SCSI Mode Page Equates
3611da177e4SLinus Torvalds     */
3621da177e4SLinus Torvalds    #define IPS_SCSI_MP3_SoftSector      0x01
3631da177e4SLinus Torvalds    #define IPS_SCSI_MP3_HardSector      0x02
3641da177e4SLinus Torvalds    #define IPS_SCSI_MP3_Removeable      0x04
3651da177e4SLinus Torvalds    #define IPS_SCSI_MP3_AllocateSurface 0x08
3661da177e4SLinus Torvalds 
3671da177e4SLinus Torvalds    /*
3681da177e4SLinus Torvalds     * HA Flags
3691da177e4SLinus Torvalds     */
3701da177e4SLinus Torvalds 
3711da177e4SLinus Torvalds    #define IPS_HA_ENH_SG                0x1
3721da177e4SLinus Torvalds 
3731da177e4SLinus Torvalds    /*
3741da177e4SLinus Torvalds     * SCB Flags
3751da177e4SLinus Torvalds     */
3761da177e4SLinus Torvalds    #define IPS_SCB_MAP_SG               0x00008
3771da177e4SLinus Torvalds    #define IPS_SCB_MAP_SINGLE           0X00010
3781da177e4SLinus Torvalds 
3791da177e4SLinus Torvalds    /*
3801da177e4SLinus Torvalds     * Passthru stuff
3811da177e4SLinus Torvalds     */
3821da177e4SLinus Torvalds    #define IPS_COPPUSRCMD              (('C'<<8) | 65)
3831da177e4SLinus Torvalds    #define IPS_COPPIOCCMD              (('C'<<8) | 66)
3841da177e4SLinus Torvalds    #define IPS_NUMCTRLS                (('C'<<8) | 68)
3851da177e4SLinus Torvalds    #define IPS_CTRLINFO                (('C'<<8) | 69)
3861da177e4SLinus Torvalds 
3871da177e4SLinus Torvalds    /* flashing defines */
3881da177e4SLinus Torvalds    #define IPS_FW_IMAGE                0x00
3891da177e4SLinus Torvalds    #define IPS_BIOS_IMAGE              0x01
3901da177e4SLinus Torvalds    #define IPS_WRITE_FW                0x01
3911da177e4SLinus Torvalds    #define IPS_WRITE_BIOS              0x02
3921da177e4SLinus Torvalds    #define IPS_ERASE_BIOS              0x03
3931da177e4SLinus Torvalds    #define IPS_BIOS_HEADER             0xC0
3941da177e4SLinus Torvalds 
3951da177e4SLinus Torvalds    /* time oriented stuff */
3961da177e4SLinus Torvalds    #define IPS_SECS_8HOURS              28800
3971da177e4SLinus Torvalds 
3981da177e4SLinus Torvalds    /*
3991da177e4SLinus Torvalds     * Scsi_Host Template
4001da177e4SLinus Torvalds     */
4011da177e4SLinus Torvalds    static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
4021da177e4SLinus Torvalds 		sector_t capacity, int geom[]);
403f64a181dSChristoph Hellwig    static int ips_slave_configure(struct scsi_device *SDptr);
4041da177e4SLinus Torvalds 
4051da177e4SLinus Torvalds /*
4061da177e4SLinus Torvalds  * Raid Command Formats
4071da177e4SLinus Torvalds  */
4081da177e4SLinus Torvalds typedef struct {
4091da177e4SLinus Torvalds    uint8_t  op_code;
4101da177e4SLinus Torvalds    uint8_t  command_id;
4111da177e4SLinus Torvalds    uint8_t  log_drv;
4121da177e4SLinus Torvalds    uint8_t  sg_count;
4131da177e4SLinus Torvalds    uint32_t lba;
4141da177e4SLinus Torvalds    uint32_t sg_addr;
4151da177e4SLinus Torvalds    uint16_t sector_count;
4161da177e4SLinus Torvalds    uint8_t  segment_4G;
4171da177e4SLinus Torvalds    uint8_t  enhanced_sg;
4181da177e4SLinus Torvalds    uint32_t ccsar;
4191da177e4SLinus Torvalds    uint32_t cccr;
4201da177e4SLinus Torvalds } IPS_IO_CMD, *PIPS_IO_CMD;
4211da177e4SLinus Torvalds 
4221da177e4SLinus Torvalds typedef struct {
4231da177e4SLinus Torvalds    uint8_t  op_code;
4241da177e4SLinus Torvalds    uint8_t  command_id;
4251da177e4SLinus Torvalds    uint16_t reserved;
4261da177e4SLinus Torvalds    uint32_t reserved2;
4271da177e4SLinus Torvalds    uint32_t buffer_addr;
4281da177e4SLinus Torvalds    uint32_t reserved3;
4291da177e4SLinus Torvalds    uint32_t ccsar;
4301da177e4SLinus Torvalds    uint32_t cccr;
4311da177e4SLinus Torvalds } IPS_LD_CMD, *PIPS_LD_CMD;
4321da177e4SLinus Torvalds 
4331da177e4SLinus Torvalds typedef struct {
4341da177e4SLinus Torvalds    uint8_t  op_code;
4351da177e4SLinus Torvalds    uint8_t  command_id;
4361da177e4SLinus Torvalds    uint8_t  reserved;
4371da177e4SLinus Torvalds    uint8_t  reserved2;
4381da177e4SLinus Torvalds    uint32_t reserved3;
4391da177e4SLinus Torvalds    uint32_t buffer_addr;
4401da177e4SLinus Torvalds    uint32_t reserved4;
4411da177e4SLinus Torvalds } IPS_IOCTL_CMD, *PIPS_IOCTL_CMD;
4421da177e4SLinus Torvalds 
4431da177e4SLinus Torvalds typedef struct {
4441da177e4SLinus Torvalds    uint8_t  op_code;
4451da177e4SLinus Torvalds    uint8_t  command_id;
4461da177e4SLinus Torvalds    uint8_t  channel;
4471da177e4SLinus Torvalds    uint8_t  reserved3;
4481da177e4SLinus Torvalds    uint8_t  reserved4;
4491da177e4SLinus Torvalds    uint8_t  reserved5;
4501da177e4SLinus Torvalds    uint8_t  reserved6;
4511da177e4SLinus Torvalds    uint8_t  reserved7;
4521da177e4SLinus Torvalds    uint8_t  reserved8;
4531da177e4SLinus Torvalds    uint8_t  reserved9;
4541da177e4SLinus Torvalds    uint8_t  reserved10;
4551da177e4SLinus Torvalds    uint8_t  reserved11;
4561da177e4SLinus Torvalds    uint8_t  reserved12;
4571da177e4SLinus Torvalds    uint8_t  reserved13;
4581da177e4SLinus Torvalds    uint8_t  reserved14;
4591da177e4SLinus Torvalds    uint8_t  adapter_flag;
4601da177e4SLinus Torvalds } IPS_RESET_CMD, *PIPS_RESET_CMD;
4611da177e4SLinus Torvalds 
4621da177e4SLinus Torvalds typedef struct {
4631da177e4SLinus Torvalds    uint8_t  op_code;
4641da177e4SLinus Torvalds    uint8_t  command_id;
4651da177e4SLinus Torvalds    uint16_t reserved;
4661da177e4SLinus Torvalds    uint32_t reserved2;
4671da177e4SLinus Torvalds    uint32_t dcdb_address;
4681da177e4SLinus Torvalds    uint16_t reserved3;
4691da177e4SLinus Torvalds    uint8_t  segment_4G;
4701da177e4SLinus Torvalds    uint8_t  enhanced_sg;
4711da177e4SLinus Torvalds    uint32_t ccsar;
4721da177e4SLinus Torvalds    uint32_t cccr;
4731da177e4SLinus Torvalds } IPS_DCDB_CMD, *PIPS_DCDB_CMD;
4741da177e4SLinus Torvalds 
4751da177e4SLinus Torvalds typedef struct {
4761da177e4SLinus Torvalds    uint8_t  op_code;
4771da177e4SLinus Torvalds    uint8_t  command_id;
4781da177e4SLinus Torvalds    uint8_t  channel;
4791da177e4SLinus Torvalds    uint8_t  source_target;
4801da177e4SLinus Torvalds    uint32_t reserved;
4811da177e4SLinus Torvalds    uint32_t reserved2;
4821da177e4SLinus Torvalds    uint32_t reserved3;
4831da177e4SLinus Torvalds    uint32_t ccsar;
4841da177e4SLinus Torvalds    uint32_t cccr;
4851da177e4SLinus Torvalds } IPS_CS_CMD, *PIPS_CS_CMD;
4861da177e4SLinus Torvalds 
4871da177e4SLinus Torvalds typedef struct {
4881da177e4SLinus Torvalds    uint8_t  op_code;
4891da177e4SLinus Torvalds    uint8_t  command_id;
4901da177e4SLinus Torvalds    uint8_t  log_drv;
4911da177e4SLinus Torvalds    uint8_t  control;
4921da177e4SLinus Torvalds    uint32_t reserved;
4931da177e4SLinus Torvalds    uint32_t reserved2;
4941da177e4SLinus Torvalds    uint32_t reserved3;
4951da177e4SLinus Torvalds    uint32_t ccsar;
4961da177e4SLinus Torvalds    uint32_t cccr;
4971da177e4SLinus Torvalds } IPS_US_CMD, *PIPS_US_CMD;
4981da177e4SLinus Torvalds 
4991da177e4SLinus Torvalds typedef struct {
5001da177e4SLinus Torvalds    uint8_t  op_code;
5011da177e4SLinus Torvalds    uint8_t  command_id;
5021da177e4SLinus Torvalds    uint8_t  reserved;
5031da177e4SLinus Torvalds    uint8_t  state;
5041da177e4SLinus Torvalds    uint32_t reserved2;
5051da177e4SLinus Torvalds    uint32_t reserved3;
5061da177e4SLinus Torvalds    uint32_t reserved4;
5071da177e4SLinus Torvalds    uint32_t ccsar;
5081da177e4SLinus Torvalds    uint32_t cccr;
5091da177e4SLinus Torvalds } IPS_FC_CMD, *PIPS_FC_CMD;
5101da177e4SLinus Torvalds 
5111da177e4SLinus Torvalds typedef struct {
5121da177e4SLinus Torvalds    uint8_t  op_code;
5131da177e4SLinus Torvalds    uint8_t  command_id;
5141da177e4SLinus Torvalds    uint8_t  reserved;
5151da177e4SLinus Torvalds    uint8_t  desc;
5161da177e4SLinus Torvalds    uint32_t reserved2;
5171da177e4SLinus Torvalds    uint32_t buffer_addr;
5181da177e4SLinus Torvalds    uint32_t reserved3;
5191da177e4SLinus Torvalds    uint32_t ccsar;
5201da177e4SLinus Torvalds    uint32_t cccr;
5211da177e4SLinus Torvalds } IPS_STATUS_CMD, *PIPS_STATUS_CMD;
5221da177e4SLinus Torvalds 
5231da177e4SLinus Torvalds typedef struct {
5241da177e4SLinus Torvalds    uint8_t  op_code;
5251da177e4SLinus Torvalds    uint8_t  command_id;
5261da177e4SLinus Torvalds    uint8_t  page;
5271da177e4SLinus Torvalds    uint8_t  write;
5281da177e4SLinus Torvalds    uint32_t reserved;
5291da177e4SLinus Torvalds    uint32_t buffer_addr;
5301da177e4SLinus Torvalds    uint32_t reserved2;
5311da177e4SLinus Torvalds    uint32_t ccsar;
5321da177e4SLinus Torvalds    uint32_t cccr;
5331da177e4SLinus Torvalds } IPS_NVRAM_CMD, *PIPS_NVRAM_CMD;
5341da177e4SLinus Torvalds 
5351da177e4SLinus Torvalds typedef struct
5361da177e4SLinus Torvalds {
5371da177e4SLinus Torvalds     uint8_t  op_code;
5381da177e4SLinus Torvalds     uint8_t  command_id;
5391da177e4SLinus Torvalds     uint16_t reserved;
5401da177e4SLinus Torvalds     uint32_t count;
5411da177e4SLinus Torvalds     uint32_t buffer_addr;
5421da177e4SLinus Torvalds     uint32_t reserved2;
5431da177e4SLinus Torvalds } IPS_VERSION_INFO, *PIPS_VERSION_INFO;
5441da177e4SLinus Torvalds 
5451da177e4SLinus Torvalds typedef struct {
5461da177e4SLinus Torvalds    uint8_t  op_code;
5471da177e4SLinus Torvalds    uint8_t  command_id;
5481da177e4SLinus Torvalds    uint8_t  reset_count;
5491da177e4SLinus Torvalds    uint8_t  reset_type;
5501da177e4SLinus Torvalds    uint8_t  second;
5511da177e4SLinus Torvalds    uint8_t  minute;
5521da177e4SLinus Torvalds    uint8_t  hour;
5531da177e4SLinus Torvalds    uint8_t  day;
5541da177e4SLinus Torvalds    uint8_t  reserved1[4];
5551da177e4SLinus Torvalds    uint8_t  month;
5561da177e4SLinus Torvalds    uint8_t  yearH;
5571da177e4SLinus Torvalds    uint8_t  yearL;
5581da177e4SLinus Torvalds    uint8_t  reserved2;
5591da177e4SLinus Torvalds } IPS_FFDC_CMD, *PIPS_FFDC_CMD;
5601da177e4SLinus Torvalds 
5611da177e4SLinus Torvalds typedef struct {
5621da177e4SLinus Torvalds    uint8_t  op_code;
5631da177e4SLinus Torvalds    uint8_t  command_id;
5641da177e4SLinus Torvalds    uint8_t  type;
5651da177e4SLinus Torvalds    uint8_t  direction;
5661da177e4SLinus Torvalds    uint32_t count;
5671da177e4SLinus Torvalds    uint32_t buffer_addr;
5681da177e4SLinus Torvalds    uint8_t  total_packets;
5691da177e4SLinus Torvalds    uint8_t  packet_num;
5701da177e4SLinus Torvalds    uint16_t reserved;
5711da177e4SLinus Torvalds } IPS_FLASHFW_CMD, *PIPS_FLASHFW_CMD;
5721da177e4SLinus Torvalds 
5731da177e4SLinus Torvalds typedef struct {
5741da177e4SLinus Torvalds    uint8_t  op_code;
5751da177e4SLinus Torvalds    uint8_t  command_id;
5761da177e4SLinus Torvalds    uint8_t  type;
5771da177e4SLinus Torvalds    uint8_t  direction;
5781da177e4SLinus Torvalds    uint32_t count;
5791da177e4SLinus Torvalds    uint32_t buffer_addr;
5801da177e4SLinus Torvalds    uint32_t offset;
5811da177e4SLinus Torvalds } IPS_FLASHBIOS_CMD, *PIPS_FLASHBIOS_CMD;
5821da177e4SLinus Torvalds 
5831da177e4SLinus Torvalds typedef union {
5841da177e4SLinus Torvalds    IPS_IO_CMD         basic_io;
5851da177e4SLinus Torvalds    IPS_LD_CMD         logical_info;
5861da177e4SLinus Torvalds    IPS_IOCTL_CMD      ioctl_info;
5871da177e4SLinus Torvalds    IPS_DCDB_CMD       dcdb;
5881da177e4SLinus Torvalds    IPS_CS_CMD         config_sync;
5891da177e4SLinus Torvalds    IPS_US_CMD         unlock_stripe;
5901da177e4SLinus Torvalds    IPS_FC_CMD         flush_cache;
5911da177e4SLinus Torvalds    IPS_STATUS_CMD     status;
5921da177e4SLinus Torvalds    IPS_NVRAM_CMD      nvram;
5931da177e4SLinus Torvalds    IPS_FFDC_CMD       ffdc;
5941da177e4SLinus Torvalds    IPS_FLASHFW_CMD    flashfw;
5951da177e4SLinus Torvalds    IPS_FLASHBIOS_CMD  flashbios;
5961da177e4SLinus Torvalds    IPS_VERSION_INFO   version_info;
5971da177e4SLinus Torvalds    IPS_RESET_CMD      reset;
5981da177e4SLinus Torvalds } IPS_HOST_COMMAND, *PIPS_HOST_COMMAND;
5991da177e4SLinus Torvalds 
6001da177e4SLinus Torvalds typedef struct {
6011da177e4SLinus Torvalds    uint8_t  logical_id;
6021da177e4SLinus Torvalds    uint8_t  reserved;
6031da177e4SLinus Torvalds    uint8_t  raid_level;
6041da177e4SLinus Torvalds    uint8_t  state;
6051da177e4SLinus Torvalds    uint32_t sector_count;
6061da177e4SLinus Torvalds } IPS_DRIVE_INFO, *PIPS_DRIVE_INFO;
6071da177e4SLinus Torvalds 
6081da177e4SLinus Torvalds typedef struct {
6091da177e4SLinus Torvalds    uint8_t       no_of_log_drive;
6101da177e4SLinus Torvalds    uint8_t       reserved[3];
6111da177e4SLinus Torvalds    IPS_DRIVE_INFO drive_info[IPS_MAX_LD];
6121da177e4SLinus Torvalds } IPS_LD_INFO, *PIPS_LD_INFO;
6131da177e4SLinus Torvalds 
6141da177e4SLinus Torvalds typedef struct {
6151da177e4SLinus Torvalds    uint8_t   device_address;
6161da177e4SLinus Torvalds    uint8_t   cmd_attribute;
6171da177e4SLinus Torvalds    uint16_t  transfer_length;
6181da177e4SLinus Torvalds    uint32_t  buffer_pointer;
6191da177e4SLinus Torvalds    uint8_t   cdb_length;
6201da177e4SLinus Torvalds    uint8_t   sense_length;
6211da177e4SLinus Torvalds    uint8_t   sg_count;
6221da177e4SLinus Torvalds    uint8_t   reserved;
6231da177e4SLinus Torvalds    uint8_t   scsi_cdb[12];
6241da177e4SLinus Torvalds    uint8_t   sense_info[64];
6251da177e4SLinus Torvalds    uint8_t   scsi_status;
6261da177e4SLinus Torvalds    uint8_t   reserved2[3];
6271da177e4SLinus Torvalds } IPS_DCDB_TABLE, *PIPS_DCDB_TABLE;
6281da177e4SLinus Torvalds 
6291da177e4SLinus Torvalds typedef struct {
6301da177e4SLinus Torvalds    uint8_t   device_address;
6311da177e4SLinus Torvalds    uint8_t   cmd_attribute;
6321da177e4SLinus Torvalds    uint8_t   cdb_length;
6331da177e4SLinus Torvalds    uint8_t   reserved_for_LUN;
6341da177e4SLinus Torvalds    uint32_t  transfer_length;
6351da177e4SLinus Torvalds    uint32_t  buffer_pointer;
6361da177e4SLinus Torvalds    uint16_t  sg_count;
6371da177e4SLinus Torvalds    uint8_t   sense_length;
6381da177e4SLinus Torvalds    uint8_t   scsi_status;
6391da177e4SLinus Torvalds    uint32_t  reserved;
6401da177e4SLinus Torvalds    uint8_t   scsi_cdb[16];
6411da177e4SLinus Torvalds    uint8_t   sense_info[56];
6421da177e4SLinus Torvalds } IPS_DCDB_TABLE_TAPE, *PIPS_DCDB_TABLE_TAPE;
6431da177e4SLinus Torvalds 
6441da177e4SLinus Torvalds typedef union {
6451da177e4SLinus Torvalds    struct {
6461da177e4SLinus Torvalds       volatile uint8_t  reserved;
6471da177e4SLinus Torvalds       volatile uint8_t  command_id;
6481da177e4SLinus Torvalds       volatile uint8_t  basic_status;
6491da177e4SLinus Torvalds       volatile uint8_t  extended_status;
6501da177e4SLinus Torvalds    } fields;
6511da177e4SLinus Torvalds 
6521da177e4SLinus Torvalds    volatile uint32_t    value;
6531da177e4SLinus Torvalds } IPS_STATUS, *PIPS_STATUS;
6541da177e4SLinus Torvalds 
6551da177e4SLinus Torvalds typedef struct {
6561da177e4SLinus Torvalds    IPS_STATUS           status[IPS_MAX_CMDS + 1];
6571da177e4SLinus Torvalds    volatile PIPS_STATUS p_status_start;
6581da177e4SLinus Torvalds    volatile PIPS_STATUS p_status_end;
6591da177e4SLinus Torvalds    volatile PIPS_STATUS p_status_tail;
6601da177e4SLinus Torvalds    volatile uint32_t    hw_status_start;
6611da177e4SLinus Torvalds    volatile uint32_t    hw_status_tail;
6621da177e4SLinus Torvalds } IPS_ADAPTER, *PIPS_ADAPTER;
6631da177e4SLinus Torvalds 
6641da177e4SLinus Torvalds typedef struct {
6651da177e4SLinus Torvalds    uint8_t  ucLogDriveCount;
6661da177e4SLinus Torvalds    uint8_t  ucMiscFlag;
6671da177e4SLinus Torvalds    uint8_t  ucSLTFlag;
6681da177e4SLinus Torvalds    uint8_t  ucBSTFlag;
6691da177e4SLinus Torvalds    uint8_t  ucPwrChgCnt;
6701da177e4SLinus Torvalds    uint8_t  ucWrongAdrCnt;
6711da177e4SLinus Torvalds    uint8_t  ucUnidentCnt;
6721da177e4SLinus Torvalds    uint8_t  ucNVramDevChgCnt;
6731da177e4SLinus Torvalds    uint8_t  CodeBlkVersion[8];
6741da177e4SLinus Torvalds    uint8_t  BootBlkVersion[8];
6751da177e4SLinus Torvalds    uint32_t ulDriveSize[IPS_MAX_LD];
6761da177e4SLinus Torvalds    uint8_t  ucConcurrentCmdCount;
6771da177e4SLinus Torvalds    uint8_t  ucMaxPhysicalDevices;
6781da177e4SLinus Torvalds    uint16_t usFlashRepgmCount;
6791da177e4SLinus Torvalds    uint8_t  ucDefunctDiskCount;
6801da177e4SLinus Torvalds    uint8_t  ucRebuildFlag;
6811da177e4SLinus Torvalds    uint8_t  ucOfflineLogDrvCount;
6821da177e4SLinus Torvalds    uint8_t  ucCriticalDrvCount;
6831da177e4SLinus Torvalds    uint16_t usConfigUpdateCount;
6841da177e4SLinus Torvalds    uint8_t  ucBlkFlag;
6851da177e4SLinus Torvalds    uint8_t  reserved;
6861da177e4SLinus Torvalds    uint16_t usAddrDeadDisk[IPS_MAX_CHANNELS * (IPS_MAX_TARGETS + 1)];
6871da177e4SLinus Torvalds } IPS_ENQ, *PIPS_ENQ;
6881da177e4SLinus Torvalds 
6891da177e4SLinus Torvalds typedef struct {
6901da177e4SLinus Torvalds    uint8_t  ucInitiator;
6911da177e4SLinus Torvalds    uint8_t  ucParameters;
6921da177e4SLinus Torvalds    uint8_t  ucMiscFlag;
6931da177e4SLinus Torvalds    uint8_t  ucState;
6941da177e4SLinus Torvalds    uint32_t ulBlockCount;
6951da177e4SLinus Torvalds    uint8_t  ucDeviceId[28];
6961da177e4SLinus Torvalds } IPS_DEVSTATE, *PIPS_DEVSTATE;
6971da177e4SLinus Torvalds 
6981da177e4SLinus Torvalds typedef struct {
6991da177e4SLinus Torvalds    uint8_t  ucChn;
7001da177e4SLinus Torvalds    uint8_t  ucTgt;
7011da177e4SLinus Torvalds    uint16_t ucReserved;
7021da177e4SLinus Torvalds    uint32_t ulStartSect;
7031da177e4SLinus Torvalds    uint32_t ulNoOfSects;
7041da177e4SLinus Torvalds } IPS_CHUNK, *PIPS_CHUNK;
7051da177e4SLinus Torvalds 
7061da177e4SLinus Torvalds typedef struct {
7071da177e4SLinus Torvalds    uint16_t ucUserField;
7081da177e4SLinus Torvalds    uint8_t  ucState;
7091da177e4SLinus Torvalds    uint8_t  ucRaidCacheParam;
7101da177e4SLinus Torvalds    uint8_t  ucNoOfChunkUnits;
7111da177e4SLinus Torvalds    uint8_t  ucStripeSize;
7121da177e4SLinus Torvalds    uint8_t  ucParams;
7131da177e4SLinus Torvalds    uint8_t  ucReserved;
7141da177e4SLinus Torvalds    uint32_t ulLogDrvSize;
7151da177e4SLinus Torvalds    IPS_CHUNK chunk[IPS_MAX_CHUNKS];
7161da177e4SLinus Torvalds } IPS_LD, *PIPS_LD;
7171da177e4SLinus Torvalds 
7181da177e4SLinus Torvalds typedef struct {
7191da177e4SLinus Torvalds    uint8_t  board_disc[8];
7201da177e4SLinus Torvalds    uint8_t  processor[8];
7211da177e4SLinus Torvalds    uint8_t  ucNoChanType;
7221da177e4SLinus Torvalds    uint8_t  ucNoHostIntType;
7231da177e4SLinus Torvalds    uint8_t  ucCompression;
7241da177e4SLinus Torvalds    uint8_t  ucNvramType;
7251da177e4SLinus Torvalds    uint32_t ulNvramSize;
7261da177e4SLinus Torvalds } IPS_HARDWARE, *PIPS_HARDWARE;
7271da177e4SLinus Torvalds 
7281da177e4SLinus Torvalds typedef struct {
7291da177e4SLinus Torvalds    uint8_t        ucLogDriveCount;
7301da177e4SLinus Torvalds    uint8_t        ucDateD;
7311da177e4SLinus Torvalds    uint8_t        ucDateM;
7321da177e4SLinus Torvalds    uint8_t        ucDateY;
7331da177e4SLinus Torvalds    uint8_t        init_id[4];
7341da177e4SLinus Torvalds    uint8_t        host_id[12];
7351da177e4SLinus Torvalds    uint8_t        time_sign[8];
7361da177e4SLinus Torvalds    uint32_t       UserOpt;
7371da177e4SLinus Torvalds    uint16_t       user_field;
7381da177e4SLinus Torvalds    uint8_t        ucRebuildRate;
7391da177e4SLinus Torvalds    uint8_t        ucReserve;
7401da177e4SLinus Torvalds    IPS_HARDWARE   hardware_disc;
7411da177e4SLinus Torvalds    IPS_LD         logical_drive[IPS_MAX_LD];
7421da177e4SLinus Torvalds    IPS_DEVSTATE   dev[IPS_MAX_CHANNELS][IPS_MAX_TARGETS+1];
7431da177e4SLinus Torvalds    uint8_t        reserved[512];
7441da177e4SLinus Torvalds } IPS_CONF, *PIPS_CONF;
7451da177e4SLinus Torvalds 
7461da177e4SLinus Torvalds typedef struct {
7471da177e4SLinus Torvalds    uint32_t  signature;
7481da177e4SLinus Torvalds    uint8_t   reserved1;
7491da177e4SLinus Torvalds    uint8_t   adapter_slot;
7501da177e4SLinus Torvalds    uint16_t  adapter_type;
7511da177e4SLinus Torvalds    uint8_t   ctrl_bios[8];
7521da177e4SLinus Torvalds    uint8_t   versioning;                   /* 1 = Versioning Supported, else 0 */
7531da177e4SLinus Torvalds    uint8_t   version_mismatch;             /* 1 = Versioning MisMatch,  else 0 */
7541da177e4SLinus Torvalds    uint8_t   reserved2;
7551da177e4SLinus Torvalds    uint8_t   operating_system;
7561da177e4SLinus Torvalds    uint8_t   driver_high[4];
7571da177e4SLinus Torvalds    uint8_t   driver_low[4];
7581da177e4SLinus Torvalds    uint8_t   BiosCompatibilityID[8];
7591da177e4SLinus Torvalds    uint8_t   ReservedForOS2[8];
7601da177e4SLinus Torvalds    uint8_t   bios_high[4];                 /* Adapter's Flashed BIOS Version   */
7611da177e4SLinus Torvalds    uint8_t   bios_low[4];
7621da177e4SLinus Torvalds    uint8_t   adapter_order[16];            /* BIOS Telling us the Sort Order   */
7631da177e4SLinus Torvalds    uint8_t   Filler[60];
7641da177e4SLinus Torvalds } IPS_NVRAM_P5, *PIPS_NVRAM_P5;
7651da177e4SLinus Torvalds 
7661da177e4SLinus Torvalds /*--------------------------------------------------------------------------*/
7671da177e4SLinus Torvalds /* Data returned from a GetVersion Command                                  */
7681da177e4SLinus Torvalds /*--------------------------------------------------------------------------*/
7691da177e4SLinus Torvalds 
7701da177e4SLinus Torvalds                                              /* SubSystem Parameter[4]      */
7711da177e4SLinus Torvalds #define  IPS_GET_VERSION_SUPPORT 0x00018000  /* Mask for Versioning Support */
7721da177e4SLinus Torvalds 
7731da177e4SLinus Torvalds typedef struct
7741da177e4SLinus Torvalds {
7751da177e4SLinus Torvalds    uint32_t  revision;
7761da177e4SLinus Torvalds    uint8_t   bootBlkVersion[32];
7771da177e4SLinus Torvalds    uint8_t   bootBlkAttributes[4];
7781da177e4SLinus Torvalds    uint8_t   codeBlkVersion[32];
7791da177e4SLinus Torvalds    uint8_t   biosVersion[32];
7801da177e4SLinus Torvalds    uint8_t   biosAttributes[4];
7811da177e4SLinus Torvalds    uint8_t   compatibilityId[32];
7821da177e4SLinus Torvalds    uint8_t   reserved[4];
7831da177e4SLinus Torvalds } IPS_VERSION_DATA;
7841da177e4SLinus Torvalds 
7851da177e4SLinus Torvalds 
7861da177e4SLinus Torvalds typedef struct _IPS_SUBSYS {
7871da177e4SLinus Torvalds    uint32_t  param[128];
7881da177e4SLinus Torvalds } IPS_SUBSYS, *PIPS_SUBSYS;
7891da177e4SLinus Torvalds 
7901da177e4SLinus Torvalds /**
7911da177e4SLinus Torvalds  ** SCSI Structures
7921da177e4SLinus Torvalds  **/
7931da177e4SLinus Torvalds 
7941da177e4SLinus Torvalds /*
7951da177e4SLinus Torvalds  * Inquiry Data Format
7961da177e4SLinus Torvalds  */
7971da177e4SLinus Torvalds typedef struct {
7981da177e4SLinus Torvalds    uint8_t   DeviceType;
7991da177e4SLinus Torvalds    uint8_t   DeviceTypeQualifier;
8001da177e4SLinus Torvalds    uint8_t   Version;
8011da177e4SLinus Torvalds    uint8_t   ResponseDataFormat;
8021da177e4SLinus Torvalds    uint8_t   AdditionalLength;
8031da177e4SLinus Torvalds    uint8_t   Reserved;
8041da177e4SLinus Torvalds    uint8_t   Flags[2];
8051da177e4SLinus Torvalds    uint8_t   VendorId[8];
8061da177e4SLinus Torvalds    uint8_t   ProductId[16];
8071da177e4SLinus Torvalds    uint8_t   ProductRevisionLevel[4];
8081da177e4SLinus Torvalds    uint8_t   Reserved2;                                  /* Provides NULL terminator to name */
8091da177e4SLinus Torvalds } IPS_SCSI_INQ_DATA, *PIPS_SCSI_INQ_DATA;
8101da177e4SLinus Torvalds 
8111da177e4SLinus Torvalds /*
8121da177e4SLinus Torvalds  * Read Capacity Data Format
8131da177e4SLinus Torvalds  */
8141da177e4SLinus Torvalds typedef struct {
8151da177e4SLinus Torvalds    uint32_t lba;
8161da177e4SLinus Torvalds    uint32_t len;
8171da177e4SLinus Torvalds } IPS_SCSI_CAPACITY;
8181da177e4SLinus Torvalds 
8191da177e4SLinus Torvalds /*
8201da177e4SLinus Torvalds  * Request Sense Data Format
8211da177e4SLinus Torvalds  */
8221da177e4SLinus Torvalds typedef struct {
8231da177e4SLinus Torvalds    uint8_t  ResponseCode;
8241da177e4SLinus Torvalds    uint8_t  SegmentNumber;
8251da177e4SLinus Torvalds    uint8_t  Flags;
8261da177e4SLinus Torvalds    uint8_t  Information[4];
8271da177e4SLinus Torvalds    uint8_t  AdditionalLength;
8281da177e4SLinus Torvalds    uint8_t  CommandSpecific[4];
8291da177e4SLinus Torvalds    uint8_t  AdditionalSenseCode;
8301da177e4SLinus Torvalds    uint8_t  AdditionalSenseCodeQual;
8311da177e4SLinus Torvalds    uint8_t  FRUCode;
8321da177e4SLinus Torvalds    uint8_t  SenseKeySpecific[3];
8331da177e4SLinus Torvalds } IPS_SCSI_REQSEN;
8341da177e4SLinus Torvalds 
8351da177e4SLinus Torvalds /*
8361da177e4SLinus Torvalds  * Sense Data Format - Page 3
8371da177e4SLinus Torvalds  */
8381da177e4SLinus Torvalds typedef struct {
8391da177e4SLinus Torvalds    uint8_t  PageCode;
8401da177e4SLinus Torvalds    uint8_t  PageLength;
8411da177e4SLinus Torvalds    uint16_t TracksPerZone;
8421da177e4SLinus Torvalds    uint16_t AltSectorsPerZone;
8431da177e4SLinus Torvalds    uint16_t AltTracksPerZone;
8441da177e4SLinus Torvalds    uint16_t AltTracksPerVolume;
8451da177e4SLinus Torvalds    uint16_t SectorsPerTrack;
8461da177e4SLinus Torvalds    uint16_t BytesPerSector;
8471da177e4SLinus Torvalds    uint16_t Interleave;
8481da177e4SLinus Torvalds    uint16_t TrackSkew;
8491da177e4SLinus Torvalds    uint16_t CylinderSkew;
8501da177e4SLinus Torvalds    uint8_t  flags;
8511da177e4SLinus Torvalds    uint8_t  reserved[3];
8521da177e4SLinus Torvalds } IPS_SCSI_MODE_PAGE3;
8531da177e4SLinus Torvalds 
8541da177e4SLinus Torvalds /*
8551da177e4SLinus Torvalds  * Sense Data Format - Page 4
8561da177e4SLinus Torvalds  */
8571da177e4SLinus Torvalds typedef struct {
8581da177e4SLinus Torvalds    uint8_t  PageCode;
8591da177e4SLinus Torvalds    uint8_t  PageLength;
8601da177e4SLinus Torvalds    uint16_t CylindersHigh;
8611da177e4SLinus Torvalds    uint8_t  CylindersLow;
8621da177e4SLinus Torvalds    uint8_t  Heads;
8631da177e4SLinus Torvalds    uint16_t WritePrecompHigh;
8641da177e4SLinus Torvalds    uint8_t  WritePrecompLow;
8651da177e4SLinus Torvalds    uint16_t ReducedWriteCurrentHigh;
8661da177e4SLinus Torvalds    uint8_t  ReducedWriteCurrentLow;
8671da177e4SLinus Torvalds    uint16_t StepRate;
8681da177e4SLinus Torvalds    uint16_t LandingZoneHigh;
8691da177e4SLinus Torvalds    uint8_t  LandingZoneLow;
8701da177e4SLinus Torvalds    uint8_t  flags;
8711da177e4SLinus Torvalds    uint8_t  RotationalOffset;
8721da177e4SLinus Torvalds    uint8_t  Reserved;
8731da177e4SLinus Torvalds    uint16_t MediumRotationRate;
8741da177e4SLinus Torvalds    uint8_t  Reserved2[2];
8751da177e4SLinus Torvalds } IPS_SCSI_MODE_PAGE4;
8761da177e4SLinus Torvalds 
8771da177e4SLinus Torvalds /*
8781da177e4SLinus Torvalds  * Sense Data Format - Page 8
8791da177e4SLinus Torvalds  */
8801da177e4SLinus Torvalds typedef struct {
8811da177e4SLinus Torvalds    uint8_t  PageCode;
8821da177e4SLinus Torvalds    uint8_t  PageLength;
8831da177e4SLinus Torvalds    uint8_t  flags;
8841da177e4SLinus Torvalds    uint8_t  RetentPrio;
8851da177e4SLinus Torvalds    uint16_t DisPrefetchLen;
8861da177e4SLinus Torvalds    uint16_t MinPrefetchLen;
8871da177e4SLinus Torvalds    uint16_t MaxPrefetchLen;
8881da177e4SLinus Torvalds    uint16_t MaxPrefetchCeiling;
8891da177e4SLinus Torvalds } IPS_SCSI_MODE_PAGE8;
8901da177e4SLinus Torvalds 
8911da177e4SLinus Torvalds /*
8921da177e4SLinus Torvalds  * Sense Data Format - Block Descriptor (DASD)
8931da177e4SLinus Torvalds  */
8941da177e4SLinus Torvalds typedef struct {
8951da177e4SLinus Torvalds    uint32_t NumberOfBlocks;
8961da177e4SLinus Torvalds    uint8_t  DensityCode;
8971da177e4SLinus Torvalds    uint16_t BlockLengthHigh;
8981da177e4SLinus Torvalds    uint8_t  BlockLengthLow;
8991da177e4SLinus Torvalds } IPS_SCSI_MODE_PAGE_BLKDESC;
9001da177e4SLinus Torvalds 
9011da177e4SLinus Torvalds /*
9021da177e4SLinus Torvalds  * Sense Data Format - Mode Page Header
9031da177e4SLinus Torvalds  */
9041da177e4SLinus Torvalds typedef struct {
9051da177e4SLinus Torvalds    uint8_t  DataLength;
9061da177e4SLinus Torvalds    uint8_t  MediumType;
9071da177e4SLinus Torvalds    uint8_t  Reserved;
9081da177e4SLinus Torvalds    uint8_t  BlockDescLength;
9091da177e4SLinus Torvalds } IPS_SCSI_MODE_PAGE_HEADER;
9101da177e4SLinus Torvalds 
9111da177e4SLinus Torvalds typedef struct {
9121da177e4SLinus Torvalds    IPS_SCSI_MODE_PAGE_HEADER  hdr;
9131da177e4SLinus Torvalds    IPS_SCSI_MODE_PAGE_BLKDESC blkdesc;
9141da177e4SLinus Torvalds 
9151da177e4SLinus Torvalds    union {
9161da177e4SLinus Torvalds       IPS_SCSI_MODE_PAGE3 pg3;
9171da177e4SLinus Torvalds       IPS_SCSI_MODE_PAGE4 pg4;
9181da177e4SLinus Torvalds       IPS_SCSI_MODE_PAGE8 pg8;
9191da177e4SLinus Torvalds    } pdata;
9201da177e4SLinus Torvalds } IPS_SCSI_MODE_PAGE_DATA;
9211da177e4SLinus Torvalds 
9221da177e4SLinus Torvalds /*
9231da177e4SLinus Torvalds  * Scatter Gather list format
9241da177e4SLinus Torvalds  */
9251da177e4SLinus Torvalds typedef struct ips_sglist {
9261da177e4SLinus Torvalds    uint32_t address;
9271da177e4SLinus Torvalds    uint32_t length;
9281da177e4SLinus Torvalds } IPS_STD_SG_LIST;
9291da177e4SLinus Torvalds 
9301da177e4SLinus Torvalds typedef struct ips_enh_sglist {
9311da177e4SLinus Torvalds    uint32_t address_lo;
9321da177e4SLinus Torvalds    uint32_t address_hi;
9331da177e4SLinus Torvalds    uint32_t length;
9341da177e4SLinus Torvalds    uint32_t reserved;
9351da177e4SLinus Torvalds } IPS_ENH_SG_LIST;
9361da177e4SLinus Torvalds 
9371da177e4SLinus Torvalds typedef union {
9381da177e4SLinus Torvalds    void             *list;
9391da177e4SLinus Torvalds    IPS_STD_SG_LIST  *std_list;
9401da177e4SLinus Torvalds    IPS_ENH_SG_LIST  *enh_list;
9411da177e4SLinus Torvalds } IPS_SG_LIST;
9421da177e4SLinus Torvalds 
9431da177e4SLinus Torvalds typedef struct {
9441da177e4SLinus Torvalds    char *option_name;
9451da177e4SLinus Torvalds    int  *option_flag;
9461da177e4SLinus Torvalds    int   option_value;
9471da177e4SLinus Torvalds } IPS_OPTION;
9481da177e4SLinus Torvalds 
9491da177e4SLinus Torvalds /*
9501da177e4SLinus Torvalds  * Status Info
9511da177e4SLinus Torvalds  */
9521da177e4SLinus Torvalds typedef struct ips_stat {
9531da177e4SLinus Torvalds    uint32_t residue_len;
9541da177e4SLinus Torvalds    void     *scb_addr;
9551da177e4SLinus Torvalds    uint8_t  padding[12 - sizeof(void *)];
9561da177e4SLinus Torvalds } ips_stat_t;
9571da177e4SLinus Torvalds 
9581da177e4SLinus Torvalds /*
9591da177e4SLinus Torvalds  * SCB Queue Format
9601da177e4SLinus Torvalds  */
9611da177e4SLinus Torvalds typedef struct ips_scb_queue {
9621da177e4SLinus Torvalds    struct ips_scb *head;
9631da177e4SLinus Torvalds    struct ips_scb *tail;
9641da177e4SLinus Torvalds    int             count;
9651da177e4SLinus Torvalds } ips_scb_queue_t;
9661da177e4SLinus Torvalds 
9671da177e4SLinus Torvalds /*
9681da177e4SLinus Torvalds  * Wait queue_format
9691da177e4SLinus Torvalds  */
9701da177e4SLinus Torvalds typedef struct ips_wait_queue {
9711516b55dSHenne 	struct scsi_cmnd *head;
9721516b55dSHenne 	struct scsi_cmnd *tail;
9731da177e4SLinus Torvalds 	int count;
974ac6424b9SIngo Molnar } ips_wait_queue_entry_t;
9751da177e4SLinus Torvalds 
9761da177e4SLinus Torvalds typedef struct ips_copp_wait_item {
9771516b55dSHenne 	struct scsi_cmnd *scsi_cmd;
9781da177e4SLinus Torvalds 	struct ips_copp_wait_item *next;
9791da177e4SLinus Torvalds } ips_copp_wait_item_t;
9801da177e4SLinus Torvalds 
9811da177e4SLinus Torvalds typedef struct ips_copp_queue {
9821da177e4SLinus Torvalds    struct ips_copp_wait_item *head;
9831da177e4SLinus Torvalds    struct ips_copp_wait_item *tail;
9841da177e4SLinus Torvalds    int                        count;
9851da177e4SLinus Torvalds } ips_copp_queue_t;
9861da177e4SLinus Torvalds 
9871da177e4SLinus Torvalds /* forward decl for host structure */
9881da177e4SLinus Torvalds struct ips_ha;
9891da177e4SLinus Torvalds 
9901da177e4SLinus Torvalds typedef struct {
9911da177e4SLinus Torvalds    int       (*reset)(struct ips_ha *);
9921da177e4SLinus Torvalds    int       (*issue)(struct ips_ha *, struct ips_scb *);
9931da177e4SLinus Torvalds    int       (*isinit)(struct ips_ha *);
9941da177e4SLinus Torvalds    int       (*isintr)(struct ips_ha *);
9951da177e4SLinus Torvalds    int       (*init)(struct ips_ha *);
9961da177e4SLinus Torvalds    int       (*erasebios)(struct ips_ha *);
9971da177e4SLinus Torvalds    int       (*programbios)(struct ips_ha *, char *, uint32_t, uint32_t);
9981da177e4SLinus Torvalds    int       (*verifybios)(struct ips_ha *, char *, uint32_t, uint32_t);
9991da177e4SLinus Torvalds    void      (*statinit)(struct ips_ha *);
10001da177e4SLinus Torvalds    int       (*intr)(struct ips_ha *);
10011da177e4SLinus Torvalds    void      (*enableint)(struct ips_ha *);
10021da177e4SLinus Torvalds    uint32_t (*statupd)(struct ips_ha *);
10031da177e4SLinus Torvalds } ips_hw_func_t;
10041da177e4SLinus Torvalds 
10051da177e4SLinus Torvalds typedef struct ips_ha {
10061da177e4SLinus Torvalds    uint8_t            ha_id[IPS_MAX_CHANNELS+1];
10071da177e4SLinus Torvalds    uint32_t           dcdb_active[IPS_MAX_CHANNELS];
10081da177e4SLinus Torvalds    uint32_t           io_addr;            /* Base I/O address           */
10091da177e4SLinus Torvalds    uint8_t            ntargets;           /* Number of targets          */
10101da177e4SLinus Torvalds    uint8_t            nbus;               /* Number of buses            */
10111da177e4SLinus Torvalds    uint8_t            nlun;               /* Number of Luns             */
10121da177e4SLinus Torvalds    uint16_t           ad_type;            /* Adapter type               */
10131da177e4SLinus Torvalds    uint16_t           host_num;           /* Adapter number             */
10141da177e4SLinus Torvalds    uint32_t           max_xfer;           /* Maximum Xfer size          */
10151da177e4SLinus Torvalds    uint32_t           max_cmds;           /* Max concurrent commands    */
10161da177e4SLinus Torvalds    uint32_t           num_ioctl;          /* Number of Ioctls           */
10171da177e4SLinus Torvalds    ips_stat_t         sp;                 /* Status packer pointer      */
10181da177e4SLinus Torvalds    struct ips_scb    *scbs;               /* Array of all CCBS          */
10191da177e4SLinus Torvalds    struct ips_scb    *scb_freelist;       /* SCB free list              */
1020ac6424b9SIngo Molnar    ips_wait_queue_entry_t   scb_waitlist;       /* Pending SCB list           */
10211da177e4SLinus Torvalds    ips_copp_queue_t   copp_waitlist;      /* Pending PT list            */
10221da177e4SLinus Torvalds    ips_scb_queue_t    scb_activelist;     /* Active SCB list            */
10231da177e4SLinus Torvalds    IPS_IO_CMD        *dummy;              /* dummy command              */
10241da177e4SLinus Torvalds    IPS_ADAPTER       *adapt;              /* Adapter status area        */
10251da177e4SLinus Torvalds    IPS_LD_INFO       *logical_drive_info; /* Adapter Logical Drive Info */
10261da177e4SLinus Torvalds    dma_addr_t         logical_drive_info_dma_addr; /* Logical Drive Info DMA Address */
10271da177e4SLinus Torvalds    IPS_ENQ           *enq;                /* Adapter Enquiry data       */
10281da177e4SLinus Torvalds    IPS_CONF          *conf;               /* Adapter config data        */
10291da177e4SLinus Torvalds    IPS_NVRAM_P5      *nvram;              /* NVRAM page 5 data          */
10301da177e4SLinus Torvalds    IPS_SUBSYS        *subsys;             /* Subsystem parameters       */
10311da177e4SLinus Torvalds    char              *ioctl_data;         /* IOCTL data area            */
10321da177e4SLinus Torvalds    uint32_t           ioctl_datasize;     /* IOCTL data size            */
10331da177e4SLinus Torvalds    uint32_t           cmd_in_progress;    /* Current command in progress*/
10341da177e4SLinus Torvalds    int                flags;              /*                            */
10351da177e4SLinus Torvalds    uint8_t            waitflag;           /* are we waiting for cmd     */
10361da177e4SLinus Torvalds    uint8_t            active;
10371da177e4SLinus Torvalds    int                ioctl_reset;        /* IOCTL Requested Reset Flag */
10381da177e4SLinus Torvalds    uint16_t           reset_count;        /* number of resets           */
1039*f990bee3SArnd Bergmann    time64_t           last_ffdc;          /* last time we sent ffdc info*/
10401da177e4SLinus Torvalds    uint8_t            slot_num;           /* PCI Slot Number            */
10411da177e4SLinus Torvalds    int                ioctl_len;          /* size of ioctl buffer       */
10421da177e4SLinus Torvalds    dma_addr_t         ioctl_busaddr;      /* dma address of ioctl buffer*/
10431da177e4SLinus Torvalds    uint8_t            bios_version[8];    /* BIOS Revision              */
10441da177e4SLinus Torvalds    uint32_t           mem_addr;           /* Memory mapped address      */
10451da177e4SLinus Torvalds    uint32_t           io_len;             /* Size of IO Address         */
10461da177e4SLinus Torvalds    uint32_t           mem_len;            /* Size of memory address     */
10471da177e4SLinus Torvalds    char              __iomem *mem_ptr;    /* Memory mapped Ptr          */
10481da177e4SLinus Torvalds    char              __iomem *ioremap_ptr;/* ioremapped memory pointer  */
10491da177e4SLinus Torvalds    ips_hw_func_t      func;               /* hw function pointers       */
10501da177e4SLinus Torvalds    struct pci_dev    *pcidev;             /* PCI device handle          */
10511da177e4SLinus Torvalds    char              *flash_data;         /* Save Area for flash data   */
10521da177e4SLinus Torvalds    int                flash_len;          /* length of flash buffer     */
10531da177e4SLinus Torvalds    u32                flash_datasize;     /* Save Area for flash data size */
10541da177e4SLinus Torvalds    dma_addr_t         flash_busaddr;      /* dma address of flash buffer*/
10551da177e4SLinus Torvalds    dma_addr_t         enq_busaddr;        /* dma address of enq struct  */
10561da177e4SLinus Torvalds    uint8_t            requires_esl;       /* Requires an EraseStripeLock */
10571da177e4SLinus Torvalds } ips_ha_t;
10581da177e4SLinus Torvalds 
10591da177e4SLinus Torvalds typedef void (*ips_scb_callback) (ips_ha_t *, struct ips_scb *);
10601da177e4SLinus Torvalds 
10611da177e4SLinus Torvalds /*
10621da177e4SLinus Torvalds  * SCB Format
10631da177e4SLinus Torvalds  */
10641da177e4SLinus Torvalds typedef struct ips_scb {
10651da177e4SLinus Torvalds    IPS_HOST_COMMAND  cmd;
10661da177e4SLinus Torvalds    IPS_DCDB_TABLE    dcdb;
10671da177e4SLinus Torvalds    uint8_t           target_id;
10681da177e4SLinus Torvalds    uint8_t           bus;
10691da177e4SLinus Torvalds    uint8_t           lun;
10701da177e4SLinus Torvalds    uint8_t           cdb[12];
10711da177e4SLinus Torvalds    uint32_t          scb_busaddr;
10721da177e4SLinus Torvalds    uint32_t          old_data_busaddr;  // Obsolete, but kept for old utility compatibility
10731da177e4SLinus Torvalds    uint32_t          timeout;
10741da177e4SLinus Torvalds    uint8_t           basic_status;
10751da177e4SLinus Torvalds    uint8_t           extended_status;
10761da177e4SLinus Torvalds    uint8_t           breakup;
10771da177e4SLinus Torvalds    uint8_t           sg_break;
10781da177e4SLinus Torvalds    uint32_t          data_len;
10791da177e4SLinus Torvalds    uint32_t          sg_len;
10801da177e4SLinus Torvalds    uint32_t          flags;
10811da177e4SLinus Torvalds    uint32_t          op_code;
10821da177e4SLinus Torvalds    IPS_SG_LIST       sg_list;
10831516b55dSHenne    struct scsi_cmnd *scsi_cmd;
10841da177e4SLinus Torvalds    struct ips_scb   *q_next;
10851da177e4SLinus Torvalds    ips_scb_callback  callback;
10861da177e4SLinus Torvalds    uint32_t          sg_busaddr;
10871da177e4SLinus Torvalds    int               sg_count;
10881da177e4SLinus Torvalds    dma_addr_t        data_busaddr;
10891da177e4SLinus Torvalds } ips_scb_t;
10901da177e4SLinus Torvalds 
10911da177e4SLinus Torvalds typedef struct ips_scb_pt {
10921da177e4SLinus Torvalds    IPS_HOST_COMMAND  cmd;
10931da177e4SLinus Torvalds    IPS_DCDB_TABLE    dcdb;
10941da177e4SLinus Torvalds    uint8_t           target_id;
10951da177e4SLinus Torvalds    uint8_t           bus;
10961da177e4SLinus Torvalds    uint8_t           lun;
10971da177e4SLinus Torvalds    uint8_t           cdb[12];
10981da177e4SLinus Torvalds    uint32_t          scb_busaddr;
10991da177e4SLinus Torvalds    uint32_t          data_busaddr;
11001da177e4SLinus Torvalds    uint32_t          timeout;
11011da177e4SLinus Torvalds    uint8_t           basic_status;
11021da177e4SLinus Torvalds    uint8_t           extended_status;
11031da177e4SLinus Torvalds    uint16_t          breakup;
11041da177e4SLinus Torvalds    uint32_t          data_len;
11051da177e4SLinus Torvalds    uint32_t          sg_len;
11061da177e4SLinus Torvalds    uint32_t          flags;
11071da177e4SLinus Torvalds    uint32_t          op_code;
11081da177e4SLinus Torvalds    IPS_SG_LIST      *sg_list;
11091516b55dSHenne    struct scsi_cmnd *scsi_cmd;
11101da177e4SLinus Torvalds    struct ips_scb   *q_next;
11111da177e4SLinus Torvalds    ips_scb_callback  callback;
11121da177e4SLinus Torvalds } ips_scb_pt_t;
11131da177e4SLinus Torvalds 
11141da177e4SLinus Torvalds /*
11151da177e4SLinus Torvalds  * Passthru Command Format
11161da177e4SLinus Torvalds  */
11171da177e4SLinus Torvalds typedef struct {
11181da177e4SLinus Torvalds    uint8_t       CoppID[4];
11191da177e4SLinus Torvalds    uint32_t      CoppCmd;
11201da177e4SLinus Torvalds    uint32_t      PtBuffer;
11211da177e4SLinus Torvalds    uint8_t      *CmdBuffer;
11221da177e4SLinus Torvalds    uint32_t      CmdBSize;
11231da177e4SLinus Torvalds    ips_scb_pt_t  CoppCP;
11241da177e4SLinus Torvalds    uint32_t      TimeOut;
11251da177e4SLinus Torvalds    uint8_t       BasicStatus;
11261da177e4SLinus Torvalds    uint8_t       ExtendedStatus;
11271da177e4SLinus Torvalds    uint8_t       AdapterType;
11281da177e4SLinus Torvalds    uint8_t       reserved;
11291da177e4SLinus Torvalds } ips_passthru_t;
11301da177e4SLinus Torvalds 
11311da177e4SLinus Torvalds #endif
11321da177e4SLinus Torvalds 
11331da177e4SLinus Torvalds /* The Version Information below gets created by SED during the build process. */
11341da177e4SLinus Torvalds /* Do not modify the next line; it's what SED is looking for to do the insert. */
11351da177e4SLinus Torvalds /* Version Info                                                                */
11361da177e4SLinus Torvalds /*************************************************************************
11371da177e4SLinus Torvalds *
11381da177e4SLinus Torvalds * VERSION.H -- version numbers and copyright notices in various formats
11391da177e4SLinus Torvalds *
11401da177e4SLinus Torvalds *************************************************************************/
11411da177e4SLinus Torvalds 
11421da177e4SLinus Torvalds #define IPS_VER_MAJOR 7
11438c8fdc59SBernhard Walle #define IPS_VER_MAJOR_STRING __stringify(IPS_VER_MAJOR)
1144c1a15468SJack Hammer #define IPS_VER_MINOR 12
11458c8fdc59SBernhard Walle #define IPS_VER_MINOR_STRING __stringify(IPS_VER_MINOR)
11468c8fdc59SBernhard Walle #define IPS_VER_BUILD 05
11478c8fdc59SBernhard Walle #define IPS_VER_BUILD_STRING __stringify(IPS_VER_BUILD)
11488c8fdc59SBernhard Walle #define IPS_VER_STRING IPS_VER_MAJOR_STRING "." \
11498c8fdc59SBernhard Walle 		IPS_VER_MINOR_STRING "." IPS_VER_BUILD_STRING
11501da177e4SLinus Torvalds #define IPS_RELEASE_ID 0x00020000
1151c1a15468SJack Hammer #define IPS_BUILD_IDENT 761
11521da177e4SLinus Torvalds #define IPS_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002. All Rights Reserved."
11531da177e4SLinus Torvalds #define IPS_ADAPTECCOPYRIGHT_STRING "(c) Copyright Adaptec, Inc. 2002 to 2004. All Rights Reserved."
11541da177e4SLinus Torvalds #define IPS_DELLCOPYRIGHT_STRING "(c) Copyright Dell 2004. All Rights Reserved."
11551da177e4SLinus Torvalds #define IPS_NT_LEGALCOPYRIGHT_STRING "(C) Copyright IBM Corp. 1994, 2002."
11561da177e4SLinus Torvalds 
11571da177e4SLinus Torvalds /* Version numbers for various adapters */
11581da177e4SLinus Torvalds #define IPS_VER_SERVERAID1 "2.25.01"
11591da177e4SLinus Torvalds #define IPS_VER_SERVERAID2 "2.88.13"
11601da177e4SLinus Torvalds #define IPS_VER_NAVAJO "2.88.13"
11611da177e4SLinus Torvalds #define IPS_VER_SERVERAID3 "6.10.24"
1162c1a15468SJack Hammer #define IPS_VER_SERVERAID4H "7.12.02"
1163c1a15468SJack Hammer #define IPS_VER_SERVERAID4MLx "7.12.02"
1164c1a15468SJack Hammer #define IPS_VER_SARASOTA "7.12.02"
1165c1a15468SJack Hammer #define IPS_VER_MARCO "7.12.02"
1166c1a15468SJack Hammer #define IPS_VER_SEBRING "7.12.02"
1167c1a15468SJack Hammer #define IPS_VER_KEYWEST "7.12.02"
11681da177e4SLinus Torvalds 
116925985edcSLucas De Marchi /* Compatibility IDs for various adapters */
11701da177e4SLinus Torvalds #define IPS_COMPAT_UNKNOWN ""
11711da177e4SLinus Torvalds #define IPS_COMPAT_CURRENT "KW710"
11721da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID1 "2.25.01"
11731da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID2 "2.88.13"
11741da177e4SLinus Torvalds #define IPS_COMPAT_NAVAJO  "2.88.13"
11751da177e4SLinus Torvalds #define IPS_COMPAT_KIOWA "2.88.13"
11761da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID3H  "SB610"
11771da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID3L  "SB610"
11781da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID4H  "KW710"
11791da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID4M  "KW710"
11801da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID4L  "KW710"
11811da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID4Mx "KW710"
11821da177e4SLinus Torvalds #define IPS_COMPAT_SERVERAID4Lx "KW710"
11831da177e4SLinus Torvalds #define IPS_COMPAT_SARASOTA     "KW710"
11841da177e4SLinus Torvalds #define IPS_COMPAT_MARCO        "KW710"
11851da177e4SLinus Torvalds #define IPS_COMPAT_SEBRING      "KW710"
11861da177e4SLinus Torvalds #define IPS_COMPAT_TAMPA        "KW710"
11871da177e4SLinus Torvalds #define IPS_COMPAT_KEYWEST      "KW710"
11881da177e4SLinus Torvalds #define IPS_COMPAT_BIOS "KW710"
11891da177e4SLinus Torvalds 
11901da177e4SLinus Torvalds #define IPS_COMPAT_MAX_ADAPTER_TYPE 18
11911da177e4SLinus Torvalds #define IPS_COMPAT_ID_LENGTH 8
11921da177e4SLinus Torvalds 
11931da177e4SLinus Torvalds #define IPS_DEFINE_COMPAT_TABLE(tablename) \
11941da177e4SLinus Torvalds    char tablename[IPS_COMPAT_MAX_ADAPTER_TYPE] [IPS_COMPAT_ID_LENGTH] = { \
11951da177e4SLinus Torvalds       IPS_COMPAT_UNKNOWN, \
11961da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID1, \
11971da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID2, \
11981da177e4SLinus Torvalds       IPS_COMPAT_NAVAJO, \
11991da177e4SLinus Torvalds       IPS_COMPAT_KIOWA, \
12001da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID3H, \
12011da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID3L, \
12021da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID4H, \
12031da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID4M, \
12041da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID4L, \
12051da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID4Mx, \
12061da177e4SLinus Torvalds       IPS_COMPAT_SERVERAID4Lx, \
12071da177e4SLinus Torvalds       IPS_COMPAT_SARASOTA,         /* one-channel variety of SARASOTA */  \
12081da177e4SLinus Torvalds       IPS_COMPAT_SARASOTA,         /* two-channel variety of SARASOTA */  \
12091da177e4SLinus Torvalds       IPS_COMPAT_MARCO, \
12101da177e4SLinus Torvalds       IPS_COMPAT_SEBRING, \
12111da177e4SLinus Torvalds       IPS_COMPAT_TAMPA, \
12121da177e4SLinus Torvalds       IPS_COMPAT_KEYWEST \
12131da177e4SLinus Torvalds    }
1214