]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Scsi / ScsiDiskDxe / ScsiDisk.h
index bb6232676d1d0ba6cb1d376160537929745e4ec0..5b4047e1dbdd632a2f0dd142c0566fefce0b93e2 100644 (file)
@@ -1,24 +1,17 @@
 /** @file\r
   Header file for SCSI Disk Driver.\r
 \r
-Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #ifndef _SCSI_DISK_H_\r
 #define _SCSI_DISK_H_\r
 \r
-\r
 #include <Uefi.h>\r
 \r
-\r
 #include <Protocol/ScsiIo.h>\r
 #include <Protocol/ComponentName.h>\r
 #include <Protocol/BlockIo.h>\r
@@ -28,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/ScsiPassThruExt.h>\r
 #include <Protocol/ScsiPassThru.h>\r
 #include <Protocol/DiskInfo.h>\r
-\r
+#include <Protocol/StorageSecurityCommand.h>\r
 \r
 #include <Library/DebugLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
@@ -38,71 +31,79 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiScsiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/DevicePathLib.h>\r
+#include <Library/PrintLib.h>\r
 \r
 #include <IndustryStandard/Scsi.h>\r
 #include <IndustryStandard/Atapi.h>\r
 \r
-#define IS_DEVICE_FIXED(a)        (a)->FixedDevice ? 1 : 0\r
+#define IS_DEVICE_FIXED(a)  (a)->FixedDevice ? 1 : 0\r
+\r
+#define IS_ALIGNED(addr, size)  (((UINTN) (addr) & (size - 1)) == 0)\r
+\r
+#define UFS_WLUN_RPMB  0xC4\r
 \r
 typedef struct {\r
-  UINT32                    MaxLbaCnt;\r
-  UINT32                    MaxBlkDespCnt;\r
-  UINT32                    GranularityAlignment;\r
+  UINT32    MaxLbaCnt;\r
+  UINT32    MaxBlkDespCnt;\r
+  UINT32    GranularityAlignment;\r
 } SCSI_UNMAP_PARAM_INFO;\r
 \r
-#define SCSI_DISK_DEV_SIGNATURE SIGNATURE_32 ('s', 'c', 'd', 'k')\r
+#define SCSI_DISK_DEV_SIGNATURE  SIGNATURE_32 ('s', 'c', 'd', 'k')\r
 \r
 typedef struct {\r
-  UINT32                    Signature;\r
+  UINT32                                   Signature;\r
+\r
+  EFI_HANDLE                               Handle;\r
 \r
-  EFI_HANDLE                Handle;\r
+  EFI_STORAGE_SECURITY_COMMAND_PROTOCOL    StorageSecurity;\r
 \r
-  EFI_BLOCK_IO_PROTOCOL     BlkIo;\r
-  EFI_BLOCK_IO2_PROTOCOL    BlkIo2;\r
-  EFI_BLOCK_IO_MEDIA        BlkIoMedia;\r
-  EFI_ERASE_BLOCK_PROTOCOL  EraseBlock;\r
-  EFI_SCSI_IO_PROTOCOL      *ScsiIo;\r
-  UINT8                     DeviceType;\r
-  BOOLEAN                   FixedDevice;\r
-  UINT16                    Reserved;\r
+  EFI_BLOCK_IO_PROTOCOL                    BlkIo;\r
+  EFI_BLOCK_IO2_PROTOCOL                   BlkIo2;\r
+  EFI_BLOCK_IO_MEDIA                       BlkIoMedia;\r
+  EFI_ERASE_BLOCK_PROTOCOL                 EraseBlock;\r
+  EFI_SCSI_IO_PROTOCOL                     *ScsiIo;\r
+  UINT8                                    DeviceType;\r
+  BOOLEAN                                  FixedDevice;\r
+  UINT16                                   Reserved;\r
 \r
-  EFI_SCSI_SENSE_DATA       *SenseData;\r
-  UINTN                     SenseDataNumber;\r
-  EFI_SCSI_INQUIRY_DATA     InquiryData;\r
+  EFI_SCSI_SENSE_DATA                      *SenseData;\r
+  UINTN                                    SenseDataNumber;\r
+  EFI_SCSI_INQUIRY_DATA                    InquiryData;\r
 \r
-  EFI_UNICODE_STRING_TABLE  *ControllerNameTable;\r
+  EFI_UNICODE_STRING_TABLE                 *ControllerNameTable;\r
 \r
-  EFI_DISK_INFO_PROTOCOL    DiskInfo;\r
+  EFI_DISK_INFO_PROTOCOL                   DiskInfo;\r
 \r
   //\r
   // The following fields are only valid for ATAPI/SATA device\r
   //\r
-  UINT32                    Channel;\r
-  UINT32                    Device;\r
-  ATAPI_IDENTIFY_DATA       IdentifyData;\r
+  UINT32                                   Channel;\r
+  UINT32                                   Device;\r
+  ATAPI_IDENTIFY_DATA                      IdentifyData;\r
 \r
   //\r
   // Scsi UNMAP command parameters information\r
   //\r
-  SCSI_UNMAP_PARAM_INFO     UnmapInfo;\r
-  BOOLEAN                   BlockLimitsVpdSupported;\r
+  SCSI_UNMAP_PARAM_INFO                    UnmapInfo;\r
+  BOOLEAN                                  BlockLimitsVpdSupported;\r
 \r
   //\r
   // The flag indicates if 16-byte command can be used\r
   //\r
-  BOOLEAN                   Cdb16Byte;\r
+  BOOLEAN                                  Cdb16Byte;\r
 \r
   //\r
   // The queue for asynchronous task requests\r
   //\r
-  LIST_ENTRY                AsyncTaskQueue;\r
+  LIST_ENTRY                               AsyncTaskQueue;\r
 } SCSI_DISK_DEV;\r
 \r
-#define SCSI_DISK_DEV_FROM_BLKIO(a)  CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)\r
-#define SCSI_DISK_DEV_FROM_BLKIO2(a)  CR (a, SCSI_DISK_DEV, BlkIo2, SCSI_DISK_DEV_SIGNATURE)\r
+#define SCSI_DISK_DEV_FROM_BLKIO(a)     CR (a, SCSI_DISK_DEV, BlkIo, SCSI_DISK_DEV_SIGNATURE)\r
+#define SCSI_DISK_DEV_FROM_BLKIO2(a)    CR (a, SCSI_DISK_DEV, BlkIo2, SCSI_DISK_DEV_SIGNATURE)\r
 #define SCSI_DISK_DEV_FROM_ERASEBLK(a)  CR (a, SCSI_DISK_DEV, EraseBlock, SCSI_DISK_DEV_SIGNATURE)\r
+#define SCSI_DISK_DEV_FROM_STORSEC(a)   CR (a, SCSI_DISK_DEV, StorageSecurity, SCSI_DISK_DEV_SIGNATURE)\r
 \r
-#define SCSI_DISK_DEV_FROM_DISKINFO(a) CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)\r
+#define SCSI_DISK_DEV_FROM_DISKINFO(a)  CR (a, SCSI_DISK_DEV, DiskInfo, SCSI_DISK_DEV_SIGNATURE)\r
 \r
 //\r
 // Asynchronous I/O request\r
@@ -111,55 +112,55 @@ typedef struct {
 // Private data structure for a BlockIo2 request\r
 //\r
 typedef struct {\r
-  EFI_BLOCK_IO2_TOKEN                  *Token;\r
+  EFI_BLOCK_IO2_TOKEN    *Token;\r
   //\r
   // The flag indicates if the last Scsi Read/Write sub-task for a BlockIo2\r
   // request is sent to device\r
   //\r
-  BOOLEAN                              LastScsiRW;\r
+  BOOLEAN                LastScsiRW;\r
 \r
   //\r
   // The queue for Scsi Read/Write sub-tasks of a BlockIo2 request\r
   //\r
-  LIST_ENTRY                           ScsiRWQueue;\r
+  LIST_ENTRY             ScsiRWQueue;\r
 \r
-  LIST_ENTRY                           Link;\r
+  LIST_ENTRY             Link;\r
 } SCSI_BLKIO2_REQUEST;\r
 \r
 //\r
 // Private data structure for a SCSI Read/Write request\r
 //\r
 typedef struct {\r
-  SCSI_DISK_DEV                        *ScsiDiskDevice;\r
-  UINT64                               Timeout;\r
-  EFI_SCSI_SENSE_DATA                  *SenseData;\r
-  UINT8                                SenseDataLength;\r
-  UINT8                                HostAdapterStatus;\r
-  UINT8                                TargetStatus;\r
-  UINT8                                *InBuffer;\r
-  UINT8                                *OutBuffer;\r
-  UINT32                               DataLength;\r
-  UINT64                               StartLba;\r
-  UINT32                               SectorCount;\r
-  UINT8                                TimesRetry;\r
+  SCSI_DISK_DEV          *ScsiDiskDevice;\r
+  UINT64                 Timeout;\r
+  EFI_SCSI_SENSE_DATA    *SenseData;\r
+  UINT8                  SenseDataLength;\r
+  UINT8                  HostAdapterStatus;\r
+  UINT8                  TargetStatus;\r
+  UINT8                  *InBuffer;\r
+  UINT8                  *OutBuffer;\r
+  UINT32                 DataLength;\r
+  UINT64                 StartLba;\r
+  UINT32                 SectorCount;\r
+  UINT8                  TimesRetry;\r
 \r
   //\r
   // The BlockIo2 request this SCSI command belongs to\r
   //\r
-  SCSI_BLKIO2_REQUEST                  *BlkIo2Req;\r
+  SCSI_BLKIO2_REQUEST    *BlkIo2Req;\r
 \r
-  LIST_ENTRY                           Link;\r
+  LIST_ENTRY             Link;\r
 } SCSI_ASYNC_RW_REQUEST;\r
 \r
 //\r
 // Private data structure for an EraseBlock request\r
 //\r
 typedef struct {\r
-  EFI_ERASE_BLOCK_TOKEN                *Token;\r
+  EFI_ERASE_BLOCK_TOKEN              *Token;\r
 \r
-  EFI_SCSI_IO_SCSI_REQUEST_PACKET      CommandPacket;\r
+  EFI_SCSI_IO_SCSI_REQUEST_PACKET    CommandPacket;\r
 \r
-  LIST_ENTRY                           Link;\r
+  LIST_ENTRY                         Link;\r
 } SCSI_ERASEBLK_REQUEST;\r
 \r
 //\r
@@ -171,23 +172,30 @@ extern EFI_COMPONENT_NAME2_PROTOCOL  gScsiDiskComponentName2;
 //\r
 // action code used in detect media process\r
 //\r
-#define ACTION_NO_ACTION               0x00\r
-#define ACTION_READ_CAPACITY           0x01\r
-#define ACTION_RETRY_COMMAND_LATER     0x02\r
-#define ACTION_RETRY_WITH_BACKOFF_ALGO 0x03\r
-\r
-#define SCSI_COMMAND_VERSION_1      0x01\r
-#define SCSI_COMMAND_VERSION_2      0x02\r
-#define SCSI_COMMAND_VERSION_3      0x03\r
+#define ACTION_NO_ACTION                0x00\r
+#define ACTION_READ_CAPACITY            0x01\r
+#define ACTION_RETRY_COMMAND_LATER      0x02\r
+#define ACTION_RETRY_WITH_BACKOFF_ALGO  0x03\r
+\r
+#define SCSI_COMMAND_VERSION_1  0x01\r
+#define SCSI_COMMAND_VERSION_2  0x02\r
+#define SCSI_COMMAND_VERSION_3  0x03\r
+\r
+// Per SCSI spec, EFI_SCSI_INQUIRY_DATA.Reserved_5_95[3 - 10] has the Vendor identification\r
+// EFI_SCSI_INQUIRY_DATA.Reserved_5_95[11 - 26] has the product identification\r
+#define VENDOR_IDENTIFICATION_OFFSET   3\r
+#define VENDOR_IDENTIFICATION_LENGTH   8\r
+#define PRODUCT_IDENTIFICATION_OFFSET  11\r
+#define PRODUCT_IDENTIFICATION_LENGTH  16\r
 \r
 //\r
 // SCSI Disk Timeout Experience Value\r
 //\r
-// As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI devices, the timout\r
+// As ScsiDisk and ScsiBus driver are used to manage SCSI or ATAPI devices, the timeout\r
 // value is updated to 30s to follow ATA/ATAPI spec in which the device may take up to 30s\r
 // to respond command.\r
 //\r
-#define SCSI_DISK_TIMEOUT           EFI_TIMER_PERIOD_SECONDS (30)\r
+#define SCSI_DISK_TIMEOUT  EFI_TIMER_PERIOD_SECONDS (30)\r
 \r
 /**\r
   Test to see if this driver supports ControllerHandle.\r
@@ -265,15 +273,16 @@ ScsiDiskDriverBindingStart (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskDriverBindingStop (\r
-  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,\r
-  IN  EFI_HANDLE                      Controller,\r
-  IN  UINTN                           NumberOfChildren,\r
-  IN  EFI_HANDLE                      *ChildHandleBuffer   OPTIONAL\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN  EFI_HANDLE                   Controller,\r
+  IN  UINTN                        NumberOfChildren,\r
+  IN  EFI_HANDLE                   *ChildHandleBuffer   OPTIONAL\r
   );\r
 \r
 //\r
 // EFI Component Name Functions\r
 //\r
+\r
 /**\r
   Retrieves a Unicode string that is the user readable name of the driver.\r
 \r
@@ -321,7 +330,6 @@ ScsiDiskComponentNameGetDriverName (
   OUT CHAR16                       **DriverName\r
   );\r
 \r
-\r
 /**\r
   Retrieves a Unicode string that is the user readable name of the controller\r
   that is being managed by a driver.\r
@@ -393,11 +401,11 @@ ScsiDiskComponentNameGetDriverName (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskComponentNameGetControllerName (\r
-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
-  IN  EFI_HANDLE                                      ControllerHandle,\r
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
-  IN  CHAR8                                           *Language,\r
-  OUT CHAR16                                          **ControllerName\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  EFI_HANDLE                   ControllerHandle,\r
+  IN  EFI_HANDLE                   ChildHandle        OPTIONAL,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **ControllerName\r
   );\r
 \r
 /**\r
@@ -410,17 +418,16 @@ ScsiDiskComponentNameGetControllerName (
   @retval EFI_SUCCESS          The device was reset.\r
   @retval EFI_DEVICE_ERROR     The device is not functioning properly and could\r
                                not be reset.\r
-  @return EFI_STATUS is retured from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r
+  @return EFI_STATUS is returned from EFI_SCSI_IO_PROTOCOL.ResetDevice().\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReset (\r
-  IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
-  IN  BOOLEAN                 ExtendedVerification\r
+  IN  EFI_BLOCK_IO_PROTOCOL  *This,\r
+  IN  BOOLEAN                ExtendedVerification\r
   );\r
 \r
-\r
 /**\r
   The function is to Read Block from SCSI Disk.\r
 \r
@@ -441,14 +448,13 @@ ScsiDiskReset (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReadBlocks (\r
-  IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
-  IN  UINT32                  MediaId,\r
-  IN  EFI_LBA                 Lba,\r
-  IN  UINTN                   BufferSize,\r
-  OUT VOID                    *Buffer\r
+  IN  EFI_BLOCK_IO_PROTOCOL  *This,\r
+  IN  UINT32                 MediaId,\r
+  IN  EFI_LBA                Lba,\r
+  IN  UINTN                  BufferSize,\r
+  OUT VOID                   *Buffer\r
   );\r
 \r
-\r
 /**\r
   The function is to Write Block to SCSI Disk.\r
 \r
@@ -462,7 +468,7 @@ ScsiDiskReadBlocks (
   @retval EFI_WRITE_PROTECTED   The device can not be written to.\r
   @retval EFI_DEVICE_ERROR      Fail to detect media.\r
   @retval EFI_NO_MEDIA          Media is not present.\r
-  @retval EFI_MEDIA_CHNAGED     Media has changed.\r
+  @retval EFI_MEDIA_CHANGED     Media has changed.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
   @retval EFI_INVALID_PARAMETER Invalid parameter passed in.\r
 \r
@@ -470,14 +476,13 @@ ScsiDiskReadBlocks (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskWriteBlocks (\r
-  IN  EFI_BLOCK_IO_PROTOCOL   *This,\r
-  IN  UINT32                  MediaId,\r
-  IN  EFI_LBA                 Lba,\r
-  IN  UINTN                   BufferSize,\r
-  IN  VOID                    *Buffer\r
+  IN  EFI_BLOCK_IO_PROTOCOL  *This,\r
+  IN  UINT32                 MediaId,\r
+  IN  EFI_LBA                Lba,\r
+  IN  UINTN                  BufferSize,\r
+  IN  VOID                   *Buffer\r
   );\r
 \r
-\r
 /**\r
   Flush Block to Disk.\r
 \r
@@ -491,10 +496,9 @@ ScsiDiskWriteBlocks (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskFlushBlocks (\r
-  IN  EFI_BLOCK_IO_PROTOCOL   *This\r
+  IN  EFI_BLOCK_IO_PROTOCOL  *This\r
   );\r
 \r
-\r
 /**\r
   Reset SCSI Disk.\r
 \r
@@ -543,12 +547,12 @@ ScsiDiskResetEx (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskReadBlocksEx (\r
-  IN     EFI_BLOCK_IO2_PROTOCOL   *This,\r
-  IN     UINT32                   MediaId,\r
-  IN     EFI_LBA                  Lba,\r
-  IN OUT EFI_BLOCK_IO2_TOKEN      *Token,\r
-  IN     UINTN                    BufferSize,\r
-  OUT    VOID                     *Buffer\r
+  IN     EFI_BLOCK_IO2_PROTOCOL  *This,\r
+  IN     UINT32                  MediaId,\r
+  IN     EFI_LBA                 Lba,\r
+  IN OUT EFI_BLOCK_IO2_TOKEN     *Token,\r
+  IN     UINTN                   BufferSize,\r
+  OUT    VOID                    *Buffer\r
   );\r
 \r
 /**\r
@@ -577,12 +581,12 @@ ScsiDiskReadBlocksEx (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskWriteBlocksEx (\r
-  IN     EFI_BLOCK_IO2_PROTOCOL *This,\r
-  IN     UINT32                 MediaId,\r
-  IN     EFI_LBA                Lba,\r
-  IN OUT EFI_BLOCK_IO2_TOKEN    *Token,\r
-  IN     UINTN                  BufferSize,\r
-  IN     VOID                   *Buffer\r
+  IN     EFI_BLOCK_IO2_PROTOCOL  *This,\r
+  IN     UINT32                  MediaId,\r
+  IN     EFI_LBA                 Lba,\r
+  IN OUT EFI_BLOCK_IO2_TOKEN     *Token,\r
+  IN     UINTN                   BufferSize,\r
+  IN     VOID                    *Buffer\r
   );\r
 \r
 /**\r
@@ -636,13 +640,156 @@ ScsiDiskFlushBlocksEx (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskEraseBlocks (\r
-  IN     EFI_ERASE_BLOCK_PROTOCOL      *This,\r
-  IN     UINT32                        MediaId,\r
-  IN     EFI_LBA                       Lba,\r
-  IN OUT EFI_ERASE_BLOCK_TOKEN         *Token,\r
-  IN     UINTN                         Size\r
+  IN     EFI_ERASE_BLOCK_PROTOCOL  *This,\r
+  IN     UINT32                    MediaId,\r
+  IN     EFI_LBA                   Lba,\r
+  IN OUT EFI_ERASE_BLOCK_TOKEN     *Token,\r
+  IN     UINTN                     Size\r
   );\r
 \r
+/**\r
+  Send a security protocol command to a device that receives data and/or the result\r
+  of one or more commands sent by SendData.\r
+\r
+  The ReceiveData function sends a security protocol command to the given MediaId.\r
+  The security protocol command sent is defined by SecurityProtocolId and contains\r
+  the security protocol specific data SecurityProtocolSpecificData. The function\r
+  returns the data from the security protocol command in PayloadBuffer.\r
+\r
+  For devices supporting the SCSI command set, the security protocol command is sent\r
+  using the SECURITY PROTOCOL IN command defined in SPC-4.\r
+\r
+  If PayloadBufferSize is too small to store the available data from the security\r
+  protocol command, the function shall copy PayloadBufferSize bytes into the\r
+  PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.\r
+\r
+  If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,\r
+  the function shall return EFI_INVALID_PARAMETER.\r
+\r
+  If the given MediaId does not support security protocol commands, the function shall\r
+  return EFI_UNSUPPORTED. If there is no media in the device, the function returns\r
+  EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,\r
+  the function returns EFI_MEDIA_CHANGED.\r
+\r
+  If the security protocol fails to complete within the Timeout period, the function\r
+  shall return EFI_TIMEOUT.\r
+\r
+  If the security protocol command completes without an error, the function shall\r
+  return EFI_SUCCESS. If the security protocol command completes with an error, the\r
+  function shall return EFI_DEVICE_ERROR.\r
+\r
+  @param  This                         Indicates a pointer to the calling context.\r
+  @param  MediaId                      ID of the medium to receive data from.\r
+  @param  Timeout                      The timeout, in 100ns units, to use for the execution\r
+                                       of the security protocol command. A Timeout value of 0\r
+                                       means that this function will wait indefinitely for the\r
+                                       security protocol command to execute. If Timeout is greater\r
+                                       than zero, then this function will return EFI_TIMEOUT if the\r
+                                       time required to execute the receive data command is greater than Timeout.\r
+  @param  SecurityProtocolId           The value of the "Security Protocol" parameter of\r
+                                       the security protocol command to be sent.\r
+  @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
+                                       of the security protocol command to be sent.\r
+  @param  PayloadBufferSize            Size in bytes of the payload data buffer.\r
+  @param  PayloadBuffer                A pointer to a destination buffer to store the security\r
+                                       protocol command specific payload data for the security\r
+                                       protocol command. The caller is responsible for having\r
+                                       either implicit or explicit ownership of the buffer.\r
+  @param  PayloadTransferSize          A pointer to a buffer to store the size in bytes of the\r
+                                       data written to the payload data buffer.\r
+\r
+  @retval EFI_SUCCESS                  The security protocol command completed successfully.\r
+  @retval EFI_WARN_BUFFER_TOO_SMALL    The PayloadBufferSize was too small to store the available\r
+                                       data from the device. The PayloadBuffer contains the truncated data.\r
+  @retval EFI_UNSUPPORTED              The given MediaId does not support security protocol commands.\r
+  @retval EFI_DEVICE_ERROR             The security protocol command completed with an error.\r
+  @retval EFI_NO_MEDIA                 There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED            The MediaId is not for the current media.\r
+  @retval EFI_INVALID_PARAMETER        The PayloadBuffer or PayloadTransferSize is NULL and\r
+                                       PayloadBufferSize is non-zero.\r
+  @retval EFI_TIMEOUT                  A timeout occurred while waiting for the security\r
+                                       protocol command to execute.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiDiskReceiveData (\r
+  IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL  *This,\r
+  IN UINT32                                 MediaId   OPTIONAL,\r
+  IN UINT64                                 Timeout,\r
+  IN UINT8                                  SecurityProtocolId,\r
+  IN UINT16                                 SecurityProtocolSpecificData,\r
+  IN UINTN                                  PayloadBufferSize,\r
+  OUT VOID                                  *PayloadBuffer,\r
+  OUT UINTN                                 *PayloadTransferSize\r
+  );\r
+\r
+/**\r
+  Send a security protocol command to a device.\r
+\r
+  The SendData function sends a security protocol command containing the payload\r
+  PayloadBuffer to the given MediaId. The security protocol command sent is\r
+  defined by SecurityProtocolId and contains the security protocol specific data\r
+  SecurityProtocolSpecificData. If the underlying protocol command requires a\r
+  specific padding for the command payload, the SendData function shall add padding\r
+  bytes to the command payload to satisfy the padding requirements.\r
+\r
+  For devices supporting the SCSI command set, the security protocol command is sent\r
+  using the SECURITY PROTOCOL OUT command defined in SPC-4.\r
+\r
+  If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall\r
+  return EFI_INVALID_PARAMETER.\r
+\r
+  If the given MediaId does not support security protocol commands, the function\r
+  shall return EFI_UNSUPPORTED. If there is no media in the device, the function\r
+  returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the\r
+  device, the function returns EFI_MEDIA_CHANGED.\r
+\r
+  If the security protocol fails to complete within the Timeout period, the function\r
+  shall return EFI_TIMEOUT.\r
+\r
+  If the security protocol command completes without an error, the function shall return\r
+  EFI_SUCCESS. If the security protocol command completes with an error, the function\r
+  shall return EFI_DEVICE_ERROR.\r
+\r
+  @param  This                         Indicates a pointer to the calling context.\r
+  @param  MediaId                      ID of the medium to receive data from.\r
+  @param  Timeout                      The timeout, in 100ns units, to use for the execution\r
+                                       of the security protocol command. A Timeout value of 0\r
+                                       means that this function will wait indefinitely for the\r
+                                       security protocol command to execute. If Timeout is greater\r
+                                       than zero, then this function will return EFI_TIMEOUT if the\r
+                                       time required to execute the receive data command is greater than Timeout.\r
+  @param  SecurityProtocolId           The value of the "Security Protocol" parameter of\r
+                                       the security protocol command to be sent.\r
+  @param  SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r
+                                       of the security protocol command to be sent.\r
+  @param  PayloadBufferSize            Size in bytes of the payload data buffer.\r
+  @param  PayloadBuffer                A pointer to a destination buffer to store the security\r
+                                       protocol command specific payload data for the security\r
+                                       protocol command.\r
+\r
+  @retval EFI_SUCCESS                  The security protocol command completed successfully.\r
+  @retval EFI_UNSUPPORTED              The given MediaId does not support security protocol commands.\r
+  @retval EFI_DEVICE_ERROR             The security protocol command completed with an error.\r
+  @retval EFI_NO_MEDIA                 There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED            The MediaId is not for the current media.\r
+  @retval EFI_INVALID_PARAMETER        The PayloadBuffer is NULL and PayloadBufferSize is non-zero.\r
+  @retval EFI_TIMEOUT                  A timeout occurred while waiting for the security\r
+                                       protocol command to execute.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ScsiDiskSendData (\r
+  IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL  *This,\r
+  IN UINT32                                 MediaId   OPTIONAL,\r
+  IN UINT64                                 Timeout,\r
+  IN UINT8                                  SecurityProtocolId,\r
+  IN UINT16                                 SecurityProtocolSpecificData,\r
+  IN UINTN                                  PayloadBufferSize,\r
+  OUT VOID                                  *PayloadBuffer\r
+  );\r
 \r
 /**\r
   Provides inquiry information for the controller type.\r
@@ -663,12 +810,11 @@ ScsiDiskEraseBlocks (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskInfoInquiry (\r
-  IN     EFI_DISK_INFO_PROTOCOL   *This,\r
-  IN OUT VOID                     *InquiryData,\r
-  IN OUT UINT32                   *InquiryDataSize\r
+  IN     EFI_DISK_INFO_PROTOCOL  *This,\r
+  IN OUT VOID                    *InquiryData,\r
+  IN OUT UINT32                  *InquiryDataSize\r
   );\r
 \r
-\r
 /**\r
   Provides identify information for the controller type.\r
 \r
@@ -690,12 +836,11 @@ ScsiDiskInfoInquiry (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskInfoIdentify (\r
-  IN     EFI_DISK_INFO_PROTOCOL   *This,\r
-  IN OUT VOID                     *IdentifyData,\r
-  IN OUT UINT32                   *IdentifyDataSize\r
+  IN     EFI_DISK_INFO_PROTOCOL  *This,\r
+  IN OUT VOID                    *IdentifyData,\r
+  IN OUT UINT32                  *IdentifyDataSize\r
   );\r
 \r
-\r
 /**\r
   Provides sense data information for the controller type.\r
 \r
@@ -716,10 +861,10 @@ ScsiDiskInfoIdentify (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskInfoSenseData (\r
-  IN     EFI_DISK_INFO_PROTOCOL   *This,\r
-  IN OUT VOID                     *SenseData,\r
-  IN OUT UINT32                   *SenseDataSize,\r
-  OUT    UINT8                    *SenseDataNumber\r
+  IN     EFI_DISK_INFO_PROTOCOL  *This,\r
+  IN OUT VOID                    *SenseData,\r
+  IN OUT UINT32                  *SenseDataSize,\r
+  OUT    UINT8                   *SenseDataNumber\r
   );\r
 \r
 /**\r
@@ -736,12 +881,11 @@ ScsiDiskInfoSenseData (
 EFI_STATUS\r
 EFIAPI\r
 ScsiDiskInfoWhichIde (\r
-  IN  EFI_DISK_INFO_PROTOCOL   *This,\r
-  OUT UINT32                   *IdeChannel,\r
-  OUT UINT32                   *IdeDevice\r
+  IN  EFI_DISK_INFO_PROTOCOL  *This,\r
+  OUT UINT32                  *IdeChannel,\r
+  OUT UINT32                  *IdeDevice\r
   );\r
 \r
-\r
 /**\r
   Detect Device and read out capacity ,if error occurs, parse the sense key.\r
 \r
@@ -755,9 +899,9 @@ ScsiDiskInfoWhichIde (
 **/\r
 EFI_STATUS\r
 ScsiDiskDetectMedia (\r
-  IN   SCSI_DISK_DEV   *ScsiDiskDevice,\r
-  IN   BOOLEAN         MustReadCapacity,\r
-  OUT  BOOLEAN         *MediaChange\r
+  IN   SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  IN   BOOLEAN        MustReadCapacity,\r
+  OUT  BOOLEAN        *MediaChange\r
   );\r
 \r
 /**\r
@@ -778,13 +922,12 @@ ScsiDiskDetectMedia (
 **/\r
 EFI_STATUS\r
 ScsiDiskTestUnitReady (\r
-  IN  SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  OUT BOOLEAN               *NeedRetry,\r
-  OUT EFI_SCSI_SENSE_DATA   **SenseDataArray,\r
-  OUT UINTN                 *NumberOfSenseKeys\r
+  IN  SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  OUT BOOLEAN              *NeedRetry,\r
+  OUT EFI_SCSI_SENSE_DATA  **SenseDataArray,\r
+  OUT UINTN                *NumberOfSenseKeys\r
   );\r
 \r
