From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.9070.1675320105271674373 for ; Wed, 01 Feb 2023 22:41:45 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=kYEJWG6C; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: weipu.zhu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675320105; x=1706856105; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=npfPtJOldgjQWePbly8B21gEAQnxbiHecB5+7jrM8uQ=; b=kYEJWG6CY3qdjd8MyfKgOt4yfP5Sdikm/kNRpE56+WqMjfXgs+Tk6NuN XIzf7catmNk1RNCSz46O+BuX3OW+Q1rdWP1MJGD1w3mgJVqnVmLqqIPpT MCCWZhGrLGdhsYyziZ6lrIsxTq65JZSFec5jyzCFTi67BT+Wh8bC82MpL m2Qwo67/T0Oa/KDwJ9ZniNpiGpUikS51bh/U+lfT9XmE/qd3uhMvZ8ivf /3YMyqi9B3zxoDicltw1mlUz5r+u3IQw0rOJXo/UT+6X7qZn+5NauIDBh d/z5ktPqSW4yGqenkL9hC4OuU65sz7Vx9YiVi598zO4cOeg2dSzhr4L8i g==; X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="312015873" X-IronPort-AV: E=Sophos;i="5.97,266,1669104000"; d="scan'208";a="312015873" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2023 22:41:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="789174474" X-IronPort-AV: E=Sophos;i="5.97,266,1669104000"; d="scan'208";a="789174474" Received: from weipuzhu.ccr.corp.intel.com ([10.239.49.144]) by orsmga004.jf.intel.com with ESMTP; 01 Feb 2023 22:41:42 -0800 From: "Weipu Zhu" To: devel@edk2.groups.io Cc: Weipu Zhu , Hao Wu , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v2 1/2] MdePkg: Add RPMB related commands and DCB definition for NVMe Date: Thu, 2 Feb 2023 14:41:40 +0800 Message-Id: X-Mailer: git-send-email 2.37.1.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4303=0D =0D Add RPMB(Replay Protected Memory Block) access commands,=0D result and DCB(Device Configuration Block) definition for=0D NVMe according to the NVMe spec 2.0.=0D =0D Signed-off-by: Weipu Zhu =0D Cc: Hao Wu =0D Cc: Michael D Kinney =0D Cc: Liming Gao =0D Cc: Zhiguang Liu =0D ---=0D MdePkg/Include/IndustryStandard/Nvme.h | 46 +++++++++++++++++++++++++-=0D 1 file changed, 45 insertions(+), 1 deletion(-)=0D =0D diff --git a/MdePkg/Include/IndustryStandard/Nvme.h b/MdePkg/Include/Indust= ryStandard/Nvme.h=0D index 4a1d92c45d..3b4e9fe67c 100644=0D --- a/MdePkg/Include/IndustryStandard/Nvme.h=0D +++ b/MdePkg/Include/IndustryStandard/Nvme.h=0D @@ -2,12 +2,13 @@=0D Definitions based on NVMe spec. version 1.1.=0D =0D (C) Copyright 2016 Hewlett Packard Enterprise Development LP
=0D - Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @par Specification Reference:=0D NVMe Specification 1.1=0D NVMe Specification 1.4=0D + NVMe Specification 2.0=0D =0D **/=0D =0D @@ -502,6 +503,49 @@ typedef struct {=0D // UINT8 *Data; /* Data to be written or read= by signed access where M =3D 512 * Sector Count. */=0D } NVME_RPMB_DATA_FRAME;=0D =0D +//=0D +// RPMB Device Configuration Block Data Structure.=0D +// (ref. NVMe Base spec. v2.0 Figure 460).=0D +//=0D +typedef struct {=0D + UINT8 BPPEnable; /* Boot Partition Protection Enabled */=0D + UINT8 BPLock; /* Boot Partition Lock */=0D + UINT8 NameSpaceWrP; /* Namespace Write Protection */=0D + UINT8 Rsvd1[509]; /* Reserved as of Nvm Express 2.0 Spec */=0D +} NVME_RPMB_DCB;=0D +=0D +//=0D +// RPMB Request and Response Message Types.=0D +// (ref. NVMe Base spec. v2.0 Figure 461).=0D +//=0D +#define NVME_RPMB_AUTHKEY_PROGRAM 0x0001=0D +#define NVME_RPMB_COUNTER_READ 0x0002=0D +#define NVME_RPMB_AUTHDATA_WRITE 0x0003=0D +#define NVME_RPMB_AUTHDATA_READ 0x0004=0D +#define NVME_RPMB_RESULT_READ 0x0005=0D +#define NVME_RPMB_DCB_WRITE 0x0006=0D +#define NVME_RPMB_DCB_READ 0x0007=0D +#define NVME_RPMB_AUTHKEY_PROGRAM_RESPONSE 0x0100=0D +#define NVME_RPMB_COUNTER_READ_RESPONSE 0x0200=0D +#define NVME_RPMB_AUTHDATA_WRITE_RESPONSE 0x0300=0D +#define NVME_RPMB_AUTHDATA_READ_RESPONSE 0x0400=0D +#define NVME_RPMB_DCB_WRITE_RESPONSE 0x0600=0D +#define NVME_RPMB_DCB_READ_RESPONSE 0x0700=0D +=0D +//=0D +// RPMB Operation Result.=0D +// (ref. NVMe Base spec. v2.0 Figure 462).=0D +//=0D +#define NVME_RPMB_RESULT_SUCCESS 0x00=0D +#define NVME_RPMB_RESULT_GENERAL_FAILURE 0x01=0D +#define NVME_RPMB_RESULT_AHTHENTICATION_FAILURE 0x02=0D +#define NVME_RPMB_RESULT_COUNTER_FAILURE 0x03=0D +#define NVME_RPMB_RESULT_ADDRESS_FAILURE 0x04=0D +#define NVME_RPMB_RESULT_WRITE_FAILURE 0x05=0D +#define NVME_RPMB_RESULT_READ_FAILURE 0x06=0D +#define NVME_RPMB_RESULT_AUTHKEY_NOT_PROGRAMMED 0x07=0D +#define NVME_RPMB_RESULT_INVALID_DCB 0x08=0D +=0D //=0D // NvmExpress Admin Identify Cmd=0D //=0D -- =0D 2.37.1.windows.1=0D =0D