]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: Add RPMB related commands and DCB definition for NVMe
authorWeipu Zhu <weipu.zhu@intel.com>
Thu, 2 Feb 2023 06:41:40 +0000 (22:41 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 10 Feb 2023 03:14:12 +0000 (03:14 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4303

Add RPMB(Replay Protected Memory Block) access commands,
result and DCB(Device Configuration Block) definition for
NVMe according to the NVMe spec 2.0.

Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Weipu Zhu <weipu.zhu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
MdePkg/Include/IndustryStandard/Nvme.h

index 4a1d92c45d688b97961ac1d91d8f32ede050aa12..3b4e9fe67cd3133056ed0be083f2657d845faea6 100644 (file)
@@ -2,12 +2,13 @@
   Definitions based on NVMe spec. version 1.1.\r
 \r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
-  Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
   @par Specification Reference:\r
   NVMe Specification 1.1\r
   NVMe Specification 1.4\r
+  NVMe Specification 2.0\r
 \r
 **/\r
 \r
@@ -502,6 +503,49 @@ typedef struct {
   // UINT8    *Data;                         /* Data to be written or read by signed access where M = 512 * Sector Count. */\r
 } NVME_RPMB_DATA_FRAME;\r
 \r
+//\r
+// RPMB Device Configuration Block Data Structure.\r
+// (ref. NVMe Base spec. v2.0 Figure 460).\r
+//\r
+typedef struct {\r
+  UINT8    BPPEnable;     /* Boot Partition Protection Enabled */\r
+  UINT8    BPLock;        /* Boot Partition Lock */\r
+  UINT8    NameSpaceWrP;  /* Namespace Write Protection */\r
+  UINT8    Rsvd1[509];    /* Reserved as of Nvm Express 2.0 Spec */\r
+} NVME_RPMB_DCB;\r
+\r
+//\r
+// RPMB Request and Response Message Types.\r
+// (ref. NVMe Base spec. v2.0 Figure 461).\r
+//\r
+#define NVME_RPMB_AUTHKEY_PROGRAM           0x0001\r
+#define NVME_RPMB_COUNTER_READ              0x0002\r
+#define NVME_RPMB_AUTHDATA_WRITE            0x0003\r
+#define NVME_RPMB_AUTHDATA_READ             0x0004\r
+#define NVME_RPMB_RESULT_READ               0x0005\r
+#define NVME_RPMB_DCB_WRITE                 0x0006\r
+#define NVME_RPMB_DCB_READ                  0x0007\r
+#define NVME_RPMB_AUTHKEY_PROGRAM_RESPONSE  0x0100\r
+#define NVME_RPMB_COUNTER_READ_RESPONSE     0x0200\r
+#define NVME_RPMB_AUTHDATA_WRITE_RESPONSE   0x0300\r
+#define NVME_RPMB_AUTHDATA_READ_RESPONSE    0x0400\r
+#define NVME_RPMB_DCB_WRITE_RESPONSE        0x0600\r
+#define NVME_RPMB_DCB_READ_RESPONSE         0x0700\r
+\r
+//\r
+// RPMB Operation Result.\r
+// (ref. NVMe Base spec. v2.0 Figure 462).\r
+//\r
+#define NVME_RPMB_RESULT_SUCCESS                 0x00\r
+#define NVME_RPMB_RESULT_GENERAL_FAILURE         0x01\r
+#define NVME_RPMB_RESULT_AHTHENTICATION_FAILURE  0x02\r
+#define NVME_RPMB_RESULT_COUNTER_FAILURE         0x03\r
+#define NVME_RPMB_RESULT_ADDRESS_FAILURE         0x04\r
+#define NVME_RPMB_RESULT_WRITE_FAILURE           0x05\r
+#define NVME_RPMB_RESULT_READ_FAILURE            0x06\r
+#define NVME_RPMB_RESULT_AUTHKEY_NOT_PROGRAMMED  0x07\r
+#define NVME_RPMB_RESULT_INVALID_DCB             0x08\r
+\r
 //\r
 // NvmExpress Admin Identify Cmd\r
 //\r