Please update the Nvme.h file header that the version being used is 2.0c. Thanks,
Mike > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tina > Chen > Sent: Monday, November 6, 2023 6:01 AM > To: devel@edk2.groups.io > Cc: Chen, Tina <tina.c...@intel.com>; Chen, Xiao X > <xiao.x.c...@intel.com>; Chen, Arthur G <arthur.g.c...@intel.com>; Ni, > Ray <ray...@intel.com>; Gao, Liming <gaolim...@byosoft.com.cn> > Subject: [edk2-devel] [PATCH V1] 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: Xiao X Chen <xiao.x.c...@intel.com> > Cc: Arthur Chen <arthur.g.c...@intel.com> > Cc: Ray Ni <ray...@intel.com> > Cc: Liming Gao <gaolim...@byosoft.com.cn> > Signed-off-by: Tina Chen <tina.c...@intel.com> > --- > MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 1 + > MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c | 1 + > MdePkg/Include/IndustryStandard/Nvme.h | 106 > ++++++++++++++++++-- > 3 files changed, 98 insertions(+), 10 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c > b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c > index b90c48731c..2ecaa2bbbe 100644 > --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c > +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c > @@ -908,6 +908,7 @@ NvmeControllerInit ( > DEBUG ((DEBUG_INFO, " RAB : 0x%x\n", Private- > >ControllerData->Rab)); > > DEBUG ((DEBUG_INFO, " IEEE : 0x%x\n", *(UINT32 *)Private- > >ControllerData->Ieee_oui)); > > DEBUG ((DEBUG_INFO, " AERL : 0x%x\n", Private- > >ControllerData->Aerl)); > > + DEBUG ((DEBUG_INFO, " Sanicap : 0x%x\n", Private- > >ControllerData->Sanicap)); > > DEBUG ((DEBUG_INFO, " SQES : 0x%x\n", Private- > >ControllerData->Sqes)); > > DEBUG ((DEBUG_INFO, " CQES : 0x%x\n", Private- > >ControllerData->Cqes)); > > DEBUG ((DEBUG_INFO, " NN : 0x%x\n", Private- > >ControllerData->Nn)); > > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c > b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c > index fc7b684940..61ef06e42f 100644 > --- a/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c > +++ b/MdeModulePkg/Bus/Pci/NvmExpressPei/NvmExpressPeiHci.c > @@ -436,6 +436,7 @@ NvmeDumpControllerData ( > DEBUG ((DEBUG_INFO, " RAB : 0x%x\n", ControllerData- > >Rab)); > > DEBUG ((DEBUG_INFO, " IEEE : 0x%x\n", *(UINT32 > *)ControllerData->Ieee_oui)); > > DEBUG ((DEBUG_INFO, " AERL : 0x%x\n", ControllerData- > >Aerl)); > > + DEBUG ((DEBUG_INFO, " Sanicap : 0x%x\n", ControllerData- > >Sanicap)); > > DEBUG ((DEBUG_INFO, " SQES : 0x%x\n", ControllerData- > >Sqes)); > > DEBUG ((DEBUG_INFO, " CQES : 0x%x\n", ControllerData- > >Cqes)); > > DEBUG ((DEBUG_INFO, " NN : 0x%x\n", ControllerData->Nn)); > > diff --git a/MdePkg/Include/IndustryStandard/Nvme.h > b/MdePkg/Include/IndustryStandard/Nvme.h > index 8b8a1bb7f3..d158d6c267 100644 > --- a/MdePkg/Include/IndustryStandard/Nvme.h > +++ b/MdePkg/Include/IndustryStandard/Nvme.h > @@ -403,7 +403,15 @@ 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 */ > > + UINT32 Sanicap; /* Sanitize Capabilities */ > > + #define SANITIZE_OVERWRITE_ERASE_SUPPORTED BIT2 > > + #define SANITIZE_BLOCK_ERASE_SUPPORTED BIT1 > > + #define SANITIZE_CRYPTO_ERASE_SUPPORTED BIT0 > > + UINT8 Rsvd2[180]; /* Reserved as of Nvm Express 1.4 > Spec */ > > // > > // NVM Command Set Attributes > > // > > @@ -687,10 +695,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 +717,25 @@ 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; > > + > > // > > // NvmExpress Admin Format NVM Command > > // > > @@ -770,6 +798,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 +901,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 +924,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 +965,14 @@ typedef enum { > > > // > > // Get Log Page ? Log Page Identifiers > > -// (ref. spec. v1.1 Figure 73). > > +// (ref. spec. v2.0 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 +1095,59 @@ typedef struct { > UINT8 Reserved2[296]; > > } NVME_SMART_HEALTH_INFO_LOG; > > > > +// > > +// Sanitize Status (Log Identifier 81h) > > +// (ref. spec. v2.0 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.35.2.windows.1 > > > > -- > Tina Chen > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110765): https://edk2.groups.io/g/devel/message/110765 Mute This Topic: https://groups.io/mt/102422560/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-