1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _UAPI_SED_OPAL_H 8 #define _UAPI_SED_OPAL_H 9 #include <linux/types.h> 10 #define OPAL_KEY_MAX 256 11 #define OPAL_MAX_LRS 9 12 enum opal_mbr { 13 OPAL_MBR_ENABLE = 0x0, 14 OPAL_MBR_DISABLE = 0x01, 15 }; 16 enum opal_mbr_done_flag { 17 OPAL_MBR_NOT_DONE = 0x0, 18 OPAL_MBR_DONE = 0x01 19 }; 20 enum opal_user { 21 OPAL_ADMIN1 = 0x0, 22 OPAL_USER1 = 0x01, 23 OPAL_USER2 = 0x02, 24 OPAL_USER3 = 0x03, 25 OPAL_USER4 = 0x04, 26 OPAL_USER5 = 0x05, 27 OPAL_USER6 = 0x06, 28 OPAL_USER7 = 0x07, 29 OPAL_USER8 = 0x08, 30 OPAL_USER9 = 0x09, 31 }; 32 enum opal_lock_state { 33 OPAL_RO = 0x01, 34 OPAL_RW = 0x02, 35 OPAL_LK = 0x04, 36 }; 37 enum opal_lock_flags { 38 OPAL_SAVE_FOR_LOCK = 0x01, 39 }; 40 enum opal_key_type { 41 OPAL_INCLUDED = 0, 42 OPAL_KEYRING, 43 }; 44 struct opal_key { 45 __u8 lr; 46 __u8 key_len; 47 __u8 key_type; 48 __u8 __align[5]; 49 __u8 key[OPAL_KEY_MAX]; 50 }; 51 enum opal_revert_lsp_opts { 52 OPAL_PRESERVE = 0x01, 53 }; 54 struct opal_lr_act { 55 struct opal_key key; 56 __u32 sum; 57 __u8 num_lrs; 58 __u8 lr[OPAL_MAX_LRS]; 59 __u8 align[2]; 60 }; 61 struct opal_session_info { 62 __u32 sum; 63 __u32 who; 64 struct opal_key opal_key; 65 }; 66 struct opal_user_lr_setup { 67 __u64 range_start; 68 __u64 range_length; 69 __u32 RLE; 70 __u32 WLE; 71 struct opal_session_info session; 72 }; 73 struct opal_lr_status { 74 struct opal_session_info session; 75 __u64 range_start; 76 __u64 range_length; 77 __u32 RLE; 78 __u32 WLE; 79 __u32 l_state; 80 __u8 align[4]; 81 }; 82 struct opal_lock_unlock { 83 struct opal_session_info session; 84 __u32 l_state; 85 __u16 flags; 86 __u8 __align[2]; 87 }; 88 struct opal_new_pw { 89 struct opal_session_info session; 90 struct opal_session_info new_user_pw; 91 }; 92 struct opal_mbr_data { 93 struct opal_key key; 94 __u8 enable_disable; 95 __u8 __align[7]; 96 }; 97 struct opal_mbr_done { 98 struct opal_key key; 99 __u8 done_flag; 100 __u8 __align[7]; 101 }; 102 struct opal_shadow_mbr { 103 struct opal_key key; 104 const __u64 data; 105 __u64 offset; 106 __u64 size; 107 }; 108 enum opal_table_ops { 109 OPAL_READ_TABLE, 110 OPAL_WRITE_TABLE, 111 }; 112 #define OPAL_UID_LENGTH 8 113 struct opal_read_write_table { 114 struct opal_key key; 115 const __u64 data; 116 const __u8 table_uid[OPAL_UID_LENGTH]; 117 __u64 offset; 118 __u64 size; 119 #define OPAL_TABLE_READ (1 << OPAL_READ_TABLE) 120 #define OPAL_TABLE_WRITE (1 << OPAL_WRITE_TABLE) 121 __u64 flags; 122 __u64 priv; 123 }; 124 #define OPAL_FL_SUPPORTED 0x00000001 125 #define OPAL_FL_LOCKING_SUPPORTED 0x00000002 126 #define OPAL_FL_LOCKING_ENABLED 0x00000004 127 #define OPAL_FL_LOCKED 0x00000008 128 #define OPAL_FL_MBR_ENABLED 0x00000010 129 #define OPAL_FL_MBR_DONE 0x00000020 130 #define OPAL_FL_SUM_SUPPORTED 0x00000040 131 struct opal_status { 132 __u32 flags; 133 __u32 reserved; 134 }; 135 struct opal_geometry { 136 __u8 align; 137 __u32 logical_block_size; 138 __u64 alignment_granularity; 139 __u64 lowest_aligned_lba; 140 __u8 __align[3]; 141 }; 142 struct opal_discovery { 143 __u64 data; 144 __u64 size; 145 }; 146 struct opal_revert_lsp { 147 struct opal_key key; 148 __u32 options; 149 __u32 __pad; 150 }; 151 #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) 152 #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) 153 #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) 154 #define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act) 155 #define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw) 156 #define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info) 157 #define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key) 158 #define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup) 159 #define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock) 160 #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) 161 #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) 162 #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) 163 #define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key) 164 #define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done) 165 #define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr) 166 #define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table) 167 #define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status) 168 #define IOC_OPAL_GET_LR_STATUS _IOW('p', 237, struct opal_lr_status) 169 #define IOC_OPAL_GET_GEOMETRY _IOR('p', 238, struct opal_geometry) 170 #define IOC_OPAL_DISCOVERY _IOW('p', 239, struct opal_discovery) 171 #define IOC_OPAL_REVERT_LSP _IOW('p', 240, struct opal_revert_lsp) 172 #endif 173