EFI_SCSI_IO_PROTOCOL has alignment requirement on any data buffer
used in SCSI data transfer. As a wrap of this protocol, UefiScsiLib
have same request. Adding EFI_INVALID_PARAMETER return status in
function comments to ask the caller to guarantee this alignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <[email protected]>
Cc: Star Zeng <[email protected]>
---
 MdePkg/Include/Library/UefiScsiLib.h     | 379 ++++++++++++++++++------------
 MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 385 +++++++++++++++++++------------
 2 files changed, 469 insertions(+), 295 deletions(-)

diff --git a/MdePkg/Include/Library/UefiScsiLib.h 
b/MdePkg/Include/Library/UefiScsiLib.h
index 768a912..26e4aa4 100644
--- a/MdePkg/Include/Library/UefiScsiLib.h
+++ b/MdePkg/Include/Library/UefiScsiLib.h
@@ -5,7 +5,7 @@
   for hard drive, CD and DVD devices that are the most common SCSI boot 
targets used by UEFI platforms.
   This library class depends on SCSI I/O Protocol defined in UEFI 
Specification and SCSI-2 industry standard.
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials                          
 are licensed and made available under the terms and conditions of the BSD 
License         
 which accompanies this distribution.  The full text of the license may be 
found at        
@@ -32,6 +32,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
   If HostAdapterStatus is NULL, then ASSERT().
   If TargetStatus is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]     ScsiIo             A pointer to the SCSI I/O Protocol instance
                                     for the specific SCSI target.
@@ -61,27 +64,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
                                     Protocol in the UEFI Specification for 
details on
                                     the possible return values. 
 
