xref: /freebsd/sys/dev/pms/freebsd/driver/ini/src/agdef.h (revision 2ff63af9b88c7413b7d71715b5532625752a248e)
14e1bc9a0SAchim Leubner /*******************************************************************************
24e1bc9a0SAchim Leubner  **
34e1bc9a0SAchim Leubner  **
44e1bc9a0SAchim Leubner *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
54e1bc9a0SAchim Leubner  *
64e1bc9a0SAchim Leubner *Redistribution and use in source and binary forms, with or without modification, are permitted provided
74e1bc9a0SAchim Leubner *that the following conditions are met:
84e1bc9a0SAchim Leubner *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
94e1bc9a0SAchim Leubner *2. Redistributions in binary form must reproduce the above copyright notice,
104e1bc9a0SAchim Leubner *this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
114e1bc9a0SAchim Leubner *
124e1bc9a0SAchim Leubner *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
134e1bc9a0SAchim Leubner *
144e1bc9a0SAchim Leubner *INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
154e1bc9a0SAchim Leubner *ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
164e1bc9a0SAchim Leubner *SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
174e1bc9a0SAchim Leubner *OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
184e1bc9a0SAchim Leubner *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
194e1bc9a0SAchim Leubner *THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
204e1bc9a0SAchim Leubner *
214e1bc9a0SAchim Leubner *
224e1bc9a0SAchim Leubner **
234e1bc9a0SAchim Leubner *******************************************************************************/
244e1bc9a0SAchim Leubner  /******************************************************************************
254e1bc9a0SAchim Leubner Note:
264e1bc9a0SAchim Leubner *******************************************************************************
274e1bc9a0SAchim Leubner Module Name:
284e1bc9a0SAchim Leubner   agdef.h
294e1bc9a0SAchim Leubner Abstract:
304e1bc9a0SAchim Leubner   Linux iSCSI/FC Initiator driver module constant define header file
314e1bc9a0SAchim Leubner Authors:
324e1bc9a0SAchim Leubner   EW - Yiding(Eddie) Wang
334e1bc9a0SAchim Leubner Environment:
344e1bc9a0SAchim Leubner   Kernel or loadable module
354e1bc9a0SAchim Leubner 
364e1bc9a0SAchim Leubner Version Control Information:
374e1bc9a0SAchim Leubner   $ver. 1.0.0
384e1bc9a0SAchim Leubner 
394e1bc9a0SAchim Leubner Revision History:
404e1bc9a0SAchim Leubner   $Revision: 115514 $0.1.0
414e1bc9a0SAchim Leubner   $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $09-27-2001
424e1bc9a0SAchim Leubner   $Modtime: 11/12/01 11:15a $15:56:00
434e1bc9a0SAchim Leubner 
444e1bc9a0SAchim Leubner Notes:
454e1bc9a0SAchim Leubner **************************** MODIFICATION HISTORY *****************************
464e1bc9a0SAchim Leubner NAME     DATE         Rev.          DESCRIPTION
474e1bc9a0SAchim Leubner ----     ----         ----          -----------
484e1bc9a0SAchim Leubner EW     09-17-2004     1.0.0     Constant definitions
494e1bc9a0SAchim Leubner ******************************************************************************/
504e1bc9a0SAchim Leubner 
514e1bc9a0SAchim Leubner 
524e1bc9a0SAchim Leubner #ifndef __AGTIAPI_DEF_H__
534e1bc9a0SAchim Leubner #define __AGTIAPI_DEF_H__
544e1bc9a0SAchim Leubner 
554e1bc9a0SAchim Leubner /*
564e1bc9a0SAchim Leubner ** Max device supported
574e1bc9a0SAchim Leubner */
584e1bc9a0SAchim Leubner #define AGTIAPI_HW_LIMIT_DEVICE     4096
594e1bc9a0SAchim Leubner #define AGTIAPI_MAX_LUN             256    /* Max # luns per target */
604e1bc9a0SAchim Leubner #define AGTIAPI_MAX_DEVICE          128 //64 //2048//1024 /* Max # device per channel */
614e1bc9a0SAchim Leubner #define AGTIAPI_MAX_DEVICE_7H       256 /*Max devices per channel in 7H */
624e1bc9a0SAchim Leubner #define AGTIAPI_MAX_DEVICE_8H       512 /*Max devices per channel in 8H*/
634e1bc9a0SAchim Leubner #define AGTIAPI_MAX_CAM_Q_DEPTH     1024
64*3e347834SAlexander Motin #define AGTIAPI_NSEGS               (MIN(btoc(maxphys), 64) + 1)
654e1bc9a0SAchim Leubner /*
664e1bc9a0SAchim Leubner ** Adapter specific defines
674e1bc9a0SAchim Leubner */
684e1bc9a0SAchim Leubner #define AGTIAPI_IO_RANGE  256      /* IO mapped address range */
694e1bc9a0SAchim Leubner 
704e1bc9a0SAchim Leubner /*
714e1bc9a0SAchim Leubner **  Scatter/Gather DMA Segment Descriptor
724e1bc9a0SAchim Leubner **  Note, MAX_Q_DEPTH could be set larger for iscsi "AcceptQueueSize"
734e1bc9a0SAchim Leubner **  parameter matching.  One thing to do is to make it to be an adjustable
744e1bc9a0SAchim Leubner **  parameter.  Currently suggest this value set to be same as
754e1bc9a0SAchim Leubner **  "AcceptQueueSize" but not required.
764e1bc9a0SAchim Leubner */
774e1bc9a0SAchim Leubner 
784e1bc9a0SAchim Leubner #define AGTIAPI_MAX_DMA_SEGS     128//256
794e1bc9a0SAchim Leubner #define AGTIAPI_DEFAULT_Q_DEPTH  4
804e1bc9a0SAchim Leubner #define AGTIAPI_MAX_Q_DEPTH      AGSA_MAX_INBOUND_Q * 512 // *INBOUND_DEPTH_SIZE
814e1bc9a0SAchim Leubner 
824e1bc9a0SAchim Leubner /*
834e1bc9a0SAchim Leubner ** CCB and device flags defines
844e1bc9a0SAchim Leubner */
854e1bc9a0SAchim Leubner #define ACTIVE           0x00000001
864e1bc9a0SAchim Leubner #define TIMEDOUT         0x00000002
874e1bc9a0SAchim Leubner #define REQ_DONE         0x00000004
884e1bc9a0SAchim Leubner #define AGTIAPI_INQUIRY  0x00000008
894e1bc9a0SAchim Leubner #define AGTIAPI_ABORT    0x00000010
904e1bc9a0SAchim Leubner #define AGTIAPI_RETRY    0x00000020
914e1bc9a0SAchim Leubner #define TASK_SUCCESS     0x00000040
924e1bc9a0SAchim Leubner /* reserved for card flag
934e1bc9a0SAchim Leubner #define AGTIAPI_RESERVED 0x00000080
944e1bc9a0SAchim Leubner */
954e1bc9a0SAchim Leubner #define AGTIAPI_CNX_UP   0x00000100
964e1bc9a0SAchim Leubner #define DEV_RESET        0x00000400    /* device reset */
974e1bc9a0SAchim Leubner #define DEV_SHIFT        0x00000800    /* device shift physical position */
984e1bc9a0SAchim Leubner #define AGTIAPI_YAM      0x00001000
994e1bc9a0SAchim Leubner #define TASK_TIMEOUT     0x00002000
1004e1bc9a0SAchim Leubner #define ENCRYPTED_IO     0x00010000    /* encrypted IO */
1014e1bc9a0SAchim Leubner #define SATA_DIF         0x00020000    /* SATA DIF */
1024e1bc9a0SAchim Leubner #define EDC_DATA         0x00040000
1034e1bc9a0SAchim Leubner #define EDC_DATA_CRC     0x00080000
1044e1bc9a0SAchim Leubner #define TAG_SMP          0x40000000
1054e1bc9a0SAchim Leubner #define TASK_MANAGEMENT  0x80000000
1064e1bc9a0SAchim Leubner 
1074e1bc9a0SAchim Leubner #define AGTIAPI_CCB_PER_DEVICE  64
1084e1bc9a0SAchim Leubner #define AGTIAPI_CMD_PER_LUN     512
1094e1bc9a0SAchim Leubner 
1104e1bc9a0SAchim Leubner /*
1114e1bc9a0SAchim Leubner ** Max time to call agtiapi_GetDevHandle
1124e1bc9a0SAchim Leubner ** to make sure that no devices are attached
1134e1bc9a0SAchim Leubner */
1144e1bc9a0SAchim Leubner #define AGTIAPI_GET_DEV_MAX  2
1154e1bc9a0SAchim Leubner 
1164e1bc9a0SAchim Leubner /*
1174e1bc9a0SAchim Leubner ** Device address mode
1184e1bc9a0SAchim Leubner */
1194e1bc9a0SAchim Leubner #define AGTIAPI_ADDRMODE_SHIFT  6
1204e1bc9a0SAchim Leubner #define AGTIAPI_PERIPHERAL   0x00
1214e1bc9a0SAchim Leubner #define AGTIAPI_VOLUME_SET   0x01
1224e1bc9a0SAchim Leubner #define AGTIAPI_LUN_ADDR     0x02
1234e1bc9a0SAchim Leubner 
1244e1bc9a0SAchim Leubner /*
1254e1bc9a0SAchim Leubner ** Device mapping method
1264e1bc9a0SAchim Leubner */
1274e1bc9a0SAchim Leubner #define SOFT_MAPPED        0x0001
1284e1bc9a0SAchim Leubner #define HARD_MAPPED        0x0002
1294e1bc9a0SAchim Leubner 
1304e1bc9a0SAchim Leubner /*
1314e1bc9a0SAchim Leubner ** bd_dev_type definitions
1324e1bc9a0SAchim Leubner */
1334e1bc9a0SAchim Leubner #define DIRECT_DEVICE        0x00
1344e1bc9a0SAchim Leubner #define TAPE_DEVICE          0x01
1354e1bc9a0SAchim Leubner #define SLOW_DEVICE          0x02
1364e1bc9a0SAchim Leubner #define ARRAY_DEVICE         0x04
1374e1bc9a0SAchim Leubner 
1384e1bc9a0SAchim Leubner /*
1394e1bc9a0SAchim Leubner ** SCSI CDB
1404e1bc9a0SAchim Leubner */
1414e1bc9a0SAchim Leubner #define SCSI_CDB_SIZE        16
1424e1bc9a0SAchim Leubner 
1434e1bc9a0SAchim Leubner /*
1444e1bc9a0SAchim Leubner ** SCSI status
1454e1bc9a0SAchim Leubner */
1464e1bc9a0SAchim Leubner #define SCSI_GOOD                   0x00
1474e1bc9a0SAchim Leubner #define SCSI_CHECK_CONDITION        0x02
1484e1bc9a0SAchim Leubner #define SCSI_CONDITION_MET          0x04
1494e1bc9a0SAchim Leubner #define SCSI_BUSY                   0x08
1504e1bc9a0SAchim Leubner #define SCSI_INTERMEDIATE           0x10
1514e1bc9a0SAchim Leubner #define SCSI_INTERMEDIATE_COND_MET  0x14
1524e1bc9a0SAchim Leubner #define SCSI_RESERVATION_CONFLICT   0x18
1534e1bc9a0SAchim Leubner #define SCSI_TASK_ABORTED           0x40
1544e1bc9a0SAchim Leubner #define SCSI_TASK_SET_FULL          0x28
1554e1bc9a0SAchim Leubner #define SCSI_ACA_ACTIVE             0x30
1564e1bc9a0SAchim Leubner 
1574e1bc9a0SAchim Leubner /*
1584e1bc9a0SAchim Leubner ** Peripheral device types
1594e1bc9a0SAchim Leubner */
1604e1bc9a0SAchim Leubner #define DTYPE_DIRECT         0x00
1614e1bc9a0SAchim Leubner #define DTYPE_SEQUENTIAL     0x01
1624e1bc9a0SAchim Leubner #define DTYPE_PRINTER        0x02
1634e1bc9a0SAchim Leubner #define DTYPE_PROCESSOR      0x03
1644e1bc9a0SAchim Leubner #define DTYPE_WORM           0x04
1654e1bc9a0SAchim Leubner #define DTYPE_RODIRECT       0x05
1664e1bc9a0SAchim Leubner #define DTYPE_SCANNER        0x06
1674e1bc9a0SAchim Leubner #define DTYPE_OPTICAL        0x07
1684e1bc9a0SAchim Leubner #define DTYPE_CHANGER        0x08
1694e1bc9a0SAchim Leubner #define DTYPE_COMM           0x09
1704e1bc9a0SAchim Leubner #define DTYPE_ARRAY_CTRL     0x0C
1714e1bc9a0SAchim Leubner #define DTYPE_ESI            0x0D
1724e1bc9a0SAchim Leubner /*
1734e1bc9a0SAchim Leubner ** Device types 0x0E-0x1E are reserved
1744e1bc9a0SAchim Leubner */
1754e1bc9a0SAchim Leubner #define DTYPE_MASK           0x1F
1764e1bc9a0SAchim Leubner 
1774e1bc9a0SAchim Leubner /*
1784e1bc9a0SAchim Leubner ** Driver capability defines
1794e1bc9a0SAchim Leubner */
1804e1bc9a0SAchim Leubner #define AGTIAPI_TIMEOUT_SECS        10            /* Default timer interval */
1814e1bc9a0SAchim Leubner #define AGTIAPI_RESET_MAX           0x7FFFFFFF    /* Default max. reset */
1824e1bc9a0SAchim Leubner #define AGTIAPI_DEV_RESET_MAX       0x10          /* Default max. reset */
1834e1bc9a0SAchim Leubner #define AGTIAPI_RETRY_MAX           10            /* Default ccb retry cnt */
1844e1bc9a0SAchim Leubner #define AGTIAPI_MAX_CHANNEL_NUM     0             /* Max channel # per card */
1854e1bc9a0SAchim Leubner #define AGTIAPI_PERIPHERAL_CHANNEL  0
1864e1bc9a0SAchim Leubner #define AGTIAPI_VOLUMESET_CHANNEL   1
1874e1bc9a0SAchim Leubner #define AGTIAPI_LUNADDR_CHANNEL     2
1884e1bc9a0SAchim Leubner #define AGTIAPI_EXTRA_DELAY         10000         /* extra 10 seconds delay */
1894e1bc9a0SAchim Leubner 
1904e1bc9a0SAchim Leubner /*
1914e1bc9a0SAchim Leubner ** Scsi ioctl test case only
1924e1bc9a0SAchim Leubner */
1934e1bc9a0SAchim Leubner #define AGTIAPI_TEST_ABORT          0xabcd
1944e1bc9a0SAchim Leubner #define AGTIAPI_TEST_ABORT_DONE     0xabce
1954e1bc9a0SAchim Leubner #define AGTIAPI_IOCTL_SIGNATURE     "AGTIAPI_IOCTL"
1964e1bc9a0SAchim Leubner 
1974e1bc9a0SAchim Leubner #define AGTIAPI_HBA_SCSI_ID         (AGTIAPI_MAX_DEVICE - 1)
1984e1bc9a0SAchim Leubner #define AGTIAPI_NO_RESEND           0x01   /* Don't resend command */
1994e1bc9a0SAchim Leubner #define AGTIAPI_RESEND              0x02   /* Resend command */
2004e1bc9a0SAchim Leubner //#define AGTIAPI_UPPER               0x04   /* Call from upper layer */
2014e1bc9a0SAchim Leubner #define AGTIAPI_CALLBACK            0x08   /* CMD call back required */
2024e1bc9a0SAchim Leubner 
2034e1bc9a0SAchim Leubner #endif  /* __AGTIAPI_DEF_H__ */
204