18c16567dSChristoph Hellwig /* SPDX-License-Identifier: GPL-2.0 */ 2455a7b23SScott Bauer /* 3455a7b23SScott Bauer * Copyright © 2016 Intel Corporation 4455a7b23SScott Bauer * 5455a7b23SScott Bauer * Authors: 6455a7b23SScott Bauer * Rafael Antognolli <rafael.antognolli@intel.com> 7455a7b23SScott Bauer * Scott Bauer <scott.bauer@intel.com> 8455a7b23SScott Bauer */ 9455a7b23SScott Bauer #include <linux/types.h> 10455a7b23SScott Bauer 11455a7b23SScott Bauer #ifndef _OPAL_PROTO_H 12455a7b23SScott Bauer #define _OPAL_PROTO_H 13455a7b23SScott Bauer 144f1244c8SChristoph Hellwig /* 154f1244c8SChristoph Hellwig * These constant values come from: 164f1244c8SChristoph Hellwig * SPC-4 section 174f1244c8SChristoph Hellwig * 6.30 SECURITY PROTOCOL IN command / table 265. 184f1244c8SChristoph Hellwig */ 194f1244c8SChristoph Hellwig enum { 204f1244c8SChristoph Hellwig TCG_SECP_00 = 0, 214f1244c8SChristoph Hellwig TCG_SECP_01, 224f1244c8SChristoph Hellwig }; 234f1244c8SChristoph Hellwig 244f1244c8SChristoph Hellwig /* 254f1244c8SChristoph Hellwig * Token defs derived from: 264f1244c8SChristoph Hellwig * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 274f1244c8SChristoph Hellwig * 3.2.2 Data Stream Encoding 284f1244c8SChristoph Hellwig */ 294f1244c8SChristoph Hellwig enum opal_response_token { 304f1244c8SChristoph Hellwig OPAL_DTA_TOKENID_BYTESTRING = 0xe0, 314f1244c8SChristoph Hellwig OPAL_DTA_TOKENID_SINT = 0xe1, 324f1244c8SChristoph Hellwig OPAL_DTA_TOKENID_UINT = 0xe2, 334f1244c8SChristoph Hellwig OPAL_DTA_TOKENID_TOKEN = 0xe3, /* actual token is returned */ 344f1244c8SChristoph Hellwig OPAL_DTA_TOKENID_INVALID = 0X0 354f1244c8SChristoph Hellwig }; 364f1244c8SChristoph Hellwig 37455a7b23SScott Bauer #define DTAERROR_NO_METHOD_STATUS 0x89 38455a7b23SScott Bauer #define GENERIC_HOST_SESSION_NUM 0x41 3988d6041dSRevanth Rajashekar #define FIRST_TPER_SESSION_NUM 4096 40455a7b23SScott Bauer 41455a7b23SScott Bauer #define TPER_SYNC_SUPPORTED 0x01 42*c6ea7060Sdougmill@linux.vnet.ibm.com /* FC_LOCKING features */ 43*c6ea7060Sdougmill@linux.vnet.ibm.com #define LOCKING_SUPPORTED_MASK 0x01 44*c6ea7060Sdougmill@linux.vnet.ibm.com #define LOCKING_ENABLED_MASK 0x02 45*c6ea7060Sdougmill@linux.vnet.ibm.com #define LOCKED_MASK 0x04 46dbec491bSScott Bauer #define MBR_ENABLED_MASK 0x10 47*c6ea7060Sdougmill@linux.vnet.ibm.com #define MBR_DONE_MASK 0x20 48455a7b23SScott Bauer 49455a7b23SScott Bauer #define TINY_ATOM_DATA_MASK 0x3F 50455a7b23SScott Bauer #define TINY_ATOM_SIGNED 0x40 51455a7b23SScott Bauer 52455a7b23SScott Bauer #define SHORT_ATOM_ID 0x80 53455a7b23SScott Bauer #define SHORT_ATOM_BYTESTRING 0x20 54455a7b23SScott Bauer #define SHORT_ATOM_SIGNED 0x10 55455a7b23SScott Bauer #define SHORT_ATOM_LEN_MASK 0xF 56455a7b23SScott Bauer 57455a7b23SScott Bauer #define MEDIUM_ATOM_ID 0xC0 58455a7b23SScott Bauer #define MEDIUM_ATOM_BYTESTRING 0x10 59455a7b23SScott Bauer #define MEDIUM_ATOM_SIGNED 0x8 60455a7b23SScott Bauer #define MEDIUM_ATOM_LEN_MASK 0x7 61455a7b23SScott Bauer 62455a7b23SScott Bauer #define LONG_ATOM_ID 0xe0 63455a7b23SScott Bauer #define LONG_ATOM_BYTESTRING 0x2 64455a7b23SScott Bauer #define LONG_ATOM_SIGNED 0x1 65455a7b23SScott Bauer 66455a7b23SScott Bauer /* Derived from TCG Core spec 2.01 Section: 67455a7b23SScott Bauer * 3.2.2.1 68455a7b23SScott Bauer * Data Type 69455a7b23SScott Bauer */ 70455a7b23SScott Bauer #define TINY_ATOM_BYTE 0x7F 71455a7b23SScott Bauer #define SHORT_ATOM_BYTE 0xBF 72455a7b23SScott Bauer #define MEDIUM_ATOM_BYTE 0xDF 73455a7b23SScott Bauer #define LONG_ATOM_BYTE 0xE3 74455a7b23SScott Bauer 75455a7b23SScott Bauer #define OPAL_INVAL_PARAM 12 76455a7b23SScott Bauer #define OPAL_MANUFACTURED_INACTIVE 0x08 77455a7b23SScott Bauer #define OPAL_DISCOVERY_COMID 0x0001 78455a7b23SScott Bauer 79455a7b23SScott Bauer #define LOCKING_RANGE_NON_GLOBAL 0x03 80455a7b23SScott Bauer /* 81455a7b23SScott Bauer * User IDs used in the TCG storage SSCs 82455a7b23SScott Bauer * Derived from: TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 83455a7b23SScott Bauer * Section: 6.3 Assigned UIDs 84455a7b23SScott Bauer */ 85455a7b23SScott Bauer #define OPAL_METHOD_LENGTH 8 86455a7b23SScott Bauer #define OPAL_MSID_KEYLEN 15 87455a7b23SScott Bauer #define OPAL_UID_LENGTH_HALF 4 88455a7b23SScott Bauer 89455a7b23SScott Bauer /* Enum to index OPALUID array */ 90455a7b23SScott Bauer enum opal_uid { 91455a7b23SScott Bauer /* users */ 92455a7b23SScott Bauer OPAL_SMUID_UID, 93455a7b23SScott Bauer OPAL_THISSP_UID, 94455a7b23SScott Bauer OPAL_ADMINSP_UID, 95455a7b23SScott Bauer OPAL_LOCKINGSP_UID, 96455a7b23SScott Bauer OPAL_ENTERPRISE_LOCKINGSP_UID, 97455a7b23SScott Bauer OPAL_ANYBODY_UID, 98455a7b23SScott Bauer OPAL_SID_UID, 99455a7b23SScott Bauer OPAL_ADMIN1_UID, 100455a7b23SScott Bauer OPAL_USER1_UID, 101455a7b23SScott Bauer OPAL_USER2_UID, 102455a7b23SScott Bauer OPAL_PSID_UID, 103455a7b23SScott Bauer OPAL_ENTERPRISE_BANDMASTER0_UID, 104455a7b23SScott Bauer OPAL_ENTERPRISE_ERASEMASTER_UID, 105455a7b23SScott Bauer /* tables */ 106ff91064eSJonas Rabenstein OPAL_TABLE_TABLE, 107455a7b23SScott Bauer OPAL_LOCKINGRANGE_GLOBAL, 108455a7b23SScott Bauer OPAL_LOCKINGRANGE_ACE_RDLOCKED, 109455a7b23SScott Bauer OPAL_LOCKINGRANGE_ACE_WRLOCKED, 110455a7b23SScott Bauer OPAL_MBRCONTROL, 111455a7b23SScott Bauer OPAL_MBR, 112455a7b23SScott Bauer OPAL_AUTHORITY_TABLE, 113455a7b23SScott Bauer OPAL_C_PIN_TABLE, 114455a7b23SScott Bauer OPAL_LOCKING_INFO_TABLE, 115455a7b23SScott Bauer OPAL_ENTERPRISE_LOCKING_INFO_TABLE, 11662c441c6SRevanth Rajashekar OPAL_DATASTORE, 117455a7b23SScott Bauer /* C_PIN_TABLE object ID's */ 118455a7b23SScott Bauer OPAL_C_PIN_MSID, 119455a7b23SScott Bauer OPAL_C_PIN_SID, 120455a7b23SScott Bauer OPAL_C_PIN_ADMIN1, 121455a7b23SScott Bauer /* half UID's (only first 4 bytes used) */ 122455a7b23SScott Bauer OPAL_HALF_UID_AUTHORITY_OBJ_REF, 123455a7b23SScott Bauer OPAL_HALF_UID_BOOLEAN_ACE, 124455a7b23SScott Bauer /* omitted optional parameter */ 125455a7b23SScott Bauer OPAL_UID_HEXFF, 126455a7b23SScott Bauer }; 127455a7b23SScott Bauer 128455a7b23SScott Bauer /* Enum for indexing the OPALMETHOD array */ 129455a7b23SScott Bauer enum opal_method { 130455a7b23SScott Bauer OPAL_PROPERTIES, 131455a7b23SScott Bauer OPAL_STARTSESSION, 132455a7b23SScott Bauer OPAL_REVERT, 133455a7b23SScott Bauer OPAL_ACTIVATE, 134455a7b23SScott Bauer OPAL_EGET, 135455a7b23SScott Bauer OPAL_ESET, 136455a7b23SScott Bauer OPAL_NEXT, 137455a7b23SScott Bauer OPAL_EAUTHENTICATE, 138455a7b23SScott Bauer OPAL_GETACL, 139455a7b23SScott Bauer OPAL_GENKEY, 140455a7b23SScott Bauer OPAL_REVERTSP, 141455a7b23SScott Bauer OPAL_GET, 142455a7b23SScott Bauer OPAL_SET, 143455a7b23SScott Bauer OPAL_AUTHENTICATE, 144455a7b23SScott Bauer OPAL_RANDOM, 145455a7b23SScott Bauer OPAL_ERASE, 146455a7b23SScott Bauer }; 147455a7b23SScott Bauer 148455a7b23SScott Bauer enum opal_token { 149455a7b23SScott Bauer /* Boolean */ 150455a7b23SScott Bauer OPAL_TRUE = 0x01, 151455a7b23SScott Bauer OPAL_FALSE = 0x00, 152455a7b23SScott Bauer OPAL_BOOLEAN_EXPR = 0x03, 153455a7b23SScott Bauer /* cellblocks */ 154455a7b23SScott Bauer OPAL_TABLE = 0x00, 155455a7b23SScott Bauer OPAL_STARTROW = 0x01, 156455a7b23SScott Bauer OPAL_ENDROW = 0x02, 157455a7b23SScott Bauer OPAL_STARTCOLUMN = 0x03, 158455a7b23SScott Bauer OPAL_ENDCOLUMN = 0x04, 159455a7b23SScott Bauer OPAL_VALUES = 0x01, 160ff91064eSJonas Rabenstein /* table table */ 161ff91064eSJonas Rabenstein OPAL_TABLE_UID = 0x00, 162ff91064eSJonas Rabenstein OPAL_TABLE_NAME = 0x01, 163ff91064eSJonas Rabenstein OPAL_TABLE_COMMON = 0x02, 164ff91064eSJonas Rabenstein OPAL_TABLE_TEMPLATE = 0x03, 165ff91064eSJonas Rabenstein OPAL_TABLE_KIND = 0x04, 166ff91064eSJonas Rabenstein OPAL_TABLE_COLUMN = 0x05, 167ff91064eSJonas Rabenstein OPAL_TABLE_COLUMNS = 0x06, 168ff91064eSJonas Rabenstein OPAL_TABLE_ROWS = 0x07, 169ff91064eSJonas Rabenstein OPAL_TABLE_ROWS_FREE = 0x08, 170ff91064eSJonas Rabenstein OPAL_TABLE_ROW_BYTES = 0x09, 171ff91064eSJonas Rabenstein OPAL_TABLE_LASTID = 0x0A, 172ff91064eSJonas Rabenstein OPAL_TABLE_MIN = 0x0B, 173ff91064eSJonas Rabenstein OPAL_TABLE_MAX = 0x0C, 174455a7b23SScott Bauer /* authority table */ 175455a7b23SScott Bauer OPAL_PIN = 0x03, 176455a7b23SScott Bauer /* locking tokens */ 177455a7b23SScott Bauer OPAL_RANGESTART = 0x03, 178455a7b23SScott Bauer OPAL_RANGELENGTH = 0x04, 179455a7b23SScott Bauer OPAL_READLOCKENABLED = 0x05, 180455a7b23SScott Bauer OPAL_WRITELOCKENABLED = 0x06, 181455a7b23SScott Bauer OPAL_READLOCKED = 0x07, 182455a7b23SScott Bauer OPAL_WRITELOCKED = 0x08, 183455a7b23SScott Bauer OPAL_ACTIVEKEY = 0x0A, 184a4ddbd1bSDavid Kozub /* lockingsp table */ 185a4ddbd1bSDavid Kozub OPAL_LIFECYCLE = 0x06, 186455a7b23SScott Bauer /* locking info table */ 187455a7b23SScott Bauer OPAL_MAXRANGES = 0x04, 188455a7b23SScott Bauer /* mbr control */ 189455a7b23SScott Bauer OPAL_MBRENABLE = 0x01, 190455a7b23SScott Bauer OPAL_MBRDONE = 0x02, 191455a7b23SScott Bauer /* properties */ 192455a7b23SScott Bauer OPAL_HOSTPROPERTIES = 0x00, 193455a7b23SScott Bauer /* atoms */ 194455a7b23SScott Bauer OPAL_STARTLIST = 0xf0, 195455a7b23SScott Bauer OPAL_ENDLIST = 0xf1, 196455a7b23SScott Bauer OPAL_STARTNAME = 0xf2, 197455a7b23SScott Bauer OPAL_ENDNAME = 0xf3, 198455a7b23SScott Bauer OPAL_CALL = 0xf8, 199455a7b23SScott Bauer OPAL_ENDOFDATA = 0xf9, 200455a7b23SScott Bauer OPAL_ENDOFSESSION = 0xfa, 201455a7b23SScott Bauer OPAL_STARTTRANSACTON = 0xfb, 202455a7b23SScott Bauer OPAL_ENDTRANSACTON = 0xfC, 203455a7b23SScott Bauer OPAL_EMPTYATOM = 0xff, 204455a7b23SScott Bauer OPAL_WHERE = 0x00, 205455a7b23SScott Bauer }; 206455a7b23SScott Bauer 207455a7b23SScott Bauer /* Locking state for a locking range */ 208455a7b23SScott Bauer enum opal_lockingstate { 209455a7b23SScott Bauer OPAL_LOCKING_READWRITE = 0x01, 210455a7b23SScott Bauer OPAL_LOCKING_READONLY = 0x02, 211455a7b23SScott Bauer OPAL_LOCKING_LOCKED = 0x03, 212455a7b23SScott Bauer }; 213455a7b23SScott Bauer 214c6da429eSRevanth Rajashekar enum opal_parameter { 215c6da429eSRevanth Rajashekar OPAL_SUM_SET_LIST = 0x060000, 216c6da429eSRevanth Rajashekar }; 217c6da429eSRevanth Rajashekar 218455a7b23SScott Bauer /* Packets derived from: 219455a7b23SScott Bauer * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 220455a7b23SScott Bauer * Secion: 3.2.3 ComPackets, Packets & Subpackets 221455a7b23SScott Bauer */ 222455a7b23SScott Bauer 223455a7b23SScott Bauer /* Comm Packet (header) for transmissions. */ 224455a7b23SScott Bauer struct opal_compacket { 225455a7b23SScott Bauer __be32 reserved0; 226455a7b23SScott Bauer u8 extendedComID[4]; 227455a7b23SScott Bauer __be32 outstandingData; 228455a7b23SScott Bauer __be32 minTransfer; 229455a7b23SScott Bauer __be32 length; 230455a7b23SScott Bauer }; 231455a7b23SScott Bauer 232455a7b23SScott Bauer /* Packet structure. */ 233455a7b23SScott Bauer struct opal_packet { 234455a7b23SScott Bauer __be32 tsn; 235455a7b23SScott Bauer __be32 hsn; 236455a7b23SScott Bauer __be32 seq_number; 237455a7b23SScott Bauer __be16 reserved0; 238455a7b23SScott Bauer __be16 ack_type; 239455a7b23SScott Bauer __be32 acknowledgment; 240455a7b23SScott Bauer __be32 length; 241455a7b23SScott Bauer }; 242455a7b23SScott Bauer 243455a7b23SScott Bauer /* Data sub packet header */ 244455a7b23SScott Bauer struct opal_data_subpacket { 245455a7b23SScott Bauer u8 reserved0[6]; 246455a7b23SScott Bauer __be16 kind; 247455a7b23SScott Bauer __be32 length; 248455a7b23SScott Bauer }; 249455a7b23SScott Bauer 250455a7b23SScott Bauer /* header of a response */ 251455a7b23SScott Bauer struct opal_header { 252455a7b23SScott Bauer struct opal_compacket cp; 253455a7b23SScott Bauer struct opal_packet pkt; 254455a7b23SScott Bauer struct opal_data_subpacket subpkt; 255455a7b23SScott Bauer }; 256455a7b23SScott Bauer 257455a7b23SScott Bauer #define FC_TPER 0x0001 258455a7b23SScott Bauer #define FC_LOCKING 0x0002 259455a7b23SScott Bauer #define FC_GEOMETRY 0x0003 260455a7b23SScott Bauer #define FC_ENTERPRISE 0x0100 261455a7b23SScott Bauer #define FC_DATASTORE 0x0202 262455a7b23SScott Bauer #define FC_SINGLEUSER 0x0201 263455a7b23SScott Bauer #define FC_OPALV100 0x0200 264455a7b23SScott Bauer #define FC_OPALV200 0x0203 265455a7b23SScott Bauer 266455a7b23SScott Bauer /* 267455a7b23SScott Bauer * The Discovery 0 Header. As defined in 268455a7b23SScott Bauer * Opal SSC Documentation 269455a7b23SScott Bauer * Section: 3.3.5 Capability Discovery 270455a7b23SScott Bauer */ 271455a7b23SScott Bauer struct d0_header { 272455a7b23SScott Bauer __be32 length; /* the length of the header 48 in 2.00.100 */ 273455a7b23SScott Bauer __be32 revision; /**< revision of the header 1 in 2.00.100 */ 274455a7b23SScott Bauer __be32 reserved01; 275455a7b23SScott Bauer __be32 reserved02; 276455a7b23SScott Bauer /* 277455a7b23SScott Bauer * the remainder of the structure is vendor specific and will not be 278455a7b23SScott Bauer * addressed now 279455a7b23SScott Bauer */ 280455a7b23SScott Bauer u8 ignored[32]; 281455a7b23SScott Bauer }; 282455a7b23SScott Bauer 283455a7b23SScott Bauer /* 284455a7b23SScott Bauer * TPer Feature Descriptor. Contains flags indicating support for the 285455a7b23SScott Bauer * TPer features described in the OPAL specification. The names match the 286455a7b23SScott Bauer * OPAL terminology 287455a7b23SScott Bauer * 288455a7b23SScott Bauer * code == 0x001 in 2.00.100 289455a7b23SScott Bauer */ 290455a7b23SScott Bauer struct d0_tper_features { 291455a7b23SScott Bauer /* 292455a7b23SScott Bauer * supported_features bits: 293455a7b23SScott Bauer * bit 7: reserved 294455a7b23SScott Bauer * bit 6: com ID management 295455a7b23SScott Bauer * bit 5: reserved 296455a7b23SScott Bauer * bit 4: streaming support 297455a7b23SScott Bauer * bit 3: buffer management 298455a7b23SScott Bauer * bit 2: ACK/NACK 299455a7b23SScott Bauer * bit 1: async 300455a7b23SScott Bauer * bit 0: sync 301455a7b23SScott Bauer */ 302455a7b23SScott Bauer u8 supported_features; 303455a7b23SScott Bauer /* 304455a7b23SScott Bauer * bytes 5 through 15 are reserved, but we represent the first 3 as 305455a7b23SScott Bauer * u8 to keep the other two 32bits integers aligned. 306455a7b23SScott Bauer */ 307455a7b23SScott Bauer u8 reserved01[3]; 308455a7b23SScott Bauer __be32 reserved02; 309455a7b23SScott Bauer __be32 reserved03; 310455a7b23SScott Bauer }; 311455a7b23SScott Bauer 312455a7b23SScott Bauer /* 313455a7b23SScott Bauer * Locking Feature Descriptor. Contains flags indicating support for the 314455a7b23SScott Bauer * locking features described in the OPAL specification. The names match the 315455a7b23SScott Bauer * OPAL terminology 316455a7b23SScott Bauer * 317455a7b23SScott Bauer * code == 0x0002 in 2.00.100 318455a7b23SScott Bauer */ 319455a7b23SScott Bauer struct d0_locking_features { 320455a7b23SScott Bauer /* 321455a7b23SScott Bauer * supported_features bits: 322455a7b23SScott Bauer * bits 6-7: reserved 323455a7b23SScott Bauer * bit 5: MBR done 324455a7b23SScott Bauer * bit 4: MBR enabled 325455a7b23SScott Bauer * bit 3: media encryption 326455a7b23SScott Bauer * bit 2: locked 327455a7b23SScott Bauer * bit 1: locking enabled 328455a7b23SScott Bauer * bit 0: locking supported 329455a7b23SScott Bauer */ 330455a7b23SScott Bauer u8 supported_features; 331455a7b23SScott Bauer /* 332455a7b23SScott Bauer * bytes 5 through 15 are reserved, but we represent the first 3 as 333455a7b23SScott Bauer * u8 to keep the other two 32bits integers aligned. 334455a7b23SScott Bauer */ 335455a7b23SScott Bauer u8 reserved01[3]; 336455a7b23SScott Bauer __be32 reserved02; 337455a7b23SScott Bauer __be32 reserved03; 338455a7b23SScott Bauer }; 339455a7b23SScott Bauer 340455a7b23SScott Bauer /* 341455a7b23SScott Bauer * Geometry Feature Descriptor. Contains flags indicating support for the 342455a7b23SScott Bauer * geometry features described in the OPAL specification. The names match the 343455a7b23SScott Bauer * OPAL terminology 344455a7b23SScott Bauer * 345455a7b23SScott Bauer * code == 0x0003 in 2.00.100 346455a7b23SScott Bauer */ 347455a7b23SScott Bauer struct d0_geometry_features { 348455a7b23SScott Bauer /* 349455a7b23SScott Bauer * skip 32 bits from header, needed to align the struct to 64 bits. 350455a7b23SScott Bauer */ 351455a7b23SScott Bauer u8 header[4]; 352455a7b23SScott Bauer /* 353455a7b23SScott Bauer * reserved01: 354455a7b23SScott Bauer * bits 1-6: reserved 355455a7b23SScott Bauer * bit 0: align 356455a7b23SScott Bauer */ 357455a7b23SScott Bauer u8 reserved01; 358455a7b23SScott Bauer u8 reserved02[7]; 359455a7b23SScott Bauer __be32 logical_block_size; 360455a7b23SScott Bauer __be64 alignment_granularity; 361455a7b23SScott Bauer __be64 lowest_aligned_lba; 362455a7b23SScott Bauer }; 363455a7b23SScott Bauer 364455a7b23SScott Bauer /* 365455a7b23SScott Bauer * Enterprise SSC Feature 366455a7b23SScott Bauer * 367455a7b23SScott Bauer * code == 0x0100 368455a7b23SScott Bauer */ 369455a7b23SScott Bauer struct d0_enterprise_ssc { 370455a7b23SScott Bauer __be16 baseComID; 371455a7b23SScott Bauer __be16 numComIDs; 372455a7b23SScott Bauer /* range_crossing: 373455a7b23SScott Bauer * bits 1-6: reserved 374455a7b23SScott Bauer * bit 0: range crossing 375455a7b23SScott Bauer */ 376455a7b23SScott Bauer u8 range_crossing; 377455a7b23SScott Bauer u8 reserved01; 378455a7b23SScott Bauer __be16 reserved02; 379455a7b23SScott Bauer __be32 reserved03; 380455a7b23SScott Bauer __be32 reserved04; 381455a7b23SScott Bauer }; 382455a7b23SScott Bauer 383455a7b23SScott Bauer /* 384455a7b23SScott Bauer * Opal V1 feature 385455a7b23SScott Bauer * 386455a7b23SScott Bauer * code == 0x0200 387455a7b23SScott Bauer */ 388455a7b23SScott Bauer struct d0_opal_v100 { 389455a7b23SScott Bauer __be16 baseComID; 390455a7b23SScott Bauer __be16 numComIDs; 391455a7b23SScott Bauer }; 392455a7b23SScott Bauer 393455a7b23SScott Bauer /* 394455a7b23SScott Bauer * Single User Mode feature 395455a7b23SScott Bauer * 396455a7b23SScott Bauer * code == 0x0201 397455a7b23SScott Bauer */ 398455a7b23SScott Bauer struct d0_single_user_mode { 399455a7b23SScott Bauer __be32 num_locking_objects; 400455a7b23SScott Bauer /* reserved01: 401455a7b23SScott Bauer * bit 0: any 402455a7b23SScott Bauer * bit 1: all 403455a7b23SScott Bauer * bit 2: policy 404455a7b23SScott Bauer * bits 3-7: reserved 405455a7b23SScott Bauer */ 406455a7b23SScott Bauer u8 reserved01; 407455a7b23SScott Bauer u8 reserved02; 408455a7b23SScott Bauer __be16 reserved03; 409455a7b23SScott Bauer __be32 reserved04; 410455a7b23SScott Bauer }; 411455a7b23SScott Bauer 412455a7b23SScott Bauer /* 413455a7b23SScott Bauer * Additonal Datastores feature 414455a7b23SScott Bauer * 415455a7b23SScott Bauer * code == 0x0202 416455a7b23SScott Bauer */ 417455a7b23SScott Bauer struct d0_datastore_table { 418455a7b23SScott Bauer __be16 reserved01; 419455a7b23SScott Bauer __be16 max_tables; 420455a7b23SScott Bauer __be32 max_size_tables; 421455a7b23SScott Bauer __be32 table_size_alignment; 422455a7b23SScott Bauer }; 423455a7b23SScott Bauer 424455a7b23SScott Bauer /* 425455a7b23SScott Bauer * OPAL 2.0 feature 426455a7b23SScott Bauer * 427455a7b23SScott Bauer * code == 0x0203 428455a7b23SScott Bauer */ 429455a7b23SScott Bauer struct d0_opal_v200 { 430455a7b23SScott Bauer __be16 baseComID; 431455a7b23SScott Bauer __be16 numComIDs; 432455a7b23SScott Bauer /* range_crossing: 433455a7b23SScott Bauer * bits 1-6: reserved 434455a7b23SScott Bauer * bit 0: range crossing 435455a7b23SScott Bauer */ 436455a7b23SScott Bauer u8 range_crossing; 437455a7b23SScott Bauer /* num_locking_admin_auth: 438455a7b23SScott Bauer * not aligned to 16 bits, so use two u8. 439455a7b23SScott Bauer * stored in big endian: 440455a7b23SScott Bauer * 0: MSB 441455a7b23SScott Bauer * 1: LSB 442455a7b23SScott Bauer */ 443455a7b23SScott Bauer u8 num_locking_admin_auth[2]; 444455a7b23SScott Bauer /* num_locking_user_auth: 445455a7b23SScott Bauer * not aligned to 16 bits, so use two u8. 446455a7b23SScott Bauer * stored in big endian: 447455a7b23SScott Bauer * 0: MSB 448455a7b23SScott Bauer * 1: LSB 449455a7b23SScott Bauer */ 450455a7b23SScott Bauer u8 num_locking_user_auth[2]; 451455a7b23SScott Bauer u8 initialPIN; 452455a7b23SScott Bauer u8 revertedPIN; 453455a7b23SScott Bauer u8 reserved01; 454455a7b23SScott Bauer __be32 reserved02; 455455a7b23SScott Bauer }; 456455a7b23SScott Bauer 457455a7b23SScott Bauer /* Union of features used to parse the discovery 0 response */ 458455a7b23SScott Bauer struct d0_features { 459455a7b23SScott Bauer __be16 code; 460455a7b23SScott Bauer /* 461455a7b23SScott Bauer * r_version bits: 462455a7b23SScott Bauer * bits 4-7: version 463455a7b23SScott Bauer * bits 0-3: reserved 464455a7b23SScott Bauer */ 465455a7b23SScott Bauer u8 r_version; 466455a7b23SScott Bauer u8 length; 467455a7b23SScott Bauer u8 features[]; 468455a7b23SScott Bauer }; 469455a7b23SScott Bauer 470455a7b23SScott Bauer #endif /* _OPAL_PROTO_H */ 471