- if ((EfiRedfishDiscoverProtocolHandle == NULL) &&\r
- (gRequiredProtocol[Index].ProtocolType == ProtocolTypeRestEx) &&\r
- !IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)\r
- )\r
- {\r
- // Install the fisrt Redfish Discover Protocol when EFI REST EX protcol is discovered.\r
- // This ensures EFI REST EX is ready while EFI_REDFISH_DISCOVER_PROTOCOL consumer acquires\r
- // Redfish serivce over network interface.\r
-\r
- Status = gBS->InstallProtocolInterface (\r
- &EfiRedfishDiscoverProtocolHandle,\r
- &gEfiRedfishDiscoverProtocolGuid,\r
- EFI_NATIVE_INTERFACE,\r
- (VOID *)&mRedfishDiscover\r
- );\r
- } else if ((EfiRedfishDiscoverProtocolHandle != NULL) && NewNetworkInterfaceInstalled) {\r
- Status = gBS->ReinstallProtocolInterface (\r
- EfiRedfishDiscoverProtocolHandle,\r
- &gEfiRedfishDiscoverProtocolGuid,\r
- (VOID *)&mRedfishDiscover,\r
- (VOID *)&mRedfishDiscover\r
- );\r
- NewNetworkInterfaceInstalled = FALSE;\r
+ if ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeRestEx)) {\r
+ // Install Redfish Discover Protocol when EFI REST EX protcol is discovered.\r
+ // This ensures EFI REST EX is ready while the consumer of EFI_REDFISH_DISCOVER_PROTOCOL\r
+ // acquires Redfish serivce over network interface.\r
+\r
+ if (!NewNetworkInterfaceInstalled) {\r
+ NetworkInterface = GetTargetNetworkInterfaceInternalByController (ControllerHandle);\r
+ if (NetworkInterface == NULL) {\r
+ DEBUG ((DEBUG_ERROR, "%a: Can't find network interface by ControllerHandle\n", __FUNCTION__));\r
+ return Status;\r
+ }\r
+ }\r
+\r
+ NewNetworkInterfaceInstalled = FALSE;\r
+ NetworkInterface->EfiRedfishDiscoverProtocolHandle = NULL;\r
+ Status = gBS->InstallProtocolInterface (\r
+ &NetworkInterface->EfiRedfishDiscoverProtocolHandle,\r
+ &gEfiRedfishDiscoverProtocolGuid,\r
+ EFI_NATIVE_INTERFACE,\r
+ (VOID *)&mRedfishDiscover\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR, "%a: Fail to install EFI_REDFISH_DISCOVER_PROTOCOL\n", __FUNCTION__));\r
+ }\r