]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c
MdeModulePkg/UsbMass: Retry CMD for MediaChanged sense key
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassImpl.c
index 9d1bb25fb39d630b73ae4bd9a7c0e8f1e53ed2e6..bb292ed3eba8866bfb1f07ef674a362efc05f1a3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   USB Mass Storage Driver that manages USB Mass Storage Device and produces Block I/O Protocol.\r
 \r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -361,6 +361,14 @@ UsbMassInitMedia (
   Media->MediaId          = 1;\r
 \r
   Status = UsbBootGetParams (UsbMass);\r
+  DEBUG ((DEBUG_INFO, "UsbMassInitMedia: UsbBootGetParams (%r)\n", Status));\r
+  if (Status == EFI_MEDIA_CHANGED) {\r
+    //\r
+    // Some USB storage devices may report MEDIA_CHANGED sense key when hot-plugged.\r
+    // Treat it as SUCCESS\r
+    //\r
+    Status = EFI_SUCCESS;\r
+  }\r
   return Status;\r
 }\r
 \r