-\r
 /**\r
   Parsing Sense Keys which got from request sense command.\r
 \r
@@ -799,13 +942,12 @@ ScsiDiskTestUnitReady (
 **/\r
 EFI_STATUS\r
 DetectMediaParsingSenseKeys (\r
-  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-  IN   EFI_SCSI_SENSE_DATA     *SenseData,\r
-  IN   UINTN                   NumberOfSenseKeys,\r
-  OUT  UINTN                   *Action\r
+  OUT  SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  IN   EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN   UINTN                NumberOfSenseKeys,\r
+  OUT  UINTN                *Action\r
   );\r
 \r
-\r
 /**\r
   Send read capacity command to device and get the device parameter.\r
 \r
@@ -820,10 +962,10 @@ DetectMediaParsingSenseKeys (
 **/\r
 EFI_STATUS\r
 ScsiDiskReadCapacity (\r
-  IN  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-      OUT  BOOLEAN                 *NeedRetry,\r
-      OUT  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
-      OUT  UINTN                   *NumberOfSenseKeys\r
+  IN  OUT  SCSI_DISK_DEV    *ScsiDiskDevice,\r
+  OUT  BOOLEAN              *NeedRetry,\r
+  OUT  EFI_SCSI_SENSE_DATA  **SenseDataArray,\r
+  OUT  UINTN                *NumberOfSenseKeys\r
   );\r
 \r
 /**\r
@@ -839,10 +981,9 @@ ScsiDiskReadCapacity (
 **/\r
 EFI_STATUS\r
 CheckHostAdapterStatus (\r
-  IN UINT8   HostAdapterStatus\r
+  IN UINT8  HostAdapterStatus\r
   );\r
 \r