-  @retval EFI_SUCCESS          The command was executed successfully.
-                               See HostAdapterStatus, TargetStatus, 
SenseDataLength,
-                               and SenseData in that order for additional 
status
-                               information.
-  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent 
because
-                               there are too many SCSI Command Packets already
-                               queued. The SCSI Request Packet was not sent, so
-                               no additional status information is available.
-                               The caller may retry again later.
-  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to send
-                               SCSI Request Packet.  See HostAdapterStatus,
-                               TargetStatus, SenseDataLength, and SenseData in 
that
-                               order for additional status information.
-  @retval EFI_UNSUPPORTED      The command described by the SCSI Request Packet
-                               is not supported by the SCSI initiator(i.e., 
SCSI
-                               Host Controller). The SCSI Request Packet was 
not
-                               sent, so no additional status information is 
available.
-  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request
-                               Packet to execute.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order for
-                               additional status information.
+  @retval EFI_SUCCESS               The command was executed successfully.
+                                    See HostAdapterStatus, TargetStatus, 
SenseDataLength,
+                                    and SenseData in that order for additional 
status
+                                    information.
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent 
because
+                                    there are too many SCSI Command Packets 
already
+                                    queued. The SCSI Request Packet was not 
sent, so
+                                    no additional status information is 
available.
+                                    The caller may retry again later.
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting 
to send
+                                    SCSI Request Packet.  See 
HostAdapterStatus,
+                                    TargetStatus, SenseDataLength, and 
SenseData in that
+                                    order for additional status information.
+  @retval EFI_UNSUPPORTED           The command described by the SCSI Request 
Packet
+                                    is not supported by the SCSI 
initiator(i.e., SCSI
+                                    Host Controller). The SCSI Request Packet 
was not
+                                    sent, so no additional status information 
is available.
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the 
SCSI Request
+                                    Packet to execute.  See HostAdapterStatus, 
TargetStatus,
+                                    SenseDataLength, and SenseData in that 
order for
+                                    additional status information.
+  @retval EFI_INVALID_PARAMETER     The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -108,6 +112,14 @@ ScsiTestUnitReadyCommand (
   If TargetStatus is NULL, then ASSERT().
   If InquiryDataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If InquiryDataLength is non-zero and InquiryDataBuffer is not NULL, 
InquiryDataBuffer
+  must meet buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. 
Otherwise
+  EFI_INVALID_PARAMETER gets returned.
+
   @param[in]      ScsiIo                 A pointer to the SCSI I/O Protocol 
instance
                                          for the specific SCSI target.
   @param[in]      Timeout                The timeout in 100 ns units to use 
for the
@@ -150,28 +162,29 @@ ScsiTestUnitReadyCommand (
                                          If FALSE, then the standard inquiry 
data is
                                          returned in InquiryDataBuffer. 
 
-  @retval EFI_SUCCESS          The command was executed successfully. See 
HostAdapterStatus,
-                               TargetStatus, SenseDataLength, and SenseData in 
that order
-                               for additional status information.
-  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire
-                               InquiryDataBuffer could not be transferred. The 
actual
-                               number of bytes transferred is returned in 
InquiryDataLength.
-  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there
-                               are too many SCSI Command Packets already 
queued.
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available. The caller may 
retry again later.
-  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI
-                               Request Packet.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order 
for additional
-                               status information.
-  @retval EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not
-                               supported by the SCSI initiator(i.e., SCSI  
Host Controller).
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available.
-  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request
-                               Packet to execute.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order for
-                               additional status information.
+  @retval EFI_SUCCESS                    The command was executed 
successfully. See HostAdapterStatus,
+                                         TargetStatus, SenseDataLength, and 
SenseData in that order
+                                         for additional status information.
+  @retval EFI_BAD_BUFFER_SIZE            The SCSI Request Packet was executed, 
but the entire
+                                         InquiryDataBuffer could not be 
transferred. The actual
+                                         number of bytes transferred is 
returned in InquiryDataLength.
+  @retval EFI_NOT_READY                  The SCSI Request Packet could not be 
sent because there
+                                         are too many SCSI Command Packets 
already queued.
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available. The 
caller may retry again later.
+  @retval EFI_DEVICE_ERROR               A device error occurred while 
attempting to send SCSI
+                                         Request Packet.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for additional
+                                         status information.
+  @retval EFI_UNSUPPORTED                The command described by the SCSI 
Request Packet is not
+                                         supported by the SCSI initiator(i.e., 
SCSI  Host Controller).
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available.
+  @retval EFI_TIMEOUT                    A timeout occurred while waiting for 
the SCSI Request
+                                         Packet to execute.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for
+                                         additional status information.
+  @retval EFI_INVALID_PARAMETER          The contents of the SCSI Request 
Packet are invalid.
 
 **/
 EFI_STATUS
@@ -201,6 +214,14 @@ ScsiInquiryCommand (
   If TargetStatus is NULL, then ASSERT().
   If InquiryDataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If InquiryDataLength is non-zero and InquiryDataBuffer is not NULL, 
InquiryDataBuffer
+  must meet buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. 
Otherwise
+  EFI_INVALID_PARAMETER gets returned.
+
   @param[in]      ScsiIo                 A pointer to the SCSI I/O Protocol 
instance
                                          for the specific SCSI target.
   @param[in]      Timeout                The timeout in 100 ns units to use 
for the
@@ -245,28 +266,29 @@ ScsiInquiryCommand (
   @param[in]      PageCode               The page code of the vital product 
data.
                                          It's ignored if 
EnableVitalProductData is FALSE.
 
-  @retval EFI_SUCCESS          The command executed successfully. See 
HostAdapterStatus,
-                               TargetStatus, SenseDataLength, and SenseData in 
that order
-                               for additional status information.
-  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire
-                               InquiryDataBuffer could not be transferred. The 
actual
-                               number of bytes transferred is returned in 
InquiryDataLength.
-  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there
-                               are too many SCSI Command Packets already 
queued.
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available. The caller may 
retry again later.
-  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI
-                               Request Packet.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order 
for additional
-                               status information.
-  @retval EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not
-                               supported by the SCSI initiator(i.e., SCSI  
Host Controller).
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available.
-  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request
-                               Packet to execute.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order for
-                               additional status information.
+  @retval EFI_SUCCESS                    The command executed successfully. 
See HostAdapterStatus,
+                                         TargetStatus, SenseDataLength, and 
SenseData in that order
+                                         for additional status information.
+  @retval EFI_BAD_BUFFER_SIZE            The SCSI Request Packet was executed, 
but the entire
+                                         InquiryDataBuffer could not be 
transferred. The actual
+                                         number of bytes transferred is 
returned in InquiryDataLength.
+  @retval EFI_NOT_READY                  The SCSI Request Packet could not be 
sent because there
+                                         are too many SCSI Command Packets 
already queued.
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available. The 
caller may retry again later.
+  @retval EFI_DEVICE_ERROR               A device error occurred while 
attempting to send SCSI
+                                         Request Packet.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for additional
+                                         status information.
+  @retval EFI_UNSUPPORTED                The command described by the SCSI 
Request Packet is not
+                                         supported by the SCSI initiator(i.e., 
SCSI  Host Controller).
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available.
+  @retval EFI_TIMEOUT                    A timeout occurred while waiting for 
the SCSI Request
+                                         Packet to execute.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for
+                                         additional status information.
+  @retval EFI_INVALID_PARAMETER          The contents of the SCSI Request 
Packet are invalid.
 
 **/
 EFI_STATUS
@@ -299,6 +321,13 @@ ScsiInquiryCommandEx (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]      ScsiIo             A pointer to the SCSI I/O Protocol 
instance
                                      for the specific SCSI target.
@@ -340,30 +369,31 @@ ScsiInquiryCommandEx (
   @param[in]      PageControl        Specifies the PC field of the CDB for 
this SCSI Command. 
   @param[in]      PageCode           Specifies the Page Control field of the 
CDB for this SCSI Command. 
 
-  @retval EFI_SUCCESS               The command was executed successfully.
-                                    See HostAdapterStatus, TargetStatus, 
SenseDataLength,
-                                    and SenseData in that order for additional 
status information.
-  @retval EFI_BAD_BUFFER_SIZE       The SCSI Request Packet was executed, but 
the
-                                    entire DataBuffer could not be transferred.
-                                    The actual number of bytes transferred is 
returned
-                                    in DataLength.
-  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent 
because
-                                    there are too many SCSI Command Packets 
already queued.
-                                    The SCSI Request Packet was not sent, so 
no additional
-                                    status information is available.  The 
caller may retry
-                                    again later.
-  @retval EFI_DEVICE_ERROR          A device error occurred while attempting 
to send
-                                    SCSI Request Packet.  See 
HostAdapterStatus, TargetStatus,
-                                    SenseDataLength, and SenseData in that 
order for
-                                    additional status information.
-  @retval EFI_UNSUPPORTED           The command described by the SCSI Request 
Packet
-                                    is not supported by the SCSI 
initiator(i.e., SCSI
-                                    Host Controller). The SCSI Request Packet 
was not
-                                    sent, so no additional status information 
is available.
-  @retval EFI_TIMEOUT               A timeout occurred while waiting for the 
SCSI
-                                    Request Packet to execute.  See 
HostAdapterStatus,
-                                    TargetStatus, SenseDataLength, and 
SenseData in that
-                                    order for additional status information.
+  @retval EFI_SUCCESS                The command was executed successfully.
+                                     See HostAdapterStatus, TargetStatus, 
SenseDataLength,
+                                     and SenseData in that order for 
additional status information.
+  @retval EFI_BAD_BUFFER_SIZE        The SCSI Request Packet was executed, but 
the
+                                     entire DataBuffer could not be 
transferred.
+                                     The actual number of bytes transferred is 
returned
+                                     in DataLength.
+  @retval EFI_NOT_READY              The SCSI Request Packet could not be sent 
because
+                                     there are too many SCSI Command Packets 
already queued.
+                                     The SCSI Request Packet was not sent, so 
no additional
+                                     status information is available.  The 
caller may retry
+                                     again later.
+  @retval EFI_DEVICE_ERROR           A device error occurred while attempting 
to send
+                                     SCSI Request Packet.  See 
HostAdapterStatus, TargetStatus,
+                                     SenseDataLength, and SenseData in that 
order for
+                                     additional status information.
+  @retval EFI_UNSUPPORTED            The command described by the SCSI Request 
Packet
+                                     is not supported by the SCSI 
initiator(i.e., SCSI
+                                     Host Controller). The SCSI Request Packet 
was not
+                                     sent, so no additional status information 
is available.
+  @retval EFI_TIMEOUT                A timeout occurred while waiting for the 
SCSI
+                                     Request Packet to execute.  See 
HostAdapterStatus,
+                                     TargetStatus, SenseDataLength, and 
SenseData in that
+                                     order for additional status information.
+  @retval EFI_INVALID_PARAMETER      The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -395,6 +425,10 @@ ScsiModeSense10Command (
   If HostAdapterStatus is NULL, then ASSERT().
   If TargetStatus is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]       ScsiIo               A pointer to SCSI IO protocol.
   @param[in]       Timeout              The length of timeout period.
   @param[in, out]  SenseData            A pointer to output sense data.
@@ -409,6 +443,7 @@ ScsiModeSense10Command (
   @retval EFI_UNSUPPORTED               The command described by the SCSI 
Request Packet is not supported by
                                         the SCSI initiator(i.e., SCSI  Host 
Controller)
   @retval EFI_TIMEOUT                   A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval EFI_INVALID_PARAMETER         The contents of the SCSI Request 
Packet are invalid.
 
 **/
 EFI_STATUS
@@ -436,6 +471,14 @@ ScsiRequestSenseCommand (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -446,16 +489,17 @@ ScsiRequestSenseCommand (
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      Pmi                  Partial medium indicator.
 
-  @retval  EFI_SUCCESS           Command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was executed, but the 
entire
-                                 DataBuffer could not be transferred. The 
actual
-                                 number of bytes transferred is returned in 
DataLength.
-  @retval  EFI_NOT_READY         The SCSI Request Packet could not be sent 
because
-                                 there are too many SCSI Command Packets 
already queued.
-  @retval  EFI_DEVICE_ERROR      A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED       The command described by the SCSI Request 
Packet
-                                 is not supported by the SCSI initiator(i.e., 
SCSI  Host Controller)
-  @retval  EFI_TIMEOUT           A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire
+                                       DataBuffer could not be transferred. 
The actual
+                                       number of bytes transferred is returned 
in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because
+                                       there are too many SCSI Command Packets 
already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet
+                                       is not supported by the SCSI 
initiator(i.e., SCSI  Host Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -486,6 +530,14 @@ ScsiReadCapacityCommand (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -496,16 +548,17 @@ ScsiReadCapacityCommand (
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      Pmi                  Partial medium indicator.
 
-  @retval  EFI_SUCCESS           Command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was executed, but the 
entire
-                                 DataBuffer could not be transferred. The 
actual
-                                 number of bytes transferred is returned in 
DataLength.
-  @retval  EFI_NOT_READY         The SCSI Request Packet could not be sent 
because
-                                 there are too many SCSI Command Packets 
already queued.
-  @retval  EFI_DEVICE_ERROR      A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED       The command described by the SCSI Request 
Packet
-                                 is not supported by the SCSI initiator(i.e., 
SCSI  Host Controller)
-  @retval  EFI_TIMEOUT           A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire
+                                       DataBuffer could not be transferred. 
The actual
+                                       number of bytes transferred is returned 
in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because
+                                       there are too many SCSI Command Packets 
already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet
+                                       is not supported by the SCSI 
initiator(i.e., SCSI  Host Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -537,6 +590,13 @@ ScsiReadCapacity16Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
@@ -549,15 +609,16 @@ ScsiReadCapacity16Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          Command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -590,6 +651,14 @@ ScsiRead10Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               SCSI IO Protocol to use
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -601,15 +670,16 @@ ScsiRead10Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          Command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -641,6 +711,13 @@ ScsiWrite10Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
@@ -653,15 +730,16 @@ ScsiWrite10Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          Command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -694,6 +772,14 @@ ScsiRead16Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               SCSI IO Protocol to use
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -705,15 +791,16 @@ ScsiRead16Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          Command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c 
b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
index 8a073db..89f2617 100644
--- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
+++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI SCSI Library implementation
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials                          
   are licensed and made available under the terms and conditions of the BSD 
License         
   which accompanies this distribution.  The full text of the license may be 
found at        
@@ -42,6 +42,9 @@
   If HostAdapterStatus is NULL, then ASSERT().
   If TargetStatus is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]     ScsiIo             A pointer to the SCSI I/O Protocol instance
                                     for the specific SCSI target.
@@ -71,27 +74,28 @@
                                     Protocol in the UEFI Specification for 
details on
                                     the possible return values. 
 
-  @retval EFI_SUCCESS          The command was executed successfully.
-                               See HostAdapterStatus, TargetStatus, 
SenseDataLength,
-                               and SenseData in that order for additional 
status
-                               information.
-  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent 
because
-                               there are too many SCSI Command Packets already
-                               queued. The SCSI Request Packet was not sent, so
-                               no additional status information is available.
-                               The caller may retry again later.
-  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to send
-                               SCSI Request Packet.  See HostAdapterStatus,
-                               TargetStatus, SenseDataLength, and SenseData in 
that
-                               order for additional status information.
-  @retval EFI_UNSUPPORTED      The command described by the SCSI Request Packet
-                               is not supported by the SCSI initiator(i.e., 
SCSI
-                               Host Controller). The SCSI Request Packet was 
not
-                               sent, so no additional status information is 
available.
-  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request
-                               Packet to execute.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order for
-                               additional status information.
+  @retval EFI_SUCCESS               The command was executed successfully.
+                                    See HostAdapterStatus, TargetStatus, 
SenseDataLength,
+                                    and SenseData in that order for additional 
status
+                                    information.
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent 
because
+                                    there are too many SCSI Command Packets 
already
+                                    queued. The SCSI Request Packet was not 
sent, so
+                                    no additional status information is 
available.
+                                    The caller may retry again later.
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting 
to send
+                                    SCSI Request Packet.  See 
HostAdapterStatus,
+                                    TargetStatus, SenseDataLength, and 
SenseData in that
+                                    order for additional status information.
+  @retval EFI_UNSUPPORTED           The command described by the SCSI Request 
Packet
+                                    is not supported by the SCSI 
initiator(i.e., SCSI
+                                    Host Controller). The SCSI Request Packet 
was not
+                                    sent, so no additional status information 
is available.
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the 
SCSI Request
+                                    Packet to execute.  See HostAdapterStatus, 
TargetStatus,
+                                    SenseDataLength, and SenseData in that 
order for
+                                    additional status information.
+  @retval EFI_INVALID_PARAMETER     The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -153,6 +157,14 @@ ScsiTestUnitReadyCommand (
   If TargetStatus is NULL, then ASSERT().
   If InquiryDataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If InquiryDataLength is non-zero and InquiryDataBuffer is not NULL, 
InquiryDataBuffer
+  must meet buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. 
Otherwise
+  EFI_INVALID_PARAMETER gets returned.
+
   @param[in]      ScsiIo                 A pointer to the SCSI I/O Protocol 
instance
                                          for the specific SCSI target.
   @param[in]      Timeout                The timeout in 100 ns units to use 
for the
@@ -197,28 +209,29 @@ ScsiTestUnitReadyCommand (
   @param[in]      PageCode               The page code of the vital product 
data.
                                          It's ignored if 
EnableVitalProductData is FALSE.
 
-  @retval EFI_SUCCESS          The command executed successfully. See 
HostAdapterStatus,
-                               TargetStatus, SenseDataLength, and SenseData in 
that order
-                               for additional status information.
-  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire
-                               InquiryDataBuffer could not be transferred. The 
actual
-                               number of bytes transferred is returned in 
InquiryDataLength.
-  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there
-                               are too many SCSI Command Packets already 
queued.
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available. The caller may 
retry again later.
-  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI
-                               Request Packet.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order 
for additional
-                               status information.
-  @retval EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not
-                               supported by the SCSI initiator(i.e., SCSI  
Host Controller).
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available.
-  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request
-                               Packet to execute.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order for
-                               additional status information.
+  @retval EFI_SUCCESS                    The command executed successfully. 
See HostAdapterStatus,
+                                         TargetStatus, SenseDataLength, and 
SenseData in that order
+                                         for additional status information.
+  @retval EFI_BAD_BUFFER_SIZE            The SCSI Request Packet was executed, 
but the entire
+                                         InquiryDataBuffer could not be 
transferred. The actual
+                                         number of bytes transferred is 
returned in InquiryDataLength.
+  @retval EFI_NOT_READY                  The SCSI Request Packet could not be 
sent because there
+                                         are too many SCSI Command Packets 
already queued.
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available. The 
caller may retry again later.
+  @retval EFI_DEVICE_ERROR               A device error occurred while 
attempting to send SCSI
+                                         Request Packet.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for additional
+                                         status information.
+  @retval EFI_UNSUPPORTED                The command described by the SCSI 
Request Packet is not
+                                         supported by the SCSI initiator(i.e., 
SCSI  Host Controller).
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available.
+  @retval EFI_TIMEOUT                    A timeout occurred while waiting for 
the SCSI Request
+                                         Packet to execute.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for
+                                         additional status information.
+  @retval EFI_INVALID_PARAMETER          The contents of the SCSI Request 
Packet are invalid.
 
 **/
 EFI_STATUS
@@ -293,6 +306,14 @@ ScsiInquiryCommandEx (
   If TargetStatus is NULL, then ASSERT().
   If InquiryDataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If InquiryDataLength is non-zero and InquiryDataBuffer is not NULL, 
InquiryDataBuffer
+  must meet buffer alignment requirement defined in EFI_SCSI_IO_PROTOCOL. 
Otherwise
+  EFI_INVALID_PARAMETER gets returned.
+
   @param[in]      ScsiIo                 A pointer to the SCSI I/O Protocol 
instance
                                          for the specific SCSI target.
   @param[in]      Timeout                The timeout in 100 ns units to use 
for the
@@ -335,28 +356,29 @@ ScsiInquiryCommandEx (
                                          If FALSE, then the standard inquiry 
data is
                                          returned in InquiryDataBuffer. 
 
-  @retval EFI_SUCCESS          The command executed successfully. See 
HostAdapterStatus,
-                               TargetStatus, SenseDataLength, and SenseData in 
that order
-                               for additional status information.
-  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire
-                               InquiryDataBuffer could not be transferred. The 
actual
-                               number of bytes transferred is returned in 
InquiryDataLength.
-  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there
-                               are too many SCSI Command Packets already 
queued.
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available. The caller may 
retry again later.
-  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI
-                               Request Packet.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order 
for additional
-                               status information.
-  @retval EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not
-                               supported by the SCSI initiator(i.e., SCSI  
Host Controller).
-                               The SCSI Request Packet was not sent, so no 
additional
-                               status information is available.
-  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request
-                               Packet to execute.  See HostAdapterStatus, 
TargetStatus,
-                               SenseDataLength, and SenseData in that order for
-                               additional status information.
+  @retval EFI_SUCCESS                    The command was executed 
successfully. See HostAdapterStatus,
+                                         TargetStatus, SenseDataLength, and 
SenseData in that order
+                                         for additional status information.
+  @retval EFI_BAD_BUFFER_SIZE            The SCSI Request Packet was executed, 
but the entire
+                                         InquiryDataBuffer could not be 
transferred. The actual
+                                         number of bytes transferred is 
returned in InquiryDataLength.
+  @retval EFI_NOT_READY                  The SCSI Request Packet could not be 
sent because there
+                                         are too many SCSI Command Packets 
already queued.
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available. The 
caller may retry again later.
+  @retval EFI_DEVICE_ERROR               A device error occurred while 
attempting to send SCSI
+                                         Request Packet.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for additional
+                                         status information.
+  @retval EFI_UNSUPPORTED                The command described by the SCSI 
Request Packet is not
+                                         supported by the SCSI initiator(i.e., 
SCSI  Host Controller).
+                                         The SCSI Request Packet was not sent, 
so no additional
+                                         status information is available.
+  @retval EFI_TIMEOUT                    A timeout occurred while waiting for 
the SCSI Request
+                                         Packet to execute.  See 
HostAdapterStatus, TargetStatus,
+                                         SenseDataLength, and SenseData in 
that order for
+                                         additional status information.
+  @retval EFI_INVALID_PARAMETER          The contents of the SCSI Request 
Packet are invalid.
 
 **/
 EFI_STATUS
@@ -401,6 +423,13 @@ ScsiInquiryCommand (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]      ScsiIo             A pointer to the SCSI I/O Protocol 
instance
                                      for the specific SCSI target.
@@ -442,30 +471,31 @@ ScsiInquiryCommand (
   @param[in]      PageControl        Specifies the PC field of the CDB for 
this SCSI Command. 
   @param[in]      PageCode           Specifies the Page Control field of the 
CDB for this SCSI Command. 
 
-  @retval EFI_SUCCESS               The command executed successfully.
-                                    See HostAdapterStatus, TargetStatus, 
SenseDataLength,
-                                    and SenseData in that order for additional 
status information.
-  @retval EFI_BAD_BUFFER_SIZE       The SCSI Request Packet was executed, but 
the
-                                    entire DataBuffer could not be transferred.
-                                    The actual number of bytes transferred is 
returned
-                                    in DataLength.
-  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent 
because
-                                    there are too many SCSI Command Packets 
already queued.
-                                    The SCSI Request Packet was not sent, so 
no additional
-                                    status information is available.  The 
caller may retry
-                                    again later.
-  @retval EFI_DEVICE_ERROR          A device error occurred while attempting 
to send
-                                    SCSI Request Packet.  See 
HostAdapterStatus, TargetStatus,
-                                    SenseDataLength, and SenseData in that 
order for
-                                    additional status information.
-  @retval EFI_UNSUPPORTED           The command described by the SCSI Request 
Packet
-                                    is not supported by the SCSI 
initiator(i.e., SCSI
-                                    Host Controller). The SCSI Request Packet 
was not
-                                    sent, so no additional status information 
is available.
-  @retval EFI_TIMEOUT               A timeout occurred while waiting for the 
SCSI
-                                    Request Packet to execute.  See 
HostAdapterStatus,
-                                    TargetStatus, SenseDataLength, and 
SenseData in that
-                                    order for additional status information.
+  @retval EFI_SUCCESS                The command was executed successfully.
+                                     See HostAdapterStatus, TargetStatus, 
SenseDataLength,
+                                     and SenseData in that order for 
additional status information.
+  @retval EFI_BAD_BUFFER_SIZE        The SCSI Request Packet was executed, but 
the
+                                     entire DataBuffer could not be 
transferred.
+                                     The actual number of bytes transferred is 
returned
+                                     in DataLength.
+  @retval EFI_NOT_READY              The SCSI Request Packet could not be sent 
because
+                                     there are too many SCSI Command Packets 
already queued.
+                                     The SCSI Request Packet was not sent, so 
no additional
+                                     status information is available.  The 
caller may retry
+                                     again later.
+  @retval EFI_DEVICE_ERROR           A device error occurred while attempting 
to send
+                                     SCSI Request Packet.  See 
HostAdapterStatus, TargetStatus,
+                                     SenseDataLength, and SenseData in that 
order for
+                                     additional status information.
+  @retval EFI_UNSUPPORTED            The command described by the SCSI Request 
Packet
+                                     is not supported by the SCSI 
initiator(i.e., SCSI
+                                     Host Controller). The SCSI Request Packet 
was not
+                                     sent, so no additional status information 
is available.
+  @retval EFI_TIMEOUT                A timeout occurred while waiting for the 
SCSI
+                                     Request Packet to execute.  See 
HostAdapterStatus,
+                                     TargetStatus, SenseDataLength, and 
SenseData in that
+                                     order for additional status information.
+  @retval EFI_INVALID_PARAMETER      The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -543,6 +573,10 @@ ScsiModeSense10Command (
   If HostAdapterStatus is NULL, then ASSERT().
   If TargetStatus is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]       ScsiIo               A pointer to SCSI IO protocol.
   @param[in]       Timeout              The length of timeout period.
   @param[in, out]  SenseData            A pointer to output sense data.
@@ -550,13 +584,14 @@ ScsiModeSense10Command (
   @param[out]      HostAdapterStatus    The status of Host Adapter.
   @param[out]      TargetStatus         The status of the target.
 
-  @retval EFI_SUCCESS                   The command executed successfully.
+  @retval EFI_SUCCESS                   Command is executed successfully.
   @retval EFI_NOT_READY                 The SCSI Request Packet could not be 
sent because there are
                                         too many SCSI Command Packets already 
queued.
   @retval EFI_DEVICE_ERROR              A device error occurred while 
attempting to send SCSI Request Packet.
   @retval EFI_UNSUPPORTED               The command described by the SCSI 
Request Packet is not supported by
                                         the SCSI initiator(i.e., SCSI  Host 
Controller)
   @retval EFI_TIMEOUT                   A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval EFI_INVALID_PARAMETER         The contents of the SCSI Request 
Packet are invalid.
 
 **/
 EFI_STATUS
@@ -620,6 +655,14 @@ ScsiRequestSenseCommand (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -628,18 +671,19 @@ ScsiRequestSenseCommand (
   @param[out]     TargetStatus         The status of the target.
   @param[in, out] DataBuffer           A pointer to a data buffer.
   @param[in, out] DataLength           The length of data buffer.
-  @param[in]      Pmi                  A partial medium indicator.
-
-  @retval  EFI_SUCCESS           The command executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was executed, but the 
entire
-                                 DataBuffer could not be transferred. The 
actual
-                                 number of bytes transferred is returned in 
DataLength.
-  @retval  EFI_NOT_READY         The SCSI Request Packet could not be sent 
because
-                                 there are too many SCSI Command Packets 
already queued.
-  @retval  EFI_DEVICE_ERROR      A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED       The command described by the SCSI Request 
Packet
-                                 is not supported by the SCSI initiator(i.e., 
SCSI  Host Controller)
-  @retval  EFI_TIMEOUT           A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @param[in]      Pmi                  Partial medium indicator.
+
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire
+                                       DataBuffer could not be transferred. 
The actual
+                                       number of bytes transferred is returned 
in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because
+                                       there are too many SCSI Command Packets 
already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet
+                                       is not supported by the SCSI 
initiator(i.e., SCSI  Host Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -715,6 +759,14 @@ ScsiReadCapacityCommand (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -725,16 +777,17 @@ ScsiReadCapacityCommand (
   @param[in, out] DataLength           The length of data buffer.
   @param[in]      Pmi                  Partial medium indicator.
 
-  @retval  EFI_SUCCESS           The command executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was executed, but the 
entire
-                                 DataBuffer could not be transferred. The 
actual
-                                 number of bytes transferred is returned in 
DataLength.
-  @retval  EFI_NOT_READY         The SCSI Request Packet could not be sent 
because
-                                 there are too many SCSI Command Packets 
already queued.
-  @retval  EFI_DEVICE_ERROR      A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED       The command described by the SCSI Request 
Packet
-                                 is not supported by the SCSI initiator(i.e., 
SCSI  Host Controller)
-  @retval  EFI_TIMEOUT           A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire
+                                       DataBuffer could not be transferred. 
The actual
+                                       number of bytes transferred is returned 
in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because
+                                       there are too many SCSI Command Packets 
already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet
+                                       is not supported by the SCSI 
initiator(i.e., SCSI  Host Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -813,6 +866,13 @@ ScsiReadCapacity16Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
@@ -825,15 +885,16 @@ ScsiReadCapacity16Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          The command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -905,6 +966,14 @@ ScsiRead10Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               SCSI IO Protocol to use
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -916,15 +985,16 @@ ScsiRead10Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          The command executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -995,6 +1065,13 @@ ScsiWrite10Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
 
   @param[in]      ScsiIo               A pointer to SCSI IO protocol.
   @param[in]      Timeout              The length of timeout period.
@@ -1007,15 +1084,16 @@ ScsiWrite10Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          The command executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
@@ -1087,6 +1165,14 @@ ScsiRead16Command (
   If TargetStatus is NULL, then ASSERT().
   If DataLength is NULL, then ASSERT().
 
+  If SenseDataLength is non-zero and SenseData is not NULL, SenseData must 
meet buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
+  If DataLength is non-zero and DataBuffer is not NULL, DataBuffer must meet 
buffer
+  alignment requirement defined in EFI_SCSI_IO_PROTOCOL. Otherwise 
EFI_INVALID_PARAMETER
+  gets returned.
+
   @param[in]      ScsiIo               SCSI IO Protocol to use
   @param[in]      Timeout              The length of timeout period.
   @param[in, out] SenseData            A pointer to output sense data.
@@ -1098,15 +1184,16 @@ ScsiRead16Command (
   @param[in]      StartLba             The start address of LBA.
   @param[in]      SectorSize           The number of contiguous logical blocks 
of data that shall be transferred.
 
-  @retval  EFI_SUCCESS          The command is executed successfully.
-  @retval  EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the 
entire DataBuffer could
-                                not be transferred. The actual number of bytes 
transferred is returned in DataLength.
-  @retval  EFI_NOT_READY        The SCSI Request Packet could not be sent 
because there are too many 
-                                SCSI Command Packets already queued.
-  @retval  EFI_DEVICE_ERROR     A device error occurred while attempting to 
send SCSI Request Packet.
-  @retval  EFI_UNSUPPORTED      The command described by the SCSI Request 
Packet is not supported by 
-                                the SCSI initiator(i.e., SCSI  Host Controller)
-  @retval  EFI_TIMEOUT          A timeout occurred while waiting for the SCSI 
Request Packet to execute.
+  @retval  EFI_SUCCESS                 Command is executed successfully.
+  @retval  EFI_BAD_BUFFER_SIZE         The SCSI Request Packet was executed, 
but the entire DataBuffer could
+                                       not be transferred. The actual number 
of bytes transferred is returned in DataLength.
+  @retval  EFI_NOT_READY               The SCSI Request Packet could not be 
sent because there are too many
+                                       SCSI Command Packets already queued.
+  @retval  EFI_DEVICE_ERROR            A device error occurred while 
attempting to send SCSI Request Packet.
+  @retval  EFI_UNSUPPORTED             The command described by the SCSI 
Request Packet is not supported by
+                                       the SCSI initiator(i.e., SCSI  Host 
Controller)
+  @retval  EFI_TIMEOUT                 A timeout occurred while waiting for 
the SCSI Request Packet to execute.
+  @retval  EFI_INVALID_PARAMETER       The contents of the SCSI Request Packet 
are invalid.
 
 **/
 EFI_STATUS
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to