aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/osd_protocol.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/osd_protocol.h')
-rw-r--r--include/scsi/osd_protocol.h96
1 files changed, 71 insertions, 25 deletions
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index cd3cbf764650..62b2ab8c69d4 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -24,17 +24,18 @@ enum {
24 OSDv1_ADDITIONAL_CDB_LENGTH = 192, 24 OSDv1_ADDITIONAL_CDB_LENGTH = 192,
25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8, 25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
26 OSDv1_CAP_LEN = 80, 26 OSDv1_CAP_LEN = 80,
27
27 /* Latest supported version */ 28 /* Latest supported version */
28/* OSD_ADDITIONAL_CDB_LENGTH = 216,*/ 29 OSDv2_ADDITIONAL_CDB_LENGTH = 228,
29 OSD_ADDITIONAL_CDB_LENGTH = 30 OSD_ADDITIONAL_CDB_LENGTH =
30 OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */ 31 OSDv2_ADDITIONAL_CDB_LENGTH,
31 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8, 32 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
32/* OSD_CAP_LEN = 104,*/ 33 OSD_CAP_LEN = 104,
33 OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */
34 34
35 OSD_SYSTEMID_LEN = 20, 35 OSD_SYSTEMID_LEN = 20,
36 OSD_CRYPTO_KEYID_SIZE = 20, 36 OSDv1_CRYPTO_KEYID_SIZE = 20,
37 /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/ 37 OSDv2_CRYPTO_KEYID_SIZE = 32,
38 OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
38 OSD_CRYPTO_SEED_SIZE = 4, 39 OSD_CRYPTO_SEED_SIZE = 4,
39 OSD_CRYPTO_NONCE_SIZE = 12, 40 OSD_CRYPTO_NONCE_SIZE = 12,
40 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */ 41 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
@@ -164,7 +165,11 @@ struct osd_cdb_head {
164 /* called allocation_length in some commands */ 165 /* called allocation_length in some commands */
165/*32*/ __be64 length; 166/*32*/ __be64 length;
166/*40*/ __be64 start_address; 167/*40*/ __be64 start_address;
167/*48*/ __be32 list_identifier;/* Rarely used */ 168 union {
169/*48*/ __be32 list_identifier;/* Rarely used */
170 /* OSD2r05 5.2.5 CDB continuation length */
171/*48*/ __be32 cdb_continuation_length;
172 };
168 } __packed v2; 173 } __packed v2;
169 }; 174 };
170/*52*/ union { /* selected attributes mode Page/List/Single */ 175/*52*/ union { /* selected attributes mode Page/List/Single */
@@ -204,29 +209,40 @@ struct osd_cdb_head {
204/*80*/ 209/*80*/
205 210
206/*160 v1*/ 211/*160 v1*/
207/*184 v2*/ 212struct osdv1_security_parameters {
208struct osd_security_parameters { 213/*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE];
209/*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
210/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; 214/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
211/*192*/osd_cdb_offset data_in_integrity_check_offset; 215/*192*/osd_cdb_offset data_in_integrity_check_offset;
212/*196*/osd_cdb_offset data_out_integrity_check_offset; 216/*196*/osd_cdb_offset data_out_integrity_check_offset;
213} __packed; 217} __packed;
214/*200 v1*/ 218/*200 v1*/
215/*224 v2*/
216 219
217/* FIXME: osdv2_security_parameters */ 220/*184 v2*/
221struct osdv2_security_parameters {
222/*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE];
223/*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
224/*228*/osd_cdb_offset data_in_integrity_check_offset;
225/*232*/osd_cdb_offset data_out_integrity_check_offset;
226} __packed;
227/*236 v2*/
228
229struct osd_security_parameters {
230 union {
231 struct osdv1_security_parameters v1;
232 struct osdv2_security_parameters v2;
233 };
234};
218 235
219struct osdv1_cdb { 236struct osdv1_cdb {
220 struct osd_cdb_head h; 237 struct osd_cdb_head h;
221 u8 caps[OSDv1_CAP_LEN]; 238 u8 caps[OSDv1_CAP_LEN];
222 struct osd_security_parameters sec_params; 239 struct osdv1_security_parameters sec_params;
223} __packed; 240} __packed;
224 241
225struct osdv2_cdb { 242struct osdv2_cdb {
226 struct osd_cdb_head h; 243 struct osd_cdb_head h;
227 u8 caps[OSD_CAP_LEN]; 244 u8 caps[OSD_CAP_LEN];
228 struct osd_security_parameters sec_params; 245 struct osdv2_security_parameters sec_params;
229 /* FIXME: osdv2_security_parameters */
230} __packed; 246} __packed;
231 247
232struct osd_cdb { 248struct osd_cdb {
@@ -301,14 +317,25 @@ struct osd_attributes_list_attrid {
301} __packed; 317} __packed;
302 318
303/* 319/*
320 * NOTE: v1: is not aligned.
321 */
322struct osdv1_attributes_list_element {
323 __be32 attr_page;
324 __be32 attr_id;
325 __be16 attr_bytes; /* valid bytes at attr_val without padding */
326 u8 attr_val[0];
327} __packed;
328
329/*
304 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and 330 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
305 * for setting attributes 331 * for setting attributes
306 * NOTE: v2 is 8-bytes aligned, v1 is not aligned. 332 * NOTE: v2 is 8-bytes aligned
307 */ 333 */
308struct osd_attributes_list_element { 334struct osdv2_attributes_list_element {
309 __be32 attr_page; 335 __be32 attr_page;
310 __be32 attr_id; 336 __be32 attr_id;
311 __be16 attr_bytes; 337 u8 reserved[6];
338 __be16 attr_bytes; /* valid bytes at attr_val without padding */
312 u8 attr_val[0]; 339 u8 attr_val[0];
313} __packed; 340} __packed;
314 341
@@ -324,13 +351,13 @@ enum {
324 351
325static inline unsigned osdv1_attr_list_elem_size(unsigned len) 352static inline unsigned osdv1_attr_list_elem_size(unsigned len)
326{ 353{
327 return ALIGN(len + sizeof(struct osd_attributes_list_element), 354 return ALIGN(len + sizeof(struct osdv1_attributes_list_element),
328 OSDv1_ATTRIBUTES_ELEM_ALIGN); 355 OSDv1_ATTRIBUTES_ELEM_ALIGN);
329} 356}
330 357
331static inline unsigned osdv2_attr_list_elem_size(unsigned len) 358static inline unsigned osdv2_attr_list_elem_size(unsigned len)
332{ 359{
333 return ALIGN(len + sizeof(struct osd_attributes_list_element), 360 return ALIGN(len + sizeof(struct osdv2_attributes_list_element),
334 OSD_ATTRIBUTES_ELEM_ALIGN); 361 OSD_ATTRIBUTES_ELEM_ALIGN);
335} 362}
336 363
@@ -419,15 +446,35 @@ struct osd_data_out_integrity_info {
419 __be64 data_bytes; 446 __be64 data_bytes;
420 __be64 set_attributes_bytes; 447 __be64 set_attributes_bytes;
421 __be64 get_attributes_bytes; 448 __be64 get_attributes_bytes;
422 __be64 integrity_check_value; 449 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
423} __packed; 450} __packed;
424 451
452/* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference
453 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
454 * below for version independent handling of this structure
455 */
456static inline int osd_data_out_integrity_info_sizeof(bool is_ver1)
457{
458 return sizeof(struct osd_data_out_integrity_info) -
459 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
460}
461
425struct osd_data_in_integrity_info { 462struct osd_data_in_integrity_info {
426 __be64 data_bytes; 463 __be64 data_bytes;
427 __be64 retrieved_attributes_bytes; 464 __be64 retrieved_attributes_bytes;
428 __be64 integrity_check_value; 465 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
429} __packed; 466} __packed;
430 467
468/* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference
469 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
470 * below for version independent handling of this structure
471 */
472static inline int osd_data_in_integrity_info_sizeof(bool is_ver1)
473{
474 return sizeof(struct osd_data_in_integrity_info) -
475 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
476}
477
431struct osd_timestamp { 478struct osd_timestamp {
432 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */ 479 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
433} __packed; 480} __packed;
@@ -477,7 +524,7 @@ enum osd_capability_bit_masks {
477 524
478 OSD_SEC_CAP_NONE1 = BIT(8), 525 OSD_SEC_CAP_NONE1 = BIT(8),
479 OSD_SEC_CAP_NONE2 = BIT(9), 526 OSD_SEC_CAP_NONE2 = BIT(9),
480 OSD_SEC_CAP_NONE3 = BIT(10), 527 OSD_SEC_GBL_REM = BIT(10), /*v2 only*/
481 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/ 528 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
482 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/ 529 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
483 OSD_SEC_CAP_POL_SEC = BIT(13), 530 OSD_SEC_CAP_POL_SEC = BIT(13),
@@ -552,8 +599,7 @@ struct osdv1_capability {
552 599
553struct osd_capability { 600struct osd_capability {
554 struct osd_capability_head h; 601 struct osd_capability_head h;
555/* struct osd_cap_object_descriptor od;*/ 602 struct osd_cap_object_descriptor od;
556 struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */
557} __packed; 603} __packed;
558 604
559/** 605/**