-\r
 /**\r
   Check the target status and re-interpret it in EFI_STATUS.\r
 \r
@@ -855,7 +996,7 @@ CheckHostAdapterStatus (
 **/\r
 EFI_STATUS\r
 CheckTargetStatus (\r
-  IN  UINT8   TargetStatus\r
+  IN  UINT8  TargetStatus\r
   );\r
 \r
 /**\r
@@ -863,7 +1004,7 @@ CheckTargetStatus (
 \r
   When encountering error during the process, if retrieve sense keys before\r
   error encountered, it returns the sense keys with return status set to EFI_SUCCESS,\r
-  and NeedRetry set to FALSE; otherwize, return the proper return status.\r
+  and NeedRetry set to FALSE; otherwise, return the proper return status.\r
 \r
   @param  ScsiDiskDevice     The pointer of SCSI_DISK_DEV\r
   @param  NeedRetry          The pointer of flag indicates if need a retry\r
@@ -877,11 +1018,11 @@ CheckTargetStatus (
 **/\r
 EFI_STATUS\r
 ScsiDiskRequestSenseKeys (\r
-  IN  OUT  SCSI_DISK_DEV           *ScsiDiskDevice,\r
-      OUT  BOOLEAN                 *NeedRetry,\r
-      OUT  EFI_SCSI_SENSE_DATA     **SenseDataArray,\r
-      OUT  UINTN                   *NumberOfSenseKeys,\r
-  IN       BOOLEAN                 AskResetIfError\r
+  IN  OUT  SCSI_DISK_DEV    *ScsiDiskDevice,\r
+  OUT  BOOLEAN              *NeedRetry,\r
+  OUT  EFI_SCSI_SENSE_DATA  **SenseDataArray,\r
+  OUT  UINTN                *NumberOfSenseKeys,\r
+  IN       BOOLEAN          AskResetIfError\r
   );\r
 \r
 /**\r
@@ -896,8 +1037,8 @@ ScsiDiskRequestSenseKeys (
 **/\r
 EFI_STATUS\r
 ScsiDiskInquiryDevice (\r
-  IN OUT  SCSI_DISK_DEV   *ScsiDiskDevice,\r
-     OUT  BOOLEAN         *NeedRetry\r
+  IN OUT  SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  OUT  BOOLEAN           *NeedRetry\r
   );\r
 \r
 /**\r
@@ -908,7 +1049,7 @@ ScsiDiskInquiryDevice (
 **/\r
 VOID\r
 ParseInquiryData (\r
-  IN OUT SCSI_DISK_DEV   *ScsiDiskDevice\r
+  IN OUT SCSI_DISK_DEV  *ScsiDiskDevice\r
   );\r
 \r
 /**\r
@@ -925,10 +1066,10 @@ ParseInquiryData (
 **/\r
 EFI_STATUS\r
 ScsiDiskReadSectors (\r
-  IN   SCSI_DISK_DEV     *ScsiDiskDevice,\r
-  OUT  VOID              *Buffer,\r
-  IN   EFI_LBA           Lba,\r
-  IN   UINTN             NumberOfBlocks\r
+  IN   SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  OUT  VOID           *Buffer,\r
+  IN   EFI_LBA        Lba,\r
+  IN   UINTN          NumberOfBlocks\r
   );\r
 \r
 /**\r
@@ -945,10 +1086,10 @@ ScsiDiskReadSectors (
 **/\r
 EFI_STATUS\r
 ScsiDiskWriteSectors (\r
-  IN  SCSI_DISK_DEV     *ScsiDiskDevice,\r
-  IN  VOID              *Buffer,\r
-  IN  EFI_LBA           Lba,\r
-  IN  UINTN             NumberOfBlocks\r
+  IN  SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  IN  VOID           *Buffer,\r
+  IN  EFI_LBA        Lba,\r
+  IN  UINTN          NumberOfBlocks\r
   );\r
 \r
 /**\r
@@ -968,11 +1109,11 @@ ScsiDiskWriteSectors (
 **/\r
 EFI_STATUS\r
 ScsiDiskAsyncReadSectors (\r
-  IN   SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  OUT  VOID                  *Buffer,\r
-  IN   EFI_LBA               Lba,\r
-  IN   UINTN                 NumberOfBlocks,\r
-  IN   EFI_BLOCK_IO2_TOKEN   *Token\r
+  IN   SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  OUT  VOID                 *Buffer,\r
+  IN   EFI_LBA              Lba,\r
+  IN   UINTN                NumberOfBlocks,\r
+  IN   EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
 /**\r
@@ -992,11 +1133,11 @@ ScsiDiskAsyncReadSectors (
 **/\r
 EFI_STATUS\r
 ScsiDiskAsyncWriteSectors (\r
-  IN  SCSI_DISK_DEV          *ScsiDiskDevice,\r
-  IN  VOID                   *Buffer,\r
-  IN  EFI_LBA                Lba,\r
-  IN  UINTN                  NumberOfBlocks,\r
-  IN  EFI_BLOCK_IO2_TOKEN    *Token\r
+  IN  SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  IN  VOID                 *Buffer,\r
+  IN  EFI_LBA              Lba,\r
+  IN  UINTN                NumberOfBlocks,\r
+  IN  EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
 /**\r
@@ -1014,13 +1155,13 @@ ScsiDiskAsyncWriteSectors (
 **/\r
 EFI_STATUS\r
 ScsiDiskRead10 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-     OUT BOOLEAN               *NeedRetry,\r
-  IN     UINT64                Timeout,\r
-     OUT UINT8                 *DataBuffer,\r
-  IN OUT UINT32                *DataLength,\r
-  IN     UINT32                StartLba,\r
-  IN     UINT32                SectorCount\r
+  IN     SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  OUT BOOLEAN           *NeedRetry,\r
+  IN     UINT64         Timeout,\r
+  OUT UINT8             *DataBuffer,\r
+  IN OUT UINT32         *DataLength,\r
+  IN     UINT32         StartLba,\r
+  IN     UINT32         SectorCount\r
   );\r
 \r
 /**\r
@@ -1039,13 +1180,13 @@ ScsiDiskRead10 (
 **/\r
 EFI_STATUS\r
 ScsiDiskWrite10 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-     OUT BOOLEAN               *NeedRetry,\r
-  IN     UINT64                Timeout,\r
-  IN     UINT8                 *DataBuffer,\r
-  IN OUT UINT32                *DataLength,\r
-  IN     UINT32                StartLba,\r
-  IN     UINT32                SectorCount\r
+  IN     SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  OUT BOOLEAN           *NeedRetry,\r
+  IN     UINT64         Timeout,\r
+  IN     UINT8          *DataBuffer,\r
+  IN OUT UINT32         *DataLength,\r
+  IN     UINT32         StartLba,\r
+  IN     UINT32         SectorCount\r
   );\r
 \r
 /**\r
@@ -1063,13 +1204,13 @@ ScsiDiskWrite10 (
 **/\r
 EFI_STATUS\r
 ScsiDiskRead16 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-     OUT BOOLEAN               *NeedRetry,\r
