1285809Sscottl/*******************************************************************************
2285809Sscottl **
3285809Sscottl **
4285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
5285809Sscottl *
6285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided
7285809Sscottl*that the following conditions are met:
8285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice,
10285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11285809Sscottl*
12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
13285809Sscottl*
14285809Sscottl*INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15285809Sscottl*ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16285809Sscottl*SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
17285809Sscottl*OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18285809Sscottl*WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
19285809Sscottl*THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20285809Sscottl*
21285809Sscottl* $FreeBSD$
22285809Sscottl*
23285809Sscottl**
24285809Sscottl*******************************************************************************/
25285809Sscottl /******************************************************************************
26285809SscottlNote:
27285809Sscottl*******************************************************************************
28285809SscottlModule Name:
29285809Sscottl  agdef.h
30285809SscottlAbstract:
31285809Sscottl  Linux iSCSI/FC Initiator driver module constant define header file
32285809SscottlAuthors:
33285809Sscottl  EW - Yiding(Eddie) Wang
34285809SscottlEnvironment:
35285809Sscottl  Kernel or loadable module
36285809Sscottl
37285809SscottlVersion Control Information:
38285809Sscottl  $ver. 1.0.0
39285809Sscottl
40285809SscottlRevision History:
41285809Sscottl  $Revision: 115514 $0.1.0
42285809Sscottl  $Date: 2012-01-06 17:12:27 -0800 (Fri, 06 Jan 2012) $09-27-2001
43285809Sscottl  $Modtime: 11/12/01 11:15a $15:56:00
44285809Sscottl
45285809SscottlNotes:
46285809Sscottl**************************** MODIFICATION HISTORY *****************************
47285809SscottlNAME     DATE         Rev.          DESCRIPTION
48285809Sscottl----     ----         ----          -----------
49285809SscottlEW     09-17-2004     1.0.0     Constant definitions
50285809Sscottl******************************************************************************/
51285809Sscottl
52285809Sscottl
53285809Sscottl#ifndef __AGTIAPI_DEF_H__
54285809Sscottl#define __AGTIAPI_DEF_H__
55285809Sscottl
56285809Sscottl/*
57285809Sscottl** Max device supported
58285809Sscottl*/
59285809Sscottl#define AGTIAPI_HW_LIMIT_DEVICE     4096
60285809Sscottl#define AGTIAPI_MAX_LUN             256    /* Max # luns per target */
61285809Sscottl#define AGTIAPI_MAX_DEVICE          128 //64 //2048//1024 /* Max # device per channel */
62285809Sscottl#define AGTIAPI_MAX_DEVICE_7H       256 /*Max devices per channel in 7H */
63285809Sscottl#define AGTIAPI_MAX_DEVICE_8H       512 /*Max devices per channel in 8H*/
64285809Sscottl#define AGTIAPI_MAX_CAM_Q_DEPTH     1024
65285809Sscottl#define AGTIAPI_NSEGS               (MAXPHYS / PAGE_SIZE)
66285809Sscottl/*
67285809Sscottl** Adapter specific defines
68285809Sscottl*/
69285809Sscottl#define AGTIAPI_IO_RANGE  256      /* IO mapped address range */
70285809Sscottl
71285809Sscottl/*
72285809Sscottl**  Scatter/Gather DMA Segment Descriptor
73285809Sscottl**  Note, MAX_Q_DEPTH could be set larger for iscsi "AcceptQueueSize"
74285809Sscottl**  parameter matching.  One thing to do is to make it to be an adjustable
75285809Sscottl**  parameter.  Currently suggest this value set to be same as
76285809Sscottl**  "AcceptQueueSize" but not required.
77285809Sscottl*/
78285809Sscottl
79285809Sscottl#define AGTIAPI_MAX_DMA_SEGS     128//256
80285809Sscottl#define AGTIAPI_DEFAULT_Q_DEPTH  4
81285809Sscottl#define AGTIAPI_MAX_Q_DEPTH      AGSA_MAX_INBOUND_Q * 512 // *INBOUND_DEPTH_SIZE
82285809Sscottl
83285809Sscottl/*
84285809Sscottl** CCB and device flags defines
85285809Sscottl*/
86285809Sscottl#define ACTIVE           0x00000001
87285809Sscottl#define TIMEDOUT         0x00000002
88285809Sscottl#define REQ_DONE         0x00000004
89285809Sscottl#define AGTIAPI_INQUIRY  0x00000008
90285809Sscottl#define AGTIAPI_ABORT    0x00000010
91285809Sscottl#define AGTIAPI_RETRY    0x00000020
92285809Sscottl#define TASK_SUCCESS     0x00000040
93285809Sscottl/* reserved for card flag
94285809Sscottl#define AGTIAPI_RESERVED 0x00000080
95285809Sscottl*/
96285809Sscottl#define AGTIAPI_CNX_UP   0x00000100
97285809Sscottl#define DEV_RESET        0x00000400    /* device reset */
98285809Sscottl#define DEV_SHIFT        0x00000800    /* device shift physical position */
99285809Sscottl#define AGTIAPI_YAM      0x00001000
100285809Sscottl#define TASK_TIMEOUT     0x00002000
101285809Sscottl#define ENCRYPTED_IO     0x00010000    /* encrypted IO */
102285809Sscottl#define SATA_DIF         0x00020000    /* SATA DIF */
103285809Sscottl#define EDC_DATA         0x00040000
104285809Sscottl#define EDC_DATA_CRC     0x00080000
105285809Sscottl#define TAG_SMP          0x40000000
106285809Sscottl#define TASK_MANAGEMENT  0x80000000
107285809Sscottl
108285809Sscottl#define AGTIAPI_CCB_PER_DEVICE  64
109285809Sscottl#define AGTIAPI_CMD_PER_LUN     512
110285809Sscottl
111285809Sscottl/*
112285809Sscottl** Max time to call agtiapi_GetDevHandle
113285809Sscottl** to make sure that no devices are attached
114285809Sscottl*/
115285809Sscottl#define AGTIAPI_GET_DEV_MAX  2
116285809Sscottl
117285809Sscottl/*
118285809Sscottl** Device address mode
119285809Sscottl*/
120285809Sscottl#define AGTIAPI_ADDRMODE_SHIFT  6
121285809Sscottl#define AGTIAPI_PERIPHERAL   0x00
122285809Sscottl#define AGTIAPI_VOLUME_SET   0x01
123285809Sscottl#define AGTIAPI_LUN_ADDR     0x02
124285809Sscottl
125285809Sscottl/*
126285809Sscottl** Device mapping method
127285809Sscottl*/
128285809Sscottl#define SOFT_MAPPED        0x0001
129285809Sscottl#define HARD_MAPPED        0x0002
130285809Sscottl
131285809Sscottl/*
132285809Sscottl** bd_dev_type definitions
133285809Sscottl*/
134285809Sscottl#define DIRECT_DEVICE        0x00
135285809Sscottl#define TAPE_DEVICE          0x01
136285809Sscottl#define SLOW_DEVICE          0x02
137285809Sscottl#define ARRAY_DEVICE         0x04
138285809Sscottl
139285809Sscottl/*
140285809Sscottl** SCSI CDB
141285809Sscottl*/
142285809Sscottl#define SCSI_CDB_SIZE        16
143285809Sscottl
144285809Sscottl/*
145285809Sscottl** SCSI status
146285809Sscottl*/
147285809Sscottl#define SCSI_GOOD                   0x00
148285809Sscottl#define SCSI_CHECK_CONDITION        0x02
149285809Sscottl#define SCSI_CONDITION_MET          0x04
150285809Sscottl#define SCSI_BUSY                   0x08
151285809Sscottl#define SCSI_INTERMEDIATE           0x10
152285809Sscottl#define SCSI_INTERMEDIATE_COND_MET  0x14
153285809Sscottl#define SCSI_RESERVATION_CONFLICT   0x18
154285809Sscottl#define SCSI_TASK_ABORTED           0x40
155285809Sscottl#define SCSI_TASK_SET_FULL          0x28
156285809Sscottl#define SCSI_ACA_ACTIVE             0x30
157285809Sscottl
158285809Sscottl/*
159285809Sscottl** Peripheral device types
160285809Sscottl*/
161285809Sscottl#define DTYPE_DIRECT         0x00
162285809Sscottl#define DTYPE_SEQUENTIAL     0x01
163285809Sscottl#define DTYPE_PRINTER        0x02
164285809Sscottl#define DTYPE_PROCESSOR      0x03
165285809Sscottl#define DTYPE_WORM           0x04
166285809Sscottl#define DTYPE_RODIRECT       0x05
167285809Sscottl#define DTYPE_SCANNER        0x06
168285809Sscottl#define DTYPE_OPTICAL        0x07
169285809Sscottl#define DTYPE_CHANGER        0x08
170285809Sscottl#define DTYPE_COMM           0x09
171285809Sscottl#define DTYPE_ARRAY_CTRL     0x0C
172285809Sscottl#define DTYPE_ESI            0x0D
173285809Sscottl/*
174285809Sscottl** Device types 0x0E-0x1E are reserved
175285809Sscottl*/
176285809Sscottl#define DTYPE_MASK           0x1F
177285809Sscottl
178285809Sscottl/*
179285809Sscottl** Driver capability defines
180285809Sscottl*/
181285809Sscottl#define AGTIAPI_TIMEOUT_SECS        10            /* Default timer interval */
182285809Sscottl#define AGTIAPI_RESET_MAX           0x7FFFFFFF    /* Default max. reset */
183285809Sscottl#define AGTIAPI_DEV_RESET_MAX       0x10          /* Default max. reset */
184285809Sscottl#define AGTIAPI_RETRY_MAX           10            /* Default ccb retry cnt */
185285809Sscottl#define AGTIAPI_MAX_CHANNEL_NUM     0             /* Max channel # per card */
186285809Sscottl#define AGTIAPI_PERIPHERAL_CHANNEL  0
187285809Sscottl#define AGTIAPI_VOLUMESET_CHANNEL   1
188285809Sscottl#define AGTIAPI_LUNADDR_CHANNEL     2
189285809Sscottl#define AGTIAPI_EXTRA_DELAY         10000         /* extra 10 seconds delay */
190285809Sscottl
191285809Sscottl/*
192285809Sscottl** Scsi ioctl test case only
193285809Sscottl*/
194285809Sscottl#define AGTIAPI_TEST_ABORT          0xabcd
195285809Sscottl#define AGTIAPI_TEST_ABORT_DONE     0xabce
196285809Sscottl#define AGTIAPI_IOCTL_SIGNATURE     "AGTIAPI_IOCTL"
197285809Sscottl
198285809Sscottl#define AGTIAPI_HBA_SCSI_ID         (AGTIAPI_MAX_DEVICE - 1)
199285809Sscottl#define AGTIAPI_NO_RESEND           0x01   /* Don't resend command */
200285809Sscottl#define AGTIAPI_RESEND              0x02   /* Resend command */
201285809Sscottl//#define AGTIAPI_UPPER               0x04   /* Call from upper layer */
202285809Sscottl#define AGTIAPI_CALLBACK            0x08   /* CMD call back required */
203285809Sscottl
204285809Sscottl#endif  /* __AGTIAPI_DEF_H__ */
205