diff options
| author | Jens Axboe <axboe@fb.com> | 2017-02-17 16:06:45 -0500 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2017-02-17 16:06:45 -0500 |
| commit | 6010720da8aab51f33beee63b73cf88016e9b250 (patch) | |
| tree | a4c5a7f645998e86a1f49cb05f8e0c4e51448294 /include/uapi/linux | |
| parent | 2fe1e8a7b2f4dcac3fcb07ff06b0ae7396201fd6 (diff) | |
| parent | 8a9ae523282f324989850fcf41312b42a2fb9296 (diff) | |
Merge branch 'for-4.11/block' into for-4.11/linus-merge
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/lightnvm.h | 50 | ||||
| -rw-r--r-- | include/uapi/linux/sed-opal.h | 119 |
2 files changed, 169 insertions, 0 deletions
diff --git a/include/uapi/linux/lightnvm.h b/include/uapi/linux/lightnvm.h index 774a43128a7a..fd19f36b3129 100644 --- a/include/uapi/linux/lightnvm.h +++ b/include/uapi/linux/lightnvm.h | |||
| @@ -122,6 +122,44 @@ struct nvm_ioctl_dev_factory { | |||
| 122 | __u32 flags; | 122 | __u32 flags; |
| 123 | }; | 123 | }; |
| 124 | 124 | ||
| 125 | struct nvm_user_vio { | ||
| 126 | __u8 opcode; | ||
| 127 | __u8 flags; | ||
| 128 | __u16 control; | ||
| 129 | __u16 nppas; | ||
| 130 | __u16 rsvd; | ||
| 131 | __u64 metadata; | ||
| 132 | __u64 addr; | ||
| 133 | __u64 ppa_list; | ||
| 134 | __u32 metadata_len; | ||
| 135 | __u32 data_len; | ||
| 136 | __u64 status; | ||
| 137 | __u32 result; | ||
| 138 | __u32 rsvd3[3]; | ||
| 139 | }; | ||
| 140 | |||
| 141 | struct nvm_passthru_vio { | ||
| 142 | __u8 opcode; | ||
| 143 | __u8 flags; | ||
| 144 | __u8 rsvd[2]; | ||
| 145 | __u32 nsid; | ||
| 146 | __u32 cdw2; | ||
| 147 | __u32 cdw3; | ||
| 148 | __u64 metadata; | ||
| 149 | __u64 addr; | ||
| 150 | __u32 metadata_len; | ||
| 151 | __u32 data_len; | ||
| 152 | __u64 ppa_list; | ||
| 153 | __u16 nppas; | ||
| 154 | __u16 control; | ||
| 155 | __u32 cdw13; | ||
| 156 | __u32 cdw14; | ||
| 157 | __u32 cdw15; | ||
| 158 | __u64 status; | ||
| 159 | __u32 result; | ||
| 160 | __u32 timeout_ms; | ||
| 161 | }; | ||
| 162 | |||
| 125 | /* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ | 163 | /* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ |
| 126 | enum { | 164 | enum { |
| 127 | /* top level cmds */ | 165 | /* top level cmds */ |
| @@ -137,6 +175,11 @@ enum { | |||
| 137 | 175 | ||
| 138 | /* Factory reset device */ | 176 | /* Factory reset device */ |
| 139 | NVM_DEV_FACTORY_CMD, | 177 | NVM_DEV_FACTORY_CMD, |
| 178 | |||
| 179 | /* Vector user I/O */ | ||
| 180 | NVM_DEV_VIO_ADMIN_CMD = 0x41, | ||
| 181 | NVM_DEV_VIO_CMD = 0x42, | ||
| 182 | NVM_DEV_VIO_USER_CMD = 0x43, | ||
| 140 | }; | 183 | }; |
| 141 | 184 | ||
| 142 | #define NVM_IOCTL 'L' /* 0x4c */ | 185 | #define NVM_IOCTL 'L' /* 0x4c */ |
| @@ -154,6 +197,13 @@ enum { | |||
| 154 | #define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ | 197 | #define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ |
| 155 | struct nvm_ioctl_dev_factory) | 198 | struct nvm_ioctl_dev_factory) |
| 156 | 199 | ||
| 200 | #define NVME_NVM_IOCTL_IO_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_USER_CMD, \ | ||
| 201 | struct nvm_passthru_vio) | ||
| 202 | #define NVME_NVM_IOCTL_ADMIN_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_ADMIN_CMD,\ | ||
| 203 | struct nvm_passthru_vio) | ||
| 204 | #define NVME_NVM_IOCTL_SUBMIT_VIO _IOWR(NVM_IOCTL, NVM_DEV_VIO_CMD,\ | ||
| 205 | struct nvm_user_vio) | ||
| 206 | |||
| 157 | #define NVM_VERSION_MAJOR 1 | 207 | #define NVM_VERSION_MAJOR 1 |
| 158 | #define NVM_VERSION_MINOR 0 | 208 | #define NVM_VERSION_MINOR 0 |
| 159 | #define NVM_VERSION_PATCHLEVEL 0 | 209 | #define NVM_VERSION_PATCHLEVEL 0 |
diff --git a/include/uapi/linux/sed-opal.h b/include/uapi/linux/sed-opal.h new file mode 100644 index 000000000000..c72e0735532d --- /dev/null +++ b/include/uapi/linux/sed-opal.h | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | /* | ||
| 2 | * Copyright © 2016 Intel Corporation | ||
| 3 | * | ||
| 4 | * Authors: | ||
| 5 | * Rafael Antognolli <rafael.antognolli@intel.com> | ||
| 6 | * Scott Bauer <scott.bauer@intel.com> | ||
| 7 | * | ||
| 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. | ||
| 11 | * | ||
| 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 | ||
| 15 | * more details. | ||
| 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 | |||
| 26 | enum opal_mbr { | ||
| 27 | OPAL_MBR_ENABLE = 0x0, | ||
| 28 | OPAL_MBR_DISABLE = 0x01, | ||
| 29 | }; | ||
| 30 | |||
| 31 | enum 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 | |||
| 44 | enum opal_lock_state { | ||
| 45 | OPAL_RO = 0x01, /* 0001 */ | ||
| 46 | OPAL_RW = 0x02, /* 0010 */ | ||
| 47 | OPAL_LK = 0x04, /* 0100 */ | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct opal_key { | ||
| 51 | __u8 lr; | ||
| 52 | __u8 key_len; | ||
| 53 | __u8 __align[6]; | ||
| 54 | __u8 key[OPAL_KEY_MAX]; | ||
| 55 | }; | ||
| 56 | |||
| 57 | struct 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]; /* Align to 8 byte boundary */ | ||
| 63 | }; | ||
| 64 | |||
| 65 | struct opal_session_info { | ||
| 66 | __u32 sum; | ||
| 67 | __u32 who; | ||
| 68 | struct opal_key opal_key; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct opal_user_lr_setup { | ||
| 72 | __u64 range_start; | ||
| 73 | __u64 range_length; | ||
| 74 | __u32 RLE; /* Read Lock enabled */ | ||
| 75 | __u32 WLE; /* Write Lock Enabled */ | ||
| 76 | struct opal_session_info session; | ||
| 77 | }; | ||
| 78 | |||
| 79 | struct opal_lock_unlock { | ||
| 80 | struct opal_session_info session; | ||
| 81 | __u32 l_state; | ||
| 82 | __u8 __align[4]; | ||
| 83 | }; | ||
| 84 | |||
| 85 | struct opal_new_pw { | ||
| 86 | struct opal_session_info session; | ||
| 87 | |||
| 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, | ||
| 91 | * User authorities. | ||
| 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 | ||
| 95 | * chaning the pw for. | ||
| 96 | */ | ||
| 97 | struct opal_session_info new_user_pw; | ||
| 98 | }; | ||
| 99 | |||
| 100 | struct 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 /* _UAPI_SED_OPAL_H */ | ||
