TianoCore EDK2 master
Loading...
Searching...
No Matches
NvmExpressMediaSanitize.h File Reference

Go to the source code of this file.

Macros

#define NVME_NO_DEALLOCATE_AFTER_SANITZE   0x1
 

Functions

EFI_STATUS NvmExpressFormatNvm (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 NamespaceId, IN UINT32 Ses, IN UINT32 Flbas)
 
EFI_STATUS NvmExpressSanitize (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 NamespaceId, IN UINT32 SanitizeAction, IN UINT32 NoDeallocAfterSanitize, IN UINT32 OverwritePattern)
 
EFI_STATUS EFIAPI NvmExpressMediaClear (IN MEDIA_SANITIZE_PROTOCOL *This, IN UINT32 MediaId, IN UINT32 PassCount, IN VOID *SectorOwBuffer)
 
EFI_STATUS EFIAPI NvmExpressMediaPurge (IN MEDIA_SANITIZE_PROTOCOL *This, IN UINT32 MediaId, IN UINT32 PurgeAction, IN UINT32 OverwritePattern)
 
EFI_STATUS EFIAPI NvmExpressMediaFormat (IN MEDIA_SANITIZE_PROTOCOL *This, IN UINT32 MediaId, IN UINT32 LbaSize, IN UINT32 SecureEraseAction)
 

Detailed Description

Header file for MEDIA_SANITIZE_PROTOCOL interface.

Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file NvmExpressMediaSanitize.h.

Macro Definition Documentation

◆ NVME_NO_DEALLOCATE_AFTER_SANITZE

#define NVME_NO_DEALLOCATE_AFTER_SANITZE   0x1

Definition at line 12 of file NvmExpressMediaSanitize.h.

Function Documentation

◆ NvmExpressFormatNvm()

EFI_STATUS NvmExpressFormatNvm ( IN EFI_BLOCK_IO_PROTOCOL This,
IN UINT32  NamespaceId,
IN UINT32  Ses,
IN UINT32  Flbas 
)

Send NVM Express FormatNVM Admin Command

The Format NVM command is used to low level format the NVM media. This command is used by the host to change the LBA data size and/or metadata size.

A low level format may destroy all data and metadata associated with all namespaces or only the specific namespace associated with the command (refer to the Format NVM Attributes field in the Identify Controller data structure).

After the Format NVM command successfully completes, the controller shall not return any user data that was previously contained in an affected namespace.

Parameters
[in]ThisIndicates a pointer to the calling context (Block IO Protocol)
[in]NamespaceIdThe NVM Express namespace ID for which a device path node is to be allocated and built. Caller must set the NamespaceId to zero if the device path node will contain a valid UUID.
[in]SesSecure Erase Setting (SES) value
  • 000b: No secure erase operation requested
  • 001b: User Data Erase
  • 010b: Cryptographic Erase
  • 011b to 111b: Reserved
[in]FlbasNew LBA size (in terms of LBA Format size Index (bits 3:0) in NamespaceData). If this param is 0 (NULL), then use existing LBA size.
Return values
EFI_SUCCESSThe device formatted correctly.
EFI_WRITE_PROTECTEDThe device can not be formatted due to write protection.
EFI_DEVICE_ERRORThe device reported an error while performing the format.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHNAGEDThe MediaId does not matched the current device.
EFI_INVALID_PARAMETERThe format request contains parameters that are not valid.

Definition at line 52 of file NvmExpressMediaSanitize.c.

◆ NvmExpressMediaClear()

EFI_STATUS EFIAPI NvmExpressMediaClear ( IN MEDIA_SANITIZE_PROTOCOL This,
IN UINT32  MediaId,
IN UINT32  PassCount,
IN VOID *  SectorOwBuffer 
)

Clear Media utilizes transport native WRITE commands to write a fixed pattern of non-sensitive data to the media.

NOTE: The caller shall send buffer of one sector/LBA size with overwrite data. NOTE: This operation is a blocking call. NOTE: This function must be called from TPL_APPLICATION or TPL_CALLBACK.

Functions are defined to erase and purge data at a block level from mass storage devices as well as to manage such devices in the EFI boot services environment.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]MediaIdThe media ID that the write request is for.
[in]PassCountThe number of passes to write over media.
[in]SectorOwBufferA pointer to the overwrite buffer.
Return values
EFI_SUCCESSThe data was written correctly to the device.
EFI_WRITE_PROTECTEDThe device can not be written to.
EFI_DEVICE_ERRORThe device reported an error while performing the write.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHNAGEDThe MediaId does not matched the current device.
EFI_INVALID_PARAMETERThe write request contains LBAs that are not valid, or the buffer is not on proper alignment.

Definition at line 326 of file NvmExpressMediaSanitize.c.

◆ NvmExpressMediaFormat()

