This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / drivers / scsi / lpfc / lpfc_fcp.h
1 /*******************************************************************
2  * This file is part of the Emulex Linux Device Driver for         *
3  * Enterprise Fibre Channel Host Bus Adapters.                     *
4  * Refer to the README file included with this package for         *
5  * driver version and adapter support.                             *
6  * Copyright (C) 2004 Emulex Corporation.                          *
7  * www.emulex.com                                                  *
8  *                                                                 *
9  * This program is free software; you can redistribute it and/or   *
10  * modify it under the terms of the GNU General Public License     *
11  * as published by the Free Software Foundation; either version 2  *
12  * of the License, or (at your option) any later version.          *
13  *                                                                 *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of  *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
17  * GNU General Public License for more details, a copy of which    *
18  * can be found in the file COPYING included with this package.    *
19  *******************************************************************/
20
21 /*
22  * $Id: lpfc_fcp.h 1.8 2004/10/14 12:03:17EDT sf_support Exp  $
23  */
24
25 #ifndef H_LPFC_DFC
26 #define H_LPFC_DFC
27
28 #define MAX_LPFC_SNS      128
29
30 struct fcp_rsp {
31         uint32_t rspRsvd1;      /* FC Word 0, byte 0:3 */
32         uint32_t rspRsvd2;      /* FC Word 1, byte 0:3 */
33
34         uint8_t rspStatus0;     /* FCP_STATUS byte 0 (reserved) */
35         uint8_t rspStatus1;     /* FCP_STATUS byte 1 (reserved) */
36         uint8_t rspStatus2;     /* FCP_STATUS byte 2 field validity */
37 #define RSP_LEN_VALID  0x01     /* bit 0 */
38 #define SNS_LEN_VALID  0x02     /* bit 1 */
39 #define RESID_OVER     0x04     /* bit 2 */
40 #define RESID_UNDER    0x08     /* bit 3 */
41         uint8_t rspStatus3;     /* FCP_STATUS byte 3 SCSI status byte */
42
43         uint32_t rspResId;      /* Residual xfer if residual count field set in
44                                    fcpStatus2 */
45         /* Received in Big Endian format */
46         uint32_t rspSnsLen;     /* Length of sense data in fcpSnsInfo */
47         /* Received in Big Endian format */
48         uint32_t rspRspLen;     /* Length of FCP response data in fcpRspInfo */
49         /* Received in Big Endian format */
50
51         uint8_t rspInfo0;       /* FCP_RSP_INFO byte 0 (reserved) */
52         uint8_t rspInfo1;       /* FCP_RSP_INFO byte 1 (reserved) */
53         uint8_t rspInfo2;       /* FCP_RSP_INFO byte 2 (reserved) */
54         uint8_t rspInfo3;       /* FCP_RSP_INFO RSP_CODE byte 3 */
55
56 #define RSP_NO_FAILURE       0x00
57 #define RSP_DATA_BURST_ERR   0x01
58 #define RSP_CMD_FIELD_ERR    0x02
59 #define RSP_RO_MISMATCH_ERR  0x03
60 #define RSP_TM_NOT_SUPPORTED 0x04       /* Task mgmt function not supported */
61 #define RSP_TM_NOT_COMPLETED 0x05       /* Task mgmt function not performed */
62
63         uint32_t rspInfoRsvd;   /* FCP_RSP_INFO bytes 4-7 (reserved) */
64
65         uint8_t rspSnsInfo[MAX_LPFC_SNS];
66 #define SNS_ILLEGAL_REQ 0x05    /* sense key is byte 3 ([2]) */
67 #define SNSCOD_BADCMD 0x20      /* sense code is byte 13 ([12]) */
68 };
69
70 struct fcp_cmnd {
71         uint32_t fcpLunMsl;     /* most  significant lun word (32 bits) */
72         uint32_t fcpLunLsl;     /* least significant lun word (32 bits) */
73         /* # of bits to shift lun id to end up in right
74          * payload word, little endian = 8, big = 16.
75          */
76 #if __BIG_ENDIAN
77 #define FC_LUN_SHIFT         16
78 #define FC_ADDR_MODE_SHIFT   24
79 #else   /*  __LITTLE_ENDIAN */
80 #define FC_LUN_SHIFT         8
81 #define FC_ADDR_MODE_SHIFT   0
82 #endif
83
84         uint8_t fcpCntl0;       /* FCP_CNTL byte 0 (reserved) */
85         uint8_t fcpCntl1;       /* FCP_CNTL byte 1 task codes */
86 #define  SIMPLE_Q        0x00
87 #define  HEAD_OF_Q       0x01
88 #define  ORDERED_Q       0x02
89 #define  ACA_Q           0x04
90 #define  UNTAGGED        0x05
91         uint8_t fcpCntl2;       /* FCP_CTL byte 2 task management codes */
92 #define  FCP_ABORT_TASK_SET  0x02       /* Bit 1 */
93 #define  FCP_CLEAR_TASK_SET  0x04       /* bit 2 */
94 #define  FCP_BUS_RESET       0x08       /* bit 3 */
95 #define  FCP_LUN_RESET       0x10       /* bit 4 */
96 #define  FCP_TARGET_RESET    0x20       /* bit 5 */
97 #define  FCP_CLEAR_ACA       0x40       /* bit 6 */
98 #define  FCP_TERMINATE_TASK  0x80       /* bit 7 */
99         uint8_t fcpCntl3;
100 #define  WRITE_DATA      0x01   /* Bit 0 */
101 #define  READ_DATA       0x02   /* Bit 1 */
102
103         uint8_t fcpCdb[16];     /* SRB cdb field is copied here */
104         uint32_t fcpDl;         /* Total transfer length */
105
106 };
107
108 #endif