/** @file\r
Implementation of driver entry point and driver binding protocol.\r
\r
-Copyright (c) 2005 - 2010, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
of the BSD License which accompanies this distribution. The full\r
text of the license may be found at<BR>\r
NULL\r
};\r
\r
+/**\r
+ Callback function which provided by user to remove one node in NetDestroyLinkList process.\r
+\r
+ @param[in] Entry The entry to be removed.\r
+ @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.\r
+\r
+ @retval EFI_SUCCESS The entry has been removed successfully.\r
+ @retval Others Fail to remove the entry.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MnpDestroyServiceDataEntry (\r
+ IN LIST_ENTRY *Entry,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ MNP_SERVICE_DATA *MnpServiceData;\r
+\r
+ MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);\r
+ return MnpDestroyServiceData (MnpServiceData);\r
+}\r
+\r
+/**\r
+ Callback function which provided by user to remove one node in NetDestroyLinkList process.\r
+\r
+ @param[in] Entry The entry to be removed.\r
+ @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.\r
+\r
+ @retval EFI_SUCCESS The entry has been removed successfully.\r
+ @retval Others Fail to remove the entry.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MnpDestroyServiceChildEntry (\r
+ IN LIST_ENTRY *Entry,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ MNP_SERVICE_DATA *MnpServiceData;\r
+\r
+ MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);\r
+ return MnpDestroyServiceChild (MnpServiceData);\r
+}\r
+\r
/**\r
Test to see if this driver supports ControllerHandle. This service\r
is called by the EFI boot service ConnectController(). In\r
EFI_VLAN_CONFIG_PROTOCOL *VlanConfig;\r
MNP_DEVICE_DATA *MnpDeviceData;\r
MNP_SERVICE_DATA *MnpServiceData;\r
- BOOLEAN AllChildrenStopped;\r
- LIST_ENTRY *Entry;\r
+ LIST_ENTRY *List;\r
+ UINTN ListLength;\r
\r
//\r
// Try to retrieve MNP service binding protocol from the ControllerHandle\r
//\r
// Destroy all MNP service data\r
//\r
- while (!IsListEmpty (&MnpDeviceData->ServiceList)) {\r
- Entry = GetFirstNode (&MnpDeviceData->ServiceList);\r
- MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);\r
- MnpDestroyServiceData (MnpServiceData);\r
+ List = &MnpDeviceData->ServiceList;\r
+ Status = NetDestroyLinkList (\r
+ List,\r
+ MnpDestroyServiceDataEntry,\r
+ NULL,\r
+ &ListLength\r
+ );\r
+ if (EFI_ERROR (Status) || ListLength !=0) {\r
+ return EFI_DEVICE_ERROR;\r
}\r
\r
//\r
MnpDestroyDeviceData (MnpDeviceData, This->DriverBindingHandle);\r
FreePool (MnpDeviceData);\r
\r
+ if (gMnpControllerNameTable != NULL) {\r
+ FreeUnicodeStringTable (gMnpControllerNameTable);\r
+ gMnpControllerNameTable = NULL;\r
+ }\r
return EFI_SUCCESS;\r
}\r
\r
//\r
// Stop all MNP child\r
//\r
- AllChildrenStopped = TRUE;\r
- NET_LIST_FOR_EACH (Entry, &MnpDeviceData->ServiceList) {\r
- MnpServiceData = MNP_SERVICE_DATA_FROM_LINK (Entry);\r
-\r
- Status = MnpDestroyServiceChild (MnpServiceData);\r
- if (EFI_ERROR (Status)) {\r
- AllChildrenStopped = FALSE;\r
- }\r
- }\r
-\r
- if (!AllChildrenStopped) {\r
+ List = &MnpDeviceData->ServiceList;\r
+ Status = NetDestroyLinkList (\r
+ List,\r
+ MnpDestroyServiceChildEntry,\r
+ NULL,\r
+ &ListLength\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
return EFI_DEVICE_ERROR;\r
}\r
\r
\r
@retval EFI_SUCCES The protocol was added to ChildHandle.\r
@retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
- @retval EFI_OUT_OF_RESOURCES There are not enough resources availabe to\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to\r
create the child.\r
@retval Others The child handle was not created.\r
\r
if (Instance->Handle != NULL) {\r
\r
gBS->UninstallMultipleProtocolInterfaces (\r
+ Instance->Handle,\r
&gEfiManagedNetworkProtocolGuid,\r
&Instance->ManagedNetwork,\r
NULL\r
@retval EFI_SUCCES The protocol was removed from ChildHandle.\r
@retval EFI_UNSUPPORTED ChildHandle does not support the protocol that\r
is being removed.\r
- @retval EFI_INVALID_PARAMETER ChildHandle is not a valid UEFI handle.\r
+ @retval EFI_INVALID_PARAMETER ChildHandle is NULL.\r
@retval EFI_ACCESS_DENIED The protocol could not be removed from the\r
ChildHandle because its services are being\r
used.\r