Merged: https://github.com/tianocore/edk2/pull/5108
> -----Original Message----- > From: Kinney, Michael D <michael.d.kin...@intel.com> > Sent: Wednesday, November 15, 2023 6:50 PM > To: Chen, Tina <tina.c...@intel.com>; devel@edk2.groups.io > Cc: Ni, Ray <ray...@intel.com>; Chen, Xiao X <xiao.x.c...@intel.com>; Chen, > Arthur G <arthur.g.c...@intel.com>; Gao, Liming <gaolim...@byosoft.com.cn>; > Liu, Zhiguang <zhiguang....@intel.com>; Sean Brogan > <sean.bro...@microsoft.com>; Kinney, Michael D <michael.d.kin...@intel.com> > Subject: RE: [PATCH v4 1/1] MdePkg:Add NVME Sanitize command support to > Nvme.h > > Reviewed-by: Michael D Kinney <michael.d.kin...@intel.com> > > > -----Original Message----- > > From: Chen, Tina <tina.c...@intel.com> > > Sent: Wednesday, November 8, 2023 11:51 PM > > To: devel@edk2.groups.io > > Cc: Chen, Tina <tina.c...@intel.com>; Ni, Ray <ray...@intel.com>; > > Chen, Xiao X <xiao.x.c...@intel.com>; Chen, Arthur G > > <arthur.g.c...@intel.com>; Gao, Liming <gaolim...@byosoft.com.cn>; > > Liu, Zhiguang <zhiguang....@intel.com>; Sean Brogan > > <sean.bro...@microsoft.com>; Kinney, Michael D > > <michael.d.kin...@intel.com> > > Subject: [PATCH v4 1/1] MdePkg:Add NVME Sanitize command support to > > Nvme.h > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4591 > > > > 1. Refer NVME spec 2.0c chapter 5.24, add Sanitize Command related > > definition. > > 2. Refer NVME spec 2.0c chapter 5.16, add Get Log Page Command related > > definition for Sanitize status support. > > > > Cc: Ray Ni <ray...@intel.com> > > Cc: Xiao X Chen <xiao.x.c...@intel.com> > > Cc: Arthur Chen <arthur.g.c...@intel.com> > > Cc: Liming Gao <gaolim...@byosoft.com.cn> > > Cc: Zhiguang Liu <zhiguang....@intel.com> > > Cc: Sean Brogan <sean.bro...@microsoft.com> > > Cc: Michael D Kinney <michael.d.kin...@intel.com> > > Signed-off-by: Tina Chen <tina.c...@intel.com> > > --- > > MdePkg/Include/IndustryStandard/Nvme.h | 121 ++++++++++++++++++-- > > 1 file changed, 110 insertions(+), 11 deletions(-) > > > > diff --git a/MdePkg/Include/IndustryStandard/Nvme.h > > b/MdePkg/Include/IndustryStandard/Nvme.h > > index 8b8a1bb7f3..67f2196bc7 100644 > > --- a/MdePkg/Include/IndustryStandard/Nvme.h > > +++ b/MdePkg/Include/IndustryStandard/Nvme.h > > @@ -1,5 +1,5 @@ > > /** @file > > > > - Definitions based on NVMe spec. version 1.1. > > > > + Definitions based on NVMe spec. version 2.0c. > > > > > > > > (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> > > > > Copyright (c) 2017 - 2023, Intel Corporation. All rights > > reserved.<BR> > > > > @@ -9,6 +9,7 @@ > > NVMe Specification 1.1 > > > > NVMe Specification 1.4 > > > > NVMe Specification 2.0 > > > > + NVMe Specification 2.0c > > > > > > > > **/ > > > > > > > > @@ -354,6 +355,15 @@ typedef struct { > > UINT8 Rsvd7[16]; /* Reserved as of Nvm Express 1.1 Spec */ > > > > } NVME_PSDESCRIPTOR; > > > > > > > > +typedef struct { > > > > + UINT32 Ces : 1; /* Crypto Erase Supported */ > > > > + UINT32 Bes : 1; /* Block Erase Supported */ > > > > + UINT32 Ows : 1; /* Overwrite Supported */ > > > > + UINT32 Rsvd1 : 26; /* Reserved as of NVM Express 2.0c Spec > > */ > > > > + UINT32 Ndi : 1; /* No-Deallocate Inhibited */ > > > > + UINT32 Nodmmas : 2; /* No-Deallocate Modifies Media After > > Sanitize */ > > > > +} NVME_SANICAP; > > > > + > > > > // > > > > // Identify Controller Data > > > > // > > > > @@ -403,7 +413,12 @@ typedef struct { > > UINT16 Edstt; /* Extended Device Self-test Time > > */ > > > > UINT8 Dsto; /* Device Self-test Options */ > > > > UINT8 Fwug; /* Firmware Update Granularity */ > > > > - UINT8 Rsvd2[192]; /* Reserved as of Nvm Express 1.4 > > Spec */ > > > > + UINT16 Kas; /* Keep Alive Support */ > > > > + UINT16 Hctma; /* Host Controlled Thermal > > Management Attributes */ > > > > + UINT16 Mntmt; /* Minimum Thermal Management > > Temperature */ > > > > + UINT16 Mxtmt; /* Maximum Thermal Management > > Temperature */ > > > > + NVME_SANICAP Sanicap; /* Sanitize Capabilities */ > > > > + UINT8 Rsvd2[180]; /* Reserved as of Nvm Express 1.4 > > Spec */ > > > > // > > > > // NVM Command Set Attributes > > > > // > > > > @@ -687,10 +702,11 @@ typedef struct { > > // CDW 10 > > > > // > > > > UINT32 Lid : 8; /* Log Page Identifier */ > > > > - #define LID_ERROR_INFO 0x1 > > > > - #define LID_SMART_INFO 0x2 > > > > - #define LID_FW_SLOT_INFO 0x3 > > > > - #define LID_BP_INFO 0x15 > > > > + #define LID_ERROR_INFO 0x1 > > > > + #define LID_SMART_INFO 0x2 > > > > + #define LID_FW_SLOT_INFO 0x3 > > > > + #define LID_BP_INFO 0x15 > > > > + #define LID_SANITIZE_STATUS_INFO 0x81 > > > > UINT32 Rsvd1 : 8; > > > > UINT32 Numd : 12; /* Number of Dwords */ > > > > UINT32 Rsvd2 : 4; /* Reserved as of Nvm Express 1.1 Spec > > */ > > > > @@ -708,6 +724,31 @@ typedef struct { > > UINT32 Sv : 1; /* Save */ > > > > } NVME_ADMIN_SET_FEATURES; > > > > > > > > +// > > > > +// NvmExpress Admin Sanitize Command > > > > +// > > > > +typedef struct { > > > > + // > > > > + // CDW 10 > > > > + // > > > > + UINT32 Sanact : 3; /* Sanitize Action */ > > > > + UINT32 Ause : 1; /* Allow Unrestricted Sanitize Exit */ > > > > + UINT32 Owpass : 4; /* Overwrite Pass Count */ > > > > + UINT32 Oipbp : 1; /* Overwrite Invert Pattern Between > > Passes */ > > > > + UINT32 Nodas : 1; /* No-Deallocate After Sanitize */ > > > > + UINT32 Rsvd1 : 22; > > > > + // > > > > + // CDW 11 > > > > + // > > > > + UINT32 Ovrpat; /* Overwrite Pattern */ > > > > +} NVME_ADMIN_SANITIZE; > > > > + > > > > +#define SANITIZE_ACTION_NO_ACTION 0x0 > > > > +#define SANITIZE_ACTION_EXIT_FAILURE_MODE 0x1 > > > > +#define SANITIZE_ACTION_BLOCK_ERASE 0x2 > > > > +#define SANITIZE_ACTION_OVERWRITE 0x3 > > > > +#define SANITIZE_ACTION_CRYPTO_ERASE 0x4 > > > > + > > > > // > > > > // NvmExpress Admin Format NVM Command > > > > // > > > > @@ -770,6 +811,7 @@ typedef union { > > NVME_ADMIN_FORMAT_NVM FormatNvm; > > > > NVME_ADMIN_SECURITY_RECEIVE SecurityReceive; > > > > NVME_ADMIN_SECURITY_SEND SecuritySend; > > > > + NVME_ADMIN_SANITIZE Sanitize; > > > > } NVME_ADMIN_CMD; > > > > > > > > typedef struct { > > > > @@ -872,6 +914,7 @@ typedef struct { > > #define NVME_ADMIN_FORMAT_NVM_CMD 0x80 > > > > #define NVME_ADMIN_SECURITY_SEND_CMD 0x81 > > > > #define NVME_ADMIN_SECURITY_RECEIVE_CMD 0x82 > > > > +#define NVME_ADMIN_SANITIZE_CMD 0x84 > > > > > > > > #define NVME_IO_FLUSH_OPC 0 > > > > #define NVME_IO_WRITE_OPC 1 > > > > @@ -894,7 +937,8 @@ typedef enum { > > NamespaceAttachmentOpcode = NVME_ADMIN_NAMESACE_ATTACHMENT_CMD, > > > > FormatNvmOpcode = NVME_ADMIN_FORMAT_NVM_CMD, > > > > SecuritySendOpcode = NVME_ADMIN_SECURITY_SEND_CMD, > > > > - SecurityReceiveOpcode = NVME_ADMIN_SECURITY_RECEIVE_CMD > > > > + SecurityReceiveOpcode = NVME_ADMIN_SECURITY_RECEIVE_CMD, > > > > + SanitizeOpcode = NVME_ADMIN_SANITIZE_CMD > > > > } NVME_ADMIN_COMMAND_OPCODE; > > > > > > > > // > > > > @@ -934,12 +978,14 @@ typedef enum { > > > > > > // > > > > // Get Log Page ? Log Page Identifiers > > > > -// (ref. spec. v1.1 Figure 73). > > > > +// (ref. spec. v2.0c Figure 202). > > > > // > > > > typedef enum { > > > > - ErrorInfoLogID = LID_ERROR_INFO, > > > > - SmartHealthInfoLogID = LID_SMART_INFO, > > > > - FirmwareSlotInfoLogID = LID_FW_SLOT_INFO > > > > + ErrorInfoLogID = LID_ERROR_INFO, > > > > + SmartHealthInfoLogID = LID_SMART_INFO, > > > > + FirmwareSlotInfoLogID = LID_FW_SLOT_INFO, > > > > + BootPartitionInfoLogID = LID_BP_INFO, > > > > + SanitizeStatusInfoLogID = LID_SANITIZE_STATUS_INFO > > > > } NVME_LOG_ID; > > > > > > > > // > > > > @@ -1062,6 +1108,59 @@ typedef struct { > > UINT8 Reserved2[296]; > > > > } NVME_SMART_HEALTH_INFO_LOG; > > > > > > > > +// > > > > +// Sanitize Status (Log Identifier 81h) > > > > +// (ref. spec. v2.0c 5.16.1.25). > > > > +// > > > > +typedef struct { > > > > + // > > > > + // Indicates the fraction complete of the sanitize operation. > > (SPROG) > > > > + // > > > > + UINT16 SanitizeProgress; > > > > + // > > > > + // Indicates the status associated with the most recent sanitize > > operation. (SSTAT) > > > > + // > > > > + UINT16 SanitizeStatus : 3; > > > > + UINT16 OverwriteSanitizeCompletedNumber : 5; > > > > + UINT16 GlobalDataErased : 1; > > > > + UINT16 SanitizeStatusRsvd : 7; > > > > + // > > > > + // Contains the value of the Command Dword 10 field of the Sanitize > > command that started the sanitize operation whose status is reported > > in the SSTAT field. (SCDW10) > > > > + // > > > > + UINT32 SanitizeCmdDw10Info; > > > > + // > > > > + // Indicates the number of seconds required to complete an > > Overwrite sanitize operation with 16 passes in the background when the > > No-Deallocate Modifies Media After Sanitize field is not set to 10b. > > > > + // > > > > + UINT32 OverwriteEstimatedTime; > > > > + // > > > > + // Indicates the number of seconds required to complete a Block > > Erase sanitize operation in the background when the No-Deallocate > > Modifies Media After Sanitize field is not set to 10b. > > > > + // > > > > + UINT32 BlockEraseEstimatedTime; > > > > + // > > > > + // Indicates the number of seconds required to complete a Crypto > > Erase sanitize operation in the background when the No-Deallocate > > Modifies Media After Sanitize field is not set to 10b. > > > > + // > > > > + UINT32 CryptoEraseEstimatedTime; > > > > + // > > > > + // Indicates the number of seconds required to complete an > > Overwrite sanitize operation and the associated additional media > > modification after the Overwrite sanitize operation in the background. > > > > + // The No-Deallocate After Sanitize bit was set to ‘1’ in the > > Sanitize command that requested the Overwrite sanitize operation. > > > > + // The No-Deallocate Modifies Media After Sanitize field is set to > > 10b. > > > > + // > > > > + UINT32 OverwriteEstimatedTimeWithNodmm; > > > > + // > > > > + // Indicates the number of seconds required to complete a Block > > Erase sanitize operation and the associated additional media > > modification after the Block Erase sanitize operation in the > > background. > > > > + // The No-Deallocate After Sanitize bit was set to ‘1’ in the > > Sanitize command that requested the Block Erase sanitize operation. > > > > + // The No-Deallocate Modifies Media After Sanitize field is set to > > 10b. > > > > + // > > > > + UINT32 BlockEraseEstimatedTimeWithNodmm; > > > > + // > > > > + // Indicates the number of seconds required to complete a Crypto > > Erase sanitize operation and the associated additional media > > modification after the Crypto Erase sanitize operation in the > > background. > > > > + // The No-Deallocate After Sanitize bit was set to ‘1’ in the > > Sanitize command that requested the Crypto Erase sanitize operation. > > > > + // The No-Deallocate Modifies Media After Sanitize field is set to > > 10b. > > > > + // > > > > + UINT32 CryptoEraseEstimatedTimeWithNodmm; > > > > + UINT8 Reserved[480]; > > > > +} NVME_SANITIZE_STATUS_INFO_LOG; > > > > + > > > > #pragma pack() > > > > > > > > #endif > > > > -- > > 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112082): https://edk2.groups.io/g/devel/message/112082 Mute This Topic: https://groups.io/mt/102481639/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-