Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
osd_sense.h
Go to the documentation of this file.
1 /*
2  * osd_sense.h - OSD Related sense handling definitions.
3  *
4  * Copyright (C) 2008 Panasas Inc. All rights reserved.
5  *
6  * Authors:
7  * Boaz Harrosh <[email protected]>
8  * Benny Halevy <[email protected]>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2
12  *
13  * This file contains types and constants that are defined by the protocol
14  * Note: All names and symbols are taken from the OSD standard's text.
15  */
16 #ifndef __OSD_SENSE_H__
17 #define __OSD_SENSE_H__
18 
19 #include <scsi/osd_protocol.h>
20 
21 /* SPC3r23 4.5.6 Sense key and sense code definitions table 27 */
38 };
39 
40 /* SPC3r23 4.5.6 Sense key and sense code definitions table 28 */
41 /* Note: only those which can be returned by an OSD target. Most of
42  * these errors are taken care of by the generic scsi layer.
43  */
63  scsi_warning = 0x0b00,
138  osd_quota_error = 0x5507,
142 };
143 
155 
160 };
161 
162 struct scsi_sense_descriptor { /* for picking into desc type */
163  u8 descriptor_type; /* one of enum scsi_descriptor_types */
164  u8 additional_length; /* n - 1 */
165  u8 data[];
166 } __packed;
167 
168 /* OSD deploys only scsi descriptor_based sense buffers */
170 /*0*/ u8 response_code; /* 0x72 or 0x73 */
171 /*1*/ u8 sense_key; /* one of enum scsi_sense_keys (4 lower bits) */
172 /*2*/ __be16 additional_sense_code; /* enum osd_additional_sense_codes */
173 /*4*/ u8 Reserved[3];
174 /*7*/ u8 additional_sense_length; /* n - 7 */
175 /*8*/ struct scsi_sense_descriptor ssd[0]; /* variable length, 1 or more */
176 } __packed;
177 
178 /* some descriptors deployed by OSD */
179 
180 /* SPC3r23 4.5.2.3 Command-specific information sense data descriptor */
181 /* Note: this is the same for descriptor_type=00 but with type=00 the
182  * Reserved[0] == 0x80 (ie. bit-7 set)
183  */
185 /*0*/ u8 descriptor_type; /* (00h/01h) */
186 /*1*/ u8 additional_length; /* (0Ah) */
187 /*2*/ u8 Reserved[2];
189 } __packed;
190 /*12*/
191 
193 /*0*/ u8 descriptor_type; /* (02h) */
194 /*1*/ u8 additional_length; /* (06h) */
195 /*2*/ u8 Reserved[2];
196 /* SKSV, C/D, Reserved (2), BPV, BIT POINTER (3) */
198 /*5*/ __be16 value; /* field-pointer/progress-value/retry-count/... */
199 /*7*/ u8 Reserved2;
200 } __packed;
201 /*8*/
202 
203 /* 4.16.2.1 OSD error identification sense data descriptor - table 52 */
204 /* Note: these bits are defined LE order for easy definition, this way the BIT()
205  * number is the same as in the documentation. Below members at
206  * osd_sense_identification_data_descriptor are therefore defined __le32.
207  */
217 };
218 
220 /*0*/ u8 descriptor_type; /* (06h) */
221 /*1*/ u8 additional_length; /* (1Eh) */
222 /*2*/ u8 Reserved[6];
223 /*8*/ __le32 not_initiated_functions; /*osd_command_functions_bits*/
224 /*12*/ __le32 completed_functions; /*osd_command_functions_bits*/
227 } __packed;
228 /*32*/
229 
231 /*0*/ u8 descriptor_type; /* (07h) */
232 /*1*/ u8 additional_length; /* (20h) */
233 /*2*/ u8 integrity_check_value[32]; /*FIXME: OSDv2_CRYPTO_KEYID_SIZE*/
234 } __packed;
235 /*34*/
236 
238 /*0*/ u8 descriptor_type; /* (08h) */
239 /*1*/ u8 additional_length; /* (n-2) */
240 /*2*/ u8 Reserved[6];
241  struct osd_sense_attr {
244 /*16*/ } sense_attrs[0]; /* 1 or more */
245 } __packed;
246 /*variable*/
247 
248 /* Dig into scsi_sk_illegal_request/scsi_invalid_field_in_cdb errors */
249 
250 /*FIXME: Support also field in CAPS*/
251 #define OSD_CDB_OFFSET(F) offsetof(struct osd_cdb_head, F)
252 
260  permissions_bit_mask),
261 };
262 
263 #endif /* ndef __OSD_SENSE_H__ */