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
24enum opal_mbr {
25  OPAL_MBR_ENABLE = 0x0,
26  OPAL_MBR_DISABLE = 0x01,
27};
28enum opal_user {
29  OPAL_ADMIN1 = 0x0,
30  OPAL_USER1 = 0x01,
31  OPAL_USER2 = 0x02,
32  OPAL_USER3 = 0x03,
33  OPAL_USER4 = 0x04,
34  OPAL_USER5 = 0x05,
35  OPAL_USER6 = 0x06,
36  OPAL_USER7 = 0x07,
37  OPAL_USER8 = 0x08,
38  OPAL_USER9 = 0x09,
39};
40enum opal_lock_state {
41  OPAL_RO = 0x01,
42  OPAL_RW = 0x02,
43  OPAL_LK = 0x04,
44};
45struct opal_key {
46  __u8 lr;
47  __u8 key_len;
48  __u8 __align[6];
49  __u8 key[OPAL_KEY_MAX];
50};
51struct opal_lr_act {
52  struct opal_key key;
53  __u32 sum;
54  __u8 num_lrs;
55  __u8 lr[OPAL_MAX_LRS];
56  __u8 align[2];
57};
58struct opal_session_info {
59  __u32 sum;
60  __u32 who;
61  struct opal_key opal_key;
62};
63struct opal_user_lr_setup {
64  __u64 range_start;
65  __u64 range_length;
66  __u32 RLE;
67  __u32 WLE;
68  struct opal_session_info session;
69};
70struct opal_lock_unlock {
71  struct opal_session_info session;
72  __u32 l_state;
73  __u8 __align[4];
74};
75struct opal_new_pw {
76  struct opal_session_info session;
77  struct opal_session_info new_user_pw;
78};
79struct opal_mbr_data {
80  struct opal_key key;
81  __u8 enable_disable;
82  __u8 __align[7];
83};
84#define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
85#define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
86#define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
87#define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act)
88#define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw)
89#define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info)
90#define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key)
91#define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup)
92#define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock)
93#define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
94#define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
95#define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
96#endif
97