ore: RAID5 Write
[linux-2.6.git] / include / scsi / osd_protocol.h
index bbeceeb..a6026da 100644 (file)
@@ -17,6 +17,7 @@
 #define __OSD_PROTOCOL_H__
 
 #include <linux/types.h>
+#include <linux/kernel.h>
 #include <asm/unaligned.h>
 #include <scsi/scsi.h>
 
@@ -24,18 +25,17 @@ enum {
        OSDv1_ADDITIONAL_CDB_LENGTH = 192,
        OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
        OSDv1_CAP_LEN = 80,
+
        /* Latest supported version */
-/*     OSD_ADDITIONAL_CDB_LENGTH = 216,*/
+       OSDv2_ADDITIONAL_CDB_LENGTH = 228,
        OSD_ADDITIONAL_CDB_LENGTH =
-               OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */
+               OSDv2_ADDITIONAL_CDB_LENGTH,
        OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
-/*     OSD_CAP_LEN = 104,*/
-       OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */
+       OSD_CAP_LEN = 104,
 
        OSD_SYSTEMID_LEN = 20,
        OSDv1_CRYPTO_KEYID_SIZE = 20,
-       /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/
-       OSDv2_CRYPTO_KEYID_SIZE = 20,
+       OSDv2_CRYPTO_KEYID_SIZE = 32,
        OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
        OSD_CRYPTO_SEED_SIZE = 4,
        OSD_CRYPTO_NONCE_SIZE = 12,
@@ -166,7 +166,11 @@ struct osd_cdb_head {
                        /* called allocation_length in some commands */
 /*32*/                 __be64  length;
 /*40*/                 __be64  start_address;
-/*48*/                 __be32 list_identifier;/* Rarely used */
+                       union {
+/*48*/                         __be32 list_identifier;/* Rarely used */
+                               /* OSD2r05 5.2.5 CDB continuation length */
+/*48*/                         __be32 cdb_continuation_length;
+                       };
                } __packed v2;
        };
 /*52*/ union { /* selected attributes mode Page/List/Single */
@@ -300,7 +304,15 @@ enum osd_service_actions {
        OSD_ACT_V2(REMOVE_MEMBER_OBJECTS,       0x21)
        OSD_ACT_V2(GET_MEMBER_ATTRIBUTES,       0x22)
        OSD_ACT_V2(SET_MEMBER_ATTRIBUTES,       0x23)
+
+       OSD_ACT_V2(CREATE_CLONE,                0x28)
+       OSD_ACT_V2(CREATE_SNAPSHOT,             0x29)
+       OSD_ACT_V2(DETACH_CLONE,                0x2A)
+       OSD_ACT_V2(REFRESH_SNAPSHOT_CLONE,      0x2B)
+       OSD_ACT_V2(RESTORE_PARTITION_FROM_SNAPSHOT, 0x2C)
+
        OSD_ACT_V2(READ_MAP,                    0x31)
+       OSD_ACT_V2(READ_MAPS_COMPARE,           0x32)
 
        OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND,     0x8F7E, 0x8F7C)
        OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT,     0x8F7F, 0x8F7D)
@@ -331,6 +343,7 @@ struct osdv1_attributes_list_element {
 struct osdv2_attributes_list_element {
        __be32 attr_page;
        __be32 attr_id;
+       u8 reserved[6];
        __be16 attr_bytes; /* valid bytes at attr_val without padding */
        u8 attr_val[0];
 } __packed;
@@ -520,7 +533,7 @@ enum osd_capability_bit_masks {
 
        OSD_SEC_CAP_NONE1       = BIT(8),
        OSD_SEC_CAP_NONE2       = BIT(9),
-       OSD_SEC_CAP_NONE3       = BIT(10),
+       OSD_SEC_GBL_REM         = BIT(10), /*v2 only*/
        OSD_SEC_CAP_QUERY       = BIT(11), /*v2 only*/
        OSD_SEC_CAP_M_OBJECT    = BIT(12), /*v2 only*/
        OSD_SEC_CAP_POL_SEC     = BIT(13),
@@ -595,8 +608,7 @@ struct osdv1_capability {
 
 struct osd_capability {
        struct osd_capability_head h;
-/*     struct osd_cap_object_descriptor od;*/
-       struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */
+       struct osd_cap_object_descriptor od;
 } __packed;
 
 /**
@@ -619,4 +631,46 @@ static inline void osd_sec_set_caps(struct osd_capability_head *cap,
        put_unaligned_le16(bit_mask, &cap->permissions_bit_mask);
 }
 
+/* osd2r05a sec 5.3: CDB continuation segment formats */
+enum osd_continuation_segment_format {
+       CDB_CONTINUATION_FORMAT_V2 = 0x01,
+};
+
+struct osd_continuation_segment_header {
+       u8      format;
+       u8      reserved1;
+       __be16  service_action;
+       __be32  reserved2;
+       u8      integrity_check[OSDv2_CRYPTO_KEYID_SIZE];
+} __packed;
+
+/* osd2r05a sec 5.4.1: CDB continuation descriptors */
+enum osd_continuation_descriptor_type {
+       NO_MORE_DESCRIPTORS = 0x0000,
+       SCATTER_GATHER_LIST = 0x0001,
+       QUERY_LIST = 0x0002,
+       USER_OBJECT = 0x0003,
+       COPY_USER_OBJECT_SOURCE = 0x0101,
+       EXTENSION_CAPABILITIES = 0xFFEE
+};
+
+struct osd_continuation_descriptor_header {
+       __be16  type;
+       u8      reserved;
+       u8      pad_length;
+       __be32  length;
+} __packed;
+
+
+/* osd2r05a sec 5.4.2: Scatter/gather list */
+struct osd_sg_list_entry {
+       __be64 offset;
+       __be64 len;
+};
+
+struct osd_sg_continuation_descriptor {
+       struct osd_continuation_descriptor_header hdr;
+       struct osd_sg_list_entry entries[];
+};
+
 #endif /* ndef __OSD_PROTOCOL_H__ */