]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/UefiPxeBcDxe/ComponentName.c
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / NetworkPkg / UefiPxeBcDxe / ComponentName.c
index 05e338a7f98cd340f991a87acf2237fe237bb7f3..6e48d4aa188f2e6b73acd4cd0dc0dadcf9141adc 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Component Name(2) protocol implementation for UefiPxeBc driver.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -171,6 +171,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE       mPxeBcDriverNameTab
   }\r
 };\r
 \r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE       mPxeBcControllerNameTable[] = {\r
+  {\r
+    "eng;en",\r
+    L"PXE Controller"\r
+  },\r
+  {\r
+    NULL,\r
+    NULL\r
+  }\r
+};\r
 \r
 /**\r
   Retrieves a Unicode string that is the user-readable name of the driver.\r
@@ -307,6 +317,42 @@ PxeBcComponentNameGetControllerName (
   OUT CHAR16                       **ControllerName\r
   )\r
 {\r
-  return EFI_UNSUPPORTED;\r
-}\r
+  EFI_STATUS                      Status;\r
+  EFI_HANDLE                      NicHandle;\r
+  PXEBC_PRIVATE_PROTOCOL          *Id;\r
 \r
+  if (ControllerHandle == NULL || ChildHandle != NULL) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  \r
+  NicHandle = PxeBcGetNicByIp4Children (ControllerHandle);\r
+  if (NicHandle == NULL) {\r
+    NicHandle = PxeBcGetNicByIp6Children (ControllerHandle);\r
+    if (NicHandle == NULL) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+  }\r
+\r
+  //\r
+  // Try to retrieve the private data by PxeBcPrivate protocol.\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                  NicHandle,\r
+                  &gEfiCallerIdGuid,\r
+                  (VOID **) &Id,\r
+                  NULL,\r
+                  NULL,\r
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  return LookupUnicodeString2 (\r
+           Language,\r
+           This->SupportedLanguages,\r
+           mPxeBcControllerNameTable,\r
+           ControllerName,\r
+           (BOOLEAN)(This == &gPxeBcComponentName)\r
+           );\r
+}\r