]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c
MdeModulePkg UsbMass: Correct comment about TPL for BLOCK IO APIs
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassImpl.c
index be11cc78fefa77eba99fb4d76979c660ddee8085..448bcc2f80ac800caba3028a1be84ec0a16a992e 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 - 2014, 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
@@ -60,10 +60,10 @@ UsbMassReset (
   EFI_STATUS      Status;\r
 \r
   //\r
-  // Raise TPL to TPL_NOTIFY to serialize all its operations\r
+  // Raise TPL to TPL_CALLBACK to serialize all its operations\r
   // to protect shared data structures.\r
   //\r
-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);\r
+  OldTpl  = gBS->RaiseTPL (TPL_CALLBACK);\r
 \r
   UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This);\r
   Status  = UsbMass->Transport->Reset (UsbMass->Context, ExtendedVerification);\r
@@ -114,10 +114,10 @@ UsbMassReadBlocks (
   UINTN               TotalBlock;\r
 \r
   //\r
-  // Raise TPL to TPL_NOTIFY to serialize all its operations\r
+  // Raise TPL to TPL_CALLBACK to serialize all its operations\r
   // to protect shared data structures.\r
   //\r
-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);\r
+  OldTpl  = gBS->RaiseTPL (TPL_CALLBACK);\r
   UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This);\r
   Media   = &UsbMass->BlockIoMedia;\r
 \r
@@ -230,10 +230,10 @@ UsbMassWriteBlocks (
   UINTN               TotalBlock;\r
 \r
   //\r
-  // Raise TPL to TPL_NOTIFY to serialize all its operations\r
+  // Raise TPL to TPL_CALLBACK to serialize all its operations\r
   // to protect shared data structures.\r
   //\r
-  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);\r
+  OldTpl  = gBS->RaiseTPL (TPL_CALLBACK);\r
   UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This);\r
   Media   = &UsbMass->BlockIoMedia;\r
 \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