diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 9d0112b2b0..6223b5a090 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -3,7 +3,7 @@ The implementation of EFI Redfish Discover Protocol. (C) Copyright 2021 Hewlett Packard Enterprise Development LP
- Copyright (c) 2022, AMD Incorporated. All rights reserved. + Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved. Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
Copyright (c) 2023, Mike Maslenkin
@@ -1644,12 +1644,18 @@ RedfishServiceReleaseService ( IN EFI_REDFISH_DISCOVERED_LIST *InstanceList ) { + EFI_STATUS Status; UINTN NumService; BOOLEAN AnyFailRelease; EFI_REDFISH_DISCOVERED_INSTANCE *ThisRedfishInstance; EFI_REDFISH_DISCOVERED_INTERNAL_LIST *DiscoveredRedfishInstance; + EFI_REST_EX_PROTOCOL *RestExProtocol; - DEBUG ((DEBUG_MANAGEABILITY, "%a: Entry.\n", __func__)); + if (InstanceList == NULL) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((DEBUG_MANAGEABILITY, "%a: Entry, to release %d Redfish instance(s).\n", __func__, InstanceList->NumberOfServiceFound)); if (IsListEmpty (&mRedfishInstanceList)) { DEBUG ((DEBUG_ERROR, "%a:No any discovered Redfish service.\n", __func__)); @@ -1662,6 +1668,24 @@ RedfishServiceReleaseService ( DiscoveredRedfishInstance = (EFI_REDFISH_DISCOVERED_INTERNAL_LIST *)GetFirstNode (&mRedfishInstanceList); do { if (DiscoveredRedfishInstance->Instance == ThisRedfishInstance) { + // + // Disable REST EX instance by setting configuration to NULL. + // This also closes the underlying protocols, such HTTP. + // + Status = gBS->LocateProtocol (&gEfiRestExProtocolGuid, NULL, (VOID **)&RestExProtocol); + if (!EFI_ERROR (Status)) { + Status = RestExProtocol->Configure ( + RestExProtocol, + NULL + ); + } + + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_MANAGEABILITY, "%a: REST EX connection is closed.\n", __func__)); + } else { + DEBUG ((DEBUG_MANAGEABILITY, "%a: REST EX connection is not propery closed.\n", __func__)); + } + RemoveEntryList (&DiscoveredRedfishInstance->NextInstance); FreeInformationData (&ThisRedfishInstance->Information); FreePool ((VOID *)ThisRedfishInstance);