-  IN     UINT64                Timeout,\r
-     OUT UINT8                 *DataBuffer,\r
-  IN OUT UINT32                *DataLength,\r
-  IN     UINT64                StartLba,\r
-  IN     UINT32                SectorCount\r
+  IN     SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  OUT BOOLEAN           *NeedRetry,\r
+  IN     UINT64         Timeout,\r
+  OUT UINT8             *DataBuffer,\r
+  IN OUT UINT32         *DataLength,\r
+  IN     UINT64         StartLba,\r
+  IN     UINT32         SectorCount\r
   );\r
 \r
 /**\r
@@ -1088,13 +1229,13 @@ ScsiDiskRead16 (
 **/\r
 EFI_STATUS\r
 ScsiDiskWrite16 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-     OUT BOOLEAN               *NeedRetry,\r
-  IN     UINT64                Timeout,\r
-  IN     UINT8                 *DataBuffer,\r
-  IN OUT UINT32                *DataLength,\r
-  IN     UINT64                StartLba,\r
-  IN     UINT32                SectorCount\r
+  IN     SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  OUT BOOLEAN           *NeedRetry,\r
+  IN     UINT64         Timeout,\r
+  IN     UINT8          *DataBuffer,\r
+  IN OUT UINT32         *DataLength,\r
+  IN     UINT64         StartLba,\r
+  IN     UINT32         SectorCount\r
   );\r
 \r
 /**\r
@@ -1119,15 +1260,15 @@ ScsiDiskWrite16 (
 **/\r
 EFI_STATUS\r
 ScsiDiskAsyncRead10 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  IN     UINT64                Timeout,\r
