blob: 0ddb18449d11b190a602d628461d2f5f01dc564d [file] [log] [blame]
Christof Schmitt2b604c92008-03-31 11:15:28 +02001/*
2 * This file is part of the zfcp device driver for
3 * FCP adapters for IBM System z9 and zSeries.
4 *
5 * Copyright IBM Corp. 2008, 2008
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#ifndef ZFCP_DBF_H
23#define ZFCP_DBF_H
24
25#include "zfcp_fsf.h"
26
27#define ZFCP_DBF_TAG_SIZE 4
28
29struct zfcp_dbf_dump {
30 u8 tag[ZFCP_DBF_TAG_SIZE];
31 u32 total_size; /* size of total dump data */
32 u32 offset; /* how much data has being already dumped */
33 u32 size; /* how much data comes with this record */
34 u8 data[]; /* dump data */
35} __attribute__ ((packed));
36
37struct zfcp_rec_dbf_record_thread {
Christof Schmitt2b604c92008-03-31 11:15:28 +020038 u32 total;
39 u32 ready;
40 u32 running;
Martin Peschke73378912008-05-19 12:17:46 +020041};
Christof Schmitt2b604c92008-03-31 11:15:28 +020042
43struct zfcp_rec_dbf_record_target {
44 u64 ref;
45 u32 status;
46 u32 d_id;
47 u64 wwpn;
48 u64 fcp_lun;
49 u32 erp_count;
Martin Peschke73378912008-05-19 12:17:46 +020050};
Christof Schmitt2b604c92008-03-31 11:15:28 +020051
52struct zfcp_rec_dbf_record_trigger {
53 u8 want;
54 u8 need;
55 u32 as;
56 u32 ps;
57 u32 us;
58 u64 ref;
59 u64 action;
60 u64 wwpn;
61 u64 fcp_lun;
Martin Peschke73378912008-05-19 12:17:46 +020062};
Christof Schmitt2b604c92008-03-31 11:15:28 +020063
64struct zfcp_rec_dbf_record_action {
65 u32 status;
66 u32 step;
67 u64 action;
68 u64 fsf_req;
Martin Peschke73378912008-05-19 12:17:46 +020069};
Christof Schmitt2b604c92008-03-31 11:15:28 +020070
71struct zfcp_rec_dbf_record {
72 u8 id;
73 u8 id2;
74 union {
75 struct zfcp_rec_dbf_record_action action;
76 struct zfcp_rec_dbf_record_thread thread;
77 struct zfcp_rec_dbf_record_target target;
78 struct zfcp_rec_dbf_record_trigger trigger;
79 } u;
Martin Peschke73378912008-05-19 12:17:46 +020080};
Christof Schmitt2b604c92008-03-31 11:15:28 +020081
82enum {
83 ZFCP_REC_DBF_ID_ACTION,
84 ZFCP_REC_DBF_ID_THREAD,
85 ZFCP_REC_DBF_ID_TARGET,
86 ZFCP_REC_DBF_ID_TRIGGER,
87};
88
89struct zfcp_hba_dbf_record_response {
90 u32 fsf_command;
91 u64 fsf_reqid;
92 u32 fsf_seqno;
93 u64 fsf_issued;
94 u32 fsf_prot_status;
95 u32 fsf_status;
96 u8 fsf_prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE];
97 u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE];
98 u32 fsf_req_status;
99 u8 sbal_first;
Martin Peschkee891bff2008-05-19 12:17:43 +0200100 u8 sbal_last;
Martin Peschkec3baa9a22008-05-19 12:17:44 +0200101 u8 sbal_response;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200102 u8 pool;
103 u64 erp_action;
104 union {
105 struct {
Martin Peschke6bc473d2008-03-31 11:15:29 +0200106 u64 cmnd;
107 u64 serial;
108 } fcp;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200109 struct {
110 u64 wwpn;
111 u32 d_id;
112 u32 port_handle;
113 } port;
114 struct {
115 u64 wwpn;
116 u64 fcp_lun;
117 u32 port_handle;
118 u32 lun_handle;
119 } unit;
120 struct {
121 u32 d_id;
122 u8 ls_code;
Martin Peschke6bc473d2008-03-31 11:15:29 +0200123 } els;
124 } u;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200125} __attribute__ ((packed));
126
127struct zfcp_hba_dbf_record_status {
128 u8 failed;
129 u32 status_type;
130 u32 status_subtype;
131 struct fsf_queue_designator
132 queue_designator;
133 u32 payload_size;
134#define ZFCP_DBF_UNSOL_PAYLOAD 80
135#define ZFCP_DBF_UNSOL_PAYLOAD_SENSE_DATA_AVAIL 32
136#define ZFCP_DBF_UNSOL_PAYLOAD_BIT_ERROR_THRESHOLD 56
137#define ZFCP_DBF_UNSOL_PAYLOAD_FEATURE_UPDATE_ALERT 2 * sizeof(u32)
138 u8 payload[ZFCP_DBF_UNSOL_PAYLOAD];
139} __attribute__ ((packed));
140
141struct zfcp_hba_dbf_record_qdio {
Christof Schmitt2b604c92008-03-31 11:15:28 +0200142 u32 qdio_error;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200143 u8 sbal_index;
144 u8 sbal_count;
145} __attribute__ ((packed));
146
147struct zfcp_hba_dbf_record {
148 u8 tag[ZFCP_DBF_TAG_SIZE];
149 u8 tag2[ZFCP_DBF_TAG_SIZE];
150 union {
151 struct zfcp_hba_dbf_record_response response;
152 struct zfcp_hba_dbf_record_status status;
153 struct zfcp_hba_dbf_record_qdio qdio;
Martin Peschke6bc473d2008-03-31 11:15:29 +0200154 } u;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200155} __attribute__ ((packed));
156
Martin Peschke6bc473d2008-03-31 11:15:29 +0200157struct zfcp_san_dbf_record_ct_request {
158 u16 cmd_req_code;
159 u8 revision;
160 u8 gs_type;
161 u8 gs_subtype;
162 u8 options;
163 u16 max_res_size;
164 u32 len;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200165#define ZFCP_DBF_CT_PAYLOAD 24
166 u8 payload[ZFCP_DBF_CT_PAYLOAD];
167} __attribute__ ((packed));
168
Martin Peschke6bc473d2008-03-31 11:15:29 +0200169struct zfcp_san_dbf_record_ct_response {
170 u16 cmd_rsp_code;
171 u8 revision;
172 u8 reason_code;
173 u8 expl;
174 u8 vendor_unique;
175 u32 len;
176 u8 payload[ZFCP_DBF_CT_PAYLOAD];
177} __attribute__ ((packed));
178
Christof Schmitt2b604c92008-03-31 11:15:28 +0200179struct zfcp_san_dbf_record_els {
180 u8 ls_code;
Martin Peschke6bc473d2008-03-31 11:15:29 +0200181 u32 len;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200182#define ZFCP_DBF_ELS_PAYLOAD 32
183#define ZFCP_DBF_ELS_MAX_PAYLOAD 1024
184 u8 payload[ZFCP_DBF_ELS_PAYLOAD];
185} __attribute__ ((packed));
186
187struct zfcp_san_dbf_record {
188 u8 tag[ZFCP_DBF_TAG_SIZE];
189 u64 fsf_reqid;
190 u32 fsf_seqno;
191 u32 s_id;
192 u32 d_id;
193 union {
Martin Peschke6bc473d2008-03-31 11:15:29 +0200194 struct zfcp_san_dbf_record_ct_request ct_req;
195 struct zfcp_san_dbf_record_ct_response ct_resp;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200196 struct zfcp_san_dbf_record_els els;
Martin Peschke6bc473d2008-03-31 11:15:29 +0200197 } u;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200198} __attribute__ ((packed));
199
200struct zfcp_scsi_dbf_record {
201 u8 tag[ZFCP_DBF_TAG_SIZE];
202 u8 tag2[ZFCP_DBF_TAG_SIZE];
203 u32 scsi_id;
204 u32 scsi_lun;
205 u32 scsi_result;
206 u64 scsi_cmnd;
207 u64 scsi_serial;
208#define ZFCP_DBF_SCSI_OPCODE 16
209 u8 scsi_opcode[ZFCP_DBF_SCSI_OPCODE];
210 u8 scsi_retries;
211 u8 scsi_allowed;
212 u64 fsf_reqid;
213 u32 fsf_seqno;
214 u64 fsf_issued;
Martin Peschke6bc473d2008-03-31 11:15:29 +0200215 u64 old_fsf_reqid;
216 u8 rsp_validity;
217 u8 rsp_scsi_status;
218 u32 rsp_resid;
219 u8 rsp_code;
Christof Schmitt2b604c92008-03-31 11:15:28 +0200220#define ZFCP_DBF_SCSI_FCP_SNS_INFO 16
221#define ZFCP_DBF_SCSI_MAX_FCP_SNS_INFO 256
Martin Peschke6bc473d2008-03-31 11:15:29 +0200222 u32 sns_info_len;
223 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO];
Christof Schmitt2b604c92008-03-31 11:15:28 +0200224} __attribute__ ((packed));
225
226#endif /* ZFCP_DBF_H */