[edk2-devel] [edk2-platforms][PATCH 1/2] IpmiFeaturePkg/GenericIpmi: add IpmiFeaturePkg.dec to packages list

2024-06-18 Thread Mike Maslenkin
GCC is unable to find a header file located into IpmiFeaturePkg:
  fatal error: Library/ServerMgmtRtLib.h: No such file or directory
 11 | #include 
|  ^~~

Signed-off-by: Mike Maslenkin 
Cc: Nate DeSimone 
Cc: Liming Gao 
---
 .../Library/ServerManagementLibNull/ServerManagementLibNull.inf  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/ServerManagementLibNull/ServerManagementLibNull.inf
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/ServerManagementLibNull/ServerManagementLibNull.inf
index 6b66b44857f3..8bde6fbaa7be 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/ServerManagementLibNull/ServerManagementLibNull.inf
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Library/ServerManagementLibNull/ServerManagementLibNull.inf
@@ -27,6 +27,7 @@
 
 
 [Packages]
+  IpmiFeaturePkg/IpmiFeaturePkg.dec
   MdePkg/MdePkg.dec
   ServerPlatformPkg/PlatformPkg.dec
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119619): https://edk2.groups.io/g/devel/message/119619
Mute This Topic: https://groups.io/mt/106750821/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH 2/2] IpmiFeaturePkg/GenericIpmi: add EFIAPI for driver entrypoints

2024-06-18 Thread Mike Maslenkin
Fix gcc build failure:
IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c:414:1:
  error: conflicting types for 'InitializeSmmGenericIpmi'
  414 | InitializeSmmGenericIpmi (
  | ^~~~
In file included from :
IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi/DEBUG/AutoGen.h:138:1:
  note: previous declaration of 'InitializeSmmGenericIpmi' was here
  138 | InitializeSmmGenericIpmi (
  | ^~~~

Signed-off-by: Mike Maslenkin 
Cc: Nate DeSimone 
Cc: Liming Gao 
---
 .../OutOfBandManagement/IpmiFeaturePkg/BmcElog/Dxe/BmcElog.c | 1 +
 .../IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c  | 1 +
 .../GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c   | 1 +
 3 files changed, 3 insertions(+)

diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/Dxe/BmcElog.c 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/Dxe/BmcElog.c
index 0b1e2f5b1355..cd627ea799a2 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/Dxe/BmcElog.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/Dxe/BmcElog.c
@@ -258,6 +258,7 @@ SetElogRedirInstall (
 
 **/
 EFI_STATUS
+EFIAPI
 InitializeBmcElogLayer (
   IN EFI_HANDLEImageHandle,
   IN EFI_SYSTEM_TABLE  *SystemTable
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
index 23493733178a..976bb69c956b 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Smm/SmmGenericIpmi.c
@@ -410,6 +410,7 @@ Returns:
 }
 
 EFI_STATUS
+EFIAPI
 InitializeSmmGenericIpmi (
   IN EFI_HANDLEImageHandle,
   IN EFI_SYSTEM_TABLE  *SystemTable
diff --git 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
index edc9eec9395a..a7faa0e1f37f 100644
--- 
a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
+++ 
b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/StandaloneMm/StandaloneMmGenericIpmi.c
@@ -330,6 +330,7 @@ Returns:
 
 **/
 EFI_STATUS
+EFIAPI
 InitializeGenericIpmiStandaloneMm (
   IN EFI_HANDLE   ImageHandle,
   IN EFI_MM_SYSTEM_TABLE  *SystemTable
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119620): https://edk2.groups.io/g/devel/message/119620
Mute This Topic: https://groups.io/mt/106750822/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH 0/2] IpmiFeaturePkg: compilation fix

2024-06-18 Thread Mike Maslenkin
Signed-off-by: Mike Maslenkin 
Cc: Nate DeSimone 
Cc: Liming Gao 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119618): https://edk2.groups.io/g/devel/message/119618
Mute This Topic: https://groups.io/mt/106750820/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/1] MdeModulePkg/RamDiskDxe: fix memory leak.

2024-04-28 Thread Mike Maslenkin
Cc: Ray Ni 
Cc: Zhichao Gao 
Cc: Liming Gao 
Signed-off-by: Mike Maslenkin 
---
 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c 
b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
index 60cf3c8c4a79..2dac121c478c 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
@@ -404,7 +404,8 @@ HiiCreateRamDisk (
   );
   } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
 
-  return EFI_DEVICE_ERROR;
+  Status = EFI_DEVICE_ERROR;
+  goto ErrorExit;
 }
   }
 
@@ -431,7 +432,7 @@ HiiCreateRamDisk (
 );
 } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
 
-return Status;
+goto ErrorExit;
   }
 
   //
@@ -442,6 +443,10 @@ HiiCreateRamDisk (
   PrivateData->CreateMethod = RamDiskCreateHii;
 
   return EFI_SUCCESS;
+
+ErrorExit:
+  gBS->FreePool (StartingAddr);
+  return Status;
 }
 
 /**
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118353): https://edk2.groups.io/g/devel/message/118353
Mute This Topic: https://groups.io/mt/105788221/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH V5 1/2] RedfishClientPkg: Set SettingsObject URI as the config language

2024-04-01 Thread Mike Maslenkin
Hi Abner,
Sorry for the delayed response.
Patch looks good to me.

Regards,
Mike.

On Mon, Apr 1, 2024 at 4:23 AM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> Hi Mike,
> Just letting you know that I merged this patch set to clean up the backlogs. 
> I believe your comment was addressed in V5. Just let me know if you still 
> find any improper code.
> Thanks
> Abner
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Chang,
> > Abner via groups.io
> > Sent: Thursday, March 28, 2024 2:54 PM
> > To: Nickle Wang ; devel@edk2.groups.io; Mike
> > Maslenkin 
> > Cc: Igor Kulchytskyy 
> > Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V5 1/2]
> > RedfishClientPkg: Set SettingsObject URI as the config language
> >
> > [AMD Official Use Only - General]
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > [AMD Official Use Only - General]
> >
> > Hi @Mike Maslenkin, would you like to review this patch again as I addressed
> > your comments in V5 patch set.
> > Thanks
> > Abner
> >
> > > -Original Message-
> > > From: Nickle Wang 
> > > Sent: Tuesday, March 26, 2024 8:14 PM
> > > To: Chang, Abner ; devel@edk2.groups.io
> > > Cc: Igor Kulchytskyy 
> > > Subject: RE: [edk2-redfish-client][PATCH V5 1/2] RedfishClientPkg: Set
> > > SettingsObject URI as the config language
> > >
> > > Caution: This message originated from an External Source. Use proper
> > caution
> > > when opening attachments, clicking links, or responding.
> > >
> > >
> > > Thanks for working on this, Abner.
> > >
> > >
> > > Reviewed-by: Nickle Wang 
> > >
> > > Regards,
> > > Nickle
> > >
> > > > -Original Message-
> > > > From: abner.ch...@amd.com 
> > > > Sent: Friday, March 22, 2024 10:41 PM
> > > > To: devel@edk2.groups.io
> > > > Cc: Igor Kulchytskyy ; Nickle Wang
> > 
> > > > Subject: [edk2-redfish-client][PATCH V5 1/2] RedfishClientPkg: Set
> > > SettingsObject
> > > > URI as the config language
> > > >
> > > > External email: Use caution opening links or attachments
> > > >
> > > >
> > > > From: Abner Chang 
> > > >
> > > > Set SettingsObject URI in @Redfish.Settings resource as the config
> > language
> > > > which is the same as the config language of parent URI that mandates
> > > > @Redfish.Settings.
> > > > With this, we can find the config language of the properties in
> > SettingsObject
> > > URI.
> > > >
> > > > Signed-off-by: Abner Chang 
> > > > Cc: Igor Kulchytskyy 
> > > > Co-authored-by: Nickle Wang 
> > > > ---
> > > >  .../Library/RedfishFeatureUtilityLib.h| 17 
> > > >  .../RedfishFeatureUtilityLib.c| 89 ---
> > > >  .../RedfishConfigLangMapDxe.c | 15 +++-
> > > >  3 files changed, 104 insertions(+), 17 deletions(-)
> > > >
> > > > diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > > b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > > index ba9ea01501..3c5f248eb7 100644
> > > > --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > > +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > > @@ -369,6 +369,23 @@ RedfishSetRedfishUri (
> > > >INEFI_STRING  Uri
> > > >);
> > > >
> > > > +/**
> > > > +
> > > > +  Save Redfish SettingsObject URI in database for further use.
> > > > +
> > > > +  @param[in]ParentUri Parent URI of @Redfish.Settings 
> > > > property.
> > > > +  @param[in]SettingObjectUri  Redfish SettingsObject Uri to save.
> > > > +
> > > > +  @retval  EFI_INVALID_PARAMETER  SystemId is NULL or EMPTY
> > > > +  @retval  EFI_SUCCESSRedfish uri is saved
> > > > +
> > > > +**/
> > > > +EFI_STATUS
> > > > +SetRedfishSettingsObjectsUri (
> > > > +  IN EFI_STRING  ParentUri,
> > > > +  IN EFI_STRING  SettingObjectUri
> > > > +  );
> > > > +
> > > &g

Re: [edk2-devel] [edk2-redfish-client][RFC PATCH 0/3] RedfishClientPkg: fix GetRedpathNodeByIndex()

2024-03-26 Thread Mike Maslenkin
Hi,

I have updated patches with R-b and pushed it to PR
https://github.com/tianocore/edk2-redfish-client/pull/85

Thank you for the review!

Regards,
Mike

On Tue, Mar 26, 2024 at 4:41 PM Nickle Wang  wrote:
>
> Thanks for your reminder, Abner. I verify this patch series on my system, and 
> I don't see any issue.
>
>
>
> Hi @Mike Maslenkin, please add Abner and my reviewed-by to the commit 
> messages. And we can merge the pull request.
>
>
>
> Thanks,
>
> Nickle
>
>
>
> > -Original Message-
>
> > From: Chang, Abner 
>
> > Sent: Monday, March 25, 2024 10:13 AM
>
> > To: Mike Maslenkin ; devel@edk2.groups.io
>
> > Cc: Igor Kulchytskyy ; Nickle Wang 
>
> > Subject: RE: [edk2-redfish-client][RFC PATCH 0/3] RedfishClientPkg: fix
>
> > GetRedpathNodeByIndex()
>
> >
>
> > External email: Use caution opening links or attachments
>
> >
>
> >
>
> > [AMD Official Use Only - General]
>
> >
>
> > For this patch set,  Reviewed-by: Abner Chang 
>
> >
>
> > Hi Nickle, please also take a look at this change. Thanks Abner
>
> >
>
> > > -Original Message-
>
> > > From: Mike Maslenkin 
>
> > > Sent: Saturday, March 23, 2024 8:01 PM
>
> > > To: devel@edk2.groups.io
>
> > > Cc: Chang, Abner ; Igor Kulchytskyy
>
> > > ; Nickle Wang ; Mike Maslenkin
>
> > > 
>
> > > Subject: [edk2-redfish-client][RFC PATCH 0/3] RedfishClientPkg: fix
>
> > > GetRedpathNodeByIndex()
>
> > >
>
> > > Caution: This message originated from an External Source. Use proper
>
> > > caution when opening attachments, clicking links, or responding.
>
> > >
>
> > >
>
> > > This set contains fixes for proper nodes handling in 
> > > GetRedpathNodeByIndex().
>
> > > It fixes handling of nodes with Index different from 0, it removes
>
> > > leading '/' returned for section with Index = 0, also it fixes return
>
> > > of the last section.
>
> >
>
> > This set does not have any impact to
>
> > > existing code,
>
> > > because in all places this function is used to obtain the end of the 
> > > first section.
>
> > > And actually returned pointer to the requested section is not used.
>
> > > The current usages is:
>
> > >GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0,
>
> > > &EndOfChar);
>
> > >
>
> > > and return of EndOfChar value is not affected by this set.
>
> > >
>
> > > Cc: Abner Chang 
>
> > > Cc: Igor Kulchytskyy 
>
> > > Cc: Nickle Wang 
>
> > > Signed-off-by: Mike Maslenkin 
>
> > >
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117141): https://edk2.groups.io/g/devel/message/117141
Mute This Topic: https://groups.io/mt/105101990/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 3/3] RedfishClientPkg: fix the first node processing in GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
For node with index 0, the result of this function contains leading L'/'
character. But for other nodes no such characters (separators) returned.
Make processing of all fields consistent.

After this patch the debug output for specified URI is the following:

 @Redfish.Settings found:/redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes:6
 GetRedpathNodeByIndex[0]:redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:Settings

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index b0a3b20a40bd..c55dc2ee6d05 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1304,7 +1304,7 @@ GetRedpathNodeByIndex (
   NumberNodes = 0;
   StringLen   = StrLen (NodeString);
   StringIndex = 1; // ConfigLang always starts with '/'.
-  NodeStart   = NodeString;
+  NodeStart   = NodeString + StringIndex;
   if (EndOfNodePtr != NULL) {
 *EndOfNodePtr = NULL;
   }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117068): https://edk2.groups.io/g/devel/message/117068
Mute This Topic: https://groups.io/mt/105101993/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 2/3] RedfishClientPkg: fix the last field processing in GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
After processing of nodes was fixed it was revealed that this function
is not handling the last node correctly. The problem is that the end
of node detected by comparing to L'/', but usually ConfigLang and other
properties do not have terminating separator (i.e '/'). So, before this
patch the situation was as below:

 @Redfish.Settings found: /redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes: 6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:

And after this patch the debug output is:

 @Redfish.Settings found: /redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes: 6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:Settings

The section with Index=5 is found and returned correctly.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 5 +
 1 file changed, 5 insertions(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 3231ef883379..b0a3b20a40bd 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1327,6 +1327,11 @@ GetRedpathNodeByIndex (
 StringIndex++;
   }
 
+  if (NumberNodes == Index) {
+*EndOfNodePtr = NodeString + StringIndex - 1;
+return NodeStart;
+  }
+
   return (NULL);
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117067): https://edk2.groups.io/g/devel/message/117067
Mute This Topic: https://groups.io/mt/105101992/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 0/3] RedfishClientPkg: fix GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
This set contains fixes for proper nodes handling in GetRedpathNodeByIndex().
It fixes handling of nodes with Index different from 0,
it removes leading '/' returned for section with Index = 0,
also it fixes return of the last section.

This set does not have any impact to 
existing code,
because in all places this function is used to obtain the end of the first 
section.
And actually returned pointer to the requested section is not used.
The current usages is:
   GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, &EndOfChar);

and return of EndOfChar value is not affected by this set.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117065): https://edk2.groups.io/g/devel/message/117065
Mute This Topic: https://groups.io/mt/105101990/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][RFC PATCH 1/3] RedfishClientPkg: fix nodes count in GetRedpathNodeByIndex()

2024-03-23 Thread Mike Maslenkin
This patch fixes work of GetRedpathNodeByIndex() function with non zero
Index argument. NumberNodes value was not changed after the new node
found. This means that before this patch modified function worked only
in case of Index = 0.

Debug output for the initial case:

 @Redfish.Settings found:/redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes:6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:
 GetRedpathNodeByIndex[2]:
 GetRedpathNodeByIndex[3]:
 GetRedpathNodeByIndex[4]:
 GetRedpathNodeByIndex[5]:

After this patch the output is as following:

 @Redfish.Settings found:/redfish/v1/Systems/system/Bios/Settings
 GetNumberOfRedpathNodes:6
 GetRedpathNodeByIndex[0]:/redfish/v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[1]:v1/Systems/system/Bios/Settings
 GetRedpathNodeByIndex[2]:Systems/system/Bios/Settings
 GetRedpathNodeByIndex[3]:system/Bios/Settings
 GetRedpathNodeByIndex[4]:Bios/Settings
 GetRedpathNodeByIndex[5]:

Note: it is supposed that caller will set terminating '\0' explicitly
at the next position pointed by returned EndOfNodePtr value.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index cc2b37b79605..3231ef883379 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1320,6 +1320,7 @@ GetRedpathNodeByIndex (
 return NodeStart;
   } else {
 NodeStart = NodeString + StringIndex + 1;
+NumberNodes++;
   }
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117066): https://edk2.groups.io/g/devel/message/117066
Mute This Topic: https://groups.io/mt/105101991/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH V3 1/2] RedfishClientPkg: Set SettingsObject URI as the config language

2024-03-22 Thread Mike Maslenkin
 Hi Abner,

Sorry if I wasn't clear.
I meant in this function including the success path.
RedfishSetRedfishUri->..->NewConfigLangMapRecord() creates a copy of
this string, so it should be freed in this function.

Regards,
Mike.


