x86/amd-iommu: Add per IOMMU reference counting
[linux/fpc-iii.git] / include / scsi / osd_attributes.h
blob56e920ade3269f4895546c13bc419bad045f2400
1 #ifndef __OSD_ATTRIBUTES_H__
2 #define __OSD_ATTRIBUTES_H__
4 #include "osd_protocol.h"
6 /*
7 * Contains types and constants that define attribute pages and attribute
8 * numbers and their data types.
9 */
11 #define ATTR_SET(pg, id, l, ptr) \
12 { .attr_page = pg, .attr_id = id, .len = l, .val_ptr = ptr }
14 #define ATTR_DEF(pg, id, l) ATTR_SET(pg, id, l, NULL)
16 /* osd-r10 4.7.3 Attributes pages */
17 enum {
18 OSD_APAGE_OBJECT_FIRST = 0x0,
19 OSD_APAGE_OBJECT_DIRECTORY = 0,
20 OSD_APAGE_OBJECT_INFORMATION = 1,
21 OSD_APAGE_OBJECT_QUOTAS = 2,
22 OSD_APAGE_OBJECT_TIMESTAMP = 3,
23 OSD_APAGE_OBJECT_COLLECTIONS = 4,
24 OSD_APAGE_OBJECT_SECURITY = 5,
25 OSD_APAGE_OBJECT_LAST = 0x2fffffff,
27 OSD_APAGE_PARTITION_FIRST = 0x30000000,
28 OSD_APAGE_PARTITION_DIRECTORY = OSD_APAGE_PARTITION_FIRST + 0,
29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1,
30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2,
31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3,
32 OSD_APAGE_PARTITION_ATTR_ACCESS = OSD_APAGE_PARTITION_FIRST + 4,
33 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5,
34 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF,
36 OSD_APAGE_COLLECTION_FIRST = 0x60000000,
37 OSD_APAGE_COLLECTION_DIRECTORY = OSD_APAGE_COLLECTION_FIRST + 0,
38 OSD_APAGE_COLLECTION_INFORMATION = OSD_APAGE_COLLECTION_FIRST + 1,
39 OSD_APAGE_COLLECTION_TIMESTAMP = OSD_APAGE_COLLECTION_FIRST + 3,
40 OSD_APAGE_COLLECTION_SECURITY = OSD_APAGE_COLLECTION_FIRST + 5,
41 OSD_APAGE_COLLECTION_LAST = 0x8FFFFFFF,
43 OSD_APAGE_ROOT_FIRST = 0x90000000,
44 OSD_APAGE_ROOT_DIRECTORY = OSD_APAGE_ROOT_FIRST + 0,
45 OSD_APAGE_ROOT_INFORMATION = OSD_APAGE_ROOT_FIRST + 1,
46 OSD_APAGE_ROOT_QUOTAS = OSD_APAGE_ROOT_FIRST + 2,
47 OSD_APAGE_ROOT_TIMESTAMP = OSD_APAGE_ROOT_FIRST + 3,
48 OSD_APAGE_ROOT_SECURITY = OSD_APAGE_ROOT_FIRST + 5,
49 OSD_APAGE_ROOT_LAST = 0xBFFFFFFF,
51 OSD_APAGE_RESERVED_TYPE_FIRST = 0xC0000000,
52 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF,
54 OSD_APAGE_COMMON_FIRST = 0xF0000000,
55 OSD_APAGE_COMMON_LAST = 0xFFFFFFFD,
57 OSD_APAGE_CURRENT_COMMAND = 0xFFFFFFFE,
59 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF,
62 /* subcategories of attr pages within each range above */
63 enum {
64 OSD_APAGE_STD_FIRST = 0x0,
65 OSD_APAGE_STD_DIRECTORY = 0,
66 OSD_APAGE_STD_INFORMATION = 1,
67 OSD_APAGE_STD_QUOTAS = 2,
68 OSD_APAGE_STD_TIMESTAMP = 3,
69 OSD_APAGE_STD_COLLECTIONS = 4,
70 OSD_APAGE_STD_POLICY_SECURITY = 5,
71 OSD_APAGE_STD_LAST = 0x0000007F,
73 OSD_APAGE_RESERVED_FIRST = 0x00000080,
74 OSD_APAGE_RESERVED_LAST = 0x00007FFF,
76 OSD_APAGE_OTHER_STD_FIRST = 0x00008000,
77 OSD_APAGE_OTHER_STD_LAST = 0x0000EFFF,
79 OSD_APAGE_PUBLIC_FIRST = 0x0000F000,
80 OSD_APAGE_PUBLIC_LAST = 0x0000FFFF,
82 OSD_APAGE_APP_DEFINED_FIRST = 0x00010000,
83 OSD_APAGE_APP_DEFINED_LAST = 0x1FFFFFFF,
85 OSD_APAGE_VENDOR_SPECIFIC_FIRST = 0x20000000,
86 OSD_APAGE_VENDOR_SPECIFIC_LAST = 0x2FFFFFFF,
89 enum {
90 OSD_ATTR_PAGE_IDENTIFICATION = 0, /* in all pages 40 bytes */
93 struct page_identification {
94 u8 vendor_identification[8];
95 u8 page_identification[32];
96 } __packed;
98 struct osd_attr_page_header {
99 __be32 page_number;
100 __be32 page_length;
101 } __packed;
103 /* 7.1.2.8 Root Information attributes page (OSD_APAGE_ROOT_INFORMATION) */
104 enum {
105 OSD_ATTR_RI_OSD_SYSTEM_ID = 0x3, /* 20 */
106 OSD_ATTR_RI_VENDOR_IDENTIFICATION = 0x4, /* 8 */
107 OSD_ATTR_RI_PRODUCT_IDENTIFICATION = 0x5, /* 16 */
108 OSD_ATTR_RI_PRODUCT_MODEL = 0x6, /* 32 */
109 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */
110 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */
111 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */
112 OSD_ATTR_RI_MAX_CDB_CONTINUATION_LEN = 0xA, /* 4 */
113 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */
114 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */
115 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */
116 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */
117 OARI_DEFAULT_ISOLATION_METHOD = 0X110, /* 1 */
118 OARI_SUPPORTED_ISOLATION_METHODS = 0X111, /* 32 */
120 OARI_DATA_ATOMICITY_GUARANTEE = 0X120, /* 8 */
121 OARI_DATA_ATOMICITY_ALIGNMENT = 0X121, /* 8 */
122 OARI_ATTRIBUTES_ATOMICITY_GUARANTEE = 0X122, /* 8 */
123 OARI_DATA_ATTRIBUTES_ATOMICITY_MULTIPLIER = 0X123, /* 1 */
125 OARI_MAXIMUM_SNAPSHOTS_COUNT = 0X1C1, /* 0 or 4 */
126 OARI_MAXIMUM_CLONES_COUNT = 0X1C2, /* 0 or 4 */
127 OARI_MAXIMUM_BRANCH_DEPTH = 0X1CC, /* 0 or 4 */
128 OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_FIRST = 0X200, /* 0 or 4 */
129 OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_LAST = 0X2ff, /* 0 or 4 */
130 OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_FIRST = 0X300, /* 0 or 4 */
131 OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_LAST = 0X30F, /* 0 or 4 */
132 OARI_SUPPORT_FOR_DUPLICATED_OBJECT_FREEZING = 0X310, /* 0 or 4 */
133 OARI_SUPPORT_FOR_SNAPSHOT_REFRESHING = 0X311, /* 0 or 1 */
134 OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_FIRST = 0X7000001,/* 0 or 4 */
135 OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_LAST = 0X700FFFF,/* 0 or 4 */
137 /* Root_Information_attributes_page does not have a get_page structure */
139 /* 7.1.2.9 Partition Information attributes page
140 * (OSD_APAGE_PARTITION_INFORMATION)
142 enum {
143 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */
144 OSD_ATTR_PI_USERNAME = 0x9, /* variable */
145 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_PI_USED_CAPACITY_INCREMENT = 0x84, /* 0 or 8 */
147 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */
149 OSD_ATTR_PI_ACTUAL_DATA_SPACE = 0xD1, /* 0 or 8 */
150 OSD_ATTR_PI_RESERVED_DATA_SPACE = 0xD2, /* 0 or 8 */
151 OSD_ATTR_PI_DEFAULT_SNAPSHOT_DUPLICATION_METHOD = 0x200,/* 0 or 4 */
152 OSD_ATTR_PI_DEFAULT_CLONE_DUPLICATION_METHOD = 0x201,/* 0 or 4 */
153 OSD_ATTR_PI_DEFAULT_SP_TIME_OF_DUPLICATION = 0x300,/* 0 or 4 */
154 OSD_ATTR_PI_DEFAULT_CLONE_TIME_OF_DUPLICATION = 0x301,/* 0 or 4 */
156 /* Partition Information attributes page does not have a get_page structure */
158 /* 7.1.2.10 Collection Information attributes page
159 * (OSD_APAGE_COLLECTION_INFORMATION)
161 enum {
162 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */
163 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */
164 OSD_ATTR_CI_USERNAME = 0x9, /* variable */
165 OSD_ATTR_CI_COLLECTION_TYPE = 0xA, /* 1 */
166 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */
168 /* Collection Information attributes page does not have a get_page structure */
170 /* 7.1.2.11 User Object Information attributes page
171 * (OSD_APAGE_OBJECT_INFORMATION)
173 enum {
174 OSD_ATTR_OI_PARTITION_ID = 0x1, /* 8 */
175 OSD_ATTR_OI_OBJECT_ID = 0x2, /* 8 */
176 OSD_ATTR_OI_USERNAME = 0x9, /* variable */
177 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */
178 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */
179 SD_ATTR_OI_ACTUAL_DATA_SPACE = 0XD1, /* 0 OR 8 */
180 SD_ATTR_OI_RESERVED_DATA_SPACE = 0XD2, /* 0 OR 8 */
182 /* Object Information attributes page does not have a get_page structure */
184 /* 7.1.2.12 Root Quotas attributes page (OSD_APAGE_ROOT_QUOTAS) */
185 enum {
186 OSD_ATTR_RQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
187 OSD_ATTR_RQ_PARTITION_CAPACITY_QUOTA = 0x10001, /* 8 */
188 OSD_ATTR_RQ_PARTITION_OBJECT_COUNT = 0x10002, /* 8 */
189 OSD_ATTR_RQ_PARTITION_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
190 OSD_ATTR_RQ_PARTITION_COUNT = 0x20002, /* 8 */
193 struct Root_Quotas_attributes_page {
194 struct osd_attr_page_header hdr; /* id=R+2, size=0x24 */
195 __be64 default_maximum_user_object_length;
196 __be64 partition_capacity_quota;
197 __be64 partition_object_count;
198 __be64 partition_collections_per_user_object;
199 __be64 partition_count;
200 } __packed;
202 /* 7.1.2.13 Partition Quotas attributes page (OSD_APAGE_PARTITION_QUOTAS)*/
203 enum {
204 OSD_ATTR_PQ_DEFAULT_MAXIMUM_USER_OBJECT_LENGTH = 0x1, /* 8 */
205 OSD_ATTR_PQ_CAPACITY_QUOTA = 0x10001, /* 8 */
206 OSD_ATTR_PQ_OBJECT_COUNT = 0x10002, /* 8 */
207 OSD_ATTR_PQ_COLLECTIONS_PER_USER_OBJECT = 0x10081, /* 4 */
210 struct Partition_Quotas_attributes_page {
211 struct osd_attr_page_header hdr; /* id=P+2, size=0x1C */
212 __be64 default_maximum_user_object_length;
213 __be64 capacity_quota;
214 __be64 object_count;
215 __be64 collections_per_user_object;
216 } __packed;
218 /* 7.1.2.14 User Object Quotas attributes page (OSD_APAGE_OBJECT_QUOTAS) */
219 enum {
220 OSD_ATTR_OQ_MAXIMUM_LENGTH = 0x1, /* 8 */
223 struct Object_Quotas_attributes_page {
224 struct osd_attr_page_header hdr; /* id=U+2, size=0x8 */
225 __be64 maximum_length;
226 } __packed;
228 /* 7.1.2.15 Root Timestamps attributes page (OSD_APAGE_ROOT_TIMESTAMP) */
229 enum {
230 OSD_ATTR_RT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
231 OSD_ATTR_RT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
232 OSD_ATTR_RT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
235 struct root_timestamps_attributes_page {
236 struct osd_attr_page_header hdr; /* id=R+3, size=0xD */
237 struct osd_timestamp attributes_accessed_time;
238 struct osd_timestamp attributes_modified_time;
239 u8 timestamp_bypass;
240 } __packed;
242 /* 7.1.2.16 Partition Timestamps attributes page
243 * (OSD_APAGE_PARTITION_TIMESTAMP)
245 enum {
246 OSD_ATTR_PT_CREATED_TIME = 0x1, /* 6 */
247 OSD_ATTR_PT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
248 OSD_ATTR_PT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
249 OSD_ATTR_PT_DATA_ACCESSED_TIME = 0x4, /* 6 */
250 OSD_ATTR_PT_DATA_MODIFIED_TIME = 0x5, /* 6 */
251 OSD_ATTR_PT_TIMESTAMP_BYPASS = 0xFFFFFFFE, /* 1 */
254 struct partition_timestamps_attributes_page {
255 struct osd_attr_page_header hdr; /* id=P+3, size=0x1F */
256 struct osd_timestamp created_time;
257 struct osd_timestamp attributes_accessed_time;
258 struct osd_timestamp attributes_modified_time;
259 struct osd_timestamp data_accessed_time;
260 struct osd_timestamp data_modified_time;
261 u8 timestamp_bypass;
262 } __packed;
264 /* 7.1.2.17/18 Collection/Object Timestamps attributes page
265 * (OSD_APAGE_COLLECTION_TIMESTAMP/OSD_APAGE_OBJECT_TIMESTAMP)
267 enum {
268 OSD_ATTR_OT_CREATED_TIME = 0x1, /* 6 */
269 OSD_ATTR_OT_ATTRIBUTES_ACCESSED_TIME = 0x2, /* 6 */
270 OSD_ATTR_OT_ATTRIBUTES_MODIFIED_TIME = 0x3, /* 6 */
271 OSD_ATTR_OT_DATA_ACCESSED_TIME = 0x4, /* 6 */
272 OSD_ATTR_OT_DATA_MODIFIED_TIME = 0x5, /* 6 */
275 /* same for collection */
276 struct object_timestamps_attributes_page {
277 struct osd_attr_page_header hdr; /* id=C+3/3, size=0x1E */
278 struct osd_timestamp created_time;
279 struct osd_timestamp attributes_accessed_time;
280 struct osd_timestamp attributes_modified_time;
281 struct osd_timestamp data_accessed_time;
282 struct osd_timestamp data_modified_time;
283 } __packed;
285 /* OSD2r05: 7.1.3.19 Attributes Access attributes page
286 * (OSD_APAGE_PARTITION_ATTR_ACCESS)
288 * each attribute is of the form below. Total array length is deduced
289 * from the attribute's length
290 * (See allowed_attributes_access of the struct osd_cap_object_descriptor)
292 struct attributes_access_attr {
293 struct osd_attributes_list_attrid attr_list[0];
294 } __packed;
296 /* OSD2r05: 7.1.2.21 Collections attributes page */
297 /* TBD */
299 /* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */
300 enum {
301 OSD_ATTR_RS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
302 OSD_ATTR_RS_OLDEST_VALID_NONCE_LIMIT = 0x2, /* 6 */
303 OSD_ATTR_RS_NEWEST_VALID_NONCE_LIMIT = 0x3, /* 6 */
304 OSD_ATTR_RS_PARTITION_DEFAULT_SECURITY_METHOD = 0x6, /* 1 */
305 OSD_ATTR_RS_SUPPORTED_SECURITY_METHODS = 0x7, /* 2 */
306 OSD_ATTR_RS_ADJUSTABLE_CLOCK = 0x9, /* 6 */
307 OSD_ATTR_RS_MASTER_KEY_IDENTIFIER = 0x7FFD, /* 0 or 7 */
308 OSD_ATTR_RS_ROOT_KEY_IDENTIFIER = 0x7FFE, /* 0 or 7 */
309 OSD_ATTR_RS_SUPPORTED_INTEGRITY_ALGORITHM_0 = 0x80000000,/* 1,(x16)*/
310 OSD_ATTR_RS_SUPPORTED_DH_GROUP_0 = 0x80000010,/* 1,(x16)*/
313 struct root_security_attributes_page {
314 struct osd_attr_page_header hdr; /* id=R+5, size=0x3F */
315 u8 default_security_method;
316 u8 partition_default_security_method;
317 __be16 supported_security_methods;
318 u8 mki_valid_rki_valid;
319 struct osd_timestamp oldest_valid_nonce_limit;
320 struct osd_timestamp newest_valid_nonce_limit;
321 struct osd_timestamp adjustable_clock;
322 u8 master_key_identifier[32-25];
323 u8 root_key_identifier[39-32];
324 u8 supported_integrity_algorithm[16];
325 u8 supported_dh_group[16];
326 } __packed;
328 /* 7.1.2.21 Partition Policy/Security attributes page
329 * (OSD_APAGE_PARTITION_SECURITY)
331 enum {
332 OSD_ATTR_PS_DEFAULT_SECURITY_METHOD = 0x1, /* 1 */
333 OSD_ATTR_PS_OLDEST_VALID_NONCE = 0x2, /* 6 */
334 OSD_ATTR_PS_NEWEST_VALID_NONCE = 0x3, /* 6 */
335 OSD_ATTR_PS_REQUEST_NONCE_LIST_DEPTH = 0x4, /* 2 */
336 OSD_ATTR_PS_FROZEN_WORKING_KEY_BIT_MASK = 0x5, /* 2 */
337 OSD_ATTR_PS_PARTITION_KEY_IDENTIFIER = 0x7FFF, /* 0 or 7 */
338 OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_FIRST = 0x8000, /* 0 or 7 */
339 OSD_ATTR_PS_WORKING_KEY_IDENTIFIER_LAST = 0x800F, /* 0 or 7 */
340 OSD_ATTR_PS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
341 OSD_ATTR_PS_USER_OBJECT_POLICY_ACCESS_TAG = 0x40000002, /* 4 */
344 struct partition_security_attributes_page {
345 struct osd_attr_page_header hdr; /* id=p+5, size=0x8f */
346 u8 reserved[3];
347 u8 default_security_method;
348 struct osd_timestamp oldest_valid_nonce;
349 struct osd_timestamp newest_valid_nonce;
350 __be16 request_nonce_list_depth;
351 __be16 frozen_working_key_bit_mask;
352 __be32 policy_access_tag;
353 __be32 user_object_policy_access_tag;
354 u8 pki_valid;
355 __be16 wki_00_0f_vld;
356 struct osd_key_identifier partition_key_identifier;
357 struct osd_key_identifier working_key_identifiers[16];
358 } __packed;
360 /* 7.1.2.22/23 Collection/Object Policy-Security attributes page
361 * (OSD_APAGE_COLLECTION_SECURITY/OSD_APAGE_OBJECT_SECURITY)
363 enum {
364 OSD_ATTR_OS_POLICY_ACCESS_TAG = 0x40000001, /* 4 */
367 struct object_security_attributes_page {
368 struct osd_attr_page_header hdr; /* id=C+5/5, size=4 */
369 __be32 policy_access_tag;
370 } __packed;
372 /* OSD2r05: 7.1.3.31 Current Command attributes page
373 * (OSD_APAGE_CURRENT_COMMAND)
375 enum {
376 OSD_ATTR_CC_RESPONSE_INTEGRITY_CHECK_VALUE = 0x1, /* 32 */
377 OSD_ATTR_CC_OBJECT_TYPE = 0x2, /* 1 */
378 OSD_ATTR_CC_PARTITION_ID = 0x3, /* 8 */
379 OSD_ATTR_CC_OBJECT_ID = 0x4, /* 8 */
380 OSD_ATTR_CC_STARTING_BYTE_ADDRESS_OF_APPEND = 0x5, /* 8 */
381 OSD_ATTR_CC_CHANGE_IN_USED_CAPACITY = 0x6, /* 8 */
384 /*TBD: osdv1_current_command_attributes_page */
386 struct osdv2_current_command_attributes_page {
387 struct osd_attr_page_header hdr; /* id=0xFFFFFFFE, size=0x44 */
388 u8 response_integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
389 u8 object_type;
390 u8 reserved[3];
391 __be64 partition_id;
392 __be64 object_id;
393 __be64 starting_byte_address_of_append;
394 __be64 change_in_used_capacity;
397 #endif /*ndef __OSD_ATTRIBUTES_H__*/