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