blob: 6274edef6cbb9e70839e2ada53f145d70cb715ce [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 */
Christopher Ferris525ce912017-07-26 13:12:53 -07007#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
12enum opal_mbr {
13 OPAL_MBR_ENABLE = 0x0,
14 OPAL_MBR_DISABLE = 0x01,
15};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070016enum opal_mbr_done_flag {
17 OPAL_MBR_NOT_DONE = 0x0,
18 OPAL_MBR_DONE = 0x01
19};
Christopher Ferris525ce912017-07-26 13:12:53 -070020enum 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};
32enum opal_lock_state {
33 OPAL_RO = 0x01,
34 OPAL_RW = 0x02,
35 OPAL_LK = 0x04,
36};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080037enum opal_lock_flags {
38 OPAL_SAVE_FOR_LOCK = 0x01,
39};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070040enum opal_key_type {
41 OPAL_INCLUDED = 0,
42 OPAL_KEYRING,
43};
Christopher Ferris525ce912017-07-26 13:12:53 -070044struct opal_key {
45 __u8 lr;
46 __u8 key_len;
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070047 __u8 key_type;
48 __u8 __align[5];
Christopher Ferris525ce912017-07-26 13:12:53 -070049 __u8 key[OPAL_KEY_MAX];
50};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -070051enum opal_revert_lsp_opts {
52 OPAL_PRESERVE = 0x01,
53};
Christopher Ferris525ce912017-07-26 13:12:53 -070054struct 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};
61struct opal_session_info {
62 __u32 sum;
63 __u32 who;
64 struct opal_key opal_key;
65};
66struct 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};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070073struct 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};
Christopher Ferris525ce912017-07-26 13:12:53 -070082struct opal_lock_unlock {
83 struct opal_session_info session;
84 __u32 l_state;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080085 __u16 flags;
86 __u8 __align[2];
Christopher Ferris525ce912017-07-26 13:12:53 -070087};
88struct opal_new_pw {
89 struct opal_session_info session;
90 struct opal_session_info new_user_pw;
91};
92struct opal_mbr_data {
93 struct opal_key key;
94 __u8 enable_disable;
95 __u8 __align[7];
96};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070097struct opal_mbr_done {
98 struct opal_key key;
99 __u8 done_flag;
100 __u8 __align[7];
101};
102struct opal_shadow_mbr {
103 struct opal_key key;
104 const __u64 data;
105 __u64 offset;
106 __u64 size;
107};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800108enum opal_table_ops {
109 OPAL_READ_TABLE,
110 OPAL_WRITE_TABLE,
111};
112#define OPAL_UID_LENGTH 8
113struct 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};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000124#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
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000130#define OPAL_FL_SUM_SUPPORTED 0x00000040
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000131struct opal_status {
132 __u32 flags;
133 __u32 reserved;
134};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700135struct opal_geometry {
136 __u8 align;
137 __u32 logical_block_size;
138 __u64 alignment_granularity;
139 __u64 lowest_aligned_lba;
140 __u8 __align[3];
141};
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700142struct opal_discovery {
143 __u64 data;
144 __u64 size;
145};
146struct opal_revert_lsp {
147 struct opal_key key;
148 __u32 options;
149 __u32 __pad;
150};
Christopher Ferris525ce912017-07-26 13:12:53 -0700151#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)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700163#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)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800166#define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000167#define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700168#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)
Christopher Ferris67d1e5e2023-10-31 13:36:37 -0700170#define IOC_OPAL_DISCOVERY _IOW('p', 239, struct opal_discovery)
171#define IOC_OPAL_REVERT_LSP _IOW('p', 240, struct opal_revert_lsp)
Christopher Ferris525ce912017-07-26 13:12:53 -0700172#endif