1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _UAPI_SED_OPAL_H
19#define _UAPI_SED_OPAL_H
20
21#include <linux/types.h>
22
23#define OPAL_KEY_MAX 256
24#define OPAL_MAX_LRS 9
25
26enum opal_mbr {
27 OPAL_MBR_ENABLE = 0x0,
28 OPAL_MBR_DISABLE = 0x01,
29};
30
31enum opal_user {
32 OPAL_ADMIN1 = 0x0,
33 OPAL_USER1 = 0x01,
34 OPAL_USER2 = 0x02,
35 OPAL_USER3 = 0x03,
36 OPAL_USER4 = 0x04,
37 OPAL_USER5 = 0x05,
38 OPAL_USER6 = 0x06,
39 OPAL_USER7 = 0x07,
40 OPAL_USER8 = 0x08,
41 OPAL_USER9 = 0x09,
42};
43
44enum opal_lock_state {
45 OPAL_RO = 0x01,
46 OPAL_RW = 0x02,
47 OPAL_LK = 0x04,
48};
49
50struct opal_key {
51 __u8 lr;
52 __u8 key_len;
53 __u8 __align[6];
54 __u8 key[OPAL_KEY_MAX];
55};
56
57struct opal_lr_act {
58 struct opal_key key;
59 __u32 sum;
60 __u8 num_lrs;
61 __u8 lr[OPAL_MAX_LRS];
62 __u8 align[2];
63};
64
65struct opal_session_info {
66 __u32 sum;
67 __u32 who;
68 struct opal_key opal_key;
69};
70
71struct opal_user_lr_setup {
72 __u64 range_start;
73 __u64 range_length;
74 __u32 RLE;
75 __u32 WLE;
76 struct opal_session_info session;
77};
78
79struct opal_lock_unlock {
80 struct opal_session_info session;
81 __u32 l_state;
82 __u8 __align[4];
83};
84
85struct opal_new_pw {
86 struct opal_session_info session;
87
88
89
90
91
92
93
94
95
96
97 struct opal_session_info new_user_pw;
98};
99
100struct opal_mbr_data {
101 struct opal_key key;
102 __u8 enable_disable;
103 __u8 __align[7];
104};
105
106#define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock)
107#define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock)
108#define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key)
109#define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act)
110#define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw)
111#define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info)
112#define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key)
113#define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup)
114#define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock)
115#define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
116#define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info)
117#define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info)
118
119#endif
120