EdkIIRedfishResourceSetConfigureLang() uses cached handler to locate protocol. However, if EdkIIRedfishResourceSetConfigureLang() is called at non-collection driver, the cached handler is NULL because cached handler is initialized by collection driver. Since EdkIIRedfishResourceSetConfigureLang() is in library, the cached handler is not shared in different drivers. Fix this issue by getting image handler from caller.
Signed-off-by: Nickle Wang <nick...@nvidia.com> Cc: Abner Chang <abner.ch...@amd.com> Cc: Igor Kulchytskyy <ig...@ami.com> Cc: Nick Ramirez <nrami...@nvidia.com> --- .../Library/EdkIIRedfishResourceConfigLib.h | 9 ++++++--- .../Features/Bios/v1_0_9/Common/BiosCommon.c | 9 +++++---- .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 3 +-- .../v1_5_0/Common/ComputerSystemCommon.c | 8 +++++--- .../v1_5_0/Dxe/ComputerSystemDxe.c | 3 +-- .../ComputerSystemCollectionDxe.c | 5 +++-- .../Memory/V1_7_1/Common/MemoryCommon.c | 8 +++++--- .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c | 3 +-- .../MemoryCollectionDxe/MemoryCollectionDxe.c | 5 +++-- .../EdkIIRedfishResourceConfigLib.c | 18 ++++++++++++++---- 10 files changed, 44 insertions(+), 27 deletions(-) diff --git a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h index a7856033..c8c9cb86 100644 --- a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h +++ b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h @@ -2,6 +2,7 @@ This file defines the EDKII resource config Library interface. (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -18,7 +19,7 @@ #include <Protocol/EdkIIRedfishInterchangeData.h> /** - Provising redfish resource by given URI. + Provisioning redfish resource by given URI. @param[in] Schema Redfish schema information. @param[in] Uri Target URI to create resource. @@ -32,7 +33,7 @@ **/ EFI_STATUS -EdkIIRedfishResourceConfigProvisionging ( +EdkIIRedfishResourceConfigProvisioning ( IN REDFISH_SCHEMA_INFO *Schema, IN EFI_STRING Uri, IN RESOURCE_INFORMATION_EXCHANGE *InformationExchange, @@ -109,6 +110,7 @@ EdkIIRedfishResourceConfigIdentify ( Set Configure language of this resource in the RESOURCE_INFORMATION_EXCHANGE structure. + @param[in] ImageHandle Pointer to image handle. @param[in] ConfigLangList Pointer to REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST. @retval EFI_SUCCESS Configure language is set. @@ -118,7 +120,8 @@ EdkIIRedfishResourceConfigIdentify ( **/ EFI_STATUS EdkIIRedfishResourceSetConfigureLang ( - REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigLangList + IN EFI_HANDLE ImageHandle, + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigLangList ); /** diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c index 98288d66..ea274018 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c @@ -12,7 +12,8 @@ CHAR8 BiosEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\": \"#Bios.v1_0_9.Bios\", \"Id\": \"\", \"Name\": \"\", \"Attributes\":{}}"; -REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL; +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL; +EFI_HANDLE mRedfishResourceConfigProtocolHandle = NULL; /** Consume resource from given URI. @@ -385,7 +386,7 @@ ProvisioningBiosResources ( // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. // This information is sent back to the parent resource (e.g. the collection driver). // - EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList); + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHandle, &UnifiedConfigureLangList); for (Index = 0; Index < UnifiedConfigureLangList.Count; Index++) { DEBUG ((DEBUG_MANAGEABILITY, "[%d] create Bios resource from: %s\n", UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangList.List[Index].ConfigureLang)); @@ -750,7 +751,7 @@ RedfishIdentifyResourceCommon ( // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. // This information is sent back to the parent resource (e.g. the collection driver). // - EdkIIRedfishResourceSetConfigureLang (&ConfigLangList); + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHandle, &ConfigLangList); DestroyConfiglanguageList (&ConfigLangList); return EFI_SUCCESS; } @@ -817,7 +818,7 @@ HandleResource ( // The target property does not exist, do the provision to create property. // DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)); - Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri, Private->InformationExchange, FALSE); + Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, Private->InformationExchange, FALSE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n", __func__, Status)); } diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c index 9b336d3d..8b9bdc31 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c @@ -11,6 +11,7 @@ #include "../Common/BiosCommon.h" extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; +extern EFI_HANDLE mRedfishResourceConfigProtocolHandle; EFI_STATUS HandleResource ( @@ -18,8 +19,6 @@ HandleResource ( IN EFI_STRING Uri ); -EFI_HANDLE mRedfishResourceConfigProtocolHandle; - /** Provisioning redfish resource by given URI. diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c index 1ffb7d1d..78beb5cb 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<BR> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -11,7 +12,8 @@ CHAR8 ComputerSystemEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\": \"#ComputerSystem.v1_5_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\", \"Boot\":{}}"; -REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL; +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL; +EFI_HANDLE mRedfishResourceConfigProtocolHandle = NULL; /** Consume resource from given URI. @@ -1321,7 +1323,7 @@ ProvisioningComputerSystemResources ( // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. // This information is sent back to the parent resource (e.g. the collection driver). // - EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList); + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHandle, &UnifiedConfigureLangList); for (Index = 0; Index < UnifiedConfigureLangList.Count; Index++) { DEBUG ((DEBUG_MANAGEABILITY, "[%d] create ComputerSystem resource from: %s\n", UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangList.List[Index].ConfigureLang)); @@ -1626,7 +1628,7 @@ RedfishIdentifyResourceCommon ( // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. // This information is sent back to the parent resource (e.g. the collection driver). // - EdkIIRedfishResourceSetConfigureLang (&ConfigLangList); + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHandle, &ConfigLangList); DestroyConfiglanguageList (&ConfigLangList); return EFI_SUCCESS; } diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c index 5c2a4ead..4ee72eeb 100644 --- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.c @@ -11,8 +11,7 @@ #include "../Common/ComputerSystemCommon.h" extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; - -EFI_HANDLE mRedfishResourceConfigProtocolHandle; +extern EFI_HANDLE mRedfishResourceConfigProtocolHandle; /** Provisioning redfish resource by given URI. diff --git a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c index 1e362d49..5c6850c9 100644 --- a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c +++ b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c @@ -3,6 +3,7 @@ Redfish feature driver implementation - ComputerSystemCollection (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -95,7 +96,7 @@ HandleResource ( // The target property does not exist, do the provision to create property. // DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)); - Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri, Private->InformationExchange, FALSE); + Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, Private->InformationExchange, FALSE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n", __func__, Status)); } @@ -226,7 +227,7 @@ CreateCollectionResource ( DEBUG ((REDFISH_DEBUG_TRACE, "%a, supported schema: %a %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, SchemaInfo.Minor, SchemaInfo.Errata)); - Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Private->CollectionUri, Private->InformationExchange, TRUE); + Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Private->CollectionUri, Private->InformationExchange, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to create resource for: %s: %r\n", __func__, Private->CollectionUri, Status)); } diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c index 4c41f16b..44325ddb 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<BR> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -11,7 +12,8 @@ CHAR8 MemoryEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\": \"#Memory.v1_7_1.Memory\", \"Id\": \"\", \"Name\": \"\"}"; -REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL; +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL; +EFI_HANDLE mRedfishResourceConfigProtocolHandle = NULL; /** Consume resource from given URI. @@ -2237,7 +2239,7 @@ ProvisioningMemoryResources ( // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. // This information is sent back to the parent resource (e.g. the collection driver). // - EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList); + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHandle, &UnifiedConfigureLangList); for (Index = 0; Index < UnifiedConfigureLangList.Count; Index++) { DEBUG ((DEBUG_MANAGEABILITY, "[%d] create Memory resource from: %s\n", UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangList.List[Index].ConfigureLang)); @@ -2542,7 +2544,7 @@ RedfishIdentifyResourceCommon ( // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. // This information is sent back to the parent resource (e.g. the collection driver). // - EdkIIRedfishResourceSetConfigureLang (&ConfigLangList); + EdkIIRedfishResourceSetConfigureLang (mRedfishResourceConfigProtocolHandle, &ConfigLangList); DestroyConfiglanguageList (&ConfigLangList); return EFI_SUCCESS; } diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c b/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c index f34f3266..80bfd6d2 100644 --- a/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c +++ b/RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.c @@ -11,8 +11,7 @@ #include "../Common/MemoryCommon.h" extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; - -EFI_HANDLE mRedfishResourceConfigProtocolHandle; +extern EFI_HANDLE mRedfishResourceConfigProtocolHandle; /** Provisioning redfish resource by given URI. diff --git a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c index 1b755cde..dc1ee5ca 100644 --- a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c +++ b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c @@ -3,6 +3,7 @@ Redfish feature driver implementation - MemoryCollection (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -95,7 +96,7 @@ HandleResource ( // The target property does not exist, do the provision to create property. // DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)); - Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri, Private->InformationExchange, FALSE); + Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, Private->InformationExchange, FALSE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n", __func__, Status)); } @@ -226,7 +227,7 @@ CreateCollectionResource ( DEBUG ((REDFISH_DEBUG_TRACE, "%a, supported schema: %a %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, SchemaInfo.Minor, SchemaInfo.Errata)); - Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Private->CollectionUri, Private->InformationExchange, TRUE); + Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Private->CollectionUri, Private->InformationExchange, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to create resource for: %s: %r\n", __func__, Private->CollectionUri, Status)); } diff --git a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c index ce86ce70..7a7bb4de 100644 --- a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c +++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c @@ -363,6 +363,7 @@ InstallInterchangeDataProtocol ( Set Configure language of this resource in the RESOURCE_INFORMATION_EXCHANGE structure. + @param[in] ImageHandle Pointer to image handle. @param[in] ConfigLangList Pointer to REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST. @retval EFI_SUCCESS Configure language is set. @@ -372,20 +373,29 @@ InstallInterchangeDataProtocol ( **/ EFI_STATUS EdkIIRedfishResourceSetConfigureLang ( - REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigLangList + IN EFI_HANDLE ImageHandle, + IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST *ConfigLangList ) { EFI_STATUS Status; UINTN Index; EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL *Interface; + if ((ImageHandle == NULL) || (ConfigLangList == NULL)) { + return EFI_INVALID_PARAMETER; + } + + if ((ConfigLangList->Count == 0) || (ConfigLangList->List == NULL)) { + return EFI_NOT_FOUND; + } + Status = gBS->HandleProtocol ( - mCachedHandle, + ImageHandle, &gEdkIIRedfishFeatureInterchangeDataProtocolGuid, (VOID **)&Interface ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL is not installed %r", __func__, Status)); + DEBUG ((DEBUG_ERROR, "%a: EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL is not installed on %p: %r\n", __func__, ImageHandle, Status)); return Status; } @@ -422,7 +432,7 @@ EdkIIRedfishResourceSetConfigureLang ( **/ EFI_STATUS -EdkIIRedfishResourceConfigProvisionging ( +EdkIIRedfishResourceConfigProvisioning ( IN REDFISH_SCHEMA_INFO *Schema, IN EFI_STRING Uri, IN RESOURCE_INFORMATION_EXCHANGE *InformationExchange, -- 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111676): https://edk2.groups.io/g/devel/message/111676 Mute This Topic: https://groups.io/mt/102767548/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-