0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/types.h>
0010
0011 #ifndef _OPAL_PROTO_H
0012 #define _OPAL_PROTO_H
0013
0014
0015
0016
0017
0018
0019 enum {
0020 TCG_SECP_00 = 0,
0021 TCG_SECP_01,
0022 };
0023
0024
0025
0026
0027
0028
0029 enum opal_response_token {
0030 OPAL_DTA_TOKENID_BYTESTRING = 0xe0,
0031 OPAL_DTA_TOKENID_SINT = 0xe1,
0032 OPAL_DTA_TOKENID_UINT = 0xe2,
0033 OPAL_DTA_TOKENID_TOKEN = 0xe3,
0034 OPAL_DTA_TOKENID_INVALID = 0X0
0035 };
0036
0037 #define DTAERROR_NO_METHOD_STATUS 0x89
0038 #define GENERIC_HOST_SESSION_NUM 0x41
0039 #define FIRST_TPER_SESSION_NUM 4096
0040
0041 #define TPER_SYNC_SUPPORTED 0x01
0042 #define MBR_ENABLED_MASK 0x10
0043
0044 #define TINY_ATOM_DATA_MASK 0x3F
0045 #define TINY_ATOM_SIGNED 0x40
0046
0047 #define SHORT_ATOM_ID 0x80
0048 #define SHORT_ATOM_BYTESTRING 0x20
0049 #define SHORT_ATOM_SIGNED 0x10
0050 #define SHORT_ATOM_LEN_MASK 0xF
0051
0052 #define MEDIUM_ATOM_ID 0xC0
0053 #define MEDIUM_ATOM_BYTESTRING 0x10
0054 #define MEDIUM_ATOM_SIGNED 0x8
0055 #define MEDIUM_ATOM_LEN_MASK 0x7
0056
0057 #define LONG_ATOM_ID 0xe0
0058 #define LONG_ATOM_BYTESTRING 0x2
0059 #define LONG_ATOM_SIGNED 0x1
0060
0061
0062
0063
0064
0065 #define TINY_ATOM_BYTE 0x7F
0066 #define SHORT_ATOM_BYTE 0xBF
0067 #define MEDIUM_ATOM_BYTE 0xDF
0068 #define LONG_ATOM_BYTE 0xE3
0069
0070 #define OPAL_INVAL_PARAM 12
0071 #define OPAL_MANUFACTURED_INACTIVE 0x08
0072 #define OPAL_DISCOVERY_COMID 0x0001
0073
0074 #define LOCKING_RANGE_NON_GLOBAL 0x03
0075
0076
0077
0078
0079
0080 #define OPAL_METHOD_LENGTH 8
0081 #define OPAL_MSID_KEYLEN 15
0082 #define OPAL_UID_LENGTH_HALF 4
0083
0084
0085 enum opal_uid {
0086
0087 OPAL_SMUID_UID,
0088 OPAL_THISSP_UID,
0089 OPAL_ADMINSP_UID,
0090 OPAL_LOCKINGSP_UID,
0091 OPAL_ENTERPRISE_LOCKINGSP_UID,
0092 OPAL_ANYBODY_UID,
0093 OPAL_SID_UID,
0094 OPAL_ADMIN1_UID,
0095 OPAL_USER1_UID,
0096 OPAL_USER2_UID,
0097 OPAL_PSID_UID,
0098 OPAL_ENTERPRISE_BANDMASTER0_UID,
0099 OPAL_ENTERPRISE_ERASEMASTER_UID,
0100
0101 OPAL_TABLE_TABLE,
0102 OPAL_LOCKINGRANGE_GLOBAL,
0103 OPAL_LOCKINGRANGE_ACE_RDLOCKED,
0104 OPAL_LOCKINGRANGE_ACE_WRLOCKED,
0105 OPAL_MBRCONTROL,
0106 OPAL_MBR,
0107 OPAL_AUTHORITY_TABLE,
0108 OPAL_C_PIN_TABLE,
0109 OPAL_LOCKING_INFO_TABLE,
0110 OPAL_ENTERPRISE_LOCKING_INFO_TABLE,
0111 OPAL_DATASTORE,
0112
0113 OPAL_C_PIN_MSID,
0114 OPAL_C_PIN_SID,
0115 OPAL_C_PIN_ADMIN1,
0116
0117 OPAL_HALF_UID_AUTHORITY_OBJ_REF,
0118 OPAL_HALF_UID_BOOLEAN_ACE,
0119
0120 OPAL_UID_HEXFF,
0121 };
0122
0123
0124 enum opal_method {
0125 OPAL_PROPERTIES,
0126 OPAL_STARTSESSION,
0127 OPAL_REVERT,
0128 OPAL_ACTIVATE,
0129 OPAL_EGET,
0130 OPAL_ESET,
0131 OPAL_NEXT,
0132 OPAL_EAUTHENTICATE,
0133 OPAL_GETACL,
0134 OPAL_GENKEY,
0135 OPAL_REVERTSP,
0136 OPAL_GET,
0137 OPAL_SET,
0138 OPAL_AUTHENTICATE,
0139 OPAL_RANDOM,
0140 OPAL_ERASE,
0141 };
0142
0143 enum opal_token {
0144
0145 OPAL_TRUE = 0x01,
0146 OPAL_FALSE = 0x00,
0147 OPAL_BOOLEAN_EXPR = 0x03,
0148
0149 OPAL_TABLE = 0x00,
0150 OPAL_STARTROW = 0x01,
0151 OPAL_ENDROW = 0x02,
0152 OPAL_STARTCOLUMN = 0x03,
0153 OPAL_ENDCOLUMN = 0x04,
0154 OPAL_VALUES = 0x01,
0155
0156 OPAL_TABLE_UID = 0x00,
0157 OPAL_TABLE_NAME = 0x01,
0158 OPAL_TABLE_COMMON = 0x02,
0159 OPAL_TABLE_TEMPLATE = 0x03,
0160 OPAL_TABLE_KIND = 0x04,
0161 OPAL_TABLE_COLUMN = 0x05,
0162 OPAL_TABLE_COLUMNS = 0x06,
0163 OPAL_TABLE_ROWS = 0x07,
0164 OPAL_TABLE_ROWS_FREE = 0x08,
0165 OPAL_TABLE_ROW_BYTES = 0x09,
0166 OPAL_TABLE_LASTID = 0x0A,
0167 OPAL_TABLE_MIN = 0x0B,
0168 OPAL_TABLE_MAX = 0x0C,
0169
0170 OPAL_PIN = 0x03,
0171
0172 OPAL_RANGESTART = 0x03,
0173 OPAL_RANGELENGTH = 0x04,
0174 OPAL_READLOCKENABLED = 0x05,
0175 OPAL_WRITELOCKENABLED = 0x06,
0176 OPAL_READLOCKED = 0x07,
0177 OPAL_WRITELOCKED = 0x08,
0178 OPAL_ACTIVEKEY = 0x0A,
0179
0180 OPAL_LIFECYCLE = 0x06,
0181
0182 OPAL_MAXRANGES = 0x04,
0183
0184 OPAL_MBRENABLE = 0x01,
0185 OPAL_MBRDONE = 0x02,
0186
0187 OPAL_HOSTPROPERTIES = 0x00,
0188
0189 OPAL_STARTLIST = 0xf0,
0190 OPAL_ENDLIST = 0xf1,
0191 OPAL_STARTNAME = 0xf2,
0192 OPAL_ENDNAME = 0xf3,
0193 OPAL_CALL = 0xf8,
0194 OPAL_ENDOFDATA = 0xf9,
0195 OPAL_ENDOFSESSION = 0xfa,
0196 OPAL_STARTTRANSACTON = 0xfb,
0197 OPAL_ENDTRANSACTON = 0xfC,
0198 OPAL_EMPTYATOM = 0xff,
0199 OPAL_WHERE = 0x00,
0200 };
0201
0202
0203 enum opal_lockingstate {
0204 OPAL_LOCKING_READWRITE = 0x01,
0205 OPAL_LOCKING_READONLY = 0x02,
0206 OPAL_LOCKING_LOCKED = 0x03,
0207 };
0208
0209 enum opal_parameter {
0210 OPAL_SUM_SET_LIST = 0x060000,
0211 };
0212
0213
0214
0215
0216
0217
0218
0219 struct opal_compacket {
0220 __be32 reserved0;
0221 u8 extendedComID[4];
0222 __be32 outstandingData;
0223 __be32 minTransfer;
0224 __be32 length;
0225 };
0226
0227
0228 struct opal_packet {
0229 __be32 tsn;
0230 __be32 hsn;
0231 __be32 seq_number;
0232 __be16 reserved0;
0233 __be16 ack_type;
0234 __be32 acknowledgment;
0235 __be32 length;
0236 };
0237
0238
0239 struct opal_data_subpacket {
0240 u8 reserved0[6];
0241 __be16 kind;
0242 __be32 length;
0243 };
0244
0245
0246 struct opal_header {
0247 struct opal_compacket cp;
0248 struct opal_packet pkt;
0249 struct opal_data_subpacket subpkt;
0250 };
0251
0252 #define FC_TPER 0x0001
0253 #define FC_LOCKING 0x0002
0254 #define FC_GEOMETRY 0x0003
0255 #define FC_ENTERPRISE 0x0100
0256 #define FC_DATASTORE 0x0202
0257 #define FC_SINGLEUSER 0x0201
0258 #define FC_OPALV100 0x0200
0259 #define FC_OPALV200 0x0203
0260
0261
0262
0263
0264
0265
0266 struct d0_header {
0267 __be32 length;
0268 __be32 revision;
0269 __be32 reserved01;
0270 __be32 reserved02;
0271
0272
0273
0274
0275 u8 ignored[32];
0276 };
0277
0278
0279
0280
0281
0282
0283
0284
0285 struct d0_tper_features {
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297 u8 supported_features;
0298
0299
0300
0301
0302 u8 reserved01[3];
0303 __be32 reserved02;
0304 __be32 reserved03;
0305 };
0306
0307
0308
0309
0310
0311
0312
0313
0314 struct d0_locking_features {
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325 u8 supported_features;
0326
0327
0328
0329
0330 u8 reserved01[3];
0331 __be32 reserved02;
0332 __be32 reserved03;
0333 };
0334
0335
0336
0337
0338
0339
0340
0341
0342 struct d0_geometry_features {
0343
0344
0345
0346 u8 header[4];
0347
0348
0349
0350
0351
0352 u8 reserved01;
0353 u8 reserved02[7];
0354 __be32 logical_block_size;
0355 __be64 alignment_granularity;
0356 __be64 lowest_aligned_lba;
0357 };
0358
0359
0360
0361
0362
0363
0364 struct d0_enterprise_ssc {
0365 __be16 baseComID;
0366 __be16 numComIDs;
0367
0368
0369
0370
0371 u8 range_crossing;
0372 u8 reserved01;
0373 __be16 reserved02;
0374 __be32 reserved03;
0375 __be32 reserved04;
0376 };
0377
0378
0379
0380
0381
0382
0383 struct d0_opal_v100 {
0384 __be16 baseComID;
0385 __be16 numComIDs;
0386 };
0387
0388
0389
0390
0391
0392
0393 struct d0_single_user_mode {
0394 __be32 num_locking_objects;
0395
0396
0397
0398
0399
0400
0401 u8 reserved01;
0402 u8 reserved02;
0403 __be16 reserved03;
0404 __be32 reserved04;
0405 };
0406
0407
0408
0409
0410
0411
0412 struct d0_datastore_table {
0413 __be16 reserved01;
0414 __be16 max_tables;
0415 __be32 max_size_tables;
0416 __be32 table_size_alignment;
0417 };
0418
0419
0420
0421
0422
0423
0424 struct d0_opal_v200 {
0425 __be16 baseComID;
0426 __be16 numComIDs;
0427
0428
0429
0430
0431 u8 range_crossing;
0432
0433
0434
0435
0436
0437
0438 u8 num_locking_admin_auth[2];
0439
0440
0441
0442
0443
0444
0445 u8 num_locking_user_auth[2];
0446 u8 initialPIN;
0447 u8 revertedPIN;
0448 u8 reserved01;
0449 __be32 reserved02;
0450 };
0451
0452
0453 struct d0_features {
0454 __be16 code;
0455
0456
0457
0458
0459
0460 u8 r_version;
0461 u8 length;
0462 u8 features[];
0463 };
0464
0465 #endif