Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | **************************************************************************** |
| 3 | *** |
| 4 | *** This header was automatically generated from a Linux kernel header |
| 5 | *** of the same name, to make information necessary for userspace to |
| 6 | *** call into the kernel available to libc. It contains only constants, |
| 7 | *** structures, and macros generated from the original header, and thus, |
| 8 | *** contains no copyrightable information. |
| 9 | *** |
| 10 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _UAPI_SED_OPAL_H |
| 20 | #define _UAPI_SED_OPAL_H |
| 21 | #include <linux/types.h> |
| 22 | #define OPAL_KEY_MAX 256 |
| 23 | #define OPAL_MAX_LRS 9 |
| 24 | enum opal_mbr { |
| 25 | OPAL_MBR_ENABLE = 0x0, |
| 26 | OPAL_MBR_DISABLE = 0x01, |
| 27 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 28 | enum opal_mbr_done_flag { |
| 29 | OPAL_MBR_NOT_DONE = 0x0, |
| 30 | OPAL_MBR_DONE = 0x01 |
| 31 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 32 | enum opal_user { |
| 33 | OPAL_ADMIN1 = 0x0, |
| 34 | OPAL_USER1 = 0x01, |
| 35 | OPAL_USER2 = 0x02, |
| 36 | OPAL_USER3 = 0x03, |
| 37 | OPAL_USER4 = 0x04, |
| 38 | OPAL_USER5 = 0x05, |
| 39 | OPAL_USER6 = 0x06, |
| 40 | OPAL_USER7 = 0x07, |
| 41 | OPAL_USER8 = 0x08, |
| 42 | OPAL_USER9 = 0x09, |
| 43 | }; |
| 44 | enum opal_lock_state { |
| 45 | OPAL_RO = 0x01, |
| 46 | OPAL_RW = 0x02, |
| 47 | OPAL_LK = 0x04, |
| 48 | }; |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 49 | enum opal_lock_flags { |
| 50 | OPAL_SAVE_FOR_LOCK = 0x01, |
| 51 | }; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 52 | enum opal_key_type { |
| 53 | OPAL_INCLUDED = 0, |
| 54 | OPAL_KEYRING, |
| 55 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 56 | struct opal_key { |
| 57 | __u8 lr; |
| 58 | __u8 key_len; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 59 | __u8 key_type; |
| 60 | __u8 __align[5]; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 61 | __u8 key[OPAL_KEY_MAX]; |
| 62 | }; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 63 | enum opal_revert_lsp_opts { |
| 64 | OPAL_PRESERVE = 0x01, |
| 65 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 66 | struct opal_lr_act { |
| 67 | struct opal_key key; |
| 68 | __u32 sum; |
| 69 | __u8 num_lrs; |
| 70 | __u8 lr[OPAL_MAX_LRS]; |
| 71 | __u8 align[2]; |
| 72 | }; |
| 73 | struct opal_session_info { |
| 74 | __u32 sum; |
| 75 | __u32 who; |
| 76 | struct opal_key opal_key; |
| 77 | }; |
| 78 | struct opal_user_lr_setup { |
| 79 | __u64 range_start; |
| 80 | __u64 range_length; |
| 81 | __u32 RLE; |
| 82 | __u32 WLE; |
| 83 | struct opal_session_info session; |
| 84 | }; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 85 | struct opal_lr_status { |
| 86 | struct opal_session_info session; |
| 87 | __u64 range_start; |
| 88 | __u64 range_length; |
| 89 | __u32 RLE; |
| 90 | __u32 WLE; |
| 91 | __u32 l_state; |
| 92 | __u8 align[4]; |
| 93 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 94 | struct opal_lock_unlock { |
| 95 | struct opal_session_info session; |
| 96 | __u32 l_state; |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 97 | __u16 flags; |
| 98 | __u8 __align[2]; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 99 | }; |
| 100 | struct opal_new_pw { |
| 101 | struct opal_session_info session; |
| 102 | struct opal_session_info new_user_pw; |
| 103 | }; |
| 104 | struct opal_mbr_data { |
| 105 | struct opal_key key; |
| 106 | __u8 enable_disable; |
| 107 | __u8 __align[7]; |
| 108 | }; |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 109 | struct opal_mbr_done { |
| 110 | struct opal_key key; |
| 111 | __u8 done_flag; |
| 112 | __u8 __align[7]; |
| 113 | }; |
| 114 | struct opal_shadow_mbr { |
| 115 | struct opal_key key; |
| 116 | const __u64 data; |
| 117 | __u64 offset; |
| 118 | __u64 size; |
| 119 | }; |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 120 | enum opal_table_ops { |
| 121 | OPAL_READ_TABLE, |
| 122 | OPAL_WRITE_TABLE, |
| 123 | }; |
| 124 | #define OPAL_UID_LENGTH 8 |
| 125 | struct opal_read_write_table { |
| 126 | struct opal_key key; |
| 127 | const __u64 data; |
| 128 | const __u8 table_uid[OPAL_UID_LENGTH]; |
| 129 | __u64 offset; |
| 130 | __u64 size; |
| 131 | #define OPAL_TABLE_READ (1 << OPAL_READ_TABLE) |
| 132 | #define OPAL_TABLE_WRITE (1 << OPAL_WRITE_TABLE) |
| 133 | __u64 flags; |
| 134 | __u64 priv; |
| 135 | }; |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 136 | #define OPAL_FL_SUPPORTED 0x00000001 |
| 137 | #define OPAL_FL_LOCKING_SUPPORTED 0x00000002 |
| 138 | #define OPAL_FL_LOCKING_ENABLED 0x00000004 |
| 139 | #define OPAL_FL_LOCKED 0x00000008 |
| 140 | #define OPAL_FL_MBR_ENABLED 0x00000010 |
| 141 | #define OPAL_FL_MBR_DONE 0x00000020 |
Christopher Ferris | b7cef6d | 2023-05-09 19:04:15 +0000 | [diff] [blame] | 142 | #define OPAL_FL_SUM_SUPPORTED 0x00000040 |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 143 | struct opal_status { |
| 144 | __u32 flags; |
| 145 | __u32 reserved; |
| 146 | }; |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 147 | struct opal_geometry { |
| 148 | __u8 align; |
| 149 | __u32 logical_block_size; |
| 150 | __u64 alignment_granularity; |
| 151 | __u64 lowest_aligned_lba; |
| 152 | __u8 __align[3]; |
| 153 | }; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 154 | struct opal_discovery { |
| 155 | __u64 data; |
| 156 | __u64 size; |
| 157 | }; |
| 158 | struct opal_revert_lsp { |
| 159 | struct opal_key key; |
| 160 | __u32 options; |
| 161 | __u32 __pad; |
| 162 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 163 | #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) |
| 164 | #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) |
| 165 | #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) |
| 166 | #define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act) |
| 167 | #define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw) |
| 168 | #define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info) |
| 169 | #define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key) |
| 170 | #define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup) |
| 171 | #define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock) |
| 172 | #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) |
| 173 | #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) |
| 174 | #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) |
Christopher Ferris | b8a95e2 | 2019-10-02 18:29:20 -0700 | [diff] [blame] | 175 | #define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key) |
| 176 | #define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done) |
| 177 | #define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr) |
Christopher Ferris | d32ca14 | 2020-02-04 16:16:51 -0800 | [diff] [blame] | 178 | #define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table) |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 179 | #define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status) |
Christopher Ferris | 37c3f3c | 2023-07-10 10:59:05 -0700 | [diff] [blame] | 180 | #define IOC_OPAL_GET_LR_STATUS _IOW('p', 237, struct opal_lr_status) |
| 181 | #define IOC_OPAL_GET_GEOMETRY _IOR('p', 238, struct opal_geometry) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 182 | #define IOC_OPAL_DISCOVERY _IOW('p', 239, struct opal_discovery) |
| 183 | #define IOC_OPAL_REVERT_LSP _IOW('p', 240, struct opal_revert_lsp) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 184 | #endif |