diff options
author | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-12-13 06:47:06 +0000 |
---|---|---|
committer | sfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-12-13 06:47:06 +0000 |
commit | 216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8 (patch) | |
tree | 847cafec4185c79f082ccb9a5e895062a06980c1 /MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c | |
parent | 906e1cb7f7f178f5cb2a3bebbac59f6aa8c273a4 (diff) | |
download | edk2-216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8.zip edk2-216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8.tar.gz edk2-216f79703b8cb8dc65abdd768bedb2bcdbc1a1f8.tar.bz2 |
1. Add EFI_COMPONENT_NAME2_PROTOCOL.GetControllerName() support.
2. Fix the driver binding Stop() hang issue in the network stack.
3. Add Ip4 raw data support.
4. Add iSCSI Dhcp option 60 support.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Ouyang Qian <qian.ouyang@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13995 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c')
-rw-r--r-- | MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c | 88 |
1 files changed, 61 insertions, 27 deletions
diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c index 8a773d9..20758d3 100644 --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Driver.c @@ -212,7 +212,6 @@ Dhcp4CreateService ( DhcpSb->Signature = DHCP_SERVICE_SIGNATURE;
DhcpSb->ServiceState = DHCP_UNCONFIGED;
- DhcpSb->InDestroy = FALSE;
DhcpSb->Controller = Controller;
DhcpSb->Image = ImageHandle;
InitializeListHead (&DhcpSb->Children);
@@ -354,6 +353,35 @@ ON_ERROR: return Status;
}
+/**
+ Callback function which provided by user to remove one node in NetDestroyLinkList process.
+
+ @param[in] Entry The entry to be removed.
+ @param[in] Context Pointer to the callback context corresponds to the Context in NetDestroyLinkList.
+
+ @retval EFI_SUCCESS The entry has been removed successfully.
+ @retval Others Fail to remove the entry.
+
+**/
+EFI_STATUS
+Dhcp4DestroyChildEntry (
+ IN LIST_ENTRY *Entry,
+ IN VOID *Context
+)
+{
+ DHCP_PROTOCOL *Instance;
+ EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
+
+ if (Entry == NULL || Context == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Instance = NET_LIST_USER_STRUCT_S (Entry, DHCP_PROTOCOL, Link, DHCP_PROTOCOL_SIGNATURE);
+ ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *) Context;
+
+ return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
+}
+
/**
Stop this driver on ControllerHandle. This service is called by the
@@ -384,10 +412,10 @@ Dhcp4DriverBindingStop ( {
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
DHCP_SERVICE *DhcpSb;
- DHCP_PROTOCOL *Instance;
EFI_HANDLE NicHandle;
EFI_STATUS Status;
- EFI_TPL OldTpl;
+ LIST_ENTRY *List;
+ UINTN ListLength;
//
// DHCP driver opens UDP child, So, the ControllerHandle is the
@@ -396,7 +424,7 @@ Dhcp4DriverBindingStop ( NicHandle = NetLibGetNicHandle (ControllerHandle, &gEfiUdp4ProtocolGuid);
if (NicHandle == NULL) {
- return EFI_DEVICE_ERROR;
+ return EFI_SUCCESS;
}
Status = gBS->OpenProtocol (
@@ -413,16 +441,30 @@ Dhcp4DriverBindingStop ( }
DhcpSb = DHCP_SERVICE_FROM_THIS (ServiceBinding);
-
- if (DhcpSb->InDestroy) {
- return EFI_SUCCESS;
+ if (!IsListEmpty (&DhcpSb->Children)) {
+ //
+ // Destroy all the children instances before destory the service.
+ //
+ List = &DhcpSb->Children;
+ Status = NetDestroyLinkList (
+ List,
+ Dhcp4DestroyChildEntry,
+ ServiceBinding,
+ &ListLength
+ );
+ if (EFI_ERROR (Status) || ListLength != 0) {
+ Status = EFI_DEVICE_ERROR;
+ }
}
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
-
- if (NumberOfChildren == 0) {
+ if (NumberOfChildren == 0 && !IsListEmpty (&DhcpSb->Children)) {
+ Status = EFI_DEVICE_ERROR;
+ }
- DhcpSb->InDestroy = TRUE;
+ if (NumberOfChildren == 0 && IsListEmpty (&DhcpSb->Children)) {
+ //
+ // Destroy the service itself if no child instance left.
+ //
DhcpSb->ServiceState = DHCP_DESTROY;
gBS->UninstallProtocolInterface (
@@ -433,24 +475,15 @@ Dhcp4DriverBindingStop ( Dhcp4CloseService (DhcpSb);
- FreePool (DhcpSb);
- } else {
- //
- // Don't use NET_LIST_FOR_EACH_SAFE here, Dhcp4ServiceBindingDestroyChild
- // may cause other child to be deleted.
- //
- while (!IsListEmpty (&DhcpSb->Children)) {
- Instance = NET_LIST_HEAD (&DhcpSb->Children, DHCP_PROTOCOL, Link);
- ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
- }
-
- if (DhcpSb->NumChildren != 0) {
- Status = EFI_DEVICE_ERROR;
+ if (gDhcpControllerNameTable != NULL) {
+ FreeUnicodeStringTable (gDhcpControllerNameTable);
+ gDhcpControllerNameTable = NULL;
}
+ FreePool (DhcpSb);
+
+ Status = EFI_SUCCESS;
}
- gBS->RestoreTPL (OldTpl);
-
return Status;
}
@@ -663,12 +696,13 @@ Dhcp4ServiceBindingDestroyChild ( //
// Uninstall the DHCP4 protocol first to enable a top down destruction.
//
+ gBS->RestoreTPL (OldTpl);
Status = gBS->UninstallProtocolInterface (
ChildHandle,
&gEfiDhcp4ProtocolGuid,
Dhcp
);
-
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (EFI_ERROR (Status)) {
Instance->InDestroy = FALSE;
|