Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: scott.bauer@intel.com (Scott Bauer)
Subject: [PATCH v4 1/6] Include: Uapi: Add user ABI for Sed/Opal
Date: Thu, 29 Dec 2016 12:26:50 -0700	[thread overview]
Message-ID: <1483039615-22407-2-git-send-email-scott.bauer@intel.com> (raw)
In-Reply-To: <1483039615-22407-1-git-send-email-scott.bauer@intel.com>

Signed-off-by: Scott Bauer <scott.bauer at intel.com>
Signed-off-by: Rafael Antognolli <Rafael.Antognolli at intel.com>
---
 include/uapi/linux/sed-opal.h | 107 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 include/uapi/linux/sed-opal.h

diff --git a/include/uapi/linux/sed-opal.h b/include/uapi/linux/sed-opal.h
new file mode 100644
index 0000000..c06077a
--- /dev/null
+++ b/include/uapi/linux/sed-opal.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright ? 2016 Intel Corporation
+ *
+ * Authors:
+ *    Rafael Antognolli <rafael.antognolli at intel.com>
+ *    Scott  Bauer      <scott.bauer at intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef _UAPI_SED_OPAL_H
+#define _UAPI_SED_OPAL_H
+
+#include <linux/types.h>
+
+#define OPAL_KEY_MAX 256
+
+enum opal_mbr {
+	OPAL_MBR_ENABLE,
+	OPAL_MBR_DISABLE,
+};
+
+enum opal_user {
+	OPAL_ADMIN1,
+	OPAL_USER1,
+	OPAL_USER2,
+	OPAL_USER3,
+	OPAL_USER4,
+	OPAL_USER5,
+	OPAL_USER6,
+	OPAL_USER7,
+	OPAL_USER8,
+	OPAL_USER9,
+};
+
+enum opal_lock_state {
+	OPAL_RO = 0x01, /* 0001 */
+	OPAL_RW = 0x02, /* 0010 */
+	OPAL_LK = 0x04, /* 0100 */
+};
+
+struct opal_key {
+	uint8_t	lr;
+	uint8_t	key_len;
+	char 	key[OPAL_KEY_MAX];
+};
+
+struct opal_session_info {
+	int sum;
+	struct opal_key opal_key;
+	enum opal_user who;
+};
+
+struct opal_user_lr_setup {
+	struct opal_session_info session;
+	size_t range_start;
+	size_t range_length;
+	int    RLE; /* Read Lock enabled */
+	int    WLE; /* Write Lock Enabled */
+};
+
+struct opal_lock_unlock {
+	struct opal_session_info session;
+	enum opal_lock_state l_state;
+};
+
+struct opal_new_pw {
+	struct opal_session_info session;
+
+	/* When we're not operating in sum, and we first set
+	 * passwords we need to set them via ADMIN authority.
+	 * After passwords are changed, we can set them via,
+	 * User authorities.
+	 * Because of this restriction we need to know about
+	 * Two different users. One in 'session' which we will use
+	 * to start the session and new_userr_pw as the user we're
+	 * chaning the pw for.
+	 */
+	struct opal_session_info new_user_pw;
+};
+
+struct opal_mbr_data {
+	u8 enable_disable;
+	struct opal_key key;
+};
+
+#define IOC_OPAL_SAVE		    _IOW('p', 220, struct opal_lock_unlock)
+#define IOC_OPAL_LOCK_UNLOCK	    _IOW('p', 221, struct opal_lock_unlock)
+#define IOC_OPAL_TAKE_OWNERSHIP	    _IOW('p', 222, struct opal_key)
+#define IOC_OPAL_ACTIVATE_LSP       _IOW('p', 223, struct opal_key)
+#define IOC_OPAL_SET_PW             _IOW('p', 224, struct opal_new_pw)
+#define IOC_OPAL_ACTIVATE_USR       _IOW('p', 225, struct opal_session_info)
+#define IOC_OPAL_REVERT_TPR         _IOW('p', 226, struct opal_key)
+#define IOC_OPAL_LR_SETUP           _IOW('p', 227, struct opal_user_lr_setup)
+#define IOC_OPAL_ADD_USR_TO_LR      _IOW('p', 228, struct opal_lock_unlock)
+#define IOC_OPAL_ENABLE_DISABLE_MBR _IOW('p', 229, struct opal_mbr_data)
+#define IOC_OPAL_ERASE_LR           _IOW('p', 230, struct opal_session_info)
+#define IOC_OPAL_SECURE_ERASE_LR    _IOW('p', 231, struct opal_session_info)
+
+#endif /* _UAPI_SED_OPAL_H */
-- 
2.7.4

  reply	other threads:[~2016-12-29 19:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-29 19:26 [PATCH v4 0/6] SED OPAL Library Scott Bauer
2016-12-29 19:26 ` Scott Bauer [this message]
2016-12-29 19:26 ` [PATCH v4 2/6] block: Add Sed-opal library Scott Bauer
2016-12-30 21:02   ` Jon Derrick
2017-01-08 13:32     ` Christoph Hellwig
2017-01-08 14:05   ` Christoph Hellwig
2017-01-11 17:47     ` J Freyensee
2017-01-30 17:08     ` Scott Bauer
2017-01-19 18:28   ` Scott Bauer
2017-01-24  0:20     ` J Freyensee
2017-01-24  7:46     ` Christoph Hellwig
2016-12-29 19:26 ` [PATCH v4 3/6] block: add ioctl interface for interfacing with Opal library Scott Bauer
2017-01-08 14:06   ` Christoph Hellwig
2016-12-29 19:26 ` [PATCH v4 4/6] block: Add Opal Files to Makefile & add config option to Kconfig Scott Bauer
2017-01-08 14:09   ` Christoph Hellwig
2016-12-29 19:26 ` [PATCH v4 5/6] nvme: Add Support for Opal: Unlock from S3 & Opal Allocation/Ioctls Scott Bauer
2017-01-08 14:20   ` Christoph Hellwig
2017-01-18 18:45     ` Keith Busch
2017-01-24  8:14     ` Christoph Hellwig
2017-01-19 19:32   ` Jon Derrick
2016-12-29 19:26 ` [PATCH v4 6/6] Maintainers: Add maintainer info for SED/Opal library Scott Bauer
2016-12-29 21:00 ` [PATCH v4 0/6] SED OPAL Library Scott Bauer
2016-12-30  8:28 ` Christoph Hellwig
2016-12-30 22:52   ` Scott Bauer
2016-12-31  3:51     ` Christoph Hellwig
2016-12-31  5:41       ` Scott Bauer
2016-12-31  5:47         ` Christoph Hellwig
2017-01-03 22:09           ` Scott Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1483039615-22407-2-git-send-email-scott.bauer@intel.com \
    --to=scott.bauer@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox