ips.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:39k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*****************************************************************************/
  2. /* ips.h -- driver for the IBM ServeRAID controller                          */
  3. /*                                                                           */
  4. /* Written By: Keith Mitchell, IBM Corporation                               */
  5. /*                                                                           */
  6. /* Copyright (C) 1999 IBM Corporation                                        */
  7. /*                                                                           */
  8. /* This program is free software; you can redistribute it and/or modify      */
  9. /* it under the terms of the GNU General Public License as published by      */
  10. /* the Free Software Foundation; either version 2 of the License, or         */
  11. /* (at your option) any later version.                                       */
  12. /*                                                                           */
  13. /* This program is distributed in the hope that it will be useful,           */
  14. /* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
  15. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
  16. /* GNU General Public License for more details.                              */
  17. /*                                                                           */
  18. /* NO WARRANTY                                                               */
  19. /* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR        */
  20. /* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT      */
  21. /* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,      */
  22. /* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is    */
  23. /* solely responsible for determining the appropriateness of using and       */
  24. /* distributing the Program and assumes all risks associated with its        */
  25. /* exercise of rights under this Agreement, including but not limited to     */
  26. /* the risks and costs of program errors, damage to or loss of data,         */
  27. /* programs or equipment, and unavailability or interruption of operations.  */
  28. /*                                                                           */
  29. /* DISCLAIMER OF LIABILITY                                                   */
  30. /* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY   */
  31. /* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL        */
  32. /* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND   */
  33. /* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR     */
  34. /* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE    */
  35. /* USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED  */
  36. /* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES             */
  37. /*                                                                           */
  38. /* You should have received a copy of the GNU General Public License         */
  39. /* along with this program; if not, write to the Free Software               */
  40. /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  41. /*                                                                           */
  42. /* Bugs/Comments/Suggestions should be mailed to:                            */
  43. /*      ipslinux@us.ibm.com                                                  */
  44. /*                                                                           */
  45. /*****************************************************************************/
  46. #ifndef _IPS_H_
  47.    #define _IPS_H_
  48.    #include <asm/uaccess.h>
  49.    #include <asm/io.h>
  50.    /* type definitions */
  51.    #define u_int8_t  uint8_t
  52.    #define u_int16_t uint16_t
  53.    #define u_int32_t uint32_t
  54.    #define u_int64_t uint64_t
  55.    /* Prototypes */
  56.    extern int ips_detect(Scsi_Host_Template *);
  57.    extern int ips_release(struct Scsi_Host *);
  58.    extern int ips_eh_abort(Scsi_Cmnd *);
  59.    extern int ips_eh_reset(Scsi_Cmnd *);
  60.    extern int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *));
  61.    extern int ips_biosparam(Disk *, kdev_t, int *);
  62.    extern const char * ips_info(struct Scsi_Host *);
  63.    extern void do_ipsintr(int, void *, struct pt_regs *);
  64.    /*
  65.     * Some handy macros
  66.     */
  67.    #ifndef LinuxVersionCode
  68.       #define LinuxVersionCode(x,y,z)  (((x)<<16)+((y)<<8)+(z))
  69.    #endif
  70.    #define IPS_HA(x)                   ((ips_ha_t *) x->hostdata)
  71.    #define IPS_COMMAND_ID(ha, scb)     (int) (scb - ha->scbs)
  72.    #define IPS_IS_TROMBONE(ha)         (((ha->device_id == IPS_DEVICEID_COPPERHEAD) && 
  73.                                          (ha->revision_id >= IPS_REVID_TROMBONE32) && 
  74.                                          (ha->revision_id <= IPS_REVID_TROMBONE64)) ? 1 : 0)
  75.    #define IPS_IS_CLARINET(ha)         (((ha->device_id == IPS_DEVICEID_COPPERHEAD) && 
  76.                                          (ha->revision_id >= IPS_REVID_CLARINETP1) && 
  77.                                          (ha->revision_id <= IPS_REVID_CLARINETP3)) ? 1 : 0)
  78.    #define IPS_IS_MORPHEUS(ha)         (ha->device_id == IPS_DEVICEID_MORPHEUS)
  79.    #define IPS_USE_I2O_DELIVER(ha)     ((IPS_IS_MORPHEUS(ha) || 
  80.                                          (IPS_IS_TROMBONE(ha) && 
  81.                                           (ips_force_i2o))) ? 1 : 0)
  82.    #define IPS_USE_I2O_STATUS(ha)      (IPS_IS_MORPHEUS(ha))
  83.    #define IPS_USE_MEMIO(ha)           ((IPS_IS_MORPHEUS(ha) || 
  84.                                          ((IPS_IS_TROMBONE(ha) || IPS_IS_CLARINET(ha)) && 
  85.                                           (ips_force_memio))) ? 1 : 0)
  86.    #ifndef VIRT_TO_BUS
  87.       #define VIRT_TO_BUS(x)           (unsigned int)virt_to_bus((void *) x)
  88.    #endif
  89.    #ifndef UDELAY
  90.       #define UDELAY udelay
  91.    #endif
  92.    #ifndef MDELAY
  93.       #define MDELAY mdelay
  94.    #endif
  95.    #ifndef verify_area_20
  96.       #define verify_area_20(t,a,sz)   (0) /* success */
  97.    #endif
  98.    #ifndef DECLARE_MUTEX_LOCKED
  99.       #define DECLARE_MUTEX_LOCKED(sem) struct semaphore sem = MUTEX_LOCKED;
  100.    #endif
  101.    
  102.    /*
  103.     * Lock macros
  104.     */
  105.    #define IPS_SCB_LOCK(cpu_flags)      spin_lock_irqsave(&ha->scb_lock, cpu_flags)
  106.    #define IPS_SCB_UNLOCK(cpu_flags)    spin_unlock_irqrestore(&ha->scb_lock, cpu_flags)
  107.    #define IPS_QUEUE_LOCK(queue)        spin_lock_irqsave(&(queue)->lock, (queue)->cpu_flags)
  108.    #define IPS_QUEUE_UNLOCK(queue)      spin_unlock_irqrestore(&(queue)->lock, (queue)->cpu_flags)
  109.    #define IPS_HA_LOCK(cpu_flags)       spin_lock_irqsave(&ha->ips_lock, cpu_flags)
  110.    #define IPS_HA_UNLOCK(cpu_flags)     spin_unlock_irqrestore(&ha->ips_lock, cpu_flags)
  111.    /*
  112.     * Adapter address map equates
  113.     */
  114.    #define IPS_REG_HISR                 0x08    /* Host Interrupt Status Reg   */
  115.    #define IPS_REG_CCSAR                0x10    /* Cmd Channel System Addr Reg */
  116.    #define IPS_REG_CCCR                 0x14    /* Cmd Channel Control Reg     */
  117.    #define IPS_REG_SQHR                 0x20    /* Status Q Head Reg           */
  118.    #define IPS_REG_SQTR                 0x24    /* Status Q Tail Reg           */
  119.    #define IPS_REG_SQER                 0x28    /* Status Q End Reg            */
  120.    #define IPS_REG_SQSR                 0x2C    /* Status Q Start Reg          */
  121.    #define IPS_REG_SCPR                 0x05    /* Subsystem control port reg  */
  122.    #define IPS_REG_ISPR                 0x06    /* interrupt status port reg   */
  123.    #define IPS_REG_CBSP                 0x07    /* CBSP register               */
  124.    #define IPS_REG_FLAP                 0x18    /* Flash address port          */
  125.    #define IPS_REG_FLDP                 0x1C    /* Flash data port             */
  126.    #define IPS_REG_NDAE                 0x38    /* Anaconda 64 NDAE Register   */
  127.    #define IPS_REG_I2O_INMSGQ           0x40    /* I2O Inbound Message Queue   */
  128.    #define IPS_REG_I2O_OUTMSGQ          0x44    /* I2O Outbound Message Queue  */
  129.    #define IPS_REG_I2O_HIR              0x30    /* I2O Interrupt Status        */
  130.    #define IPS_REG_I960_IDR             0x20    /* i960 Inbound Doorbell       */
  131.    #define IPS_REG_I960_MSG0            0x18    /* i960 Outbound Reg 0         */
  132.    #define IPS_REG_I960_MSG1            0x1C    /* i960 Outbound Reg 1         */
  133.    #define IPS_REG_I960_OIMR            0x34    /* i960 Oubound Int Mask Reg   */
  134.    /*
  135.     * Adapter register bit equates
  136.     */
  137.    #define IPS_BIT_GHI                  0x04    /* HISR General Host Interrupt */
  138.    #define IPS_BIT_SQO                  0x02    /* HISR Status Q Overflow      */
  139.    #define IPS_BIT_SCE                  0x01    /* HISR Status Channel Enqueue */
  140.    #define IPS_BIT_SEM                  0x08    /* CCCR Semaphore Bit          */
  141.    #define IPS_BIT_ILE                  0x10    /* CCCR ILE Bit                */
  142.    #define IPS_BIT_START_CMD            0x101A  /* CCCR Start Command Channel  */
  143.    #define IPS_BIT_START_STOP           0x0002  /* CCCR Start/Stop Bit         */
  144.    #define IPS_BIT_RST                  0x80    /* SCPR Reset Bit              */
  145.    #define IPS_BIT_EBM                  0x02    /* SCPR Enable Bus Master      */
  146.    #define IPS_BIT_EI                   0x80    /* HISR Enable Interrupts      */
  147.    #define IPS_BIT_OP                   0x01    /* OP bit in CBSP              */
  148.    #define IPS_BIT_I2O_OPQI             0x08    /* General Host Interrupt      */
  149.    #define IPS_BIT_I960_MSG0I           0x01    /* Message Register 0 Interrupt*/
  150.    #define IPS_BIT_I960_MSG1I           0x02    /* Message Register 1 Interrupt*/
  151.    /*
  152.     * Adapter Command ID Equates
  153.     */
  154.    #define IPS_CMD_GET_LD_INFO          0x19
  155.    #define IPS_CMD_GET_SUBSYS           0x40
  156.    #define IPS_CMD_READ_CONF            0x38
  157.    #define IPS_CMD_RW_NVRAM_PAGE        0xBC
  158.    #define IPS_CMD_READ                 0x02
  159.    #define IPS_CMD_WRITE                0x03
  160.    #define IPS_CMD_FFDC                 0xD7
  161.    #define IPS_CMD_ENQUIRY              0x05
  162.    #define IPS_CMD_FLUSH                0x0A
  163.    #define IPS_CMD_READ_SG              0x82
  164.    #define IPS_CMD_WRITE_SG             0x83
  165.    #define IPS_CMD_DCDB                 0x04
  166.    #define IPS_CMD_DCDB_SG              0x84
  167.    #define IPS_CMD_CONFIG_SYNC          0x58
  168.    #define IPS_CMD_ERROR_TABLE          0x17
  169.    #define IPS_CMD_RW_BIOSFW            0x22
  170.    /*
  171.     * Adapter Equates
  172.     */
  173.    #define IPS_CSL                      0xFF
  174.    #define IPS_POCL                     0x30
  175.    #define IPS_NORM_STATE               0x00
  176.    #define IPS_MAX_ADAPTERS             16
  177.    #define IPS_MAX_IOCTL                1
  178.    #define IPS_MAX_IOCTL_QUEUE          8
  179.    #define IPS_MAX_QUEUE                128
  180.    #define IPS_BLKSIZE                  512
  181.    #define IPS_MAX_SG                   17
  182.    #define IPS_MAX_LD                   8
  183.    #define IPS_MAX_CHANNELS             4
  184.    #define IPS_MAX_TARGETS              15
  185.    #define IPS_MAX_CHUNKS               16
  186.    #define IPS_MAX_CMDS                 128
  187.    #define IPS_MAX_XFER                 0x10000
  188.    #define IPS_NVRAM_P5_SIG             0xFFDDBB99
  189.    #define IPS_MAX_POST_BYTES           0x02
  190.    #define IPS_MAX_CONFIG_BYTES         0x02
  191.    #define IPS_GOOD_POST_STATUS         0x80
  192.    #define IPS_SEM_TIMEOUT              2000
  193.    #define IPS_IOCTL_COMMAND            0x0D
  194.    #define IPS_IOCTL_NEW_COMMAND        0x81
  195.    #define IPS_INTR_ON                  0
  196.    #define IPS_INTR_IORL                1
  197.    #define IPS_INTR_HAL                 2
  198.    #define IPS_ADAPTER_ID               0xF
  199.    #define IPS_VENDORID                 0x1014
  200.    #define IPS_DEVICEID_COPPERHEAD      0x002E
  201.    #define IPS_DEVICEID_MORPHEUS        0x01BD
  202.    #define IPS_SUBDEVICEID_4M           0x01BE
  203.    #define IPS_SUBDEVICEID_4L           0x01BF
  204.    #define IPS_SUBDEVICEID_4MX          0x0208
  205.    #define IPS_SUBDEVICEID_4LX          0x020E
  206.    #define IPS_IOCTL_SIZE               8192
  207.    #define IPS_STATUS_SIZE              4
  208.    #define IPS_STATUS_Q_SIZE            (IPS_MAX_CMDS+1) * IPS_STATUS_SIZE
  209.    #define IPS_IMAGE_SIZE               500 * 1024
  210.    #define IPS_MEMMAP_SIZE              128
  211.    #define IPS_ONE_MSEC                 1
  212.    #define IPS_ONE_SEC                  1000
  213.    /*
  214.     * Geometry Settings
  215.     */
  216.    #define IPS_COMP_HEADS               128
  217.    #define IPS_COMP_SECTORS             32
  218.    #define IPS_NORM_HEADS               254
  219.    #define IPS_NORM_SECTORS             63
  220.    /*
  221.     * Adapter Basic Status Codes
  222.     */
  223.    #define IPS_BASIC_STATUS_MASK        0xFF
  224.    #define IPS_GSC_STATUS_MASK          0x0F
  225.    #define IPS_CMD_SUCCESS              0x00
  226.    #define IPS_CMD_RECOVERED_ERROR      0x01
  227.    #define IPS_INVAL_OPCO               0x03
  228.    #define IPS_INVAL_CMD_BLK            0x04
  229.    #define IPS_INVAL_PARM_BLK           0x05
  230.    #define IPS_BUSY                     0x08
  231.    #define IPS_CMD_CMPLT_WERROR         0x0C
  232.    #define IPS_LD_ERROR                 0x0D
  233.    #define IPS_CMD_TIMEOUT              0x0E
  234.    #define IPS_PHYS_DRV_ERROR           0x0F
  235.    /*
  236.     * Adapter Extended Status Equates
  237.     */
  238.    #define IPS_ERR_SEL_TO               0xF0
  239.    #define IPS_ERR_OU_RUN               0xF2
  240.    #define IPS_ERR_HOST_RESET           0xF7
  241.    #define IPS_ERR_DEV_RESET            0xF8
  242.    #define IPS_ERR_RECOVERY             0xFC
  243.    #define IPS_ERR_CKCOND               0xFF
  244.    /*
  245.     * Operating System Defines
  246.     */
  247.    #define IPS_OS_WINDOWS_NT            0x01
  248.    #define IPS_OS_NETWARE               0x02
  249.    #define IPS_OS_OPENSERVER            0x03
  250.    #define IPS_OS_UNIXWARE              0x04
  251.    #define IPS_OS_SOLARIS               0x05
  252.    #define IPS_OS_OS2                   0x06
  253.    #define IPS_OS_LINUX                 0x07
  254.    #define IPS_OS_FREEBSD               0x08
  255.    /*
  256.     * Adapter Revision ID's
  257.     */
  258.    #define IPS_REVID_SERVERAID          0x02
  259.    #define IPS_REVID_NAVAJO             0x03
  260.    #define IPS_REVID_SERVERAID2         0x04
  261.    #define IPS_REVID_CLARINETP1         0x05
  262.    #define IPS_REVID_CLARINETP2         0x07
  263.    #define IPS_REVID_CLARINETP3         0x0D
  264.    #define IPS_REVID_TROMBONE32         0x0F
  265.    #define IPS_REVID_TROMBONE64         0x10
  266.    /*
  267.     * NVRAM Page 5 Adapter Defines
  268.     */
  269.    #define IPS_ADTYPE_SERVERAID         0x01
  270.    #define IPS_ADTYPE_SERVERAID2        0x02
  271.    #define IPS_ADTYPE_NAVAJO            0x03
  272.    #define IPS_ADTYPE_KIOWA             0x04
  273.    #define IPS_ADTYPE_SERVERAID3        0x05
  274.    #define IPS_ADTYPE_SERVERAID3L       0x06
  275.    #define IPS_ADTYPE_SERVERAID4H       0x07
  276.    #define IPS_ADTYPE_SERVERAID4M       0x08
  277.    #define IPS_ADTYPE_SERVERAID4L       0x09
  278.    #define IPS_ADTYPE_SERVERAID4MX      0x0A
  279.    #define IPS_ADTYPE_SERVERAID4LX      0x0B
  280.    /*
  281.     * Adapter Command/Status Packet Definitions
  282.     */
  283.    #define IPS_SUCCESS                  0x01 /* Successfully completed       */
  284.    #define IPS_SUCCESS_IMM              0x02 /* Success - Immediately        */
  285.    #define IPS_FAILURE                  0x04 /* Completed with Error         */
  286.    /*
  287.     * Logical Drive Equates
  288.     */
  289.    #define IPS_LD_OFFLINE               0x02
  290.    #define IPS_LD_OKAY                  0x03
  291.    #define IPS_LD_FREE                  0x00
  292.    #define IPS_LD_SYS                   0x06
  293.    #define IPS_LD_CRS                   0x24
  294.    /*
  295.     * DCDB Table Equates
  296.     */
  297.    #define IPS_NO_DISCONNECT            0x00
  298.    #define IPS_DISCONNECT_ALLOWED       0x80
  299.    #define IPS_NO_AUTO_REQSEN           0x40
  300.    #define IPS_DATA_NONE                0x00
  301.    #define IPS_DATA_UNK                 0x00
  302.    #define IPS_DATA_IN                  0x01
  303.    #define IPS_DATA_OUT                 0x02
  304.    #define IPS_TRANSFER64K              0x08
  305.    #define IPS_NOTIMEOUT                0x00
  306.    #define IPS_TIMEOUT10                0x10
  307.    #define IPS_TIMEOUT60                0x20
  308.    #define IPS_TIMEOUT20M               0x30
  309.    /*
  310.     * SCSI Inquiry Data Flags
  311.     */
  312.    #define IPS_SCSI_INQ_TYPE_DASD       0x00
  313.    #define IPS_SCSI_INQ_TYPE_PROCESSOR  0x03
  314.    #define IPS_SCSI_INQ_LU_CONNECTED    0x00
  315.    #define IPS_SCSI_INQ_RD_REV2         0x02
  316.    #define IPS_SCSI_INQ_REV2            0x02
  317.    #define IPS_SCSI_INQ_REV3            0x03
  318.    #define IPS_SCSI_INQ_Address16       0x01
  319.    #define IPS_SCSI_INQ_Address32       0x02
  320.    #define IPS_SCSI_INQ_MedChanger      0x08
  321.    #define IPS_SCSI_INQ_MultiPort       0x10
  322.    #define IPS_SCSI_INQ_EncServ         0x40
  323.    #define IPS_SCSI_INQ_SoftReset       0x01
  324.    #define IPS_SCSI_INQ_CmdQue          0x02
  325.    #define IPS_SCSI_INQ_Linked          0x08
  326.    #define IPS_SCSI_INQ_Sync            0x10
  327.    #define IPS_SCSI_INQ_WBus16          0x20
  328.    #define IPS_SCSI_INQ_WBus32          0x40
  329.    #define IPS_SCSI_INQ_RelAdr          0x80
  330.    /*
  331.     * SCSI Request Sense Data Flags
  332.     */
  333.    #define IPS_SCSI_REQSEN_VALID        0x80
  334.    #define IPS_SCSI_REQSEN_CURRENT_ERR  0x70
  335.    #define IPS_SCSI_REQSEN_NO_SENSE     0x00
  336.    /*
  337.     * SCSI Mode Page Equates
  338.     */
  339.    #define IPS_SCSI_MP3_SoftSector      0x01
  340.    #define IPS_SCSI_MP3_HardSector      0x02
  341.    #define IPS_SCSI_MP3_Removeable      0x04
  342.    #define IPS_SCSI_MP3_AllocateSurface 0x08
  343.    /*
  344.     * Configuration Structure Flags
  345.     */
  346.    #define IPS_CFG_USEROPT_UPDATECOUNT(cfg)   (((cfg)->UserOpt & 0xffff000) >> 16)
  347.    #define IPS_CFG_USEROPT_CONCURSTART(cfg)   (((cfg)->UserOpt & 0xf000) >> 12)
  348.    #define IPS_CFG_USEROPT_STARTUPDELAY(cfg)  (((cfg)->UserOpt & 0xf00) >> 8)
  349.    #define IPS_CFG_USEROPT_REARRANGE(cfg)     ((cfg)->UserOpt & 0x80)
  350.    #define IPS_CFG_USEROPT_CDBOOT(cfg)        ((cfg)->UserOpt & 0x40)
  351.    #define IPS_CFG_USEROPT_CLUSTER(cfg)       ((cfg)->UserOpt & 0x20)
  352.    /*
  353.     * Host adapter Flags (bit numbers)
  354.     */
  355.    #define IPS_IN_INTR                  0
  356.    #define IPS_IN_ABORT                 1
  357.    #define IPS_IN_RESET                 2
  358.    /*
  359.     * SCB Flags
  360.     */
  361.    #define IPS_SCB_ACTIVE               0x00001
  362.    #define IPS_SCB_WAITING              0x00002
  363.    /*
  364.     * Passthru stuff
  365.     */
  366.    #define IPS_COPPUSRCMD              (('C'<<8) | 65)
  367.    #define IPS_COPPIOCCMD              (('C'<<8) | 66)
  368.    #define IPS_NUMCTRLS                (('C'<<8) | 68)
  369.    #define IPS_CTRLINFO                (('C'<<8) | 69)
  370.    #define IPS_FLASHBIOS               (('C'<<8) | 70)
  371.    /* time oriented stuff */
  372.    #define IPS_IS_LEAP_YEAR(y)           (((y % 4 == 0) && ((y % 100 != 0) || (y % 400 == 0))) ? 1 : 0)
  373.    #define IPS_NUM_LEAP_YEARS_THROUGH(y) ((y) / 4 - (y) / 100 + (y) / 400)
  374.    #define IPS_SECS_MIN                 60
  375.    #define IPS_SECS_HOUR                3600
  376.    #define IPS_SECS_8HOURS              28800
  377.    #define IPS_SECS_DAY                 86400
  378.    #define IPS_DAYS_NORMAL_YEAR         365
  379.    #define IPS_DAYS_LEAP_YEAR           366
  380.    #define IPS_EPOCH_YEAR               1970
  381.    /*
  382.     * Scsi_Host Template
  383.     */
  384. #if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
  385.  #define IPS {                            
  386.     next : NULL,                          
  387.     module : NULL,                        
  388.     proc_info : NULL,                     
  389.     proc_dir : NULL,                      
  390.     name : NULL,                          
  391.     detect : ips_detect,                  
  392.     release : ips_release,                
  393.     info : ips_info,                      
  394.     command : NULL,                       
  395.     queuecommand : ips_queue,             
  396.     eh_strategy_handler : NULL,           
  397.     eh_abort_handler : ips_eh_abort,      
  398.     eh_device_reset_handler : NULL,       
  399.     eh_bus_reset_handler : NULL,          
  400.     eh_host_reset_handler : ips_eh_reset, 
  401.     abort : NULL,                         
  402.     reset : NULL,                         
  403.     slave_attach : NULL,                  
  404.     bios_param : ips_biosparam,           
  405.     can_queue : 0,                        
  406.     this_id: -1,                          
  407.     sg_tablesize : IPS_MAX_SG,            
  408.     cmd_per_lun: 16,                      
  409.     present : 0,                          
  410.     unchecked_isa_dma : 0,                
  411.     use_clustering : ENABLE_CLUSTERING,   
  412.     use_new_eh_code : 1                   
  413. }
  414. #else
  415.  #define IPS {                            
  416.     next : NULL,                          
  417.     module : NULL,                        
  418.     proc_info : NULL,                     
  419.     name : NULL,                          
  420.     detect : ips_detect,                  
  421.     release : ips_release,                
  422.     info : ips_info,                      
  423.     command : NULL,                       
  424.     queuecommand : ips_queue,             
  425.     eh_strategy_handler : NULL,           
  426.     eh_abort_handler : ips_eh_abort,      
  427.     eh_device_reset_handler : NULL,       
  428.     eh_bus_reset_handler : NULL,          
  429.     eh_host_reset_handler : ips_eh_reset, 
  430.     abort : NULL,                         
  431.     reset : NULL,                         
  432.     slave_attach : NULL,                  
  433.     bios_param : ips_biosparam,           
  434.     can_queue : 0,                        
  435.     this_id: -1,                          
  436.     sg_tablesize : IPS_MAX_SG,            
  437.     cmd_per_lun: 16,                      
  438.     present : 0,                          
  439.     unchecked_isa_dma : 0,                
  440.     use_clustering : ENABLE_CLUSTERING,   
  441.     use_new_eh_code : 1                   
  442. }
  443. #endif
  444. /*
  445.  * IBM PCI Raid Command Formats
  446.  */
  447. typedef struct {
  448.    u_int8_t  op_code;
  449.    u_int8_t  command_id;
  450.    u_int8_t  log_drv;
  451.    u_int8_t  sg_count;
  452.    u_int32_t lba;
  453.    u_int32_t sg_addr;
  454.    u_int16_t sector_count;
  455.    u_int16_t reserved;
  456.    u_int32_t ccsar;
  457.    u_int32_t cccr;
  458. } IPS_IO_CMD, *PIPS_IO_CMD;
  459. typedef struct {
  460.    u_int8_t  op_code;
  461.    u_int8_t  command_id;
  462.    u_int16_t reserved;
  463.    u_int32_t reserved2;
  464.    u_int32_t buffer_addr;
  465.    u_int32_t reserved3;
  466.    u_int32_t ccsar;
  467.    u_int32_t cccr;
  468. } IPS_LD_CMD, *PIPS_LD_CMD;
  469. typedef struct {
  470.    u_int8_t  op_code;
  471.    u_int8_t  command_id;
  472.    u_int8_t  reserved;
  473.    u_int8_t  reserved2;
  474.    u_int32_t reserved3;
  475.    u_int32_t buffer_addr;
  476.    u_int32_t reserved4;
  477. } IPS_IOCTL_CMD, *PIPS_IOCTL_CMD;
  478. typedef struct {
  479.    u_int8_t  op_code;
  480.    u_int8_t  command_id;
  481.    u_int16_t reserved;
  482.    u_int32_t reserved2;
  483.    u_int32_t dcdb_address;
  484.    u_int32_t reserved3;
  485.    u_int32_t ccsar;
  486.    u_int32_t cccr;
  487. } IPS_DCDB_CMD, *PIPS_DCDB_CMD;
  488. typedef struct {
  489.    u_int8_t  op_code;
  490.    u_int8_t  command_id;
  491.    u_int8_t  channel;
  492.    u_int8_t  source_target;
  493.    u_int32_t reserved;
  494.    u_int32_t reserved2;
  495.    u_int32_t reserved3;
  496.    u_int32_t ccsar;
  497.    u_int32_t cccr;
  498. } IPS_CS_CMD, *PIPS_CS_CMD;
  499. typedef struct {
  500.    u_int8_t  op_code;
  501.    u_int8_t  command_id;
  502.    u_int8_t  log_drv;
  503.    u_int8_t  control;
  504.    u_int32_t reserved;
  505.    u_int32_t reserved2;
  506.    u_int32_t reserved3;
  507.    u_int32_t ccsar;
  508.    u_int32_t cccr;
  509. } IPS_US_CMD, *PIPS_US_CMD;
  510. typedef struct {
  511.    u_int8_t  op_code;
  512.    u_int8_t  command_id;
  513.    u_int8_t  reserved;
  514.    u_int8_t  state;
  515.    u_int32_t reserved2;
  516.    u_int32_t reserved3;
  517.    u_int32_t reserved4;
  518.    u_int32_t ccsar;
  519.    u_int32_t cccr;
  520. } IPS_FC_CMD, *PIPS_FC_CMD;
  521. typedef struct {
  522.    u_int8_t  op_code;
  523.    u_int8_t  command_id;
  524.    u_int8_t  reserved;
  525.    u_int8_t  desc;
  526.    u_int32_t reserved2;
  527.    u_int32_t buffer_addr;
  528.    u_int32_t reserved3;
  529.    u_int32_t ccsar;
  530.    u_int32_t cccr;
  531. } IPS_STATUS_CMD, *PIPS_STATUS_CMD;
  532. typedef struct {
  533.    u_int8_t  op_code;
  534.    u_int8_t  command_id;
  535.    u_int8_t  page;
  536.    u_int8_t  write;
  537.    u_int32_t reserved;
  538.    u_int32_t buffer_addr;
  539.    u_int32_t reserved2;
  540.    u_int32_t ccsar;
  541.    u_int32_t cccr;
  542. } IPS_NVRAM_CMD, *PIPS_NVRAM_CMD;
  543. typedef struct {
  544.    u_int8_t  op_code;
  545.    u_int8_t  command_id;
  546.    u_int8_t  reset_count;
  547.    u_int8_t  reset_type;
  548.    u_int8_t  second;
  549.    u_int8_t  minute;
  550.    u_int8_t  hour;
  551.    u_int8_t  day;
  552.    u_int8_t  reserved1[4];
  553.    u_int8_t  month;
  554.    u_int8_t  yearH;
  555.    u_int8_t  yearL;
  556.    u_int8_t  reserved2;
  557. } IPS_FFDC_CMD, *PIPS_FFDC_CMD;
  558. typedef struct {
  559.    u_int8_t  op_code;
  560.    u_int8_t  command_id;
  561.    u_int8_t  type;
  562.    u_int8_t  direction;
  563.    u_int32_t count;
  564.    u_int32_t buffer_addr;
  565.    u_int8_t  total_packets;
  566.    u_int8_t  packet_num;
  567.    u_int16_t reserved;
  568. } IPS_FLASHFW_CMD, *PIPS_FLASHFW_CMD;
  569. typedef struct {
  570.    u_int8_t  op_code;
  571.    u_int8_t  command_id;
  572.    u_int8_t  type;
  573.    u_int8_t  direction;
  574.    u_int32_t count;
  575.    u_int32_t buffer_addr;
  576.    u_int32_t offset;
  577. } IPS_FLASHBIOS_CMD, *PIPS_FLASHBIOS_CMD;
  578. typedef union {
  579.    IPS_IO_CMD        basic_io;
  580.    IPS_LD_CMD        logical_info;
  581.    IPS_IOCTL_CMD     ioctl_info;
  582.    IPS_DCDB_CMD      dcdb;
  583.    IPS_CS_CMD        config_sync;
  584.    IPS_US_CMD        unlock_stripe;
  585.    IPS_FC_CMD        flush_cache;
  586.    IPS_STATUS_CMD    status;
  587.    IPS_NVRAM_CMD     nvram;
  588.    IPS_FFDC_CMD      ffdc;
  589.    IPS_FLASHFW_CMD    flashfw;
  590.    IPS_FLASHBIOS_CMD  flashbios;
  591. } IPS_HOST_COMMAND, *PIPS_HOST_COMMAND;
  592. typedef struct {
  593.    u_int8_t  logical_id;
  594.    u_int8_t  reserved;
  595.    u_int8_t  raid_level;
  596.    u_int8_t  state;
  597.    u_int32_t sector_count;
  598. } IPS_DRIVE_INFO, *PIPS_DRIVE_INFO;
  599. typedef struct {
  600.    u_int8_t       no_of_log_drive;
  601.    u_int8_t       reserved[3];
  602.    IPS_DRIVE_INFO drive_info[IPS_MAX_LD];
  603. } IPS_LD_INFO, *PIPS_LD_INFO;
  604. typedef struct {
  605.    u_int8_t   device_address;
  606.    u_int8_t   cmd_attribute;
  607.    u_int16_t  transfer_length;
  608.    u_int32_t  buffer_pointer;
  609.    u_int8_t   cdb_length;
  610.    u_int8_t   sense_length;
  611.    u_int8_t   sg_count;
  612.    u_int8_t   reserved;
  613.    u_int8_t   scsi_cdb[12];
  614.    u_int8_t   sense_info[64];
  615.    u_int8_t   scsi_status;
  616.    u_int8_t   reserved2[3];
  617. } IPS_DCDB_TABLE, *PIPS_DCDB_TABLE;
  618. typedef union {
  619.    struct {
  620.       volatile u_int8_t  reserved;
  621.       volatile u_int8_t  command_id;
  622.       volatile u_int8_t  basic_status;
  623.       volatile u_int8_t  extended_status;
  624.    } fields;
  625.    volatile u_int32_t    value;
  626. } IPS_STATUS, *PIPS_STATUS;
  627. typedef struct {
  628.    IPS_STATUS           status[IPS_MAX_CMDS + 1];
  629.    volatile PIPS_STATUS p_status_start;
  630.    volatile PIPS_STATUS p_status_end;
  631.    volatile PIPS_STATUS p_status_tail;
  632.    volatile u_int32_t   hw_status_start;
  633.    volatile u_int32_t   hw_status_tail;
  634.    IPS_LD_INFO          logical_drive_info;
  635. } IPS_ADAPTER, *PIPS_ADAPTER;
  636. typedef struct {
  637.    u_int8_t  ucLogDriveCount;
  638.    u_int8_t  ucMiscFlag;
  639.    u_int8_t  ucSLTFlag;
  640.    u_int8_t  ucBSTFlag;
  641.    u_int8_t  ucPwrChgCnt;
  642.    u_int8_t  ucWrongAdrCnt;
  643.    u_int8_t  ucUnidentCnt;
  644.    u_int8_t  ucNVramDevChgCnt;
  645.    u_int8_t  CodeBlkVersion[8];
  646.    u_int8_t  BootBlkVersion[8];
  647.    u_int32_t ulDriveSize[IPS_MAX_LD];
  648.    u_int8_t  ucConcurrentCmdCount;
  649.    u_int8_t  ucMaxPhysicalDevices;
  650.    u_int16_t usFlashRepgmCount;
  651.    u_int8_t  ucDefunctDiskCount;
  652.    u_int8_t  ucRebuildFlag;
  653.    u_int8_t  ucOfflineLogDrvCount;
  654.    u_int8_t  ucCriticalDrvCount;
  655.    u_int16_t usConfigUpdateCount;
  656.    u_int8_t  ucBlkFlag;
  657.    u_int8_t  reserved;
  658.    u_int16_t usAddrDeadDisk[IPS_MAX_CHANNELS * IPS_MAX_TARGETS];
  659. } IPS_ENQ, *PIPS_ENQ;
  660. typedef struct {
  661.    u_int8_t  ucInitiator;
  662.    u_int8_t  ucParameters;
  663.    u_int8_t  ucMiscFlag;
  664.    u_int8_t  ucState;
  665.    u_int32_t ulBlockCount;
  666.    u_int8_t  ucDeviceId[28];
  667. } IPS_DEVSTATE, *PIPS_DEVSTATE;
  668. typedef struct {
  669.    u_int8_t  ucChn;
  670.    u_int8_t  ucTgt;
  671.    u_int16_t ucReserved;
  672.    u_int32_t ulStartSect;
  673.    u_int32_t ulNoOfSects;
  674. } IPS_CHUNK, *PIPS_CHUNK;
  675. typedef struct {
  676.    u_int16_t ucUserField;
  677.    u_int8_t  ucState;
  678.    u_int8_t  ucRaidCacheParam;
  679.    u_int8_t  ucNoOfChunkUnits;
  680.    u_int8_t  ucStripeSize;
  681.    u_int8_t  ucParams;
  682.    u_int8_t  ucReserved;
  683.    u_int32_t ulLogDrvSize;
  684.    IPS_CHUNK chunk[IPS_MAX_CHUNKS];
  685. } IPS_LD, *PIPS_LD;
  686. typedef struct {
  687.    u_int8_t  board_disc[8];
  688.    u_int8_t  processor[8];
  689.    u_int8_t  ucNoChanType;
  690.    u_int8_t  ucNoHostIntType;
  691.    u_int8_t  ucCompression;
  692.    u_int8_t  ucNvramType;
  693.    u_int32_t ulNvramSize;
  694. } IPS_HARDWARE, *PIPS_HARDWARE;
  695. typedef struct {
  696.    u_int8_t       ucLogDriveCount;
  697.    u_int8_t       ucDateD;
  698.    u_int8_t       ucDateM;
  699.    u_int8_t       ucDateY;
  700.    u_int8_t       init_id[4];
  701.    u_int8_t       host_id[12];
  702.    u_int8_t       time_sign[8];
  703.    u_int32_t      UserOpt;
  704.    u_int16_t      user_field;
  705.    u_int8_t       ucRebuildRate;
  706.    u_int8_t       ucReserve;
  707.    IPS_HARDWARE   hardware_disc;
  708.    IPS_LD         logical_drive[IPS_MAX_LD];
  709.    IPS_DEVSTATE   dev[IPS_MAX_CHANNELS][IPS_MAX_TARGETS+1];
  710.    u_int8_t       reserved[512];
  711. } IPS_CONF, *PIPS_CONF;
  712. typedef struct {
  713.    u_int32_t  signature;
  714.    u_int8_t   reserved;
  715.    u_int8_t   adapter_slot;
  716.    u_int16_t  adapter_type;
  717.    u_int8_t   bios_high[4];
  718.    u_int8_t   bios_low[4];
  719.    u_int16_t  reserved2;
  720.    u_int8_t   reserved3;
  721.    u_int8_t   operating_system;
  722.    u_int8_t   driver_high[4];
  723.    u_int8_t   driver_low[4];
  724.    u_int8_t   reserved4[100];
  725. } IPS_NVRAM_P5, *PIPS_NVRAM_P5;
  726. typedef struct _IPS_SUBSYS {
  727.    u_int32_t  param[128];
  728. } IPS_SUBSYS, *PIPS_SUBSYS;
  729. /**
  730.  ** SCSI Structures
  731.  **/
  732. /*
  733.  * Inquiry Data Format
  734.  */
  735. typedef struct {
  736.    u_int8_t  DeviceType;
  737.    u_int8_t  DeviceTypeQualifier;
  738.    u_int8_t  Version;
  739.    u_int8_t  ResponseDataFormat;
  740.    u_int8_t  AdditionalLength;
  741.    u_int8_t  Reserved;
  742.    u_int8_t  Flags[2];
  743.    char      VendorId[8];
  744.    char      ProductId[16];
  745.    char      ProductRevisionLevel[4];
  746. } IPS_SCSI_INQ_DATA, *PIPS_SCSI_INQ_DATA;
  747. /*
  748.  * Read Capacity Data Format
  749.  */
  750. typedef struct {
  751.    u_int32_t lba;
  752.    u_int32_t len;
  753. } IPS_SCSI_CAPACITY;
  754. /*
  755.  * Request Sense Data Format
  756.  */
  757. typedef struct {
  758.    u_int8_t  ResponseCode;
  759.    u_int8_t  SegmentNumber;
  760.    u_int8_t  Flags;
  761.    u_int8_t  Information[4];
  762.    u_int8_t  AdditionalLength;
  763.    u_int8_t  CommandSpecific[4];
  764.    u_int8_t  AdditionalSenseCode;
  765.    u_int8_t  AdditionalSenseCodeQual;
  766.    u_int8_t  FRUCode;
  767.    u_int8_t  SenseKeySpecific[3];
  768. } IPS_SCSI_REQSEN;
  769. /*
  770.  * Sense Data Format - Page 3
  771.  */
  772. typedef struct {
  773.    u_int8_t  PageCode;
  774.    u_int8_t  PageLength;
  775.    u_int16_t TracksPerZone;
  776.    u_int16_t AltSectorsPerZone;
  777.    u_int16_t AltTracksPerZone;
  778.    u_int16_t AltTracksPerVolume;
  779.    u_int16_t SectorsPerTrack;
  780.    u_int16_t BytesPerSector;
  781.    u_int16_t Interleave;
  782.    u_int16_t TrackSkew;
  783.    u_int16_t CylinderSkew;
  784.    u_int8_t  flags;
  785.    u_int8_t  reserved[3];
  786. } IPS_SCSI_MODE_PAGE3;
  787. /*
  788.  * Sense Data Format - Page 4
  789.  */
  790. typedef struct {
  791.    u_int8_t  PageCode;
  792.    u_int8_t  PageLength;
  793.    u_int16_t CylindersHigh;
  794.    u_int8_t  CylindersLow;
  795.    u_int8_t  Heads;
  796.    u_int16_t WritePrecompHigh;
  797.    u_int8_t  WritePrecompLow;
  798.    u_int16_t ReducedWriteCurrentHigh;
  799.    u_int8_t  ReducedWriteCurrentLow;
  800.    u_int16_t StepRate;
  801.    u_int16_t LandingZoneHigh;
  802.    u_int8_t  LandingZoneLow;
  803.    u_int8_t  flags;
  804.    u_int8_t  RotationalOffset;
  805.    u_int8_t  Reserved;
  806.    u_int16_t MediumRotationRate;
  807.    u_int8_t  Reserved2[2];
  808. } IPS_SCSI_MODE_PAGE4;
  809. /*
  810.  * Sense Data Format - Block Descriptor (DASD)
  811.  */
  812. typedef struct {
  813.    u_int32_t NumberOfBlocks;
  814.    u_int8_t  DensityCode;
  815.    u_int16_t BlockLengthHigh;
  816.    u_int8_t  BlockLengthLow;
  817. } IPS_SCSI_MODE_PAGE_BLKDESC;
  818. /*
  819.  * Sense Data Format - Mode Page Header
  820.  */
  821. typedef struct {
  822.    u_int8_t  DataLength;
  823.    u_int8_t  MediumType;
  824.    u_int8_t  Reserved;
  825.    u_int8_t  BlockDescLength;
  826. } IPS_SCSI_MODE_PAGE_HEADER;
  827. typedef struct {
  828.    IPS_SCSI_MODE_PAGE_HEADER  hdr;
  829.    IPS_SCSI_MODE_PAGE_BLKDESC blkdesc;
  830.    union {
  831.       IPS_SCSI_MODE_PAGE3 pg3;
  832.       IPS_SCSI_MODE_PAGE4 pg4;
  833.    } pdata;
  834. } IPS_SCSI_MODE_PAGE_DATA;
  835. /*
  836.  * Scatter Gather list format
  837.  */
  838. typedef struct ips_sglist {
  839.    u_int32_t address;
  840.    u_int32_t length;
  841. } IPS_SG_LIST, *PIPS_SG_LIST;
  842. typedef struct _IPS_INFOSTR {
  843.    char *buffer;
  844.    int   length;
  845.    int   offset;
  846.    int   pos;
  847.    int   localpos;
  848. } IPS_INFOSTR;
  849. typedef struct {
  850.    char *option_name;
  851.    int  *option_flag;
  852.    int   option_value;
  853. } IPS_OPTION;
  854. typedef struct {
  855.    void             *userbuffer;
  856.    u_int32_t         usersize;
  857.    void             *kernbuffer;
  858.    u_int32_t         kernsize;
  859.    void             *ha;
  860.    void             *SC;
  861.    void             *pt;
  862.    struct semaphore *sem;
  863.    u_int32_t         offset;
  864.    u_int32_t         retcode;
  865. } IPS_FLASH_DATA;
  866. /*
  867.  * Status Info
  868.  */
  869. typedef struct ips_stat {
  870.    u_int32_t residue_len;
  871.    void     *scb_addr;
  872.    u_int8_t  padding[12 - sizeof(void *)];
  873. } ips_stat_t;
  874. /*
  875.  * SCB Queue Format
  876.  */
  877. typedef struct ips_scb_queue {
  878.    struct ips_scb *head;
  879.    struct ips_scb *tail;
  880.    u_int32_t       count;
  881.    u_int32_t       cpu_flags;
  882.    spinlock_t      lock;
  883. } ips_scb_queue_t;
  884. /*
  885.  * Wait queue_format
  886.  */
  887. typedef struct ips_wait_queue {
  888.    Scsi_Cmnd      *head;
  889.    Scsi_Cmnd      *tail;
  890.    u_int32_t       count;
  891.    u_int32_t       cpu_flags;
  892.    spinlock_t      lock;
  893. } ips_wait_queue_t;
  894. typedef struct ips_copp_wait_item {
  895.    Scsi_Cmnd                 *scsi_cmd;
  896.    struct semaphore          *sem;
  897.    struct ips_copp_wait_item *next;
  898. } ips_copp_wait_item_t;
  899. typedef struct ips_copp_queue {
  900.    struct ips_copp_wait_item *head;
  901.    struct ips_copp_wait_item *tail;
  902.    u_int32_t                  count;
  903.    u_int32_t                  cpu_flags;
  904.    spinlock_t                 lock;
  905. } ips_copp_queue_t;
  906. /* forward decl for host structure */
  907. struct ips_ha;
  908. typedef struct {
  909.    int       (*reset)(struct ips_ha *);
  910.    int       (*issue)(struct ips_ha *, struct ips_scb *);
  911.    int       (*isinit)(struct ips_ha *);
  912.    int       (*isintr)(struct ips_ha *);
  913.    int       (*init)(struct ips_ha *);
  914.    int       (*erasebios)(struct ips_ha *);
  915.    int       (*programbios)(struct ips_ha *, char *, u_int32_t, u_int32_t);
  916.    int       (*verifybios)(struct ips_ha *, char *, u_int32_t, u_int32_t);
  917.    void      (*statinit)(struct ips_ha *);
  918.    void      (*intr)(struct ips_ha *);
  919.    void      (*enableint)(struct ips_ha *);
  920.    u_int32_t (*statupd)(struct ips_ha *);
  921. } ips_hw_func_t;
  922. typedef struct ips_ha {
  923.    u_int8_t           ha_id[IPS_MAX_CHANNELS+1];
  924.    u_int32_t          dcdb_active[IPS_MAX_CHANNELS];
  925.    u_int32_t          io_addr;            /* Base I/O address           */
  926.    u_int8_t           irq;                /* IRQ for adapter            */
  927.    u_int8_t           ntargets;           /* Number of targets          */
  928.    u_int8_t           nbus;               /* Number of buses            */
  929.    u_int8_t           nlun;               /* Number of Luns             */
  930.    u_int16_t          ad_type;            /* Adapter type               */
  931.    u_int16_t          host_num;           /* Adapter number             */
  932.    u_int32_t          max_xfer;           /* Maximum Xfer size          */
  933.    u_int32_t          max_cmds;           /* Max concurrent commands    */
  934.    u_int32_t          num_ioctl;          /* Number of Ioctls           */
  935.    ips_stat_t         sp;                 /* Status packer pointer      */
  936.    struct ips_scb    *scbs;               /* Array of all CCBS          */
  937.    struct ips_scb    *scb_freelist;       /* SCB free list              */
  938.    ips_wait_queue_t   scb_waitlist;       /* Pending SCB list           */
  939.    ips_copp_queue_t   copp_waitlist;      /* Pending PT list            */
  940.    ips_scb_queue_t    scb_activelist;     /* Active SCB list            */
  941.    IPS_IO_CMD        *dummy;              /* dummy command              */
  942.    IPS_ADAPTER       *adapt;              /* Adapter status area        */
  943.    IPS_ENQ           *enq;                /* Adapter Enquiry data       */
  944.    IPS_CONF          *conf;               /* Adapter config data        */
  945.    IPS_NVRAM_P5      *nvram;              /* NVRAM page 5 data          */
  946.    IPS_SUBSYS        *subsys;             /* Subsystem parameters       */
  947.    char              *ioctl_data;         /* IOCTL data area            */
  948.    u_int32_t          ioctl_datasize;     /* IOCTL data size            */
  949.    u_int32_t          cmd_in_progress;    /* Current command in progress*/
  950.    unsigned long      flags;              /* HA flags                   */
  951.    u_int8_t           waitflag;           /* are we waiting for cmd     */
  952.    u_int8_t           active;
  953.    u_int16_t          reset_count;        /* number of resets           */
  954.    u_int32_t          last_ffdc;          /* last time we sent ffdc info*/
  955.    u_int8_t           revision_id;        /* Revision level             */
  956.    u_int16_t          device_id;          /* PCI device ID              */
  957.    u_int8_t           slot_num;           /* PCI Slot Number            */
  958.    u_int16_t          subdevice_id;       /* Subsystem device ID        */
  959.    u_int8_t           ioctl_order;        /* Number of pages in ioctl   */
  960.    u_int8_t           reserved2;          /* Empty                      */
  961.    u_int8_t           bios_version[8];    /* BIOS Revision              */
  962.    u_int32_t          mem_addr;           /* Memory mapped address      */
  963.    u_int32_t          io_len;             /* Size of IO Address         */
  964.    u_int32_t          mem_len;            /* Size of memory address     */
  965.    char              *mem_ptr;            /* Memory mapped Ptr          */
  966.    char              *ioremap_ptr;        /* ioremapped memory pointer  */
  967.    ips_hw_func_t      func;               /* hw function pointers       */
  968.    struct pci_dev    *pcidev;             /* PCI device handle          */
  969.    spinlock_t         scb_lock;
  970.    spinlock_t         copp_lock;
  971.    spinlock_t         ips_lock;
  972.    struct semaphore   ioctl_sem;          /* Semaphore for new IOCTL's  */
  973.    struct semaphore   flash_ioctl_sem;    /* Semaphore for Flashing     */
  974.    char              *save_ioctl_data;    /* Save Area for ioctl_data   */
  975.    u8                 save_ioctl_order;   /* Save Area for ioctl_order  */
  976.    u32                save_ioctl_datasize;/* Save Area for ioctl_datasize */
  977. } ips_ha_t;
  978. typedef void (*ips_scb_callback) (ips_ha_t *, struct ips_scb *);
  979. /*
  980.  * SCB Format
  981.  */
  982. typedef struct ips_scb {
  983.    IPS_HOST_COMMAND  cmd;
  984.    IPS_DCDB_TABLE    dcdb;
  985.    u_int8_t          target_id;
  986.    u_int8_t          bus;
  987.    u_int8_t          lun;
  988.    u_int8_t          cdb[12];
  989.    u_int32_t         scb_busaddr;
  990.    u_int32_t         data_busaddr;
  991.    u_int32_t         timeout;
  992.    u_int8_t          basic_status;
  993.    u_int8_t          extended_status;
  994.    u_int8_t          breakup;
  995.    u_int8_t          sg_break;
  996.    u_int32_t         data_len;
  997.    u_int32_t         sg_len;
  998.    u_int32_t         flags;
  999.    u_int32_t         op_code;
  1000.    IPS_SG_LIST      *sg_list;
  1001.    Scsi_Cmnd        *scsi_cmd;
  1002.    struct ips_scb   *q_next;
  1003.    ips_scb_callback  callback;
  1004.    struct semaphore *sem;
  1005. } ips_scb_t;
  1006. typedef struct ips_scb_pt {
  1007.    IPS_HOST_COMMAND  cmd;
  1008.    IPS_DCDB_TABLE    dcdb;
  1009.    u_int8_t          target_id;
  1010.    u_int8_t          bus;
  1011.    u_int8_t          lun;
  1012.    u_int8_t          cdb[12];
  1013.    u_int32_t         scb_busaddr;
  1014.    u_int32_t         data_busaddr;
  1015.    u_int32_t         timeout;
  1016.    u_int8_t          basic_status;
  1017.    u_int8_t          extended_status;
  1018.    u_int16_t         breakup;
  1019.    u_int32_t         data_len;
  1020.    u_int32_t         sg_len;
  1021.    u_int32_t         flags;
  1022.    u_int32_t         op_code;
  1023.    IPS_SG_LIST      *sg_list;
  1024.    Scsi_Cmnd        *scsi_cmd;
  1025.    struct ips_scb   *q_next;
  1026.    ips_scb_callback  callback;
  1027. } ips_scb_pt_t;
  1028. /*
  1029.  * Passthru Command Format
  1030.  */
  1031. typedef struct {
  1032.    u_int8_t      CoppID[4];
  1033.    u_int32_t     CoppCmd;
  1034.    u_int32_t     PtBuffer;
  1035.    u_int8_t     *CmdBuffer;
  1036.    u_int32_t     CmdBSize;
  1037.    ips_scb_pt_t  CoppCP;
  1038.    u_int32_t     TimeOut;
  1039.    u_int8_t      BasicStatus;
  1040.    u_int8_t      ExtendedStatus;
  1041.    u_int16_t     reserved;
  1042. } ips_passthru_t;
  1043. #endif
  1044. /*
  1045.  * Overrides for Emacs so that we almost follow Linus's tabbing style.
  1046.  * Emacs will notice this stuff at the end of the file and automatically
  1047.  * adjust the settings for this buffer only.  This must remain at the end
  1048.  * of the file.
  1049.  * ---------------------------------------------------------------------------
  1050.  * Local variables:
  1051.  * c-indent-level: 2
  1052.  * c-brace-imaginary-offset: 0
  1053.  * c-brace-offset: -2
  1054.  * c-argdecl-indent: 2
  1055.  * c-label-offset: -2
  1056.  * c-continued-statement-offset: 2
  1057.  * c-continued-brace-offset: 0
  1058.  * indent-tabs-mode: nil
  1059.  * tab-width: 8
  1060.  * End:
  1061.  */