blob: 4685bb3b4230e77162db9fa1cc304c38fc23deff [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};
77struct opal_lock_unlock {
78 struct opal_session_info session;
79 __u32 l_state;
Christopher Ferris8b7fdc92023-02-21 13:36:32 -080080 __u16 flags;
81 __u8 __align[2];
Christopher Ferris525ce912017-07-26 13:12:53 -070082};
83struct opal_new_pw {
84 struct opal_session_info session;
85 struct opal_session_info new_user_pw;
86};
87struct opal_mbr_data {
88 struct opal_key key;
89 __u8 enable_disable;
90 __u8 __align[7];
91};
Christopher Ferrisb8a95e22019-10-02 18:29:20 -070092struct opal_mbr_done {
93 struct opal_key key;
94 __u8 done_flag;
95 __u8 __align[7];
96};
97struct opal_shadow_mbr {
98 struct opal_key key;
99 const __u64 data;
100 __u64 offset;
101 __u64 size;
102};
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800103enum opal_table_ops {
104 OPAL_READ_TABLE,
105 OPAL_WRITE_TABLE,
106};
107#define OPAL_UID_LENGTH 8
108struct opal_read_write_table {
109 struct opal_key key;
110 const __u64 data;
111 const __u8 table_uid[OPAL_UID_LENGTH];
112 __u64 offset;
113 __u64 size;
114#define OPAL_TABLE_READ (1 << OPAL_READ_TABLE)
115#define OPAL_TABLE_WRITE (1 << OPAL_WRITE_TABLE)
116 __u64 flags;
117 __u64 priv;
118};
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000119#define OPAL_FL_SUPPORTED 0x00000001
120#define OPAL_FL_LOCKING_SUPPORTED 0x00000002
121#define OPAL_FL_LOCKING_ENABLED 0x00000004
122#define OPAL_FL_LOCKED 0x00000008
123#define OPAL_FL_MBR_ENABLED 0x00000010
124#define OPAL_FL_MBR_DONE 0x00000020
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000125#define OPAL_FL_SUM_SUPPORTED 0x00000040
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000126struct opal_status {
127 __u32 flags;
128 __u32 reserved;
129};
Christopher Ferris525ce912017-07-26 13:12:53 -0700130#define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
131#define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
132#define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
133#define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act)
134#define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw)
135#define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info)
136#define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key)
137#define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup)
138#define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock)
139#define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
140#define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
141#define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
Christopher Ferrisb8a95e22019-10-02 18:29:20 -0700142#define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key)
143#define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done)
144#define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr)
Christopher Ferrisd32ca142020-02-04 16:16:51 -0800145#define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000146#define IOC_OPAL_GET_STATUS _IOR('p', 236, struct opal_status)
Christopher Ferris525ce912017-07-26 13:12:53 -0700147#endif