2 * Copyright © 2016 Intel Corporation
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 #ifndef _UAPI_SED_OPAL_H
19 #define _UAPI_SED_OPAL_H
21 #include <linux/types.h>
23 #define OPAL_KEY_MAX 256
24 #define OPAL_MAX_LRS 9
27 OPAL_MBR_ENABLE = 0x0,
28 OPAL_MBR_DISABLE = 0x01,
44 enum opal_lock_state {
45 OPAL_RO = 0x01, /* 0001 */
46 OPAL_RW = 0x02, /* 0010 */
47 OPAL_LK = 0x04, /* 0100 */
54 __u8 key[OPAL_KEY_MAX];
61 __u8 lr[OPAL_MAX_LRS];
62 __u8 align[2]; /* Align to 8 byte boundary */
65 struct opal_session_info {
68 struct opal_key opal_key;
71 struct opal_user_lr_setup {
74 __u32 RLE; /* Read Lock enabled */
75 __u32 WLE; /* Write Lock Enabled */
76 struct opal_session_info session;
79 struct opal_lock_unlock {
80 struct opal_session_info session;
86 struct opal_session_info session;
88 /* When we're not operating in sum, and we first set
89 * passwords we need to set them via ADMIN authority.
90 * After passwords are changed, we can set them via,
92 * Because of this restriction we need to know about
93 * Two different users. One in 'session' which we will use
94 * to start the session and new_userr_pw as the user we're
97 struct opal_session_info new_user_pw;
100 struct opal_mbr_data {
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)
119 #endif /* _UAPI_SED_OPAL_H */