From 39de741e2dcb8f11e9b4438e37224797643d8451 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Sun, 5 Dec 2021 14:54:11 -0800 Subject: RedfishPkg: Apply uncrustify changes REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the RedfishPkg package Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Abner Chang --- .../RedfishConfigHandlerCommon.c | 88 ++++++----- .../RedfishConfigHandlerCommon.h | 12 +- .../RedfishConfigHandlerDriver.c | 174 +++++++++++---------- .../RedfishConfigHandlerDriver.h | 17 +- 4 files changed, 157 insertions(+), 134 deletions(-) (limited to 'RedfishPkg/RedfishConfigHandler') diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c index ff465d9ff3..c3a7efd796 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c @@ -9,12 +9,12 @@ #include "RedfishConfigHandlerCommon.h" -REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; // Only one Redfish service supproted +REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; // Only one Redfish service supproted // on platform for the BIOS // Redfish configuration. -EFI_EVENT gEndOfDxeEvent = NULL; -EFI_EVENT gExitBootServiceEvent = NULL; -EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential = NULL; +EFI_EVENT gEndOfDxeEvent = NULL; +EFI_EVENT gExitBootServiceEvent = NULL; +EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential = NULL; /** Callback function executed when the EndOfDxe event group is signaled. @@ -30,10 +30,10 @@ RedfishConfigOnEndOfDxe ( OUT VOID *Context ) { - EFI_STATUS Status; + EFI_STATUS Status; Status = gCredential->StopService (gCredential, ServiceStopTypeSecureBootDisabled); - if (EFI_ERROR(Status) && Status != EFI_UNSUPPORTED) { + if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) { DEBUG ((DEBUG_ERROR, "Redfish credential protocol faied to stop service on EndOfDxe: %r", Status)); } @@ -58,10 +58,10 @@ RedfishConfigOnExitBootService ( OUT VOID *Context ) { - EFI_STATUS Status; + EFI_STATUS Status; Status = gCredential->StopService (gCredential, ServiceStopTypeExitBootService); - if (EFI_ERROR(Status) && Status != EFI_UNSUPPORTED) { + if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) { DEBUG ((DEBUG_ERROR, "Redfish credential protocol faied to stop service on ExitBootService: %r", Status)); } } @@ -113,16 +113,18 @@ RedfishConfigCommonInit ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + EFI_STATUS Status; + // // Locate Redfish Credential Protocol to get credential for // accessing to Redfish service. // - Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **) &gCredential); + Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **)&gCredential); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "%a: No Redfish Credential Protocol is installed on system.", __FUNCTION__)); return Status; } + // // Create EndOfDxe Event. // @@ -138,6 +140,7 @@ RedfishConfigCommonInit ( DEBUG ((DEBUG_ERROR, "%a: Fail to register End Of DXE event.", __FUNCTION__)); return Status; } + // // Create Exit Boot Service event. // @@ -155,8 +158,10 @@ RedfishConfigCommonInit ( DEBUG ((DEBUG_ERROR, "%a: Fail to register Exit Boot Service event.", __FUNCTION__)); return Status; } + return EFI_SUCCESS; } + /** This is the common code to stop EDK2 Redfish feature driver. @@ -167,13 +172,13 @@ RedfishConfigCommonInit ( EFI_STATUS RedfishConfigCommonStop ( VOID -) + ) { - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN NumberOfHandles; - UINTN Index; - EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + UINTN Index; + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; Status = gBS->LocateHandleBuffer ( ByProtocol, @@ -182,27 +187,29 @@ RedfishConfigCommonStop ( &NumberOfHandles, &HandleBuffer ); - if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) { + if (EFI_ERROR (Status) && (Status != EFI_NOT_FOUND)) { return Status; } Status = EFI_SUCCESS; for (Index = 0; Index < NumberOfHandles; Index++) { Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEdkIIRedfishConfigHandlerProtocolGuid, - (VOID**) &ConfigHandler - ); + HandleBuffer[Index], + &gEdkIIRedfishConfigHandlerProtocolGuid, + (VOID **)&ConfigHandler + ); ASSERT_EFI_ERROR (Status); Status = ConfigHandler->Stop (ConfigHandler); - if (EFI_ERROR (Status) && Status != EFI_UNSUPPORTED) { + if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) { DEBUG ((DEBUG_ERROR, "ERROR: Failed to stop Redfish config handler %p.\n", ConfigHandler)); break; } } + return Status; } + /** Callback function executed when a Redfish Config Handler Protocol is installed by EDK2 Redfish Feature Drivers. @@ -213,12 +220,12 @@ RedfishConfigHandlerInitialization ( VOID ) { - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN NumberOfHandles; - EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; - UINTN Index; - UINT32 Id; + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; + UINTN Index; + UINT32 Id; Status = gBS->LocateHandleBuffer ( ByProtocol, @@ -233,33 +240,34 @@ RedfishConfigHandlerInitialization ( for (Index = 0; Index < NumberOfHandles; Index++) { Status = gBS->HandleProtocol ( - HandleBuffer [Index], + HandleBuffer[Index], &gEfiCallerIdGuid, - (VOID **) &Id + (VOID **)&Id ); if (!EFI_ERROR (Status)) { continue; } Status = gBS->HandleProtocol ( - HandleBuffer [Index], - &gEdkIIRedfishConfigHandlerProtocolGuid, - (VOID**) &ConfigHandler - ); + HandleBuffer[Index], + &gEdkIIRedfishConfigHandlerProtocolGuid, + (VOID **)&ConfigHandler + ); ASSERT_EFI_ERROR (Status); Status = ConfigHandler->Init (ConfigHandler, &gRedfishConfigData.RedfishServiceInfo); - if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) { + if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) { DEBUG ((DEBUG_ERROR, "ERROR: Failed to init Redfish config handler %p.\n", ConfigHandler)); } + // // Install caller ID to indicate Redfish Configure Handler is initialized. // Status = gBS->InstallProtocolInterface ( - &HandleBuffer [Index], - &gEfiCallerIdGuid, - EFI_NATIVE_INTERFACE, - (VOID *)&gRedfishConfigData.CallerId - ); + &HandleBuffer[Index], + &gEfiCallerIdGuid, + EFI_NATIVE_INTERFACE, + (VOID *)&gRedfishConfigData.CallerId + ); ASSERT_EFI_ERROR (Status); } } diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h index 5e46c42219..460b3d915c 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h @@ -40,11 +40,11 @@ /// Internal structure used by Redfish Config DXE driver. /// typedef struct { - UINT32 CallerId; ///< Caller ID used to indicate Redfish Config Handler - ///< has been initiated - EFI_HANDLE Image; ///< Image handle of Redfish Config Driver - EFI_EVENT Event; ///< Event for the notification of EFI_REDFISH_CONFIG_HANDLER_PROTOCOL - REDFISH_CONFIG_SERVICE_INFORMATION RedfishServiceInfo; /// Redfish Service information discovered + UINT32 CallerId; ///< Caller ID used to indicate Redfish Config Handler + ///< has been initiated + EFI_HANDLE Image; ///< Image handle of Redfish Config Driver + EFI_EVENT Event; ///< Event for the notification of EFI_REDFISH_CONFIG_HANDLER_PROTOCOL + REDFISH_CONFIG_SERVICE_INFORMATION RedfishServiceInfo; /// Redfish Service information discovered } REDFISH_CONFIG_DRIVER_DATA; /** @@ -86,7 +86,7 @@ RedfishConfigCommonInit ( EFI_STATUS RedfishConfigCommonStop ( VOID -); + ); /** Callback function executed when a Redfish Config Handler Protocol is installed diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c index 51378dff4f..96ac70f418 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c @@ -17,22 +17,22 @@ EFI_EVENT gEfiRedfishDiscoverProtocolEvent = NULL; // // Variables for using RFI Redfish Discover Protocol // -VOID *gEfiRedfishDiscoverRegistration; -EFI_HANDLE gEfiRedfishDiscoverControllerHandle = NULL; -EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol = NULL; -BOOLEAN gRedfishDiscoverActivated = FALSE; -BOOLEAN gRedfishServiceDiscovered = FALSE; +VOID *gEfiRedfishDiscoverRegistration; +EFI_HANDLE gEfiRedfishDiscoverControllerHandle = NULL; +EFI_REDFISH_DISCOVER_PROTOCOL *gEfiRedfishDiscoverProtocol = NULL; +BOOLEAN gRedfishDiscoverActivated = FALSE; +BOOLEAN gRedfishServiceDiscovered = FALSE; // // Network interfaces discovered by EFI Redfish Discover Protocol. // UINTN gNumberOfNetworkInterfaces; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *gNetworkInterfaceInstances = NULL; -EFI_REDFISH_DISCOVERED_TOKEN *gRedfishDiscoveredToken = NULL; +EFI_REDFISH_DISCOVERED_TOKEN *gRedfishDiscoveredToken = NULL; /// /// Driver Binding Protocol instance /// -EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding = { +EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding = { RedfishConfigDriverBindingSupported, RedfishConfigDriverBindingStart, RedfishConfigDriverBindingStop, @@ -48,7 +48,7 @@ EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding = { VOID RedfishConfigStopRedfishDiscovery ( VOID -) + ) { if (gRedfishDiscoverActivated) { // @@ -57,6 +57,7 @@ RedfishConfigStopRedfishDiscovery ( if (gEfiRedfishDiscoverProtocolEvent != NULL) { gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent); } + // // Stop Redfish service discovery. // @@ -65,9 +66,9 @@ RedfishConfigStopRedfishDiscovery ( gNetworkInterfaceInstances ); gEfiRedfishDiscoverControllerHandle = NULL; - gEfiRedfishDiscoverProtocol = NULL; - gRedfishDiscoverActivated = FALSE; - gRedfishServiceDiscovered = FALSE; + gEfiRedfishDiscoverProtocol = NULL; + gRedfishDiscoverActivated = FALSE; + gRedfishServiceDiscovered = FALSE; } } @@ -138,9 +139,9 @@ RedfishConfigDriverBindingSupported ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) { - EFI_REST_EX_PROTOCOL *RestEx; - EFI_STATUS Status; - EFI_HANDLE ChildHandle; + EFI_REST_EX_PROTOCOL *RestEx; + EFI_STATUS Status; + EFI_HANDLE ChildHandle; ChildHandle = NULL; @@ -161,10 +162,10 @@ RedfishConfigDriverBindingSupported ( // // Test if REST EX protocol is ready. // - Status = gBS->OpenProtocol( + Status = gBS->OpenProtocol ( ChildHandle, &gEfiRestExProtocolGuid, - (VOID**) &RestEx, + (VOID **)&RestEx, This->DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL @@ -172,6 +173,7 @@ RedfishConfigDriverBindingSupported ( if (EFI_ERROR (Status)) { Status = EFI_UNSUPPORTED; } + NetLibDestroyServiceChild ( ControllerHandle, This->ImageHandle, @@ -222,19 +224,19 @@ RedfishConfigDriverBindingStart ( IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL ) { - VOID *ConfigHandlerRegistration; + VOID *ConfigHandlerRegistration; if (gRedfishConfigData.Event != NULL) { return EFI_ALREADY_STARTED; } gRedfishConfigData.Event = EfiCreateProtocolNotifyEvent ( - &gEdkIIRedfishConfigHandlerProtocolGuid, - TPL_CALLBACK, - RedfishConfigHandlerInstalledCallback, - (VOID *)&gRedfishConfigData, - &ConfigHandlerRegistration - ); + &gEdkIIRedfishConfigHandlerProtocolGuid, + TPL_CALLBACK, + RedfishConfigHandlerInstalledCallback, + (VOID *)&gRedfishConfigData, + &ConfigHandlerRegistration + ); return EFI_SUCCESS; } @@ -278,6 +280,7 @@ RedfishConfigDriverBindingStop ( if (ControllerHandle == gEfiRedfishDiscoverControllerHandle) { RedfishConfigStopRedfishDiscovery (); } + gBS->CloseProtocol ( ControllerHandle, &gEfiRedfishDiscoverProtocolGuid, @@ -294,6 +297,7 @@ RedfishConfigDriverBindingStop ( gBS->CloseEvent (gRedfishConfigData.Event); gRedfishConfigData.Event = NULL; } + return EFI_SUCCESS; } @@ -311,8 +315,8 @@ RedfishServiceDiscoveredCallback ( OUT VOID *Context ) { - EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken; - EFI_REDFISH_DISCOVERED_INSTANCE *RedfishInstance; + EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken; + EFI_REDFISH_DISCOVERED_INSTANCE *RedfishInstance; if (gRedfishServiceDiscovered) { // @@ -322,7 +326,7 @@ RedfishServiceDiscoveredCallback ( } RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context; - RedfishInstance = RedfishDiscoveredToken->DiscoverList.RedfishInstances; + RedfishInstance = RedfishDiscoveredToken->DiscoverList.RedfishInstances; // // Only pick up the first found Redfish service. // @@ -336,7 +340,7 @@ RedfishServiceDiscoveredCallback ( gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct = RedfishInstance->Information.Product; gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer = RedfishInstance->Information.ProductVer; gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = RedfishInstance->Information.UseHttps; - gRedfishServiceDiscovered = TRUE; + gRedfishServiceDiscovered = TRUE; } // @@ -361,76 +365,79 @@ RedfishDiscoverProtocolInstalled ( OUT VOID *Context ) { - EFI_STATUS Status; - UINTN BufferSize; - EFI_HANDLE HandleBuffer; - UINTN NetworkInterfaceIndex; - EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface; - EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; + EFI_STATUS Status; + UINTN BufferSize; + EFI_HANDLE HandleBuffer; + UINTN NetworkInterfaceIndex; + EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface; + EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; - DEBUG((DEBUG_INFO, "%a: New network interface is installed on system by EFI Redfish discover driver.\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a: New network interface is installed on system by EFI Redfish discover driver.\n", __FUNCTION__)); BufferSize = sizeof (EFI_HANDLE); - Status = gBS->LocateHandle ( - ByRegisterNotify, - NULL, - gEfiRedfishDiscoverRegistration, - &BufferSize, - &HandleBuffer - ); + Status = gBS->LocateHandle ( + ByRegisterNotify, + NULL, + gEfiRedfishDiscoverRegistration, + &BufferSize, + &HandleBuffer + ); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a: Can't locate handle with EFI_REDFISH_DISCOVER_PROTOCOL installed.\n", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a: Can't locate handle with EFI_REDFISH_DISCOVER_PROTOCOL installed.\n", __FUNCTION__)); } + gRedfishDiscoverActivated = TRUE; if (gEfiRedfishDiscoverProtocol == NULL) { - gEfiRedfishDiscoverControllerHandle = HandleBuffer; + gEfiRedfishDiscoverControllerHandle = HandleBuffer; // // First time to open EFI_REDFISH_DISCOVER_PROTOCOL. // - Status = gBS->OpenProtocol( - gEfiRedfishDiscoverControllerHandle, - &gEfiRedfishDiscoverProtocolGuid, - (VOID **)&gEfiRedfishDiscoverProtocol, - gRedfishConfigData.Image, - gRedfishConfigData.Image, - EFI_OPEN_PROTOCOL_BY_DRIVER + Status = gBS->OpenProtocol ( + gEfiRedfishDiscoverControllerHandle, + &gEfiRedfishDiscoverProtocolGuid, + (VOID **)&gEfiRedfishDiscoverProtocol, + gRedfishConfigData.Image, + gRedfishConfigData.Image, + EFI_OPEN_PROTOCOL_BY_DRIVER ); if (EFI_ERROR (Status)) { gEfiRedfishDiscoverProtocol = NULL; - gRedfishDiscoverActivated = FALSE; - DEBUG((DEBUG_ERROR, "%a: Can't locate EFI_REDFISH_DISCOVER_PROTOCOL.\n", __FUNCTION__)); + gRedfishDiscoverActivated = FALSE; + DEBUG ((DEBUG_ERROR, "%a: Can't locate EFI_REDFISH_DISCOVER_PROTOCOL.\n", __FUNCTION__)); return; } } + // // Check the new found network interface. // if (gNetworkInterfaceInstances != NULL) { FreePool (gNetworkInterfaceInstances); } - Status = gEfiRedfishDiscoverProtocol->GetNetworkInterfaceList( + + Status = gEfiRedfishDiscoverProtocol->GetNetworkInterfaceList ( gEfiRedfishDiscoverProtocol, gRedfishConfigData.Image, &gNumberOfNetworkInterfaces, &gNetworkInterfaceInstances ); - if (EFI_ERROR (Status) || gNumberOfNetworkInterfaces == 0) { - DEBUG((DEBUG_ERROR, "%a: No network interfaces found on the handle.\n", __FUNCTION__)); + if (EFI_ERROR (Status) || (gNumberOfNetworkInterfaces == 0)) { + DEBUG ((DEBUG_ERROR, "%a: No network interfaces found on the handle.\n", __FUNCTION__)); return; } gRedfishDiscoveredToken = AllocateZeroPool (gNumberOfNetworkInterfaces * sizeof (EFI_REDFISH_DISCOVERED_TOKEN)); if (gRedfishDiscoveredToken == NULL) { - DEBUG((DEBUG_ERROR, "%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a: Not enough memory for EFI_REDFISH_DISCOVERED_TOKEN.\n", __FUNCTION__)); return; } - ThisNetworkInterface = gNetworkInterfaceInstances; + ThisNetworkInterface = gNetworkInterfaceInstances; ThisRedfishDiscoveredToken = gRedfishDiscoveredToken; // // Loop to discover Redfish service on each network interface. // - for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < gNumberOfNetworkInterfaces; NetworkInterfaceIndex ++) { + for (NetworkInterfaceIndex = 0; NetworkInterfaceIndex < gNumberOfNetworkInterfaces; NetworkInterfaceIndex++) { // // Initial this Redfish Discovered Token // @@ -440,37 +447,40 @@ RedfishDiscoverProtocolInstalled ( RedfishServiceDiscoveredCallback, (VOID *)ThisRedfishDiscoveredToken, &ThisRedfishDiscoveredToken->Event - ); + ); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a: Failed to create event for Redfish discovered token.\n", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a: Failed to create event for Redfish discovered token.\n", __FUNCTION__)); goto ErrorReturn; } - ThisRedfishDiscoveredToken->Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE; + + ThisRedfishDiscoveredToken->Signature = REDFISH_DISCOVER_TOKEN_SIGNATURE; ThisRedfishDiscoveredToken->DiscoverList.NumberOfServiceFound = 0; - ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances = NULL; + ThisRedfishDiscoveredToken->DiscoverList.RedfishInstances = NULL; // // Acquire for Redfish service which is reported by // Redfish Host Interface. // - Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService( - gEfiRedfishDiscoverProtocol, - gRedfishConfigData.Image, - ThisNetworkInterface, - EFI_REDFISH_DISCOVER_HOST_INTERFACE, - ThisRedfishDiscoveredToken - ); - ThisNetworkInterface ++; - ThisRedfishDiscoveredToken ++; + Status = gEfiRedfishDiscoverProtocol->AcquireRedfishService ( + gEfiRedfishDiscoverProtocol, + gRedfishConfigData.Image, + ThisNetworkInterface, + EFI_REDFISH_DISCOVER_HOST_INTERFACE, + ThisRedfishDiscoveredToken + ); + ThisNetworkInterface++; + ThisRedfishDiscoveredToken++; } + if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a: Acquire Redfish service fail.\n", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a: Acquire Redfish service fail.\n", __FUNCTION__)); goto ErrorReturn; } + return; ErrorReturn: if (gRedfishDiscoveredToken != NULL) { - FreePool(gRedfishDiscoveredToken); + FreePool (gRedfishDiscoveredToken); } } @@ -488,23 +498,26 @@ RedfishConfigHandlerDriverUnload ( IN EFI_HANDLE ImageHandle ) { - EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; - UINTN NumberOfNetworkInterfacesIndex; + EFI_REDFISH_DISCOVERED_TOKEN *ThisRedfishDiscoveredToken; + UINTN NumberOfNetworkInterfacesIndex; RedfishConfigDriverCommonUnload (ImageHandle); RedfishConfigStopRedfishDiscovery (); if (gRedfishDiscoveredToken != NULL) { ThisRedfishDiscoveredToken = gRedfishDiscoveredToken; - for (NumberOfNetworkInterfacesIndex = 0; NumberOfNetworkInterfacesIndex < gNumberOfNetworkInterfaces; NumberOfNetworkInterfacesIndex ++) { + for (NumberOfNetworkInterfacesIndex = 0; NumberOfNetworkInterfacesIndex < gNumberOfNetworkInterfaces; NumberOfNetworkInterfacesIndex++) { if (ThisRedfishDiscoveredToken->Event != NULL) { gBS->CloseEvent (ThisRedfishDiscoveredToken->Event); } + FreePool (ThisRedfishDiscoveredToken); - ThisRedfishDiscoveredToken ++; + ThisRedfishDiscoveredToken++; } + gRedfishDiscoveredToken = NULL; } + return EFI_SUCCESS; } @@ -526,7 +539,7 @@ RedfishConfigHandlerDriverEntryPoint ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + EFI_STATUS Status; ZeroMem ((VOID *)&gRedfishConfigData, sizeof (REDFISH_CONFIG_DRIVER_DATA)); gRedfishConfigData.Image = ImageHandle; @@ -546,11 +559,12 @@ RedfishConfigHandlerDriverEntryPoint ( DEBUG ((DEBUG_ERROR, "%a: Fail to create event for the installation of EFI_REDFISH_DISCOVER_PROTOCOL.", __FUNCTION__)); return Status; } + Status = gBS->RegisterProtocolNotify ( &gEfiRedfishDiscoverProtocolGuid, gEfiRedfishDiscoverProtocolEvent, &gEfiRedfishDiscoverRegistration - ); + ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: Fail to register event for the installation of EFI_REDFISH_DISCOVER_PROTOCOL.", __FUNCTION__)); return Status; @@ -582,6 +596,6 @@ RedfishConfigHandlerDriverEntryPoint ( DEBUG ((DEBUG_ERROR, "%a: Fail to install EFI Binding Protocol of EFI Redfish Config driver.", __FUNCTION__)); return Status; } + return Status; } - diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h index 58202c41e2..07214875bd 100644 --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h @@ -26,10 +26,10 @@ // extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding; -extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; -extern EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential; -extern EFI_EVENT gEndOfDxeEvent; -extern EFI_EVENT gExitBootServiceEvent; +extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData; +extern EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential; +extern EFI_EVENT gEndOfDxeEvent; +extern EFI_EVENT gExitBootServiceEvent; /** Tests to see if this driver supports a given controller. If a child device is provided, @@ -151,9 +151,10 @@ RedfishConfigDriverBindingStart ( EFI_STATUS EFIAPI RedfishConfigDriverBindingStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE ControllerHandle, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer OPTIONAL + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer OPTIONAL ); + #endif -- cgit