]>
Commit | Line | Data |
---|---|---|
e2be04c7 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
19641f2d SB |
2 | /* |
3 | * Copyright © 2016 Intel Corporation | |
4 | * | |
5 | * Authors: | |
6 | * Rafael Antognolli <rafael.antognolli@intel.com> | |
7 | * Scott Bauer <scott.bauer@intel.com> | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify it | |
10 | * under the terms and conditions of the GNU General Public License, | |
11 | * version 2, as published by the Free Software Foundation. | |
12 | * | |
13 | * This program is distributed in the hope it will be useful, but WITHOUT | |
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
16 | * more details. | |
17 | */ | |
18 | ||
19 | #ifndef _UAPI_SED_OPAL_H | |
20 | #define _UAPI_SED_OPAL_H | |
21 | ||
22 | #include <linux/types.h> | |
23 | ||
24 | #define OPAL_KEY_MAX 256 | |
25 | #define OPAL_MAX_LRS 9 | |
26 | ||
27 | enum opal_mbr { | |
28 | OPAL_MBR_ENABLE = 0x0, | |
29 | OPAL_MBR_DISABLE = 0x01, | |
30 | }; | |
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 | ||
45 | enum opal_lock_state { | |
46 | OPAL_RO = 0x01, /* 0001 */ | |
47 | OPAL_RW = 0x02, /* 0010 */ | |
48 | OPAL_LK = 0x04, /* 0100 */ | |
49 | }; | |
50 | ||
51 | struct opal_key { | |
8c87fe72 SB |
52 | __u8 lr; |
53 | __u8 key_len; | |
54 | __u8 __align[6]; | |
55 | __u8 key[OPAL_KEY_MAX]; | |
19641f2d SB |
56 | }; |
57 | ||
58 | struct opal_lr_act { | |
19641f2d | 59 | struct opal_key key; |
8c87fe72 SB |
60 | __u32 sum; |
61 | __u8 num_lrs; | |
62 | __u8 lr[OPAL_MAX_LRS]; | |
63 | __u8 align[2]; /* Align to 8 byte boundary */ | |
19641f2d SB |
64 | }; |
65 | ||
66 | struct opal_session_info { | |
8c87fe72 SB |
67 | __u32 sum; |
68 | __u32 who; | |
19641f2d | 69 | struct opal_key opal_key; |
19641f2d SB |
70 | }; |
71 | ||
72 | struct opal_user_lr_setup { | |
8c87fe72 SB |
73 | __u64 range_start; |
74 | __u64 range_length; | |
75 | __u32 RLE; /* Read Lock enabled */ | |
76 | __u32 WLE; /* Write Lock Enabled */ | |
19641f2d | 77 | struct opal_session_info session; |
19641f2d SB |
78 | }; |
79 | ||
80 | struct opal_lock_unlock { | |
19641f2d | 81 | struct opal_session_info session; |
8c87fe72 SB |
82 | __u32 l_state; |
83 | __u8 __align[4]; | |
19641f2d SB |
84 | }; |
85 | ||
86 | struct opal_new_pw { | |
87 | struct opal_session_info session; | |
88 | ||
89 | /* When we're not operating in sum, and we first set | |
90 | * passwords we need to set them via ADMIN authority. | |
91 | * After passwords are changed, we can set them via, | |
92 | * User authorities. | |
93 | * Because of this restriction we need to know about | |
94 | * Two different users. One in 'session' which we will use | |
95 | * to start the session and new_userr_pw as the user we're | |
96 | * chaning the pw for. | |
97 | */ | |
98 | struct opal_session_info new_user_pw; | |
99 | }; | |
100 | ||
101 | struct opal_mbr_data { | |
19641f2d | 102 | struct opal_key key; |
8c87fe72 SB |
103 | __u8 enable_disable; |
104 | __u8 __align[7]; | |
19641f2d SB |
105 | }; |
106 | ||
107 | #define IOC_OPAL_SAVE _IOW('p', 220, struct opal_lock_unlock) | |
108 | #define IOC_OPAL_LOCK_UNLOCK _IOW('p', 221, struct opal_lock_unlock) | |
109 | #define IOC_OPAL_TAKE_OWNERSHIP _IOW('p', 222, struct opal_key) | |
24bff4d7 | 110 | #define IOC_OPAL_ACTIVATE_LSP _IOW('p', 223, struct opal_lr_act) |
19641f2d SB |
111 | #define IOC_OPAL_SET_PW _IOW('p', 224, struct opal_new_pw) |
112 | #define IOC_OPAL_ACTIVATE_USR _IOW('p', 225, struct opal_session_info) | |
113 | #define IOC_OPAL_REVERT_TPR _IOW('p', 226, struct opal_key) | |
114 | #define IOC_OPAL_LR_SETUP _IOW('p', 227, struct opal_user_lr_setup) | |
115 | #define IOC_OPAL_ADD_USR_TO_LR _IOW('p', 228, struct opal_lock_unlock) | |
116 | #define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data) | |
117 | #define IOC_OPAL_ERASE_LR _IOW('p', 230, struct opal_session_info) | |
118 | #define IOC_OPAL_SECURE_ERASE_LR _IOW('p', 231, struct opal_session_info) | |
119 | ||
120 | #endif /* _UAPI_SED_OPAL_H */ |