-  IN     UINT8                 TimesRetry,\r
-     OUT UINT8                 *DataBuffer,\r
-  IN     UINT32                DataLength,\r
-  IN     UINT32                StartLba,\r
-  IN     UINT32                SectorCount,\r
-  IN OUT SCSI_BLKIO2_REQUEST   *BlkIo2Req,\r
-  IN     EFI_BLOCK_IO2_TOKEN   *Token\r
+  IN     SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  IN     UINT64               Timeout,\r
+  IN     UINT8                TimesRetry,\r
+  OUT UINT8                   *DataBuffer,\r
+  IN     UINT32               DataLength,\r
+  IN     UINT32               StartLba,\r
+  IN     UINT32               SectorCount,\r
+  IN OUT SCSI_BLKIO2_REQUEST  *BlkIo2Req,\r
+  IN     EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
 /**\r
@@ -1152,15 +1293,15 @@ ScsiDiskAsyncRead10 (
 **/\r
 EFI_STATUS\r
 ScsiDiskAsyncWrite10 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  IN     UINT64                Timeout,\r
-  IN     UINT8                 TimesRetry,\r
-  IN     UINT8                 *DataBuffer,\r
-  IN     UINT32                DataLength,\r
-  IN     UINT32                StartLba,\r
-  IN     UINT32                SectorCount,\r
-  IN OUT SCSI_BLKIO2_REQUEST   *BlkIo2Req,\r
-  IN     EFI_BLOCK_IO2_TOKEN   *Token\r
+  IN     SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  IN     UINT64               Timeout,\r
+  IN     UINT8                TimesRetry,\r
+  IN     UINT8                *DataBuffer,\r
+  IN     UINT32               DataLength,\r
+  IN     UINT32               StartLba,\r
+  IN     UINT32               SectorCount,\r
+  IN OUT SCSI_BLKIO2_REQUEST  *BlkIo2Req,\r
+  IN     EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
 /**\r
@@ -1185,15 +1326,15 @@ ScsiDiskAsyncWrite10 (
 **/\r
 EFI_STATUS\r
 ScsiDiskAsyncRead16 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  IN     UINT64                Timeout,\r
