]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code Scrub:
authorjji4 <jji4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 Nov 2008 11:24:14 +0000 (11:24 +0000)
committerjji4 <jji4@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 Nov 2008 11:24:14 +0000 (11:24 +0000)
  The code of MdePkg\Library\UefiScsiLib\ and MdePkg\Library\UefiUsbLib has been checked and modified according to MDE_Library_Spec_0.61h-4.doc.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6561 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/UefiScsiLib.h
MdePkg/Include/Library/UefiUsbLib.h
MdePkg/Library/UefiScsiLib/UefiScsiLib.c
MdePkg/Library/UefiUsbLib/Hid.c
MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
MdePkg/Library/UefiUsbLib/UefiUsbLibInternal.h
MdePkg/Library/UefiUsbLib/UsbDxeLib.c

index f1d899d38b72bb7b8d5455b5250cddeb1ee085fe..d721735b46f2e5c18b3131051c0150a362f17809 100644 (file)
@@ -2,7 +2,7 @@
 \r
   Provides the functions to submit Scsi commands defined in SCSI-2 specification for scsi device.\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation<BR>\r
 All rights reserved. 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
@@ -34,189 +34,291 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 \r
 /**\r
-  Function test the ready status of the SCSI unit.\r
-\r
-  Submit SCSI test unit ready command with SCSI request packet specified by this scsi command, TimeOut\r
-  and SenseData, then get the status of the target Scsi unit.\r
+  Execute Test Unit Ready SCSI command on a specific SCSI target.\r
 \r
+  Executes the Test Unit Ready command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo             A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout            The length of timeout period.\r
-  @param[in]     SenseData          A pointer to output sense data.\r
-  @param[out]    SenseDataLength    The length of output sense data.\r
-  @param[out]    HostAdapterStatus  The status of Host Adapter.\r
-  @param[out]    TargetStatus       The status of the target.\r
-\r
-  @retval EFI_SUCCESS           The status of the unit is tested successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was executed, \r
-                                but the entire DataBuffer could not be transferred.\r
-                                The actual number of bytes transferred is returned\r
-                                in InTransferLength.\r
-  @retval EFI_NOT_READY         The SCSI Request Packet could not be sent because \r
-                                there are too many SCSI Command Packets already \r
-                                queued.\r
-  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to send \r
-                                the SCSI Request Packet.\r
-  @retval EFI_INVALID_PARAMETER ScsiIo is NULL.\r
-  @retval EFI_UNSUPPORTED       The command described by the SCSI Request Packet\r
-                                is not supported by the SCSI initiator(i.e., SCSI \r
-                                Host Controller).\r
-  @retval EFI_TIMEOUT           A timeout occurred while waiting for the SCSI \r
-                                Request Packet to execute.\r
+\r
+  @param[in]     ScsiIo             A pointer to the SCSI I/O Protocol instance\r
+                                    for the specific SCSI target.\r
+  @param[in]     Timeout            The timeout in 100 ns units to use for the execution\r
+                                    of this SCSI Request Packet. A Timeout value of\r
+                                    zero means that this function will wait indefinitely\r
+                                    for the SCSI Request Packet to execute. If Timeout\r
+                                    is greater than zero, then this function will return\r
+                                    EFI_TIMEOUT if the time required to execute the SCSI\r
+                                    Request Packet is greater than Timeout.\r
+  @param[in, out] SenseData         A pointer to sense data that was generated by\r
+                                    the execution of the SCSI Request Packet. This\r
+                                    buffer must be allocated by the caller.\r
+                                    If SenseDataLength is 0, then this parameter is\r
+                                    optional and may be NULL.\r
+  @param[in, out] SenseDataLength   On input, a pointer to the length in bytes of\r
+                                    the SenseData buffer. On output, a poiinter to\r
+                                    the number of bytes written to the SenseData buffer. \r
+  @param[out]     HostAdapterStatus The status of the SCSI Host Controller that produces\r
+                                    the SCSI bus containing the SCSI target specified by\r
+                                    ScsiIo when the SCSI Request Packet was executed.\r
+                                    See the EFI SCSI I/O Protocol in the UEFI Specification\r
+                                    for details on the possible return values.\r
+  @param[out]     TargetStatus      The status returned by the SCSI target specified\r
+                                    by ScsiIo when the SCSI Request Packat was executed\r
+                                    on the SCSI Host Controller. See the EFI SCSI I/O\r
+                                    Protocol in the UEFI Specification for details on\r
+                                    the possible return values. \r
+\r
+  @retval EFI_SUCCESS          The command was executed successfully.\r
+                               See HostAdapterStatus, TargetStatus, SenseDataLength,\r
+                               and SenseData in that order for additional status\r
+                               information.\r
+  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent because\r
+                               there are too many SCSI Command Packets already\r
+                               queued. The SCSI Request Packet was not sent, so\r
+                               no additional status information is available.\r
+                               The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to send\r
+                               SCSI Request Packet.  See HostAdapterStatus,\r
+                               TargetStatus, SenseDataLength, and SenseData in that\r
+                               order for additional status information.\r
+  @retval EFI_UNSUPPORTED      The command described by the SCSI Request Packet\r
+                               is not supported by the SCSI initiator(i.e., SCSI\r
+                               Host Controller). The SCSI Request Packet was not\r
+                               sent, so no additional status information is available.\r
+  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI Request\r
+                               Packet to execute.  See HostAdapterStatus, TargetStatus,\r
+                               SenseDataLength, and SenseData in that order for\r
+                               additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, \r
+                               but the entire DataBuffer could not be transferred.\r
+                               The actual number of bytes transferred is returned\r
+                               in InTransferLength.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiTestUnitReadyCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  OUT UINT8                 *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,  OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus\r
   );\r
 \r
 \r
 /**\r
-  Function to submit SCSI inquiry command.\r
-\r
-  Submit SCSI inquiry command with the SCSI request packet specified by this SCSI command and input\r
-  parameters, then return the status of Scsi unit execution.\r
+  Execute Inquiry SCSI command on a specific SCSI target.\r
 \r
+  Executes the Inquiry command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If InquiryDataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo             SCSI IO Protocol to use\r
-  @param[in]     Timeout            The length of timeout period.\r
-  @param[in]     SenseData          A pointer to output sense data.\r
-  @param[in, out] SenseDataLength    The length of output sense data.\r
-  @param[out]    HostAdapterStatus  The status of Host Adapter.\r
-  @param[out]    TargetStatus       The status of the target.\r
-  @param[in, out] InquiryDataBuffer  A pointer to inquiry data buffer.\r
-  @param[in, out] InquiryDataLength  The length of inquiry data buffer.\r
-  @param[in]     EnableVitalProductData  Boolean to enable Vital Product Data.\r
-\r
-  @retval EFI_SUCCESS                Command is executed successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE        The SCSI Request Packet was executed, \r
-                                     but the entire DataBuffer could not be transferred.\r
-                                     The actual number of bytes transferred is returned\r
-                                     in TransferLength.\r
-  @retval EFI_NOT_READY              The SCSI Request Packet could not be sent because \r
-                                     there are too many SCSI Command Packets already \r
-                                     queued.\r
-  @retval EFI_DEVICE_ERROR           A device error occurred while attempting to send \r
-                                     the SCSI Request Packet.\r
-  @retval EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
-  @retval EFI_UNSUPPORTED            The command described by the SCSI Request Packet\r
-                                     is not supported by the SCSI initiator(i.e., SCSI \r
-                                     Host Controller).\r
-  @retval EFI_TIMEOUT                A timeout occurred while waiting for the SCSI \r
-                                     Request Packet to execute.\r
+  @param[in]      ScsiIo                 A pointer to the SCSI I/O Protocol instance\r
+                                         for the specific SCSI target.\r
+  @param[in]      Timeout                The timeout in 100 ns units to use for the\r
+                                         execution of this SCSI Request Packet. A Timeout\r
+                                         value of zero means that this function will wait\r
+                                         indefinitely for the SCSI Request Packet to execute.\r
+                                         If Timeout is greater than zero, then this function\r
+                                         will return EFI_TIMEOUT if the time required to\r
+                                         execute the SCSI Request Packet is greater than Timeout.\r
+  @param[in, out] SenseData              A pointer to sense data that was generated\r
+                                         by the execution of the SCSI Request Packet.\r
+                                         This buffer must be allocated by the caller.\r
+                                         If SenseDataLength is 0, then this parameter\r
+                                         is optional and may be NULL.\r
+  @param[in, out] SenseDataLength        On input, the length in bytes of the SenseData buffer.\r
+                                         On output, the number of bytes written to the SenseData buffer. \r
+  @param[out]     HostAdapterStatus      The status of the SCSI Host Controller that\r
+                                         produces the SCSI bus containing the SCSI\r
+                                         target specified by ScsiIo when the SCSI\r
+                                         Request Packet was executed.  See the EFI\r
+                                         SCSI I/O Protocol in the UEFI Specification\r
+                                         for details on the possible return values.\r
+  @param[out]     TargetStatus           The status returned by the SCSI target specified\r
+                                         by ScsiIo when the SCSI Request Packat was\r
+                                         executed on the SCSI Host Controller.\r
+                                         See the EFI SCSI I/O Protocol in the UEFI\r
+                                         Specification for details on the possible\r
+                                         return values. \r
+  @param[in, out] InquiryDataBuffer      A pointer to inquiry data that was generated\r
+                                         by the execution of the SCSI Request Packet.\r
+                                         This buffer must be allocated by the caller.\r
+                                         If InquiryDataLength is 0, then this parameter\r
+                                         is optional and may be NULL. \r
+  @param[in, out] InquiryDataLength      On input, a pointer to the length in bytes\r
+                                         of the InquiryDataBuffer buffer.\r
+                                         On output, a pointer to the number of bytes\r
+                                         written to the InquiryDataBuffer buffer.\r
+  @param[in]      EnableVitalProductData If TRUE, then the supported vital product\r
+                                         data is returned in InquiryDataBuffer.\r
+                                         If FALSE, then the standard inquiry data is\r
+                                         returned in InquiryDataBuffer. \r
+\r
+  @retval EFI_SUCCESS          The command was executed successfully. See HostAdapterStatus,\r
+                               TargetStatus, SenseDataLength, and SenseData in that order\r
+                               for additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the entire\r
+                               InquiryDataBuffer could not be transferred. The actual\r
+                               number of bytes transferred is returned in InquiryDataLength.\r
+  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent because there\r
+                               are too many SCSI Command Packets already queued.\r
+                               The SCSI Request Packet was not sent, so no additional\r
+                               status information is available. The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to send SCSI\r
+                               Request Packet.  See HostAdapterStatus, TargetStatus,\r
+                               SenseDataLength, and SenseData in that order for additional\r
+                               status information.\r
+  @retval EFI_UNSUPPORTED      The command described by the SCSI Request Packet is not\r
+                               supported by the SCSI initiator(i.e., SCSI  Host Controller).\r
+                               The SCSI Request Packet was not sent, so no additional\r
+                               status information is available.\r
+  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI Request\r
+                               Packet to execute.  See HostAdapterStatus, TargetStatus,\r
+                               SenseDataLength, and SenseData in that order for\r
+                               additional status information.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiInquiryCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  IN OUT VOID               *InquiryDataBuffer,\r
-  IN OUT UINT32             *InquiryDataLength,\r
-  IN  BOOLEAN               EnableVitalProductData\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,  OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *InquiryDataBuffer,    OPTIONAL\r
+  IN OUT UINT32                *InquiryDataLength,\r
+  IN     BOOLEAN               EnableVitalProductData\r
   );\r
 \r
 \r
 /**\r
-  Function to submit SCSI mode sense 10 command.\r
-\r
-  Submit SCSI Mode Sense (10) command with the SCSI request packet specified by this SCSI command and\r
-  the input parameters, then return the status of Scsi unit execution.\r
-\r
+  Execute Mode Sense(10) SCSI command on a specific SCSI target.\r
+\r
+  Executes the SCSI Mode Sense(10) command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout\r
+  after Timeout 100 ns units.  The DBDField, PageControl, and PageCode parameters\r
+  are used to construct the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo             A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout            The length of timeout period.\r
-  @param[in]     SenseData          A pointer to output sense data.\r
-  @param[in, out] SenseDataLength    The length of output sense data.\r
-  @param[out]    HostAdapterStatus  The status of Host Adapter.\r
-  @param[out]    TargetStatus       The status of the target.\r
-  @param[in]     DataBuffer         A pointer to input data buffer.\r
-  @param[in, out] DataLength         The length of input data buffer.\r
-  @param[in]     DBDField           The DBD Field (Optional).\r
-  @param[in]     PageControl        Page Control.\r
-  @param[in]     PageCode           Page code.\r
-\r
-  @retval EFI_SUCCESS               The status of the unit is tested successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE       The SCSI Request Packet was executed, \r
-                                    but the entire DataBuffer could not be transferred.\r
+\r
+  @param[in]      ScsiIo             A pointer to the SCSI I/O Protocol instance\r
+                                     for the specific SCSI target.\r
+  @param[in]      Timeout            The timeout in 100 ns units to use for the\r
+                                     execution of this SCSI Request Packet. A Timeout\r
+                                     value of zero means that this function will wait\r
+                                     indefinitely for the SCSI Request Packet to execute.\r
+                                     If Timeout is greater than zero, then this function\r
+                                     will return EFI_TIMEOUT if the time required to\r
+                                     execute the SCSI Request Packet is greater than Timeout.\r
+  @param[in,out]  SenseData          A pointer to sense data that was generated\r
+                                     by the execution of the SCSI Request Packet.\r
+                                     This buffer must be allocated by the caller.\r
+                                     If SenseDataLength is 0, then this parameter\r
+                                     is optional and may be NULL.\r
+  @param[in,out]  SenseDataLength    On input, the length in bytes of the SenseData buffer.\r
+                                     On output, the number of bytes written to the SenseData buffer. \r
+  @param[out]     HostAdapterStatus  The status of the SCSI Host Controller that\r
+                                     produces the SCSI bus containing the SCSI target\r
+                                     specified by ScsiIo when the SCSI Request Packet\r
+                                     was executed. See the EFI SCSI I/O Protocol in the\r
+                                     UEFI Specification for details on the possible\r
+                                     return values.\r
+  @param[out]     TargetStatus       The status returned by the SCSI target specified\r
+                                     by ScsiIo when the SCSI Request Packat was executed\r
+                                     on the SCSI Host Controller.  See the EFI SCSI\r
+                                     I/O Protocol in the UEFI Specification for details\r
+                                     on the possible return values.\r
+  @param[in,out]  DataBuffer         A pointer to data that was generated by the\r
+                                     execution of the SCSI Request Packet.  This\r
+                                     buffer must be allocated by the caller. If\r
+                                     DataLength is 0, then this parameter is optional\r
+                                     and may be NULL. \r
+  @param[in,out]  DataLength         On input, a pointer to the length in bytes of\r
+                                     the DataBuffer buffer.  On output, a pointer\r
+                                     to the number of bytes written to the DataBuffer\r
+                                     buffer. \r
+  @param[in]      DBDField           Specifies the DBD field of the CDB for this SCSI Command.\r
+  @param[in]      PageControl        Specifies the PC field of the CDB for this SCSI Command. \r
+  @param[in]      PageCode           Specifies the Page Control field of the CDB for this SCSI Command. \r
+\r
+  @retval EFI_SUCCESS               The command was executed successfully.\r
+                                    See HostAdapterStatus, TargetStatus, SenseDataLength,\r
+                                    and SenseData in that order for additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE       The SCSI Request Packet was executed, but the\r
+                                    entire DataBuffer could not be transferred.\r
                                     The actual number of bytes transferred is returned\r
-                                    in TransferLength.\r
-  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because \r
-                                    there are too many SCSI Command Packets already \r
-                                    queued.\r
-  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send \r
-                                    the SCSI Request Packet.\r
-  @retval EFI_INVALID_PARAMETER     ScsiIo is NULL. \r
+                                    in DataLength.\r
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because\r
+                                    there are too many SCSI Command Packets already queued.\r
+                                    The SCSI Request Packet was not sent, so no additional\r
+                                    status information is available.  The caller may retry\r
+                                    again later.\r
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send\r
+                                    SCSI Request Packet.  See HostAdapterStatus, TargetStatus,\r
+                                    SenseDataLength, and SenseData in that order for\r
+                                    additional status information.\r
   @retval EFI_UNSUPPORTED           The command described by the SCSI Request Packet\r
-                                    is not supported by the SCSI initiator(i.e., SCSI \r
-                                    Host Controller).\r
-  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI \r
-                                    Request Packet to execute.\r
+                                    is not supported by the SCSI initiator(i.e., SCSI\r
+                                    Host Controller). The SCSI Request Packet was not\r
+                                    sent, so no additional status information is available.\r
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI\r
+                                    Request Packet to execute.  See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in that\r
+                                    order for additional status information.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiModeSense10Command (\r
-  IN  EFI_SCSI_IO_PROTOCOL    *ScsiIo,\r
-  IN  UINT64                  Timeout,\r
-  IN  VOID                    *SenseData,\r
-  IN OUT UINT8                *SenseDataLength,\r
-  OUT UINT8                   *HostAdapterStatus,\r
-  OUT UINT8                   *TargetStatus,\r
-  IN  VOID                    *DataBuffer,\r
-  IN OUT UINT32               *DataLength,\r
-  IN  UINT8                   DBDField, OPTIONAL\r
-  IN  UINT8                   PageControl,\r
-  IN  UINT8                   PageCode\r
+  IN     EFI_SCSI_IO_PROTOCOL    *ScsiIo,\r
+  IN     UINT64                  Timeout,\r
+  IN OUT VOID                    *SenseData,  OPTIONAL\r
+  IN OUT UINT8                   *SenseDataLength,\r
+     OUT UINT8                   *HostAdapterStatus,\r
+     OUT UINT8                   *TargetStatus,\r
+  IN OUT VOID                    *DataBuffer, OPTIONAL\r
+  IN OUT UINT32                  *DataLength,\r
+  IN     UINT8                   DBDField,    OPTIONAL\r
+  IN     UINT8                   PageControl,\r
+  IN     UINT8                   PageCode\r
   );\r
 \r
 \r
 \r
 /**\r
-  Function to submit SCSI request sense command.\r
-\r
-  Submit SCSI request sense command with the SCSI requested packet specified by this\r
-  SCSI command, TimeOut and SenseData, and then return the status of scsi unit execution.\r
+  Execute Request Sense SCSI command on a specific SCSI target.\r
 \r
+  Executes the Request Sense command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-  \r
   If HostAdapterStatus is NULL, then ASSERT().\r
-  \r
   If TargetStatus is NULL, then ASSERT().\r
 \r
   @param[in]       ScsiIo               A pointer to SCSI IO protocol.\r
   @param[in]       Timeout              The length of timeout period.\r
-  @param[in]       SenseData            A pointer to output sense data.\r
-  @param[in, out]   SenseDataLength      The length of output sense data.\r
+  @param[in, out]  SenseData            A pointer to output sense data.\r
+  @param[in, out]  SenseDataLength      The length of output sense data.\r
   @param[out]      HostAdapterStatus    The status of Host Adapter.\r
   @param[out]      TargetStatus         The status of the target.\r
 \r
@@ -227,44 +329,42 @@ ScsiModeSense10Command (
   @retval EFI_UNSUPPORTED               The command described by the SCSI Request Packet is not supported by\r
                                         the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval EFI_TIMEOUT                   A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval EFI_INVALID_PARAMETER         ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiRequestSenseCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,  OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus\r
   );\r
 \r
 \r
 /**\r
-  Function to submit read capacity command.\r
-\r
-  Submit SCSI read capacity command with the SCSI request packet specified by this SCSI \r
-  command and the input parameters, and then return the status of Scsi unit execution.\r
+  Execute Read Capacity SCSI command on a specific SCSI target.\r
 \r
+  Executes the SCSI Read Capacity command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after\r
+  Timeout 100 ns units.  The PMI parameter is used to construct the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo               A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout              The length of timeout period.\r
-  @param[in]     SenseData            A pointer to output sense data.\r
+  @param[in]      ScsiIo               A pointer to SCSI IO protocol.\r
+  @param[in]      Timeout              The length of timeout period.\r
+  @param[in, out] SenseData            A pointer to output sense data.\r
   @param[in, out] SenseDataLength      The length of output sense data.\r
-  @param[out]    HostAdapterStatus    The status of Host Adapter.\r
-  @param[out]    TargetStatus         The status of the target.\r
-  @param[out]    DataBuffer           A pointer to a data buffer.\r
+  @param[out]     HostAdapterStatus    The status of Host Adapter.\r
+  @param[out]     TargetStatus         The status of the target.\r
+  @param[in, out] DataBuffer           A pointer to a data buffer.\r
   @param[in, out] DataLength           The length of data buffer.\r
-  @param[in]     PMI                  Partial medium indicator.\r
+  @param[in]      PMI                  Partial medium indicator.\r
 \r
   @retval  EFI_SUCCESS                Command is executed successfully.\r
   @retval  EFI_WARN_BUFFER_TOO_SMALL  The SCSI Request Packet was executed, but the entire DataBuffer could\r
@@ -275,48 +375,48 @@ ScsiRequestSenseCommand (
   @retval  EFI_UNSUPPORTED            The command described by the SCSI Request Packet is not supported by \r
                                       the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval  EFI_TIMEOUT                A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval  EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiReadCapacityCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  OUT VOID                  *DataBuffer,\r
-  IN OUT UINT32             *DataLength,\r
-  IN  BOOLEAN               PMI\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,    OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *DataBuffer,   OPTIONAL\r
+  IN OUT UINT32                *DataLength,\r
+  IN     BOOLEAN               PMI\r
   );\r
 \r
 \r
 /**\r
-  Function to submit read 10 command.\r
-\r
-  Submit SCSI read (10) command with the SCSI request packet specified by this SCSI command \r
-  and the input parameters, and then return the status of Scsi unit execution.\r
-\r
+  Execute Read(10) SCSI command on a specific SCSI target.\r
+\r
+  Executes the SCSI Read(10) command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout\r
+  after Timeout 100 ns units.  The StartLba and SectorSize parameters are used to\r
+  construct the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo               A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout              The length of timeout period.\r
-  @param[in]     SenseData            A pointer to output sense data.\r
+\r
+  @param[in]      ScsiIo               A pointer to SCSI IO protocol.\r
+  @param[in]      Timeout              The length of timeout period.\r
+  @param[in, out] SenseData            A pointer to output sense data.\r
   @param[in, out] SenseDataLength      The length of output sense data.\r
-  @param[out]    HostAdapterStatus    The status of Host Adapter.\r
-  @param[out]    TargetStatus         The status of the target.\r
-  @param[out]    DataBuffer           Read 10 command data.\r
+  @param[out]     HostAdapterStatus    The status of Host Adapter.\r
+  @param[out]     TargetStatus         The status of the target.\r
+  @param[in, out] DataBuffer           Read 10 command data.\r
   @param[in, out] DataLength           The length of data buffer.\r
-  @param[in]     StartLba             The start address of LBA.\r
-  @param[in]     SectorSize           The sector size.\r
+  @param[in]      StartLba             The start address of LBA.\r
+  @param[in]      SectorSize           The sector size.\r
 \r
   @retval  EFI_SUCCESS                Command is executed successfully.\r
   @retval  EFI_WARN_BUFFER_TOO_SMALL  The SCSI Request Packet was executed, but the entire DataBuffer could\r
@@ -327,49 +427,48 @@ ScsiReadCapacityCommand (
   @retval  EFI_UNSUPPORTED            The command described by the SCSI Request Packet is not supported by \r
                                       the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval  EFI_TIMEOUT                A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval  EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiRead10Command (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  OUT VOID                  *DataBuffer,\r
-  IN OUT UINT32             *DataLength,\r
-  IN  UINT32                StartLba,\r
-  IN  UINT32                SectorSize\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,   OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *DataBuffer,  OPTIONAL\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
   );\r
 \r
 \r
 /**\r
-  Function to submit SCSI write 10 command.\r
-\r
-  Submit SCSI write (10) command with the SCSI request packet specified by this SCSI command and the\r
-  input parameters, and then return the status of Scsi unit execution.\r
-\r
+  Execute Write(10) SCSI command on a specific SCSI target.\r
+\r
+  Executes the SCSI Write(10) command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after\r
+  Timeout 100 ns units.  The StartLba and SectorSize parameters are used to construct\r
+  the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo               SCSI IO Protocol to use\r
-  @param[in]     Timeout              The length of timeout period.\r
-  @param[in]     SenseData            A pointer to output sense data.\r
+  @param[in]      ScsiIo               SCSI IO Protocol to use\r
+  @param[in]      Timeout              The length of timeout period.\r
+  @param[in, out] SenseData            A pointer to output sense data.\r
   @param[in, out] SenseDataLength      The length of output sense data.\r
-  @param[out]    HostAdapterStatus    The status of Host Adapter.\r
-  @param[out]    TargetStatus         The status of the target.\r
-  @param[out]    DataBuffer           A pointer to a data buffer.\r
+  @param[out]     HostAdapterStatus    The status of Host Adapter.\r
+  @param[out]     TargetStatus         The status of the target.\r
+  @param[in, out] DataBuffer           A pointer to a data buffer.\r
   @param[in, out] DataLength           The length of data buffer.\r
-  @param[in]     StartLba             The start address of LBA.\r
-  @param[in]     SectorSize           The sector size.\r
+  @param[in]      StartLba             The start address of LBA.\r
+  @param[in]      SectorSize           The sector size.\r
 \r
   @retval  EFI_SUCCESS                Command is executed successfully.\r
   @retval  EFI_WARN_BUFFER_TOO_SMALL  The SCSI Request Packet was executed, but the entire DataBuffer could\r
@@ -380,22 +479,21 @@ ScsiRead10Command (
   @retval  EFI_UNSUPPORTED            The command described by the SCSI Request Packet is not supported by \r
                                       the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval  EFI_TIMEOUT                A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval  EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiWrite10Command (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  OUT VOID                  *DataBuffer,\r
-  IN OUT UINT32             *DataLength,\r
-  IN  UINT32                StartLba,\r
-  IN  UINT32                SectorSize\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,   OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *DataBuffer,  OPTIONAL\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
   );\r
 \r
 \r
index f1fdc3d0734dbe7a7f8d37edcbc1e013211b0dc7..2a6730d76ac0d71b9cc8b9d3e88ad6a7573767f5 100644 (file)
@@ -18,6 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define __USB_DXE_LIB_H__\r
 \r
 #include <Protocol/UsbIo.h>\r
+#include <IndustryStandard/Usb.h>\r
 \r
 ///\r
 /// define the timeout time as 3ms\r
@@ -25,57 +26,78 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define TIMEOUT_VALUE 3 * 1000\r
 \r
 /**\r
-  Get Hid Descriptor.\r
+  Get the descriptor of the specified USB HID interface.\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  InterfaceNum      Hid interface number.\r
-  @param  HidDescriptor     Caller allocated buffer to store Usb hid descriptor if\r
-                            successfully returned.\r
+  Submit a USB get HID descriptor request for the USB device specified by UsbIo\r
+  and Interface and return the HID descriptor in HidDescriptor.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If HidDescriptor is NULL, then ASSERT().\r
 \r
-  @return Status of getting HID descriptor through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @param  UsbIo          A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface      The index of the HID interface on the USB target.\r
+  @param  HidDescriptor  Pointer to the USB HID descriptor that was retrieved from\r
+                         the specified USB target and interface. Type EFI_USB_HID_DESCRIPTOR\r
+                         is defined in the MDE Package Industry Standard include file Usb.h.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetHidDescriptor (\r
   IN  EFI_USB_IO_PROTOCOL        *UsbIo,\r
-  IN  UINT8                      InterfaceNum,\r
+  IN  UINT8                      Interface,\r
   OUT EFI_USB_HID_DESCRIPTOR     *HidDescriptor\r
   );\r
 \r
 \r
 /**\r
-  get Report Class descriptor.\r
+  Get the report descriptor of the specified USB HID interface.\r
+\r
+  Submit a USB get HID report descriptor request for the USB device specified by\r
+  UsbIo and Interface and return the report descriptor in DescriptorBuffer.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If DescriptorBuffer is NULL, then ASSERT().\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  InterfaceNum      Report interface number.\r
-  @param  DescriptorSize    Length of DescriptorBuffer.\r
-  @param  DescriptorBuffer  Caller allocated buffer to store Usb report descriptor\r
-                            if successfully returned.\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface         The index of the report interface on the USB target.\r
+  @param  DescriptorLength  The size, in bytes, of DescriptorBuffer.\r
+  @param  DescriptorBuffer  A pointer to the buffer to store the report class descriptor.\r
 \r
-  @return Status of getting Report Class descriptor through USB\r
-          I/O protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS           The request executed successfully.\r
+  @retval  EFI_OUT_OF_RESOURCES  The request could not be completed because the\r
+                                 buffer specifed by DescriptorLength and DescriptorBuffer\r
+                                 is not large enough to hold the result of the request.\r
+  @retval  EFI_TIMEOUT           A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR      The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetReportDescriptor (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT8                   InterfaceNum,\r
-  IN  UINT16                  DescriptorSize,\r
+  IN  UINT8                   Interface,\r
+  IN  UINT16                  DescriptorLength,\r
   OUT UINT8                   *DescriptorBuffer\r
   );\r
 \r
 /**\r
-  Get Hid Protocol Request.\r
+  Get the HID protocol of the specified USB HID interface.\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to get protocol.\r
-  @param  Protocol          Protocol value returned.\r
+  Submit a USB get HID protocol request for the USB device specified by UsbIo\r
+  and Interface and return the protocol retrieved in Protocol.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Protocol is NULL, then ASSERT().\r
 \r
-  @return Status of getting Protocol Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  Protocol   A pointer to the protocol for the specified USB target.\r
+\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -87,14 +109,19 @@ UsbGetProtocolRequest (
   );\r
 \r
 /**\r
-  Set Hid Protocol Request.\r
+  Set the HID protocol of the specified USB HID interface.\r
+\r
+  Submit a USB set HID protocol request for the USB device specified by UsbIo\r
+  and Interface and set the protocol to the value specified by Protocol.\r
+  If UsbIo is NULL, then ASSERT().\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set protocol.\r
-  @param  Protocol          Protocol value the caller wants to set.\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  Protocol   The protocol value to set for the specified USB target.\r
 \r
-  @return Status of setting Protocol Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -106,15 +133,20 @@ UsbSetProtocolRequest (
   );\r
 \r
 /**\r
-  Set Idel request.\r
+  Set the idle rate of the specified USB HID report.\r
+\r
+  Submit a USB set HID report idle request for the USB device specified by UsbIo,\r
+  Interface, and ReportId, and set the idle rate to the value specified by Duration.\r
+  If UsbIo is NULL, then ASSERT().\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set.\r
-  @param  ReportId          Which report the caller wants to set.\r
-  @param  Duration          Idle rate the caller wants to set.\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  ReportId   The identifier of the report to retrieve.\r
+  @param  Duration   The idle rate to set for the specified USB target.\r
 \r
-  @return Status of setting IDLE Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -127,15 +159,21 @@ UsbSetIdleRequest (
   );\r
 \r
 /**\r
-  Get Idel request.\r
+  Get the idle rate of the specified USB HID report.\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to get.\r
-  @param  ReportId          Which report the caller wants to get.\r
-  @param  Duration          Idle rate the caller wants to get.\r
+  Submit a USB get HID report idle request for the USB device specified by UsbIo,\r
+  Interface, and ReportId, and return the ide rate in Duration.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Duration is NULL, then ASSERT().\r
 \r
-  @return Status of getting IDLE Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  ReportId   The identifier of the report to retrieve.\r
+  @param  Duration   A pointer to the idle rate retrieved from the specified USB target.\r
+\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -148,17 +186,18 @@ UsbGetIdleRequest (
   );\r
 \r
 /**\r
-  Hid Set Report request.\r
+  Set the report descriptor of the specified USB HID interface.\r
 \r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set.\r
-  @param  ReportId          Which report the caller wants to set.\r
-  @param  ReportType        Type of report.\r
-  @param  ReportLen         Length of report descriptor.\r
-  @param  Report            Report Descriptor buffer.\r
+  @param  UsbIo         A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface     The index of the report interface on the USB target.\r
+  @param  ReportId      The identifier of the report to retrieve.\r
+  @param  ReportType    The type of report to retrieve.\r
+  @param  ReportLength  The size, in bytes, of Report.\r
+  @param  Report        A pointer to the report descriptor buffer to set.\r
 \r
-  @return Status of setting Report Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -173,17 +212,27 @@ UsbSetReportRequest (
   );\r
 \r
 /**\r
-  Hid Set Report request.\r
-\r
-  @param  UsbIo             A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set.\r
-  @param  ReportId          Which report the caller wants to set.\r
-  @param  ReportType        Type of report.\r
-  @param  ReportLen         Length of report descriptor.\r
-  @param  Report            Caller allocated buffer to store Report Descriptor.\r
-\r
-  @return Status of getting Report Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  Get the report descriptor of the specified USB HID interface.\r
+\r
+  Submit a USB get HID report request for the USB device specified by UsbIo,\r
+  Interface, ReportId, and ReportType, and return the report in the buffer\r
+  specified by Report.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Report is NULL, then ASSERT().\r
+\r
+  @param  UsbIo         A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface     The index of the report interface on the USB target.\r
+  @param  ReportId      The identifier of the report to retrieve.\r
+  @param  ReportType    The type of report to retrieve.\r
+  @param  ReportLength  The size, in bytes, of Report.\r
+  @param  Report        A pointer to the buffer to store the report descriptor.\r
+\r
+  @retval  EFI_SUCCESS           The request executed successfully.\r
+  @retval  EFI_OUT_OF_RESOURCES  The request could not be completed because the\r
+                                 buffer specifed by ReportLength and Report is not\r
+                                 large enough to hold the result of the request.\r
+  @retval  EFI_TIMEOUT           A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR      The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -198,18 +247,29 @@ UsbGetReportRequest (
   );\r
 \r
 /**\r
-  Usb Get Descriptor.\r
-\r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Value                  Device Request Value.\r
-  @param  Index                  Device Request Index.\r
-  @param  DescriptorLength       Descriptor Length.\r
-  @param  Descriptor             Descriptor buffer to contain result.\r
-  @param  Status                 Transfer Status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Get the descriptor of the specified USB device.\r
+\r
+  Submit a USB get descriptor request for the USB device specified by UsbIo, Value,\r
+  and Index, and return the descriptor in the buffer specified by Descriptor.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Descriptor is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Value             The device request value.\r
+  @param  Index             The device request index.\r
+  @param  DescriptorLength  The size, in bytes, of Descriptor.\r
+  @param  Descriptor        A pointer to the descriptor buffer to get.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS           The request executed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed because the\r
+                                buffer specifed by DescriptorLength and Descriptor\r
+                                is not large enough to hold the result of the request.\r
+  @retval EFI_TIMEOUT           A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR      The request failed due to a device error. The transfer\r
+                                status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -224,18 +284,26 @@ UsbGetDescriptor (
   );\r
 \r
 /**\r
-  Usb Set Descriptor.\r
-\r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Value                  Device Request Value.\r
-  @param  Index                  Device Request Index.\r
-  @param  DescriptorLength       Descriptor Length.\r
-  @param  Descriptor             Descriptor buffer to set.\r
-  @param  Status                 Transfer Status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Set the descriptor of the specified USB device.\r
+\r
+  Submit a USB set descriptor request for the USB device specified by UsbIo,\r
+  Value, and Index, and set the descriptor using the buffer specified by DesriptorLength\r
+  and Descriptor.  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Descriptor is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Value             The device request value.\r
+  @param  Index             The device request index.\r
+  @param  DescriptorLength  The size, in bytes, of Descriptor.\r
+  @param  Descriptor        A pointer to the descriptor buffer to set.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                             The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -250,178 +318,245 @@ UsbSetDescriptor (
   );\r
 \r
 /**\r
-  Usb Get Device Interface.\r
+  Get the interface setting of the specified USB device.\r
 \r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Index                  Interface index value.\r
-  @param  AltSetting             Alternate setting.\r
-  @param  Status                 Trasnsfer status.\r
+  Submit a USB get interface request for the USB device specified by UsbIo,\r
+  and Interface, and place the result in the buffer specified by AlternateSetting.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If AlternateSetting is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface         The interface index value.\r
+  @param  AlternateSetting  A pointer to the alternate setting to be retrieved.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetInterface (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT16                  Index,\r
-  OUT UINT8                   *AltSetting,\r
+  IN  UINT16                  Interface,\r
+  OUT UINT8                   *AlternateSetting,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Usb Set Device Interface.\r
+  Set the interface setting of the specified USB device.\r
 \r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  InterfaceNo            Interface Number.\r
-  @param  AltSetting             Alternate setting.\r
-  @param  Status                 Trasnsfer status.\r
+  Submit a USB set interface request for the USB device specified by UsbIo, and\r
+  Interface, and set the alternate setting to the value specified by AlternateSetting.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface         The interface index value.\r
+  @param  AlternateSetting  The alternate setting to be set.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS  The request executed successfully.\r
+  @retval EFI_TIMEOUT  A timeout occurred executing the request.\r
+  @retval EFI_SUCCESS  The request failed due to a device error.\r
+                       The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbSetInterface (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT16                  InterfaceNo,\r
-  IN  UINT16                  AltSetting,\r
+  IN  UINT16                  Interface,\r
+  IN  UINT16                  AlternateSetting,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Usb Get Device Configuration.\r
+  Get the device configuration.\r
+\r
+  Submit a USB get configuration request for the USB device specified by UsbIo\r
+  and place the result in the buffer specified by ConfigurationValue. The status\r
+  of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If ConfigurationValue is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  ConfigValue            Config Value.\r
-  @param  Status                 Transfer Status.\r
+  @param  UsbIo               A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  ConfigurationValue  A pointer to the device configuration to be retrieved.\r
+  @param  Status              A pointer to the status of the transfer.\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @retval EFI_SUCCESS        The request executed successfully.\r
+  @retval EFI_TIMEOUT        A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR   The request failed due to a device error.\r
+                             The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetConfiguration (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  OUT UINT8                   *ConfigValue,\r
+  OUT UINT8                   *ConfigurationValue,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Usb Set Device Configuration.\r
+  Set the device configuration.\r
 \r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Value                  Configuration Value to set.\r
-  @param  Status                 Transfer status.\r
+  Submit a USB set configuration request for the USB device specified by UsbIo\r
+  and set the device configuration to the value specified by ConfigurationValue.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @param  UsbIo               A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  ConfigurationValue  The device configuration value to be set.\r
+  @param  Status              A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbSetConfiguration (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT16                  Value,\r
+  IN  UINT16                  ConfigurationValue,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Usb Set Device Feature.\r
-\r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Recipient              Interface/Device/Endpoint.\r
-  @param  Value                  Request value.\r
-  @param  Target                 Request Index.\r
-  @param  Status                 Transfer status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Set the specified feature of the specified device.\r
+\r
+  Submit a USB set device feature request for the USB device specified by UsbIo,\r
+  Recipient, and Target to the value specified by Value.  The status of the\r
+  transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Recipient  The USB data recipient type (i.e. Device, Interface, Endpoint).\r
+                     Type USB_TYPES_DEFINITION is defined in the MDE Package Industry\r
+                     Standard include file Usb.h.\r
+  @param  Value      The value of the feature to be set.\r
+  @param  Target     The index of the device to be set.\r
+  @param  Status     A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbSetFeature (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINTN                   Recipient,\r
+  IN  USB_TYPES_DEFINITION    Recipient,\r
   IN  UINT16                  Value,\r
   IN  UINT16                  Target,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Usb Clear Device Feature.\r
-\r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Recipient              Interface/Device/Endpoint.\r
-  @param  Value                  Request value.\r
-  @param  Target                 Request Index.\r
-  @param  Status                 Transfer status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Clear the specified feature of the specified device.\r
+\r
+  Submit a USB clear device feature request for the USB device specified by UsbIo,\r
+  Recipient, and Target to the value specified by Value.  The status of the transfer\r
+  is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Recipient  The USB data recipient type (i.e. Device, Interface, Endpoint).\r
+                     Type USB_TYPES_DEFINITION is defined in the MDE Package Industry Standard\r
+                     include file Usb.h.\r
+  @param  Value      The value of the feature to be cleared.\r
+  @param  Target     The index of the device to be cleared.\r
+  @param  Status     A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbClearFeature (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINTN                   Recipient,\r
+  IN  USB_TYPES_DEFINITION    Recipient,\r
   IN  UINT16                  Value,\r
   IN  UINT16                  Target,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Usb Get Device Status.\r
-\r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  Recipient              Interface/Device/Endpoint.\r
-  @param  Target                 Request index.\r
-  @param  DevStatus              Device status.\r
-  @param  Status                 Transfer status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Get the status of the specified device.\r
+\r
+  Submit a USB device get status request for the USB device specified by UsbIo,\r
+  Recipient, and Target and place the result in the buffer specified by DeviceStatus.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If DeviceStatus is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo         A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Recipient     The USB data recipient type (i.e. Device, Interface, Endpoint).\r
+                        Type USB_TYPES_DEFINITION is defined in the MDE Package Industry Standard\r
+                        include file Usb.h.\r
+  @param  Target        The index of the device to be get the status of.\r
+  @param  DeviceStatus  A pointer to the device status to be retrieved.\r
+  @param  Status        A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetStatus (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINTN                   Recipient,\r
+  IN  USB_TYPES_DEFINITION    Recipient,\r
   IN  UINT16                  Target,\r
   OUT UINT16                  *DevStatus,\r
   OUT UINT32                  *Status\r
   );\r
 \r
 /**\r
-  Clear endpoint stall.\r
+  Clear halt feature of the specified usb endpoint.\r
+\r
+  Retrieve the USB endpoint descriptor specified by UsbIo and EndPoint.\r
+  If the USB endpoint descriptor can not be retrieved, then return EFI_NOT_FOUND.\r
+  If the endpoint descriptor is found, then clear the halt fature of this USB endpoint.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @param  UsbIo                  A pointer to EFI_USB_IO_PROTOCOL.\r
-  @param  EndpointNo             Endpoint Number.\r
-  @param  Status                 Transfer Status.\r
+  @param  UsbIo     A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Endpoint  The endpoint address.\r
+  @param  Status    A pointer to the status of the transfer.\r
 \r
-  @retval EFI_NOT_FOUND          Can't find the Endpoint.\r
-  @retval EFI_DEVICE_ERROR       Hardware error.\r
-  @retval EFI_SUCCESS            Success.\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
+  @retval EFI_NOT_FOUND     The specified USB endpoint descriptor can not be found\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbClearEndpointHalt (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT8                   EndpointNo,\r
+  IN  UINT8                   Endpoint,\r
   OUT UINT32                  *Status\r
   );\r
 \r
index a90a37b74d4e3fe5069e9e44439e8b19e82702b6..3b4da1fb0e17aaeace1054a867fa843284147a30 100644 (file)
 #include <Library/DebugLib.h>\r
 #include <Library/UefiScsiLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-\r
+  \r
 #include <IndustryStandard/Scsi.h>\r
-\r
-//\r
-// Max bytes needed to represent ID of a SCSI device\r
-//\r
+  \r
+  \r
+  //\r
+  // Max bytes needed to represent ID of a SCSI device\r
+  //\r
 #define EFI_SCSI_TARGET_MAX_BYTES (0x10)\r
-\r
-//\r
-// bit5..7 are for Logical unit number\r
-// 11100000b (0xe0)\r
-//\r
+  \r
+  //\r
+  // bit5..7 are for Logical unit number\r
+  // 11100000b (0xe0)\r
+  //\r
 #define EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK 0xe0\r
-\r
-//\r
-// Scsi Command Length six or ten\r
-//\r
+  \r
+  //\r
+  // Scsi Command Length six or ten\r
+  //\r
 #define EFI_SCSI_OP_LENGTH_SIX 0x6\r
 #define EFI_SCSI_OP_LENGTH_TEN 0xa\r
 \r
-/**\r
-  Function test the ready status of the SCSI unit.\r
 \r
-  Submit SCSI test unit ready command with SCSI request packet specified by this scsi command, TimeOut\r
-  and SenseData, then get the status of the target Scsi unit.\r
 \r
-  If SenseDataLength is NULL, then ASSERT().\r
+/**\r
+  Execute Test Unit Ready SCSI command on a specific SCSI target.\r
 \r
+  Executes the Test Unit Ready command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
+  If ScsiIo is NULL, then ASSERT().\r
+  If SenseDataLength is NULL, then ASSERT().\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo             A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout            The length of timeout period.\r
-  @param[in]     SenseData          A pointer to output sense data.\r
-  @param[out]    SenseDataLength    The length of output sense data.\r
-  @param[out]    HostAdapterStatus  The status of Host Adapter.\r
-  @param[out]    TargetStatus       The status of the target.\r
-\r
-  @retval EFI_SUCCESS           The status of the unit is tested successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE   The SCSI Request Packet was executed, \r
-                                but the entire DataBuffer could not be transferred.\r
-                                The actual number of bytes transferred is returned\r
-                                in InTransferLength.\r
-  @retval EFI_NOT_READY         The SCSI Request Packet could not be sent because \r
-                                there are too many SCSI Command Packets already \r
-                                queued.\r
-  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to send \r
-                                the SCSI Request Packet.\r
-  @retval EFI_INVALID_PARAMETER ScsiIo is NULL.\r
-  @retval EFI_UNSUPPORTED       The command described by the SCSI Request Packet\r
-                                is not supported by the SCSI initiator(i.e., SCSI \r
-                                Host Controller).\r
-  @retval EFI_TIMEOUT           A timeout occurred while waiting for the SCSI \r
-                                Request Packet to execute.\r
+\r
+  @param[in]     ScsiIo             A pointer to the SCSI I/O Protocol instance\r
+                                    for the specific SCSI target.\r
+  @param[in]     Timeout            The timeout in 100 ns units to use for the execution\r
+                                    of this SCSI Request Packet. A Timeout value of\r
+                                    zero means that this function will wait indefinitely\r
+                                    for the SCSI Request Packet to execute. If Timeout\r
+                                    is greater than zero, then this function will return\r
+                                    EFI_TIMEOUT if the time required to execute the SCSI\r
+                                    Request Packet is greater than Timeout.\r
+  @param[in, out] SenseData         A pointer to sense data that was generated by\r
+                                    the execution of the SCSI Request Packet. This\r
+                                    buffer must be allocated by the caller.\r
+                                    If SenseDataLength is 0, then this parameter is\r
+                                    optional and may be NULL.\r
+  @param[in, out] SenseDataLength   On input, a pointer to the length in bytes of\r
+                                    the SenseData buffer. On output, a poiinter to\r
+                                    the number of bytes written to the SenseData buffer. \r
+  @param[out]     HostAdapterStatus The status of the SCSI Host Controller that produces\r
+                                    the SCSI bus containing the SCSI target specified by\r
+                                    ScsiIo when the SCSI Request Packet was executed.\r
+                                    See the EFI SCSI I/O Protocol in the UEFI Specification\r
+                                    for details on the possible return values.\r
+  @param[out]     TargetStatus      The status returned by the SCSI target specified\r
+                                    by ScsiIo when the SCSI Request Packat was executed\r
+                                    on the SCSI Host Controller. See the EFI SCSI I/O\r
+                                    Protocol in the UEFI Specification for details on\r
+                                    the possible return values. \r
+\r
+  @retval EFI_SUCCESS          The command was executed successfully.\r
+                               See HostAdapterStatus, TargetStatus, SenseDataLength,\r
+                               and SenseData in that order for additional status\r
+                               information.\r
+  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent because\r
+                               there are too many SCSI Command Packets already\r
+                               queued. The SCSI Request Packet was not sent, so\r
+                               no additional status information is available.\r
+                               The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to send\r
+                               SCSI Request Packet.  See HostAdapterStatus,\r
+                               TargetStatus, SenseDataLength, and SenseData in that\r
+                               order for additional status information.\r
+  @retval EFI_UNSUPPORTED      The command described by the SCSI Request Packet\r
+                               is not supported by the SCSI initiator(i.e., SCSI\r
+                               Host Controller). The SCSI Request Packet was not\r
+                               sent, so no additional status information is available.\r
+  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI Request\r
+                               Packet to execute.  See HostAdapterStatus, TargetStatus,\r
+                               SenseDataLength, and SenseData in that order for\r
+                               additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, \r
+                               but the entire DataBuffer could not be transferred.\r
+                               The actual number of bytes transferred is returned\r
+                               in InTransferLength.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiTestUnitReadyCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  OUT UINT8                 *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,  OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -95,10 +128,7 @@ ScsiTestUnitReadyCommand (
   ASSERT (SenseDataLength != NULL);\r
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);\r
@@ -132,59 +162,95 @@ ScsiTestUnitReadyCommand (
 \r
 \r
 /**\r
-  Function to submit SCSI inquiry command.\r
-\r
-  Submit SCSI inquiry command with the SCSI request packet specified by this SCSI command and input\r
-  parameters, then return the status of Scsi unit execution.\r
+  Execute Inquiry SCSI command on a specific SCSI target.\r
 \r
+  Executes the Inquiry command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If InquiryDataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo             SCSI IO Protocol to use\r
-  @param[in]     Timeout            The length of timeout period.\r
-  @param[in]     SenseData          A pointer to output sense data.\r
-  @param[in, out] SenseDataLength    The length of output sense data.\r
-  @param[out]    HostAdapterStatus  The status of Host Adapter.\r
-  @param[out]    TargetStatus       The status of the target.\r
-  @param[in, out] InquiryDataBuffer  A pointer to inquiry data buffer.\r
-  @param[in, out] InquiryDataLength  The length of inquiry data buffer.\r
-  @param[in]     EnableVitalProductData  Boolean to enable Vital Product Data.\r
-\r
-  @retval EFI_SUCCESS                Command is executed successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE        The SCSI Request Packet was executed, \r
-                                     but the entire DataBuffer could not be transferred.\r
-                                     The actual number of bytes transferred is returned\r
-                                     in TransferLength.\r
-  @retval EFI_NOT_READY              The SCSI Request Packet could not be sent because \r
-                                     there are too many SCSI Command Packets already \r
-                                     queued.\r
-  @retval EFI_DEVICE_ERROR           A device error occurred while attempting to send \r
-                                     the SCSI Request Packet.\r
-  @retval EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
-  @retval EFI_UNSUPPORTED            The command described by the SCSI Request Packet\r
-                                     is not supported by the SCSI initiator(i.e., SCSI \r
-                                     Host Controller).\r
-  @retval EFI_TIMEOUT                A timeout occurred while waiting for the SCSI \r
-                                     Request Packet to execute.\r
+  @param[in]      ScsiIo                 A pointer to the SCSI I/O Protocol instance\r
+                                         for the specific SCSI target.\r
+  @param[in]      Timeout                The timeout in 100 ns units to use for the\r
+                                         execution of this SCSI Request Packet. A Timeout\r
+                                         value of zero means that this function will wait\r
+                                         indefinitely for the SCSI Request Packet to execute.\r
+                                         If Timeout is greater than zero, then this function\r
+                                         will return EFI_TIMEOUT if the time required to\r
+                                         execute the SCSI Request Packet is greater than Timeout.\r
+  @param[in, out] SenseData              A pointer to sense data that was generated\r
+                                         by the execution of the SCSI Request Packet.\r
+                                         This buffer must be allocated by the caller.\r
+                                         If SenseDataLength is 0, then this parameter\r
+                                         is optional and may be NULL.\r
+  @param[in, out] SenseDataLength        On input, the length in bytes of the SenseData buffer.\r
+                                         On output, the number of bytes written to the SenseData buffer. \r
+  @param[out]     HostAdapterStatus      The status of the SCSI Host Controller that\r
+                                         produces the SCSI bus containing the SCSI\r
+                                         target specified by ScsiIo when the SCSI\r
+                                         Request Packet was executed.  See the EFI\r
+                                         SCSI I/O Protocol in the UEFI Specification\r
+                                         for details on the possible return values.\r
+  @param[out]     TargetStatus           The status returned by the SCSI target specified\r
+                                         by ScsiIo when the SCSI Request Packat was\r
+                                         executed on the SCSI Host Controller.\r
+                                         See the EFI SCSI I/O Protocol in the UEFI\r
+                                         Specification for details on the possible\r
+                                         return values. \r
+  @param[in, out] InquiryDataBuffer      A pointer to inquiry data that was generated\r
+                                         by the execution of the SCSI Request Packet.\r
+                                         This buffer must be allocated by the caller.\r
+                                         If InquiryDataLength is 0, then this parameter\r
+                                         is optional and may be NULL. \r
+  @param[in, out] InquiryDataLength      On input, a pointer to the length in bytes\r
+                                         of the InquiryDataBuffer buffer.\r
+                                         On output, a pointer to the number of bytes\r
+                                         written to the InquiryDataBuffer buffer.\r
+  @param[in]      EnableVitalProductData If TRUE, then the supported vital product\r
+                                         data is returned in InquiryDataBuffer.\r
+                                         If FALSE, then the standard inquiry data is\r
+                                         returned in InquiryDataBuffer. \r
+\r
+  @retval EFI_SUCCESS          The command was executed successfully. See HostAdapterStatus,\r
+                               TargetStatus, SenseDataLength, and SenseData in that order\r
+                               for additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE  The SCSI Request Packet was executed, but the entire\r
+                               InquiryDataBuffer could not be transferred. The actual\r
+                               number of bytes transferred is returned in InquiryDataLength.\r
+  @retval EFI_NOT_READY        The SCSI Request Packet could not be sent because there\r
+                               are too many SCSI Command Packets already queued.\r
+                               The SCSI Request Packet was not sent, so no additional\r
+                               status information is available. The caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR     A device error occurred while attempting to send SCSI\r
+                               Request Packet.  See HostAdapterStatus, TargetStatus,\r
+                               SenseDataLength, and SenseData in that order for additional\r
+                               status information.\r
+  @retval EFI_UNSUPPORTED      The command described by the SCSI Request Packet is not\r
+                               supported by the SCSI initiator(i.e., SCSI  Host Controller).\r
+                               The SCSI Request Packet was not sent, so no additional\r
+                               status information is available.\r
+  @retval EFI_TIMEOUT          A timeout occurred while waiting for the SCSI Request\r
+                               Packet to execute.  See HostAdapterStatus, TargetStatus,\r
+                               SenseDataLength, and SenseData in that order for\r
+                               additional status information.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiInquiryCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  IN OUT VOID               *InquiryDataBuffer,\r
-  IN OUT UINT32             *InquiryDataLength,\r
-  IN  BOOLEAN               EnableVitalProductData\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,  OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *InquiryDataBuffer,    OPTIONAL\r
+  IN OUT UINT32                *InquiryDataLength,\r
+  IN     BOOLEAN               EnableVitalProductData\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -198,10 +264,7 @@ ScsiInquiryCommand (
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
   ASSERT (InquiryDataLength != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);\r
@@ -242,63 +305,100 @@ ScsiInquiryCommand (
 \r
 \r
 /**\r
-  Function to submit SCSI mode sense 10 command.\r
-\r
-  Submit SCSI Mode Sense (10) command with the SCSI request packet specified by this SCSI command and\r
-  the input parameters, then return the status of Scsi unit execution.\r
-\r
+  Execute Mode Sense(10) SCSI command on a specific SCSI target.\r
+\r
+  Executes the SCSI Mode Sense(10) command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout\r
+  after Timeout 100 ns units.  The DBDField, PageControl, and PageCode parameters\r
+  are used to construct the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo             A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout            The length of timeout period.\r
-  @param[in]     SenseData          A pointer to output sense data.\r
-  @param[in, out] SenseDataLength    The length of output sense data.\r
-  @param[out]    HostAdapterStatus  The status of Host Adapter.\r
-  @param[out]    TargetStatus       The status of the target.\r
-  @param[in]     DataBuffer         A pointer to input data buffer.\r
-  @param[in, out] DataLength         The length of input data buffer.\r
-  @param[in]     DBDField           The DBD Field (Optional).\r
-  @param[in]     PageControl        Page Control.\r
-  @param[in]     PageCode           Page code.\r
-\r
-  @retval EFI_SUCCESS               The status of the unit is tested successfully.\r
-  @retval EFI_BAD_BUFFER_SIZE       The SCSI Request Packet was executed, \r
-                                    but the entire DataBuffer could not be transferred.\r
+\r
+  @param[in]      ScsiIo             A pointer to the SCSI I/O Protocol instance\r
+                                     for the specific SCSI target.\r
+  @param[in]      Timeout            The timeout in 100 ns units to use for the\r
+                                     execution of this SCSI Request Packet. A Timeout\r
+                                     value of zero means that this function will wait\r
+                                     indefinitely for the SCSI Request Packet to execute.\r
+                                     If Timeout is greater than zero, then this function\r
+                                     will return EFI_TIMEOUT if the time required to\r
+                                     execute the SCSI Request Packet is greater than Timeout.\r
+  @param[in, out] SenseData          A pointer to sense data that was generated\r
+                                     by the execution of the SCSI Request Packet.\r
+                                     This buffer must be allocated by the caller.\r
+                                     If SenseDataLength is 0, then this parameter\r
+                                     is optional and may be NULL.\r
+  @param[in, out] SenseDataLength    On input, the length in bytes of the SenseData buffer.\r
+                                     On output, the number of bytes written to the SenseData buffer. \r
+  @param[out]     HostAdapterStatus  The status of the SCSI Host Controller that\r
+                                     produces the SCSI bus containing the SCSI target\r
+                                     specified by ScsiIo when the SCSI Request Packet\r
+                                     was executed. See the EFI SCSI I/O Protocol in the\r
+                                     UEFI Specification for details on the possible\r
+                                     return values.\r
+  @param[out]     TargetStatus       The status returned by the SCSI target specified\r
+                                     by ScsiIo when the SCSI Request Packat was executed\r
+                                     on the SCSI Host Controller.  See the EFI SCSI\r
+                                     I/O Protocol in the UEFI Specification for details\r
+                                     on the possible return values.\r
+  @param[in, out]  DataBuffer        A pointer to data that was generated by the\r
+                                     execution of the SCSI Request Packet.  This\r
+                                     buffer must be allocated by the caller. If\r
+                                     DataLength is 0, then this parameter is optional\r
+                                     and may be NULL. \r
+  @param[in, out]  DataLength        On input, a pointer to the length in bytes of\r
+                                     the DataBuffer buffer.  On output, a pointer\r
+                                     to the number of bytes written to the DataBuffer\r
+                                     buffer. \r
+  @param[in]      DBDField           Specifies the DBD field of the CDB for this SCSI Command.\r
+  @param[in]      PageControl        Specifies the PC field of the CDB for this SCSI Command. \r
+  @param[in]      PageCode           Specifies the Page Control field of the CDB for this SCSI Command. \r
+\r
+  @retval EFI_SUCCESS               The command was executed successfully.\r
+                                    See HostAdapterStatus, TargetStatus, SenseDataLength,\r
+                                    and SenseData in that order for additional status information.\r
+  @retval EFI_BAD_BUFFER_SIZE       The SCSI Request Packet was executed, but the\r
+                                    entire DataBuffer could not be transferred.\r
                                     The actual number of bytes transferred is returned\r
-                                    in TransferLength.\r
-  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because \r
-                                    there are too many SCSI Command Packets already \r
-                                    queued.\r
-  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send \r
-                                    the SCSI Request Packet.\r
-  @retval EFI_INVALID_PARAMETER     ScsiIo is NULL. \r
+                                    in DataLength.\r
+  @retval EFI_NOT_READY             The SCSI Request Packet could not be sent because\r
+                                    there are too many SCSI Command Packets already queued.\r
+                                    The SCSI Request Packet was not sent, so no additional\r
+                                    status information is available.  The caller may retry\r
+                                    again later.\r
+  @retval EFI_DEVICE_ERROR          A device error occurred while attempting to send\r
+                                    SCSI Request Packet.  See HostAdapterStatus, TargetStatus,\r
+                                    SenseDataLength, and SenseData in that order for\r
+                                    additional status information.\r
   @retval EFI_UNSUPPORTED           The command described by the SCSI Request Packet\r
-                                    is not supported by the SCSI initiator(i.e., SCSI \r
-                                    Host Controller).\r
-  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI \r
-                                    Request Packet to execute.\r
+                                    is not supported by the SCSI initiator(i.e., SCSI\r
+                                    Host Controller). The SCSI Request Packet was not\r
+                                    sent, so no additional status information is available.\r
+  @retval EFI_TIMEOUT               A timeout occurred while waiting for the SCSI\r
+                                    Request Packet to execute.  See HostAdapterStatus,\r
+                                    TargetStatus, SenseDataLength, and SenseData in that\r
+                                    order for additional status information.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiModeSense10Command (\r
-  IN  EFI_SCSI_IO_PROTOCOL    *ScsiIo,\r
-  IN  UINT64                  Timeout,\r
-  IN  VOID                    *SenseData,\r
-  IN OUT UINT8                *SenseDataLength,\r
-  OUT UINT8                   *HostAdapterStatus,\r
-  OUT UINT8                   *TargetStatus,\r
-  IN  VOID                    *DataBuffer,\r
-  IN OUT UINT32               *DataLength,\r
-  IN  UINT8                   DBDField, OPTIONAL\r
-  IN  UINT8                   PageControl,\r
-  IN  UINT8                   PageCode\r
+  IN     EFI_SCSI_IO_PROTOCOL    *ScsiIo,\r
+  IN     UINT64                  Timeout,\r
+  IN OUT VOID                    *SenseData,  OPTIONAL\r
+  IN OUT UINT8                   *SenseDataLength,\r
+     OUT UINT8                   *HostAdapterStatus,\r
+     OUT UINT8                   *TargetStatus,\r
+  IN OUT VOID                    *DataBuffer, OPTIONAL\r
+  IN OUT UINT32                  *DataLength,\r
+  IN     UINT8                   DBDField,    OPTIONAL\r
+  IN     UINT8                   PageControl,\r
+  IN     UINT8                   PageCode\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -312,10 +412,7 @@ ScsiModeSense10Command (
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
   ASSERT (DataLength != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
@@ -359,21 +456,20 @@ ScsiModeSense10Command (
 \r
 \r
 /**\r
-  Function to submit SCSI request sense command.\r
-\r
-  Submit SCSI request sense command with the SCSI requested packet specified by this\r
-  SCSI command, TimeOut and SenseData, and then return the status of scsi unit execution.\r
+  Execute Request Sense SCSI command on a specific SCSI target.\r
 \r
+  Executes the Request Sense command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after Timeout 100 ns units.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-  \r
   If HostAdapterStatus is NULL, then ASSERT().\r
-  \r
   If TargetStatus is NULL, then ASSERT().\r
 \r
   @param[in]       ScsiIo               A pointer to SCSI IO protocol.\r
   @param[in]       Timeout              The length of timeout period.\r
-  @param[in]       SenseData            A pointer to output sense data.\r
-  @param[in, out]   SenseDataLength      The length of output sense data.\r
+  @param[in, out]  SenseData            A pointer to output sense data.\r
+  @param[in, out]  SenseDataLength      The length of output sense data.\r
   @param[out]      HostAdapterStatus    The status of Host Adapter.\r
   @param[out]      TargetStatus         The status of the target.\r
 \r
@@ -384,18 +480,17 @@ ScsiModeSense10Command (
   @retval EFI_UNSUPPORTED               The command described by the SCSI Request Packet is not supported by\r
                                         the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval EFI_TIMEOUT                   A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval EFI_INVALID_PARAMETER         ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiRequestSenseCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,  OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -408,10 +503,7 @@ ScsiRequestSenseCommand (
   ASSERT (SenseDataLength != NULL);\r
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);\r
@@ -446,28 +538,27 @@ ScsiRequestSenseCommand (
 \r
 \r
 /**\r
-  Function to submit read capacity command.\r
-\r
-  Submit SCSI read capacity command with the SCSI request packet specified by this SCSI \r
-  command and the input parameters, and then return the status of Scsi unit execution.\r
+  Execute Read Capacity SCSI command on a specific SCSI target.\r
 \r
+  Executes the SCSI Read Capacity command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after\r
+  Timeout 100 ns units.  The PMI parameter is used to construct the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo               A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout              The length of timeout period.\r
-  @param[in]     SenseData            A pointer to output sense data.\r
+  @param[in]      ScsiIo               A pointer to SCSI IO protocol.\r
+  @param[in]      Timeout              The length of timeout period.\r
+  @param[in, out] SenseData            A pointer to output sense data.\r
   @param[in, out] SenseDataLength      The length of output sense data.\r
-  @param[out]    HostAdapterStatus    The status of Host Adapter.\r
-  @param[out]    TargetStatus         The status of the target.\r
-  @param[out]    DataBuffer           A pointer to a data buffer.\r
+  @param[out]     HostAdapterStatus    The status of Host Adapter.\r
+  @param[out]     TargetStatus         The status of the target.\r
+  @param[in, out] DataBuffer           A pointer to a data buffer.\r
   @param[in, out] DataLength           The length of data buffer.\r
-  @param[in]     PMI                  Partial medium indicator.\r
+  @param[in]      PMI                  Partial medium indicator.\r
 \r
   @retval  EFI_SUCCESS                Command is executed successfully.\r
   @retval  EFI_WARN_BUFFER_TOO_SMALL  The SCSI Request Packet was executed, but the entire DataBuffer could\r
@@ -478,21 +569,20 @@ ScsiRequestSenseCommand (
   @retval  EFI_UNSUPPORTED            The command described by the SCSI Request Packet is not supported by \r
                                       the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval  EFI_TIMEOUT                A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval  EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiReadCapacityCommand (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  OUT VOID                  *DataBuffer,\r
-  IN OUT UINT32             *DataLength,\r
-  IN  BOOLEAN               PMI\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,    OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *DataBuffer,   OPTIONAL\r
+  IN OUT UINT32                *DataLength,\r
+  IN     BOOLEAN               PMI\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -506,10 +596,7 @@ ScsiReadCapacityCommand (
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
   ASSERT (DataLength != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
@@ -552,29 +639,30 @@ ScsiReadCapacityCommand (
 \r
 \r
 /**\r
-  Function to submit read 10 command.\r
-\r
-  Submit SCSI read (10) command with the SCSI request packet specified by this SCSI command \r
-  and the input parameters, and then return the status of Scsi unit execution.\r
-\r
+  Execute Read(10) SCSI command on a specific SCSI target.\r
+\r
+  Executes the SCSI Read(10) command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout\r
+  after Timeout 100 ns units.  The StartLba and SectorSize parameters are used to\r
+  construct the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo               A pointer to SCSI IO protocol.\r
-  @param[in]     Timeout              The length of timeout period.\r
-  @param[in]     SenseData            A pointer to output sense data.\r
+\r
+  @param[in]      ScsiIo               A pointer to SCSI IO protocol.\r
+  @param[in]      Timeout              The length of timeout period.\r
+  @param[in, out] SenseData            A pointer to output sense data.\r
   @param[in, out] SenseDataLength      The length of output sense data.\r
-  @param[out]    HostAdapterStatus    The status of Host Adapter.\r
-  @param[out]    TargetStatus         The status of the target.\r
-  @param[out]    DataBuffer           Read 10 command data.\r
+  @param[out]     HostAdapterStatus    The status of Host Adapter.\r
+  @param[out]     TargetStatus         The status of the target.\r
+  @param[in, out] DataBuffer           Read 10 command data.\r
   @param[in, out] DataLength           The length of data buffer.\r
-  @param[in]     StartLba             The start address of LBA.\r
-  @param[in]     SectorSize           The sector size.\r
+  @param[in]      StartLba             The start address of LBA.\r
+  @param[in]      SectorSize           The sector size.\r
 \r
   @retval  EFI_SUCCESS                Command is executed successfully.\r
   @retval  EFI_WARN_BUFFER_TOO_SMALL  The SCSI Request Packet was executed, but the entire DataBuffer could\r
@@ -585,22 +673,21 @@ ScsiReadCapacityCommand (
   @retval  EFI_UNSUPPORTED            The command described by the SCSI Request Packet is not supported by \r
                                       the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval  EFI_TIMEOUT                A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval  EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiRead10Command (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  OUT VOID                  *DataBuffer,\r
-  IN OUT UINT32             *DataLength,\r
-  IN  UINT32                StartLba,\r
-  IN  UINT32                SectorSize\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,   OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *DataBuffer,  OPTIONAL\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -614,10 +701,7 @@ ScsiRead10Command (
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
   ASSERT (DataLength != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
@@ -658,29 +742,29 @@ ScsiRead10Command (
 \r
 \r
 /**\r
-  Function to submit SCSI write 10 command.\r
-\r
-  Submit SCSI write (10) command with the SCSI request packet specified by this SCSI command and the\r
-  input parameters, and then return the status of Scsi unit execution.\r
-\r
+  Execute Write(10) SCSI command on a specific SCSI target.\r
+\r
+  Executes the SCSI Write(10) command on the SCSI target specified by ScsiIo.\r
+  If Timeout is zero, then this function waits indefinitely for the command to complete.\r
+  If Timeout is greater than zero, then the command is executed and will timeout after\r
+  Timeout 100 ns units.  The StartLba and SectorSize parameters are used to construct\r
+  the CDB for this SCSI command.\r
+  If ScsiIo is NULL, then ASSERT().\r
   If SenseDataLength is NULL, then ASSERT().\r
-\r
   If HostAdapterStatus is NULL, then ASSERT().\r
-\r
   If TargetStatus is NULL, then ASSERT().\r
-\r
   If DataLength is NULL, then ASSERT().\r
 \r
-  @param[in]     ScsiIo               SCSI IO Protocol to use\r
-  @param[in]     Timeout              The length of timeout period.\r
-  @param[in]     SenseData            A pointer to output sense data.\r
-  @param[in, out] SenseDataLength      The length of output sense data.\r
-  @param[out]    HostAdapterStatus    The status of Host Adapter.\r
-  @param[out]    TargetStatus         The status of the target.\r
-  @param[out]    DataBuffer           A pointer to a data buffer.\r
-  @param[in, out] DataLength           The length of data buffer.\r
-  @param[in]     StartLba             The start address of LBA.\r
-  @param[in]     SectorSize           The sector size.\r
+  @param[in]      ScsiIo               SCSI IO Protocol to use\r
+  @param[in]      Timeout              The length of timeout period.\r
+  @param[in, out] SenseData            A pointer to output sense data.\r
+  @param[in, out] SenseDataLength     The length of output sense data.\r
+  @param[out]     HostAdapterStatus    The status of Host Adapter.\r
+  @param[out]     TargetStatus         The status of the target.\r
+  @param[in, out] DataBuffer           A pointer to a data buffer.\r
+  @param[in, out] DataLength          The length of data buffer.\r
+  @param[in]      StartLba             The start address of LBA.\r
+  @param[in]      SectorSize           The sector size.\r
 \r
   @retval  EFI_SUCCESS                Command is executed successfully.\r
   @retval  EFI_WARN_BUFFER_TOO_SMALL  The SCSI Request Packet was executed, but the entire DataBuffer could\r
@@ -691,22 +775,21 @@ ScsiRead10Command (
   @retval  EFI_UNSUPPORTED            The command described by the SCSI Request Packet is not supported by \r
                                       the SCSI initiator(i.e., SCSI  Host Controller)\r
   @retval  EFI_TIMEOUT                A timeout occurred while waiting for the SCSI Request Packet to execute.\r
-  @retval  EFI_INVALID_PARAMETER      ScsiIo is NULL.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 ScsiWrite10Command (\r
-  IN  EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
-  IN  UINT64                Timeout,\r
-  IN  VOID                  *SenseData,\r
-  IN OUT UINT8              *SenseDataLength,\r
-  OUT UINT8                 *HostAdapterStatus,\r
-  OUT UINT8                 *TargetStatus,\r
-  OUT VOID                  *DataBuffer,\r
-  IN OUT UINT32             *DataLength,\r
-  IN  UINT32                StartLba,\r
-  IN  UINT32                SectorSize\r
+  IN     EFI_SCSI_IO_PROTOCOL  *ScsiIo,\r
+  IN     UINT64                Timeout,\r
+  IN OUT VOID                  *SenseData,   OPTIONAL\r
+  IN OUT UINT8                 *SenseDataLength,\r
+     OUT UINT8                 *HostAdapterStatus,\r
+     OUT UINT8                 *TargetStatus,\r
+  IN OUT VOID                  *DataBuffer,  OPTIONAL\r
+  IN OUT UINT32                *DataLength,\r
+  IN     UINT32                StartLba,\r
+  IN     UINT32                SectorSize\r
   )\r
 {\r
   EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;\r
@@ -720,10 +803,7 @@ ScsiWrite10Command (
   ASSERT (HostAdapterStatus != NULL);\r
   ASSERT (TargetStatus != NULL);\r
   ASSERT (DataLength != NULL);\r
-  \r
-  if (ScsiIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (ScsiIo != NULL);\r
 \r
   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));\r
   ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);\r
index 0e9be352067bc59e7cb78abcd2e948b220f442c5..d2a4b577ffd12e8f2919d1382e11d08131995167 100644 (file)
 //\r
 \r
 /**\r
-  Get Hid Descriptor.\r
+  Get the descriptor of the specified USB HID interface.\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  InterfaceNum      Hid interface number.\r
-  @param  HidDescriptor     Caller allocated buffer to store Usb hid descriptor if\r
-                            successfully returned.\r
+  Submit a USB get HID descriptor request for the USB device specified by UsbIo\r
+  and Interface and return the HID descriptor in HidDescriptor.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If HidDescriptor is NULL, then ASSERT().\r
 \r
-  @return Status of getting HID descriptor through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @param  UsbIo          A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface      The index of the HID interface on the USB target.\r
+  @param  HidDescriptor  Pointer to the USB HID descriptor that was retrieved from\r
+                         the specified USB target and interface. Type EFI_USB_HID_DESCRIPTOR\r
+                         is defined in the MDE Package Industry Standard include file Usb.h.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetHidDescriptor (\r
   IN  EFI_USB_IO_PROTOCOL        *UsbIo,\r
-  IN  UINT8                      InterfaceNum,\r
+  IN  UINT8                      Interface,\r
   OUT EFI_USB_HID_DESCRIPTOR     *HidDescriptor\r
   )\r
 {\r
   UINT32                  Status;\r
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
-  \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+\r
+  ASSERT(UsbIo != NULL);\r
+  ASSERT(HidDescriptor != NULL);\r
 \r
   Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;\r
   Request.Request     = USB_REQ_GET_DESCRIPTOR;\r
   Request.Value       = (UINT16) (USB_DESC_TYPE_HID << 8);\r
-  Request.Index       = InterfaceNum;\r
+  Request.Index       = Interface;\r
   Request.Length      = sizeof (EFI_USB_HID_DESCRIPTOR);\r
 \r
   Result = UsbIo->UsbControlTransfer (\r
@@ -78,24 +84,32 @@ UsbGetHidDescriptor (
 }\r
 \r
 /**\r
-  Get Report Class descriptor.\r
+  Get the report descriptor of the specified USB HID interface.\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  InterfaceNum      Report interface number.\r
-  @param  DescriptorSize    Length of DescriptorBuffer.\r
-  @param  DescriptorBuffer  Caller allocated buffer to store Usb report descriptor\r
-                            if successfully returned.\r
+  Submit a USB get HID report descriptor request for the USB device specified by\r
+  UsbIo and Interface and return the report descriptor in DescriptorBuffer.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If DescriptorBuffer is NULL, then ASSERT().\r
 \r
-  @return Status of getting Report Class descriptor through USB\r
-          I/O protocol's UsbControlTransfer().\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface         The index of the report interface on the USB target.\r
+  @param  DescriptorLength  The size, in bytes, of DescriptorBuffer.\r
+  @param  DescriptorBuffer  A pointer to the buffer to store the report class descriptor.\r
+\r
+  @retval  EFI_SUCCESS           The request executed successfully.\r
+  @retval  EFI_OUT_OF_RESOURCES  The request could not be completed because the\r
+                                 buffer specifed by DescriptorLength and DescriptorBuffer\r
+                                 is not large enough to hold the result of the request.\r
+  @retval  EFI_TIMEOUT           A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR      The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetReportDescriptor (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT8                   InterfaceNum,\r
-  IN  UINT16                  DescriptorSize,\r
+  IN  UINT8                   Interface,\r
+  IN  UINT16                  DescriptorLength,\r
   OUT UINT8                   *DescriptorBuffer\r
   )\r
 {\r
@@ -103,17 +117,17 @@ UsbGetReportDescriptor (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (DescriptorBuffer != NULL);\r
+\r
   //\r
   // Fill Device request packet\r
   //\r
   Request.RequestType = USB_HID_GET_DESCRIPTOR_REQ_TYPE;\r
   Request.Request     = USB_REQ_GET_DESCRIPTOR;\r
   Request.Value       = (UINT16) (USB_DESC_TYPE_REPORT << 8);\r
-  Request.Index       = InterfaceNum;\r
-  Request.Length      = DescriptorSize;\r
+  Request.Index       = Interface;\r
+  Request.Length      = DescriptorLength;\r
 \r
   Result = UsbIo->UsbControlTransfer (\r
                     UsbIo,\r
@@ -121,7 +135,7 @@ UsbGetReportDescriptor (
                     EfiUsbDataIn,\r
                     TIMEOUT_VALUE,\r
                     DescriptorBuffer,\r
-                    DescriptorSize,\r
+                    DescriptorLength,\r
                     &Status\r
                     );\r
 \r
@@ -130,14 +144,20 @@ UsbGetReportDescriptor (
 }\r
 \r
 /**\r
-  Get Hid Protocol Request\r
+  Get the HID protocol of the specified USB HID interface.\r
+\r
+  Submit a USB get HID protocol request for the USB device specified by UsbIo\r
+  and Interface and return the protocol retrieved in Protocol.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Protocol is NULL, then ASSERT().\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to get protocol\r
-  @param  Protocol          Protocol value returned.\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  Protocol   A pointer to the protocol for the specified USB target.\r
 \r
-  @return Status of getting Protocol Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -152,9 +172,9 @@ UsbGetProtocolRequest (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Protocol != NULL);\r
+\r
   //\r
   // Fill Device request packet\r
   //\r
@@ -180,15 +200,19 @@ UsbGetProtocolRequest (
 \r
 \r
 /**\r
-  Set Hid Protocol Request.\r
+  Set the HID protocol of the specified USB HID interface.\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to\r
-                            set protocol.\r
-  @param  Protocol          Protocol value the caller wants to set.\r
+  Submit a USB set HID protocol request for the USB device specified by UsbIo\r
+  and Interface and set the protocol to the value specified by Protocol.\r
+  If UsbIo is NULL, then ASSERT().\r
 \r
-  @return Status of setting Protocol Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  Protocol   The protocol value to set for the specified USB target.\r
+\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -203,9 +227,8 @@ UsbSetProtocolRequest (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  \r
   //\r
   // Fill Device request packet\r
   //\r
@@ -229,15 +252,20 @@ UsbSetProtocolRequest (
 \r
 \r
 /**\r
-  Set Idel request.\r
+  Set the idle rate of the specified USB HID report.\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set.\r
-  @param  ReportId          Which report the caller wants to set.\r
-  @param  Duration          Idle rate the caller wants to set.\r
+  Submit a USB set HID report idle request for the USB device specified by UsbIo,\r
+  Interface, and ReportId, and set the idle rate to the value specified by Duration.\r
+  If UsbIo is NULL, then ASSERT().\r
 \r
-  @return Status of setting IDLE Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  ReportId   The identifier of the report to retrieve.\r
+  @param  Duration   The idle rate to set for the specified USB target.\r
+\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -253,9 +281,7 @@ UsbSetIdleRequest (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
   //\r
   // Fill Device request packet\r
   //\r
@@ -279,15 +305,21 @@ UsbSetIdleRequest (
 \r
 \r
 /**\r
-  Get Idel request.\r
+  Get the idle rate of the specified USB HID report.\r
+\r
+  Submit a USB get HID report idle request for the USB device specified by UsbIo,\r
+  Interface, and ReportId, and return the ide rate in Duration.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Duration is NULL, then ASSERT().\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to get.\r
-  @param  ReportId          Which report the caller wants to get.\r
-  @param  Duration          Idle rate the caller wants to get.\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface  The index of the report interface on the USB target.\r
+  @param  ReportId   The identifier of the report to retrieve.\r
+  @param  Duration   A pointer to the idle rate retrieved from the specified USB target.\r
 \r
-  @return Status of getting IDLE Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -303,9 +335,8 @@ UsbGetIdleRequest (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
   \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Duration != NULL);\r
   //\r
   // Fill Device request packet\r
   //\r
@@ -331,17 +362,24 @@ UsbGetIdleRequest (
 \r
 \r
 /**\r
-  Hid Set Report request.\r
+  Set the report descriptor of the specified USB HID interface.\r
+\r
+  Submit a USB set HID report request for the USB device specified by UsbIo,\r
+  Interface, ReportId, and ReportType, and set the report descriptor using the\r
+  buffer specified by ReportLength and Report.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Report is NULL, then ASSERT().\r
 \r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set.\r
-  @param  ReportId          Which report the caller wants to set.\r
-  @param  ReportType        Type of report.\r
-  @param  ReportLen         Length of report descriptor.\r
-  @param  Report            Report Descriptor buffer.\r
+  @param  UsbIo         A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface     The index of the report interface on the USB target.\r
+  @param  ReportId      The identifier of the report to retrieve.\r
+  @param  ReportType    The type of report to retrieve.\r
+  @param  ReportLength  The size, in bytes, of Report.\r
+  @param  Report        A pointer to the report descriptor buffer to set.\r
 \r
-  @return Status of setting Report Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -351,7 +389,7 @@ UsbSetReportRequest (
   IN UINT8                   Interface,\r
   IN UINT8                   ReportId,\r
   IN UINT8                   ReportType,\r
-  IN UINT16                  ReportLen,\r
+  IN UINT16                  ReportLength,\r
   IN UINT8                   *Report\r
   )\r
 {\r
@@ -359,9 +397,9 @@ UsbSetReportRequest (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Report != NULL);\r
+\r
   //\r
   // Fill Device request packet\r
   //\r
@@ -369,7 +407,7 @@ UsbSetReportRequest (
   Request.Request = EFI_USB_SET_REPORT_REQUEST;\r
   Request.Value   = (UINT16) ((ReportType << 8) | ReportId);\r
   Request.Index   = Interface;\r
-  Request.Length  = ReportLen;\r
+  Request.Length  = ReportLength;\r
 \r
   Result = UsbIo->UsbControlTransfer (\r
                     UsbIo,\r
@@ -377,7 +415,7 @@ UsbSetReportRequest (
                     EfiUsbDataOut,\r
                     TIMEOUT_VALUE,\r
                     Report,\r
-                    ReportLen,\r
+                    ReportLength,\r
                     &Status\r
                     );\r
 \r
@@ -386,17 +424,27 @@ UsbSetReportRequest (
 \r
 \r
 /**\r
-  Hid Set Report request.\r
-\r
-  @param  UsbIo             EFI_USB_IO_PROTOCOL.\r
-  @param  Interface         Which interface the caller wants to set.\r
-  @param  ReportId          Which report the caller wants to set.\r
-  @param  ReportType        Type of report.\r
-  @param  ReportLen         Length of report descriptor.\r
-  @param  Report            Caller allocated buffer to store Report Descriptor.\r
-\r
-  @return Status of getting Report Request through USB I/O\r
-          protocol's UsbControlTransfer().\r
+  Get the report descriptor of the specified USB HID interface.\r
+\r
+  Submit a USB get HID report request for the USB device specified by UsbIo,\r
+  Interface, ReportId, and ReportType, and return the report in the buffer\r
+  specified by Report.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Report is NULL, then ASSERT().\r
+\r
+  @param  UsbIo         A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface     The index of the report interface on the USB target.\r
+  @param  ReportId      The identifier of the report to retrieve.\r
+  @param  ReportType    The type of report to retrieve.\r
+  @param  ReportLength  The size, in bytes, of Report.\r
+  @param  Report        A pointer to the buffer to store the report descriptor.\r
+\r
+  @retval  EFI_SUCCESS           The request executed successfully.\r
+  @retval  EFI_OUT_OF_RESOURCES  The request could not be completed because the\r
+                                 buffer specifed by ReportLength and Report is not\r
+                                 large enough to hold the result of the request.\r
+  @retval  EFI_TIMEOUT           A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR      The request failed due to a device error.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -414,9 +462,9 @@ UsbGetReportRequest (
   EFI_STATUS              Result;\r
   EFI_USB_DEVICE_REQUEST  Request;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Report != NULL);\r
+\r
   //\r
   // Fill Device request packet\r
   //\r
index 12290dc57193bcdcb6a5a09c3743e9c4906613b9..6ebd81a4265f3acc88214e346af1cb78e9b9b5cc 100644 (file)
@@ -38,5 +38,6 @@
   MdePkg/MdePkg.dec\r
 \r
 [LibraryClasses]\r
+  DebugLib\r
   BaseMemoryLib\r
 \r
index e8c817ae1d32900c37df7135bf782dfac1bc4cdd..329606d565f2ec388576e989f95915497a66a246 100644 (file)
    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 **/\r
 \r
