/** @file\r
The driver binding and service binding protocol for IP4 driver.\r
\r
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
\r
This program and the accompanying materials\r
IN VOID *Context\r
)\r
{\r
+ EFI_STATUS Status;\r
//\r
- // Close the event so it does not get called again.\r
+ // Test if protocol was even found.\r
+ // Notification function will be called at least once.\r
//\r
- gBS->CloseEvent (Event);\r
+ Status = gBS->LocateProtocol (&gEfiIpSec2ProtocolGuid, NULL, (VOID **)&mIpSec);\r
+ if (Status == EFI_SUCCESS && mIpSec != NULL) {\r
+ //\r
+ // Close the event so it does not get called again.\r
+ //\r
+ gBS->CloseEvent (Event);\r
\r
- mIpSec2Installed = TRUE;\r
+ mIpSec2Installed = TRUE;\r
+ }\r
}\r
\r
/**\r
ZeroMem (&IpSb->SnpMode, sizeof (EFI_SIMPLE_NETWORK_MODE));\r
\r
IpSb->Timer = NULL;\r
+ IpSb->ReconfigCheckTimer = NULL;\r
\r
IpSb->ReconfigEvent = NULL;\r
\r
goto ON_ERROR;\r
}\r
\r
+ Status = gBS->CreateEvent (\r
+ EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
+ TPL_CALLBACK,\r
+ Ip4TimerReconfigChecking,\r
+ IpSb,\r
+ &IpSb->ReconfigCheckTimer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
+\r
Status = gBS->CreateEvent (\r
EVT_NOTIFY_SIGNAL,\r
TPL_NOTIFY,\r
IpSb->Timer = NULL;\r
}\r
\r
+ if (IpSb->ReconfigCheckTimer != NULL) {\r
+ gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerCancel, 0);\r
+ gBS->CloseEvent (IpSb->ReconfigCheckTimer);\r
+\r
+ IpSb->ReconfigCheckTimer = NULL;\r
+ }\r
+\r
if (IpSb->DefaultInterface != NULL) {\r
Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);\r
\r
if (EFI_ERROR(Status)) {\r
goto UNINSTALL_PROTOCOL;\r
}\r
+ \r
+ if (Index == Ip4Config2DataTypePolicy && (*(DataItem->Data.Policy) == Ip4Config2PolicyDhcp)) {\r
+ break;\r
+ } \r
}\r
}\r
\r
goto UNINSTALL_PROTOCOL;\r
}\r
\r
+ Status = gBS->SetTimer (IpSb->ReconfigCheckTimer, TimerPeriodic, 500 * TICKS_PER_MS);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ goto UNINSTALL_PROTOCOL;\r
+ }\r
+\r
//\r
// Initialize the IP4 ID\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 create\r
+ @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create\r
the child\r
@retval other The child handle was not created\r
\r
IP4_PROTOCOL *IpInstance;\r
EFI_IP4_PROTOCOL *Ip4;\r
EFI_TPL OldTpl;\r
- INTN State;\r
\r
if ((This == NULL) || (ChildHandle == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
// when UDP driver is being stopped, it will destroy all\r
// the IP child it opens.\r
//\r
- if (IpInstance->State == IP4_STATE_DESTROY) {\r
+ if (IpInstance->InDestroy) {\r
gBS->RestoreTPL (OldTpl);\r
return EFI_SUCCESS;\r
}\r
\r
- State = IpInstance->State;\r
- IpInstance->State = IP4_STATE_DESTROY;\r
+ IpInstance->InDestroy = TRUE;\r
\r
//\r
// Close the Managed Network protocol.\r
);\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
if (EFI_ERROR (Status)) {\r
+ IpInstance->InDestroy = FALSE;\r
goto ON_ERROR;\r
}\r
\r
return EFI_SUCCESS;\r
\r
ON_ERROR:\r
- IpInstance->State = State;\r
gBS->RestoreTPL (OldTpl);\r
\r
return Status;\r