xref: /freebsd/sys/dev/pms/freebsd/driver/ini/src/agdef.h (revision 06c3fb27)
1 /*******************************************************************************
2  **
3  **
4 *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
5  *
6 *Redistribution and use in source and binary forms, with or without modification, are permitted provided
7 *that the following conditions are met:
8 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9 *2. Redistributions in binary form must reproduce the above copyright notice,
10 *this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11 *
12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
13 *
14 *INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 *ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16 *SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
17 *OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18 *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
19 *THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20 *
21 *
22 **
23 *******************************************************************************/
24  /******************************************************************************
25 Note:
26 *******************************************************************************
27 Module Name:
28   agdef.h
29 Abstract:
30   Linux iSCSI/FC Initiator driver module constant define header file
31 Authors:
32   EW - Yiding(Eddie) Wang
33 Environment:
34   Kernel or loadable module
35 
36 Version Control Information:
37   $ver. 1.0.0
38 
39 Revision History:
40   $Revision: 115514 $0.1.0
41   $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $09-27-2001
42   $Modtime: 11/12/01 11:15a $15:56:00
43 
44 Notes:
45 **************************** MODIFICATION HISTORY *****************************
46 NAME     DATE         Rev.          DESCRIPTION
47 ----     ----         ----          -----------
48 EW     09-17-2004     1.0.0     Constant definitions
49 ******************************************************************************/
50 
51 
52 #ifndef __AGTIAPI_DEF_H__
53 #define __AGTIAPI_DEF_H__
54 
55 /*
56 ** Max device supported
57 */
58 #define AGTIAPI_HW_LIMIT_DEVICE     4096
59 #define AGTIAPI_MAX_LUN             256    /* Max # luns per target */
60 #define AGTIAPI_MAX_DEVICE          128 //64 //2048//1024 /* Max # device per channel */
61 #define AGTIAPI_MAX_DEVICE_7H       256 /*Max devices per channel in 7H */
62 #define AGTIAPI_MAX_DEVICE_8H       512 /*Max devices per channel in 8H*/
63 #define AGTIAPI_MAX_CAM_Q_DEPTH     1024
64 #define AGTIAPI_NSEGS               (MIN(btoc(maxphys), 64) + 1)
65 /*
66 ** Adapter specific defines
67 */
68 #define AGTIAPI_IO_RANGE  256      /* IO mapped address range */
69 
70 /*
71 **  Scatter/Gather DMA Segment Descriptor
72 **  Note, MAX_Q_DEPTH could be set larger for iscsi "AcceptQueueSize"
73 **  parameter matching.  One thing to do is to make it to be an adjustable
74 **  parameter.  Currently suggest this value set to be same as
75 **  "AcceptQueueSize" but not required.
76 */
77 
78 #define AGTIAPI_MAX_DMA_SEGS     128//256
79 #define AGTIAPI_DEFAULT_Q_DEPTH  4
80 #define AGTIAPI_MAX_Q_DEPTH      AGSA_MAX_INBOUND_Q * 512 // *INBOUND_DEPTH_SIZE
81 
82 /*
83 ** CCB and device flags defines
84 */
85 #define ACTIVE           0x00000001
86 #define TIMEDOUT         0x00000002
87 #define REQ_DONE         0x00000004
88 #define AGTIAPI_INQUIRY  0x00000008
89 #define AGTIAPI_ABORT    0x00000010
90 #define AGTIAPI_RETRY    0x00000020
91 #define TASK_SUCCESS     0x00000040
92 /* reserved for card flag
93 #define AGTIAPI_RESERVED 0x00000080
94 */
95 #define AGTIAPI_CNX_UP   0x00000100
96 #define DEV_RESET        0x00000400    /* device reset */
97 #define DEV_SHIFT        0x00000800    /* device shift physical position */
98 #define AGTIAPI_YAM      0x00001000
99 #define TASK_TIMEOUT     0x00002000
100 #define ENCRYPTED_IO     0x00010000    /* encrypted IO */
101 #define SATA_DIF         0x00020000    /* SATA DIF */
102 #define EDC_DATA         0x00040000
103 #define EDC_DATA_CRC     0x00080000
104 #define TAG_SMP          0x40000000
105 #define TASK_MANAGEMENT  0x80000000
106 
107 #define AGTIAPI_CCB_PER_DEVICE  64
108 #define AGTIAPI_CMD_PER_LUN     512
109 
110 /*
111 ** Max time to call agtiapi_GetDevHandle
112 ** to make sure that no devices are attached
113 */
114 #define AGTIAPI_GET_DEV_MAX  2
115 
116 /*
117 ** Device address mode
118 */
119 #define AGTIAPI_ADDRMODE_SHIFT  6
120 #define AGTIAPI_PERIPHERAL   0x00
121 #define AGTIAPI_VOLUME_SET   0x01
122 #define AGTIAPI_LUN_ADDR     0x02
123 
124 /*
125 ** Device mapping method
126 */
127 #define SOFT_MAPPED        0x0001
128 #define HARD_MAPPED        0x0002
129 
130 /*
131 ** bd_dev_type definitions
132 */
133 #define DIRECT_DEVICE        0x00
134 #define TAPE_DEVICE          0x01
135 #define SLOW_DEVICE          0x02
136 #define ARRAY_DEVICE         0x04
137 
138 /*
139 ** SCSI CDB
140 */
141 #define SCSI_CDB_SIZE        16
142 
143 /*
144 ** SCSI status
145 */
146 #define SCSI_GOOD                   0x00
147 #define SCSI_CHECK_CONDITION        0x02
148 #define SCSI_CONDITION_MET          0x04
149 #define SCSI_BUSY                   0x08
150 #define SCSI_INTERMEDIATE           0x10
151 #define SCSI_INTERMEDIATE_COND_MET  0x14
152 #define SCSI_RESERVATION_CONFLICT   0x18
153 #define SCSI_TASK_ABORTED           0x40
154 #define SCSI_TASK_SET_FULL          0x28
155 #define SCSI_ACA_ACTIVE             0x30
156 
157 /*
158 ** Peripheral device types
159 */
160 #define DTYPE_DIRECT         0x00
161 #define DTYPE_SEQUENTIAL     0x01
162 #define DTYPE_PRINTER        0x02
163 #define DTYPE_PROCESSOR      0x03
164 #define DTYPE_WORM           0x04
165 #define DTYPE_RODIRECT       0x05
166 #define DTYPE_SCANNER        0x06
167 #define DTYPE_OPTICAL        0x07
168 #define DTYPE_CHANGER        0x08
169 #define DTYPE_COMM           0x09
170 #define DTYPE_ARRAY_CTRL     0x0C
171 #define DTYPE_ESI            0x0D
172 /*
173 ** Device types 0x0E-0x1E are reserved
174 */
175 #define DTYPE_MASK           0x1F
176 
177 /*
178 ** Driver capability defines
179 */
180 #define AGTIAPI_TIMEOUT_SECS        10            /* Default timer interval */
181 #define AGTIAPI_RESET_MAX           0x7FFFFFFF    /* Default max. reset */
182 #define AGTIAPI_DEV_RESET_MAX       0x10          /* Default max. reset */
183 #define AGTIAPI_RETRY_MAX           10            /* Default ccb retry cnt */
184 #define AGTIAPI_MAX_CHANNEL_NUM     0             /* Max channel # per card */
185 #define AGTIAPI_PERIPHERAL_CHANNEL  0
186 #define AGTIAPI_VOLUMESET_CHANNEL   1
187 #define AGTIAPI_LUNADDR_CHANNEL     2
188 #define AGTIAPI_EXTRA_DELAY         10000         /* extra 10 seconds delay */
189 
190 /*
191 ** Scsi ioctl test case only
192 */
193 #define AGTIAPI_TEST_ABORT          0xabcd
194 #define AGTIAPI_TEST_ABORT_DONE     0xabce
195 #define AGTIAPI_IOCTL_SIGNATURE     "AGTIAPI_IOCTL"
196 
197 #define AGTIAPI_HBA_SCSI_ID         (AGTIAPI_MAX_DEVICE - 1)
198 #define AGTIAPI_NO_RESEND           0x01   /* Don't resend command */
199 #define AGTIAPI_RESEND              0x02   /* Resend command */
200 //#define AGTIAPI_UPPER               0x04   /* Call from upper layer */
201 #define AGTIAPI_CALLBACK            0x08   /* CMD call back required */
202 
203 #endif  /* __AGTIAPI_DEF_H__ */
204