/** @file\r
The driver binding and service binding protocol for IP6 driver.\r
\r
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, 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
are licensed and made available under the terms and conditions of the BSD License\r
NULL\r
};\r
\r
+BOOLEAN mIpSec2Installed = FALSE;\r
+\r
+/**\r
+ Callback function for IpSec2 Protocol install.\r
+\r
+ @param[in] Event Event whose notification function is being invoked\r
+ @param[in] Context Pointer to the notification function's context\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IpSec2InstalledCallback (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ //\r
+ // Close the event so it does not get called again.\r
+ //\r
+ gBS->CloseEvent (Event);\r
+\r
+ mIpSec2Installed = TRUE;\r
+\r
+ return;\r
+}\r
+\r
/**\r
This is the declaration of an EFI image entry point. This entry point is\r
the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
+ VOID *Registration;\r
+\r
+ EfiCreateProtocolNotifyEvent (\r
+ &gEfiIpSec2ProtocolGuid,\r
+ TPL_CALLBACK,\r
+ IpSec2InstalledCallback,\r
+ NULL,\r
+ &Registration\r
+ );\r
+\r
return EfiLibInstallDriverBindingComponentName2 (\r
ImageHandle,\r
SystemTable,\r
EFI_STATUS Status;\r
EFI_MANAGED_NETWORK_COMPLETION_TOKEN *MnpToken;\r
EFI_MANAGED_NETWORK_CONFIG_DATA *Config;\r
- IP6_CONFIG_DATA_ITEM *DataItem;\r
\r
ASSERT (Service != NULL);\r
\r
goto ON_ERROR;\r
}\r
\r
- //\r
- // If there is any manual address, set it.\r
- //\r
- DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];\r
- if (DataItem->Data.Ptr != NULL) {\r
- DataItem->SetData (\r
- &IpSb->Ip6ConfigInstance,\r
- DataItem->DataSize,\r
- DataItem->Data.Ptr\r
- );\r
- }\r
-\r
- //\r
- // If there is any gateway address, set it.\r
- //\r
- DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];\r
- if (DataItem->Data.Ptr != NULL) {\r
- DataItem->SetData (\r
- &IpSb->Ip6ConfigInstance,\r
- DataItem->DataSize,\r
- DataItem->Data.Ptr\r
- );\r
- }\r
-\r
InsertHeadList (&IpSb->Interfaces, &IpSb->DefaultInterface->Link);\r
\r
*Service = IpSb;\r
{\r
IP6_SERVICE *IpSb;\r
EFI_STATUS Status;\r
+ EFI_IP6_CONFIG_PROTOCOL *Ip6Cfg;\r
+ IP6_CONFIG_DATA_ITEM *DataItem;\r
+\r
+ IpSb = NULL;\r
+ Ip6Cfg = NULL;\r
+ DataItem = NULL;\r
\r
//\r
// Test for the Ip6 service binding protocol\r
\r
ASSERT (IpSb != NULL);\r
\r
+ Ip6Cfg = &IpSb->Ip6ConfigInstance.Ip6Config;\r
+\r
//\r
// Install the Ip6ServiceBinding Protocol onto ControlerHandle\r
//\r
&gEfiIp6ServiceBindingProtocolGuid,\r
&IpSb->ServiceBinding,\r
&gEfiIp6ConfigProtocolGuid,\r
- &IpSb->Ip6ConfigInstance.Ip6Config,\r
+ Ip6Cfg,\r
NULL\r
);\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
+\r
+ //\r
+ // Read the config data from NV variable again. \r
+ // The default data can be changed by other drivers.\r
+ //\r
+ Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);\r
+ if (EFI_ERROR (Status)) {\r
+ goto ON_ERROR;\r
+ }\r
+ \r
+ //\r
+ // If there is any default manual address, set it.\r
+ //\r
+ DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeManualAddress];\r
+ if (DataItem->Data.Ptr != NULL) {\r
+ Status = Ip6Cfg->SetData (\r
+ Ip6Cfg,\r
+ Ip6ConfigDataTypeManualAddress,\r
+ DataItem->DataSize,\r
+ DataItem->Data.Ptr\r
+ );\r
+ if (EFI_ERROR(Status)) {\r
+ goto ON_ERROR;\r
+ }\r
+ }\r
+\r
+ //\r
+ // If there is any default gateway address, set it.\r
+ //\r
+ DataItem = &IpSb->Ip6ConfigInstance.DataItem[Ip6ConfigDataTypeGateway];\r
+ if (DataItem->Data.Ptr != NULL) {\r
+ Status = Ip6Cfg->SetData (\r
+ Ip6Cfg,\r
+ Ip6ConfigDataTypeGateway,\r
+ DataItem->DataSize,\r
+ DataItem->Data.Ptr\r
+ );\r
+ if (EFI_ERROR(Status)) {\r
+ goto ON_ERROR;\r
+ }\r
+ }\r
\r
if (!EFI_ERROR (Status)) {\r
//\r