blob: fa1d7edd370ed30b18e4d4356b2d242cd233659a [file] [log] [blame]
Christopher Ferris525ce912017-07-26 13:12:53 -07001/****************************************************************************
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
24enum opal_mbr {
25 OPAL_MBR_ENABLE = 0x0,
26 OPAL_MBR_DISABLE = 0x01,
27};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070028enum opal_mbr_done_flag {
29 OPAL_MBR_NOT_DONE = 0x0,
30 OPAL_MBR_DONE = 0x01
31};
Christopher Ferris525ce912017-07-26 13:12:53 -070032enum 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};
44enum opal_lock_state {
45 OPAL_RO = 0x01,
46 OPAL_RW = 0x02,
47 OPAL_LK = 0x04,
48};
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080049enum opal_lock_flags {
50 OPAL_SAVE_FOR_LOCK = 0x01,
51};
Christopher Ferris525ce912017-07-26 13:12:53 -070052struct opal_key {
53 __u8 lr;
54 __u8 key_len;
55 __u8 __align[6];
56 __u8 key[OPAL_KEY_MAX];
57};
58struct opal_lr_act {
59 struct opal_key key;
60 __u32 sum;
61 __u8 num_lrs;
62 __u8 lr[OPAL_MAX_LRS];
63 __u8 align[2];
64};
65struct opal_session_info {
66 __u32 sum;
67 __u32 who;
68 struct opal_key opal_key;
69};
70struct opal_user_lr_setup {
71 __u64 range_start;
72 __u64 range_length;
73 __u32 RLE;
74 __u32 WLE;
75 struct opal_session_info session;
76};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -070077struct opal_lr_status {
78 struct opal_session_info session;
79 __u64 range_start;
80 __u64 range_length;
81 __u32 RLE;
82 __u32 WLE;
83 __u32 l_state;
84 __u8 align[4];
85};
Christopher Ferris525ce912017-07-26 13:12:53 -070086struct opal_lock_unlock {
87 struct opal_session_info session;
88 __u32 l_state;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080089 __u16 flags;
90 __u8 __align[2];
Christopher Ferris525ce912017-07-26 13:12:53 -070091};
92struct opal_new_pw {
93 struct opal_session_info session;
94 struct opal_session_info new_user_pw;
95};
96struct opal_mbr_data {
97 struct opal_key key;
98 __u8 enable_disable;
99 __u8 __align[7];
100};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700101struct opal_mbr_done {
102 struct opal_key key;
103 __u8 done_flag;
104 __u8 __align[7];
105};
106struct opal_shadow_mbr {
107 struct opal_key key;
108 const __u64 data;
109 __u64 offset;
110 __u64 size;
111};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800112enum opal_table_ops {
113 OPAL_READ_TABLE,
114 OPAL_WRITE_TABLE,
115};
116#define OPAL_UID_LENGTH 8
117struct opal_read_write_table {
118 struct opal_key key;
119 const __u64 data;
120 const __u8 table_uid[OPAL_UID_LENGTH];
121 __u64 offset;
122 __u64 size;
123#define OPAL_TABLE_READ (1 << OPAL_READ_TABLE)
124#define OPAL_TABLE_WRITE (1 << OPAL_WRITE_TABLE)
125 __u64 flags;
126 __u64 priv;
127};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000128#define OPAL_FL_SUPPORTED 0x00000001
129#define OPAL_FL_LOCKING_SUPPORTED 0x00000002
130#define OPAL_FL_LOCKING_ENABLED 0x00000004
131#define OPAL_FL_LOCKED 0x00000008
132#define OPAL_FL_MBR_ENABLED 0x00000010
133#define OPAL_FL_MBR_DONE 0x00000020
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000134#define OPAL_FL_SUM_SUPPORTED 0x00000040
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000135struct opal_status {
136 __u32 flags;
137 __u32 reserved;
138};
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700139struct opal_geometry {
140 __u8 align;
141 __u32 logical_block_size;
142 __u64 alignment_granularity;
143 __u64 lowest_aligned_lba;
144 __u8 __align[3];
145};
Christopher Ferris525ce912017-07-26 13:12:53 -0700146#define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
147#define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
148#define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
149#define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act)
150#define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw)
151#define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info)
152#define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key)
153#define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup)
154#define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock)
155#define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
156#define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
157#define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700158#define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key)
159#define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done)
160#define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800161#define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000162#define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status)
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700163#define IOC_OPAL_GET_LR_STATUS _IOW('p', 237, struct opal_lr_status)
164#define IOC_OPAL_GET_GEOMETRY _IOR('p', 238, struct opal_geometry)
Christopher Ferris525ce912017-07-26 13:12:53 -0700165#endif