diff options
author | Qiu Shumin <shumin.qiu@intel.com> | 2015-12-10 07:21:12 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-12-10 07:21:12 +0000 |
commit | b0fdb34d967435c34f28a3da3b09398ff600f145 (patch) | |
tree | 6180fb6cf03d4e80294fdf3242a26a094a2db6aa /ShellPkg/Library/UefiShellCommandLib | |
parent | d839b9c0f0c80161b932f2c4d153c555b1322610 (diff) | |
download | edk2-platforms-b0fdb34d967435c34f28a3da3b09398ff600f145.tar.xz |
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.
(Sync patch r19149 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19194 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellCommandLib')
-rw-r--r-- | ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c index 9bd7b2cedd..86e8dc59a8 100644 --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c @@ -16,6 +16,10 @@ #include <Library/SortLib.h>
#include <Library/UefiLib.h>
#include <Protocol/UsbIo.h>
+#include <Protocol/BlockIo.h>
+#include <Protocol/SimpleFileSystem.h>
+
+
typedef enum {
MTDTypeUnknown,
@@ -1349,20 +1353,22 @@ ShellCommandConsistMappingInitialize ( 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,
- NULL,
+ ByProtocol,
+ &gEfiDevicePathProtocolGuid,
NULL,
&HandleNum,
&HandleBuffer
@@ -1385,6 +1391,20 @@ ShellCommandConsistMappingInitialize ( 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);
|