-#ifndef __UEFI_USB_LIB_INTERNAL_H_\r
-#define __UEFI_USB_LIB_INTERNAL_H_\r
+#ifndef _UEFI_USB_LIB_INTERNAL_H_\r
+#define _UEFI_USB_LIB_INTERNAL_H_\r
 \r
 #include <Uefi.h>\r
+\r
 #include <Library/UefiUsbLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#include <IndustryStandard/Usb.h>\r
+\r
 \r
 #endif\r
index 18fe37c381d4ff11fd20f72ddc1c2786e2184a34..a15ef6ebefc5db582c8a19576cbf811581240a6b 100644 (file)
 \r
 \r
 /**\r
-  Usb Get Descriptor.\r
-\r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Value                  Device Request Value.\r
-  @param  Index                  Device Request Index.\r
-  @param  DescriptorLength       Descriptor Length.\r
-  @param  Descriptor             Descriptor buffer to contain result.\r
-  @param  Status                 Transfer Status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Get the descriptor of the specified USB device.\r
+\r
+  Submit a USB get descriptor request for the USB device specified by UsbIo, Value,\r
+  and Index, and return the descriptor in the buffer specified by Descriptor.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Descriptor is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Value             The device request value.\r
+  @param  Index             The device request index.\r
+  @param  DescriptorLength  The size, in bytes, of Descriptor.\r
+  @param  Descriptor        A pointer to the descriptor buffer to get.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS           The request executed successfully.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed because the\r
+                                buffer specifed by DescriptorLength and Descriptor\r
+                                is not large enough to hold the result of the request.\r
+  @retval EFI_TIMEOUT           A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR      The request failed due to a device error. The transfer\r
+                                status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -46,9 +57,9 @@ UsbGetDescriptor (
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Descriptor != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
@@ -71,18 +82,26 @@ UsbGetDescriptor (
 \r
 \r
 /**\r
-  Usb Set Descriptor.\r
-\r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Value                  Device Request Value.\r
-  @param  Index                  Device Request Index.\r
-  @param  DescriptorLength       Descriptor Length.\r
-  @param  Descriptor             Descriptor buffer to set.\r
-  @param  Status                 Transfer Status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Set the descriptor of the specified USB device.\r
+\r
+  Submit a USB set descriptor request for the USB device specified by UsbIo,\r
+  Value, and Index, and set the descriptor using the buffer specified by DesriptorLength\r
+  and Descriptor.  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Descriptor is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Value             The device request value.\r
+  @param  Index             The device request index.\r
+  @param  DescriptorLength  The size, in bytes, of Descriptor.\r
+  @param  Descriptor        A pointer to the descriptor buffer to set.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval  EFI_SUCCESS       The request executed successfully.\r
+  @retval  EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval  EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                             The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -98,9 +117,9 @@ UsbSetDescriptor (
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Descriptor != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
@@ -123,38 +142,46 @@ UsbSetDescriptor (
 \r
 \r
 /**\r
-  Usb Get Device Interface.\r
+  Get the interface setting of the specified USB device.\r
 \r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Index                  Interface index value.\r
-  @param  AltSetting             Alternate setting.\r
-  @param  Status                 Trasnsfer status.\r
+  Submit a USB get interface request for the USB device specified by UsbIo,\r
+  and Interface, and place the result in the buffer specified by AlternateSetting.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If AlternateSetting is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface         The interface index value.\r
+  @param  AlternateSetting  A pointer to the alternate setting to be retrieved.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetInterface (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT16                  Index,\r
-  OUT UINT8                   *AltSetting,\r
+  IN  UINT16                  Interface,\r
+  OUT UINT8                   *AlternateSetting,\r
   OUT UINT32                  *Status\r
   )\r
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (AlternateSetting != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
   DevReq.RequestType  = USB_DEV_GET_INTERFACE_REQ_TYPE;\r
   DevReq.Request      = USB_REQ_GET_INTERFACE;\r
-  DevReq.Index        = Index;\r
+  DevReq.Index        = Interface;\r
   DevReq.Length       = 1;\r
 \r
   return UsbIo->UsbControlTransfer (\r
@@ -162,7 +189,7 @@ UsbGetInterface (
                   &DevReq,\r
                   EfiUsbDataIn,\r
                   TIMEOUT_VALUE,\r
-                  AltSetting,\r
+                  AlternateSetting,\r
                   1,\r
                   Status\r
                   );\r
@@ -170,40 +197,45 @@ UsbGetInterface (
 \r
 \r
 /**\r
-  Usb Set Device Interface.\r
+  Set the interface setting of the specified USB device.\r
 \r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  InterfaceNo            Interface Number.\r
-  @param  AltSetting             Alternate setting.\r
-  @param  Status                 Trasnsfer status.\r
+  Submit a USB set interface request for the USB device specified by UsbIo, and\r
+  Interface, and set the alternate setting to the value specified by AlternateSetting.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @param  UsbIo             A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Interface         The interface index value.\r
+  @param  AlternateSetting  The alternate setting to be set.\r
+  @param  Status            A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS  The request executed successfully.\r
+  @retval EFI_TIMEOUT  A timeout occurred executing the request.\r
+  @retval EFI_SUCCESS  The request failed due to a device error.\r
+                       The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbSetInterface (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT16                  InterfaceNo,\r
-  IN  UINT16                  AltSetting,\r
+  IN  UINT16                  Interface,\r
+  IN  UINT16                  AlternateSetting,\r
   OUT UINT32                  *Status\r
   )\r
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
   DevReq.RequestType  = USB_DEV_SET_INTERFACE_REQ_TYPE;\r
   DevReq.Request      = USB_REQ_SET_INTERFACE;\r
-  DevReq.Value        = AltSetting;\r
-  DevReq.Index        = InterfaceNo;\r
-\r
+  DevReq.Value        = AlternateSetting;\r
+  DevReq.Index        = Interface;\r
 \r
   return UsbIo->UsbControlTransfer (\r
                   UsbIo,\r
@@ -218,30 +250,38 @@ UsbSetInterface (
 \r
 \r
 /**\r
-  Usb Get Device Configuration.\r
+  Get the device configuration.\r
+\r
+  Submit a USB get configuration request for the USB device specified by UsbIo\r
+  and place the result in the buffer specified by ConfigurationValue. The status\r
+  of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If ConfigurationValue is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  ConfigValue            Config Value.\r
-  @param  Status                 Transfer Status.\r
+  @param  UsbIo               A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  ConfigurationValue  A pointer to the device configuration to be retrieved.\r
+  @param  Status              A pointer to the status of the transfer.\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @retval EFI_SUCCESS        The request executed successfully.\r
+  @retval EFI_TIMEOUT        A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR   The request failed due to a device error.\r
+                             The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetConfiguration (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  OUT UINT8                   *ConfigValue,\r
+  OUT UINT8                   *ConfigurationValue,\r
   OUT UINT32                  *Status\r
   )\r
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (ConfigurationValue != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
@@ -254,7 +294,7 @@ UsbGetConfiguration (
                   &DevReq,\r
                   EfiUsbDataIn,\r
                   TIMEOUT_VALUE,\r
-                  ConfigValue,\r
+                  ConfigurationValue,\r
                   1,\r
                   Status\r
                   );\r
@@ -262,36 +302,42 @@ UsbGetConfiguration (
 \r
 \r
 /**\r
-  Usb Set Device Configuration.\r
+  Set the device configuration.\r
+\r
+  Submit a USB set configuration request for the USB device specified by UsbIo\r
+  and set the device configuration to the value specified by ConfigurationValue.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Value                  Configuration Value to set.\r
-  @param  Status                 Transfer status.\r
+  @param  UsbIo               A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  ConfigurationValue  The device configuration value to be set.\r
+  @param  Status              A pointer to the status of the transfer.\r
 \r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbSetConfiguration (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT16                  Value,\r
+  IN  UINT16                  ConfigurationValue,\r
   OUT UINT32                  *Status\r
   )\r
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
   DevReq.RequestType  = USB_DEV_SET_CONFIGURATION_REQ_TYPE;\r
   DevReq.Request      = USB_REQ_SET_CONFIG;\r
-  DevReq.Value        = Value;\r
+  DevReq.Value        = ConfigurationValue;\r
 \r
   return UsbIo->UsbControlTransfer (\r
                   UsbIo,\r
@@ -306,24 +352,33 @@ UsbSetConfiguration (
 \r
 \r
 /**\r
-  Usb Set Device Feature.\r
-\r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Recipient              Interface/Device/Endpoint.\r
-  @param  Value                  Request value.\r
-  @param  Target                 Request Index.\r
-  @param  Status                 Transfer status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Set the specified feature of the specified device.\r
+\r
+  Submit a USB set device feature request for the USB device specified by UsbIo,\r
+  Recipient, and Target to the value specified by Value.  The status of the\r
+  transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Recipient  The USB data recipient type (i.e. Device, Interface, Endpoint).\r
+                     Type USB_TYPES_DEFINITION is defined in the MDE Package Industry\r
+                     Standard include file Usb.h.\r
+  @param  Value      The value of the feature to be set.\r
+  @param  Target     The index of the device to be set.\r
+  @param  Status     A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbSetFeature (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINTN       Recipient,\r
+  IN  USB_TYPES_DEFINITION    Recipient,\r
   IN  UINT16                  Value,\r
   IN  UINT16                  Target,\r
   OUT UINT32                  *Status\r
@@ -331,9 +386,8 @@ UsbSetFeature (
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
@@ -372,24 +426,33 @@ UsbSetFeature (
 \r
 \r
 /**\r
-  Usb Clear Device Feature.\r
-\r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Recipient              Interface/Device/Endpoint.\r
-  @param  Value                  Request value.\r
-  @param  Target                 Request Index.\r
-  @param  Status                 Transfer status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Clear the specified feature of the specified device.\r
+\r
+  Submit a USB clear device feature request for the USB device specified by UsbIo,\r
+  Recipient, and Target to the value specified by Value.  The status of the transfer\r
+  is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo      A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Recipient  The USB data recipient type (i.e. Device, Interface, Endpoint).\r
+                     Type USB_TYPES_DEFINITION is defined in the MDE Package Industry Standard\r
+                     include file Usb.h.\r
+  @param  Value      The value of the feature to be cleared.\r
+  @param  Target     The index of the device to be cleared.\r
+  @param  Status     A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbClearFeature (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINTN       Recipient,\r
+  IN  USB_TYPES_DEFINITION    Recipient,\r
   IN  UINT16                  Value,\r
   IN  UINT16                  Target,\r
   OUT UINT32                  *Status\r
@@ -397,9 +460,9 @@ UsbClearFeature (
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Status != NULL);\r
+\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
@@ -438,34 +501,44 @@ UsbClearFeature (
 \r
 \r
 /**\r
-  Usb Get Device Status.\r
-\r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  Recipient              Interface/Device/Endpoint.\r
-  @param  Target                 Request index.\r
-  @param  DevStatus              Device status.\r
-  @param  Status                 Transfer status.\r
-\r
-  @retval EFI_INVALID_PARAMETER  Parameter is error.\r
-  @retval EFI_SUCCESS            Success.\r
-  @retval EFI_TIMEOUT            Device has no response.\r
+  Get the status of the specified device.\r
+\r
+  Submit a USB device get status request for the USB device specified by UsbIo,\r
+  Recipient, and Target and place the result in the buffer specified by DeviceStatus.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If DeviceStatus is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
+\r
+  @param  UsbIo         A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Recipient     The USB data recipient type (i.e. Device, Interface, Endpoint).\r
+                        Type USB_TYPES_DEFINITION is defined in the MDE Package Industry Standard\r
+                        include file Usb.h.\r
+  @param  Target        The index of the device to be get the status of.\r
+  @param  DeviceStatus  A pointer to the device status to be retrieved.\r
+  @param  Status        A pointer to the status of the transfer.\r
+\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbGetStatus (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINTN       Recipient,\r
+  IN  USB_TYPES_DEFINITION    Recipient,\r
   IN  UINT16                  Target,\r
-  OUT UINT16                  *DevStatus,\r
+  OUT UINT16                  *DeviceStatus,\r
   OUT UINT32                  *Status\r
   )\r
 {\r
   EFI_USB_DEVICE_REQUEST  DevReq;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (DeviceStatus != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
 \r
@@ -496,7 +569,7 @@ UsbGetStatus (
                   &DevReq,\r
                   EfiUsbDataIn,\r
                   TIMEOUT_VALUE,\r
-                  DevStatus,\r
+                  DeviceStatus,\r
                   2,\r
                   Status\r
                   );\r
@@ -504,22 +577,31 @@ UsbGetStatus (
 \r
 \r
 /**\r
-  Clear endpoint stall.\r
+  Clear halt feature of the specified usb endpoint.\r
+\r
+  Retrieve the USB endpoint descriptor specified by UsbIo and EndPoint.\r
+  If the USB endpoint descriptor can not be retrieved, then return EFI_NOT_FOUND.\r
+  If the endpoint descriptor is found, then clear the halt fature of this USB endpoint.\r
+  The status of the transfer is returned in Status.\r
+  If UsbIo is NULL, then ASSERT().\r
+  If Status is NULL, then ASSERT().\r
 \r
-  @param  UsbIo                  EFI_USB_IO_PROTOCOL.\r
-  @param  EndpointNo             Endpoint Number.\r
-  @param  Status                 Transfer Status.\r
+  @param  UsbIo     A pointer to the USB I/O Protocol instance for the specific USB target.\r
+  @param  Endpoint  The endpoint address.\r
+  @param  Status    A pointer to the status of the transfer.\r
 \r
-  @retval EFI_NOT_FOUND          Can't find the Endpoint.\r
-  @retval EFI_DEVICE_ERROR       Hardware error.\r
-  @retval EFI_SUCCESS            Success.\r
+  @retval EFI_SUCCESS       The request executed successfully.\r
+  @retval EFI_TIMEOUT       A timeout occurred executing the request.\r
+  @retval EFI_DEVICE_ERROR  The request failed due to a device error.\r
+                            The transfer status is returned in Status.\r
+  @retval EFI_NOT_FOUND     The specified USB endpoint descriptor can not be found\r
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbClearEndpointHalt (\r
   IN  EFI_USB_IO_PROTOCOL     *UsbIo,\r
-  IN  UINT8                   EndpointNo,\r
+  IN  UINT8                   Endpoint,\r
   OUT UINT32                  *Status\r
   )\r
 {\r
@@ -528,9 +610,8 @@ UsbClearEndpointHalt (
   EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;\r
   UINT8                         Index;\r
 \r
-  if (UsbIo == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  ASSERT (UsbIo != NULL);\r
+  ASSERT (Status != NULL);\r
 \r
   ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));\r
   //\r
@@ -554,7 +635,7 @@ UsbClearEndpointHalt (
       continue;\r
     }\r
 \r
-    if (EndpointDescriptor.EndpointAddress == EndpointNo) {\r
+    if (EndpointDescriptor.EndpointAddress == Endpoint) {\r
       break;\r
     }\r
   }\r