]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg UefiDpLib: Use Image->FilePath to get name for SMM drivers
authorStar Zeng <star.zeng@intel.com>
Tue, 19 Jan 2016 09:19:37 +0000 (09:19 +0000)
committerlzeng14 <lzeng14@Edk2>
Tue, 19 Jan 2016 09:19:37 +0000 (09:19 +0000)
This enhancement is to use the FilePath field in the loaded image
protocol to find the name of an image as a fallback for when the
loaded image device path protocol is not installed on the image handle.
This is necessary because the SMM core does not install the loaded
image device path protocol, so DP was displaying "Unknown Driver Name"
for every SMM driver.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Shumin Qiu <shumin.qiu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19683 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiDpLib/DpUtilities.c

index e9d8fb3adf31e363ffb67a2bdfcb202e9b7a2a16..032e7b4ce1bdd5cc50cd5df9b7cbc06100a01dcb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Utility functions used by the Dp application.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.\r
+  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.\r
   (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -206,6 +206,10 @@ DpGetNameFromHandle (
   CHAR8                       *PlatformLanguage;\r
   EFI_COMPONENT_NAME2_PROTOCOL      *ComponentName2;\r
 \r
+  Image = NULL;\r
+  LoadedImageDevicePath = NULL;\r
+  DevicePath = NULL;\r
+\r
   //\r
   // Method 1: Get the name string from image PDB\r
   //\r
@@ -275,9 +279,13 @@ DpGetNameFromHandle (
                   );\r
   if (!EFI_ERROR (Status) && (LoadedImageDevicePath != NULL)) {\r
     DevicePath = LoadedImageDevicePath;\r
+  } else if (Image != NULL) {\r
+    DevicePath = Image->FilePath;\r
+  }\r
 \r
+  if (DevicePath != NULL) {\r
     //\r
-    // Try to get image GUID from LoadedImageDevicePath protocol\r
+    // Try to get image GUID from image DevicePath\r
     //\r
     NameGuid = NULL;\r
     while (!IsDevicePathEndType (DevicePath)) {\r
@@ -320,7 +328,7 @@ DpGetNameFromHandle (
       //\r
       // Method 5: Get the name string from image DevicePath\r
       //\r
-      NameString = ConvertDevicePathToText (LoadedImageDevicePath, TRUE, FALSE);\r
+      NameString = ConvertDevicePathToText (DevicePath, TRUE, FALSE);\r
       if (NameString != NULL) {\r
         StrnCpyS (mGaugeString, DP_GAUGE_STRING_LENGTH + 1, NameString, DP_GAUGE_STRING_LENGTH);\r
         mGaugeString[DP_GAUGE_STRING_LENGTH] = 0;\r