[AMD Official Use Only - General] Reviewed-by: Abner Chang <abner.ch...@amd.com>
> -----Original Message----- > From: Nickle Wang <nick...@nvidia.com> > Sent: Friday, May 12, 2023 11:47 AM > To: devel@edk2.groups.io > Cc: Chang, Abner <abner.ch...@amd.com>; Igor Kulchytskyy > <ig...@ami.com> > Subject: [edk2-redfish-client][PATCH 1/4] RedfishClientPkg: Fix GCC build > error > > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. > > > Fix below GCC build error: > 1) "Head" dereference issue. > 2) "BooleanArrayBuffer" uninitialized variable issue. > 3) Multiple definition of mRedfishVariableGuid. > 4) Multiple definition of medfishResourceConfigProtocolHandle. > > Signed-off-by: Nickle Wang <nick...@nvidia.com> > Cc: Abner Chang <abner.ch...@amd.com> > Cc: Igor Kulchytskyy <ig...@ami.com> > --- > RedfishClientPkg/RedfishClientPkg.dec | 4 ++++ > .../RedfishConfigLangMapDxe.inf | 2 ++ > RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf | 2 ++ > RedfishClientPkg/Include/RedfishBase.h | 4 ++-- > .../EdkIIRedfishResourceConfigLib.c | 11 ++++++----- > .../RedfishFeatureUtilityLib.c | 5 +++-- > .../RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c | 9 +++++---- > RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c | 9 +++++---- > 8 files changed, 29 insertions(+), 17 deletions(-) > > diff --git a/RedfishClientPkg/RedfishClientPkg.dec > b/RedfishClientPkg/RedfishClientPkg.dec > index 67929341..d3c97ecf 100644 > --- a/RedfishClientPkg/RedfishClientPkg.dec > +++ b/RedfishClientPkg/RedfishClientPkg.dec > @@ -2,6 +2,7 @@ > # Redfish Client Package > # > # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR> > +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -51,6 +52,9 @@ > gEfiRedfishClientFeatureReadyToProvisioningGuid = { 0x77E4FC1C, 0x2428, > 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E, 0xF0 } } > gEfiRedfishClientFeatureAfterProvisioningGuid = { 0xE547CB6F, 0x306F, > 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E, 0xD0 } } > > + ## Include/RedfishBase.h > + gEfiRedfishClientVariableGuid = { 0x91c46a3d, 0xed1a, > 0x477b, > { 0xa5, 0x33, 0x87, 0x2d, 0xcd, 0xb0, 0xfc, 0xc1 } } > + > [PcdsFixedAtBuild] > > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32| > UINT32|0x10000001 > > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8| > UINT32|0x10000002 > diff --git > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.i > nf > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.i > nf > index 9f195338..821f0552 100644 > --- > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.i > nf > +++ > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.i > +++ nf > @@ -1,6 +1,7 @@ > ## @file > # > # (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR> > +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -41,6 +42,7 @@ > > [Guids] > gEfiEventExitBootServicesGuid ## CONSUMED ## > + gEfiRedfishClientVariableGuid ## CONSUMED ## > > [Depex] > TRUE > diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > index e29a1045..4aecdb41 100644 > --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > @@ -1,6 +1,7 @@ > ## @file > # > # (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR> > +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -40,6 +41,7 @@ > > [Guids] > gEfiEventExitBootServicesGuid ## CONSUMES ## Event > + gEfiRedfishClientVariableGuid ## CONSUMED ## > > [Depex] > TRUE > diff --git a/RedfishClientPkg/Include/RedfishBase.h > b/RedfishClientPkg/Include/RedfishBase.h > index 1abe9517..753e9ed2 100644 > --- a/RedfishClientPkg/Include/RedfishBase.h > +++ b/RedfishClientPkg/Include/RedfishBase.h > @@ -2,6 +2,7 @@ > Redfish base header file. > > (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR> > + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -16,7 +17,6 @@ > /// > /// This GUID is used for an EFI Variable that stores the Redfish data. > /// > -EFI_GUID mRedfishVariableGuid = { 0x91c46a3d, 0xed1a, 0x477b, { 0xa5, > 0x33, 0x87, 0x2d, 0xcd, 0xb0, 0xfc, 0xc1 } -}; > +extern EFI_GUID gEfiRedfishClientVariableGuid; > > #endif > diff --git > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.c > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishRes > ourceConfigLib.c > index b1eaad75..521e2edb 100644 > --- > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishReso > urceConfigLib.c > +++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfis > +++ hResourceConfigLib.c > @@ -2,6 +2,7 @@ > Redfish resource config library implementation > > (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR> > + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -17,7 +18,7 @@ > #include <Library/RedfishPlatformConfigLib.h> > > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL > *mRedfishResourceConfigProtocol = NULL; > -EFI_HANDLE > medfishResourceConfigProtocolHandle; > +EFI_HANDLE mCachedHandle; > EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL > mRedfishFeatureInterchangeData; > REDFISH_SCHEMA_INFO mSchemaInfoCache; > > @@ -256,7 +257,7 @@ GetRedfishResourceConfigProtocol ( > (AsciiStrCmp (Schema->Errata, mSchemaInfoCache.Errata) == 0)) > { > if (Handle != NULL) { > - *Handle = medfishResourceConfigProtocolHandle; > + *Handle = mCachedHandle; > } > > return mRedfishResourceConfigProtocol; @@ -302,8 +303,8 @@ > GetRedfishResourceConfigProtocol ( > } > > if (Found) { > - medfishResourceConfigProtocolHandle = HandleBuffer[Index]; > - mRedfishResourceConfigProtocol = Protocol; > + mCachedHandle = HandleBuffer[Index]; > + mRedfishResourceConfigProtocol = Protocol; > CopyMem (&mSchemaInfoCache, Schema, sizeof > (REDFISH_SCHEMA_INFO)); > if (Handle != NULL) { > *Handle = HandleBuffer[Index]; > @@ -379,7 +380,7 @@ EdkIIRedfishResourceSetConfigureLang ( > EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL *Interface; > > Status = gBS->HandleProtocol ( > - medfishResourceConfigProtocolHandle, > + mCachedHandle, > &gEdkIIRedfishFeatureInterchangeDataProtocolGuid, > (VOID **)&Interface > ); > diff --git > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib > .c > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib > .c > index b93a9e18..e87af3d5 100644 > --- > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib > .c > +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUt > +++ ilityLib.c > @@ -2,6 +2,7 @@ > Redfish feature utility library implementation > > (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR> > + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -1971,7 +1972,7 @@ RedfishGetUri ( > // > // String which has no ConfigLang remaining > // > - if (Head != '\0') { > + if (Head[0] != '\0') { > StrCatS (ResultStr, MAX_REDFISH_URL_LEN, Head); > } > > @@ -3234,7 +3235,7 @@ AddRedfishBooleanArray ( > RedfishCS_bool_Array *BooleanArrayBuffer; > RedfishCS_bool_Array *PreArrayBuffer; > > - if ((Head == NULL) || (BooleanArrayBuffer == NULL) || (ArraySize == 0)) { > + if ((Head == NULL) || (BooleanArray == NULL) || (ArraySize == 0)) { > return EFI_INVALID_PARAMETER; > } > > diff --git > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > index cea61f90..d1a73576 100644 > --- > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > +++ > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > @@ -1,6 +1,7 @@ > /** @file > > (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR> > + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -414,16 +415,16 @@ SaveConfigLangMapList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&Data, > NULL > ); > if (!EFI_ERROR (Status)) { > FreePool (Data); > - gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > + gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, > + VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > } > > - return gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData); > + return gRT->SetVariable (VariableName, > + &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, > + (VOID *)VarData); > } > > /** > @@ -459,7 +460,7 @@ InitialConfigLangMapList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&VarData, > &VariableSize > ); > diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > index a4233a64..3561c11b 100644 > --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > @@ -1,6 +1,7 @@ > /** @file > > (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP<BR> > + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -401,16 +402,16 @@ SaveETagList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&Data, > NULL > ); > if (!EFI_ERROR (Status)) { > FreePool (Data); > - gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > + gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, > + VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > } > > - return gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData); > + return gRT->SetVariable (VariableName, > + &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, > + (VOID *)VarData); > } > > /** > @@ -446,7 +447,7 @@ InitialETagList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&VarData, > &VariableSize > ); > -- > 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104754): https://edk2.groups.io/g/devel/message/104754 Mute This Topic: https://groups.io/mt/98842831/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-