EFI_STATUS EFIAPI NvmExpressMediaFormat ( IN MEDIA_SANITIZE_PROTOCOL This,
IN UINT32  MediaId,
IN UINT32  LbaSize,
IN UINT32  SecureEraseAction 
)

Format Media utilizes native format operations to modify sector/LBA size. Secure erase actions are used to define how latent user data is erased.

NOTE: This function must be called from TPL_APPLICATION or TPL_CALLBACK.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]MediaIdThe media ID that the clear request is for.
[in]LbaSizeSize of LBA (in terms of power of two: 2^n).
[in]SecureEraseActionSecure erase action, if any, to apply to format.
  • 000b: No secure erase operation requested
  • 001b: User Data Erase
  • 010b: Cryptographic Erase
  • 011b to 111b: Reserved
Return values
EFI_SUCCESSThe media format request completed successfully on the device.
EFI_WRITE_PROTECTEDThe device can't be formatted due to write protection.
EFI_DEVICE_ERRORThe device reported an error while attempting to perform the format operation.
EFI_INVALID_PARAMETERThe format request contains parameters that are not valid.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.

Format Media utilizes native format operations to modify sector/LBA size. Secure erase actions are used to define how latent user data is erased.

NOTE: This function must be called from TPL_APPLICATION or TPL_CALLBACK.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]MediaIdThe media ID that the clear request is for.
[in]LbaSizeSize of LBA (in terms of power of two: 2^n).
[in]SecureEraseActionSecure erase action, if any, to apply to format.
  • 000b: No secure erase operation requested
  • 001b: User Data Erase
  • 010b: Cryptographic Erase
  • 011b to 111b: Reserved
Return values
EFI_SUCCESSThe media format request comopleted successfully on the device.
EFI_WRITE_PROTECTEDThe device can't be formatted due to write protection.
EFI_DEVICE_ERRORThe device reported an error while attempting to perform the format operation.
EFI_INVALID_PARAMETERThe format request contains parameters that are not valid.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.

Definition at line 503 of file NvmExpressMediaSanitize.c.

◆ NvmExpressMediaPurge()

EFI_STATUS EFIAPI NvmExpressMediaPurge ( IN MEDIA_SANITIZE_PROTOCOL This,
IN UINT32  MediaId,
IN UINT32  PurgeAction,
IN UINT32  OverwritePattern 
)

Purge Media utilizes transport native Sanitize operations. Sanitize specific purge actions include: overwrite, block erase, or crypto erase.

Functions are defined to erase and purge data at a block level from mass storage devices as well as to manage such devices in the EFI boot services environment. Sanitization refers to a process that renders access to target data on the media infeasible for a given level of effort.

NOTE: This operation is a blocking call. NOTE: This function must be called from TPL_APPLICATION or TPL_CALLBACK.

Parameters
[in]ThisIndicates a pointer to the calling context.
[in]MediaIdThe media ID that the write request is for.
[in]PurgeActionThe purage action (overwrite, crypto erase, block erase).
[in]OverwritePattern32-bit pattern to overwrite on media (for overwrite).
Return values
EFI_SUCCESSThe media was purged successfully on the device.
EFI_WRITE_PROTECTEDThe device can not be purged due to write protection.
EFI_DEVICE_ERRORThe device reported an error while performing the purge.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHNAGEDThe MediaId does not match the current device.
EFI_INVALID_PARAMETERThe purge request contains parameters that are not valid.

Definition at line 413 of file NvmExpressMediaSanitize.c.

◆ NvmExpressSanitize()

EFI_STATUS NvmExpressSanitize ( IN EFI_BLOCK_IO_PROTOCOL This,
IN UINT32  NamespaceId,
IN UINT32  SanitizeAction,
IN UINT32  NoDeallocAfterSanitize,
IN UINT32  OverwritePattern 
)

Send NVM Express Sanitize Admin Command

The Sanitize command is used to start a sanitize operation or to recover from a previously failed sanitize operation. The sanitize operation types that may be supported are Block Erase, Crypto Erase, and Overwrite.

All sanitize operations are processed in the background (i.e., completion of the Sanitize command does not indicate completion of the sanitize operation).

Parameters
[in]ThisIndicates a pointer to the calling context (Block IO Protocol)
[in]NamespaceIdThe NVM Express namespace ID for which a device path node is to be allocated and built. Caller must set the NamespaceId to zero if the device path node will contain a valid UUID.
[in]SanitizeActionSanitize action
[in]NoDeallocAfterSanitizeNo deallocate after sanitize option
[in]OverwritePatternPattern to overwrite old user data
Return values
EFI_SUCCESSThe media was sanitized successfully on the device.
EFI_WRITE_PROTECTEDThe device can not be sanitized due to write protection.
EFI_DEVICE_ERRORThe device reported an error while performing the sanitize.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHNAGEDThe MediaId does not match the current device.
EFI_INVALID_PARAMETERThe sanitize request contains parameters that are not valid.

Definition at line 196 of file NvmExpressMediaSanitize.c.