]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
ShellPkg: elevate DumpHex() from Debug1-internal to generic-internal
[mirror_edk2.git] / ShellPkg / Library / UefiShellCommandLib / ConsistMapping.c
index 368d6a487b87cee5618c25012a81c68da959f488..41754dd905d699bae30c3d304a156517f0c359d1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for support of shell consist mapping.\r
 \r
-  Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 2015, 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
 #include <Library/SortLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Protocol/UsbIo.h>\r
+#include <Protocol/BlockIo.h>\r
+#include <Protocol/SimpleFileSystem.h>\r
+\r
+\r
 \r
 typedef enum {\r
   MTDTypeUnknown,\r
@@ -116,7 +120,7 @@ CatPrint (
     ASSERT (Str->Str != NULL);\r
   }\r
 \r
-  StrnCat (Str->Str, AppendStr, StringSize/sizeof(CHAR16) - 1 - StrLen(Str->Str));\r
+  StrCatS (Str->Str, StringSize/sizeof(CHAR16), AppendStr);\r
   Str->Len = StringSize;\r
 \r
   FreePool (AppendStr);\r
@@ -1349,20 +1353,22 @@ ShellCommandConsistMappingInitialize (
   OUT EFI_DEVICE_PATH_PROTOCOL           ***Table\r
   )\r
 {\r
-  EFI_HANDLE                *HandleBuffer;\r
-  UINTN                     HandleNum;\r
-  UINTN                     HandleLoop;\r
-  EFI_DEVICE_PATH_PROTOCOL  **TempTable;\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL  *HIDevicePath;\r
-  UINTN                     Index;\r
-  EFI_STATUS                Status;\r
+  EFI_HANDLE                      *HandleBuffer;\r
+  UINTN                           HandleNum;\r
+  UINTN                           HandleLoop;\r
+  EFI_DEVICE_PATH_PROTOCOL        **TempTable;\r
+  EFI_DEVICE_PATH_PROTOCOL        *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL        *HIDevicePath;\r
+  EFI_BLOCK_IO_PROTOCOL           *BlockIo;\r
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;\r
+  UINTN                           Index;\r
+  EFI_STATUS                      Status;\r
 \r
   HandleBuffer              = NULL;\r
 \r
   Status = gBS->LocateHandleBuffer (\r
-              AllHandles,\r
-              NULL,\r
+              ByProtocol,\r
+              &gEfiDevicePathProtocolGuid,\r
               NULL,\r
               &HandleNum,\r
               &HandleBuffer\r
@@ -1385,6 +1391,21 @@ ShellCommandConsistMappingInitialize (
       continue;\r
     }\r
 \r
+    Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], \r
+                                  &gEfiBlockIoProtocolGuid, \r
+                                  (VOID **)&BlockIo\r
+                                  );\r
+    if (EFI_ERROR(Status)) {\r
+      Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], \r
+                                    &gEfiSimpleFileSystemProtocolGuid, \r
+                                    (VOID **)&SimpleFileSystem\r
+                                    );\r
+      if (EFI_ERROR(Status)) {\r
+        FreePool (HIDevicePath);\r
+        continue;\r
+      }\r
+    }\r
+\r
     for (Index = 0; TempTable[Index] != NULL; Index++) {\r
       if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) {\r
         FreePool (HIDevicePath);\r