GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / scsi / bfa / include / protocol / fcp.h
blob74ea63ce84b73cc5e4b66669ff5d13763456565e
1 /*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
18 #ifndef __FCPPROTO_H__
19 #define __FCPPROTO_H__
21 #include <linux/bitops.h>
22 #include <protocol/scsi.h>
24 #pragma pack(1)
26 enum {
27 FCP_RJT = 0x01000000, /* SRR reject */
28 FCP_SRR_ACCEPT = 0x02000000, /* SRR accept */
29 FCP_SRR = 0x14000000, /* Sequence Retransmission Request */
33 * SRR FC-4 LS payload
35 struct fc_srr_s{
36 u32 ls_cmd;
37 u32 ox_id:16; /* ox-id */
38 u32 rx_id:16; /* rx-id */
39 u32 ro; /* relative offset */
40 u32 r_ctl:8; /* R_CTL for I.U. */
41 u32 res:24;
46 * FCP_CMND definitions
48 #define FCP_CMND_CDB_LEN 16
49 #define FCP_CMND_LUN_LEN 8
51 struct fcp_cmnd_s{
52 lun_t lun; /* 64-bit LU number */
53 u8 crn; /* command reference number */
54 #ifdef __BIGENDIAN
55 u8 resvd:1,
56 priority:4, /* FCP-3: SAM-3 priority */
57 taskattr:3; /* scsi task attribute */
58 #else
59 u8 taskattr:3, /* scsi task attribute */
60 priority:4, /* FCP-3: SAM-3 priority */
61 resvd:1;
62 #endif
63 u8 tm_flags; /* task management flags */
64 #ifdef __BIGENDIAN
65 u8 addl_cdb_len:6, /* additional CDB length words */
66 iodir:2; /* read/write FCP_DATA IUs */
67 #else
68 u8 iodir:2, /* read/write FCP_DATA IUs */
69 addl_cdb_len:6; /* additional CDB length */
70 #endif
71 struct scsi_cdb_s cdb;
74 * !!! additional cdb bytes follows here!!!
76 u32 fcp_dl; /* bytes to be transferred */
79 #define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
80 #define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
83 * fcp_cmnd_t.iodir field values
85 enum fcp_iodir{
86 FCP_IODIR_NONE = 0,
87 FCP_IODIR_WRITE = 1,
88 FCP_IODIR_READ = 2,
89 FCP_IODIR_RW = 3,
93 * Task attribute field
95 enum {
96 FCP_TASK_ATTR_SIMPLE = 0,
97 FCP_TASK_ATTR_HOQ = 1,
98 FCP_TASK_ATTR_ORDERED = 2,
99 FCP_TASK_ATTR_ACA = 4,
100 FCP_TASK_ATTR_UNTAGGED = 5, /* obsolete in FCP-3 */
104 * Task management flags field - only one bit shall be set
106 enum fcp_tm_cmnd{
107 FCP_TM_ABORT_TASK_SET = BIT(1),
108 FCP_TM_CLEAR_TASK_SET = BIT(2),
109 FCP_TM_LUN_RESET = BIT(4),
110 FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
111 FCP_TM_CLEAR_ACA = BIT(6),
115 * FCP_XFER_RDY IU defines
117 struct fcp_xfer_rdy_s{
118 u32 data_ro;
119 u32 burst_len;
120 u32 reserved;
124 * FCP_RSP residue flags
126 enum fcp_residue{
127 FCP_NO_RESIDUE = 0, /* no residue */
128 FCP_RESID_OVER = 1, /* more data left that was not sent */
129 FCP_RESID_UNDER = 2, /* less data than requested */
132 enum {
133 FCP_RSPINFO_GOOD = 0,
134 FCP_RSPINFO_DATALEN_MISMATCH = 1,
135 FCP_RSPINFO_CMND_INVALID = 2,
136 FCP_RSPINFO_ROLEN_MISMATCH = 3,
137 FCP_RSPINFO_TM_NOT_SUPP = 4,
138 FCP_RSPINFO_TM_FAILED = 5,
141 struct fcp_rspinfo_s{
142 u32 res0:24;
143 u32 rsp_code:8; /* response code (as above) */
144 u32 res1;
147 struct fcp_resp_s{
148 u32 reserved[2]; /* 2 words reserved */
149 u16 reserved2;
150 #ifdef __BIGENDIAN
151 u8 reserved3:3;
152 u8 fcp_conf_req:1; /* FCP_CONF is requested */
153 u8 resid_flags:2; /* underflow/overflow */
154 u8 sns_len_valid:1;/* sense len is valid */
155 u8 rsp_len_valid:1;/* response len is valid */
156 #else
157 u8 rsp_len_valid:1;/* response len is valid */
158 u8 sns_len_valid:1;/* sense len is valid */
159 u8 resid_flags:2; /* underflow/overflow */
160 u8 fcp_conf_req:1; /* FCP_CONF is requested */
161 u8 reserved3:3;
162 #endif
163 u8 scsi_status; /* one byte SCSI status */
164 u32 residue; /* residual data bytes */
165 u32 sns_len; /* length od sense info */
166 u32 rsp_len; /* length of response info */
169 #define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
170 (__fcprsp)->sns_len : 0)
171 #define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
172 (__fcprsp)->rsp_len : 0)
173 #define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
174 #define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
175 fcp_rsplen(__fcprsp))
177 struct fcp_cmnd_fr_s{
178 struct fchs_s fchs;
179 struct fcp_cmnd_s fcp;
182 #pragma pack()
184 #endif