On Fri, Mar 22, 2024 at 12:58 PM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> Hi Mike,
> Thanks for catching this, V4 sent.
>
> Abner
>
> > -Original Message-
> > From: M M 
> > Sent: Friday, March 22, 2024 5:20 PM
> > To: devel@edk2.groups.io; Chang, Abner 
> > Cc: Igor Kulchytskyy ; Nickle Wang 
> > Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V3 1/2]
> > RedfishClientPkg: Set SettingsObject URI as the config language
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Hi Abner,
> >
> > > On 22. 3. 2024., at 12:09, Chang, Abner via groups.io
> >  wrote:
> > >
> > > From: Abner Chang 
> > >
> > > Set SettingsObject URI in @Redfish.Settings resource as the config
> > > language which is the same as the config language of parent URI
> > > that mandates @Redfish.Settings.
> > > With this, we can find the config language of the properties in
> > > SettingsObject URI.
> > >
> > > Signed-off-by: Abner Chang 
> > > Cc: Igor Kulchytskyy 
> > > Co-authored-by: Nickle Wang 
> > > ---
> > > .../Library/RedfishFeatureUtilityLib.h| 17 
> > > .../RedfishFeatureUtilityLib.c| 86 ---
> > > .../RedfishConfigLangMapDxe.c | 15 +++-
> > > 3 files changed, 101 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > index ba9ea01501..3c5f248eb7 100644
> > > --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > @@ -369,6 +369,23 @@ RedfishSetRedfishUri (
> > >   INEFI_STRING  Uri
> > >   );
> > >
> > > +/**
> > > +
> > > +  Save Redfish SettingsObject URI in database for further use.
> > > +
> > > +  @param[in]ParentUri Parent URI of @Redfish.Settings 
> > > property.
> > > +  @param[in]SettingObjectUri  Redfish SettingsObject Uri to save.
> > > +
> > > +  @retval  EFI_INVALID_PARAMETER  SystemId is NULL or EMPTY
> > > +  @retval  EFI_SUCCESSRedfish uri is saved
> > > +
> > > +**/
> > > +EFI_STATUS
> > > +SetRedfishSettingsObjectsUri (
> > > +  IN EFI_STRING  ParentUri,
> > > +  IN EFI_STRING  SettingObjectUri
> > > +  );
> > > +
> > > /**
> > >
> > >   Get the property name by given Configure Language.
> > > diff --git
> > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> > c
> > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> > c
> > > index cc2b37b796..c37bf85310 100644
> > > ---
> > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> > c
> > > +++
> > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> > c
> > > @@ -2082,7 +2082,6 @@ GetConfigureLang (
> > >   EFI_STRING  ResultStr;
> > >   EFI_STRING  UnicodeUri;
> > >   EFI_STATUS  Status;
> > > -  EFI_STRING  StrFound;
> > >
> > >   if (IS_EMPTY_STRING (Uri)) {
> > > return NULL;
> > > @@ -2101,18 +2100,6 @@ GetConfigureLang (
> > >   }
> > >
> > >   ConfigLang = RedfishGetConfigLanguage (UnicodeUri);
> > > -  if (ConfigLang == NULL) {
> > > -//
> > > -// @Redfish.Settings share the same schema as its parent.
> > > -// Remove "Settings" and try again.
> > > -//
> > > -StrFound = StrStr (UnicodeUri, L"/Settings");
> > > -if (StrFound != NULL) {
> > > -  StrFound[0] = L'\0';
> > > -  DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI, try:
> > %s\n", __func__, UnicodeUri));
> > > -  ConfigLang = RedfishGetConfigLanguage (UnicodeUri);
> > > -}
> > > -  }
> > >
> > >   FreePool (UnicodeUri);
> > >
> > > @@ -2172,6 +2159,61 @@ RedfishSetRedfishUri (
> > >   return mConfigLangMapProtocol->Set (mConfigLangMapProtocol,
> > ConfigLang, Uri);
> > > }
> > >
> > > +/**
> > > +
> > > +  Save Redfish SettingsObject URI in database for further use.
> > > +
> > > +  @param[in]ParentUri Parent URI of @Redfish.Settings 
> > > property.
> > > +  @param[in]SettingObjectUri  Redfish SettingsObject Uri to save.
> > > +
> > > +  @retval  EFI_INVALID_PARAMETER  ParentUri or SettingObjectUri is NULL.
> > > +  @retval  EFI_NOT_FOUND  Config language for ParentUri is not 
> > > found.
> > > +  @retval  EFI_SUCCESSRedfish URI is saved with corresponding
> > > +  config language.
> > > +
> > > +**/
> > > +EFI_STATUS
> > > +SetRedfishSettingsObjectsUri (
> > > +  IN EFI_STRING  ParentUri,
> > > +  IN EFI_STRING  SettingObjectUri
> > > +  )
> > > +{
> > > +  EFI_STATUS  Status;
> > > +  EFI_STRIN

Re: [edk2-devel] [edk2-redfish-client][PATCH V3 1/2] RedfishClientPkg: Set SettingsObject URI as the config language

2024-03-22 Thread Mike Maslenkin
Hi Abner,

> On 22. 3. 2024., at 12:09, Chang, Abner via groups.io 
>  wrote:
> 
> From: Abner Chang 
> 
> Set SettingsObject URI in @Redfish.Settings resource as the config
> language which is the same as the config language of parent URI
> that mandates @Redfish.Settings.
> With this, we can find the config language of the properties in
> SettingsObject URI.
> 
> Signed-off-by: Abner Chang 
> Cc: Igor Kulchytskyy 
> Co-authored-by: Nickle Wang 
> ---
> .../Library/RedfishFeatureUtilityLib.h| 17 
> .../RedfishFeatureUtilityLib.c| 86 ---
> .../RedfishConfigLangMapDxe.c | 15 +++-
> 3 files changed, 101 insertions(+), 17 deletions(-)
> 
> diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h 
> b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> index ba9ea01501..3c5f248eb7 100644
> --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> @@ -369,6 +369,23 @@ RedfishSetRedfishUri (
>   INEFI_STRING  Uri
>   );
> 
> +/**
> +
> +  Save Redfish SettingsObject URI in database for further use.
> +
> +  @param[in]ParentUri Parent URI of @Redfish.Settings property.
> +  @param[in]SettingObjectUri  Redfish SettingsObject Uri to save.
> +
> +  @retval  EFI_INVALID_PARAMETER  SystemId is NULL or EMPTY
> +  @retval  EFI_SUCCESSRedfish uri is saved
> +
> +**/
> +EFI_STATUS
> +SetRedfishSettingsObjectsUri (
> +  IN EFI_STRING  ParentUri,
> +  IN EFI_STRING  SettingObjectUri
> +  );
> +
> /**
> 
>   Get the property name by given Configure Language.
> diff --git 
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
>  
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> index cc2b37b796..c37bf85310 100644
> --- 
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> +++ 
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
> @@ -2082,7 +2082,6 @@ GetConfigureLang (
>   EFI_STRING  ResultStr;
>   EFI_STRING  UnicodeUri;
>   EFI_STATUS  Status;
> -  EFI_STRING  StrFound;
> 
>   if (IS_EMPTY_STRING (Uri)) {
> return NULL;
> @@ -2101,18 +2100,6 @@ GetConfigureLang (
>   }
> 
>   ConfigLang = RedfishGetConfigLanguage (UnicodeUri);
> -  if (ConfigLang == NULL) {
> -//
> -// @Redfish.Settings share the same schema as its parent.
> -// Remove "Settings" and try again.
> -//
> -StrFound = StrStr (UnicodeUri, L"/Settings");
> -if (StrFound != NULL) {
> -  StrFound[0] = L'\0';
> -  DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"Settings\" found in URI, try: 
> %s\n", __func__, UnicodeUri));
> -  ConfigLang = RedfishGetConfigLanguage (UnicodeUri);
> -}
> -  }
> 
>   FreePool (UnicodeUri);
> 
> @@ -2172,6 +2159,61 @@ RedfishSetRedfishUri (
>   return mConfigLangMapProtocol->Set (mConfigLangMapProtocol, ConfigLang, 
> Uri);
> }
> 
> +/**
> +
> +  Save Redfish SettingsObject URI in database for further use.
> +
> +  @param[in]ParentUri Parent URI of @Redfish.Settings property.
> +  @param[in]SettingObjectUri  Redfish SettingsObject Uri to save.
> +
> +  @retval  EFI_INVALID_PARAMETER  ParentUri or SettingObjectUri is NULL.
> +  @retval  EFI_NOT_FOUND  Config language for ParentUri is not found.
> +  @retval  EFI_SUCCESSRedfish URI is saved with corresponding
> +  config language.
> +
> +**/
> +EFI_STATUS
> +SetRedfishSettingsObjectsUri (
> +  IN EFI_STRING  ParentUri,
> +  IN EFI_STRING  SettingObjectUri
> +  )
> +{
> +  EFI_STATUS  Status;
> +  EFI_STRING  ConfigLang;
> +
> +  if ((ParentUri == NULL) || (SettingObjectUri == NULL)) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
> +  //
> +  // Check if the SettingsObject URI already in the database.
> +  //
> +  ConfigLang = RedfishGetConfigLanguage (SettingObjectUri);
> +  if (ConfigLang == NULL) {
> +//
> +// No config language of SettingsObject URI is found.
> +// Get the config language of parent URI because the data model of
> +// SettingsObject URI resource is the same as the data model of parent 
> URI.
> +//
> +ConfigLang = RedfishGetConfigLanguage (ParentUri);
> +if (ConfigLang == NULL) {
> +  DEBUG ((DEBUG_ERROR, "%a: Failed to get the config language of parent 
> URI that mandates SettingsObject - %s.\n", __func__, ParentUri));
> +  return EFI_NOT_FOUND;
> +}
> +
> +// Set the config language of settings URI using parent's URI config 
> language.
> +Status = RedfishSetRedfishUri (ConfigLang, SettingObjectUri);
> +if (EFI_ERROR (Status)) {
> +  DEBUG ((DEBUG_ERROR, "%a: Fails to set the config language of 
> SettingsObject - %s.\n", __func__, SettingObjectUri));

looks like there is ConfigLang leak in this function.

> +  return Status;
> +}
> +
> +DEBUG ((DEBUG_INFO, "%a: Set the config language 

Re: [edk2-devel] [PATCH 0/4][edk2-redfish-client] RedfishClientPkg: fix deallocation of C-structures

2024-03-13 Thread Mike Maslenkin
On Sun, Mar 10, 2024 at 1:41 PM Mike Maslenkin  wrote:
>
> This set contains fixes for proper deallocation of the structures
> returned by JsonStructProtocol->ToStructure().
>
> PR: https://github.com/tianocore/edk2-redfish-client/pull/82
>
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nickle Wang 
> Signed-off-by: Mike Maslenkin 

I have updated patches with R-b and pushed it to PR.

Thank you for review!

Regards,
Mike


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116721): https://edk2.groups.io/g/devel/message/116721
Mute This Topic: https://groups.io/mt/104841891/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/4][edk2-redfish-client] RedfishClientPkg: fix leak in provisioning properties functions

2024-03-10 Thread Mike Maslenkin
The structure instance retunred by ToStructure() must be deallocated
properly.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../v1_13_0/Common/ComputerSystemCommon.c | 25 +--
 .../v1_5_0/Common/ComputerSystemCommon.c  | 25 +--
 2 files changed, 36 insertions(+), 14 deletions(-)

diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
index df22a1c90c46..4795e4d6c6eb 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
@@ -263,7 +263,7 @@ ProvisioningComputerSystemProperties (
   );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a: ToStructure failure: %r\n", __func__, Status));
-return Status;
+goto ON_RELEASE;
   }
 
   ComputerSystemCs = ComputerSystem->ComputerSystem;
@@ -365,7 +365,7 @@ ProvisioningComputerSystemProperties (
  );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status));
-return Status;
+goto ON_RELEASE;
   }
 
   if (PropertyChanged) {
@@ -374,10 +374,14 @@ ProvisioningComputerSystemProperties (
 if (EFI_ERROR (Status)) {
   DEBUG ((DEBUG_ERROR, "%a: Fail to remove Redfish unchangeable properties 
from ResultJson.\n", __func__));
   *ResultJson = NULL;
-  return Status;
+  goto ON_RELEASE;
 }
   }
 
+  Status = EFI_SUCCESS;
+
+ON_RELEASE:
+
   //
   // Release resource.
   //
@@ -393,10 +397,17 @@ ProvisioningComputerSystemProperties (
 DestoryRedfishCharArray (ComputerSystemCsEmpty->Boot->BootOrder, 
ArraySize);
   }
 
-  JsonStructProtocol->DestoryStructure (
-JsonStructProtocol,
-(EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystemEmpty
-);
+  if (ComputerSystemEmpty != NULL) {
+JsonStructProtocol->DestoryStructure (
+  JsonStructProtocol,
+  (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystemEmpty
+  );
+  }
+
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
index c383cad59029..2d257e01da2b 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -793,7 +793,7 @@ ProvisioningComputerSystemProperties (
   );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a: ToStructure failure: %r\n", __func__, Status));
-return Status;
+goto ON_RELEASE;
   }
 
   ComputerSystemCs = ComputerSystem->ComputerSystem;
@@ -1235,7 +1235,7 @@ ProvisioningComputerSystemProperties (
  );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status));
-return Status;
+goto ON_RELEASE;
   }
 
   if (PropertyChanged) {
@@ -1244,10 +1244,14 @@ ProvisioningComputerSystemProperties (
 if (EFI_ERROR (Status)) {
   DEBUG ((DEBUG_ERROR, "%a: Fail to remove Redfish unchangeable properties 
from ResultJson.\n", __func__));
   *ResultJson = NULL;
-  return Status;
+  goto ON_RELEASE;
 }
   }
 
+  Status = EFI_SUCCESS;
+
+ON_RELEASE:
+
   //
   // Release resource.
   //
@@ -1263,10 +1267,17 @@ ProvisioningComputerSystemProperties (
 DestoryRedfishCharArray (ComputerSystemCsEmpty->Boot->BootOrder, 
ArraySize);
   }
 
-  JsonStructProtocol->DestoryStructure (
-JsonStructProtocol,
-(EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystemEmpty
-);
+  if (ComputerSystemEmpty != NULL) {
+JsonStructProtocol->DestoryStructure (
+  JsonStructProtocol,
+  (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystemEmpty
+  );
+  }
+
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116567): https://edk2.groups.io/g/devel/message/116567
Mute This Topic: https://groups.io/mt/104841894/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 4/4][edk2-redfish-client] RedfishClientPkg: fix memory leak

2024-03-10 Thread Mike Maslenkin
The structure instance retunred by ToStructure() must be deallocated
properly.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../v1_5_0/RedfishResourceIdentifyLibComputerSystem.c| 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/RedfishResourceIdentifyLibComputerSystem.c
 
b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/RedfishResourceIdentifyLibComputerSystem.c
index 29b4f525d5ff..2f177b8032cc 100644
--- 
a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/RedfishResourceIdentifyLibComputerSystem.c
+++ 
b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_0/RedfishResourceIdentifyLibComputerSystem.c
@@ -70,19 +70,20 @@ RedfishIdentifyResource (
   ComputerSystemCs = ComputerSystem->ComputerSystem;
 
   if (IS_EMPTY_STRING (ComputerSystemCs->UUID)) {
-return FALSE;
+Status = EFI_NOT_FOUND;
+goto ON_RELEASE;
   }
 
   Status = AsciiStrToGuid (ComputerSystemCs->UUID, &ResourceUuid);
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a, fail to get resource UUID: %r\n", __func__, 
Status));
-return FALSE;
+goto ON_RELEASE;
   }
 
   Status = NetLibGetSystemGuid (&SystemUuid);
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a, fail to get system UUID from SMBIOS: %r\n", 
__func__, Status));
-return FALSE;
+goto ON_RELEASE;
   }
 
   DEBUG ((REDFISH_DEBUG_TRACE, "%a, Identify: System: %g Resource: %g\n", 
__func__, &SystemUuid, &ResourceUuid));
@@ -92,6 +93,8 @@ RedfishIdentifyResource (
 Status = EFI_UNSUPPORTED;
   }
 
+ON_RELEASE:
+
   mJsonStructProtocol->DestoryStructure (
  mJsonStructProtocol,
  (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116568): https://edk2.groups.io/g/devel/message/116568
Mute This Topic: https://groups.io/mt/104841896/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/4][edk2-redfish-client] RedfishClientPkg: fix leak in provisioning properties functions

2024-03-10 Thread Mike Maslenkin
The structure instance retunred by ToStructure() must be deallocated
properly.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c| 5 -
 .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c | 5 -
 .../Features/Memory/V1_7_1/Common/MemoryCommon.c | 5 -
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index 1eb269a84222..f40fe215afeb 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -247,7 +247,6 @@ ProvisioningBiosProperties (
  );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status));
-return Status;
   }
 
   //
@@ -258,6 +257,10 @@ ProvisioningBiosProperties (
 (EFI_REST_JSON_STRUCTURE_HEADER *)Bios
 );
 
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
diff --git 
a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c 
b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
index 339c8ba04103..358b32253973 100644
--- a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
+++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
@@ -334,7 +334,6 @@ ON_RELEASE:
  );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status));
-return Status;
   }
 
   //
@@ -345,6 +344,10 @@ ON_RELEASE:
 (EFI_REST_JSON_STRUCTURE_HEADER *)BootOption
 );
 
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c 
b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
index e873f05ca040..39ec7ec0c34b 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
@@ -2133,7 +2133,6 @@ ProvisioningMemoryProperties (
  );
   if (EFI_ERROR (Status)) {
 DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status));
-return Status;
   }
 
   //
@@ -2144,6 +2143,10 @@ ProvisioningMemoryProperties (
 (EFI_REST_JSON_STRUCTURE_HEADER *)Memory
 );
 
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116566): https://edk2.groups.io/g/devel/message/116566
Mute This Topic: https://groups.io/mt/104841893/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 0/4][edk2-redfish-client] RedfishClientPkg: fix deallocation of C-structures

2024-03-10 Thread Mike Maslenkin
This set contains fixes for proper deallocation of the structures
returned by JsonStructProtocol->ToStructure().

PR: https://github.com/tianocore/edk2-redfish-client/pull/82

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116564): https://edk2.groups.io/g/devel/message/116564
Mute This Topic: https://groups.io/mt/104841891/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/4][edk2-redfish-client] RedfishClientPkg: fix memory leak

2024-03-10 Thread Mike Maslenkin
This patch fixes leak of EFI_REDFISH_COMPUTERSYSTEMCOLLECTION instance
on error path.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../ComputerSystemCollectionDxe.c| 12 +---
 .../MemoryCollectionDxe/MemoryCollectionDxe.c| 11 ---
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
index 55a6d07dbf2e..3deefa824629 100644
--- 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
+++ 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
@@ -174,11 +174,13 @@ HandleCollectionResource (
   CollectionCs = Collection->ComputerSystemCollection;
 
   if (*CollectionCs->Membersodata_count == 0) {
-return EFI_NOT_FOUND;
+Status = EFI_NOT_FOUND;
+goto ON_RELEASE;
   }
 
   if (IsLinkEmpty (&CollectionCs->Members)) {
-return EFI_NOT_FOUND;
+Status = EFI_NOT_FOUND;
+goto ON_RELEASE;
   }
 
   List = GetFirstLink (&CollectionCs->Members);
@@ -206,12 +208,16 @@ HandleCollectionResource (
 List = GetNextLink (&CollectionCs->Members, List);
   }
 
+  Status = EFI_SUCCESS;
+
+ON_RELEASE:
+
   //
   // Release resource.
   //
   Private->JsonStructProtocol->DestoryStructure (Private->JsonStructProtocol, 
(EFI_REST_JSON_STRUCTURE_HEADER *)Collection);
 
-  return EFI_SUCCESS;
+  return Status;
 }
 
 EFI_STATUS
diff --git 
a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c 
b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
index d963fb52ad37..38f28f902715 100644
--- a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
+++ b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
@@ -165,11 +165,13 @@ HandleCollectionResource (
   CollectionCs = Collection->MemoryCollection;
 
   if (*CollectionCs->Membersodata_count == 0) {
-return EFI_NOT_FOUND;
+Status = EFI_NOT_FOUND;
+goto ON_RELEASE;
   }
 
   if (IsLinkEmpty (&CollectionCs->Members)) {
-return EFI_NOT_FOUND;
+Status = EFI_NOT_FOUND;
+goto ON_RELEASE;
   }
 
   List = GetFirstLink (&CollectionCs->Members);
@@ -197,12 +199,15 @@ HandleCollectionResource (
 List = GetNextLink (&CollectionCs->Members, List);
   }
 
+  Status = EFI_SUCCESS;
+
+ON_RELEASE:
   //
   // Release resource.
   //
   Private->JsonStructProtocol->DestoryStructure (Private->JsonStructProtocol, 
(EFI_REST_JSON_STRUCTURE_HEADER *)Collection);
 
-  return EFI_SUCCESS;
+  return Status;
 }
 
 EFI_STATUS
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116565): https://edk2.groups.io/g/devel/message/116565
Mute This Topic: https://groups.io/mt/104841892/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 00/13] use Redfish HTTP protocol

2024-02-29 Thread Mike Maslenkin
Good work, Nickle!

On Thu, Feb 29, 2024 at 11:53 AM Nickle Wang via groups.io
 wrote:
>
> Redfish HTTP protocol is introduced to edk2 RedfishPkg. Update
> RedfishClientPkg to use RedfishHttpLib. And remove the use of
> RedfishHttpCacheLib.
>
> I also replace several functions from RedfishLib with the function
> provided in RedfishHttpLib. In this way, there is no dependency on
> RedfishLib in RedfishClientPkg.

May I know why didn't you remove
RedfishClientPkg/PrivateLibrary/RedfishLib completely?
I've been looking at this library for a long time and started
improving it with this set.
Eventually I realized that the improved functions are not used in
RedfishClientPkg.
Then I just deleted RedfishClientPkg/PrivateLibrary and
RedfishClientPkg/PrivateInclude/Library/RedfishLib.h,
tuned the dec and dsc files, and I successfully built the package.
Removing this library is a big improvement since it duplicates
RedfishLib from RedfishPkg.
and their headers no longer conflict.

Regards,
Mike.


>
> I noticed that there is false alarm in uncrustify check. When there
> are deleted files, uncrustiry cannot check them and trigger uncrustify
> failure.
>
> Pull request is created here for testing CI:
> https://github.com/tianocore/edk2-redfish-client/pull/79
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
>
> Nickle Wang (13):
>   RedfishClientPkg/.github: do not run uncrustify to deleted file.
>   RedfishClientPkg: remove RedfishHttpCacheLib
>   RedfishClientPkg: ues RedfishHttpLib
>   RedfishClientPkg/RedfishResourceConfigLib: ues RedfishHttpLib
>   RedfishClientPkg/RedfishFeatureUtilityLib: ues RedfishHttpLib
>   RedfishClientPkg/RedfishVersionLib: ues RedfishHttpLib
>   RedfishClientPkg/BiosDxe: ues RedfishHttpLib
>   RedfishClientPkg/BootOptionDxe: ues RedfishHttpLib
>   RedfishClientPkg/BootOptionCollectionDxe: ues RedfishHttpLib
>   RedfishClientPkg/ComputerSystemDxe: ues RedfishHttpLib
>   RedfishClientPkg/ComputerSystemCollectionDxe: ues RedfishHttpLib
>   RedfishClientPkg/MemoryDxe: ues RedfishHttpLib
>   RedfishClientPkg/MemoryCollectionDxe: ues RedfishHttpLib
>
>  RedfishClientPkg/RedfishClientPkg.dec |   1 -
>  RedfishClientPkg/RedfishClientLibs.dsc.inc|   2 +-
>  RedfishClientPkg/RedfishClientPkg.dsc |   1 -
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.inf  |   3 +-
>  .../BootOption/v1_0_4/Dxe/BootOptionDxe.inf   |   5 +-
>  .../BootOptionCollectionDxe.inf   |   5 +-
>  .../v1_13_0/Dxe/ComputerSystemDxe.inf |   3 +-
>  .../v1_5_0/Dxe/ComputerSystemDxe.inf  |   3 +-
>  .../ComputerSystemCollectionDxe.inf   |   3 +-
>  .../Features/Memory/V1_7_1/Dxe/MemoryDxe.inf  |   3 +-
>  .../MemoryCollectionDxe.inf   |   3 +-
>  .../EdkIIRedfishResourceConfigLib.inf |   2 +-
>  .../RedfishFeatureUtilityLib.inf  |   3 +-
>  .../RedfishHttpCacheLib.inf   |  48 --
>  .../RedfishVersionLib/RedfishVersionLib.inf   |   3 +-
>  .../Library/EdkIIRedfishResourceConfigLib.h   |   4 +-
>  .../Library/RedfishFeatureUtilityLib.h|  46 +-
>  .../Include/Library/RedfishHttpCacheLib.h |  59 --
>  .../Include/RedfishCollectionCommon.h |   3 +-
>  .../Include/RedfishResourceCommon.h   |   3 +-
>  .../RedfishFeatureUtilityInternal.h   |   3 +-
>  .../RedfishHttpCacheLibInternal.h |  63 --
>  .../Features/Bios/v1_0_9/Common/BiosCommon.c  |  92 +--
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.c| 113 +--
>  .../v1_0_4/Common/BootOptionCommon.c  |  45 +-
>  .../BootOption/v1_0_4/Dxe/BootOptionDxe.c |  86 +-
>  .../BootOptionCollectionDxe.c |  26 +-
>  .../v1_13_0/Common/ComputerSystemCommon.c |  68 +-
>  .../v1_13_0/Dxe/ComputerSystemDxe.c   |  85 +-
>  .../v1_5_0/Common/ComputerSystemCommon.c  |  68 +-
>  .../v1_5_0/Dxe/ComputerSystemDxe.c|  84 +-
>  .../ComputerSystemCollectionDxe.c |  15 +-
>  .../Memory/V1_7_1/Common/MemoryCommon.c   |  86 +-
>  .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c| 111 +--
>  .../MemoryCollectionDxe/MemoryCollectionDxe.c |  15 +-
>  .../EdkIIRedfishResourceConfigLib.c   |   6 +-
>  .../RedfishFeatureUtilityLib.c| 182 +---
>  .../RedfishHttpCacheLib/RedfishHttpCacheLib.c | 774 --
>  .../RedfishVersionLib/RedfishVersionLib.c |  24 +-
>  .github/workflows/uncrustify-check.sh |  17 +-
>  40 files changed, 328 insertions(+), 1838 deletions(-)
>  delete mode 100644 
> RedfishClientPkg/Library/RedfishHttpCacheLib/RedfishHttpCacheLib.inf
>  delete mode 100644 RedfishClientPkg/Include/Library/RedfishHttpCacheLib.h
>  delete mode 100644 
> RedfishClientPkg/Library/RedfishHttpCacheLib/RedfishHttpCacheLibInternal.h
>  delete mode 100644 
> RedfishClientPkg/Library/RedfishHttpCacheLib/RedfishHttpCacheLib.c
>
> --
> 2.34.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group

Re: [edk2-devel] [edk2-redfish-client][PATCH] edk2-Redfish-client: Clarify HTTP method used for provisioning

2024-02-28 Thread Mike Maslenkin
Reviewed-by: Mike Maslenkin 

Regards,
Mike.

