diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index f96c90cc9..98288d663 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -338,7 +338,7 @@ ProvisioningBiosResource (
// Keep location of new resource.
//
if (NewResourceLocation != NULL) {
- RedfisSetRedfishUri (ConfigureLang, NewResourceLocation);
+ RedfishSetRedfishUri (ConfigureLang, NewResourceLocation);
}
//
@@ -745,7 +745,7 @@ RedfishIdentifyResourceCommon (
//
// Keep URI and ConfigLang mapping
//
- RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
+ RedfishSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
//
// Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE.
// This information is sent back to the parent resource (e.g. the collection driver).
diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
index 7ed1bd55e..ca6d3bc30 100644
--- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -2,6 +2,7 @@
Redfish feature driver implementation - common functions
(C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -1274,7 +1275,7 @@ ProvisioningComputerSystemResource (
// Keep location of new resource.
//
if (NewResourceLocation != NULL) {
- RedfisSetRedfishUri (ConfigureLang, NewResourceLocation);
+ RedfishSetRedfishUri (ConfigureLang, NewResourceLocation);
}
//
@@ -1621,7 +1622,7 @@ RedfishIdentifyResourceCommon (
//
// Keep URI and ConfigLang mapping
//
- RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
+ RedfishSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
//
// Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE.
// This information is sent back to the parent resource (e.g. the collection driver).
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
index b74340362..1b6f4c4ad 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
@@ -2,6 +2,7 @@
Redfish feature driver implementation - common functions
(C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -2190,7 +2191,7 @@ ProvisioningMemoryResource (
// Keep location of new resource.
//
if (NewResourceLocation != NULL) {
- RedfisSetRedfishUri (ConfigureLang, NewResourceLocation);
+ RedfishSetRedfishUri (ConfigureLang, NewResourceLocation);
}
//
@@ -2537,7 +2538,7 @@ RedfishIdentifyResourceCommon (
//
// Keep URI and ConfigLang mapping
//
- RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
+ RedfishSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
//
// Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE.
// This information is sent back to the parent resource (e.g. the collection driver).
diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
index e2f728b26..4906a55ab 100644
--- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
@@ -11,32 +11,13 @@
#ifndef REDFISH_FEATURE_UTILITY_LIB_H_
#define REDFISH_FEATURE_UTILITY_LIB_H_
-#include
#include
#include
#include
+#include
#define REDFISH_ENABLE_SYSTEM_REBOOT() PcdSetBoolS(PcdRedfishSystemRebootRequired, TRUE)
-/**
-
- Read redfish resource by given resource URI.
-
- @param[in] Service Redfish srvice instacne 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
@@ -47,7 +28,7 @@ GetResourceByUri (
@param[out] ArraySignatureClose String to the close of array signature.
@retval EFI_SUCCESS Index is found.
- @retval EFI_NOT_FOUND The non-array configure language string is retured.
+ @retval EFI_NOT_FOUND The non-array configure language string is returned.
@retval EFI_INVALID_PARAMETER The format of input ConfigureLang is wrong.
@retval Others Errors occur.
@@ -100,7 +81,7 @@ CopyConfiglanguageList (
/**
- Get number of node from the string. Node is seperated by '/'.
+ Get number of node from the string. Node is separated by '/'.
@param[in] NodeString The node string to parse.
@@ -118,10 +99,10 @@ GetNumberOfRedpathNodes (
@param[in] NodeString The node string to parse.
@param[in] Index Index of the node.
- @param[out] EndOfNodePtr Pointer to receive the poitner to
+ @param[out] EndOfNodePtr Pointer to receive the pointer to
the last character of node string.
- @retval EFI_STRING the begining of the node string.
+ @retval EFI_STRING the beginning of the node string.
**/
EFI_STRING
@@ -140,7 +121,7 @@ GetRedpathNodeByIndex (
@param[out] Index The array index number.
@retval EFI_SUCCESS Index is found.
- @retval EFI_NOT_FOUND The non-array configure language string is retured.
+ @retval EFI_NOT_FOUND The non-array configure language string is returned.
@retval EFI_INVALID_PARAMETER The format of input ConfigureLang is wrong.
@retval Others Errors occur.
@@ -188,7 +169,7 @@ DestroyConfiglanguageList (
@param[in] DestConfigLang Pointer to the node's configure language string.
The memory pointed by ConfigLang must be allocated
- through memory allocation interface. Becasue we will replace
+ through memory allocation interface. Because we will replace
the pointer in this function.
@param[in] MaxtLengthConfigLang The maximum length of ConfigLang.
@param[in] ConfigLangInstance Pointer to Collection member instance.
@@ -244,7 +225,7 @@ ApplyFeatureSettingsStringType (
/**
- Apply property value to UEFI HII database in numric type.
+ Apply property value to UEFI HII database in numeric type.
@param[in] Schema Property schema.
@param[in] Version Property schema version.
@@ -356,7 +337,7 @@ ApplyFeatureSettingsNumericArrayType (
@param[in] Schema Property schema.
@param[in] Version Property schema version.
@param[in] ConfigureLang Configure language refers to this property.
- @param[in] ArrayHead Head of Redfich CS boolean array value.
+ @param[in] ArrayHead Head of Redfish CS boolean array value.
@retval EFI_SUCCESS New value is applied successfully.
@retval Others Errors occur.
@@ -370,50 +351,6 @@ ApplyFeatureSettingsBooleanArrayType (
IN RedfishCS_bool_Array *ArrayHead
);
-/**
-
- Create HTTP payload and send them to redfish service with POST method.
-
- @param[in] Service Redfish service.
- @param[in] TargetPayload Target payload
- @param[in] Json Data in JSON format.
- @param[out] Location Returned location string from Redfish service.
- @param[out] Etag Returned ETAG string from Redfish service.
-
- @retval EFI_SUCCESS Data is sent to redfish service successfully.
- @retval Others Errors occur.
-
-**/
-EFI_STATUS
-CreatePayloadToPostResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT EFI_STRING *Location,
- OUT CHAR8 **Etag
- );
-
-/**
-
- Create HTTP payload and send them to redfish service with PATCH method.
-
- @param[in] Service Redfish service.
- @param[in] TargetPayload Target payload
- @param[in] Json Data in JSON format.
- @param[out] Etag Returned ETAG string from Redfish service.
-
- @retval EFI_SUCCESS Data is sent to redfish service successfully.
- @retval Others Errors occur.
-
-**/
-EFI_STATUS
-CreatePayloadToPatchResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT CHAR8 **Etag
- );
-
/**
Save Redfish URI in database for further use.
@@ -421,19 +358,19 @@ CreatePayloadToPatchResource (
@param[in] ConfigLang ConfigLang to save
@param[in] Uri Redfish Uri to save
- @retval EFI_INVALID_PARAMETR SystemId is NULL or EMPTY
+ @retval EFI_INVALID_PARAMETER SystemId is NULL or EMPTY
@retval EFI_SUCCESS Redfish uri is saved
**/
EFI_STATUS
-RedfisSetRedfishUri (
+RedfishSetRedfishUri (
IN EFI_STRING ConfigLang,
IN EFI_STRING Uri
);
/**
- Get the property name by given Configure Langauge.
+ Get the property name by given Configure Language.
@param[in] ResourceUri URI of root of resource.
@param[in] ConfigureLang Configure Language string.
@@ -576,7 +513,7 @@ GetOdataId (
/**
- Return config language from given URI and prperty name. It's call responsibility to release returned buffer.
+ Return config language from given URI and property name. It's call responsibility to release returned buffer.
@param[in] Uri The URI to match
@param[in] PropertyName The property name of resource. This is optional.
@@ -790,7 +727,7 @@ MatchPropertyWithJsonContext (
/**
- Create string array and append to arry node in Redfish JSON convert format.
+ Create string array and append to array node in Redfish JSON convert format.
@param[in,out] Head The head of string array.
@param[in] StringArray Input string array.
@@ -809,7 +746,7 @@ AddRedfishCharArray (
/**
- Create numeric array and append to arry node in Redfish JSON convert format.
+ Create numeric array and append to array node in Redfish JSON convert format.
@param[in,out] Head The head of string array.
@param[in] NumericArray Input numeric array.
@@ -828,7 +765,7 @@ AddRedfishNumericArray (
/**
- Create boolean array and append to arry node in Redfish JSON convert format.
+ Create boolean array and append to array node in Redfish JSON convert format.
@param[in,out] Head The head of string array.
@param[in] BooleanArray Input boolean array.
@@ -871,7 +808,7 @@ CompareRedfishStringArrayValues (
Check and see if value in Redfish numeric array are all the same as the one
from HII configuration.
- @param[in] Head The head of Redfish CS numeraic array.
+ @param[in] Head The head of Redfish CS numeric array.
@param[in] NumericArray Input numeric array.
@param[in] ArraySize The size of NumericArray.
@@ -914,9 +851,9 @@ CompareRedfishBooleanArrayValues (
This is just a simple check.
@param[in] RedfishVagueKeyValuePtr The vague key value sets on Redfish service.
- @param[in] RedfishVagueKeyValueNumber The numebr of vague key value sets
+ @param[in] RedfishVagueKeyValueNumber The number of vague key value sets
@param[in] ConfigVagueKeyValuePtr The vague configuration on platform.
- @param[in] ConfigVagueKeyValueNumber The numebr of vague key value sets
+ @param[in] ConfigVagueKeyValueNumber The number of vague key value sets
@retval TRUE All values are the same.
FALSE There is some difference.
diff --git a/RedfishClientPkg/Include/Library/RedfishVersionLib.h b/RedfishClientPkg/Include/Library/RedfishVersionLib.h
index 319f22bd3..020d14d6f 100644
--- a/RedfishClientPkg/Include/Library/RedfishVersionLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishVersionLib.h
@@ -2,6 +2,7 @@
This file defines the Redfish version Library interface.
(C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,9 +11,11 @@
#ifndef REDFISH_VERSION_LIB_H_
#define REDFISH_VERSION_LIB_H_
+#include
+
/**
Query HTTP request to BMC with given redfish service and return redfish
- version information. If there is troulbe to get Redfish version on BMC,
+ version information. If there is trouble to get Redfish version on BMC,
The value of PcdDefaultRedfishVersion is returned.
It's call responsibility to release returned buffer.
diff --git a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
index ce86ce701..d2560e925 100644
--- a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
+++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *mRedfishResourceConfigProtocol = NULL;
EFI_HANDLE mCachedHandle;
@@ -56,7 +57,8 @@ GetRedfishSchemaInfo (
return EFI_INVALID_PARAMETER;
}
- Status = GetResourceByUri (RedfishService, Uri, &Response);
+ ZeroMem (&Response, sizeof (Response));
+ Status = RedfishHttpGetResource (RedfishService, Uri, &Response, TRUE);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, failed to get resource from %s: %r", __func__, Uri, Status));
return Status;
@@ -90,6 +92,10 @@ GetRedfishSchemaInfo (
//
// Release resource.
//
+ if (Response.Payload != NULL) {
+ RedfishHttpFreeResource (&Response);
+ }
+
JsonStructProtocol->DestoryStructure (JsonStructProtocol, Header);
FreePool (JsonText);
RedfishFreeResponse (Response.StatusCode, Response.HeaderCount, Response.Headers, Response.Payload);
diff --git a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.inf b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.inf
index 0da3423d2..f526dc619 100644
--- a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.inf
+++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.inf
@@ -38,6 +38,7 @@
MemoryAllocationLib
RedfishFeatureUtilityLib
RedfishPlatformConfigLib
+ RedfishHttpLib
[Protocols]
gEdkIIRedfishResourceConfigProtocolGuid ## CONSUMES ##
diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 13e29902d..d6ebc7fdf 100644
--- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1040,66 +1040,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
@@ -1773,161 +1713,6 @@ GetEtagAndLocation (
return Status;
}
-/**
-
- Create HTTP payload and send them to redfish service with PATCH method.
-
- @param[in] Service Redfish service.
- @param[in] TargetPayload Target payload
- @param[in] Json Data in JSON format.
- @param[out] Etag Returned ETAG string from Redfish service.
-
- @retval EFI_SUCCESS Data is sent to redfish service successfully.
- @retval Others Errors occur.
-
-**/
-EFI_STATUS
-CreatePayloadToPatchResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT CHAR8 **Etag
- )
-{
- REDFISH_PAYLOAD Payload;
- EDKII_JSON_VALUE ResourceJsonValue;
- REDFISH_RESPONSE PostResponse;
- EFI_STATUS Status;
-
- if ((Service == NULL) || (TargetPayload == NULL) || IS_EMPTY_STRING (Json) || (Etag == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ResourceJsonValue = JsonLoadString (Json, 0, NULL);
- Payload = RedfishCreatePayload (ResourceJsonValue, Service);
- if (Payload == NULL) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from JSON value!\n", __func__, __LINE__));
- Status = EFI_DEVICE_ERROR;
- goto EXIT_FREE_JSON_VALUE;
- }
-
- ZeroMem (&PostResponse, sizeof (REDFISH_RESPONSE));
- Status = RedfishPatchToPayload (TargetPayload, Payload, &PostResponse);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to PATCH payload to Redfish service.\n", __func__, __LINE__));
-
- DEBUG_CODE_BEGIN ();
- DEBUG ((DEBUG_ERROR, "%a: Request:\n", __func__));
- DumpRedfishPayload (DEBUG_ERROR, Payload);
- DEBUG ((DEBUG_ERROR, "%a: Response:\n", __func__));
- DumpRedfishResponse (__func__, DEBUG_ERROR, &PostResponse);
- DEBUG_CODE_END ();
- goto EXIT_FREE_JSON_VALUE;
- }
-
- //
- // Find ETag
- //
- Status = GetEtagAndLocation (&PostResponse, Etag, NULL);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
- RedfishFreeResponse (
- PostResponse.StatusCode,
- PostResponse.HeaderCount,
- PostResponse.Headers,
- PostResponse.Payload
- );
-
-EXIT_FREE_JSON_VALUE:
- if (Payload != NULL) {
- RedfishCleanupPayload (Payload);
- }
-
- JsonValueFree (ResourceJsonValue);
-
- return Status;
-}
-
-/**
-
- Create HTTP payload and send them to redfish service with POST method.
-
- @param[in] Service Redfish service.
- @param[in] TargetPayload Target payload
- @param[in] Json Data in JSON format.
- @param[out] Location Returned location string from Redfish service.
- @param[out] Etag Returned ETAG string from Redfish service.
-
- @retval EFI_SUCCESS Data is sent to redfish service successfully.
- @retval Others Errors occur.
-
-**/
-EFI_STATUS
-CreatePayloadToPostResource (
- IN REDFISH_SERVICE *Service,
- IN REDFISH_PAYLOAD *TargetPayload,
- IN CHAR8 *Json,
- OUT EFI_STRING *Location,
- OUT CHAR8 **Etag
- )
-{
- REDFISH_PAYLOAD Payload;
- EDKII_JSON_VALUE ResourceJsonValue;
- REDFISH_RESPONSE PostResponse;
- EFI_STATUS Status;
-
- if ((Service == NULL) || (TargetPayload == NULL) || IS_EMPTY_STRING (Json) || (Location == NULL) || (Etag == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- ResourceJsonValue = JsonLoadString (Json, 0, NULL);
- Payload = RedfishCreatePayload (ResourceJsonValue, Service);
- if (Payload == NULL) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to create JSON payload from JSON value!\n", __func__, __LINE__));
- Status = EFI_DEVICE_ERROR;
- goto EXIT_FREE_JSON_VALUE;
- }
-
- ZeroMem (&PostResponse, sizeof (REDFISH_RESPONSE));
- Status = RedfishPostToPayload (TargetPayload, Payload, &PostResponse);
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a:%d Failed to POST payload to Redfish service.\n", __func__, __LINE__));
-
- DEBUG_CODE_BEGIN ();
- DEBUG ((DEBUG_ERROR, "%a: Request:\n", __func__));
- DumpRedfishPayload (DEBUG_ERROR, Payload);
- DEBUG ((DEBUG_ERROR, "%a: Response:\n", __func__));
- DumpRedfishResponse (__func__, DEBUG_ERROR, &PostResponse);
- DEBUG_CODE_END ();
-
- goto EXIT_FREE_JSON_VALUE;
- }
-
- //
- // per Redfish spec. the URL of new resource will be returned in "Location" header.
- //
- Status = GetEtagAndLocation (&PostResponse, Etag, Location);
- if (EFI_ERROR (Status)) {
- Status = EFI_DEVICE_ERROR;
- }
-
- RedfishFreeResponse (
- PostResponse.StatusCode,
- PostResponse.HeaderCount,
- PostResponse.Headers,
- PostResponse.Payload
- );
-
- RedfishCleanupPayload (Payload);
-
-EXIT_FREE_JSON_VALUE:
- JsonValueFree (ResourceJsonValue);
-
- return Status;
-}
-
/**
Return redfish URI by given config language. It's call responsibility to release returned buffer.
@@ -2191,7 +1976,7 @@ GetConfigureLang (
**/
EFI_STATUS
-RedfisSetRedfishUri (
+RedfishSetRedfishUri (
IN EFI_STRING ConfigLang,
IN EFI_STRING Uri
)
diff --git a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
index 45e156ca9..b47836818 100644
--- a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
+++ b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
@@ -2,6 +2,7 @@
Redfish version library implementation
(C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -10,15 +11,17 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
#include
+#include
#define REDFISH_VERSION_DEFAULT_STRING L"v1"
-#define REDFISH_ROOT_URI "/redfish"
+#define REDFISH_ROOT_URI L"/redfish"
REDFISH_SERVICE *mCacheService;
EFI_STRING mVersionCache;
@@ -26,7 +29,7 @@ UINTN mVersionStringSize;
/**
Cache the redfish service version for later use so we don't have to query
- HTTP request everytime.
+ HTTP request every time.
@param[in] Service Redfish service instance
@param[in] Version Version string to cache
@@ -66,7 +69,7 @@ CacheVersion (
/**
Query HTTP request to BMC with given redfish service and return redfish
- version information. If there is troulbe to get Redfish version on BMC,
+ version information. If there is trouble to get Redfish version on BMC,
The value of PcdDefaultRedfishVersion is returned.
It's call responsibility to release returned buffer.
@@ -105,22 +108,17 @@ RedfishGetVersion (
//
// Get resource from redfish service.
//
- Status = RedfishGetByUri (
+ ZeroMem (&Response, sizeof (Response));
+ Status = RedfishHttpGetResource (
Service,
REDFISH_ROOT_URI,
- &Response
+ &Response,
+ TRUE
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, RedfishGetByService to %a failed: %r\n", __func__, REDFISH_ROOT_URI, Status));
if (Response.Payload != NULL) {
RedfishDumpPayload (Response.Payload);
- RedfishFreeResponse (
- NULL,
- 0,
- NULL,
- Response.Payload
- );
- Response.Payload = NULL;
}
goto ON_ERROR;
@@ -150,6 +148,10 @@ RedfishGetVersion (
VersionString = REDFISH_VERSION_DEFAULT_STRING;
}
+ if (Response.Payload != NULL) {
+ RedfishHttpFreeResource (&Response);
+ }
+
return AllocateCopyPool (StrSize (VersionString), VersionString);
}
diff --git a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf
index 34d13d64f..eba8a0823 100644
--- a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf
+++ b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf
@@ -31,10 +31,11 @@
[LibraryClasses]
BaseLib
+ BaseMemoryLib
DebugLib
MemoryAllocationLib
PcdLib
- RedfishLib
+ RedfishHttpLib
JsonLib
[Protocols]