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 (, sizeof (REDFISH_RESPONSE));
+  Status = GetPendingSettings (
+ Private->RedfishService,
+ Response.Payload,
+ ,
+ 
+ );
+  if (!EFI_ERROR (Status)) {
+DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", 
__func__, PendingSettingUri));
+Private->Uri = PendingSettingUri;
+ExpectedResponse = 
+  } else {
+DEBUG ((REDFISH_DEBUG_TRACE, "%a: No @Redfish.Settings is found\n", 
__func__));
+Private->Uri = Uri;
+ExpectedResponse = 
+  }

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 Chang, Abner via groups.io
[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 (#114616): https://edk2.groups.io/g/devel/message/114616
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 Chang, Abner via groups.io
[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 (#114614): https://edk2.groups.io/g/devel/message/114614
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/FeatureDriver: ComputerSystem_1_13_0 driver

2024-01-25 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Thanks Nickle, I just sent out the updates.

Abner

> -Original Message-
> From: Nickle Wang 
> Sent: Friday, January 26, 2024 10:21 AM
> To: devel@edk2.groups.io; Chang, Abner 
> Cc: 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,
>
> 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
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Chang,
> Abner
> > via groups.io
> > Sent: Friday, January 26, 2024 9:00 AM
> > To: devel@edk2.groups.io
> > Cc: Nickle Wang ; Igor Kulchytskyy 
> > Subject: [edk2-devel] [edk2-redfish-client][PATCH V2]
> > RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver
> >
> > External email: Use caution opening links or attachments
> >
> >
> > From: Abner Chang 
> >
> > Initial version of edk2 Redfish feature of
> > Redfish schema ComputerSystem_1_13_0. This driver
> > handles ComputerSystem Boot properties but not all.
> >
> > Signed-off-by: Abner Chang 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > ---
> >  .../v1_13_0/Dxe/ComputerSystemDxe.inf |  53 ++
> >  .../v1_13_0/Common/ComputerSystemCommon.h |  29 +
> >  .../v1_13_0/Common/ComputerSystemCommon.c | 899
> > ++
> >  .../v1_13_0/Dxe/ComputerSystemDxe.c   | 702 ++
> >  4 files changed, 1683 insertions(+)
> >  create mode 100644
> >
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystem
> Dxe.
> > inf
> >  create mode 100644
> >
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerS
> yste
> > mCommon.h
> >  create mode 100644
> >
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerS
> yste
> > mCommon.c
> >  create mode 100644
> >
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystem
> Dxe.
> > c
> >
> > diff --git
> >
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyste
> mD
> > xe.inf
> >
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyst
> emD
> > xe.inf
> > new file mode 100644
> > index 00..6bc5cb358e
> > --- /dev/null
> > +++
> >
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSyst
> emD
> > xe.inf
> > @@ -0,0 +1,53 @@
> > +## @file
> > +#
> > +#  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development
> LP
> > +#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +#
> > +##
> > +
> > +
> > +[Defines]
> > +  INF_VERSION   = 0x00010005
> > +  BASE_NAME = ComputerSystemDxe
> > +  FILE_GUID = D94362A1-C358-4059-B014-F07D1AE04F16
> > +  MODULE_TYPE   = DXE_DRIVER
> > +  VERSION_STRING= 1.0
> > +  ENTRY_POINT   = RedfishResourceEntryPoint
> > +  UNLOAD_IMAGE  = RedfishResourceUnload
> > +
> > +[Packages]
> > +  MdePkg/MdePkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +  RedfishPkg/RedfishPkg.dec
> > +  RedfishClientPkg/RedfishClientPkg.dec
> > +
> > +[Sources]
> > +  ../Common/ComputerSystemCommon.h
> > +  ../Common/ComputerSystemCommon.c
> > +  ComputerSystemDxe.c
> > +
> > +[LibraryClasses]
> > +  BaseMemoryLib
> > +  DebugLib
> > +  EdkIIRedfishResourceConfigLib
> > +  RedfishLib
> > +  RedfishFeatureUtilityLib
> > +  RedfishResourceIdentifyLib
> > +  UefiLib
> > +  UefiDriverEntryPoint
> > +  RedfishAddendumLib
> > +  RedfishHttpCacheLib
> > +
> > +[Protocols]
> > +  gEdkIIRedfishConfigHandlerProtocolGuid  ## PRODUCED
> > +  gEfiRestJsonStructureProtocolGuid   ## CONSUMED
> > +  gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED
> > +
> > +[Pcd]
> > +  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize
> > +  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize
> >

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

2024-01-25 Thread Nickle Wang via groups.io
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

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang, Abner
> via groups.io
> Sent: Friday, January 26, 2024 9:00 AM
> To: devel@edk2.groups.io
> Cc: Nickle Wang ; Igor Kulchytskyy 
> Subject: [edk2-devel] [edk2-redfish-client][PATCH V2]
> RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Initial version of edk2 Redfish feature of
> Redfish schema ComputerSystem_1_13_0. This driver
> handles ComputerSystem Boot properties but not all.
> 
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../v1_13_0/Dxe/ComputerSystemDxe.inf |  53 ++
>  .../v1_13_0/Common/ComputerSystemCommon.h |  29 +
>  .../v1_13_0/Common/ComputerSystemCommon.c | 899
> ++
>  .../v1_13_0/Dxe/ComputerSystemDxe.c   | 702 ++
>  4 files changed, 1683 insertions(+)
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.
> inf
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyste
> mCommon.h
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyste
> mCommon.c
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.
> c
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.inf
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.inf
> new file mode 100644
> index 00..6bc5cb358e
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.inf
> @@ -0,0 +1,53 @@
> +## @file
> +#
> +#  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +
> +[Defines]
> +  INF_VERSION   = 0x00010005
> +  BASE_NAME = ComputerSystemDxe
> +  FILE_GUID = D94362A1-C358-4059-B014-F07D1AE04F16
> +  MODULE_TYPE   = DXE_DRIVER
> +  VERSION_STRING= 1.0
> +  ENTRY_POINT   = RedfishResourceEntryPoint
> +  UNLOAD_IMAGE  = RedfishResourceUnload
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  RedfishPkg/RedfishPkg.dec
> +  RedfishClientPkg/RedfishClientPkg.dec
> +
> +[Sources]
> +  ../Common/ComputerSystemCommon.h
> +  ../Common/ComputerSystemCommon.c
> +  ComputerSystemDxe.c
> +
> +[LibraryClasses]
> +  BaseMemoryLib
> +  DebugLib
> +  EdkIIRedfishResourceConfigLib
> +  RedfishLib
> +  RedfishFeatureUtilityLib
> +  RedfishResourceIdentifyLib
> +  UefiLib
> +  UefiDriverEntryPoint
> +  RedfishAddendumLib
> +  RedfishHttpCacheLib
> +
> +[Protocols]
> +  gEdkIIRedfishConfigHandlerProtocolGuid  ## PRODUCED
> +  gEfiRestJsonStructureProtocolGuid   ## CONSUMED
> +  gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED
> +
> +[Pcd]
> +  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize
> +  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize
> +
> +[Depex]
> +  TRUE
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.h
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.h
> new file mode 100644
> index 00..c9c8512881
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.h
> @@ -0,0 +1,29 @@
> +/** @file
> +
> +  Redfish feature driver implementation - internal header file
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
> +#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
> +
> +#include
>  >
> +#include 
> +
> +//
> +// Schema information.
> +//
> +#define RESOURCE_SCHEMA  "ComputerSystem"
> +#define RESOURCE_SCHEMA_MAJOR"1"
> +#define RESOURCE_SCHEMA_MINOR"13"
> +#define RESOURCE_SCHEMA_ERRATA   "

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

2024-01-25 Thread Chang, Abner via groups.io
From: Abner Chang 

Initial version of edk2 Redfish feature of
Redfish schema ComputerSystem_1_13_0. This driver
handles ComputerSystem Boot properties but not all.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../v1_13_0/Dxe/ComputerSystemDxe.inf |  53 ++
 .../v1_13_0/Common/ComputerSystemCommon.h |  29 +
 .../v1_13_0/Common/ComputerSystemCommon.c | 899 ++
 .../v1_13_0/Dxe/ComputerSystemDxe.c   | 702 ++
 4 files changed, 1683 insertions(+)
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.c

diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf
new file mode 100644
index 00..6bc5cb358e
--- /dev/null
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf
@@ -0,0 +1,53 @@
+## @file
+#
+#  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+[Defines]
+  INF_VERSION   = 0x00010005
+  BASE_NAME = ComputerSystemDxe
+  FILE_GUID = D94362A1-C358-4059-B014-F07D1AE04F16
+  MODULE_TYPE   = DXE_DRIVER
+  VERSION_STRING= 1.0
+  ENTRY_POINT   = RedfishResourceEntryPoint
+  UNLOAD_IMAGE  = RedfishResourceUnload
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  RedfishPkg/RedfishPkg.dec
+  RedfishClientPkg/RedfishClientPkg.dec
+
+[Sources]
+  ../Common/ComputerSystemCommon.h
+  ../Common/ComputerSystemCommon.c
+  ComputerSystemDxe.c
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  EdkIIRedfishResourceConfigLib
+  RedfishLib
+  RedfishFeatureUtilityLib
+  RedfishResourceIdentifyLib
+  UefiLib
+  UefiDriverEntryPoint
+  RedfishAddendumLib
+  RedfishHttpCacheLib
+
+[Protocols]
+  gEdkIIRedfishConfigHandlerProtocolGuid  ## PRODUCED
+  gEfiRestJsonStructureProtocolGuid   ## CONSUMED
+  gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED
+
+[Pcd]
+  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize
+  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize
+
+[Depex]
+  TRUE
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
new file mode 100644
index 00..c9c8512881
--- /dev/null
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
@@ -0,0 +1,29 @@
+/** @file
+
+  Redfish feature driver implementation - internal header file
+  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
+#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
+
+#include 

+#include 
+
+//
+// Schema information.
+//
+#define RESOURCE_SCHEMA  "ComputerSystem"
+#define RESOURCE_SCHEMA_MAJOR"1"
+#define RESOURCE_SCHEMA_MINOR"13"
+#define RESOURCE_SCHEMA_ERRATA   "0"
+#define RESOURCE_SCHEMA_VERSION  "v1_13_0"
+#define REDPATH_ARRAY_PATTERNL"/Systems/\\{.*\\}/"
+#define REDPATH_ARRAY_PREFIX L"/Systems/"
+#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-ComputerSystem.v1_13_0"
+
+#endif
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
new file mode 100644
index 00..bc24c49206
--- /dev/null
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
@@ -0,0 +1,899 @@
+/** @file
+  Redfish feature driver implementation - common functions
+
+  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "ComputerSystemCommon.h"
+
+CHAR8  ComputerSystemEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\": 
\"#ComputerSystem.v1_13_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\", 
\"Boot\":{}}";
+
+REDFISH_RESOURCE_COMMON_PRIVATE  *mRedfishResourcePrivate = NULL;
+EFI_HANDLE   mRedfishResourceConfigProtocolHandle = NULL;
+
+/**
+  Consume resource from given URI.
+
+  @param[in]   This