On Mon, Feb 26, 2024 at 7:55 AM  wrote:
>
> From: Abner Chang 
>
> Clarify the HTTP method that is used to provision BIOS
> managed Redfish resource.
>
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Mike Maslenkin 
> ---
>  RedfishClientPkg/Readme.md| 35 ---
>  .../Media/redfish-call-flow-provisioning.svg  |  2 +-
>  .../Media/redfish-synchronization-design.svg  |  4 +--
>  3 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/RedfishClientPkg/Readme.md b/RedfishClientPkg/Readme.md
> index 82cb9c8c99..1789dff6f8 100644
> --- a/RedfishClientPkg/Readme.md
> +++ b/RedfishClientPkg/Readme.md
> @@ -310,21 +310,32 @@ job.
>
>  Several interfaces defined in EDKII Redfish Resource Config Protocol work 
> together to support Redfish synchronization:
>  - Identify()
> -  - This function is used to check if the given Redfish resource is the one 
> the feature driver wants to manage. A platform
> -library `RedfishResourceIdentifyLib` is introduced for platform to 
> implement its own policy to identify Redfish resource.
> +  - This function is used to check if the given Redfish resource is the one 
> the feature driver
> +wants to manage. A platform library `RedfishResourceIdentifyLib` is 
> introduced for
> +platform to implement its own policy to identify Redfish resource.
>  - Check()
> -  - This function is used to check the attribute status on Redfish service. 
> If all attributes the feature driver manages
> -are presented in Redfish service, feature driver must provision them 
> already. Otherwise, Provisioning() will be called
> -to perform resource provisioning job.
> +  - This function is used to check the attribute status on Redfish service. 
> If all attributes
> +the feature driver manages are presented in Redfish service, feature 
> driver must provision
> +them already. Otherwise, Provisioning() will be called to perform 
> resource provisioning
> +job.
>  - Provisioning()
> -  - When this function is called, feature driver will provision all 
> attributes that it managed to Redfish service. This
> -operation usually create new resource at Redfish service and require 
> different operation that specified by Redfish service.
> +  - When this function is called, feature driver will provision all 
> attributes that it managed
> +to Redfish service. This operation usually creates the new Redfish 
> properties at the
> +existing URI in Redfish service. Use HTTP PATCH to provision Redfish 
> properties as BIOS
> +may only manage some but not all of the properties of the resource. See 
> [Redfish-edk2 
> implementation](#Redfish-Service-Implementation-that-Incorporates-with-EDK2-Redfish)
>  for
> +the details. HTTP POST is still used for creating a collection member, 
> such as the
> +collection member of processor or memory for the Redfish inventory 
> management.
> +However, HTTP PUT to overwrite an entire Redfish resource is not used in 
> edk2 Redfish
> +implementation as edk2 Redfish implementation has no idea of whether the 
> Redfish resource
> +is entirely managed by BIOS or not.
>  - Consume()
> -  - When there is pending settings in Redfish service, this function is 
> called for feature driver to consume pending settings
> -requested by user.
> +  - When there is pending settings in Redfish service, this function is 
> called for feature
> +driver to consume pending settings requested by user. HTTP GET is the 
> method used
> +to retrieve Redfish properties.
>  - Update()
> -  - When platform configuration is updated, this function is called to 
> update configuration changes to Redfish service and
> -Redfish service can show the latest settings on platform.
> +  - When platform configuration is updated, this function is called to 
> update configuration
> +changes to Redfish service and Redfish service can show the latest 
> settings on platform.
> +HTTP PATCH is the method used to update the properties of Redfish 
> resource.
>
>  The EDKII Redfish Resource Addendum Protocol is introduced to provide 
> platform addendum data that Redfish service requires.
>  This protocol will be called at Provisioning() and Update() functions so 
> platform can add OEM attribute or any other attribute
> @@ -338,7 +349,7 @@ struct _EDKII_REDFISH_RESOURCE_ADDENDUM_PROTOCOL {
>  };
>  ```
>
> -### Redfish Service Implementation that Incorporates with EDK2 Redfish
> +###  name="Redfish-Service-Implementation-that-Incorporates-with-EDK2-Redfish">Redfish
>  Service Implementation that

Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP protocol

2024-02-28 Thread Mike Maslenkin
On Wed, Feb 28, 2024 at 2:47 PM Nickle Wang  wrote:
>
> Hi @Mike Maslenkin,
>
>
>
> May I have your reviewed-by if version 3 patch set look good to you?
>

Sure!

Reviewed-by: Mike Maslenkin 

BTW I'm just curious, there is a mention in patch 2 "We currently only
support gzip Content-Encoding."
But I didn't see any implementation of gzip coding/encoding for edk2.
Do you know of any?

I hope you know that patch 5 breaks edk2-redfish-client compilation
(Instance of library class [RedfishHttpLib] is not found)
But I understand these changes are not atomic for edk2 and edk2-redfish-client.

Regards,
Mike.


>
>
> Thanks,
>
> Nickle
>
>
>
> > -Original Message-
>
> > From: devel@edk2.groups.io  On Behalf Of Nickle Wang
>
> > via groups.io
>
> > Sent: Tuesday, February 27, 2024 8:49 AM
>
> > To: Mike Maslenkin 
>
> > Cc: devel@edk2.groups.io; Igor Kulchytskyy ; Abner Chang
>
> > ; Nick Ramirez 
>
> > Subject: Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP
>
> > protocol
>
> >
>
> > External email: Use caution opening links or attachments
>
> >
>
> >
>
> > Thanks for your confirmation, Mike!
>
> >
>
> > Version 3 patch set is here: https://edk2.groups.io/g/devel/message/115985
>
> >
>
> > Regards,
>
> > Nickle
>
> >
>
> > > -Original Message-
>
> > > From: Mike Maslenkin 
>
> > > Sent: Tuesday, February 27, 2024 8:13 AM
>
> > > To: Nickle Wang 
>
> > > Cc: devel@edk2.groups.io; Igor Kulchytskyy ; Abner
>
> > > Chang ; Nick Ramirez 
>
> > > Subject: Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish
>
> > > HTTP protocol
>
> > >
>
> > > External email: Use caution opening links or attachments
>
> > >
>
> > >
>
> > > Hii Nickle,
>
> > >
>
> > >
>
> > > On Mon, Feb 26, 2024 at 4:44 PM Nickle Wang  wrote:
>
> > > >
>
> > > > Hi Mike,
>
> > > >
>
> > > > > So finally we have
>
> > > > > HttpFreeHeaderFields (Response->Headers, Response->HeaderCount);
>
> > > > > but
>
> > > > > Response->HeaderCount does not count partially allocated elements. 
> > > > > Right?
>
> > > > >
>
> > > > > To fix this, it is required to set *DstHeaderCount =
>
> > > > > SrcHeaderCount unconditionally right after DstHeaders  allocation,
>
> > > > > and HttpFreeHeaderFields() will do the work then.
>
> > > >
>
> > > > I follow your suggestion to update DstHeaderCount right after
>
> > > > DstHeaders is
>
> > > allocated.  So, HttpFreeHeaderFields can release headers correctly. I
>
> > > also create a macro to implemented AsciiStrCpy. Please check below link 
> > > to see
>
> > my changes:
>
> > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
>
> > > > th
>
> > > >
>
> > >
>
> > ub.com%2Ftianocore%2Fedk2%2Fcompare%2F0f391b1c2f988d90a3ac723b314a
>
> > > c28b
>
> > > >
>
> > >
>
> > a7b0b8df..f0fa1b8fdcd933beb52fd3127c2476443c00ef8d&data=05%7C02%7Cnic
>
> > > k
>
> > > >
>
> > >
>
> > lew%40nvidia.com%7Cf3870f71360e44f3b4e208dc3728ff87%7C43083d1572734
>
> > > 0c1
>
> > > >
>
> > >
>
> > b7db39efd9ccc17a%7C0%7C0%7C638445896465360452%7CUnknown%7CTWFp
>
> > > bGZsb3d8
>
> > > >
>
> > >
>
> > eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%
>
> > > 7C0
>
> > > >
>
> > >
>
> > %7C%7C%7C&sdata=K%2FEA2QWpk%2F8NHQ1QhzqkvQqao4db%2BILn1Jt%2BB
>
> > > qQ5n1E%3D
>
> > > > &reserved=0
>
> > >
>
> > > These changes looks good. Internal strings
>
> > > initialization/deinitialization code much cleaner now and possible leak 
> > > seems to
>
> > have been fixed.
>
> > >
>
> > > Thank you!
>
> > >
>
> > > Regards,
>
> > > Mike.
>
> >
>
> >
>
> > 
>
> >
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116126): https://edk2.groups.io/g/devel/message/116126
Mute This Topic: https://groups.io/mt/104505404/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP protocol

2024-02-26 Thread Mike Maslenkin
Hii Nickle,


On Mon, Feb 26, 2024 at 4:44 PM Nickle Wang  wrote:
>
> Hi Mike,
>
> > So finally we have
> > HttpFreeHeaderFields (Response->Headers, Response->HeaderCount);
> > but Response->HeaderCount does not count partially allocated elements. 
> > Right?
> >
> > To fix this, it is required to set
> > *DstHeaderCount = SrcHeaderCount unconditionally right after
> > DstHeaders  allocation, and HttpFreeHeaderFields() will do the work
> > then.
>
> I follow your suggestion to update DstHeaderCount right after DstHeaders is 
> allocated.  So, HttpFreeHeaderFields can release headers correctly. I also 
> create a macro to implemented AsciiStrCpy. Please check below link to see my 
> changes:
> https://github.com/tianocore/edk2/compare/0f391b1c2f988d90a3ac723b314ac28ba7b0b8df..f0fa1b8fdcd933beb52fd3127c2476443c00ef8d

These changes looks good. Internal strings
initialization/deinitialization code much cleaner now and possible
leak seems to have been fixed.

Thank you!

Regards,
Mike.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115981): https://edk2.groups.io/g/devel/message/115981
Mute This Topic: https://groups.io/mt/104505404/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP protocol

2024-02-23 Thread Mike Maslenkin
Hi Nickle,

On Fri, Feb 23, 2024 at 5:07 PM Nickle Wang  wrote:
>
> Thanks for your review, Mike.
>
> > %s/Resrouce/Resource/ this comes from RedfishClient autogenerated files...
>
> Typos are Addressed. I will send v3 later.
>
> >> +ON_ERROR:
> >> +
> >> +  ReleaseRedfishPayload (NewPayload);
> >> +
> >
> > NewPayload->Service  is leaked
>
> NewPayload->Service will be released in ReleaseRedfishPayload function.  
> ReleaseRedfishService() will be called in ReleaseRedfishPayload() when 
> Service is not NULL. Please let me know if I misunderstand your comment.

Oh, I see.
I missed ReleaseRedfishService() call.

>
>
> >> +(*DstHeaders)[Index].FieldValue = AllocateCopyPool (AsciiStrSize 
> >> (SrcHeaders[Index].FieldValue), SrcHeaders[Index].FieldValue);
> >> +if ((*DstHeaders)[Index].FieldValue == NULL) {
> >> +  return EFI_OUT_OF_RESOURCES;
> >
> > Looks like orevious allocations leaked.
> > Didn't you think to implement smth like this ?
>
> Yes, I can implement AsciiStrDup() here. But this won't fix the allocation 
> leaking, right? To fix allocation leaking, my idea is to call 
> HttpFreeHeaderFields() before returning EFI_OUT_OF_RESOURCES.  
> HttpFreeHeaderFields() will skip NULL FieldName and FieldValue automatically. 
> Does this sound good to you?
>
> I think I covered all your comments, but I am bad to find review comment in 
> email. If I missed any review comment, please kindly let me know. Thanks!

AsciiStrDup() is not handy here, because it requires preallocated buffer.
I mentioned about function similar to StrDup just to get shorter and
cleaner code.

I think I understood the idea now.
I'm just looking into code and assume that if function returns an
error, it must deallocate/cleanup resources.

So finally we have
HttpFreeHeaderFields (Response->Headers, Response->HeaderCount);
but Response->HeaderCount does not count partially allocated elements. Right?

To fix this, it is required to set
*DstHeaderCount = SrcHeaderCount unconditionally right after
DstHeaders  allocation, and HttpFreeHeaderFields() will do the work
then.

Regards,
Mike.

>
> Regards,
> Nickle
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Friday, February 23, 2024 7:29 PM
> > To: devel@edk2.groups.io; Nickle Wang 
> > Cc: Igor Kulchytskyy ; Abner Chang ;
> > Nick Ramirez 
> > Subject: Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP
> > protocol
> >
> > External email: Use caution opening links or attachments
> >
> >
> > Hi Nickle,
> >
> > %s/Resrouce/Resource/ this comes from RedfishClient autogenerated files...
> > there are thousands of "Resrouce" typos.
> >
> > please, find my minor notes below:
> >
> >
> > On Thu, Feb 22, 2024 at 12:11 PM Nickle Wang via groups.io
> >  wrote:
> > >
> > > implement Redfish HTTP protocol driver.
> > >
> > > Signed-off-by: Nickle Wang 
> > > Co-authored-by: Igor Kulchytskyy 
> > > Cc: Abner Chang 
> > > Cc: Igor Kulchytskyy 
> > > Cc: Nick Ramirez 
> > > ---
> > > RedfishPkg/RedfishPkg.dec |7 +-
> > > RedfishPkg/RedfishComponents.dsc.inc  |3 +-
> > > RedfishPkg/RedfishPkg.dsc |2 +
> > > RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf  |   73 +
> > > RedfishPkg/RedfishHttpDxe/RedfishHttpData.h   |  256 
> > > RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h|   44 +
> > > .../RedfishHttpDxe/RedfishHttpOperation.h |   76 +
> > > RedfishPkg/RedfishHttpDxe/RedfishHttpData.c   |  667 
> > > RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c| 1344 +
> > > .../RedfishHttpDxe/RedfishHttpOperation.c |  693 +
> > > RedfishPkg/Redfish.fdf.inc|3 +-
> > > 11 files changed, 3164 insertions(+), 4 deletions(-)
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.h
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.h
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c
> > > create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.c
> > >
> > > diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
> > > index 9b424efdf3..114f8d2ad8 

Re: [edk2-devel] [edk2-redfish-client][PATCH v2 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-23 Thread Mike Maslenkin
Hi Nickle,

I've updated commit message with your R-b and pushed it to PR.

Regards,
Mike.

> On 23. 2. 2024., at 12:38, Nickle Wang  wrote:
> 
> Hi @Mike Maslenkin <mailto:mike.maslen...@gmail.com>,
>  
> Can you please help me to add my reviewed-by to this commit message? 
> https://github.com/tianocore/edk2-redfish-client/pull/76/commits/7110d17629d6131030a3c382ca46d9331e13f2af
>  
> <https://github.com/tianocore/edk2-redfish-client/pull/76/commits/7110d17629d6131030a3c382ca46d9331e13f2af>
>   Then I can merge this pull request.
>  
> Thanks,
> Nickle
>  
> > -Original Message-
> > From: devel@edk2.groups.io <mailto:devel@edk2.groups.io> 
> > mailto:devel@edk2.groups.io>> On Behalf Of Nickle 
> > Wang
> > via groups.io <http://groups.io/>
> > Sent: Thursday, February 22, 2024 10:14 AM
> > To: Mike Maslenkin  > <mailto:mike.maslen...@gmail.com>>; devel@edk2.groups.io 
> > <mailto:devel@edk2.groups.io>
> > Cc: Abner Chang mailto:abner.ch...@amd.com>>; Igor 
> > Kulchytskyy mailto:ig...@ami.com>>
> > Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH v2 2/4] 
> > RedfishClientPkg:
> > refine RedfishExternalResourceResourceFeatureCallback
> > 
> > External email: Use caution opening links or attachments
> > 
> > 
> > Thanks for addressing my comment.
> > 
> > 
> > Reviewed-by: Nickle Wang mailto:nick...@nvidia.com>>
> > 
> > Regards,
> > Nickle
> > 
> > > -Original Message-
> > > From: Mike Maslenkin  > > <mailto:mike.maslen...@gmail.com>>
> > > Sent: Thursday, February 22, 2024 4:06 AM
> > > To: devel@edk2.groups.io <mailto:devel@edk2.groups.io>
> > > Cc: Mike Maslenkin  > > <mailto:mike.maslen...@gmail.com>>; Nickle Wang
> > > mailto:nick...@nvidia.com>>; Abner Chang 
> > > mailto:abner.ch...@amd.com>>; Igor
> > > Kulchytskyy mailto:ig...@ami.com>>
> > > Subject: [edk2-redfish-client][PATCH v2 2/4] RedfishClientPkg: refine
> > > RedfishExternalResourceResourceFeatureCallback
> > >
> > > External email: Use caution opening links or attachments
> > >
> > >
> > > Use local variable for BiosUri passed to HandleResource() to avoid
> > > problems in case of Private->Uri is overriden down the call stack.
> > >
> > > Suggested-by: Nickle Wang mailto:nick...@nvidia.com>>
> > > Cc: Abner Chang mailto:abner.ch...@amd.com>>
> > > Cc: Nickle Wang mailto:nick...@nvidia.com>>
> > > Cc: Igor Kulchytskyy mailto:ig...@ami.com>>
> > > Signed-off-by: Mike Maslenkin  > > <mailto:mike.maslen...@gmail.com>>
> > > ---
> > >  RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-
> > >  1 file changed, 6 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > > index f40f2d85af80..db77ed3dfccb 100644
> > > --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > > @@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (
> > >REDFISH_SERVICE  RedfishService;
> > >
> > >REDFISH_RESOURCE_COMMON_PRIVATE  *Private;
> > >
> > >EFI_STRING   ResourceUri;
> > >
> > > +  EFI_STRING   BiosUri;
> > >
> > >
> > >
> > >if (FeatureAction != CallbackActionStartOperation) {
> > >
> > >  return EFI_UNSUPPORTED;
> > >
> > > @@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback (
> > >//
> > >
> > >// Initialize collection path
> > >
> > >//
> > >
> > > -  Private->Uri = RedfishGetUri (ResourceUri);
> > >
> > > -  if (Private->Uri == NULL) {
> > >
> > > +  BiosUri = RedfishGetUri (ResourceUri);
> > >
> > > +  if (BiosUri == NULL) {
> > >
> > >  ASSERT (FALSE);
> > >
> > >  FreePool (ResourceUri);
> > >
> > >  return EFI_OUT_OF_RESOURCES;
> > >
> > >}
> > >
> > >
> > >
> > > -  Status = HandleResource (Private, Private->Uri);
> > >
> > > +  Status = HandleResource (Private, BiosUri);
> > >
> > >if (EFI_ERROR (Status)) {
> > >
> > > -DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: 
> > > %r\n",
> > > __func__, Private->Uri, Status));
> > >
> > > +DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed:
> > > + %r\n", __func__, BiosUri, Status));
> > >
> > >}
> > >
> > >
> > >
> > > -  FreePool (Private->Uri);
> > >
> > > +  FreePool (BiosUri);
> > >
> > >FreePool (ResourceUri);
> > >
> > >return Status;
> > >
> > >  }
> > >
> > > --
> > > 2.32.0 (Apple Git-132)
> > 
> > 
> > 
> > 
> > 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115882): https://edk2.groups.io/g/devel/message/115882
Mute This Topic: https://groups.io/mt/104495956/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP protocol

2024-02-23 Thread Mike Maslenkin
Hi Nickle,

%s/Resrouce/Resource/ this comes from RedfishClient autogenerated files... 
there are thousands of "Resrouce" typos.

please, find my minor notes below:


On Thu, Feb 22, 2024 at 12:11 PM Nickle Wang via groups.io 
 wrote:
> 
> implement Redfish HTTP protocol driver.
> 
> Signed-off-by: Nickle Wang 
> Co-authored-by: Igor Kulchytskyy 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
> RedfishPkg/RedfishPkg.dec |7 +-
> RedfishPkg/RedfishComponents.dsc.inc  |3 +-
> RedfishPkg/RedfishPkg.dsc |2 +
> RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf  |   73 +
> RedfishPkg/RedfishHttpDxe/RedfishHttpData.h   |  256 
> RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h|   44 +
> .../RedfishHttpDxe/RedfishHttpOperation.h |   76 +
> RedfishPkg/RedfishHttpDxe/RedfishHttpData.c   |  667 
> RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c| 1344 +
> .../RedfishHttpDxe/RedfishHttpOperation.c |  693 +
> RedfishPkg/Redfish.fdf.inc|3 +-
> 11 files changed, 3164 insertions(+), 4 deletions(-)
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.h
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.h
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c
> create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.c
> 
> diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
> index 9b424efdf3..114f8d2ad8 100644
> --- a/RedfishPkg/RedfishPkg.dec
> +++ b/RedfishPkg/RedfishPkg.dec
> @@ -157,8 +157,11 @@
>   # set to EFI_REST_EX_PROTOCOL.
>   #
>   
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT32|0x1009
> -  ## This is used to enable HTTP content encoding on Redfish communication.
> -  
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceContentEncoding|TRUE|BOOLEAN|0x100A
> +  #
> +  # This PCD string is introduced for platform developer to set the encoding 
> method supported by BMC Redfish.
> +  # Currently only "None" and "gzip" are supported.
> +  #
> +  
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceContentEncoding|"None"|VOID*|0x100A
>   #
>   # Use below PCDs to control Redfhs HTTP protocol.
>   #
> diff --git a/RedfishPkg/RedfishComponents.dsc.inc 
> b/RedfishPkg/RedfishComponents.dsc.inc
> index 464ffc8606..d6c5b73d7f 100644
> --- a/RedfishPkg/RedfishComponents.dsc.inc
> +++ b/RedfishPkg/RedfishComponents.dsc.inc
> @@ -7,7 +7,7 @@
> # "RedfishDefines.dsc.inc".
> #
> # (C) Copyright 2020-2021 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
> #
> @@ -28,4 +28,5 @@
>   RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
>   RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf
>   MdeModulePkg/Universal/RegularExpressionDxe/RegularExpressionDxe.inf
> +  RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> !endif
> diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
> index 25ed193182..5849e7cf9e 100644
> --- a/RedfishPkg/RedfishPkg.dsc
> +++ b/RedfishPkg/RedfishPkg.dsc
> @@ -45,6 +45,8 @@
>   
> UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
>   
> RedfishPlatformCredentialLib|RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
>   
> RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
> +  
> ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
> +  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
> 
>   # NULL instance of IPMI related library.
>   IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
> diff --git a/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf 
> b/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> new file mode 100644
> index 00..c7dfdffacf
> --- /dev/null
> +++ b/RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
> @@ -0,0 +1,73 @@
> +## @file
> +#  RedfishHttpDxe is the DXE driver which provides
> +#  EdkIIRedfishHttpProtocol to EDK2 Redfish Feature
> +#  drivers for HTTP operation.
> +#
> +#  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
> reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION= 0x0001000b
> +  BASE_NAME  = RedfishHttpDxe
> +  FILE_GUID  = 85ADB2F1-DA93-47D4-AF4F-3D920D9BD2C0
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= RedfishHttpEntryPoi

[edk2-devel] [edk2-redfish-client][PATCH v2 4/4] RedfishClientPkg: use Json value from a function argument

2024-02-21 Thread Mike Maslenkin
This patch replaces value Private->Json with Json used as second argument
for RedfishIdentifyResource(). Currently Json argument is not used at all
and the pattern for caller side is:
  Status = RedfishIdentifyResourceCommon (Private, Private->Json);

So in scope of RedfishIdentifyResourceCommon Json actually is the same
value as Private->Json. Let's make code a bit cleaner.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
Reviewed-by: Nickle Wang 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c   | 2 +-
 .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c| 2 +-
 .../ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c| 2 +-
 .../ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c | 2 +-
 RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index 0ae841499692..f3f993c8782e 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -729,7 +729,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
diff --git 
a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c 
b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
index 0b9f2bf28434..f471c01c3790 100644
--- a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
+++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
@@ -791,7 +791,7 @@ RedfishIdentifyResourceCommon (
 {
   BOOLEAN  Supported;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 return EFI_SUCCESS;
   }
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
index cee6c8bf9ba1..d69fc176ad94 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
@@ -848,7 +848,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
index a67ef3dac283..11bcb5f76cab 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -1718,7 +1718,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c 
b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
index eb52c68c5dcb..00a69f748c3c 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
@@ -2516,7 +2516,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &am

[edk2-devel] [edk2-redfish-client][PATCH v2 3/4] RedfishClientPkg/Bios: fix leak of GetPendingSettings URI.

2024-02-21 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
Reviewed-by: Nickle Wang 
---
 .../Features/Bios/v1_0_9/Dxe/BiosDxe.c  | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index db77ed3dfccb..a442d446bc35 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -132,12 +132,13 @@ RedfishResourceConsumeResource (
   // Check and see if "@Redfish.Settings" exist or not.
   //
   ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
-  Status = GetPendingSettings (
- Private->RedfishService,
- Response.Payload,
- &PendingSettingResponse,
- &PendingSettingUri
- );
+  PendingSettingUri = NULL;
+  Status= GetPendingSettings (
+Private->RedfishService,
+Response.Payload,
+&PendingSettingResponse,
+&PendingSettingUri
+);
   if (!EFI_ERROR (Status)) {
 DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", 
__func__, PendingSettingUri));
 Private->Uri = PendingSettingUri;
@@ -206,6 +207,10 @@ RedfishResourceConsumeResource (
 FreePool (Etag);
   }
 
+  if (PendingSettingUri != NULL) {
+FreePool (PendingSettingUri);
+  }
+
   return Status;
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115737): https://edk2.groups.io/g/devel/message/115737
Mute This Topic: https://groups.io/mt/104495960/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v2 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory leak on error path

2024-02-21 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
Reviewed-by: Nickle Wang 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index e1494471038c..21ce8ddad9d5 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -4010,6 +4010,7 @@ RedfishRemoveUnchangeableProperties (
  (RedfishCS_uint32)AsciiStrSize (*JsonString)
  );
   if (Status != RedfishCS_status_success) {
+FreePool (UpdatedJsonString);
 return EFI_DEVICE_ERROR;
   }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115735): https://edk2.groups.io/g/devel/message/115735
Mute This Topic: https://groups.io/mt/104495954/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v2 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-21 Thread Mike Maslenkin
Use local variable for BiosUri passed to HandleResource() to avoid
problems in case of Private->Uri is overriden down the call stack.

Suggested-by: Nickle Wang 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index f40f2d85af80..db77ed3dfccb 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (
   REDFISH_SERVICE  RedfishService;
   REDFISH_RESOURCE_COMMON_PRIVATE  *Private;
   EFI_STRING   ResourceUri;
+  EFI_STRING   BiosUri;
 
   if (FeatureAction != CallbackActionStartOperation) {
 return EFI_UNSUPPORTED;
@@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback (
   //
   // Initialize collection path
   //
-  Private->Uri = RedfishGetUri (ResourceUri);
-  if (Private->Uri == NULL) {
+  BiosUri = RedfishGetUri (ResourceUri);
+  if (BiosUri == NULL) {
 ASSERT (FALSE);
 FreePool (ResourceUri);
 return EFI_OUT_OF_RESOURCES;
   }
 
-  Status = HandleResource (Private, Private->Uri);
+  Status = HandleResource (Private, BiosUri);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n", 
__func__, Private->Uri, Status));
+DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed: %r\n", 
__func__, BiosUri, Status));
   }
 
-  FreePool (Private->Uri);
+  FreePool (BiosUri);
   FreePool (ResourceUri);
   return Status;
 }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115736): https://edk2.groups.io/g/devel/message/115736
Mute This Topic: https://groups.io/mt/104495956/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v2 0/4] RedfishClientPkg: fix memory leaks and refine code

2024-02-21 Thread Mike Maslenkin
This set contains a trivial fix for a leak reviewed on Feb 1 [1] and a fix for 
а leak discussed in [2]

PR: https://github.com/tianocore/edk2-redfish-client/pull/76

[1] https://edk2.groups.io/g/devel/message/114925
[2] https://edk2.groups.io/g/devel/message/114765


v2:
in commit message put Cc back for the ones had given R-b
collected R-b
renamed CollectionUri to BiosUri

Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115734): https://edk2.groups.io/g/devel/message/115734
Mute This Topic: https://groups.io/mt/104495953/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-21 Thread Mike Maslenkin
On Wed, Feb 21, 2024 at 5:34 AM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Wednesday, February 21, 2024 8:13 AM
> > To: devel@edk2.groups.io
> > Cc: Mike Maslenkin ; Nickle Wang
> > ; Chang, Abner ; Igor
> > Kulchytskyy 
> > Subject: [PATCH 2/4] RedfishClientPkg: refine
> > RedfishExternalResourceResourceFeatureCallback
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Use local variable for CollectionUri passed to HandleResource() to avoid
> > problems in case of Private->Uri is overriden down the call stack.
> >
> > Suggested-by: Nickle Wang 
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Signed-off-by: Mike Maslenkin 
> > ---
> >  RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > index f40f2d85af80..396ec22969b5 100644
> > --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
> > @@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (
> >REDFISH_SERVICE  RedfishService;
> >
> >REDFISH_RESOURCE_COMMON_PRIVATE  *Private;
> >
> >EFI_STRING   ResourceUri;
> >
> > +  EFI_STRING   CollectionUri;
> >
> >
> >
> >if (FeatureAction != CallbackActionStartOperation) {
> >
> >  return EFI_UNSUPPORTED;
> >
> > @@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback
> > (
> >//
> >
> >// Initialize collection path
> >
> >//
> >
> > -  Private->Uri = RedfishGetUri (ResourceUri);
> >
> > -  if (Private->Uri == NULL) {
> >
> > +  CollectionUri = RedfishGetUri (ResourceUri);
>
> I would like to leave this to Nickle to review if there is any impacts of not 
> initializing Private->Uri. Is Private->Uri referred in the later process?
> Apart from above, the naming of CollectionUri is not proper as BiosDxe is not 
> a collection driver. I think the comment of " // Initialize collection path" 
> is a copy & paste error.
>
> Thanks
> Abner
>

Good question about Private->Uri.
It looks like it's safe not to initialize Private->Uri here, because
it is being initialized in every function of
EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL.
That was exactly my previous concern.  After this patch only callee
from EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL are dealing with
Private->Uri.
So it could be dropped in favor of additional parameter.

I mean currently EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL function
initializes Private->Uri explicitly, then it is used in function
implementing actual implementation of
EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL. For example:
RedfishResourceConsumeResource->RedfishConsumeResourceCommon,
RedfishResourceConsumeResource->RedfishConsumeResourceCommon,
RedfishResourceProvisioningResource->RedfishProvisioningResourceCommon->{ProvisioningBiosExistResource,ProvisioningBiosResources},
RedfishResourceCheck->RedfishCheckResourceCommon,
RedfishResourceUpdate->RedfishUpdateResourceCommon,
RedfishResourceIdentify->RedfishIdentifyResourceCommon.
So, in all this cases Private->Uri can be passed as a function
argument down to call stack.


And HandleResource() mentioned above calls functions from
EdkIIRedfishResourceConfigLib that in turn calls
EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL implementation, where
Private->Uri is being initialized.  See previous paragraph.

I don't think I missed anything.

Regards,
Mike.


> >
> > +  if (CollectionUri == NULL) {
> >
> >  ASSERT (FALSE);
> >
> >  FreePool (ResourceUri);
> >
> >  return EFI_OUT_OF_RESOURCES;
> >
> >}
> >
> >
> >
> > -  Status = HandleResource (Private, Private->Uri);
> >
> > +  Status = HandleResource (Private, CollectionUri);
> >
> >if (EFI_ERROR (Status)) {
> >
> > -DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n",
> > __func__, Private->Uri, Status));
> >
> > +DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed: %r\n",
> > __func__, CollectionUri, Status));
> >
> >}
> >
> >
> >
> > -  FreePool (Private->Uri);
> >
> > +  FreePool (CollectionUri);
> >
> >FreePool (ResourceUri);
> >
> >return Status;
> >
> >  }
> >
> > --
> > 2.32.0 (Apple Git-132)
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115732): https://edk2.groups.io/g/devel/message/115732
Mute This Topic: https://groups.io/mt/104479572/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 4/4] RedfishClientPkg: use Json value from a function argument

2024-02-20 Thread Mike Maslenkin
This patch replaces value Private->Json with Json used as second argument
for RedfishIdentifyResource(). Currently Json argument is not used at all
and the pattern for caller side is:
  Status = RedfishIdentifyResourceCommon (Private, Private->Json);

So in scope of RedfishIdentifyResourceCommon Json actually is the same
value as Private->Json. Let's make code a bit cleaner.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c   | 2 +-
 .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c| 2 +-
 .../ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c| 2 +-
 .../ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c | 2 +-
 RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index 0ae841499692..f3f993c8782e 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -729,7 +729,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
diff --git 
a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c 
b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
index 0b9f2bf28434..f471c01c3790 100644
--- a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
+++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
@@ -791,7 +791,7 @@ RedfishIdentifyResourceCommon (
 {
   BOOLEAN  Supported;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 return EFI_SUCCESS;
   }
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
index cee6c8bf9ba1..d69fc176ad94 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
@@ -848,7 +848,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
index a67ef3dac283..11bcb5f76cab 100644
--- 
a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -1718,7 +1718,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c 
b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
index eb52c68c5dcb..00a69f748c3c 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
@@ -2516,7 +2516,7 @@ RedfishIdentifyResourceCommon (
   EFI_STRING   EndOfChar;
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
 
-  Supported = RedfishIdentifyResource (Private->Uri, Private->Json);
+  Supported = RedfishIdentifyResource (Private->Uri, Json);
   if (Supported) {
 Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, 
RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
 if (EFI_ERROR (Status)) {
-- 
2.32.0 (Apple Gi

[edk2-devel] [PATCH 3/4] RedfishClientPkg/Bios: fix leak of GetPendingSettings URI.

2024-02-20 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index 396ec22969b5..8548425c9c83 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -132,6 +132,7 @@ RedfishResourceConsumeResource (
   // Check and see if "@Redfish.Settings" exist or not.
   //
   ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
+  PendingSettingUri = NULL;
   Status = GetPendingSettings (
  Private->RedfishService,
  Response.Payload,
@@ -206,6 +207,10 @@ RedfishResourceConsumeResource (
 FreePool (Etag);
   }
 
+  if (PendingSettingUri != NULL) {
+FreePool (PendingSettingUri);
+  }
+
   return Status;
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115687): https://edk2.groups.io/g/devel/message/115687
Mute This Topic: https://groups.io/mt/104479573/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/4] RedfishClientPkg/RedfishFeatureUtilityLib: fix memory leak on error path

2024-02-20 Thread Mike Maslenkin
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index e1494471038c..21ce8ddad9d5 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -4010,6 +4010,7 @@ RedfishRemoveUnchangeableProperties (
  (RedfishCS_uint32)AsciiStrSize (*JsonString)
  );
   if (Status != RedfishCS_status_success) {
+FreePool (UpdatedJsonString);
 return EFI_DEVICE_ERROR;
   }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115685): https://edk2.groups.io/g/devel/message/115685
Mute This Topic: https://groups.io/mt/104479571/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback

2024-02-20 Thread Mike Maslenkin
Use local variable for CollectionUri passed to HandleResource() to avoid
problems in case of Private->Uri is overriden down the call stack.

Suggested-by: Nickle Wang 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index f40f2d85af80..396ec22969b5 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback (
   REDFISH_SERVICE  RedfishService;
   REDFISH_RESOURCE_COMMON_PRIVATE  *Private;
   EFI_STRING   ResourceUri;
+  EFI_STRING   CollectionUri;
 
   if (FeatureAction != CallbackActionStartOperation) {
 return EFI_UNSUPPORTED;
@@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback (
   //
   // Initialize collection path
   //
-  Private->Uri = RedfishGetUri (ResourceUri);
-  if (Private->Uri == NULL) {
+  CollectionUri = RedfishGetUri (ResourceUri);
+  if (CollectionUri == NULL) {
 ASSERT (FALSE);
 FreePool (ResourceUri);
 return EFI_OUT_OF_RESOURCES;
   }
 
-  Status = HandleResource (Private, Private->Uri);
+  Status = HandleResource (Private, CollectionUri);
   if (EFI_ERROR (Status)) {
-DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n", 
__func__, Private->Uri, Status));
+DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed: %r\n", 
__func__, CollectionUri, Status));
   }
 
-  FreePool (Private->Uri);
+  FreePool (CollectionUri);
   FreePool (ResourceUri);
   return Status;
 }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115686): https://edk2.groups.io/g/devel/message/115686
Mute This Topic: https://groups.io/mt/104479572/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 0/4] RedfishClientPkg: fix memory leaks and refine code

2024-02-20 Thread Mike Maslenkin
This set contains a trivial fix for a leak reviewed on Feb 1 [1]
and a fix for а leak discussed in [2].

PR: https://github.com/tianocore/edk2-redfish-client/pull/76

[1] https://edk2.groups.io/g/devel/message/114925
[2] https://edk2.groups.io/g/devel/message/114765


Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115684): https://edk2.groups.io/g/devel/message/115684
Mute This Topic: https://groups.io/mt/104479570/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] MdeModulePkg/NvmExpressDxe: use format "0x%lx" for UINT64 values.

2024-02-16 Thread Mike Maslenkin
Signed-off-by: Mike Maslenkin 
Cc: Ray Ni 
---
 MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c 
b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
index dfa3653d6a5e..069da12a9b1b 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
@@ -288,9 +288,9 @@ EnumerateNvmeDevNamespace (
 // Dump NvmExpress Identify Namespace Data
 //
 DEBUG ((DEBUG_INFO, " == NVME IDENTIFY NAMESPACE [%d] DATA ==\n", 
NamespaceId));
-DEBUG ((DEBUG_INFO, "NSZE: 0x%x\n", NamespaceData->Nsze));
-DEBUG ((DEBUG_INFO, "NCAP: 0x%x\n", NamespaceData->Ncap));
-DEBUG ((DEBUG_INFO, "NUSE: 0x%x\n", NamespaceData->Nuse));
+DEBUG ((DEBUG_INFO, "NSZE: 0x%lx\n", NamespaceData->Nsze));
+DEBUG ((DEBUG_INFO, "NCAP: 0x%lx\n", NamespaceData->Ncap));
+DEBUG ((DEBUG_INFO, "NUSE: 0x%lx\n", NamespaceData->Nuse));
 DEBUG ((DEBUG_INFO, "LBAF0.LBADS : 0x%x\n", 
(NamespaceData->LbaFormat[0].Lbads)));
 
 //
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115557): https://edk2.groups.io/g/devel/message/115557
Mute This Topic: https://groups.io/mt/104401877/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 0/2] MdeModulePkg/NvmExpressDxe: fix format specifiers for UINT64 values

2024-02-16 Thread Mike Maslenkin
This set contains a simple fixes for UINT64 values passed to functions
producing strings.

Patch 1/2 is a real fix for NVMe drive label creation logic.
For example: Opal driver from SecurityPkg uses gEfiComponentNameProtocolGuid
family for obtaining disk name.

Signed-off-by: Mike Maslenkin 
Cc: Ray Ni 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#11): https://edk2.groups.io/g/devel/message/11
Mute This Topic: https://groups.io/mt/104401875/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 1/2] MdeModulePkg/NvmExpressDxe: fix format used for Eui64 conversion

2024-02-16 Thread Mike Maslenkin
Eui64 is a 64 bit value, so the "L" or "l" is required for
format specifier, otherwise only lower 32 bit will be converted.

Signed-off-by: Mike Maslenkin 
Cc: Ray Ni 
---
 MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c 
b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
index dea14f1a446c..dfa3653d6a5e 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
@@ -300,7 +300,7 @@ EnumerateNvmeDevNamespace (
 Sn[20] = 0;
 CopyMem (Mn, Private->ControllerData->Mn, sizeof 
(Private->ControllerData->Mn));
 Mn[40] = 0;
-UnicodeSPrintAsciiFormat (Device->ModelName, sizeof (Device->ModelName), 
"%a-%a-%x", Sn, Mn, NamespaceData->Eui64);
+UnicodeSPrintAsciiFormat (Device->ModelName, sizeof (Device->ModelName), 
"%a-%a-%lx", Sn, Mn, NamespaceData->Eui64);
 
 AddUnicodeString2 (
   "eng",
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115556): https://edk2.groups.io/g/devel/message/115556
Mute This Topic: https://groups.io/mt/104401876/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg: fix memory leak in ConverterLib

2024-01-26 Thread Mike Maslenkin
The memory returned by json_dumps() must be freed.

Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c 
b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
index 126200dd019c..250ef75e40de 100644
--- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
+++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
@@ -379,15 +379,19 @@ CreateCsJsonByNode (
   if (TempChar != NULL) {
 Status = allocateRecordCsMemory (Cs, sizeof (RedfishCS_Type_JSON_Data), 
(void **)&CsTypeJson);
 if (Status != RedfishCS_status_success) {
+  free (TempChar);
   return Status;
 }
 
 Status = allocateRecordCsMemory (Cs, (RedfishCS_int)strlen (TempChar) + 1, 
(void **)&DumpStr);
 if (Status != RedfishCS_status_success) {
+  free (TempChar);
   return Status;
 }
 
 strncpy (DumpStr, TempChar, strlen (TempChar) + 1);
+free (TempChar);
+
 InitializeLinkHead (&CsTypeJson->Header.LinkEntry);
 CsTypeJson->Header.ResourceType = RedfishCS_Type_JSON;
 CsTypeJson->Header.ThisUri  = ParentUri;
@@ -1506,9 +1510,10 @@ RemoveUnchangeableProperties (
   Status = RedfishCS_status_insufficient_memory;
 } else {
   memcpy (NewJsonBuffer, TempChar, strlen (TempChar) + 1);
-  free (TempChar);
   Status = RedfishCS_status_success;
 }
+
+free (TempChar);
   } else {
 Status = RedfishCS_status_unknown_error;
   }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114645): https://edk2.groups.io/g/devel/message/114645
Mute This Topic: https://groups.io/mt/103988340/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 1/2] RedfishClientPkg: fix uninitialized variable build error

2024-01-26 Thread Mike Maslenkin
Variable 'Status' may be used uninitialized in this function
[-Werror=maybe-uninitialized]

Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c 
b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index dce83a8a986f..e76f8d106987 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -152,6 +152,7 @@ StartUpFeatureDriver (
   }
 
   ThisList = ThisFeatureDriverList;
+  Status   = EFI_SUCCESS;
   while (TRUE) {
 if (ThisList->Callback != NULL) {
   ThisList->InformationExchange = mInformationExchange;
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114644): https://edk2.groups.io/g/devel/message/114644
Mute This Topic: https://groups.io/mt/103988339/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 0/2] RedfishClientPkg: fix memory leak in ConverterLib

2024-01-26 Thread Mike Maslenkin
This patchset contains a trivial fix for memory leak in ConverterLib
Also patch 1 is a resend of the same patch sent to list on 4th Jan with
added Rb (https://edk2.groups.io/g/devel/message/113162).

PR: https://github.com/tianocore/edk2-redfish-client/pull/74

Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114643): https://edk2.groups.io/g/devel/message/114643
Mute This Topic: https://groups.io/mt/103988338/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver

2024-01-26 Thread Mike Maslenkin
BTW did you consider to remove this Private->Uri someday at all ?
I tried to remove it, but since it declared in a common header for all redfish 
client feature drivers
those changes was huge comparing to a small memory leak I tried to fix.
And now such pattern spreads into new feature drivers. 
In short: there is no need to cache this value in Private->Uri, but pass it as 
an argument down to stack in EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL 
implementation.
I think it just small design flaw. 

The code I'm talking about:
+  //
+  // Check and see if "@Redfish.Settings" exist or not.
+  //
+  ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE));
+  Status = GetPendingSettings (
+ Private->RedfishService,
+ Response.Payload,
+ &PendingSettingResponse,
+ &PendingSettingUri
+ );
+  if (!EFI_ERROR (Status)) {
+DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", 
__func__, PendingSettingUri));
+Private->Uri = PendingSettingUri;
+ExpectedResponse = &PendingSettingResponse;
+  } else {
+DEBUG ((REDFISH_DEBUG_TRACE, "%a: No @Redfish.Settings is found\n", 
__func__));
+Private->Uri = Uri;
+ExpectedResponse = &Response;
+  }

In this pattern PendingSettingUri is leaked, since Private->Uri belongs to 
caller and never released.

But... in fact it is not true for Feature/Bios driver, and actually leaked 
resource is original Private->Uri string.

This is because these EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL function called by
HandleResource() function, which in turns called from here:
  //
  // Initialize collection path
  //
  Private->Uri = RedfishGetUri (ResourceUri);
  if (Private->Uri == NULL) {
ASSERT (FALSE);
FreePool (ResourceUri);
return EFI_OUT_OF_RESOURCES;
  }

  Status = HandleResource (Private, Private->Uri);
  if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r\n", 
__func__, Private->Uri, Status));
  }

  FreePool (Private->Uri);


Too many "Private->Uri" with a different value. 

PS: Funny, just pay attention to the log trace above - %a used for 
Private->Uri. Probably it was one of the factors 
induced me to write previous message :)

Regards,
Mike.


> On 26. 1. 2024., at 17:13, Chang, Abner  wrote:
> 
> [AMD Official Use Only - General]
> 
> It is no problem. 😊 Thank you Mike for looking into this patch.
> Abner
> 
>> -Original Message-
>> From: M M 
>> Sent: Friday, January 26, 2024 10:11 PM
>> To: Chang, Abner 
>> Cc: devel@edk2.groups.io; Nickle Wang ; Igor
>> Kulchytskyy 
>> Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V2]
>> RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver
>> 
>> Caution: This message originated from an External Source. Use proper caution
>> when opening attachments, clicking links, or responding.
>> 
>> 
>> You are right.
>> 
>> Sorry for the noise!
>> 
>> No problems here.
>> I mixed up with tags in my editor while looked into patch.
>> 
>> Regards,
>> Mike
>> 
>>> On 26. 1. 2024., at 17:03, Chang, Abner  wrote:
>>> 
>>> [AMD Official Use Only - General]
>>> 
>>> Hi Mike,
>>> I can't identify the issue on %s as Private->Uri is defined as EFI_STRING, 
>>> or I
>> miss something?
>>> 
>>> Thanks
>>> Abner
>>> 
 -Original Message-
 From: M M 
 Sent: Friday, January 26, 2024 9:55 PM
 To: devel@edk2.groups.io; Nickle Wang 
 Cc: Chang, Abner ; Igor Kulchytskyy
 
 Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V2]
 RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver
 
 Caution: This message originated from an External Source. Use proper
>> caution
 when opening attachments, clicking links, or responding.
 
 
 Hi Abner,
 
> On 26. 1. 2024., at 05:20, Nickle Wang via groups.io
  wrote:
> 
> Hi Abner,
> 
> Same minor issue as 1_5_0. Please add "%a:" to below DEBUG call.
> 
>> +  DEBUG ((DEBUG_MANAGEABILITY, "  No platform Redfish
 ConfigureLang
>> found for %s\n", __func__, Private->Uri));
> 
> Regards,
> Nickle
 
 There are two issues in this string. The second one is incorrect  %s format
>> used
 for Private->Uri.
 This issue exists in V3 not only in the line mentioned above.
 
 Regards,
 Mike.
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114618): https://edk2.groups.io/g/devel/message/114618
Mute This Topic: https://groups.io/mt/103967446/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver

2024-01-26 Thread Mike Maslenkin
You are right.

Sorry for the noise!

No problems here.
I mixed up with tags in my editor while looked into patch.

Regards,
Mike

> On 26. 1. 2024., at 17:03, Chang, Abner  wrote:
> 
> [AMD Official Use Only - General]
> 
> Hi Mike,
> I can't identify the issue on %s as Private->Uri is defined as EFI_STRING, or 
> I miss something?
> 
> Thanks
> Abner
> 
>> -Original Message-
>> From: M M 
>> Sent: Friday, January 26, 2024 9:55 PM
>> To: devel@edk2.groups.io; Nickle Wang 
>> Cc: Chang, Abner ; Igor Kulchytskyy
>> 
>> Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V2]
>> RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver
>> 
>> Caution: This message originated from an External Source. Use proper caution
>> when opening attachments, clicking links, or responding.
>> 
>> 
>> Hi Abner,
>> 
>>> On 26. 1. 2024., at 05:20, Nickle Wang via groups.io
>>  wrote:
>>> 
>>> Hi Abner,
>>> 
>>> Same minor issue as 1_5_0. Please add "%a:" to below DEBUG call.
>>> 
 +  DEBUG ((DEBUG_MANAGEABILITY, "  No platform Redfish
>> ConfigureLang
 found for %s\n", __func__, Private->Uri));
>>> 
>>> Regards,
>>> Nickle
>> 
>> There are two issues in this string. The second one is incorrect  %s format 
>> used
>> for Private->Uri.
>> This issue exists in V3 not only in the line mentioned above.
>> 
>> Regards,
>> Mike.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114615): https://edk2.groups.io/g/devel/message/114615
Mute This Topic: https://groups.io/mt/103967446/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver

2024-01-26 Thread Mike Maslenkin
Hi Abner,

> On 26. 1. 2024., at 05:20, Nickle Wang via groups.io 
>  wrote:
> 
> Hi Abner,
> 
> Same minor issue as 1_5_0. Please add "%a:" to below DEBUG call.
> 
>> +  DEBUG ((DEBUG_MANAGEABILITY, "  No platform Redfish ConfigureLang
>> found for %s\n", __func__, Private->Uri));
> 
> Regards,
> Nickle

There are two issues in this string. The second one is incorrect  %s format 
used for Private->Uri.
This issue exists in V3 not only in the line mentioned above.

Regards,
Mike.

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114612): https://edk2.groups.io/g/devel/message/114612
Mute This Topic: https://groups.io/mt/103967446/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg: Add ETag PCD and revise Redfish ETag functions

2024-01-05 Thread Mike Maslenkin
Hi Abner,

Thank you for the clarification.

Regards,
Mike.

On Fri, Jan 5, 2024 at 12:03 PM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> Hi Mike,
> This PCD is introduced for the platform that connects to the Redfish service 
> which doesn't support ETag.
> We disable the client code that handles ETag with setting this PCD to FALSE. 
> So client will just consume any Redfish property from service even there is 
> nothing changed. This knob doesn't control Redfish service behavior on BMC.
> Yes, there is no method to detect if Redfish service supports ETag or not. So 
> we introduce a client side knob to disable ETag checking although it mentions 
> the service "should" support ETag in Redfish spec. However, a simple Redfish 
> services may not implementing ETag HTTP header.
> Does above clarify the question?
>
> Thanks
> Abner
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Friday, January 5, 2024 8:20 AM
> > To: devel@edk2.groups.io; Chang, Abner 
> > Cc: Nickle Wang ; Igor Kulchytskyy 
> > Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg:
> > Add ETag PCD and revise Redfish ETag functions
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Looks good to me.
> >
> > But could it be possible to rephrase "ETAG is not supported on Redfish
> > service." ?
> > May be I misunderstand, but I assume "Redfish service" is a service at
> > BMC side, while we are disabling ETAG functionality at Redfish client
> > side.
> > README.md says "Redfish service hosted by Board Management Controller
> > (BMC) in server".
> > Currently there is no method to get server features (AFAIR), so we
> > disable a work with those explicitly on the client side.
> >
> > Regards,
> > Mike.
> >
> > On Thu, Jan 4, 2024 at 11:57 AM Chang, Abner via groups.io
> >  wrote:
> > >
> > > From: Abner Chang 
> > >
> > > Add PCD to disable ETag capability for the case Redfish
> > > service doesn't support ETag.
> > >
> > > Signed-off-by: Abner Chang 
> > > Cc: Nickle Wang 
> > > Cc: Igor Kulchytskyy 
> > > Cc: Mike Maslenkin 
> > > ---
> > >  RedfishClientPkg/RedfishClientPkg.dec |   2 +
> > >  .../RedfishFeatureUtilityLib.inf  |   1 +
> > >  .../Library/RedfishFeatureUtilityLib.h|  46 +++-
> > >  .../Features/Bios/v1_0_9/Dxe/BiosDxe.c|  18 +-
> > >  .../v1_0_4/Common/BootOptionCommon.c  |   4 +-
> > >  .../BootOption/v1_0_4/Dxe/BootOptionDxe.c |  16 +-
> > >  .../v1_5_0/Dxe/ComputerSystemDxe.c|  16 +-
> > >  .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c|  16 +-
> > >  .../RedfishFeatureUtilityLib.c| 208 --
> > >  9 files changed, 197 insertions(+), 130 deletions(-)
> > >
> > > diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> > b/RedfishClientPkg/RedfishClientPkg.dec
> > > index b350facae0..8adef327fb 100644
> > > --- a/RedfishClientPkg/RedfishClientPkg.dec
> > > +++ b/RedfishClientPkg/RedfishClientPkg.dec
> > > @@ -76,6 +76,8 @@
> > >
> > gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID*
> > |0x1004
> > >## The number of seconds that the firmware will wait before system 
> > > reboot
> > >
> > gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5|UI
> > NT16|0x2002
> > > +  ## Default capability of Redfish service side ETAG support
> > > +
> > gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported|TRUE|
> > BOOLEAN|0x1005
> > >
> > >  [PcdsDynamicEx]
> > >## The flag used to indicate that system reboot is required due to 
> > > system
> > configuration change
> > > diff --git
> > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.i
> > nf
> > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.i
> > nf
> > > index 718273b248..fde6a176d0 100644
> > > ---
> > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.i
> > nf
> > > +++
> > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.i
> > nf
> > > @@ -54,6 +54,7 @@
> > >
> > >  [Pcd]
> > &

Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg: Add ETag PCD and revise Redfish ETag functions

2024-01-04 Thread Mike Maslenkin
Looks good to me.

But could it be possible to rephrase "ETAG is not supported on Redfish
service." ?
May be I misunderstand, but I assume "Redfish service" is a service at
BMC side, while we are disabling ETAG functionality at Redfish client
side.
README.md says "Redfish service hosted by Board Management Controller
(BMC) in server".
Currently there is no method to get server features (AFAIR), so we
disable a work with those explicitly on the client side.

Regards,
Mike.

On Thu, Jan 4, 2024 at 11:57 AM Chang, Abner via groups.io
 wrote:
>
> From: Abner Chang 
>
> Add PCD to disable ETag capability for the case Redfish
> service doesn't support ETag.
>
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Mike Maslenkin 
> ---
>  RedfishClientPkg/RedfishClientPkg.dec |   2 +
>  .../RedfishFeatureUtilityLib.inf  |   1 +
>  .../Library/RedfishFeatureUtilityLib.h|  46 +++-
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.c|  18 +-
>  .../v1_0_4/Common/BootOptionCommon.c  |   4 +-
>  .../BootOption/v1_0_4/Dxe/BootOptionDxe.c |  16 +-
>  .../v1_5_0/Dxe/ComputerSystemDxe.c|  16 +-
>  .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c|  16 +-
>  .../RedfishFeatureUtilityLib.c| 208 --
>  9 files changed, 197 insertions(+), 130 deletions(-)
>
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec 
> b/RedfishClientPkg/RedfishClientPkg.dec
> index b350facae0..8adef327fb 100644
> --- a/RedfishClientPkg/RedfishClientPkg.dec
> +++ b/RedfishClientPkg/RedfishClientPkg.dec
> @@ -76,6 +76,8 @@
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID*|0x1004
>## The number of seconds that the firmware will wait before system reboot
>
> gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5|UINT16|0x2002
> +  ## Default capability of Redfish service side ETAG support
> +  
> gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported|TRUE|BOOLEAN|0x1005
>
>  [PcdsDynamicEx]
>## The flag used to indicate that system reboot is required due to system 
> configuration change
> diff --git 
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
>  
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
> index 718273b248..fde6a176d0 100644
> --- 
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
> +++ 
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
> @@ -54,6 +54,7 @@
>
>  [Pcd]
>gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
> +  gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported
>
>  [Guids]
>
> diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h 
> b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> index 9513a65617..834ea0fcfe 100644
> --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> @@ -81,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.
>
> @@ -559,6 +559,19 @@ GetEtagWithUri (
>IN  EFI_STRING  Uri
>);
>
> +/**
> +
> +  This function returns a boolean of ETAG support on Redfish service side.
> +
> +  @retval TRUEETAG is supported on Redfish service.
> +  @retval FALSE   ETAG is not supported on Redfish service.
> +
> +**/
> +BOOLEAN
> +CheckIsServerEtagSupported (
> +  VOID
> +  );
> +
>  /**
>
>Get @odata.id from give HTTP payload. It's call responsibility to release 
> returned buffer.
> @@ -931,22 +944,33 @@ CompareRedfishPropertyVagueValues (
>);
>
>  /**
> +  Find "ETag" from either HTTP header or Redfish response.
>
> -  Find "ETag" and "Location" from either HTTP header or Redfish response.
> +  @param[in]  ResponseHTTP response
> +  @param[out] EtagString buffer to return ETag
>
> -  @param[in]  ResponseHTTP response
> -  @param[out] EtagString buffer to return ETag
> -  @param[out] LocationString buffer to return Location
> +  @retval  EFI_SUCCESSETag is returned in Etag
> +  @retval  EFI_UNSUPPORTEDETag is unsupported
> +  @retval  EFI_INVALID_PARAMETER  Response, Etag or both are NULL.
>
> -  @retval EFI_SUCCESS Data is found and returned.
> -  @retval

[edk2-devel] [PATCH] RedfishClientPkg: fix uninitialized variable build error

2024-01-04 Thread Mike Maslenkin
Variable 'Status' may be used uninitialized in this function
[-Werror=maybe-uninitialized]

Signed-off-by: Mike Maslenkin 
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c 
b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index c0c3ec476f19..f2373b080c70 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -146,6 +146,7 @@ StartUpFeatureDriver (
   }
 
   ThisList = ThisFeatureDriverList;
+  Status   = EFI_SUCCESS;
   while (TRUE) {
 if (ThisList->Callback != NULL) {
   ThisList->InformationExchange = mInformationExchange;
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113161): https://edk2.groups.io/g/devel/message/113161
Mute This Topic: https://groups.io/mt/103520603/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements

2023-12-26 Thread Mike Maslenkin
Hi Abner,

I added your RB to all patches in the set and updated PR.

Thanks,
Mike.

On Tue, Dec 26, 2023 at 4:41 AM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> Hi Mike,
> I had RB on this patch set. Please update PR with my RB. Also let me know 
> when you reset it.
>
> Thanks
> Abner
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Monday, December 25, 2023 6:59 AM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; nick...@nvidia.com;
> > ig...@ami.com; Mike Maslenkin 
> > Subject: [PATCH v3 0/16] Redfish related fixes and improvements
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > This is an expanded version of the original set of 9 patches with
> > additional patch introducing brackets for IPv6 Redfish resource location
> > with required changes according to comments for the initial RFC patch.
> >
> > PR: https://github.com/tianocore/edk2/pull/5149
> >
> > diff from v2:
> >   added Abner's R-b
> >   refined copyrights
> >   added additional patches [13-14] deallocating stings stored in
> > EFI_REDFISH_DISCOVERED_INFORMATION
> >   changed const to CONST in intermediate patches (patch 10)
> >   reworked Product and ProductVer strings handling in accordance with the
> > comments
> >   removed IpAddress local variable in the last patch
> >
> > diff from v1:
> >  fixed typo double "that that"
> >  removed variable declaration in block scope
> >  added patches 10-13
> >  removed unnecessary casts
> >  added checks for memory allocation result
> >
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Signed-off-by: Mike Maslenkin 
> >
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112926): https://edk2.groups.io/g/devel/message/112926
Mute This Topic: https://groups.io/mt/103354119/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions.

2023-12-24 Thread Mike Maslenkin
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4625

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 89 ---
 1 file changed, 78 insertions(+), 11 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index bbd1f4b86400..1022ab090df8 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -791,38 +791,105 @@ InitInformationData (
   if (RedfishLocation != NULL) {
 AllocationSize= AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
 Information->Location = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
+if (Information->Location != NULL) {
+  AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
+  DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service location: %a.\n",
+__func__,
+RedfishLocation
+));
+}
   }
 
   if (Uuid != NULL) {
 AllocationSize= AsciiStrSize (Uuid) * sizeof (CHAR16);
 Information->Uuid = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+if (Information->Uuid != NULL) {
+  AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
+  DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Service UUID: %a.\n",
+__func__,
+Uuid
+));
+}
   }
 
   if (Os != NULL) {
 AllocationSize  = AsciiStrSize (Os) * sizeof (CHAR16);
 Information->Os = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
+if (Information->Os != NULL) {
+  AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service OS: %a.\n",
+__func__,
+Os
+));
+}
   }
 
   if (OsVer != NULL) {
 AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
 Information->OsVersion = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
+if (Information->OsVersion != NULL) {
+  AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
+  DEBUG ((
+DEBUG_MANAGEABILITY,
+"Redfish service OS: %s, Version:%s.\n",
+Information->Os,
+Information->OsVersion
+));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish OS Version:%a.\n",
+__func__,
+OsVer
+));
+}
   }
 
-  if ((Product != NULL) && (ProductVer != NULL)) {
+  if (Product != NULL) {
 AllocationSize   = AsciiStrSize (Product) * sizeof (CHAR16);
 Information->Product = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+if (Information->Product != NULL) {
+  AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service product: %a.\n",
+__func__,
+Product
+));
+}
+  }
+
+  if (ProductVer != NULL) {
 AllocationSize  = AsciiStrSize (ProductVer) * sizeof (CHAR16);
 Information->ProductVer = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, 
AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
+if (Information->ProductVer != NULL) {
+  AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, 
AllocationSize);
+  DEBUG ((
+DEBUG_MANAGEABILITY,
+"Redfish service product: %s, Version:%s.\n",
+Information->Product,
+Information->ProductVer
+));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service product Version: 
%a.\n&quo

[edk2-devel] [PATCH v3 12/16] RedfishDiscoverDxe: refine InitInformationData() function

2023-12-24 Thread Mike Maslenkin
Cache size of ASCII string in local variable.

Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 34 ---
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 0ac41f09559b..76f87e4fe5e7 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -738,39 +738,47 @@ InitInformationData (
   IN CONST CHAR8 *ProductVer OPTIONAL
   )
 {
+  UINTN  AllocationSize;
+
   if (RedfishVersion != NULL) {
 Information->RedfishVersion = *RedfishVersion;
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", 
Information->RedfishVersion));
   }
 
   if (RedfishLocation != NULL) {
-Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) * 
sizeof (CHAR16));
-AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
+AllocationSize= AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+Information->Location = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
   }
 
   if (Uuid != NULL) {
-Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * 
sizeof (CHAR16));
+AllocationSize= AsciiStrSize (Uuid) * sizeof (CHAR16);
+Information->Uuid = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
 DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
   }
 
   if (Os != NULL) {
-Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof 
(CHAR16));
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
+AllocationSize  = AsciiStrSize (Os) * sizeof (CHAR16);
+Information->Os = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
   }
 
   if (OsVer != NULL) {
-Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof 
(CHAR16));
-AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer) 
* sizeof (CHAR16));
+AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
+Information->OsVersion = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
   }
 
   if ((Product != NULL) && (ProductVer != NULL)) {
-Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof 
(CHAR16));
-AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize 
(Product) * sizeof (CHAR16));
-Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof 
(CHAR16));
-AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize 
(ProductVer) * sizeof (CHAR16));
+AllocationSize   = AsciiStrSize (Product) * sizeof (CHAR16);
+Information->Product = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+AllocationSize  = AsciiStrSize (ProductVer) * sizeof (CHAR16);
+Information->ProductVer = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, 
AllocationSize);
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
   }
 }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112871): https://edk2.groups.io/g/devel/message/112871
Mute This Topic: https://groups.io/mt/103354131/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses

2023-12-24 Thread Mike Maslenkin
URI is generated based on the RedfishLocation containing an ASCII string
representing the IP address. So, in the case of IPv4 the canonical
representation of an IPv4 address was inserted into the resulting Unicode
string i.e: "http{,s}://X.X.X.X/".

In the case of IPv6, to access resources, the IP address must be specified
in brackets, i.e. the resulting string should look like:
  "http{,s}://[X::X:X:X:X]/".

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 1022ab090df8..238039b57717 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -759,6 +759,7 @@ FreeInformationData (
   The function initializes particular strings into the structure instance.
 
   @param[in]  Information   EFI_REDFISH_DISCOVERED_INFORMATION
+  @param[in]  IsIpv6Flag indicating IP version 6 protocol is 
used
   @param[in]  RedfishVersionRedfish version.
   @param[in]  RedfishLocation   Redfish location.
   @param[in]  Uuid  Service UUID string.
@@ -772,6 +773,7 @@ STATIC
 VOID
 InitInformationData (
   IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
+  IN BOOLEAN IsIpv6,
   IN UINTN   *RedfishVersion OPTIONAL,
   IN CONST CHAR8 *RedfishLocation OPTIONAL,
   IN CONST CHAR8 *Uuid OPTIONAL,
@@ -789,10 +791,20 @@ InitInformationData (
   }
 
   if (RedfishLocation != NULL) {
-AllocationSize= AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+
+if (IsIpv6) {
+  AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
+}
+
 Information->Location = AllocatePool (AllocationSize);
 if (Information->Location != NULL) {
-  AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
+  if (IsIpv6) {
+UnicodeSPrintAsciiFormat (Information->Location, AllocationSize, 
"[%a]", RedfishLocation);
+  } else {
+AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
+  }
+
   DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
 } else {
   DEBUG ((
@@ -1038,6 +1050,7 @@ AddAndSignalNewRedfishService (
 
 InitInformationData (
   &DiscoveredInstance->Information,
+  CheckIsIpVersion6 (NetworkInterface),
   RedfishVersion,
   RedfishLocation,
   Uuid,
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112875): https://edk2.groups.io/g/devel/message/112875
Mute This Topic: https://groups.io/mt/103354135/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources.

2023-12-24 Thread Mike Maslenkin
This patch adds a handy helper function deallocating resources from the
EFI_REDFISH_DISCOVERED_INFORMATION structure instance.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 68 ---
 1 file changed, 44 insertions(+), 24 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 76f87e4fe5e7..ff0c3ff1d1f5 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -712,6 +712,49 @@ DiscoverRedfishHostInterface (
   return Status;
 }
 
+/**
+  The function releases particular strings into the structure instance.
+
+  @param[in]  Information   EFI_REDFISH_DISCOVERED_INFORMATION
+
+**/
+STATIC
+VOID
+FreeInformationData (
+  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information
+  )
+{
+  if (Information->Location != NULL) {
+FreePool (Information->Location);
+Information->Location = NULL;
+  }
+
+  if (Information->Uuid != NULL) {
+FreePool (Information->Uuid);
+Information->Uuid = NULL;
+  }
+
+  if (Information->Os != NULL) {
+FreePool (Information->Os);
+Information->Os = NULL;
+  }
+
+  if (Information->OsVersion != NULL) {
+FreePool (Information->OsVersion);
+Information->OsVersion = NULL;
+  }
+
+  if (Information->Product != NULL) {
+FreePool (Information->Product);
+Information->Product = NULL;
+  }
+
+  if (Information->ProductVer != NULL) {
+FreePool (Information->ProductVer);
+Information->ProductVer = NULL;
+  }
+}
+
 /**
   The function initializes particular strings into the structure instance.
 
@@ -1514,30 +1557,7 @@ RedfishServiceReleaseService (
 do {
   if (DiscoveredRedfishInstance->Instance == ThisRedfishInstance) {
 RemoveEntryList (&DiscoveredRedfishInstance->NextInstance);
-if (ThisRedfishInstance->Information.Location != NULL) {
-  FreePool (ThisRedfishInstance->Information.Location);
-}
-
-if (ThisRedfishInstance->Information.Uuid != NULL) {
-  FreePool (ThisRedfishInstance->Information.Uuid);
-}
-
-if (ThisRedfishInstance->Information.Os != NULL) {
-  FreePool (ThisRedfishInstance->Information.Os);
-}
-
-if (ThisRedfishInstance->Information.OsVersion != NULL) {
-  FreePool (ThisRedfishInstance->Information.OsVersion);
-}
-
-if (ThisRedfishInstance->Information.Product != NULL) {
-  FreePool (ThisRedfishInstance->Information.Product);
-}
-
-if (ThisRedfishInstance->Information.ProductVer != NULL) {
-  FreePool (ThisRedfishInstance->Information.ProductVer);
-}
-
+FreeInformationData (&ThisRedfishInstance->Information);
 FreePool ((VOID *)ThisRedfishInstance);
 goto ReleaseNext;
   }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112872): https://edk2.groups.io/g/devel/message/112872
Mute This Topic: https://groups.io/mt/103354132/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data

2023-12-24 Thread Mike Maslenkin
It is required to free previously allocated strings stored in
DiscoveredInstance->Information structure.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index ff0c3ff1d1f5..bbd1f4b86400 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -961,6 +961,8 @@ AddAndSignalNewRedfishService (
 FreePool ((VOID *)DiscoveredList);
 return EFI_OUT_OF_RESOURCES;
   }
+} else {
+  FreeInformationData (&DiscoveredInstance->Information);
 }
 
 DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information ***\n"));
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112873): https://edk2.groups.io/g/devel/message/112873
Mute This Topic: https://groups.io/mt/103354133/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function

2023-12-24 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 108 --
 1 file changed, 74 insertions(+), 34 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index e344e06d8dcc..7aa68b54a61b 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -6,6 +6,7 @@
   Copyright (c) 2022, AMD Incorporated. 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  
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -711,6 +712,69 @@ DiscoverRedfishHostInterface (
   return Status;
 }
 
+/**
+  The function initializes particular strings into the structure instance.
+
+  @param[in]  Information   EFI_REDFISH_DISCOVERED_INFORMATION
+  @param[in]  RedfishVersionRedfish version.
+  @param[in]  RedfishLocation   Redfish location.
+  @param[in]  Uuid  Service UUID string.
+  @param[in]  OsOS string.
+  @param[in]  OsVer OS version string.
+  @param[in]  Product   Product string.
+  @param[in]  ProductVerProduct version string.
+
+**/
+STATIC
+VOID
+InitInformationData (
+  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
+  IN UINTN   *RedfishVersion OPTIONAL,
+  IN CHAR8   *RedfishLocation OPTIONAL,
+  IN CHAR8   *Uuid  OPTIONAL,
+  IN CHAR8   *Os  OPTIONAL,
+  IN CHAR8   *OsVer  OPTIONAL,
+  IN CHAR8   *Product  OPTIONAL,
+  IN CHAR8   *ProductVer  OPTIONAL
+  )
+{
+  if (RedfishVersion != NULL) {
+Information->RedfishVersion = *RedfishVersion;
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", 
Information->RedfishVersion));
+  }
+
+  if (RedfishLocation != NULL) {
+Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 
*)RedfishLocation) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((CONST CHAR8 *)RedfishLocation, 
Information->Location, AsciiStrSize ((CONST CHAR8 *)RedfishLocation) * sizeof 
(CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
+  }
+
+  if (Uuid != NULL) {
+Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 
*)Uuid) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((CONST CHAR8 *)Uuid, Information->Uuid, 
AsciiStrSize ((CONST CHAR8 *)Uuid) * sizeof (CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+  }
+
+  if (Os != NULL) {
+Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)Os) 
* sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((CONST CHAR8 *)Os, Information->Os, AsciiStrSize 
((CONST CHAR8 *)Os) * sizeof (CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
+  }
+
+  if (OsVer != NULL) {
+Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST 
CHAR8 *)OsVer) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((CONST CHAR8 *)OsVer, Information->OsVersion, 
AsciiStrSize ((CONST CHAR8 *)OsVer) * sizeof (CHAR16));
+  }
+
+  if ((Product != NULL) && (ProductVer != NULL)) {
+Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 
*)Product) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((CONST CHAR8 *)Product, Information->Product, 
AsciiStrSize ((CONST CHAR8 *)Product) * sizeof (CHAR16));
+Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST 
CHAR8 *)ProductVer) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((CONST CHAR8 *)ProductVer, Information->ProductVer, 
AsciiStrSize ((CONST CHAR8 *)ProductVer) * sizeof (CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
+  }
+}
+
 /**
   The function adds a new found Redfish service to internal list and
   notify client.
@@ -851,41 +915,17 @@ AddAndSignalNewRedfishService (
 DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information ***\n"));
 
 DiscoveredInstance->Information.UseHttps = UseHttps;
-if (RedfishVersion != NULL) {
-  DiscoveredInstance->Information.RedfishVersion = *RedfishVersion;
-  DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", 
DiscoveredInstance->Information.RedfishVersion));
-}
 
-if (RedfishLocation != NULL) {
-  DiscoveredInstance->Information.Location

[edk2-devel] [PATCH v3 11/16] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts

2023-12-24 Thread Mike Maslenkin
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Pedro Falcato 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 36 +--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 7aa68b54a61b..0ac41f09559b 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -730,12 +730,12 @@ VOID
 InitInformationData (
   IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
   IN UINTN   *RedfishVersion OPTIONAL,
-  IN CHAR8   *RedfishLocation OPTIONAL,
-  IN CHAR8   *Uuid  OPTIONAL,
-  IN CHAR8   *Os  OPTIONAL,
-  IN CHAR8   *OsVer  OPTIONAL,
-  IN CHAR8   *Product  OPTIONAL,
-  IN CHAR8   *ProductVer  OPTIONAL
+  IN CONST CHAR8 *RedfishLocation OPTIONAL,
+  IN CONST CHAR8 *Uuid OPTIONAL,
+  IN CONST CHAR8 *Os OPTIONAL,
+  IN CONST CHAR8 *OsVer OPTIONAL,
+  IN CONST CHAR8 *Product OPTIONAL,
+  IN CONST CHAR8 *ProductVer OPTIONAL
   )
 {
   if (RedfishVersion != NULL) {
@@ -744,33 +744,33 @@ InitInformationData (
   }
 
   if (RedfishLocation != NULL) {
-Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 
*)RedfishLocation) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((CONST CHAR8 *)RedfishLocation, 
Information->Location, AsciiStrSize ((CONST CHAR8 *)RedfishLocation) * sizeof 
(CHAR16));
+Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) * 
sizeof (CHAR16));
+AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
   }
 
   if (Uuid != NULL) {
-Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 
*)Uuid) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((CONST CHAR8 *)Uuid, Information->Uuid, 
AsciiStrSize ((CONST CHAR8 *)Uuid) * sizeof (CHAR16));
+Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * 
sizeof (CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
   }
 
   if (Os != NULL) {
-Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)Os) 
* sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((CONST CHAR8 *)Os, Information->Os, AsciiStrSize 
((CONST CHAR8 *)Os) * sizeof (CHAR16));
+Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof 
(CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
   }
 
   if (OsVer != NULL) {
-Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST 
CHAR8 *)OsVer) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((CONST CHAR8 *)OsVer, Information->OsVersion, 
AsciiStrSize ((CONST CHAR8 *)OsVer) * sizeof (CHAR16));
+Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof 
(CHAR16));
+AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer) 
* sizeof (CHAR16));
   }
 
   if ((Product != NULL) && (ProductVer != NULL)) {
-Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 
*)Product) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((CONST CHAR8 *)Product, Information->Product, 
AsciiStrSize ((CONST CHAR8 *)Product) * sizeof (CHAR16));
-Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST 
CHAR8 *)ProductVer) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((CONST CHAR8 *)ProductVer, Information->ProductVer, 
AsciiStrSize ((CONST CHAR8 *)ProductVer) * sizeof (CHAR16));
+Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof 
(CHAR16));
+AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize 
(Product) * sizeof (CHAR16));
+Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof 
(CHAR16));
+AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize 
(ProductVer) * sizeof (CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
   }
 }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply O

[edk2-devel] [PATCH v3 09/16] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable

2023-12-24 Thread Mike Maslenkin
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../RedfishPlatformHostInterfaceLib.c   | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
 
b/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
index 4332caa71016..71b3dfc64358 100644
--- 
a/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
+++ 
b/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
@@ -42,12 +42,10 @@ GetMacAddressInformation (
   OUT EFI_MAC_ADDRESS  *MacAddress
   )
 {
-  MAC_ADDR_DEVICE_PATH  *Mac;
   REST_EX_SERVICE_DEVICE_PATH_DATA  *RestExServiceDevicePathData;
   EFI_DEVICE_PATH_PROTOCOL  *RestExServiceDevicePath;
   MAC_ADDR_DEVICE_PATH  *MacAddressDevicePath;
 
-  Mac = NULL;
   RestExServiceDevicePathData = NULL;
   RestExServiceDevicePath = NULL;
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112868): https://edk2.groups.io/g/devel/message/112868
Mute This Topic: https://groups.io/mt/103354128/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 07/16] RedfishPkg: add proper initialization of IPMI request

2023-12-24 Thread Mike Maslenkin
All fields of IPMI_CHANNEL_INFO_CHANNEL_NUMBER union must be
initialized to avoid error condition on BMC side.

Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../PlatformHostInterfaceBmcUsbNicLib.c   | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index 7f295fe7f1c0..c73e76df5791 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -616,9 +616,10 @@ HostInterfaceIpmiCheckMacAddress (
   }
 
   // Initial the get MAC address request.
-  GetLanConfigReq.SetSelector   = 0;
-  GetLanConfigReq.BlockSelector = 0;
-  GetLanConfigReq.ParameterSelector = IpmiLanMacAddress;
+  GetLanConfigReq.ChannelNumber.Uint8 = 0;
+  GetLanConfigReq.SetSelector = 0;
+  GetLanConfigReq.BlockSelector   = 0;
+  GetLanConfigReq.ParameterSelector   = IpmiLanMacAddress;
 
   ExitStatus = EFI_NOT_FOUND;
   for (ChannelNum = IPMI_CHANNEL_NUMBER_IMPLEMENTATION_SPECIFIC_1;
@@ -640,6 +641,7 @@ HostInterfaceIpmiCheckMacAddress (
 } else {
   DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "  No cached IPMI LAN info\n"));
   DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "  Send NetFn = App, Command = 
0x42 to channel %d\n", ChannelNum));
+  GetChanelInfoRequest.ChannelNumber.Uint8  = 0;
   GetChanelInfoRequest.ChannelNumber.Bits.ChannelNo = (UINT8)ChannelNum;
   Status= IpmiGetChannelInfo (
 
&GetChanelInfoRequest,
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112866): https://edk2.groups.io/g/devel/message/112866
Mute This Topic: https://groups.io/mt/103354126/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 08/16] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService

2023-12-24 Thread Mike Maslenkin
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 EmulatorPkg/EmulatorPkg.dec  |  8 
 .../RedfishPlatformCredentialLib.c   | 12 ++--
 .../RedfishPlatformCredentialLib.inf |  8 
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
index fe81652b0478..c2a92923e9b7 100644
--- a/EmulatorPkg/EmulatorPkg.dec
+++ b/EmulatorPkg/EmulatorPkg.dec
@@ -77,15 +77,15 @@
   ## Platform level Redfish Service control PCD
   # These PCDs are used to stop the Redfish sevice when secure boot is disabled
   # or exit boot service.
-  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfSecureBootDisabled|TRUE|BOOLEAN|0x1020
-  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfExitbootService|TRUE|BOOLEAN|0x1021
+  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfSecureBootDisabled|TRUE|BOOLEAN|0x1020
+  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfExitbootService|TRUE|BOOLEAN|0x1021
   ##
   # edk2 Redfish implementation on Emulator package is designed to access
   # to Redfish simulator.
   # https://github.com/DMTF/Redfish-Profile-Simulator
   # The user ID and password are fixed as below.
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieUserId|"admin"|VOID*|0x1022
-  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiePassword|"pwd123456"|VOID*|0x1023
+  gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceUserId|"admin"|VOID*|0x1022
+  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServicePassword|"pwd123456"|VOID*|0x1023
   
gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize|0x400|UINT32|0x1024
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
diff --git 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
index 614eaebb0d0e..5c167fcdea56 100644
--- 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
+++ 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
@@ -57,8 +57,8 @@ GetRedfishCredential (
   //
   // User ID and Password.
   //
-  UserIdSize   = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServieUserId));
-  PasswordSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServiePassword));
+  UserIdSize   = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServiceUserId));
+  PasswordSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServicePassword));
   if ((UserIdSize == 0) || (PasswordSize == 0)) {
 DEBUG ((DEBUG_ERROR, "Incorrect string of UserID or Password for REdfish 
service.\n"));
 return EFI_INVALID_PARAMETER;
@@ -69,7 +69,7 @@ GetRedfishCredential (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServieUserId), UserIdSize);
+  CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServiceUserId), UserIdSize);
 
   *Password = AllocateZeroPool (PasswordSize);
   if (*Password == NULL) {
@@ -77,7 +77,7 @@ GetRedfishCredential (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  CopyMem (*Password, (CHAR8 *)PcdGetPtr (PcdRedfishServiePassword), 
PasswordSize);
+  CopyMem (*Password, (CHAR8 *)PcdGetPtr (PcdRedfishServicePassword), 
PasswordSize);
   return EFI_SUCCESS;
 }
 
@@ -177,7 +177,7 @@ LibStopRedfishService (
 // Check platform PCD to determine the action for stopping
 // Redfish service due to secure boot is disabled.
 //
-if (!PcdGetBool (PcdRedfishServieStopIfSecureBootDisabled)) {
+if (!PcdGetBool (PcdRedfishServiceStopIfSecureBootDisabled)) {
   return EFI_UNSUPPORTED;
 } else {
   //
@@ -198,7 +198,7 @@ LibStopRedfishService (
 // Check platform PCD to determine the action for stopping
 // Redfish service due to exit boot service.
 //
-if (PcdGetBool (PcdRedfishServieStopIfExitbootService)) {
+if (PcdGetBool (PcdRedfishServiceStopIfExitbootService)) {
   return EFI_UNSUPPORTED;
 } else {
   mStopRedfishService = TRUE;
diff --git 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
index 41c389c4a292..9d151f14ee17 100644
--- 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
+++ 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
@@ -36,10 +36,10 @@
   UefiLib
 
 [Pcd]
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfSecureBootDisabled ## 
CONSUMES
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfExitbootService## 
CONSUMES
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieUserId   ## 
CONSUMES
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServiePassword ## 
CONSUMES
+  gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfSecureBootDisabled ## 
CONSUMES
+  gEmulatorPkgTokenSpaceGuid.PcdR

[edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver

2023-12-24 Thread Mike Maslenkin
Currently there is no description for RedfishConfigHandler driver.
This leads to  in the "DRIVER NAME" column of a `drivers`
command for example.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishConfigHandler/ComponentName.c  | 218 ++
 .../RedfishConfigHandlerDriver.c  |  10 +-
 .../RedfishConfigHandlerDriver.h  |   4 +-
 .../RedfishConfigHandlerDriver.inf|   1 +
 4 files changed, 230 insertions(+), 3 deletions(-)
 create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c

diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c 
b/RedfishPkg/RedfishConfigHandler/ComponentName.c
new file mode 100644
index ..8e19fdb2cde5
--- /dev/null
+++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
@@ -0,0 +1,218 @@
+/** @file
+  Implementation of EFI_COMPONENT_NAME_PROTOCOL and 
EFI_COMPONENT_NAME2_PROTOCOL protocol
+  for EFI Refish Config Handler Protocol
+
+  Copyright (c) 2023, Mike Maslenkin  
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "RedfishConfigHandlerCommon.h"
+
+//
+// EFI Component Name Functions
+//
+
+/**
+  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
+
+  @param[in]  This   A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  Language   A pointer to a three-character ISO 639-2 language 
identifier.
+ This is the language of the driver name that the 
caller
+ is requesting, and it must match one of the languages 
specified
+ in SupportedLanguages.  The number of languages 
supported by a
+ driver is up to the driver writer.
+  @param[out] DriverName A pointer to the Unicode string to return.  This 
Unicode string
+ is the name of the driver specified by This in the 
language
+ specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by 
This
+and the language specified by Language was 
returned
+in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support 
the
+language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishConfigHandlerComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  );
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being managed by an EFI Driver.
+
+  @param[in]  This A pointer to the EFI_COMPONENT_NAME_PROTOCOL 
instance.
+  @param[in]  ControllerHandle The handle of a controller that the driver 
specified by
+   This is managing.  This handle specifies the 
controller
+   whose name is to be returned.
+  @param[in]  ChildHandle  The handle of the child controller to retrieve 
the name
+   of.  This is an optional parameter that may be 
NULL.  It
+   will be NULL for device drivers.  It will also 
be NULL
+   for a bus drivers that wish to retrieve the 
name of the
+   bus controller.  It will not be NULL for a bus 
driver
+   that wishes to retrieve the name of a child 
controller.
+  @param[in]  Language A pointer to a three character ISO 639-2 
language
+   identifier.  This is the language of the 
controller name
+   that the caller is requesting, and it must 
match one
+   of the languages specified in 
SupportedLanguages.  The
+   number of languages supported by a driver is up 
to the
+   driver writer.
+  @param[out]  ControllerName  A pointer to the Unicode string to return.  
This Unicode
+   string is the name of the controller specified 
by
+   ControllerHandle and ChildHandle in the 
language specified
+   by Language, from the point of view of the 
driver specified
+   by This.
+
+  @retval EFI_SUCCESS   The Unicode string for the user-readable name 
in the
+language specified by Language for the driver
+specified by This was returned in DriverName.
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid 
EFI_HANDLE.
+  @retval E

[edk2-devel] [PATCH v3 04/16] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations

2023-12-24 Thread Mike Maslenkin
It's unclear why the new string is allocated as copy of the original
string if its pointer is stored in an array and the original string
is released immediately after the copy is created. All data allocated
in the same pool.

Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index cbc65ba59408..f970e317b3f6 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -2057,9 +2057,7 @@ RedfishPlatformConfigProtocolGetConfigureLang (
 TmpString = HiiGetRedfishString 
(StatementRef->Statement->ParentForm->ParentFormset->HiiHandle, FullSchema, 
StatementRef->Statement->Description);
 ASSERT (TmpString != NULL);
 if (TmpString != NULL) {
-  TmpConfigureLangList[Index] = AllocateCopyPool (StrSize (TmpString), 
TmpString);
-  ASSERT (TmpConfigureLangList[Index] != NULL);
-  FreePool (TmpString);
+  TmpConfigureLangList[Index] = TmpString;
   ++Index;
 }
   }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112863): https://edk2.groups.io/g/devel/message/112863
Mute This Topic: https://groups.io/mt/103354123/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 05/16] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.

2023-12-24 Thread Mike Maslenkin
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 06d8d00da7fb..e344e06d8dcc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -829,6 +829,10 @@ AddAndSignalNewRedfishService (
 } while (TRUE);
   }
 
+  if (Char16Uuid != NULL) {
+FreePool (Char16Uuid);
+  }
+
   if (NewFound || InfoRefresh) {
 if (!InfoRefresh) {
   DiscoveredList = (EFI_REDFISH_DISCOVERED_INTERNAL_LIST 
*)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_INTERNAL_LIST));
@@ -907,10 +911,6 @@ AddAndSignalNewRedfishService (
 }
   }
 
-  if (Char16Uuid != NULL) {
-FreePool ((VOID *)Char16Uuid);
-  }
-
   Status = EFI_SUCCESS;
   if (NewFound || InfoRefresh) {
 //
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112864): https://edk2.groups.io/g/devel/message/112864
Mute This Topic: https://groups.io/mt/103354124/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 03/16] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h

2023-12-24 Thread Mike Maslenkin
It seems that initial implementation of this header file is based on
CrtLibSupport.h from CryptoPkg. But uid, euid, gid, egid and sa_family_t
sre not used in RedfishPkg. So remove them.

Also take "true" and "false" definition from MdePkg's LibFdtSupport.h
header file, that also seems based on a header mentioned above.

Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 RedfishPkg/Include/Library/RedfishCrtLib.h | 45 ++
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/RedfishPkg/Include/Library/RedfishCrtLib.h 
b/RedfishPkg/Include/Library/RedfishCrtLib.h
index ac6c5162ad6a..0c51a03d0e1a 100644
--- a/RedfishPkg/Include/Library/RedfishCrtLib.h
+++ b/RedfishPkg/Include/Library/RedfishCrtLib.h
@@ -69,20 +69,17 @@
 //
 // Basic types mapping
 //
-typedef UINTN   size_t;
-typedef INTNssize_t;
-typedef INT32   time_t;
-typedef UINT8   __uint8_t;
-typedef UINT8   sa_family_t;
-typedef UINT32  uid_t;
-typedef UINT32  gid_t;
-typedef INT32   int32_t;
-typedef UINT32  uint32_t;
-typedef UINT16  uint16_t;
-typedef UINT8   uint8_t;
-typedef enum {
-  false, true
-} bool;
+typedef UINTNsize_t;
+typedef INTN ssize_t;
+typedef INT32time_t;
+typedef INT32int32_t;
+typedef UINT32   uint32_t;
+typedef UINT16   uint16_t;
+typedef UINT8uint8_t;
+typedef BOOLEAN  bool;
+
+#define true   (1 == 1)
+#define false  (1 == 0)
 
 //
 // File operations are not required for EFI building,
@@ -343,26 +340,6 @@ fgetc   (
   FILE  *_File
   );
 
-uid_t
-getuid  (
-  void
-  );
-
-uid_t
-geteuid (
-  void
-  );
-
-gid_t
-getgid  (
-  void
-  );
-
-gid_t
-getegid (
-  void
-  );
-
 void
 qsort   (
   void *,
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112862): https://edk2.groups.io/g/devel/message/112862
Mute This Topic: https://groups.io/mt/103354122/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 02/16] RedfishPkg: fix RedfishPlatformCredentialLib library class name typo.

2023-12-24 Thread Mike Maslenkin
RedfishPlatformCredentialIpmiLib is the library instance name not the
class name.

Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../RedfishPlatformCredentialIpmiLib.inf| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
index 5c20ea22f894..935461e1dcd0 100644
--- 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
+++ 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
@@ -13,7 +13,7 @@
   FILE_GUID  = 9C45D622-4C66-417F-814C-F76246D97233
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = RedfishPlatformCredentialIpmiLib
+  LIBRARY_CLASS  = RedfishPlatformCredentialLib
 
 [Sources]
   RedfishPlatformCredentialIpmiLib.c
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112861): https://edk2.groups.io/g/devel/message/112861
Mute This Topic: https://groups.io/mt/103354121/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements

2023-12-24 Thread Mike Maslenkin
This is an expanded version of the original set of 9 patches with
additional patch introducing brackets for IPv6 Redfish resource location
with required changes according to comments for the initial RFC patch.

PR: https://github.com/tianocore/edk2/pull/5149

diff from v2:
  added Abner's R-b
  refined copyrights
  added additional patches [13-14] deallocating stings stored in 
EFI_REDFISH_DISCOVERED_INFORMATION
  changed const to CONST in intermediate patches (patch 10)
  reworked Product and ProductVer strings handling in accordance with the 
comments
  removed IpAddress local variable in the last patch

diff from v1:
 fixed typo double "that that"
 removed variable declaration in block scope
 added patches 10-13
 removed unnecessary casts
 added checks for memory allocation result

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112859): https://edk2.groups.io/g/devel/message/112859
Mute This Topic: https://groups.io/mt/103354119/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 01/16] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo.

2023-12-24 Thread Mike Maslenkin
PlatformHostInterfaceBmcUsbNicLib is the library instance name not
the class name.

Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Abner Chang 
---
 .../PlatformHostInterfaceBmcUsbNicLib.inf   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
index 838a1721a7ae..3660249a3588 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
@@ -14,7 +14,7 @@
   FILE_GUID  = C4837B58-225E-4352-8FDC-4C52A5D65891
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = PlatformHostInterfaceBmcUsbNicLib
+  LIBRARY_CLASS  = RedfishPlatformHostInterfaceLib
 
 [Sources]
   PlatformHostInterfaceBmcUsbNicLib.c
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112860): https://edk2.groups.io/g/devel/message/112860
Mute This Topic: https://groups.io/mt/103354120/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v3 3/3] RedfishClientPkg: fix access to unitialized variable.

2023-12-22 Thread Mike Maslenkin
It is possible that at the time of accessing to AsciiLocation pointer
the memory is not allocated.

Also gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) emits a warning for
this case:

RedfishFeatureUtilityLib.c:1889:37: error: 'AsciiLocation' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
   *Location = StrAsciiToUnicode (AsciiLocation);

Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Nickle Wang 
Reviewed-by: Abner Chang 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c| 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 0f0b050d7eba..01c054ae3b70 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1856,7 +1856,8 @@ GetEtagAndLocation (
   }
 
   if (Location != NULL) {
-*Location = NULL;
+*Location = NULL;
+AsciiLocation = NULL;
 
 if (*(Response->StatusCode) == HTTP_STATUS_200_OK) {
   Header = HttpFindHeader (Response->HeaderCount, Response->Headers, 
HTTP_HEADER_LOCATION);
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112851): https://edk2.groups.io/g/devel/message/112851
Mute This Topic: https://groups.io/mt/103326962/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v3 2/3] RedfishClientPkg: fix typo in EfiRestJsonStructureProtocolIsReady

2023-12-22 Thread Mike Maslenkin
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Nickle Wang 
Reviewed-by: Abner Chang 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index 8b9bdc313832..85dc546120e2 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -562,7 +562,7 @@ EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL  
mRedfishConfigHandler = {
 **/
 VOID
 EFIAPI
-EfiRestJasonStructureProtocolIsReady (
+EfiRestJsonStructureProtocolIsReady (
   IN  EFI_EVENT  Event,
   IN  VOID   *Context
   )
@@ -829,7 +829,7 @@ RedfishResourceEntryPoint (
   EfiCreateProtocolNotifyEvent (
 &gEfiRestJsonStructureProtocolGuid,
 TPL_CALLBACK,
-EfiRestJasonStructureProtocolIsReady,
+EfiRestJsonStructureProtocolIsReady,
 NULL,
 &Registration
 );
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112850): https://edk2.groups.io/g/devel/message/112850
Mute This Topic: https://groups.io/mt/103326961/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v3 0/3] change method for provisioning + minor fixes

2023-12-22 Thread Mike Maslenkin
This patch set contains minor fixes.
I have not added any copyrights as I have nothing to claim in this set.

diff from v2:
added Abner's RB tag

diff from v1:
original patch 4/4 with change related to BIOS resources provisioning removed.

PR: https://github.com/tianocore/edk2-redfish-client/pull/64

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112848): https://edk2.groups.io/g/devel/message/112848
Mute This Topic: https://groups.io/mt/103326959/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v3 1/3] RedfishClientPkg: add check for NULL pointer to avoid ASSERT

2023-12-22 Thread Mike Maslenkin
Initially RedfishPlatformConfigGetConfigureLang could return success
even if ConfigureLangList is empty. After fixing this condition,
RedfishPlatformConfigGetConfigureLang returns an error, but this doesn't
help to avoid ASSERT because the error path is the same as for non-empty
list.

Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Nickle Wang 
Reviewed-by: Abner Chang 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 4cb7621c25c4..0f0b050d7eba 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -3118,7 +3118,9 @@ LeaveFunction:
 FreePool (ConfigureLangBuffer);
   }
 
-  FreePool (ConfigureLangList);
+  if (ConfigureLangList != NULL) {
+FreePool (ConfigureLangList);
+  }
 
   *NumberOfValues = (UINT32)ListCount;
   return FirstEmptyPropKeyValueList;
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112849): https://edk2.groups.io/g/devel/message/112849
Mute This Topic: https://groups.io/mt/103326960/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses

2023-12-18 Thread Mike Maslenkin
Hi Abner,

On Mon, Dec 18, 2023 at 7:58 AM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Friday, December 15, 2023 7:25 AM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; nick...@nvidia.com;
> > ig...@ami.com; Mike Maslenkin 
> > Subject: [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to
> > URI for IPv6 addresses
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > URI is generated based on the RedfishLocation containing an ASCII string
> > representing the IP address. So, in the case of IPv4 the canonical
> > representation of an IPv4 address was inserted into the resulting Unicode
> > string i.e: "http{,s}://X.X.X.X/".
> >
> > In the case of IPv6, to access resources, the IP address must be specified
> > in brackets, i.e. the resulting string should look like:
> >   "http{,s}://[X::X:X:X:X]/".
> >
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Signed-off-by: Mike Maslenkin 
> > ---
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 21 ---
> >  1 file changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 9d1678c3429e..38eaf4f6decc 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > @@ -715,6 +715,7 @@ DiscoverRedfishHostInterface (
> >The function initalizes particular strings into
> > EFI_REDFISH_DISCOVERED_INFORMATION structure
> >
> >
> >
> >@param[in]  Information   EFI_REDFISH_DISCOVERED_INFORMATION
> >
> > +  @param[in]  IsIpv6Flag indicating IP version 6 protocol 
> > is used
> >
> >@param[in]  RedfishVersionRedfish version.
> >
> >@param[in]  RedfishLocation   Redfish location.
> >
> >@param[in]  Uuid  Service UUID string.
> >
> > @@ -729,6 +730,7 @@ STATIC
> >  VOID
> >
> >  InitInformationData (
> >
> >IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
> >
> > +  IN BOOLEAN IsIpv6,
> >
> >IN UINTN   *RedfishVersion OPTIONAL,
> >
> >IN CONST CHAR8 *RedfishLocation OPTIONAL,
> >
> >IN CONST CHAR8 *Uuid OPTIONAL,
> >
> > @@ -738,7 +740,8 @@ InitInformationData (
> >IN CONST CHAR8 *ProductVer OPTIONAL
> >
> >)
> >
> >  {
> >
> > -  UINTN  AllocationSize;
> >
> > +  UINTNAllocationSize;
> >
> > +  CONST CHAR8  *IpAddress;
> >
> >
> >
> >if (RedfishVersion != NULL) {
> >
> >  Information->RedfishVersion = *RedfishVersion;
> >
> > @@ -746,10 +749,21 @@ InitInformationData (
> >}
> >
> >
> >
> >if (RedfishLocation != NULL) {
> >
> > -AllocationSize= AsciiStrSize (RedfishLocation) * sizeof 
> > (CHAR16);
> >
> > +AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
> >
> > +IpAddress  = RedfishLocation;
> Not quite understand why do we need a copy of RedfishLocation in IpAddress?
> I think we can use RedfishLocation for UnicodeSPrintAsciiFormat later, right?

I'll remove IpAddress variable.
It was added into initial RFC as a minimal change reducing a number of
type casts.
It was also added as self-describing code to show we are supposed to
be dealing with RedfishLocation in IP address string format and not
anything else.

> Thanks
> Abner
>
> >
> > +
> >
> > +if (IsIpv6) {
> >
> > +  AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and 
> > ']'
> >
> > +}
> >
> > +
> >
> >  Information->Location = AllocatePool (AllocationSize);
> >
> >  if (Information->Location != NULL) {
> >
> > -  AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > +  if (IsIpv6) {
> >
> > +UnicodeSPrintAsciiFormat (Information->Location, AllocationSize,
> > "[%a]", IpAddress);
> >
> > + 

Re: [edk2-devel] [edk2-redfish-client][PATCH v2 0/3] change method for provisioning + minor fixes

2023-12-18 Thread Mike Maslenkin
Hi Abner,

Ok. I've already done it. But copyright change mentioned is for
another patchset to edk2's RedfishPkg.
Whereas you mentioned  FIRST - LAST, would you like me to add
copyrights for these changes?
I guess LAST is not required for the new added code.
I didn't add any copyrights previously,  so for my case it would be:
Copyright (c)  2023, Contributor  
in any place.

Regard,
Mike.



On Tue, Dec 19, 2023 at 5:04 AM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> Hi Mike,
> According the conversation I had with Rebecca, please update your copyright 
> that follow below format on the later patches you send; as you use the 
> individual contributor copyright.
>
> Copyright (c) FIRST - LAST, Contributor  
>
> Thanks
> Abner
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Tuesday, December 19, 2023 9:00 AM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; nick...@nvidia.com;
> > ig...@ami.com; Mike Maslenkin 
> > Subject: [edk2-redfish-client][PATCH v2 0/3] change method for provisioning
> > + minor fixes
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > This patch set contains minor fixes.
> >
> > diff from v1:
> >  original patch 4/4 with change related to BIOS resources provisioning
> > removed.
> >
> > PR: https://github.com/tianocore/edk2-redfish-client/pull/64
> >
> > Cc: Abner Chang 
> > Cc: Igor Kulchytskyy 
> > Cc: Nickle Wang 
> > Signed-off-by: Mike Maslenkin 
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112666): https://edk2.groups.io/g/devel/message/112666
Mute This Topic: https://groups.io/mt/103255134/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions.

2023-12-18 Thread Mike Maslenkin
Hi Abner,

On Mon, Dec 18, 2023 at 7:47 AM Chang, Abner  wrote:
>
> [AMD Official Use Only - General]
>
> > -Original Message-
> > From: Mike Maslenkin 
> > Sent: Friday, December 15, 2023 7:25 AM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; nick...@nvidia.com;
> > ig...@ami.com; Mike Maslenkin 
> > Subject: [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation
> > error conditions.
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Signed-off-by: Mike Maslenkin 
> > ---
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 85 ---
> >  1 file changed, 75 insertions(+), 10 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 3499a855570c..9d1678c3429e 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > @@ -748,38 +748,103 @@ InitInformationData (
> >if (RedfishLocation != NULL) {
> >
> >  AllocationSize= AsciiStrSize (RedfishLocation) * sizeof 
> > (CHAR16);
> >
> >  Information->Location = AllocatePool (AllocationSize);
> >
> > -AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > -DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > Information->Location));
> >
> > +if (Information->Location != NULL) {
> >
> > +  AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > +  DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > Information->Location));
> >
> > +} else {
> >
> > +  DEBUG ((
> >
> > +DEBUG_ERROR,
> >
> > +"%a: Can not allocate memory for Redfish service location: %a.\n",
> >
> > +__func__,
> >
> > +RedfishLocation
> >
> > +));
> >
> > +}
> >
> >}
> >
> >
> >
> >if (Uuid != NULL) {
> >
> >  AllocationSize= AsciiStrSize (Uuid) * sizeof (CHAR16);
> >
> >  Information->Uuid = AllocatePool (AllocationSize);
> >
> > -AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
> >
> > -DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> > >Uuid));
> >
> > +if (Information->Uuid != NULL) {
> >
> > +  AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
> >
> > +  DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> > >Uuid));
> >
> > +} else {
> >
> > +  DEBUG ((
> >
> > +DEBUG_ERROR,
> >
> > +"%a: Can not allocate memory for Service UUID: %a.\n",
> >
> > +__func__,
> >
> > +Uuid
> >
> > +));
> >
> > +}
> >
> >}
> >
> >
> >
> >if (Os != NULL) {
> >
> >  AllocationSize  = AsciiStrSize (Os) * sizeof (CHAR16);
> >
> >  Information->Os = AllocatePool (AllocationSize);
> >
> > -AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
> >
> > +if (Information->Os != NULL) {
> >
> > +  AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
> >
> > +} else {
> >
> > +  DEBUG ((
> >
> > +DEBUG_ERROR,
> >
> > +"%a: Can not allocate memory for Redfish service OS: %a.\n",
> >
> > +__func__,
> >
> > +Os
> >
> > +));
> >
> > +}
> >
> >}
> >
> >
> >
> >if (OsVer != NULL) {
> >
> >  AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
> >
> >  Information->OsVersion = AllocatePool (AllocationSize);
> >
> > -AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
> >
> > -DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n",
> > Information->Os, Information->OsVersion));
> >
> > +if (Information->OsVersion !=

[edk2-devel] [edk2-redfish-client][PATCH v2 3/3] RedfishClientPkg: fix access to unitialized variable.

2023-12-18 Thread Mike Maslenkin
It is possible that at the time of accessing to AsciiLocation pointer
the memory is not allocated.

Also gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) emits a warning for
this case:

RedfishFeatureUtilityLib.c:1889:37: error: 'AsciiLocation' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
   *Location = StrAsciiToUnicode (AsciiLocation);

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Nickle Wang 

---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c| 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 0f0b050d7eba..01c054ae3b70 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1856,7 +1856,8 @@ GetEtagAndLocation (
   }
 
   if (Location != NULL) {
-*Location = NULL;
+*Location = NULL;
+AsciiLocation = NULL;
 
 if (*(Response->StatusCode) == HTTP_STATUS_200_OK) {
   Header = HttpFindHeader (Response->HeaderCount, Response->Headers, 
HTTP_HEADER_LOCATION);
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112660): https://edk2.groups.io/g/devel/message/112660
Mute This Topic: https://groups.io/mt/103255138/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v2 2/3] RedfishClientPkg: fix typo in EfiRestJsonStructureProtocolIsReady

2023-12-18 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Nickle Wang 

---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index 8b9bdc313832..85dc546120e2 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -562,7 +562,7 @@ EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL  
mRedfishConfigHandler = {
 **/
 VOID
 EFIAPI
-EfiRestJasonStructureProtocolIsReady (
+EfiRestJsonStructureProtocolIsReady (
   IN  EFI_EVENT  Event,
   IN  VOID   *Context
   )
@@ -829,7 +829,7 @@ RedfishResourceEntryPoint (
   EfiCreateProtocolNotifyEvent (
 &gEfiRestJsonStructureProtocolGuid,
 TPL_CALLBACK,
-EfiRestJasonStructureProtocolIsReady,
+EfiRestJsonStructureProtocolIsReady,
 NULL,
 &Registration
 );
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112659): https://edk2.groups.io/g/devel/message/112659
Mute This Topic: https://groups.io/mt/103255137/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v2 0/3] change method for provisioning + minor fixes

2023-12-18 Thread Mike Maslenkin
This patch set contains minor fixes.

diff from v1:
 original patch 4/4 with change related to BIOS resources provisioning removed.

PR: https://github.com/tianocore/edk2-redfish-client/pull/64

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112657): https://edk2.groups.io/g/devel/message/112657
Mute This Topic: https://groups.io/mt/103255134/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH v2 1/3] RedfishClientPkg: add check for NULL pointer to avoid ASSERT

2023-12-18 Thread Mike Maslenkin
Initially RedfishPlatformConfigGetConfigureLang could return success
even if ConfigureLangList is empty. After fixing this condition,
RedfishPlatformConfigGetConfigureLang returns an error, but this doesn't
help to avoid ASSERT because the error path is the same as for non-empty
list.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
Reviewed-by: Nickle Wang 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 4cb7621c25c4..0f0b050d7eba 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -3118,7 +3118,9 @@ LeaveFunction:
 FreePool (ConfigureLangBuffer);
   }
 
-  FreePool (ConfigureLangList);
+  if (ConfigureLangList != NULL) {
+FreePool (ConfigureLangList);
+  }
 
   *NumberOfValues = (UINT32)ListCount;
   return FirstEmptyPropKeyValueList;
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112658): https://edk2.groups.io/g/devel/message/112658
Mute This Topic: https://groups.io/mt/103255135/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method while provisioning new property.

2023-12-17 Thread Mike Maslenkin


> On 18. 12. 2023., at 03:33, Mike Maslenkin via groups.io 
>  wrote:
> 
> 
> Hi Nickle,
> 
>> On 15. 12. 2023., at 04:53, Nickle Wang > <mailto:nick...@nvidia.com>> wrote:
>> 
>> Hi Mike,
>> 
>> Per Redfish specification 7.9 POST(create)
>> 
>> "The POST request is submitted to the resource collection to which the new 
>> resource will belong."
>> 
>> If this is not a collection resource, we cannot use POST method. And 
>> /redfish/v1/Systems/SYS_ID/Bios is not a collection resource. The allowed 
>> method returned from BMC for BIOS resource is usually "GET" and "PUT".
>> 
>> So, I think that the fourth parameter is still FALSE here. But I admit that 
>> the function header below is confusing and did not express above rule 
>> clearly.
>> 
>> /**
>>  Provisioning redfish resource by given URI.
>> 
>>  @param[in]   Schema  Redfish schema information.
>>  @param[in]   Uri Target URI to create resource.
>>  @param[in]   InformationExchange Pointer to RESOURCE_INFORMATION_EXCHANGE.
>>  @param[in]   HttpPostModeTRUE if resource does not exist, HTTP POST 
>> method is used.
>>   FALSE if the resource exist but some of 
>> properties are missing,
>>   HTTP PUT method is used.
>> 
>>  @retval EFI_SUCCESS  Value is returned successfully.
>>  @retval Others   Some error happened.
>> 
>> **/
>> 
>> Below is my suggestion.
>> 
>>  @param[in]   HttpPostModeTRUE if target resource is a member of 
>> collection resource, HTTP POST method is used.
>> FALSE if target 
>> resource is non-collection resource, HTTP PUT method is used.
>> 
>> Do you think this helps to explain the use-case of fourth parameter more 
>> clearly?
>> 
>> Thanks,
>> Nickle
> 
> 
> Seems like more comments need to be changed
> The idea behind this patch is the basis of the current implementation of 
> RedfishClientPkg/Features/Bios/v1_0_9.
> The EdkIIRedfishResourceConfigProvisioning function calls the 
> EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL::Provisioning function,
> this is RedfishResourceProvisioningResource() for this driver[1], then it 
> calls RedfishProvisioningResourceCommon() where the logic
> of this flag is completely changed [2].
> So, for the current implementation of this flag, it is not a choice between 
> POST and PUT, but between POST and PATCH (see [1]).
> May be flag should not be inverted here [3]? 
> The value of FALSE here (you expect PUT to be used) means the following 
> ProvisioningBiosExistResource() function calls
> ProvisioningBiosProperties() with ProvisionMode == TRUE. This ProvisionMode 
> == TRUE forces PropertyChanged set into TRUE,
> so finally ProvisioningBiosProperties() returns success even for elements 
> that do not exist.
> 
> Here I mean elements of /redfish/v1/Systems/{SystemID}/Bios/Attributes. I'm 
> in situation when Attributes exists,
> but it is empty.
> 
> Currently the PUT method is not used anywhere in 
> RedfishClientPkg/Features/Bios and "PUT back to instance" actually performs 
> the PATCH.
> 
> I will drop this patch from the current PR until it becomes clear how this 
> can be improved.

Forgot to add the links:

[1] 
https://github.com/tianocore/edk2-redfish-client/blob/main/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c#L50
[2] 
https://github.com/tianocore/edk2-redfish-client/blob/main/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c#L518
 
<https://github.com/tianocore/edk2-redfish-client/blob/main/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c#L518>
[3] 
https://github.com/tianocore/edk2-redfish-client/blob/main/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c#L68


> 
> Regards,
> Mike.
>> 
>>> -Original Message-
>>> From: Mike Maslenkin >> <mailto:mike.maslen...@gmail.com>>
>>> Sent: Friday, December 15, 2023 8:04 AM
>>> To: devel@edk2.groups.io <mailto:devel@edk2.groups.io>
>>> Cc: abner.ch...@amd.com <mailto:abner.ch...@amd.com>; Nickle Wang 
>>> mailto:nick...@nvidia.com>>;
>>> ig...@ami.com <mailto:ig...@ami.com>; Mike Maslenkin 
>>> mailto:mike.maslen...@gmail.com>>
>>> Subject: [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method
>>> while provisioning new property.
>>> 
>>> External email: Use caution opening links or attachmen

Re: [edk2-devel] [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method while provisioning new property.

2023-12-17 Thread Mike Maslenkin

Hi Nickle,

> On 15. 12. 2023., at 04:53, Nickle Wang  wrote:
> 
> Hi Mike,
> 
> Per Redfish specification 7.9 POST(create)
> 
> "The POST request is submitted to the resource collection to which the new 
> resource will belong."
> 
> If this is not a collection resource, we cannot use POST method. And 
> /redfish/v1/Systems/SYS_ID/Bios is not a collection resource. The allowed 
> method returned from BMC for BIOS resource is usually "GET" and "PUT".
> 
> So, I think that the fourth parameter is still FALSE here. But I admit that 
> the function header below is confusing and did not express above rule clearly.
> 
> /**
>  Provisioning redfish resource by given URI.
> 
>  @param[in]   Schema  Redfish schema information.
>  @param[in]   Uri Target URI to create resource.
>  @param[in]   InformationExchange Pointer to RESOURCE_INFORMATION_EXCHANGE.
>  @param[in]   HttpPostModeTRUE if resource does not exist, HTTP POST 
> method is used.
>   FALSE if the resource exist but some of 
> properties are missing,
>   HTTP PUT method is used.
> 
>  @retval EFI_SUCCESS  Value is returned successfully.
>  @retval Others   Some error happened.
> 
> **/
> 
> Below is my suggestion.
> 
>  @param[in]   HttpPostModeTRUE if target resource is a member of 
> collection resource, HTTP POST method is used.
> FALSE if target 
> resource is non-collection resource, HTTP PUT method is used.
> 
> Do you think this helps to explain the use-case of fourth parameter more 
> clearly?
> 
> Thanks,
> Nickle


Seems like more comments need to be changed
The idea behind this patch is the basis of the current implementation of 
RedfishClientPkg/Features/Bios/v1_0_9.
The EdkIIRedfishResourceConfigProvisioning function calls the 
EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL::Provisioning function,
this is RedfishResourceProvisioningResource() for this driver[1], then it calls 
RedfishProvisioningResourceCommon() where the logic
of this flag is completely changed [2].
So, for the current implementation of this flag, it is not a choice between 
POST and PUT, but between POST and PATCH (see [1]).
May be flag should not be inverted here [3]? 
The value of FALSE here (you expect PUT to be used) means the following 
ProvisioningBiosExistResource() function calls
ProvisioningBiosProperties() with ProvisionMode == TRUE. This ProvisionMode == 
TRUE forces PropertyChanged set into TRUE,
so finally ProvisioningBiosProperties() returns success even for elements that 
do not exist.

Here I mean elements of /redfish/v1/Systems/{SystemID}/Bios/Attributes. I'm in 
situation when Attributes exists,
but it is empty.

Currently the PUT method is not used anywhere in RedfishClientPkg/Features/Bios 
and "PUT back to instance" actually performs the PATCH.

I will drop this patch from the current PR until it becomes clear how this can 
be improved.

Regards,
Mike.
> 
>> -Original Message-
>> From: Mike Maslenkin 
>> Sent: Friday, December 15, 2023 8:04 AM
>> To: devel@edk2.groups.io
>> Cc: abner.ch...@amd.com; Nickle Wang ;
>> ig...@ami.com; Mike Maslenkin 
>> Subject: [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method
>> while provisioning new property.
>> 
>> External email: Use caution opening links or attachments
>> 
>> 
>> If EdkIIRedfishResourceConfigCheck fails according to the logic and
>> comment: new resources should be provisioned, so the POST method must be
>> used. Fourth parameter of EdkIIRedfishResourceConfigProvisioning is BOOLEAN
>> HttpPostMode, so we pass TRUE here.
>> 
>> Cc: Abner Chang 
>> Cc: Igor Kulchytskyy 
>> Cc: Nickle Wang 
>> Signed-off-by: Mike Maslenkin 
>> ---
>> RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> index a26a1083cd74..4fd4845f3420 100644
>> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> @@ -818,9 +818,9 @@ 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 = EdkIIRedfishResourceConfigProvisioning (&

[edk2-devel] [edk2-redfish-client][PATCH 2/4] RedfishClientPkg: fix typo in EfiRestJsonStructureProtocolIsReady

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
index 8b9bdc313832..85dc546120e2 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c
@@ -562,7 +562,7 @@ EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL  
mRedfishConfigHandler = {
 **/
 VOID
 EFIAPI
-EfiRestJasonStructureProtocolIsReady (
+EfiRestJsonStructureProtocolIsReady (
   IN  EFI_EVENT  Event,
   IN  VOID   *Context
   )
@@ -829,7 +829,7 @@ RedfishResourceEntryPoint (
   EfiCreateProtocolNotifyEvent (
 &gEfiRestJsonStructureProtocolGuid,
 TPL_CALLBACK,
-EfiRestJasonStructureProtocolIsReady,
+EfiRestJsonStructureProtocolIsReady,
 NULL,
 &Registration
 );
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112575): https://edk2.groups.io/g/devel/message/112575
Mute This Topic: https://groups.io/mt/103181639/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: fix access to unitialized variable.

2023-12-14 Thread Mike Maslenkin
It is possible that at the time of accessing to AsciiLocation pointer
the memory is not allocated.

Also gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) emits a warning for
this case:

RedfishFeatureUtilityLib.c:1889:37: error: 'AsciiLocation' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
   *Location = StrAsciiToUnicode (AsciiLocation);

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c| 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 0f0b050d7eba..01c054ae3b70 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -1856,7 +1856,8 @@ GetEtagAndLocation (
   }
 
   if (Location != NULL) {
-*Location = NULL;
+*Location = NULL;
+AsciiLocation = NULL;
 
 if (*(Response->StatusCode) == HTTP_STATUS_200_OK) {
   Header = HttpFindHeader (Response->HeaderCount, Response->Headers, 
HTTP_HEADER_LOCATION);
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112576): https://edk2.groups.io/g/devel/message/112576
Mute This Topic: https://groups.io/mt/103181640/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method while provisioning new property.

2023-12-14 Thread Mike Maslenkin
If EdkIIRedfishResourceConfigCheck fails according to the logic and
comment: new resources should be provisioned, so the POST method must be
used. Fourth parameter of EdkIIRedfishResourceConfigProvisioning is
BOOLEAN HttpPostMode, so we pass TRUE here.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index a26a1083cd74..4fd4845f3420 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -818,9 +818,9 @@ 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 = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, 
Private->InformationExchange, FALSE);
+Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, 
Private->InformationExchange, TRUE);
 if (EFI_ERROR (Status)) {
-  DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n", 
__func__, Status));
+  DEBUG ((DEBUG_ERROR, "%a, failed to provision with POST mode: %r\n", 
__func__, Status));
 }
 
 return Status;
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112577): https://edk2.groups.io/g/devel/message/112577
Mute This Topic: https://groups.io/mt/103181641/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 1/4] RedfishClientPkg: add check for NULL pointer to avoid ASSERT

2023-12-14 Thread Mike Maslenkin
Initially RedfishPlatformConfigGetConfigureLang could return success
even if ConfigureLangList is empty. After fixing this condition,
RedfishPlatformConfigGetConfigureLang returns an error, but this doesn't
help to avoid ASSERT because the error path is the same as for non-empty
list.

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 4cb7621c25c4..0f0b050d7eba 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -3118,7 +3118,9 @@ LeaveFunction:
 FreePool (ConfigureLangBuffer);
   }
 
-  FreePool (ConfigureLangList);
+  if (ConfigureLangList != NULL) {
+FreePool (ConfigureLangList);
+  }
 
   *NumberOfValues = (UINT32)ListCount;
   return FirstEmptyPropKeyValueList;
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112574): https://edk2.groups.io/g/devel/message/112574
Mute This Topic: https://groups.io/mt/103181638/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 0/4] change method for provisioning + minor fixes

2023-12-14 Thread Mike Maslenkin
This patch set contains minor fixes and the one major change related
to BIOS resources provisioning.

PR: https://github.com/tianocore/edk2-redfish-client/pull/64

Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112573): https://edk2.groups.io/g/devel/message/112573
Mute This Topic: https://groups.io/mt/103181637/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions.

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 85 ---
 1 file changed, 75 insertions(+), 10 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 3499a855570c..9d1678c3429e 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -748,38 +748,103 @@ InitInformationData (
   if (RedfishLocation != NULL) {
 AllocationSize= AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
 Information->Location = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
+if (Information->Location != NULL) {
+  AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
+  DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service location: %a.\n",
+__func__,
+RedfishLocation
+));
+}
   }
 
   if (Uuid != NULL) {
 AllocationSize= AsciiStrSize (Uuid) * sizeof (CHAR16);
 Information->Uuid = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+if (Information->Uuid != NULL) {
+  AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
+  DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Service UUID: %a.\n",
+__func__,
+Uuid
+));
+}
   }
 
   if (Os != NULL) {
 AllocationSize  = AsciiStrSize (Os) * sizeof (CHAR16);
 Information->Os = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
+if (Information->Os != NULL) {
+  AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service OS: %a.\n",
+__func__,
+Os
+));
+}
   }
 
   if (OsVer != NULL) {
 AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
 Information->OsVersion = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
+if (Information->OsVersion != NULL) {
+  AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
+  DEBUG ((
+DEBUG_MANAGEABILITY,
+"Redfish service OS: %s, Version:%s.\n",
+Information->Os,
+Information->OsVersion
+));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish OS Version:%a.\n",
+__func__,
+OsVer
+));
+}
   }
 
   if ((Product != NULL) && (ProductVer != NULL)) {
 AllocationSize   = AsciiStrSize (Product) * sizeof (CHAR16);
 Information->Product = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+if (Information->Product != NULL) {
+  AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service product: %a.\n",
+__func__,
+Product
+));
+}
+
 AllocationSize  = AsciiStrSize (ProductVer) * sizeof (CHAR16);
 Information->ProductVer = AllocatePool (AllocationSize);
-AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, 
AllocationSize);
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
+if (Information->ProductVer != NULL) {
+  AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, 
AllocationSize);
+  DEBUG ((
+DEBUG_MANAGEABILITY,
+"Redfish service product: %s, Version:%s.\n",
+Information->Product,
+Information->ProductVer
+));
+} else {
+  DEBUG ((
+DEBUG_ERROR,
+"%a: Can not allocate memory for Redfish service product Version: 
%a.\n",
+__func__,
+ProductVer
+));
+}
   }
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=

[edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses

2023-12-14 Thread Mike Maslenkin
URI is generated based on the RedfishLocation containing an ASCII string
representing the IP address. So, in the case of IPv4 the canonical
representation of an IPv4 address was inserted into the resulting Unicode
string i.e: "http{,s}://X.X.X.X/".

In the case of IPv6, to access resources, the IP address must be specified
in brackets, i.e. the resulting string should look like:
  "http{,s}://[X::X:X:X:X]/".

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 21 ---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 9d1678c3429e..38eaf4f6decc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -715,6 +715,7 @@ DiscoverRedfishHostInterface (
   The function initalizes particular strings into 
EFI_REDFISH_DISCOVERED_INFORMATION structure
 
   @param[in]  Information   EFI_REDFISH_DISCOVERED_INFORMATION
+  @param[in]  IsIpv6Flag indicating IP version 6 protocol is 
used
   @param[in]  RedfishVersionRedfish version.
   @param[in]  RedfishLocation   Redfish location.
   @param[in]  Uuid  Service UUID string.
@@ -729,6 +730,7 @@ STATIC
 VOID
 InitInformationData (
   IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
+  IN BOOLEAN IsIpv6,
   IN UINTN   *RedfishVersion OPTIONAL,
   IN CONST CHAR8 *RedfishLocation OPTIONAL,
   IN CONST CHAR8 *Uuid OPTIONAL,
@@ -738,7 +740,8 @@ InitInformationData (
   IN CONST CHAR8 *ProductVer OPTIONAL
   )
 {
-  UINTN  AllocationSize;
+  UINTNAllocationSize;
+  CONST CHAR8  *IpAddress;
 
   if (RedfishVersion != NULL) {
 Information->RedfishVersion = *RedfishVersion;
@@ -746,10 +749,21 @@ InitInformationData (
   }
 
   if (RedfishLocation != NULL) {
-AllocationSize= AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+IpAddress  = RedfishLocation;
+
+if (IsIpv6) {
+  AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
+}
+
 Information->Location = AllocatePool (AllocationSize);
 if (Information->Location != NULL) {
-  AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
+  if (IsIpv6) {
+UnicodeSPrintAsciiFormat (Information->Location, AllocationSize, 
"[%a]", IpAddress);
+  } else {
+AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
+  }
+
   DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
 } else {
   DEBUG ((
@@ -991,6 +1005,7 @@ AddAndSignalNewRedfishService (
 
 InitInformationData (
   &DiscoveredInstance->Information,
+  CheckIsIpVersion6 (NetworkInterface),
   RedfishVersion,
   RedfishLocation,
   Uuid,
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112563): https://edk2.groups.io/g/devel/message/112563
Mute This Topic: https://groups.io/mt/103181051/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function

2023-12-14 Thread Mike Maslenkin
Cache size of ASCII string in local variable.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 34 ---
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index e3fc2d809dbc..3499a855570c 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -738,39 +738,47 @@ InitInformationData (
   IN CONST CHAR8 *ProductVer OPTIONAL
   )
 {
+  UINTN  AllocationSize;
+
   if (RedfishVersion != NULL) {
 Information->RedfishVersion = *RedfishVersion;
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", 
Information->RedfishVersion));
   }
 
   if (RedfishLocation != NULL) {
-Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) * 
sizeof (CHAR16));
-AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
+AllocationSize= AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+Information->Location = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AllocationSize);
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
   }
 
   if (Uuid != NULL) {
-Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * 
sizeof (CHAR16));
+AllocationSize= AsciiStrSize (Uuid) * sizeof (CHAR16);
+Information->Uuid = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
 DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
   }
 
   if (Os != NULL) {
-Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof 
(CHAR16));
-DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
+AllocationSize  = AsciiStrSize (Os) * sizeof (CHAR16);
+Information->Os = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
   }
 
   if (OsVer != NULL) {
-Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof 
(CHAR16));
-AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer) 
* sizeof (CHAR16));
+AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
+Information->OsVersion = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
   }
 
   if ((Product != NULL) && (ProductVer != NULL)) {
-Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof 
(CHAR16));
-AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize 
(Product) * sizeof (CHAR16));
-Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof 
(CHAR16));
-AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize 
(ProductVer) * sizeof (CHAR16));
+AllocationSize   = AsciiStrSize (Product) * sizeof (CHAR16);
+Information->Product = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+AllocationSize  = AsciiStrSize (ProductVer) * sizeof (CHAR16);
+Information->ProductVer = AllocatePool (AllocationSize);
+AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, 
AllocationSize);
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
   }
 }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112561): https://edk2.groups.io/g/devel/message/112561
Mute This Topic: https://groups.io/mt/103181048/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 108 --
 1 file changed, 74 insertions(+), 34 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index e344e06d8dcc..724aa35431a8 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -711,6 +711,69 @@ DiscoverRedfishHostInterface (
   return Status;
 }
 
+/**
+  The function initalizes particular strings into 
EFI_REDFISH_DISCOVERED_INFORMATION structure
+
+  @param[in]  Information   EFI_REDFISH_DISCOVERED_INFORMATION
+  @param[in]  RedfishVersionRedfish version.
+  @param[in]  RedfishLocation   Redfish location.
+  @param[in]  Uuid  Service UUID string.
+  @param[in]  OsOS string.
+  @param[in]  OsVer OS version string.
+  @param[in]  Product   Product string.
+  @param[in]  ProductVerProduct version string.
+
+**/
+STATIC
+VOID
+InitInformationData (
+  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
+  IN UINTN   *RedfishVersion OPTIONAL,
+  IN CHAR8   *RedfishLocation OPTIONAL,
+  IN CHAR8   *Uuid  OPTIONAL,
+  IN CHAR8   *Os  OPTIONAL,
+  IN CHAR8   *OsVer  OPTIONAL,
+  IN CHAR8   *Product  OPTIONAL,
+  IN CHAR8   *ProductVer  OPTIONAL
+  )
+{
+  if (RedfishVersion != NULL) {
+Information->RedfishVersion = *RedfishVersion;
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", 
Information->RedfishVersion));
+  }
+
+  if (RedfishLocation != NULL) {
+Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 
*)RedfishLocation) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, 
Information->Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof 
(CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
+  }
+
+  if (Uuid != NULL) {
+Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 
*)Uuid) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, Information->Uuid, 
AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+  }
+
+  if (Os != NULL) {
+Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Os) 
* sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((const CHAR8 *)Os, Information->Os, AsciiStrSize 
((const CHAR8 *)Os) * sizeof (CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
+  }
+
+  if (OsVer != NULL) {
+Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((const 
CHAR8 *)OsVer) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, Information->OsVersion, 
AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
+  }
+
+  if ((Product != NULL) && (ProductVer != NULL)) {
+Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 
*)Product) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((const CHAR8 *)Product, Information->Product, 
AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
+Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((const 
CHAR8 *)ProductVer) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, Information->ProductVer, 
AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
+DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
+  }
+}
+
 /**
   The function adds a new found Redfish service to internal list and
   notify client.
@@ -851,41 +915,17 @@ AddAndSignalNewRedfishService (
 DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information ***\n"));
 
 DiscoveredInstance->Information.UseHttps = UseHttps;
-if (RedfishVersion != NULL) {
-  DiscoveredInstance->Information.RedfishVersion = *RedfishVersion;
-  DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", 
DiscoveredInstance->Information.RedfishVersion));
-}
 
-if (RedfishLocation != NULL) {
-  DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool 
(AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
-  AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, 
DiscoveredInstance->Information.Location, AsciiStrSize ((const CHAR8 
*)RedfishLocation) * sizeof (CHAR16));
-  DEBUG ((DEBUG_M

[edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Pedro Falcato 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 36 +--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 724aa35431a8..e3fc2d809dbc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -730,12 +730,12 @@ VOID
 InitInformationData (
   IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
   IN UINTN   *RedfishVersion OPTIONAL,
-  IN CHAR8   *RedfishLocation OPTIONAL,
-  IN CHAR8   *Uuid  OPTIONAL,
-  IN CHAR8   *Os  OPTIONAL,
-  IN CHAR8   *OsVer  OPTIONAL,
-  IN CHAR8   *Product  OPTIONAL,
-  IN CHAR8   *ProductVer  OPTIONAL
+  IN CONST CHAR8 *RedfishLocation OPTIONAL,
+  IN CONST CHAR8 *Uuid OPTIONAL,
+  IN CONST CHAR8 *Os OPTIONAL,
+  IN CONST CHAR8 *OsVer OPTIONAL,
+  IN CONST CHAR8 *Product OPTIONAL,
+  IN CONST CHAR8 *ProductVer OPTIONAL
   )
 {
   if (RedfishVersion != NULL) {
@@ -744,33 +744,33 @@ InitInformationData (
   }
 
   if (RedfishLocation != NULL) {
-Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 
*)RedfishLocation) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, 
Information->Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof 
(CHAR16));
+Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) * 
sizeof (CHAR16));
+AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, 
AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
Information->Location));
   }
 
   if (Uuid != NULL) {
-Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 
*)Uuid) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, Information->Uuid, 
AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
+Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * 
sizeof (CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
   }
 
   if (Os != NULL) {
-Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Os) 
* sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((const CHAR8 *)Os, Information->Os, AsciiStrSize 
((const CHAR8 *)Os) * sizeof (CHAR16));
+Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
+AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof 
(CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", 
Information->Os, Information->OsVersion));
   }
 
   if (OsVer != NULL) {
-Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((const 
CHAR8 *)OsVer) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, Information->OsVersion, 
AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
+Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof 
(CHAR16));
+AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer) 
* sizeof (CHAR16));
   }
 
   if ((Product != NULL) && (ProductVer != NULL)) {
-Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 
*)Product) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((const CHAR8 *)Product, Information->Product, 
AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
-Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((const 
CHAR8 *)ProductVer) * sizeof (CHAR16));
-AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, Information->ProductVer, 
AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
+Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof 
(CHAR16));
+AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize 
(Product) * sizeof (CHAR16));
+Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof 
(CHAR16));
+AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize 
(ProductVer) * sizeof (CHAR16));
 DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", 
Information->Product, Information->ProductVer));
   }
 }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#

[edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishPlatformHostInterfaceLib.c   | 2 --
 1 file changed, 2 deletions(-)

diff --git 
a/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
 
b/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
index 4332caa71016..71b3dfc64358 100644
--- 
a/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
+++ 
b/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHostInterfaceLib.c
@@ -42,12 +42,10 @@ GetMacAddressInformation (
   OUT EFI_MAC_ADDRESS  *MacAddress
   )
 {
-  MAC_ADDR_DEVICE_PATH  *Mac;
   REST_EX_SERVICE_DEVICE_PATH_DATA  *RestExServiceDevicePathData;
   EFI_DEVICE_PATH_PROTOCOL  *RestExServiceDevicePath;
   MAC_ADDR_DEVICE_PATH  *MacAddressDevicePath;
 
-  Mac = NULL;
   RestExServiceDevicePathData = NULL;
   RestExServiceDevicePath = NULL;
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112558): https://edk2.groups.io/g/devel/message/112558
Mute This Topic: https://groups.io/mt/103181044/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Mike Maslenkin 
---
 EmulatorPkg/EmulatorPkg.dec  |  8 
 .../RedfishPlatformCredentialLib.c   | 12 ++--
 .../RedfishPlatformCredentialLib.inf |  8 
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec
index fe81652b0478..c2a92923e9b7 100644
--- a/EmulatorPkg/EmulatorPkg.dec
+++ b/EmulatorPkg/EmulatorPkg.dec
@@ -77,15 +77,15 @@
   ## Platform level Redfish Service control PCD
   # These PCDs are used to stop the Redfish sevice when secure boot is disabled
   # or exit boot service.
-  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfSecureBootDisabled|TRUE|BOOLEAN|0x1020
-  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfExitbootService|TRUE|BOOLEAN|0x1021
+  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfSecureBootDisabled|TRUE|BOOLEAN|0x1020
+  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfExitbootService|TRUE|BOOLEAN|0x1021
   ##
   # edk2 Redfish implementation on Emulator package is designed to access
   # to Redfish simulator.
   # https://github.com/DMTF/Redfish-Profile-Simulator
   # The user ID and password are fixed as below.
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieUserId|"admin"|VOID*|0x1022
-  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServiePassword|"pwd123456"|VOID*|0x1023
+  gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceUserId|"admin"|VOID*|0x1022
+  
gEmulatorPkgTokenSpaceGuid.PcdRedfishServicePassword|"pwd123456"|VOID*|0x1023
   
gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize|0x400|UINT32|0x1024
 
 [PcdsFixedAtBuild, PcdsPatchableInModule]
diff --git 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
index 614eaebb0d0e..5c167fcdea56 100644
--- 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
+++ 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.c
@@ -57,8 +57,8 @@ GetRedfishCredential (
   //
   // User ID and Password.
   //
-  UserIdSize   = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServieUserId));
-  PasswordSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServiePassword));
+  UserIdSize   = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServiceUserId));
+  PasswordSize = AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdRedfishServicePassword));
   if ((UserIdSize == 0) || (PasswordSize == 0)) {
 DEBUG ((DEBUG_ERROR, "Incorrect string of UserID or Password for REdfish 
service.\n"));
 return EFI_INVALID_PARAMETER;
@@ -69,7 +69,7 @@ GetRedfishCredential (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServieUserId), UserIdSize);
+  CopyMem (*UserId, (CHAR8 *)PcdGetPtr (PcdRedfishServiceUserId), UserIdSize);
 
   *Password = AllocateZeroPool (PasswordSize);
   if (*Password == NULL) {
@@ -77,7 +77,7 @@ GetRedfishCredential (
 return EFI_OUT_OF_RESOURCES;
   }
 
-  CopyMem (*Password, (CHAR8 *)PcdGetPtr (PcdRedfishServiePassword), 
PasswordSize);
+  CopyMem (*Password, (CHAR8 *)PcdGetPtr (PcdRedfishServicePassword), 
PasswordSize);
   return EFI_SUCCESS;
 }
 
@@ -177,7 +177,7 @@ LibStopRedfishService (
 // Check platform PCD to determine the action for stopping
 // Redfish service due to secure boot is disabled.
 //
-if (!PcdGetBool (PcdRedfishServieStopIfSecureBootDisabled)) {
+if (!PcdGetBool (PcdRedfishServiceStopIfSecureBootDisabled)) {
   return EFI_UNSUPPORTED;
 } else {
   //
@@ -198,7 +198,7 @@ LibStopRedfishService (
 // Check platform PCD to determine the action for stopping
 // Redfish service due to exit boot service.
 //
-if (PcdGetBool (PcdRedfishServieStopIfExitbootService)) {
+if (PcdGetBool (PcdRedfishServiceStopIfExitbootService)) {
   return EFI_UNSUPPORTED;
 } else {
   mStopRedfishService = TRUE;
diff --git 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
index 41c389c4a292..9d151f14ee17 100644
--- 
a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
+++ 
b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredentialLib.inf
@@ -36,10 +36,10 @@
   UefiLib
 
 [Pcd]
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfSecureBootDisabled ## 
CONSUMES
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfExitbootService## 
CONSUMES
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServieUserId   ## 
CONSUMES
-  gEmulatorPkgTokenSpaceGuid.PcdRedfishServiePassword ## 
CONSUMES
+  gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfSecureBootDisabled ## 
CONSUMES
+  gEmulatorPkgTokenSpaceGuid.PcdR

[edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request

2023-12-14 Thread Mike Maslenkin
All fields of IPMI_CHANNEL_INFO_CHANNEL_NUMBER union must be
initialized to avoid error condition on BMC side.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../PlatformHostInterfaceBmcUsbNicLib.c   | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index 7f295fe7f1c0..c73e76df5791 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -616,9 +616,10 @@ HostInterfaceIpmiCheckMacAddress (
   }
 
   // Initial the get MAC address request.
-  GetLanConfigReq.SetSelector   = 0;
-  GetLanConfigReq.BlockSelector = 0;
-  GetLanConfigReq.ParameterSelector = IpmiLanMacAddress;
+  GetLanConfigReq.ChannelNumber.Uint8 = 0;
+  GetLanConfigReq.SetSelector = 0;
+  GetLanConfigReq.BlockSelector   = 0;
+  GetLanConfigReq.ParameterSelector   = IpmiLanMacAddress;
 
   ExitStatus = EFI_NOT_FOUND;
   for (ChannelNum = IPMI_CHANNEL_NUMBER_IMPLEMENTATION_SPECIFIC_1;
@@ -640,6 +641,7 @@ HostInterfaceIpmiCheckMacAddress (
 } else {
   DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "  No cached IPMI LAN info\n"));
   DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "  Send NetFn = App, Command = 
0x42 to channel %d\n", ChannelNum));
+  GetChanelInfoRequest.ChannelNumber.Uint8  = 0;
   GetChanelInfoRequest.ChannelNumber.Bits.ChannelNo = (UINT8)ChannelNum;
   Status= IpmiGetChannelInfo (
 
&GetChanelInfoRequest,
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112556): https://edk2.groups.io/g/devel/message/112556
Mute This Topic: https://groups.io/mt/103181042/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver

2023-12-14 Thread Mike Maslenkin
Currently there is no description for RedfishConfigHandler driver.
This leads to  in the "DRIVER NAME" column of a `drivers`
command for example.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishConfigHandler/ComponentName.c  | 216 ++
 .../RedfishConfigHandlerDriver.c  |  10 +-
 .../RedfishConfigHandlerDriver.h  |   4 +-
 .../RedfishConfigHandlerDriver.inf|   1 +
 4 files changed, 228 insertions(+), 3 deletions(-)
 create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c

diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c 
b/RedfishPkg/RedfishConfigHandler/ComponentName.c
new file mode 100644
index ..c6b8b189f3e1
--- /dev/null
+++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
@@ -0,0 +1,218 @@
+/** @file
+  Implementation of EFI_COMPONENT_NAME_PROTOCOL and 
EFI_COMPONENT_NAME2_PROTOCOL protocol
+  for EFI Refish Config Handler Protocol
+
+  Copyright (c) 2023, Mike Maslenkin 
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "RedfishConfigHandlerCommon.h"
+
+//
+// EFI Component Name Functions
+//
+
+/**
+  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
+
+  @param[in]  This   A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  Language   A pointer to a three-character ISO 639-2 language 
identifier.
+ This is the language of the driver name that the 
caller
+ is requesting, and it must match one of the languages 
specified
+ in SupportedLanguages.  The number of languages 
supported by a
+ driver is up to the driver writer.
+  @param[out] DriverName A pointer to the Unicode string to return.  This 
Unicode string
+ is the name of the driver specified by This in the 
language
+ specified by Language.
+
+  @retval EFI_SUCCESS   The Unicode string for the Driver specified by 
This
+and the language specified by Language was 
returned
+in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED   The driver specified by This does not support 
the
+language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishConfigHandlerComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8*Language,
+  OUT CHAR16   **DriverName
+  );
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being managed by an EFI Driver.
+
+  @param[in]  This A pointer to the EFI_COMPONENT_NAME_PROTOCOL 
instance.
+  @param[in]  ControllerHandle The handle of a controller that the driver 
specified by
+   This is managing.  This handle specifies the 
controller
+   whose name is to be returned.
+  @param[in]  ChildHandle  The handle of the child controller to retrieve 
the name
+   of.  This is an optional parameter that may be 
NULL.  It
+   will be NULL for device drivers.  It will also 
be NULL
+   for a bus drivers that wish to retrieve the 
name of the
+   bus controller.  It will not be NULL for a bus 
driver
+   that wishes to retrieve the name of a child 
controller.
+  @param[in]  Language A pointer to a three character ISO 639-2 
language
+   identifier.  This is the language of the 
controller name
+   that the caller is requesting, and it must 
match one
+   of the languages specified in 
SupportedLanguages.  The
+   number of languages supported by a driver is up 
to the
+   driver writer.
+  @param[out]  ControllerName  A pointer to the Unicode string to return.  
This Unicode
+   string is the name of the controller specified 
by
+   ControllerHandle and ChildHandle in the 
language specified
+   by Language, from the point of view of the 
driver specified
+   by This.
+
+  @retval EFI_SUCCESS   The Unicode string for the user-readable name 
in the
+language specified by Language for the driver
+specified by This was returned in DriverName.
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid 
EFI_HANDLE.
+  @retval EFI_INVALI

[edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.

2023-12-14 Thread Mike Maslenkin
Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 06d8d00da7fb..e344e06d8dcc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -829,6 +829,10 @@ AddAndSignalNewRedfishService (
 } while (TRUE);
   }
 
+  if (Char16Uuid != NULL) {
+FreePool (Char16Uuid);
+  }
+
   if (NewFound || InfoRefresh) {
 if (!InfoRefresh) {
   DiscoveredList = (EFI_REDFISH_DISCOVERED_INTERNAL_LIST 
*)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_INTERNAL_LIST));
@@ -907,10 +911,6 @@ AddAndSignalNewRedfishService (
 }
   }
 
-  if (Char16Uuid != NULL) {
-FreePool ((VOID *)Char16Uuid);
-  }
-
   Status = EFI_SUCCESS;
   if (NewFound || InfoRefresh) {
 //
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112554): https://edk2.groups.io/g/devel/message/112554
Mute This Topic: https://groups.io/mt/103181040/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations

2023-12-14 Thread Mike Maslenkin
It's unclear why the new string is allocated as copy of the original
string if its pointer is stored in an array and the original string
is released immediately after the copy is created. All data allocated
in the same pool.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index cbc65ba59408..f970e317b3f6 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -2057,9 +2057,7 @@ RedfishPlatformConfigProtocolGetConfigureLang (
 TmpString = HiiGetRedfishString 
(StatementRef->Statement->ParentForm->ParentFormset->HiiHandle, FullSchema, 
StatementRef->Statement->Description);
 ASSERT (TmpString != NULL);
 if (TmpString != NULL) {
-  TmpConfigureLangList[Index] = AllocateCopyPool (StrSize (TmpString), 
TmpString);
-  ASSERT (TmpConfigureLangList[Index] != NULL);
-  FreePool (TmpString);
+  TmpConfigureLangList[Index] = TmpString;
   ++Index;
 }
   }
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112553): https://edk2.groups.io/g/devel/message/112553
Mute This Topic: https://groups.io/mt/103181039/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo.

2023-12-14 Thread Mike Maslenkin
PlatformHostInterfaceBmcUsbNicLib is the library instance name not
the class name.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../PlatformHostInterfaceBmcUsbNicLib.inf   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
index 838a1721a7ae..3660249a3588 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
@@ -14,7 +14,7 @@
   FILE_GUID  = C4837B58-225E-4352-8FDC-4C52A5D65891
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = PlatformHostInterfaceBmcUsbNicLib
+  LIBRARY_CLASS  = RedfishPlatformHostInterfaceLib
 
 [Sources]
   PlatformHostInterfaceBmcUsbNicLib.c
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112550): https://edk2.groups.io/g/devel/message/112550
Mute This Topic: https://groups.io/mt/103181036/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib library class name typo.

2023-12-14 Thread Mike Maslenkin
RedfishPlatformCredentialIpmiLib is the library instance name not the
class name.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 .../RedfishPlatformCredentialIpmiLib.inf| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
index 5c20ea22f894..935461e1dcd0 100644
--- 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
+++ 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
@@ -13,7 +13,7 @@
   FILE_GUID  = 9C45D622-4C66-417F-814C-F76246D97233
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = RedfishPlatformCredentialIpmiLib
+  LIBRARY_CLASS  = RedfishPlatformCredentialLib
 
 [Sources]
   RedfishPlatformCredentialIpmiLib.c
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112551): https://edk2.groups.io/g/devel/message/112551
Mute This Topic: https://groups.io/mt/103181037/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h

2023-12-14 Thread Mike Maslenkin
It seems that initial implementation of this header file is based on
CrtLibSupport.h from CryptoPkg. But uid, euid, gid, egid and sa_family_t
sre not used in RedfishPkg. So remove them.

Also take "true" and "false" definition from MdePkg's LibFdtSupport.h
header file, that also seems based on a header mentioned above.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 
---
 RedfishPkg/Include/Library/RedfishCrtLib.h | 45 ++
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/RedfishPkg/Include/Library/RedfishCrtLib.h 
b/RedfishPkg/Include/Library/RedfishCrtLib.h
index ac6c5162ad6a..0c51a03d0e1a 100644
--- a/RedfishPkg/Include/Library/RedfishCrtLib.h
+++ b/RedfishPkg/Include/Library/RedfishCrtLib.h
@@ -69,20 +69,17 @@
 //
 // Basic types mapping
 //
-typedef UINTN   size_t;
-typedef INTNssize_t;
-typedef INT32   time_t;
-typedef UINT8   __uint8_t;
-typedef UINT8   sa_family_t;
-typedef UINT32  uid_t;
-typedef UINT32  gid_t;
-typedef INT32   int32_t;
-typedef UINT32  uint32_t;
-typedef UINT16  uint16_t;
-typedef UINT8   uint8_t;
-typedef enum {
-  false, true
-} bool;
+typedef UINTNsize_t;
+typedef INTN ssize_t;
+typedef INT32time_t;
+typedef INT32int32_t;
+typedef UINT32   uint32_t;
+typedef UINT16   uint16_t;
+typedef UINT8uint8_t;
+typedef BOOLEAN  bool;
+
+#define true   (1 == 1)
+#define false  (1 == 0)
 
 //
 // File operations are not required for EFI building,
@@ -343,26 +340,6 @@ fgetc   (
   FILE  *_File
   );
 
-uid_t
-getuid  (
-  void
-  );
-
-uid_t
-geteuid (
-  void
-  );
-
-gid_t
-getgid  (
-  void
-  );
-
-gid_t
-getegid (
-  void
-  );
-
 void
 qsort   (
   void *,
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112552): https://edk2.groups.io/g/devel/message/112552
Mute This Topic: https://groups.io/mt/103181038/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements

2023-12-14 Thread Mike Maslenkin
This is an exapanded version of the original set of 9 patches with
additional patch introducing brackets for IPv6 Redfish resource location
with required changes according to comments for the initial RFC patch.

PR: https://github.com/tianocore/edk2/pull/5149

diff from v1:
  fixed typo double "that that"
  removed variable declaration in block scope
  added patches 10-13
  removed unnecessary casts
  added checks for memory allocation result

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Mike Maslenkin 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112549): https://edk2.groups.io/g/devel/message/112549
Mute This Topic: https://groups.io/mt/103181035/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses

2023-12-13 Thread Mike Maslenkin
Fair.
I'll try to make some cleanups before applying this patch after
committing Abner's remedy patch
https://github.com/tianocore/edk2/pull/5139.

Regards,
Mike..


On Wed, Dec 13, 2023 at 4:15 PM Pedro Falcato  wrote:
>
> On Thu, Dec 7, 2023 at 1:24 PM Mike Maslenkin  
> wrote:
> >
> > URI is generated based on the RedfishLocation containing an ASCII string
> > representing the IP address. So, in the case of IPv4 the canonical
> > representation of an IPv4 address was inserted into the resulting Unicode
> > string i.e: "http{,s}://X.X.X.X/".
> >
> > In the case of IPv6, to access resources, the IP address must be specified
> > in brackets, i.e. the resulting string should look like:
> >   "http{,s}://[X::X:X:X:X]/".
> >
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Signed-off-by: Mike Maslenkin 
> > ---
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 20 ---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 28ba2d3a9fca..49c96bd28b27 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > @@ -863,9 +863,23 @@ AddAndSignalNewRedfishService (
> >  }
> >
> >  if (RedfishLocation != NULL) {
> > -  DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool 
> > (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
> > -  AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, 
> > DiscoveredInstance->Information.Location, AsciiStrSize ((const CHAR8 
> > *)RedfishLocation) * sizeof (CHAR16));
> > -  DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", 
> > DiscoveredInstance->Information.Location));
> > +  UINTNAllocSize;
> > +  CONST CHAR8  *IpAddress;
> > +
> > +  IpAddress = (CONST CHAR8 *)RedfishLocation;
> > +  AllocSize = AsciiStrSize (IpAddress) * sizeof (CHAR16);
> > +
> > +  if (CheckIsIpVersion6 (NetworkInterface)) {
> > +AllocSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
> > +
> > +DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool 
> > (AllocSize);
>
> You don't check for NULL.
>
> > +UnicodeSPrintAsciiFormat 
> > (DiscoveredInstance->Information.Location, AllocSize, "[%a]", IpAddress);
> > +  } else {
> > +DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool 
> > (AllocSize);
>
> You don't check for NULL.
> Heck, why does no one check for NULL in this whole function
> (AddAndSignalNewRedfishService)?
>
> --
> Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112474): https://edk2.groups.io/g/devel/message/112474
Mute This Topic: https://groups.io/mt/103033764/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




  1   2   3   >