diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h index 24f0ad244..9513a6561 100644 --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h @@ -2,7 +2,7 @@ This file defines the Redfish Feature Utility Library interface. (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -18,25 +18,6 @@ #define REDFISH_ENABLE_SYSTEM_REBOOT() PcdSetBoolS(PcdRedfishSystemRebootRequired, TRUE) -/** - - Read redfish resource by given resource URI. - - @param[in] Service Redfish service instance to make query. - @param[in] ResourceUri Target resource URI. - @param[out] Response HTTP response from redfish service. - - @retval EFI_SUCCESS Resrouce is returned successfully. - @retval Others Errors occur. - -**/ -EFI_STATUS -GetResourceByUri ( - IN REDFISH_SERVICE *Service, - IN EFI_STRING ResourceUri, - OUT REDFISH_RESPONSE *Response - ); - /** Check if this is the Redpath array. Usually the Redpath array represents diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h index 5d39984c0..b4cfca030 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityInternal.h @@ -2,7 +2,7 @@ Common header file for RedfishFeatureUtilityLib driver. (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -30,6 +30,7 @@ #include #include #include +#include #include diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c index 01c054ae3..cad91a411 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c @@ -2,7 +2,7 @@ Redfish feature utility library implementation (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -147,7 +147,8 @@ SetEtagFromUri ( return Status; } - Status = GetResourceByUri (RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status = RedfishHttpGetResource (RedfishService, Uri, &Response, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, Uri)); return Status; @@ -887,8 +888,8 @@ ApplyFeatureSettingsStringArrayType ( } // - // Validate input string array from BMC to see: - // 1) String array from BMC is valid or not. + // Validate input string array from Redfish service to see: + // 1) String array from Redfish service is valid or not. // 2) If there is no change in array, do nothing. // Status = ValidateRedfishStringArrayValues (ArrayHead, RedfishValue.Value.StringArray, RedfishValue.ArrayCount, &ValueChanged); @@ -1163,66 +1164,6 @@ ApplyFeatureSettingsBooleanArrayType ( return Status; } -/** - - Read redfish resource by given resource URI. - - @param[in] Service Redfish service instance to make query. - @param[in] ResourceUri Target resource URI. - @param[out] Response HTTP response from redfish service. - - @retval EFI_SUCCESS Resrouce is returned successfully. - @retval Others Errors occur. - -**/ -EFI_STATUS -GetResourceByUri ( - IN REDFISH_SERVICE *Service, - IN EFI_STRING ResourceUri, - OUT REDFISH_RESPONSE *Response - ) -{ - EFI_STATUS Status; - CHAR8 *AsciiResourceUri; - - if ((Service == NULL) || (Response == NULL) || IS_EMPTY_STRING (ResourceUri)) { - return EFI_INVALID_PARAMETER; - } - - AsciiResourceUri = StrUnicodeToAscii (ResourceUri); - if (AsciiResourceUri == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get resource from redfish service. - // - Status = RedfishGetByUri ( - Service, - AsciiResourceUri, - Response - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: RedfishGetByUri to %a failed: %r\n", __func__, AsciiResourceUri, Status)); - if (Response->Payload != NULL) { - RedfishDumpPayload (Response->Payload); - RedfishFreeResponse ( - NULL, - 0, - NULL, - Response->Payload - ); - Response->Payload = NULL; - } - } - - if (AsciiResourceUri != NULL) { - FreePool (AsciiResourceUri); - } - - return Status; -} - /** Check if this is the Redpath array. Usually the Redpath array represents @@ -3704,7 +3645,7 @@ GetPendingSettings ( return EFI_NOT_FOUND; } - Status = GetResourceByUri (RedfishService, *SettingUri, SettingResponse); + Status = RedfishHttpGetResource (RedfishService, *SettingUri, SettingResponse, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: @Redfish.Settings exists, get resource from: %s failed: %r\n", __func__, *SettingUri, Status)); return Status; @@ -3889,7 +3830,7 @@ ValidateRedfishStringArrayValues ( // CharArrayBuffer is not the same as the StringArray at Index. So the // value is changed. But we still have to go through StringArray to see // if CharArrayBuffer can be found in StringArray or not. If not, Head - // is invalid input from BMC. + // is invalid input from Redfish service. // for (ArrayIndex = FirstMismatch; ArrayIndex < ArraySize; ArrayIndex++) { if (AsciiStrCmp (StringArray[ArrayIndex], CharArrayBuffer->ArrayValue) == 0) { diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf index fd66b8ac3..718273b24 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf @@ -2,7 +2,7 @@ # INF for Redfish feature utility library. # # (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
-# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -46,6 +46,7 @@ PrintLib HttpLib RedfishDebugLib + RedfishHttpCacheLib [Protocols] gEdkIIRedfishETagProtocolGuid ## CONSUMED ##