Revision: 14680
          http://sourceforge.net/p/edk2/code/14680
Author:   niruiyu
Date:     2013-09-17 05:11:30 +0000 (Tue, 17 Sep 2013)
Log Message:
-----------
Fix 3 bugs in DiskIoDxe and PartitionDxe drivers introduced in DiskIo2 
implementation.
1. DiskIo2 shouldn't signal the event when the *Ex interface returns failure 
status per the UEFI spec.
2. PartitionDxe should close DiskIo2 protocol when error happens in 
DriverBindingStart() otherwise Fat driver cannot open the DiskIo2 BY_DRIVER.
3. PartitionDxe should create event using TPL_NOTIFY instead of TPL_CALLBACK 
otherwise asynchronous FileIo may be blocked.

Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Feng Tian <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
    trunk/edk2/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c

Modified: trunk/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c   2013-09-17 
00:33:25 UTC (rev 14679)
+++ trunk/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c   2013-09-17 
05:11:30 UTC (rev 14680)
@@ -403,8 +403,6 @@
   EFI_STATUS            TransactionStatus;
   DISK_IO_PRIVATE_DATA  *Instance;
 
-  gBS->CloseEvent (Event);
-
   Subtask           = (DISK_IO_SUBTASK *) Context;
   TransactionStatus = Subtask->BlockIo2Token.TransactionStatus;
   Task              = Subtask->Task;
@@ -414,27 +412,14 @@
   ASSERT (Instance->Signature == DISK_IO_PRIVATE_DATA_SIGNATURE);
   ASSERT (Task->Signature     == DISK_IO2_TASK_SIGNATURE);
 
-  if (Subtask->WorkingBuffer != NULL) {
-    if (!EFI_ERROR (TransactionStatus) && (Task->Token != NULL) && 
!Subtask->Write) {
-      CopyMem (Subtask->Buffer, Subtask->WorkingBuffer + Subtask->Offset, 
Subtask->Length);
-    }
-
-    //
-    // The WorkingBuffer of blocking subtask either points to 
SharedWorkingBuffer
-    // or will be used by non-blocking subtask which will be freed below.
-    //
-    if (!Subtask->Blocking) {
-      FreeAlignedPages (
-        Subtask->WorkingBuffer, 
-        Subtask->Length < Instance->BlockIo->Media->BlockSize
-        ? EFI_SIZE_TO_PAGES (Instance->BlockIo->Media->BlockSize)
-        : EFI_SIZE_TO_PAGES (Subtask->Length)
-        );
-    }
+  if ((Subtask->WorkingBuffer != NULL) && !EFI_ERROR (TransactionStatus) && 
+      (Task->Token != NULL) && !Subtask->Write
+     ) {
+    CopyMem (Subtask->Buffer, Subtask->WorkingBuffer + Subtask->Offset, 
Subtask->Length);
   }
-  RemoveEntryList (&Subtask->Link);
-  FreePool (Subtask);
 
+  DiskIoDestroySubtask (Instance, Subtask);
+
   if (EFI_ERROR (TransactionStatus) || IsListEmpty (&Task->Subtasks)) {
     if (Task->Token != NULL) {
       //
@@ -961,7 +946,7 @@
     RemoveEntryList (&Task->Link);
     EfiReleaseLock (&Instance->TaskQueueLock);
 
-    if (Task->Token != NULL) {
+    if (!EFI_ERROR (Status) && (Task->Token != NULL)) {
       //
       // Task->Token should be set to NULL by the DiskIo2OnReadWriteComplete
       // It it's not, that means the non-blocking request was downgraded to 
blocking request.

Modified: trunk/edk2/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c     
2013-09-17 00:33:25 UTC (rev 14679)
+++ trunk/edk2/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c     
2013-09-17 05:11:30 UTC (rev 14680)
@@ -352,11 +352,11 @@
           ControllerHandle
           );
     //
-    // Close Parent BlockIO2 if has.
+    // Close Parent DiskIo2 if has.
     //    
     gBS->CloseProtocol (
            ControllerHandle,
-           &gEfiBlockIo2ProtocolGuid,
+           &gEfiDiskIo2ProtocolGuid,
            This->DriverBindingHandle,
            ControllerHandle
            );
@@ -822,7 +822,7 @@
 
   Status = gBS->CreateEvent (
                   EVT_NOTIFY_SIGNAL,
-                  TPL_CALLBACK,
+                  TPL_NOTIFY,
                   PartitionOnAccessComplete,
                   Task,
                   &Task->DiskIo2Token.Event

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to