Revision: 19149
          http://sourceforge.net/p/edk2/code/19149
Author:   shenshushi
Date:     2015-12-08 02:00:16 +0000 (Tue, 08 Dec 2015)
Log Message:
-----------
ShellPkg: Refine the code to reduce time cost of 'map -r'

In some platform 'map -r' may cost more than 1 min. This patch filter the 
target handles by
BlockIO and SimpleFileSystem protocol to reduce the time cost.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c

Modified: trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c    
2015-12-07 16:51:35 UTC (rev 19148)
+++ trunk/edk2/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c    
2015-12-08 02:00:16 UTC (rev 19149)
@@ -16,7 +16,11 @@
 #include <Library/SortLib.h>
 #include <Library/UefiLib.h>
 #include <Protocol/UsbIo.h>
+#include <Protocol/BlockIo.h>
+#include <Protocol/SimpleFileSystem.h>
 
+
+
 typedef enum {
   MTDTypeUnknown,
   MTDTypeFloppy,
@@ -1349,21 +1353,23 @@
   OUT EFI_DEVICE_PATH_PROTOCOL           ***Table
   )
 {
-  EFI_HANDLE                *HandleBuffer;
-  UINTN                     HandleNum;
-  UINTN                     HandleLoop;
-  EFI_DEVICE_PATH_PROTOCOL  **TempTable;
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  EFI_DEVICE_PATH_PROTOCOL  *HIDevicePath;
-  UINTN                     Index;
-  EFI_STATUS                Status;
+  EFI_HANDLE                      *HandleBuffer;
+  UINTN                           HandleNum;
+  UINTN                           HandleLoop;
+  EFI_DEVICE_PATH_PROTOCOL        **TempTable;
+  EFI_DEVICE_PATH_PROTOCOL        *DevicePath;
+  EFI_DEVICE_PATH_PROTOCOL        *HIDevicePath;
+  EFI_BLOCK_IO_PROTOCOL           *BlockIo;
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
+  UINTN                           Index;
+  EFI_STATUS                      Status;
 
   HandleBuffer              = NULL;
 
   Status = gBS->LocateHandleBuffer (
-              AllHandles,
+              ByProtocol,
+              &gEfiDevicePathProtocolGuid,
               NULL,
-              NULL,
               &HandleNum,
               &HandleBuffer
              );
@@ -1385,6 +1391,20 @@
       continue;
     }
 
+    Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], 
+                                  &gEfiBlockIoProtocolGuid, 
+                                  (VOID **)&BlockIo
+                                  );
+    if (EFI_ERROR(Status)) {
+      Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], 
+                                    &gEfiSimpleFileSystemProtocolGuid, 
+                                    (VOID **)&SimpleFileSystem
+                                    );
+      if (EFI_ERROR(Status)) {
+        continue;
+      }
+    }
+
     for (Index = 0; TempTable[Index] != NULL; Index++) {
       if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) {
         FreePool (HIDevicePath);


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to