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 };
28 enum opal_mbr_done_flag {
29   OPAL_MBR_NOT_DONE = 0x0,
30   OPAL_MBR_DONE = 0x01
31 };
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 };
49 struct opal_key {
50   __u8 lr;
51   __u8 key_len;
52   __u8 __align[6];
53   __u8 key[OPAL_KEY_MAX];
54 };
55 struct opal_lr_act {
56   struct opal_key key;
57   __u32 sum;
58   __u8 num_lrs;
59   __u8 lr[OPAL_MAX_LRS];
60   __u8 align[2];
61 };
62 struct opal_session_info {
63   __u32 sum;
64   __u32 who;
65   struct opal_key opal_key;
66 };
67 struct opal_user_lr_setup {
68   __u64 range_start;
69   __u64 range_length;
70   __u32 RLE;
71   __u32 WLE;
72   struct opal_session_info session;
73 };
74 struct opal_lock_unlock {
75   struct opal_session_info session;
76   __u32 l_state;
77   __u8 __align[4];
78 };
79 struct opal_new_pw {
80   struct opal_session_info session;
81   struct opal_session_info new_user_pw;
82 };
83 struct opal_mbr_data {
84   struct opal_key key;
85   __u8 enable_disable;
86   __u8 __align[7];
87 };
88 struct opal_mbr_done {
89   struct opal_key key;
90   __u8 done_flag;
91   __u8 __align[7];
92 };
93 struct opal_shadow_mbr {
94   struct opal_key key;
95   const __u64 data;
96   __u64 offset;
97   __u64 size;
98 };
99 enum opal_table_ops {
100   OPAL_READ_TABLE,
101   OPAL_WRITE_TABLE,
102 };
103 #define OPAL_UID_LENGTH 8
104 struct opal_read_write_table {
105   struct opal_key key;
106   const __u64 data;
107   const __u8 table_uid[OPAL_UID_LENGTH];
108   __u64 offset;
109   __u64 size;
110 #define OPAL_TABLE_READ (1 << OPAL_READ_TABLE)
111 #define OPAL_TABLE_WRITE (1 << OPAL_WRITE_TABLE)
112   __u64 flags;
113   __u64 priv;
114 };
115 #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
116 #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
117 #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
118 #define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act)
119 #define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw)
120 #define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info)
121 #define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key)
122 #define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup)
123 #define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock)
124 #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
125 #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
126 #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
127 #define IOC_OPAL_PSID_REVERT_TPR _IOW('p', 232, struct opal_key)
128 #define IOC_OPAL_MBR_DONE _IOW('p', 233, struct opal_mbr_done)
129 #define IOC_OPAL_WRITE_SHADOW_MBR _IOW('p', 234, struct opal_shadow_mbr)
130 #define IOC_OPAL_GENERIC_TABLE_RW _IOW('p', 235, struct opal_read_write_table)
131 #endif
132