]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassCbi.c
index d56254b77c8d406244c90e5cdc8bd2571665b9a5..f9c56e24e8dc0664fa6202b6dbccc064eb0fff8f 100644 (file)
@@ -4,8 +4,8 @@
   Notice: it is being obsoleted by the standard body in favor of the BOT\r
   (Bulk-Only Transport).\r
 \r
-Copyright (c) 2007 - 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-#include "UsbMass.h"\r
+#include "UsbMassBoot.h"\r
 #include "UsbMassCbi.h"\r
 \r
 //\r
@@ -146,13 +146,13 @@ UsbCbiInit (
   if (Context != NULL) {\r
     *Context = UsbCbi;\r
   } else {\r
-    gBS->FreePool (UsbCbi);\r
+    FreePool (UsbCbi);\r
   }\r
  \r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r
-  gBS->FreePool (UsbCbi);\r
+  FreePool (UsbCbi);\r
   return Status;\r
 }\r
 \r
@@ -457,6 +457,7 @@ UsbCbiExecCommand (
   //\r
   Status = UsbCbiSendCommand (UsbCbi, Cmd, CmdLen, Timeout);\r
   if (EFI_ERROR (Status)) {\r
+    gBS->Stall(10 * USB_MASS_1_MILLISECOND);\r
     DEBUG ((EFI_D_ERROR, "UsbCbiExecCommand: UsbCbiSendCommand (%r)\n",Status));\r
     return Status;\r
   }\r
@@ -486,10 +487,12 @@ UsbCbiExecCommand (
     //\r
     // For UFI device, ASC and ASCQ are returned.\r
     //\r
-    if (Result.Type != 0) {\r
+    // Do not set the USB_MASS_CMD_FAIL for a request sense command\r
+    // as a bad result type doesn't mean a cmd failure\r
+    //\r
+    if (Result.Type != 0 && *(UINT8*)Cmd != 0x03) {\r
       *CmdStatus = USB_MASS_CMD_FAIL;\r
     }\r
-\r
   } else {\r
     //\r
     // Check page 27, CBI spec 1.1 for vaious reture status.\r
@@ -605,6 +608,6 @@ UsbCbiCleanUp (
   IN  VOID                   *Context\r
   )\r
 {\r
-  gBS->FreePool (Context);\r
+  FreePool (Context);\r
   return EFI_SUCCESS;\r
 }\r