1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#include <linux/types.h>
18
19#ifndef _OPAL_PROTO_H
20#define _OPAL_PROTO_H
21
22
23
24
25
26
27enum {
28 TCG_SECP_00 = 0,
29 TCG_SECP_01,
30};
31
32
33
34
35
36
37enum opal_response_token {
38 OPAL_DTA_TOKENID_BYTESTRING = 0xe0,
39 OPAL_DTA_TOKENID_SINT = 0xe1,
40 OPAL_DTA_TOKENID_UINT = 0xe2,
41 OPAL_DTA_TOKENID_TOKEN = 0xe3,
42 OPAL_DTA_TOKENID_INVALID = 0X0
43};
44
45#define DTAERROR_NO_METHOD_STATUS 0x89
46#define GENERIC_HOST_SESSION_NUM 0x41
47
48#define TPER_SYNC_SUPPORTED 0x01
49#define MBR_ENABLED_MASK 0x10
50
51#define TINY_ATOM_DATA_MASK 0x3F
52#define TINY_ATOM_SIGNED 0x40
53
54#define SHORT_ATOM_ID 0x80
55#define SHORT_ATOM_BYTESTRING 0x20
56#define SHORT_ATOM_SIGNED 0x10
57#define SHORT_ATOM_LEN_MASK 0xF
58
59#define MEDIUM_ATOM_ID 0xC0
60#define MEDIUM_ATOM_BYTESTRING 0x10
61#define MEDIUM_ATOM_SIGNED 0x8
62#define MEDIUM_ATOM_LEN_MASK 0x7
63
64#define LONG_ATOM_ID 0xe0
65#define LONG_ATOM_BYTESTRING 0x2
66#define LONG_ATOM_SIGNED 0x1
67
68
69
70
71
72#define TINY_ATOM_BYTE 0x7F
73#define SHORT_ATOM_BYTE 0xBF
74#define MEDIUM_ATOM_BYTE 0xDF
75#define LONG_ATOM_BYTE 0xE3
76
77#define OPAL_INVAL_PARAM 12
78#define OPAL_MANUFACTURED_INACTIVE 0x08
79#define OPAL_DISCOVERY_COMID 0x0001
80
81#define LOCKING_RANGE_NON_GLOBAL 0x03
82
83
84
85
86
87#define OPAL_UID_LENGTH 8
88#define OPAL_METHOD_LENGTH 8
89#define OPAL_MSID_KEYLEN 15
90#define OPAL_UID_LENGTH_HALF 4
91
92
93enum opal_uid {
94
95 OPAL_SMUID_UID,
96 OPAL_THISSP_UID,
97 OPAL_ADMINSP_UID,
98 OPAL_LOCKINGSP_UID,
99 OPAL_ENTERPRISE_LOCKINGSP_UID,
100 OPAL_ANYBODY_UID,
101 OPAL_SID_UID,
102 OPAL_ADMIN1_UID,
103 OPAL_USER1_UID,
104 OPAL_USER2_UID,
105 OPAL_PSID_UID,
106 OPAL_ENTERPRISE_BANDMASTER0_UID,
107 OPAL_ENTERPRISE_ERASEMASTER_UID,
108
109 OPAL_LOCKINGRANGE_GLOBAL,
110 OPAL_LOCKINGRANGE_ACE_RDLOCKED,
111 OPAL_LOCKINGRANGE_ACE_WRLOCKED,
112 OPAL_MBRCONTROL,
113 OPAL_MBR,
114 OPAL_AUTHORITY_TABLE,
115 OPAL_C_PIN_TABLE,
116 OPAL_LOCKING_INFO_TABLE,
117 OPAL_ENTERPRISE_LOCKING_INFO_TABLE,
118
119 OPAL_C_PIN_MSID,
120 OPAL_C_PIN_SID,
121 OPAL_C_PIN_ADMIN1,
122
123 OPAL_HALF_UID_AUTHORITY_OBJ_REF,
124 OPAL_HALF_UID_BOOLEAN_ACE,
125
126 OPAL_UID_HEXFF,
127};
128
129#define OPAL_METHOD_LENGTH 8
130
131
132enum opal_method {
133 OPAL_PROPERTIES,
134 OPAL_STARTSESSION,
135 OPAL_REVERT,
136 OPAL_ACTIVATE,
137 OPAL_EGET,
138 OPAL_ESET,
139 OPAL_NEXT,
140 OPAL_EAUTHENTICATE,
141 OPAL_GETACL,
142 OPAL_GENKEY,
143 OPAL_REVERTSP,
144 OPAL_GET,
145 OPAL_SET,
146 OPAL_AUTHENTICATE,
147 OPAL_RANDOM,
148 OPAL_ERASE,
149};
150
151enum opal_token {
152
153 OPAL_TRUE = 0x01,
154 OPAL_FALSE = 0x00,
155 OPAL_BOOLEAN_EXPR = 0x03,
156
157 OPAL_TABLE = 0x00,
158 OPAL_STARTROW = 0x01,
159 OPAL_ENDROW = 0x02,
160 OPAL_STARTCOLUMN = 0x03,
161 OPAL_ENDCOLUMN = 0x04,
162 OPAL_VALUES = 0x01,
163
164 OPAL_PIN = 0x03,
165
166 OPAL_RANGESTART = 0x03,
167 OPAL_RANGELENGTH = 0x04,
168 OPAL_READLOCKENABLED = 0x05,
169 OPAL_WRITELOCKENABLED = 0x06,
170 OPAL_READLOCKED = 0x07,
171 OPAL_WRITELOCKED = 0x08,
172 OPAL_ACTIVEKEY = 0x0A,
173
174 OPAL_MAXRANGES = 0x04,
175
176 OPAL_MBRENABLE = 0x01,
177 OPAL_MBRDONE = 0x02,
178
179 OPAL_HOSTPROPERTIES = 0x00,
180
181 OPAL_STARTLIST = 0xf0,
182 OPAL_ENDLIST = 0xf1,
183 OPAL_STARTNAME = 0xf2,
184 OPAL_ENDNAME = 0xf3,
185 OPAL_CALL = 0xf8,
186 OPAL_ENDOFDATA = 0xf9,
187 OPAL_ENDOFSESSION = 0xfa,
188 OPAL_STARTTRANSACTON = 0xfb,
189 OPAL_ENDTRANSACTON = 0xfC,
190 OPAL_EMPTYATOM = 0xff,
191 OPAL_WHERE = 0x00,
192};
193
194
195enum opal_lockingstate {
196 OPAL_LOCKING_READWRITE = 0x01,
197 OPAL_LOCKING_READONLY = 0x02,
198 OPAL_LOCKING_LOCKED = 0x03,
199};
200
201
202
203
204
205
206
207struct opal_compacket {
208 __be32 reserved0;
209 u8 extendedComID[4];
210 __be32 outstandingData;
211 __be32 minTransfer;
212 __be32 length;
213};
214
215
216struct opal_packet {
217 __be32 tsn;
218 __be32 hsn;
219 __be32 seq_number;
220 __be16 reserved0;
221 __be16 ack_type;
222 __be32 acknowledgment;
223 __be32 length;
224};
225
226
227struct opal_data_subpacket {
228 u8 reserved0[6];
229 __be16 kind;
230 __be32 length;
231};
232
233
234struct opal_header {
235 struct opal_compacket cp;
236 struct opal_packet pkt;
237 struct opal_data_subpacket subpkt;
238};
239
240#define FC_TPER 0x0001
241#define FC_LOCKING 0x0002
242#define FC_GEOMETRY 0x0003
243#define FC_ENTERPRISE 0x0100
244#define FC_DATASTORE 0x0202
245#define FC_SINGLEUSER 0x0201
246#define FC_OPALV100 0x0200
247#define FC_OPALV200 0x0203
248
249
250
251
252
253
254struct d0_header {
255 __be32 length;
256 __be32 revision;
257 __be32 reserved01;
258 __be32 reserved02;
259
260
261
262
263 u8 ignored[32];
264};
265
266
267
268
269
270
271
272
273struct d0_tper_features {
274
275
276
277
278
279
280
281
282
283
284
285 u8 supported_features;
286
287
288
289
290 u8 reserved01[3];
291 __be32 reserved02;
292 __be32 reserved03;
293};
294
295
296
297
298
299
300
301
302struct d0_locking_features {
303
304
305
306
307
308
309
310
311
312
313 u8 supported_features;
314
315
316
317
318 u8 reserved01[3];
319 __be32 reserved02;
320 __be32 reserved03;
321};
322
323
324
325
326
327
328
329
330struct d0_geometry_features {
331
332
333
334 u8 header[4];
335
336
337
338
339
340 u8 reserved01;
341 u8 reserved02[7];
342 __be32 logical_block_size;
343 __be64 alignment_granularity;
344 __be64 lowest_aligned_lba;
345};
346
347
348
349
350
351
352struct d0_enterprise_ssc {
353 __be16 baseComID;
354 __be16 numComIDs;
355
356
357
358
359 u8 range_crossing;
360 u8 reserved01;
361 __be16 reserved02;
362 __be32 reserved03;
363 __be32 reserved04;
364};
365
366
367
368
369
370
371struct d0_opal_v100 {
372 __be16 baseComID;
373 __be16 numComIDs;
374};
375
376
377
378
379
380
381struct d0_single_user_mode {
382 __be32 num_locking_objects;
383
384
385
386
387
388
389 u8 reserved01;
390 u8 reserved02;
391 __be16 reserved03;
392 __be32 reserved04;
393};
394
395
396
397
398
399
400struct d0_datastore_table {
401 __be16 reserved01;
402 __be16 max_tables;
403 __be32 max_size_tables;
404 __be32 table_size_alignment;
405};
406
407
408
409
410
411
412struct d0_opal_v200 {
413 __be16 baseComID;
414 __be16 numComIDs;
415
416
417
418
419 u8 range_crossing;
420
421
422
423
424
425
426 u8 num_locking_admin_auth[2];
427
428
429
430
431
432
433 u8 num_locking_user_auth[2];
434 u8 initialPIN;
435 u8 revertedPIN;
436 u8 reserved01;
437 __be32 reserved02;
438};
439
440
441struct d0_features {
442 __be16 code;
443
444
445
446
447
448 u8 r_version;
449 u8 length;
450 u8 features[];
451};
452
453#endif
454