-/**\r
- Internal function to get the child handle of the NIC handle.\r
-\r
- @param[in] Controller NIC controller handle.\r
- @param[out] ChildHandle Returned child handle.\r
-\r
- @retval EFI_SUCCESS Successfully to get child handle.\r
- @retval Others Failed to get child handle.\r
-\r
-**/\r
-EFI_STATUS\r
-NetGetChildHandle (\r
- IN EFI_HANDLE Controller,\r
- OUT EFI_HANDLE *ChildHandle\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_HANDLE *Handles;\r
- UINTN HandleCount;\r
- UINTN Index;\r
- EFI_DEVICE_PATH_PROTOCOL *ChildDeviceDevicePath;\r
- VENDOR_DEVICE_PATH *VendorDeviceNode;\r
-\r
- //\r
- // Locate all EFI Hii Config Access protocols\r
- //\r
- Status = gBS->LocateHandleBuffer (\r
- ByProtocol,\r
- &gEfiHiiConfigAccessProtocolGuid,\r
- NULL,\r
- &HandleCount,\r
- &Handles\r
- );\r
- if (EFI_ERROR (Status) || (HandleCount == 0)) {\r
- return Status;\r
- }\r
-\r
- Status = EFI_NOT_FOUND;\r
-\r
- for (Index = 0; Index < HandleCount; Index++) {\r
-\r
- Status = EfiTestChildHandle (Controller, Handles[Index], &gEfiManagedNetworkServiceBindingProtocolGuid);\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Get device path on the child handle\r
- //\r
- Status = gBS->HandleProtocol (\r
- Handles[Index],\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **) &ChildDeviceDevicePath\r
- );\r
-\r
- if (!EFI_ERROR (Status)) {\r
- while (!IsDevicePathEnd (ChildDeviceDevicePath)) {\r
- ChildDeviceDevicePath = NextDevicePathNode (ChildDeviceDevicePath);\r
- //\r
- // Parse one instance\r
- //\r
- if (ChildDeviceDevicePath->Type == HARDWARE_DEVICE_PATH &&\r
- ChildDeviceDevicePath->SubType == HW_VENDOR_DP) {\r
- VendorDeviceNode = (VENDOR_DEVICE_PATH *) ChildDeviceDevicePath;\r
- if (CompareMem (&VendorDeviceNode->Guid, &gEfiNicIp4ConfigVariableGuid, sizeof (EFI_GUID)) == 0) {\r
- //\r
- // Found item matched gEfiNicIp4ConfigVariableGuid\r
- //\r
- *ChildHandle = Handles[Index];\r
- FreePool (Handles);\r
- return EFI_SUCCESS;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
-\r
- FreePool (Handles);\r
- return Status;\r
-}\r
-\r
-\r