1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 2 /* 3 * Copyright © 2016 Intel Corporation 3 * Copyright © 2016 Intel Corporation 4 * 4 * 5 * Authors: 5 * Authors: 6 * Rafael Antognolli <rafael.antognolli@int 6 * Rafael Antognolli <rafael.antognolli@intel.com> 7 * Scott Bauer <scott.bauer@intel.com 7 * Scott Bauer <scott.bauer@intel.com> 8 */ 8 */ 9 #include <linux/types.h> 9 #include <linux/types.h> 10 10 11 #ifndef _OPAL_PROTO_H 11 #ifndef _OPAL_PROTO_H 12 #define _OPAL_PROTO_H 12 #define _OPAL_PROTO_H 13 13 14 /* 14 /* 15 * These constant values come from: 15 * These constant values come from: 16 * SPC-4 section 16 * SPC-4 section 17 * 6.30 SECURITY PROTOCOL IN command / table 2 17 * 6.30 SECURITY PROTOCOL IN command / table 265. 18 */ 18 */ 19 enum { 19 enum { 20 TCG_SECP_00 = 0, 20 TCG_SECP_00 = 0, 21 TCG_SECP_01, 21 TCG_SECP_01, 22 }; 22 }; 23 23 24 /* 24 /* 25 * Token defs derived from: 25 * Token defs derived from: 26 * TCG_Storage_Architecture_Core_Spec_v2.01_r1 26 * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 27 * 3.2.2 Data Stream Encoding 27 * 3.2.2 Data Stream Encoding 28 */ 28 */ 29 enum opal_response_token { 29 enum opal_response_token { 30 OPAL_DTA_TOKENID_BYTESTRING = 0xe0, 30 OPAL_DTA_TOKENID_BYTESTRING = 0xe0, 31 OPAL_DTA_TOKENID_SINT = 0xe1, 31 OPAL_DTA_TOKENID_SINT = 0xe1, 32 OPAL_DTA_TOKENID_UINT = 0xe2, 32 OPAL_DTA_TOKENID_UINT = 0xe2, 33 OPAL_DTA_TOKENID_TOKEN = 0xe3, /* actu 33 OPAL_DTA_TOKENID_TOKEN = 0xe3, /* actual token is returned */ 34 OPAL_DTA_TOKENID_INVALID = 0X0 34 OPAL_DTA_TOKENID_INVALID = 0X0 35 }; 35 }; 36 36 37 #define DTAERROR_NO_METHOD_STATUS 0x89 37 #define DTAERROR_NO_METHOD_STATUS 0x89 38 #define GENERIC_HOST_SESSION_NUM 0x41 38 #define GENERIC_HOST_SESSION_NUM 0x41 39 #define FIRST_TPER_SESSION_NUM 4096 39 #define FIRST_TPER_SESSION_NUM 4096 40 40 41 #define TPER_SYNC_SUPPORTED 0x01 41 #define TPER_SYNC_SUPPORTED 0x01 42 /* FC_LOCKING features */ 42 /* FC_LOCKING features */ 43 #define LOCKING_SUPPORTED_MASK 0x01 43 #define LOCKING_SUPPORTED_MASK 0x01 44 #define LOCKING_ENABLED_MASK 0x02 44 #define LOCKING_ENABLED_MASK 0x02 45 #define LOCKED_MASK 0x04 45 #define LOCKED_MASK 0x04 46 #define MBR_ENABLED_MASK 0x10 46 #define MBR_ENABLED_MASK 0x10 47 #define MBR_DONE_MASK 0x20 47 #define MBR_DONE_MASK 0x20 48 48 49 #define TINY_ATOM_DATA_MASK 0x3F 49 #define TINY_ATOM_DATA_MASK 0x3F 50 #define TINY_ATOM_SIGNED 0x40 50 #define TINY_ATOM_SIGNED 0x40 51 51 52 #define SHORT_ATOM_ID 0x80 52 #define SHORT_ATOM_ID 0x80 53 #define SHORT_ATOM_BYTESTRING 0x20 53 #define SHORT_ATOM_BYTESTRING 0x20 54 #define SHORT_ATOM_SIGNED 0x10 54 #define SHORT_ATOM_SIGNED 0x10 55 #define SHORT_ATOM_LEN_MASK 0xF 55 #define SHORT_ATOM_LEN_MASK 0xF 56 56 57 #define MEDIUM_ATOM_ID 0xC0 57 #define MEDIUM_ATOM_ID 0xC0 58 #define MEDIUM_ATOM_BYTESTRING 0x10 58 #define MEDIUM_ATOM_BYTESTRING 0x10 59 #define MEDIUM_ATOM_SIGNED 0x8 59 #define MEDIUM_ATOM_SIGNED 0x8 60 #define MEDIUM_ATOM_LEN_MASK 0x7 60 #define MEDIUM_ATOM_LEN_MASK 0x7 61 61 62 #define LONG_ATOM_ID 0xe0 62 #define LONG_ATOM_ID 0xe0 63 #define LONG_ATOM_BYTESTRING 0x2 63 #define LONG_ATOM_BYTESTRING 0x2 64 #define LONG_ATOM_SIGNED 0x1 64 #define LONG_ATOM_SIGNED 0x1 65 65 66 /* Derived from TCG Core spec 2.01 Section: 66 /* Derived from TCG Core spec 2.01 Section: 67 * 3.2.2.1 67 * 3.2.2.1 68 * Data Type 68 * Data Type 69 */ 69 */ 70 #define TINY_ATOM_BYTE 0x7F 70 #define TINY_ATOM_BYTE 0x7F 71 #define SHORT_ATOM_BYTE 0xBF 71 #define SHORT_ATOM_BYTE 0xBF 72 #define MEDIUM_ATOM_BYTE 0xDF 72 #define MEDIUM_ATOM_BYTE 0xDF 73 #define LONG_ATOM_BYTE 0xE3 73 #define LONG_ATOM_BYTE 0xE3 74 #define EMPTY_ATOM_BYTE 0xFF << 75 74 76 #define OPAL_INVAL_PARAM 12 75 #define OPAL_INVAL_PARAM 12 77 #define OPAL_MANUFACTURED_INACTIVE 0x08 76 #define OPAL_MANUFACTURED_INACTIVE 0x08 78 #define OPAL_DISCOVERY_COMID 0x0001 77 #define OPAL_DISCOVERY_COMID 0x0001 79 78 80 #define LOCKING_RANGE_NON_GLOBAL 0x03 79 #define LOCKING_RANGE_NON_GLOBAL 0x03 81 /* 80 /* 82 * User IDs used in the TCG storage SSCs 81 * User IDs used in the TCG storage SSCs 83 * Derived from: TCG_Storage_Architecture_Core 82 * Derived from: TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 84 * Section: 6.3 Assigned UIDs 83 * Section: 6.3 Assigned UIDs 85 */ 84 */ 86 #define OPAL_METHOD_LENGTH 8 85 #define OPAL_METHOD_LENGTH 8 87 #define OPAL_MSID_KEYLEN 15 86 #define OPAL_MSID_KEYLEN 15 88 #define OPAL_UID_LENGTH_HALF 4 87 #define OPAL_UID_LENGTH_HALF 4 89 88 90 /* << 91 * Boolean operators from TCG Core spec 2.01 S << 92 * 5.1.3.11 << 93 * Table 61 << 94 */ << 95 #define OPAL_BOOLEAN_AND 0 << 96 #define OPAL_BOOLEAN_OR 1 << 97 #define OPAL_BOOLEAN_NOT 2 << 98 << 99 /* Enum to index OPALUID array */ 89 /* Enum to index OPALUID array */ 100 enum opal_uid { 90 enum opal_uid { 101 /* users */ 91 /* users */ 102 OPAL_SMUID_UID, 92 OPAL_SMUID_UID, 103 OPAL_THISSP_UID, 93 OPAL_THISSP_UID, 104 OPAL_ADMINSP_UID, 94 OPAL_ADMINSP_UID, 105 OPAL_LOCKINGSP_UID, 95 OPAL_LOCKINGSP_UID, 106 OPAL_ENTERPRISE_LOCKINGSP_UID, 96 OPAL_ENTERPRISE_LOCKINGSP_UID, 107 OPAL_ANYBODY_UID, 97 OPAL_ANYBODY_UID, 108 OPAL_SID_UID, 98 OPAL_SID_UID, 109 OPAL_ADMIN1_UID, 99 OPAL_ADMIN1_UID, 110 OPAL_USER1_UID, 100 OPAL_USER1_UID, 111 OPAL_USER2_UID, 101 OPAL_USER2_UID, 112 OPAL_PSID_UID, 102 OPAL_PSID_UID, 113 OPAL_ENTERPRISE_BANDMASTER0_UID, 103 OPAL_ENTERPRISE_BANDMASTER0_UID, 114 OPAL_ENTERPRISE_ERASEMASTER_UID, 104 OPAL_ENTERPRISE_ERASEMASTER_UID, 115 /* tables */ 105 /* tables */ 116 OPAL_TABLE_TABLE, 106 OPAL_TABLE_TABLE, 117 OPAL_LOCKINGRANGE_GLOBAL, 107 OPAL_LOCKINGRANGE_GLOBAL, 118 OPAL_LOCKINGRANGE_ACE_START_TO_KEY, << 119 OPAL_LOCKINGRANGE_ACE_RDLOCKED, 108 OPAL_LOCKINGRANGE_ACE_RDLOCKED, 120 OPAL_LOCKINGRANGE_ACE_WRLOCKED, 109 OPAL_LOCKINGRANGE_ACE_WRLOCKED, 121 OPAL_MBRCONTROL, 110 OPAL_MBRCONTROL, 122 OPAL_MBR, 111 OPAL_MBR, 123 OPAL_AUTHORITY_TABLE, 112 OPAL_AUTHORITY_TABLE, 124 OPAL_C_PIN_TABLE, 113 OPAL_C_PIN_TABLE, 125 OPAL_LOCKING_INFO_TABLE, 114 OPAL_LOCKING_INFO_TABLE, 126 OPAL_ENTERPRISE_LOCKING_INFO_TABLE, 115 OPAL_ENTERPRISE_LOCKING_INFO_TABLE, 127 OPAL_DATASTORE, 116 OPAL_DATASTORE, 128 /* C_PIN_TABLE object ID's */ 117 /* C_PIN_TABLE object ID's */ 129 OPAL_C_PIN_MSID, 118 OPAL_C_PIN_MSID, 130 OPAL_C_PIN_SID, 119 OPAL_C_PIN_SID, 131 OPAL_C_PIN_ADMIN1, 120 OPAL_C_PIN_ADMIN1, 132 /* half UID's (only first 4 bytes used 121 /* half UID's (only first 4 bytes used) */ 133 OPAL_HALF_UID_AUTHORITY_OBJ_REF, 122 OPAL_HALF_UID_AUTHORITY_OBJ_REF, 134 OPAL_HALF_UID_BOOLEAN_ACE, 123 OPAL_HALF_UID_BOOLEAN_ACE, 135 /* omitted optional parameter */ 124 /* omitted optional parameter */ 136 OPAL_UID_HEXFF, 125 OPAL_UID_HEXFF, 137 }; 126 }; 138 127 139 /* Enum for indexing the OPALMETHOD array */ 128 /* Enum for indexing the OPALMETHOD array */ 140 enum opal_method { 129 enum opal_method { 141 OPAL_PROPERTIES, 130 OPAL_PROPERTIES, 142 OPAL_STARTSESSION, 131 OPAL_STARTSESSION, 143 OPAL_REVERT, 132 OPAL_REVERT, 144 OPAL_ACTIVATE, 133 OPAL_ACTIVATE, 145 OPAL_EGET, 134 OPAL_EGET, 146 OPAL_ESET, 135 OPAL_ESET, 147 OPAL_NEXT, 136 OPAL_NEXT, 148 OPAL_EAUTHENTICATE, 137 OPAL_EAUTHENTICATE, 149 OPAL_GETACL, 138 OPAL_GETACL, 150 OPAL_GENKEY, 139 OPAL_GENKEY, 151 OPAL_REVERTSP, 140 OPAL_REVERTSP, 152 OPAL_GET, 141 OPAL_GET, 153 OPAL_SET, 142 OPAL_SET, 154 OPAL_AUTHENTICATE, 143 OPAL_AUTHENTICATE, 155 OPAL_RANDOM, 144 OPAL_RANDOM, 156 OPAL_ERASE, 145 OPAL_ERASE, 157 }; 146 }; 158 147 159 enum opal_token { 148 enum opal_token { 160 /* Boolean */ 149 /* Boolean */ 161 OPAL_TRUE = 0x01, 150 OPAL_TRUE = 0x01, 162 OPAL_FALSE = 0x00, 151 OPAL_FALSE = 0x00, 163 OPAL_BOOLEAN_EXPR = 0x03, 152 OPAL_BOOLEAN_EXPR = 0x03, 164 /* cellblocks */ 153 /* cellblocks */ 165 OPAL_TABLE = 0x00, 154 OPAL_TABLE = 0x00, 166 OPAL_STARTROW = 0x01, 155 OPAL_STARTROW = 0x01, 167 OPAL_ENDROW = 0x02, 156 OPAL_ENDROW = 0x02, 168 OPAL_STARTCOLUMN = 0x03, 157 OPAL_STARTCOLUMN = 0x03, 169 OPAL_ENDCOLUMN = 0x04, 158 OPAL_ENDCOLUMN = 0x04, 170 OPAL_VALUES = 0x01, 159 OPAL_VALUES = 0x01, 171 /* table table */ 160 /* table table */ 172 OPAL_TABLE_UID = 0x00, 161 OPAL_TABLE_UID = 0x00, 173 OPAL_TABLE_NAME = 0x01, 162 OPAL_TABLE_NAME = 0x01, 174 OPAL_TABLE_COMMON = 0x02, 163 OPAL_TABLE_COMMON = 0x02, 175 OPAL_TABLE_TEMPLATE = 0x03, 164 OPAL_TABLE_TEMPLATE = 0x03, 176 OPAL_TABLE_KIND = 0x04, 165 OPAL_TABLE_KIND = 0x04, 177 OPAL_TABLE_COLUMN = 0x05, 166 OPAL_TABLE_COLUMN = 0x05, 178 OPAL_TABLE_COLUMNS = 0x06, 167 OPAL_TABLE_COLUMNS = 0x06, 179 OPAL_TABLE_ROWS = 0x07, 168 OPAL_TABLE_ROWS = 0x07, 180 OPAL_TABLE_ROWS_FREE = 0x08, 169 OPAL_TABLE_ROWS_FREE = 0x08, 181 OPAL_TABLE_ROW_BYTES = 0x09, 170 OPAL_TABLE_ROW_BYTES = 0x09, 182 OPAL_TABLE_LASTID = 0x0A, 171 OPAL_TABLE_LASTID = 0x0A, 183 OPAL_TABLE_MIN = 0x0B, 172 OPAL_TABLE_MIN = 0x0B, 184 OPAL_TABLE_MAX = 0x0C, 173 OPAL_TABLE_MAX = 0x0C, 185 /* authority table */ 174 /* authority table */ 186 OPAL_PIN = 0x03, 175 OPAL_PIN = 0x03, 187 /* locking tokens */ 176 /* locking tokens */ 188 OPAL_RANGESTART = 0x03, 177 OPAL_RANGESTART = 0x03, 189 OPAL_RANGELENGTH = 0x04, 178 OPAL_RANGELENGTH = 0x04, 190 OPAL_READLOCKENABLED = 0x05, 179 OPAL_READLOCKENABLED = 0x05, 191 OPAL_WRITELOCKENABLED = 0x06, 180 OPAL_WRITELOCKENABLED = 0x06, 192 OPAL_READLOCKED = 0x07, 181 OPAL_READLOCKED = 0x07, 193 OPAL_WRITELOCKED = 0x08, 182 OPAL_WRITELOCKED = 0x08, 194 OPAL_ACTIVEKEY = 0x0A, 183 OPAL_ACTIVEKEY = 0x0A, 195 /* lockingsp table */ 184 /* lockingsp table */ 196 OPAL_LIFECYCLE = 0x06, 185 OPAL_LIFECYCLE = 0x06, 197 /* locking info table */ 186 /* locking info table */ 198 OPAL_MAXRANGES = 0x04, 187 OPAL_MAXRANGES = 0x04, 199 /* mbr control */ 188 /* mbr control */ 200 OPAL_MBRENABLE = 0x01, 189 OPAL_MBRENABLE = 0x01, 201 OPAL_MBRDONE = 0x02, 190 OPAL_MBRDONE = 0x02, 202 /* properties */ 191 /* properties */ 203 OPAL_HOSTPROPERTIES = 0x00, 192 OPAL_HOSTPROPERTIES = 0x00, 204 /* atoms */ 193 /* atoms */ 205 OPAL_STARTLIST = 0xf0, 194 OPAL_STARTLIST = 0xf0, 206 OPAL_ENDLIST = 0xf1, 195 OPAL_ENDLIST = 0xf1, 207 OPAL_STARTNAME = 0xf2, 196 OPAL_STARTNAME = 0xf2, 208 OPAL_ENDNAME = 0xf3, 197 OPAL_ENDNAME = 0xf3, 209 OPAL_CALL = 0xf8, 198 OPAL_CALL = 0xf8, 210 OPAL_ENDOFDATA = 0xf9, 199 OPAL_ENDOFDATA = 0xf9, 211 OPAL_ENDOFSESSION = 0xfa, 200 OPAL_ENDOFSESSION = 0xfa, 212 OPAL_STARTTRANSACTON = 0xfb, 201 OPAL_STARTTRANSACTON = 0xfb, 213 OPAL_ENDTRANSACTON = 0xfC, 202 OPAL_ENDTRANSACTON = 0xfC, 214 OPAL_EMPTYATOM = 0xff, 203 OPAL_EMPTYATOM = 0xff, 215 OPAL_WHERE = 0x00, 204 OPAL_WHERE = 0x00, 216 }; 205 }; 217 206 218 /* Locking state for a locking range */ 207 /* Locking state for a locking range */ 219 enum opal_lockingstate { 208 enum opal_lockingstate { 220 OPAL_LOCKING_READWRITE = 0x01, 209 OPAL_LOCKING_READWRITE = 0x01, 221 OPAL_LOCKING_READONLY = 0x02, 210 OPAL_LOCKING_READONLY = 0x02, 222 OPAL_LOCKING_LOCKED = 0x03, 211 OPAL_LOCKING_LOCKED = 0x03, 223 }; 212 }; 224 213 225 enum opal_parameter { 214 enum opal_parameter { 226 OPAL_SUM_SET_LIST = 0x060000, 215 OPAL_SUM_SET_LIST = 0x060000, 227 }; << 228 << 229 enum opal_revertlsp { << 230 OPAL_KEEP_GLOBAL_RANGE_KEY = 0x060000, << 231 }; 216 }; 232 217 233 /* Packets derived from: 218 /* Packets derived from: 234 * TCG_Storage_Architecture_Core_Spec_v2.01_r1 219 * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 235 * Secion: 3.2.3 ComPackets, Packets & Subpack 220 * Secion: 3.2.3 ComPackets, Packets & Subpackets 236 */ 221 */ 237 222 238 /* Comm Packet (header) for transmissions. */ 223 /* Comm Packet (header) for transmissions. */ 239 struct opal_compacket { 224 struct opal_compacket { 240 __be32 reserved0; 225 __be32 reserved0; 241 u8 extendedComID[4]; 226 u8 extendedComID[4]; 242 __be32 outstandingData; 227 __be32 outstandingData; 243 __be32 minTransfer; 228 __be32 minTransfer; 244 __be32 length; 229 __be32 length; 245 }; 230 }; 246 231 247 /* Packet structure. */ 232 /* Packet structure. */ 248 struct opal_packet { 233 struct opal_packet { 249 __be32 tsn; 234 __be32 tsn; 250 __be32 hsn; 235 __be32 hsn; 251 __be32 seq_number; 236 __be32 seq_number; 252 __be16 reserved0; 237 __be16 reserved0; 253 __be16 ack_type; 238 __be16 ack_type; 254 __be32 acknowledgment; 239 __be32 acknowledgment; 255 __be32 length; 240 __be32 length; 256 }; 241 }; 257 242 258 /* Data sub packet header */ 243 /* Data sub packet header */ 259 struct opal_data_subpacket { 244 struct opal_data_subpacket { 260 u8 reserved0[6]; 245 u8 reserved0[6]; 261 __be16 kind; 246 __be16 kind; 262 __be32 length; 247 __be32 length; 263 }; 248 }; 264 249 265 /* header of a response */ 250 /* header of a response */ 266 struct opal_header { 251 struct opal_header { 267 struct opal_compacket cp; 252 struct opal_compacket cp; 268 struct opal_packet pkt; 253 struct opal_packet pkt; 269 struct opal_data_subpacket subpkt; 254 struct opal_data_subpacket subpkt; 270 }; 255 }; 271 256 272 #define FC_TPER 0x0001 257 #define FC_TPER 0x0001 273 #define FC_LOCKING 0x0002 258 #define FC_LOCKING 0x0002 274 #define FC_GEOMETRY 0x0003 259 #define FC_GEOMETRY 0x0003 275 #define FC_ENTERPRISE 0x0100 260 #define FC_ENTERPRISE 0x0100 276 #define FC_DATASTORE 0x0202 261 #define FC_DATASTORE 0x0202 277 #define FC_SINGLEUSER 0x0201 262 #define FC_SINGLEUSER 0x0201 278 #define FC_OPALV100 0x0200 263 #define FC_OPALV100 0x0200 279 #define FC_OPALV200 0x0203 264 #define FC_OPALV200 0x0203 280 265 281 /* 266 /* 282 * The Discovery 0 Header. As defined in 267 * The Discovery 0 Header. As defined in 283 * Opal SSC Documentation 268 * Opal SSC Documentation 284 * Section: 3.3.5 Capability Discovery 269 * Section: 3.3.5 Capability Discovery 285 */ 270 */ 286 struct d0_header { 271 struct d0_header { 287 __be32 length; /* the length of the he 272 __be32 length; /* the length of the header 48 in 2.00.100 */ 288 __be32 revision; /**< revision of the 273 __be32 revision; /**< revision of the header 1 in 2.00.100 */ 289 __be32 reserved01; 274 __be32 reserved01; 290 __be32 reserved02; 275 __be32 reserved02; 291 /* 276 /* 292 * the remainder of the structure is v 277 * the remainder of the structure is vendor specific and will not be 293 * addressed now 278 * addressed now 294 */ 279 */ 295 u8 ignored[32]; 280 u8 ignored[32]; 296 }; 281 }; 297 282 298 /* 283 /* 299 * TPer Feature Descriptor. Contains flags ind 284 * TPer Feature Descriptor. Contains flags indicating support for the 300 * TPer features described in the OPAL specifi 285 * TPer features described in the OPAL specification. The names match the 301 * OPAL terminology 286 * OPAL terminology 302 * 287 * 303 * code == 0x001 in 2.00.100 288 * code == 0x001 in 2.00.100 304 */ 289 */ 305 struct d0_tper_features { 290 struct d0_tper_features { 306 /* 291 /* 307 * supported_features bits: 292 * supported_features bits: 308 * bit 7: reserved 293 * bit 7: reserved 309 * bit 6: com ID management 294 * bit 6: com ID management 310 * bit 5: reserved 295 * bit 5: reserved 311 * bit 4: streaming support 296 * bit 4: streaming support 312 * bit 3: buffer management 297 * bit 3: buffer management 313 * bit 2: ACK/NACK 298 * bit 2: ACK/NACK 314 * bit 1: async 299 * bit 1: async 315 * bit 0: sync 300 * bit 0: sync 316 */ 301 */ 317 u8 supported_features; 302 u8 supported_features; 318 /* 303 /* 319 * bytes 5 through 15 are reserved, bu 304 * bytes 5 through 15 are reserved, but we represent the first 3 as 320 * u8 to keep the other two 32bits int 305 * u8 to keep the other two 32bits integers aligned. 321 */ 306 */ 322 u8 reserved01[3]; 307 u8 reserved01[3]; 323 __be32 reserved02; 308 __be32 reserved02; 324 __be32 reserved03; 309 __be32 reserved03; 325 }; 310 }; 326 311 327 /* 312 /* 328 * Locking Feature Descriptor. Contains flags 313 * Locking Feature Descriptor. Contains flags indicating support for the 329 * locking features described in the OPAL spec 314 * locking features described in the OPAL specification. The names match the 330 * OPAL terminology 315 * OPAL terminology 331 * 316 * 332 * code == 0x0002 in 2.00.100 317 * code == 0x0002 in 2.00.100 333 */ 318 */ 334 struct d0_locking_features { 319 struct d0_locking_features { 335 /* 320 /* 336 * supported_features bits: 321 * supported_features bits: 337 * bits 6-7: reserved 322 * bits 6-7: reserved 338 * bit 5: MBR done 323 * bit 5: MBR done 339 * bit 4: MBR enabled 324 * bit 4: MBR enabled 340 * bit 3: media encryption 325 * bit 3: media encryption 341 * bit 2: locked 326 * bit 2: locked 342 * bit 1: locking enabled 327 * bit 1: locking enabled 343 * bit 0: locking supported 328 * bit 0: locking supported 344 */ 329 */ 345 u8 supported_features; 330 u8 supported_features; 346 /* 331 /* 347 * bytes 5 through 15 are reserved, bu 332 * bytes 5 through 15 are reserved, but we represent the first 3 as 348 * u8 to keep the other two 32bits int 333 * u8 to keep the other two 32bits integers aligned. 349 */ 334 */ 350 u8 reserved01[3]; 335 u8 reserved01[3]; 351 __be32 reserved02; 336 __be32 reserved02; 352 __be32 reserved03; 337 __be32 reserved03; 353 }; 338 }; 354 339 355 /* 340 /* 356 * Geometry Feature Descriptor. Contains flags 341 * Geometry Feature Descriptor. Contains flags indicating support for the 357 * geometry features described in the OPAL spe 342 * geometry features described in the OPAL specification. The names match the 358 * OPAL terminology 343 * OPAL terminology 359 * 344 * 360 * code == 0x0003 in 2.00.100 345 * code == 0x0003 in 2.00.100 361 */ 346 */ 362 struct d0_geometry_features { 347 struct d0_geometry_features { 363 /* 348 /* 364 * skip 32 bits from header, needed to 349 * skip 32 bits from header, needed to align the struct to 64 bits. 365 */ 350 */ 366 u8 header[4]; 351 u8 header[4]; 367 /* 352 /* 368 * reserved01: 353 * reserved01: 369 * bits 1-6: reserved 354 * bits 1-6: reserved 370 * bit 0: align 355 * bit 0: align 371 */ 356 */ 372 u8 reserved01; 357 u8 reserved01; 373 u8 reserved02[7]; 358 u8 reserved02[7]; 374 __be32 logical_block_size; 359 __be32 logical_block_size; 375 __be64 alignment_granularity; 360 __be64 alignment_granularity; 376 __be64 lowest_aligned_lba; 361 __be64 lowest_aligned_lba; 377 }; 362 }; 378 363 379 /* 364 /* 380 * Enterprise SSC Feature 365 * Enterprise SSC Feature 381 * 366 * 382 * code == 0x0100 367 * code == 0x0100 383 */ 368 */ 384 struct d0_enterprise_ssc { 369 struct d0_enterprise_ssc { 385 __be16 baseComID; 370 __be16 baseComID; 386 __be16 numComIDs; 371 __be16 numComIDs; 387 /* range_crossing: 372 /* range_crossing: 388 * bits 1-6: reserved 373 * bits 1-6: reserved 389 * bit 0: range crossing 374 * bit 0: range crossing 390 */ 375 */ 391 u8 range_crossing; 376 u8 range_crossing; 392 u8 reserved01; 377 u8 reserved01; 393 __be16 reserved02; 378 __be16 reserved02; 394 __be32 reserved03; 379 __be32 reserved03; 395 __be32 reserved04; 380 __be32 reserved04; 396 }; 381 }; 397 382 398 /* 383 /* 399 * Opal V1 feature 384 * Opal V1 feature 400 * 385 * 401 * code == 0x0200 386 * code == 0x0200 402 */ 387 */ 403 struct d0_opal_v100 { 388 struct d0_opal_v100 { 404 __be16 baseComID; 389 __be16 baseComID; 405 __be16 numComIDs; 390 __be16 numComIDs; 406 }; 391 }; 407 392 408 /* 393 /* 409 * Single User Mode feature 394 * Single User Mode feature 410 * 395 * 411 * code == 0x0201 396 * code == 0x0201 412 */ 397 */ 413 struct d0_single_user_mode { 398 struct d0_single_user_mode { 414 __be32 num_locking_objects; 399 __be32 num_locking_objects; 415 /* reserved01: 400 /* reserved01: 416 * bit 0: any 401 * bit 0: any 417 * bit 1: all 402 * bit 1: all 418 * bit 2: policy 403 * bit 2: policy 419 * bits 3-7: reserved 404 * bits 3-7: reserved 420 */ 405 */ 421 u8 reserved01; 406 u8 reserved01; 422 u8 reserved02; 407 u8 reserved02; 423 __be16 reserved03; 408 __be16 reserved03; 424 __be32 reserved04; 409 __be32 reserved04; 425 }; 410 }; 426 411 427 /* 412 /* 428 * Additonal Datastores feature 413 * Additonal Datastores feature 429 * 414 * 430 * code == 0x0202 415 * code == 0x0202 431 */ 416 */ 432 struct d0_datastore_table { 417 struct d0_datastore_table { 433 __be16 reserved01; 418 __be16 reserved01; 434 __be16 max_tables; 419 __be16 max_tables; 435 __be32 max_size_tables; 420 __be32 max_size_tables; 436 __be32 table_size_alignment; 421 __be32 table_size_alignment; 437 }; 422 }; 438 423 439 /* 424 /* 440 * OPAL 2.0 feature 425 * OPAL 2.0 feature 441 * 426 * 442 * code == 0x0203 427 * code == 0x0203 443 */ 428 */ 444 struct d0_opal_v200 { 429 struct d0_opal_v200 { 445 __be16 baseComID; 430 __be16 baseComID; 446 __be16 numComIDs; 431 __be16 numComIDs; 447 /* range_crossing: 432 /* range_crossing: 448 * bits 1-6: reserved 433 * bits 1-6: reserved 449 * bit 0: range crossing 434 * bit 0: range crossing 450 */ 435 */ 451 u8 range_crossing; 436 u8 range_crossing; 452 /* num_locking_admin_auth: 437 /* num_locking_admin_auth: 453 * not aligned to 16 bits, so use two 438 * not aligned to 16 bits, so use two u8. 454 * stored in big endian: 439 * stored in big endian: 455 * 0: MSB 440 * 0: MSB 456 * 1: LSB 441 * 1: LSB 457 */ 442 */ 458 u8 num_locking_admin_auth[2]; 443 u8 num_locking_admin_auth[2]; 459 /* num_locking_user_auth: 444 /* num_locking_user_auth: 460 * not aligned to 16 bits, so use two 445 * not aligned to 16 bits, so use two u8. 461 * stored in big endian: 446 * stored in big endian: 462 * 0: MSB 447 * 0: MSB 463 * 1: LSB 448 * 1: LSB 464 */ 449 */ 465 u8 num_locking_user_auth[2]; 450 u8 num_locking_user_auth[2]; 466 u8 initialPIN; 451 u8 initialPIN; 467 u8 revertedPIN; 452 u8 revertedPIN; 468 u8 reserved01; 453 u8 reserved01; 469 __be32 reserved02; 454 __be32 reserved02; 470 }; 455 }; 471 456 472 /* Union of features used to parse the discove 457 /* Union of features used to parse the discovery 0 response */ 473 struct d0_features { 458 struct d0_features { 474 __be16 code; 459 __be16 code; 475 /* 460 /* 476 * r_version bits: 461 * r_version bits: 477 * bits 4-7: version 462 * bits 4-7: version 478 * bits 0-3: reserved 463 * bits 0-3: reserved 479 */ 464 */ 480 u8 r_version; 465 u8 r_version; 481 u8 length; 466 u8 length; 482 u8 features[]; 467 u8 features[]; 483 }; 468 }; 484 469 485 #endif /* _OPAL_PROTO_H */ 470 #endif /* _OPAL_PROTO_H */ 486 471
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.