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 42c6ea7060Sdougmill@linux.vnet.ibm.com /* FC_LOCKING features */ 43c6ea7060Sdougmill@linux.vnet.ibm.com #define LOCKING_SUPPORTED_MASK 0x01 44c6ea7060Sdougmill@linux.vnet.ibm.com #define LOCKING_ENABLED_MASK 0x02 45c6ea7060Sdougmill@linux.vnet.ibm.com #define LOCKED_MASK 0x04 46dbec491bSScott Bauer #define MBR_ENABLED_MASK 0x10 47c6ea7060Sdougmill@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 89*175b6544SOndrej Kozina /* 90*175b6544SOndrej Kozina * Boolean operators from TCG Core spec 2.01 Section: 91*175b6544SOndrej Kozina * 5.1.3.11 92*175b6544SOndrej Kozina * Table 61 93*175b6544SOndrej Kozina */ 94*175b6544SOndrej Kozina #define OPAL_BOOLEAN_AND 0 95*175b6544SOndrej Kozina #define OPAL_BOOLEAN_OR 1 96*175b6544SOndrej Kozina #define OPAL_BOOLEAN_NOT 2 97*175b6544SOndrej Kozina 98455a7b23SScott Bauer /* Enum to index OPALUID array */ 99455a7b23SScott Bauer enum opal_uid { 100455a7b23SScott Bauer /* users */ 101455a7b23SScott Bauer OPAL_SMUID_UID, 102455a7b23SScott Bauer OPAL_THISSP_UID, 103455a7b23SScott Bauer OPAL_ADMINSP_UID, 104455a7b23SScott Bauer OPAL_LOCKINGSP_UID, 105455a7b23SScott Bauer OPAL_ENTERPRISE_LOCKINGSP_UID, 106455a7b23SScott Bauer OPAL_ANYBODY_UID, 107455a7b23SScott Bauer OPAL_SID_UID, 108455a7b23SScott Bauer OPAL_ADMIN1_UID, 109455a7b23SScott Bauer OPAL_USER1_UID, 110455a7b23SScott Bauer OPAL_USER2_UID, 111455a7b23SScott Bauer OPAL_PSID_UID, 112455a7b23SScott Bauer OPAL_ENTERPRISE_BANDMASTER0_UID, 113455a7b23SScott Bauer OPAL_ENTERPRISE_ERASEMASTER_UID, 114455a7b23SScott Bauer /* tables */ 115ff91064eSJonas Rabenstein OPAL_TABLE_TABLE, 116455a7b23SScott Bauer OPAL_LOCKINGRANGE_GLOBAL, 117455a7b23SScott Bauer OPAL_LOCKINGRANGE_ACE_RDLOCKED, 118455a7b23SScott Bauer OPAL_LOCKINGRANGE_ACE_WRLOCKED, 119455a7b23SScott Bauer OPAL_MBRCONTROL, 120455a7b23SScott Bauer OPAL_MBR, 121455a7b23SScott Bauer OPAL_AUTHORITY_TABLE, 122455a7b23SScott Bauer OPAL_C_PIN_TABLE, 123455a7b23SScott Bauer OPAL_LOCKING_INFO_TABLE, 124455a7b23SScott Bauer OPAL_ENTERPRISE_LOCKING_INFO_TABLE, 12562c441c6SRevanth Rajashekar OPAL_DATASTORE, 126455a7b23SScott Bauer /* C_PIN_TABLE object ID's */ 127455a7b23SScott Bauer OPAL_C_PIN_MSID, 128455a7b23SScott Bauer OPAL_C_PIN_SID, 129455a7b23SScott Bauer OPAL_C_PIN_ADMIN1, 130455a7b23SScott Bauer /* half UID's (only first 4 bytes used) */ 131455a7b23SScott Bauer OPAL_HALF_UID_AUTHORITY_OBJ_REF, 132455a7b23SScott Bauer OPAL_HALF_UID_BOOLEAN_ACE, 133455a7b23SScott Bauer /* omitted optional parameter */ 134455a7b23SScott Bauer OPAL_UID_HEXFF, 135455a7b23SScott Bauer }; 136455a7b23SScott Bauer 137455a7b23SScott Bauer /* Enum for indexing the OPALMETHOD array */ 138455a7b23SScott Bauer enum opal_method { 139455a7b23SScott Bauer OPAL_PROPERTIES, 140455a7b23SScott Bauer OPAL_STARTSESSION, 141455a7b23SScott Bauer OPAL_REVERT, 142455a7b23SScott Bauer OPAL_ACTIVATE, 143455a7b23SScott Bauer OPAL_EGET, 144455a7b23SScott Bauer OPAL_ESET, 145455a7b23SScott Bauer OPAL_NEXT, 146455a7b23SScott Bauer OPAL_EAUTHENTICATE, 147455a7b23SScott Bauer OPAL_GETACL, 148455a7b23SScott Bauer OPAL_GENKEY, 149455a7b23SScott Bauer OPAL_REVERTSP, 150455a7b23SScott Bauer OPAL_GET, 151455a7b23SScott Bauer OPAL_SET, 152455a7b23SScott Bauer OPAL_AUTHENTICATE, 153455a7b23SScott Bauer OPAL_RANDOM, 154455a7b23SScott Bauer OPAL_ERASE, 155455a7b23SScott Bauer }; 156455a7b23SScott Bauer 157455a7b23SScott Bauer enum opal_token { 158455a7b23SScott Bauer /* Boolean */ 159455a7b23SScott Bauer OPAL_TRUE = 0x01, 160455a7b23SScott Bauer OPAL_FALSE = 0x00, 161455a7b23SScott Bauer OPAL_BOOLEAN_EXPR = 0x03, 162455a7b23SScott Bauer /* cellblocks */ 163455a7b23SScott Bauer OPAL_TABLE = 0x00, 164455a7b23SScott Bauer OPAL_STARTROW = 0x01, 165455a7b23SScott Bauer OPAL_ENDROW = 0x02, 166455a7b23SScott Bauer OPAL_STARTCOLUMN = 0x03, 167455a7b23SScott Bauer OPAL_ENDCOLUMN = 0x04, 168455a7b23SScott Bauer OPAL_VALUES = 0x01, 169ff91064eSJonas Rabenstein /* table table */ 170ff91064eSJonas Rabenstein OPAL_TABLE_UID = 0x00, 171ff91064eSJonas Rabenstein OPAL_TABLE_NAME = 0x01, 172ff91064eSJonas Rabenstein OPAL_TABLE_COMMON = 0x02, 173ff91064eSJonas Rabenstein OPAL_TABLE_TEMPLATE = 0x03, 174ff91064eSJonas Rabenstein OPAL_TABLE_KIND = 0x04, 175ff91064eSJonas Rabenstein OPAL_TABLE_COLUMN = 0x05, 176ff91064eSJonas Rabenstein OPAL_TABLE_COLUMNS = 0x06, 177ff91064eSJonas Rabenstein OPAL_TABLE_ROWS = 0x07, 178ff91064eSJonas Rabenstein OPAL_TABLE_ROWS_FREE = 0x08, 179ff91064eSJonas Rabenstein OPAL_TABLE_ROW_BYTES = 0x09, 180ff91064eSJonas Rabenstein OPAL_TABLE_LASTID = 0x0A, 181ff91064eSJonas Rabenstein OPAL_TABLE_MIN = 0x0B, 182ff91064eSJonas Rabenstein OPAL_TABLE_MAX = 0x0C, 183455a7b23SScott Bauer /* authority table */ 184455a7b23SScott Bauer OPAL_PIN = 0x03, 185455a7b23SScott Bauer /* locking tokens */ 186455a7b23SScott Bauer OPAL_RANGESTART = 0x03, 187455a7b23SScott Bauer OPAL_RANGELENGTH = 0x04, 188455a7b23SScott Bauer OPAL_READLOCKENABLED = 0x05, 189455a7b23SScott Bauer OPAL_WRITELOCKENABLED = 0x06, 190455a7b23SScott Bauer OPAL_READLOCKED = 0x07, 191455a7b23SScott Bauer OPAL_WRITELOCKED = 0x08, 192455a7b23SScott Bauer OPAL_ACTIVEKEY = 0x0A, 193a4ddbd1bSDavid Kozub /* lockingsp table */ 194a4ddbd1bSDavid Kozub OPAL_LIFECYCLE = 0x06, 195455a7b23SScott Bauer /* locking info table */ 196455a7b23SScott Bauer OPAL_MAXRANGES = 0x04, 197455a7b23SScott Bauer /* mbr control */ 198455a7b23SScott Bauer OPAL_MBRENABLE = 0x01, 199455a7b23SScott Bauer OPAL_MBRDONE = 0x02, 200455a7b23SScott Bauer /* properties */ 201455a7b23SScott Bauer OPAL_HOSTPROPERTIES = 0x00, 202455a7b23SScott Bauer /* atoms */ 203455a7b23SScott Bauer OPAL_STARTLIST = 0xf0, 204455a7b23SScott Bauer OPAL_ENDLIST = 0xf1, 205455a7b23SScott Bauer OPAL_STARTNAME = 0xf2, 206455a7b23SScott Bauer OPAL_ENDNAME = 0xf3, 207455a7b23SScott Bauer OPAL_CALL = 0xf8, 208455a7b23SScott Bauer OPAL_ENDOFDATA = 0xf9, 209455a7b23SScott Bauer OPAL_ENDOFSESSION = 0xfa, 210455a7b23SScott Bauer OPAL_STARTTRANSACTON = 0xfb, 211455a7b23SScott Bauer OPAL_ENDTRANSACTON = 0xfC, 212455a7b23SScott Bauer OPAL_EMPTYATOM = 0xff, 213455a7b23SScott Bauer OPAL_WHERE = 0x00, 214455a7b23SScott Bauer }; 215455a7b23SScott Bauer 216455a7b23SScott Bauer /* Locking state for a locking range */ 217455a7b23SScott Bauer enum opal_lockingstate { 218455a7b23SScott Bauer OPAL_LOCKING_READWRITE = 0x01, 219455a7b23SScott Bauer OPAL_LOCKING_READONLY = 0x02, 220455a7b23SScott Bauer OPAL_LOCKING_LOCKED = 0x03, 221455a7b23SScott Bauer }; 222455a7b23SScott Bauer 223c6da429eSRevanth Rajashekar enum opal_parameter { 224c6da429eSRevanth Rajashekar OPAL_SUM_SET_LIST = 0x060000, 225c6da429eSRevanth Rajashekar }; 226c6da429eSRevanth Rajashekar 227455a7b23SScott Bauer /* Packets derived from: 228455a7b23SScott Bauer * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00 229455a7b23SScott Bauer * Secion: 3.2.3 ComPackets, Packets & Subpackets 230455a7b23SScott Bauer */ 231455a7b23SScott Bauer 232455a7b23SScott Bauer /* Comm Packet (header) for transmissions. */ 233455a7b23SScott Bauer struct opal_compacket { 234455a7b23SScott Bauer __be32 reserved0; 235455a7b23SScott Bauer u8 extendedComID[4]; 236455a7b23SScott Bauer __be32 outstandingData; 237455a7b23SScott Bauer __be32 minTransfer; 238455a7b23SScott Bauer __be32 length; 239455a7b23SScott Bauer }; 240455a7b23SScott Bauer 241455a7b23SScott Bauer /* Packet structure. */ 242455a7b23SScott Bauer struct opal_packet { 243455a7b23SScott Bauer __be32 tsn; 244455a7b23SScott Bauer __be32 hsn; 245455a7b23SScott Bauer __be32 seq_number; 246455a7b23SScott Bauer __be16 reserved0; 247455a7b23SScott Bauer __be16 ack_type; 248455a7b23SScott Bauer __be32 acknowledgment; 249455a7b23SScott Bauer __be32 length; 250455a7b23SScott Bauer }; 251455a7b23SScott Bauer 252455a7b23SScott Bauer /* Data sub packet header */ 253455a7b23SScott Bauer struct opal_data_subpacket { 254455a7b23SScott Bauer u8 reserved0[6]; 255455a7b23SScott Bauer __be16 kind; 256455a7b23SScott Bauer __be32 length; 257455a7b23SScott Bauer }; 258455a7b23SScott Bauer 259455a7b23SScott Bauer /* header of a response */ 260455a7b23SScott Bauer struct opal_header { 261455a7b23SScott Bauer struct opal_compacket cp; 262455a7b23SScott Bauer struct opal_packet pkt; 263455a7b23SScott Bauer struct opal_data_subpacket subpkt; 264455a7b23SScott Bauer }; 265455a7b23SScott Bauer 266455a7b23SScott Bauer #define FC_TPER 0x0001 267455a7b23SScott Bauer #define FC_LOCKING 0x0002 268455a7b23SScott Bauer #define FC_GEOMETRY 0x0003 269455a7b23SScott Bauer #define FC_ENTERPRISE 0x0100 270455a7b23SScott Bauer #define FC_DATASTORE 0x0202 271455a7b23SScott Bauer #define FC_SINGLEUSER 0x0201 272455a7b23SScott Bauer #define FC_OPALV100 0x0200 273455a7b23SScott Bauer #define FC_OPALV200 0x0203 274455a7b23SScott Bauer 275455a7b23SScott Bauer /* 276455a7b23SScott Bauer * The Discovery 0 Header. As defined in 277455a7b23SScott Bauer * Opal SSC Documentation 278455a7b23SScott Bauer * Section: 3.3.5 Capability Discovery 279455a7b23SScott Bauer */ 280455a7b23SScott Bauer struct d0_header { 281455a7b23SScott Bauer __be32 length; /* the length of the header 48 in 2.00.100 */ 282455a7b23SScott Bauer __be32 revision; /**< revision of the header 1 in 2.00.100 */ 283455a7b23SScott Bauer __be32 reserved01; 284455a7b23SScott Bauer __be32 reserved02; 285455a7b23SScott Bauer /* 286455a7b23SScott Bauer * the remainder of the structure is vendor specific and will not be 287455a7b23SScott Bauer * addressed now 288455a7b23SScott Bauer */ 289455a7b23SScott Bauer u8 ignored[32]; 290455a7b23SScott Bauer }; 291455a7b23SScott Bauer 292455a7b23SScott Bauer /* 293455a7b23SScott Bauer * TPer Feature Descriptor. Contains flags indicating support for the 294455a7b23SScott Bauer * TPer features described in the OPAL specification. The names match the 295455a7b23SScott Bauer * OPAL terminology 296455a7b23SScott Bauer * 297455a7b23SScott Bauer * code == 0x001 in 2.00.100 298455a7b23SScott Bauer */ 299455a7b23SScott Bauer struct d0_tper_features { 300455a7b23SScott Bauer /* 301455a7b23SScott Bauer * supported_features bits: 302455a7b23SScott Bauer * bit 7: reserved 303455a7b23SScott Bauer * bit 6: com ID management 304455a7b23SScott Bauer * bit 5: reserved 305455a7b23SScott Bauer * bit 4: streaming support 306455a7b23SScott Bauer * bit 3: buffer management 307455a7b23SScott Bauer * bit 2: ACK/NACK 308455a7b23SScott Bauer * bit 1: async 309455a7b23SScott Bauer * bit 0: sync 310455a7b23SScott Bauer */ 311455a7b23SScott Bauer u8 supported_features; 312455a7b23SScott Bauer /* 313455a7b23SScott Bauer * bytes 5 through 15 are reserved, but we represent the first 3 as 314455a7b23SScott Bauer * u8 to keep the other two 32bits integers aligned. 315455a7b23SScott Bauer */ 316455a7b23SScott Bauer u8 reserved01[3]; 317455a7b23SScott Bauer __be32 reserved02; 318455a7b23SScott Bauer __be32 reserved03; 319455a7b23SScott Bauer }; 320455a7b23SScott Bauer 321455a7b23SScott Bauer /* 322455a7b23SScott Bauer * Locking Feature Descriptor. Contains flags indicating support for the 323455a7b23SScott Bauer * locking features described in the OPAL specification. The names match the 324455a7b23SScott Bauer * OPAL terminology 325455a7b23SScott Bauer * 326455a7b23SScott Bauer * code == 0x0002 in 2.00.100 327455a7b23SScott Bauer */ 328455a7b23SScott Bauer struct d0_locking_features { 329455a7b23SScott Bauer /* 330455a7b23SScott Bauer * supported_features bits: 331455a7b23SScott Bauer * bits 6-7: reserved 332455a7b23SScott Bauer * bit 5: MBR done 333455a7b23SScott Bauer * bit 4: MBR enabled 334455a7b23SScott Bauer * bit 3: media encryption 335455a7b23SScott Bauer * bit 2: locked 336455a7b23SScott Bauer * bit 1: locking enabled 337455a7b23SScott Bauer * bit 0: locking supported 338455a7b23SScott Bauer */ 339455a7b23SScott Bauer u8 supported_features; 340455a7b23SScott Bauer /* 341455a7b23SScott Bauer * bytes 5 through 15 are reserved, but we represent the first 3 as 342455a7b23SScott Bauer * u8 to keep the other two 32bits integers aligned. 343455a7b23SScott Bauer */ 344455a7b23SScott Bauer u8 reserved01[3]; 345455a7b23SScott Bauer __be32 reserved02; 346455a7b23SScott Bauer __be32 reserved03; 347455a7b23SScott Bauer }; 348455a7b23SScott Bauer 349455a7b23SScott Bauer /* 350455a7b23SScott Bauer * Geometry Feature Descriptor. Contains flags indicating support for the 351455a7b23SScott Bauer * geometry features described in the OPAL specification. The names match the 352455a7b23SScott Bauer * OPAL terminology 353455a7b23SScott Bauer * 354455a7b23SScott Bauer * code == 0x0003 in 2.00.100 355455a7b23SScott Bauer */ 356455a7b23SScott Bauer struct d0_geometry_features { 357455a7b23SScott Bauer /* 358455a7b23SScott Bauer * skip 32 bits from header, needed to align the struct to 64 bits. 359455a7b23SScott Bauer */ 360455a7b23SScott Bauer u8 header[4]; 361455a7b23SScott Bauer /* 362455a7b23SScott Bauer * reserved01: 363455a7b23SScott Bauer * bits 1-6: reserved 364455a7b23SScott Bauer * bit 0: align 365455a7b23SScott Bauer */ 366455a7b23SScott Bauer u8 reserved01; 367455a7b23SScott Bauer u8 reserved02[7]; 368455a7b23SScott Bauer __be32 logical_block_size; 369455a7b23SScott Bauer __be64 alignment_granularity; 370455a7b23SScott Bauer __be64 lowest_aligned_lba; 371455a7b23SScott Bauer }; 372455a7b23SScott Bauer 373455a7b23SScott Bauer /* 374455a7b23SScott Bauer * Enterprise SSC Feature 375455a7b23SScott Bauer * 376455a7b23SScott Bauer * code == 0x0100 377455a7b23SScott Bauer */ 378455a7b23SScott Bauer struct d0_enterprise_ssc { 379455a7b23SScott Bauer __be16 baseComID; 380455a7b23SScott Bauer __be16 numComIDs; 381455a7b23SScott Bauer /* range_crossing: 382455a7b23SScott Bauer * bits 1-6: reserved 383455a7b23SScott Bauer * bit 0: range crossing 384455a7b23SScott Bauer */ 385455a7b23SScott Bauer u8 range_crossing; 386455a7b23SScott Bauer u8 reserved01; 387455a7b23SScott Bauer __be16 reserved02; 388455a7b23SScott Bauer __be32 reserved03; 389455a7b23SScott Bauer __be32 reserved04; 390455a7b23SScott Bauer }; 391455a7b23SScott Bauer 392455a7b23SScott Bauer /* 393455a7b23SScott Bauer * Opal V1 feature 394455a7b23SScott Bauer * 395455a7b23SScott Bauer * code == 0x0200 396455a7b23SScott Bauer */ 397455a7b23SScott Bauer struct d0_opal_v100 { 398455a7b23SScott Bauer __be16 baseComID; 399455a7b23SScott Bauer __be16 numComIDs; 400455a7b23SScott Bauer }; 401455a7b23SScott Bauer 402455a7b23SScott Bauer /* 403455a7b23SScott Bauer * Single User Mode feature 404455a7b23SScott Bauer * 405455a7b23SScott Bauer * code == 0x0201 406455a7b23SScott Bauer */ 407455a7b23SScott Bauer struct d0_single_user_mode { 408455a7b23SScott Bauer __be32 num_locking_objects; 409455a7b23SScott Bauer /* reserved01: 410455a7b23SScott Bauer * bit 0: any 411455a7b23SScott Bauer * bit 1: all 412455a7b23SScott Bauer * bit 2: policy 413455a7b23SScott Bauer * bits 3-7: reserved 414455a7b23SScott Bauer */ 415455a7b23SScott Bauer u8 reserved01; 416455a7b23SScott Bauer u8 reserved02; 417455a7b23SScott Bauer __be16 reserved03; 418455a7b23SScott Bauer __be32 reserved04; 419455a7b23SScott Bauer }; 420455a7b23SScott Bauer 421455a7b23SScott Bauer /* 422455a7b23SScott Bauer * Additonal Datastores feature 423455a7b23SScott Bauer * 424455a7b23SScott Bauer * code == 0x0202 425455a7b23SScott Bauer */ 426455a7b23SScott Bauer struct d0_datastore_table { 427455a7b23SScott Bauer __be16 reserved01; 428455a7b23SScott Bauer __be16 max_tables; 429455a7b23SScott Bauer __be32 max_size_tables; 430455a7b23SScott Bauer __be32 table_size_alignment; 431455a7b23SScott Bauer }; 432455a7b23SScott Bauer 433455a7b23SScott Bauer /* 434455a7b23SScott Bauer * OPAL 2.0 feature 435455a7b23SScott Bauer * 436455a7b23SScott Bauer * code == 0x0203 437455a7b23SScott Bauer */ 438455a7b23SScott Bauer struct d0_opal_v200 { 439455a7b23SScott Bauer __be16 baseComID; 440455a7b23SScott Bauer __be16 numComIDs; 441455a7b23SScott Bauer /* range_crossing: 442455a7b23SScott Bauer * bits 1-6: reserved 443455a7b23SScott Bauer * bit 0: range crossing 444455a7b23SScott Bauer */ 445455a7b23SScott Bauer u8 range_crossing; 446455a7b23SScott Bauer /* num_locking_admin_auth: 447455a7b23SScott Bauer * not aligned to 16 bits, so use two u8. 448455a7b23SScott Bauer * stored in big endian: 449455a7b23SScott Bauer * 0: MSB 450455a7b23SScott Bauer * 1: LSB 451455a7b23SScott Bauer */ 452455a7b23SScott Bauer u8 num_locking_admin_auth[2]; 453455a7b23SScott Bauer /* num_locking_user_auth: 454455a7b23SScott Bauer * not aligned to 16 bits, so use two u8. 455455a7b23SScott Bauer * stored in big endian: 456455a7b23SScott Bauer * 0: MSB 457455a7b23SScott Bauer * 1: LSB 458455a7b23SScott Bauer */ 459455a7b23SScott Bauer u8 num_locking_user_auth[2]; 460455a7b23SScott Bauer u8 initialPIN; 461455a7b23SScott Bauer u8 revertedPIN; 462455a7b23SScott Bauer u8 reserved01; 463455a7b23SScott Bauer __be32 reserved02; 464455a7b23SScott Bauer }; 465455a7b23SScott Bauer 466455a7b23SScott Bauer /* Union of features used to parse the discovery 0 response */ 467455a7b23SScott Bauer struct d0_features { 468455a7b23SScott Bauer __be16 code; 469455a7b23SScott Bauer /* 470455a7b23SScott Bauer * r_version bits: 471455a7b23SScott Bauer * bits 4-7: version 472455a7b23SScott Bauer * bits 0-3: reserved 473455a7b23SScott Bauer */ 474455a7b23SScott Bauer u8 r_version; 475455a7b23SScott Bauer u8 length; 476455a7b23SScott Bauer u8 features[]; 477455a7b23SScott Bauer }; 478455a7b23SScott Bauer 479455a7b23SScott Bauer #endif /* _OPAL_PROTO_H */ 480