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* $FreeBSD$
22*
23**
24*******************************************************************************/
25 /******************************************************************************
26Note:
27*******************************************************************************
28Module Name:
29  agdef.h
30Abstract:
31  Linux iSCSI/FC Initiator driver module constant define header file
32Authors:
33  EW - Yiding(Eddie) Wang
34Environment:
35  Kernel or loadable module
36
37Version Control Information:
38  $ver. 1.0.0
39
40Revision History:
41  $Revision: 115514 $0.1.0
42  $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $09-27-2001
43  $Modtime: 11/12/01 11:15a $15:56:00
44
45Notes:
46**************************** MODIFICATION HISTORY *****************************
47NAME     DATE         Rev.          DESCRIPTION
48----     ----         ----          -----------
49EW     09-17-2004     1.0.0     Constant definitions
50******************************************************************************/
51
52
53#ifndef __AGTIAPI_DEF_H__
54#define __AGTIAPI_DEF_H__
55
56/*
57** Max device supported
58*/
59#define AGTIAPI_HW_LIMIT_DEVICE     4096
60#define AGTIAPI_MAX_LUN             256    /* Max # luns per target */
61#define AGTIAPI_MAX_DEVICE          128 //64 //2048//1024 /* Max # device per channel */
62#define AGTIAPI_MAX_DEVICE_7H       256 /*Max devices per channel in 7H */
63#define AGTIAPI_MAX_DEVICE_8H       512 /*Max devices per channel in 8H*/
64#define AGTIAPI_MAX_CAM_Q_DEPTH     1024
65#define AGTIAPI_NSEGS               (MAXPHYS / PAGE_SIZE)
66/*
67** Adapter specific defines
68*/
69#define AGTIAPI_IO_RANGE  256      /* IO mapped address range */
70
71/*
72**  Scatter/Gather DMA Segment Descriptor
73**  Note, MAX_Q_DEPTH could be set larger for iscsi "AcceptQueueSize"
74**  parameter matching.  One thing to do is to make it to be an adjustable
75**  parameter.  Currently suggest this value set to be same as
76**  "AcceptQueueSize" but not required.
77*/
78
79#define AGTIAPI_MAX_DMA_SEGS     128//256
80#define AGTIAPI_DEFAULT_Q_DEPTH  4
81#define AGTIAPI_MAX_Q_DEPTH      AGSA_MAX_INBOUND_Q * 512 // *INBOUND_DEPTH_SIZE
82
83/*
84** CCB and device flags defines
85*/
86#define ACTIVE           0x00000001
87#define TIMEDOUT         0x00000002
88#define REQ_DONE         0x00000004
89#define AGTIAPI_INQUIRY  0x00000008
90#define AGTIAPI_ABORT    0x00000010
91#define AGTIAPI_RETRY    0x00000020
92#define TASK_SUCCESS     0x00000040
93/* reserved for card flag
94#define AGTIAPI_RESERVED 0x00000080
95*/
96#define AGTIAPI_CNX_UP   0x00000100
97#define DEV_RESET        0x00000400    /* device reset */
98#define DEV_SHIFT        0x00000800    /* device shift physical position */
99#define AGTIAPI_YAM      0x00001000
100#define TASK_TIMEOUT     0x00002000
101#define ENCRYPTED_IO     0x00010000    /* encrypted IO */
102#define SATA_DIF         0x00020000    /* SATA DIF */
103#define EDC_DATA         0x00040000
104#define EDC_DATA_CRC     0x00080000
105#define TAG_SMP          0x40000000
106#define TASK_MANAGEMENT  0x80000000
107
108#define AGTIAPI_CCB_PER_DEVICE  64
109#define AGTIAPI_CMD_PER_LUN     512
110
111/*
112** Max time to call agtiapi_GetDevHandle
113** to make sure that no devices are attached
114*/
115#define AGTIAPI_GET_DEV_MAX  2
116
117/*
118** Device address mode
119*/
120#define AGTIAPI_ADDRMODE_SHIFT  6
121#define AGTIAPI_PERIPHERAL   0x00
122#define AGTIAPI_VOLUME_SET   0x01
123#define AGTIAPI_LUN_ADDR     0x02
124
125/*
126** Device mapping method
127*/
128#define SOFT_MAPPED        0x0001
129#define HARD_MAPPED        0x0002
130
131/*
132** bd_dev_type definitions
133*/
134#define DIRECT_DEVICE        0x00
135#define TAPE_DEVICE          0x01
136#define SLOW_DEVICE          0x02
137#define ARRAY_DEVICE         0x04
138
139/*
140** SCSI CDB
141*/
142#define SCSI_CDB_SIZE        16
143
144/*
145** SCSI status
146*/
147#define SCSI_GOOD                   0x00
148#define SCSI_CHECK_CONDITION        0x02
149#define SCSI_CONDITION_MET          0x04
150#define SCSI_BUSY                   0x08
151#define SCSI_INTERMEDIATE           0x10
152#define SCSI_INTERMEDIATE_COND_MET  0x14
153#define SCSI_RESERVATION_CONFLICT   0x18
154#define SCSI_TASK_ABORTED           0x40
155#define SCSI_TASK_SET_FULL          0x28
156#define SCSI_ACA_ACTIVE             0x30
157
158/*
159** Peripheral device types
160*/
161#define DTYPE_DIRECT         0x00
162#define DTYPE_SEQUENTIAL     0x01
163#define DTYPE_PRINTER        0x02
164#define DTYPE_PROCESSOR      0x03
165#define DTYPE_WORM           0x04
166#define DTYPE_RODIRECT       0x05
167#define DTYPE_SCANNER        0x06
168#define DTYPE_OPTICAL        0x07
169#define DTYPE_CHANGER        0x08
170#define DTYPE_COMM           0x09
171#define DTYPE_ARRAY_CTRL     0x0C
172#define DTYPE_ESI            0x0D
173/*
174** Device types 0x0E-0x1E are reserved
175*/
176#define DTYPE_MASK           0x1F
177
178/*
179** Driver capability defines
180*/
181#define AGTIAPI_TIMEOUT_SECS        10            /* Default timer interval */
182#define AGTIAPI_RESET_MAX           0x7FFFFFFF    /* Default max. reset */
183#define AGTIAPI_DEV_RESET_MAX       0x10          /* Default max. reset */
184#define AGTIAPI_RETRY_MAX           10            /* Default ccb retry cnt */
185#define AGTIAPI_MAX_CHANNEL_NUM     0             /* Max channel # per card */
186#define AGTIAPI_PERIPHERAL_CHANNEL  0
187#define AGTIAPI_VOLUMESET_CHANNEL   1
188#define AGTIAPI_LUNADDR_CHANNEL     2
189#define AGTIAPI_EXTRA_DELAY         10000         /* extra 10 seconds delay */
190
191/*
192** Scsi ioctl test case only
193*/
194#define AGTIAPI_TEST_ABORT          0xabcd
195#define AGTIAPI_TEST_ABORT_DONE     0xabce
196#define AGTIAPI_IOCTL_SIGNATURE     "AGTIAPI_IOCTL"
197
198#define AGTIAPI_HBA_SCSI_ID         (AGTIAPI_MAX_DEVICE - 1)
199#define AGTIAPI_NO_RESEND           0x01   /* Don't resend command */
200#define AGTIAPI_RESEND              0x02   /* Resend command */
201//#define AGTIAPI_UPPER               0x04   /* Call from upper layer */
202#define AGTIAPI_CALLBACK            0x08   /* CMD call back required */
203
204#endif  /* __AGTIAPI_DEF_H__ */
205