-  IN     UINT8                 TimesRetry,\r
-     OUT UINT8                 *DataBuffer,\r
-  IN     UINT32                DataLength,\r
-  IN     UINT64                StartLba,\r
-  IN     UINT32                SectorCount,\r
-  IN OUT SCSI_BLKIO2_REQUEST   *BlkIo2Req,\r
-  IN     EFI_BLOCK_IO2_TOKEN   *Token\r
+  IN     SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  IN     UINT64               Timeout,\r
+  IN     UINT8                TimesRetry,\r
+  OUT UINT8                   *DataBuffer,\r
+  IN     UINT32               DataLength,\r
+  IN     UINT64               StartLba,\r
+  IN     UINT32               SectorCount,\r
+  IN OUT SCSI_BLKIO2_REQUEST  *BlkIo2Req,\r
+  IN     EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
 /**\r
@@ -1218,15 +1359,15 @@ ScsiDiskAsyncRead16 (
 **/\r
 EFI_STATUS\r
 ScsiDiskAsyncWrite16 (\r
-  IN     SCSI_DISK_DEV         *ScsiDiskDevice,\r
-  IN     UINT64                Timeout,\r
-  IN     UINT8                 TimesRetry,\r
-  IN     UINT8                 *DataBuffer,\r
-  IN     UINT32                DataLength,\r
-  IN     UINT64                StartLba,\r
-  IN     UINT32                SectorCount,\r
-  IN OUT SCSI_BLKIO2_REQUEST   *BlkIo2Req,\r
-  IN     EFI_BLOCK_IO2_TOKEN   *Token\r
+  IN     SCSI_DISK_DEV        *ScsiDiskDevice,\r
+  IN     UINT64               Timeout,\r
+  IN     UINT8                TimesRetry,\r
+  IN     UINT8                *DataBuffer,\r
+  IN     UINT32               DataLength,\r
+  IN     UINT64               StartLba,\r
+  IN     UINT32               SectorCount,\r
+  IN OUT SCSI_BLKIO2_REQUEST  *BlkIo2Req,\r
+  IN     EFI_BLOCK_IO2_TOKEN  *Token\r
   );\r
 \r
 /**\r
@@ -1254,8 +1395,8 @@ GetMediaInfo (
 **/\r
 BOOLEAN\r
 ScsiDiskIsNoMedia (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts\r
   );\r
 \r
 /**\r
@@ -1270,8 +1411,8 @@ ScsiDiskIsNoMedia (
 **/\r
 BOOLEAN\r
 ScsiDiskIsMediaError (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts\r
   );\r
 \r
 /**\r
@@ -1286,8 +1427,8 @@ ScsiDiskIsMediaError (
 **/\r
 BOOLEAN\r
 ScsiDiskIsHardwareError (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts\r
   );\r
 \r
 /**\r
@@ -1297,12 +1438,12 @@ ScsiDiskIsHardwareError (
   @param  SenseCounts  The number of sense key\r
 \r
   @retval TRUE   Media is changed.\r
-  @retval FALSE  Medit is NOT changed.\r
+  @retval FALSE  Media is NOT changed.\r
 **/\r
 BOOLEAN\r
 ScsiDiskIsMediaChange (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts\r
   );\r
 \r
 /**\r
@@ -1317,8 +1458,8 @@ ScsiDiskIsMediaChange (
 **/\r
 BOOLEAN\r
 ScsiDiskIsResetBefore (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts\r
   );\r
 \r
 /**\r
@@ -1334,9 +1475,9 @@ ScsiDiskIsResetBefore (
 **/\r
 BOOLEAN\r
 ScsiDiskIsDriveReady (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts,\r
-  OUT BOOLEAN               *RetryLater\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts,\r
+  OUT BOOLEAN              *RetryLater\r
   );\r
 \r
 /**\r
@@ -1351,8 +1492,8 @@ ScsiDiskIsDriveReady (
 **/\r
 BOOLEAN\r
 ScsiDiskHaveSenseKey (\r
-  IN  EFI_SCSI_SENSE_DATA   *SenseData,\r
-  IN  UINTN                 SenseCounts\r
+  IN  EFI_SCSI_SENSE_DATA  *SenseData,\r
+  IN  UINTN                SenseCounts\r
   );\r
 \r
 /**\r
@@ -1363,7 +1504,7 @@ ScsiDiskHaveSenseKey (
 **/\r
 VOID\r
 ReleaseScsiDiskDeviceResources (\r
-  IN  SCSI_DISK_DEV   *ScsiDiskDevice\r
+  IN  SCSI_DISK_DEV  *ScsiDiskDevice\r
   );\r
 \r
 /**\r
@@ -1378,7 +1519,7 @@ ReleaseScsiDiskDeviceResources (
 **/\r
 BOOLEAN\r
 DetermineInstallBlockIo (\r
-  IN  EFI_HANDLE      ChildHandle\r
+  IN  EFI_HANDLE  ChildHandle\r
   );\r
 \r
 /**\r
@@ -1395,8 +1536,8 @@ DetermineInstallBlockIo (
 **/\r
 VOID\r
 InitializeInstallDiskInfo (\r
-  IN  SCSI_DISK_DEV   *ScsiDiskDevice,\r
-  IN  EFI_HANDLE      ChildHandle\r
+  IN  SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  IN  EFI_HANDLE     ChildHandle\r
   );\r
 \r
 /**\r
@@ -1414,8 +1555,8 @@ InitializeInstallDiskInfo (
 VOID *\r
 EFIAPI\r
 GetParentProtocol (\r
-  IN  EFI_GUID                          *ProtocolGuid,\r
-  IN  EFI_HANDLE                        ChildHandle\r
+  IN  EFI_GUID    *ProtocolGuid,\r
+  IN  EFI_HANDLE  ChildHandle\r
   );\r
 \r
 /**\r
@@ -1430,8 +1571,24 @@ GetParentProtocol (
 **/\r
 BOOLEAN\r
 DetermineInstallEraseBlock (\r
-  IN  SCSI_DISK_DEV          *ScsiDiskDevice,\r
-  IN  EFI_HANDLE             ChildHandle\r
+  IN  SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  IN  EFI_HANDLE     ChildHandle\r
+  );\r
+\r
+/**\r
+  Determine if EFI Storage Security Command Protocol should be produced.\r
+\r
+  @param   ScsiDiskDevice    The pointer of SCSI_DISK_DEV.\r
+  @param   ChildHandle       Handle of device.\r
+\r
+  @retval  TRUE    Should produce EFI Storage Security Command Protocol.\r
+  @retval  FALSE   Should not produce EFI Storage Security Command Protocol.\r
+\r
+**/\r
+BOOLEAN\r
+DetermineInstallStorageSecurity (\r
+  IN  SCSI_DISK_DEV  *ScsiDiskDevice,\r
+  IN  EFI_HANDLE     ChildHandle\r
   );\r
 \r
 #endif\r