Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: introduce RedfishBootstrapAccountDxe

2024-05-16 Thread Igor Kulchytskyy via groups.io
We can have some protocol where all Redfish clients register saying that they 
are using the bootstrap credentials.
And when they finish their job they notify RedfishBootstrapAccountDxe driver 
and when all of registered modules finish their job RedfishBootstrapAccountDxe 
driver delete the account.
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Wednesday, May 15, 2024 11:10 PM
To: Chang, Abner ; Igor Kulchytskyy ; 
devel@edk2.groups.io
Cc: Nick Ramirez 
Subject: RE: [EXTERNAL] RE: [edk2-devel] [edk2-redfish-client][PATCH] 
RedfishClientPkg: introduce RedfishBootstrapAccountDxe

> RedfishFeatureCore could be one of the Redfish clients, delete the credential 
> from
> Redfish account service in RedfishFeatureCore lifecycle may impact other 
> Redfish
> clients that still need the communication with Redfish service, right?

When all Redfish clients are managed by RedfishFeatureCore, I think we don't 
have such case. And this may be a good reason to keep it in RedfishClientPkg. 
This driver offers a way for BIOS to delete bootstrapping account at BMC after 
everything is done. Platform owner can decide to include this driver or not 
depending on the Redfish design in system.

Regards,
Nickle

> -Original Message-
> From: Chang, Abner 
> Sent: Thursday, May 16, 2024 10:41 AM
> To: Nickle Wang ; Igor Kulchytskyy ;
> devel@edk2.groups.io
> Cc: Nick Ramirez 
> Subject: RE: [EXTERNAL] RE: [edk2-devel] [edk2-redfish-client][PATCH]
> RedfishClientPkg: introduce RedfishBootstrapAccountDxe
>
> External email: Use caution opening links or attachments
>
>
> [AMD Official Use Only - General]
>
> I think we probably overlook some use cases. Multiple edk2 Redfish 
> applications
> running simultaneously is allowed from the design perspective. However, we
> centralized GetAuthInfo in RedfishPlatformCredentialLib for all of edk2 
> Redfish
> client entities to leverage the same credential stored in EFI variable. This 
> way we
> can limit the process of acquiring credential to only one time Redfish IPMI
> bootstrap command sent to BMC.
> RedfishFeatureCore could be one of the Redfish clients, delete the credential 
> from
> Redfish account service in RedfishFeatureCore lifecycle may impact other 
> Redfish
> clients that still need the communication with Redfish service, right?
>
> Thanks
> Abner
>
> > -Original Message-
> > From: Nickle Wang 
> > Sent: Thursday, May 16, 2024 9:38 AM
> > To: Chang, Abner ; Igor Kulchytskyy
> > ; devel@edk2.groups.io
> > Cc: Nick Ramirez 
> > Subject: RE: [EXTERNAL] RE: [edk2-devel] [edk2-redfish-client][PATCH]
> > RedfishClientPkg: introduce RedfishBootstrapAccountDxe
> >
> > [AMD Official Use Only - General]
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Hi Igor, Abner,
> >
> > > Maybe we should consider moving RedfishBootstrapAccountDxe driver to
> > RedfishPkg and have some register mechanism which will be used by
> > interested drivers to notify that they finished their job and after
> > that RedfishBootstrapAccountDxe driver would delete an account.
> >
> > You are saying the mechanism in runtime, right? In current design,
> > RedfishFeatureCore driver will send "after provisioning" signal to
> > notify this driver to delete bootstrapping account. This makes sure
> > that all feature drivers are done with their jobs, so this driver is
> > safe to delete bootstrapping account at BMC.
> >
> > If we move it to RedfishPkg, there is no such centralized Redfish
> > driver managing Redfish stuff. How does a particular driver know that
> > there is no other driver running Redfish stuff after it? The way I can
> > think of now is to rely on EDK2 ready-to-boot event as the signal to
> > do the notification, since there is not supposed to have Redfish driver 
> > running
> jobs after this event...
> >
> > Regards,
> > Nickle
> >
> > > -Original Message-
> > > From: Chang, Abner 
> > > Sent: Thursday, May 16, 2024 9:06 AM
> > > To: Igor Kulchytskyy ; Nickle Wang
> > > ; devel@edk2.groups.io
> > > Cc: Nick Ramirez 
> > > Subject: RE: [EXTERNAL] RE: [edk2-devel]
> > > [edk2-redfish-client][PATCH]
> > > RedfishClientPkg: introduce RedfishBootstrapAccountDxe
> > >
> > > External email: Use caution opening links or attachments
> > >
> > >
> > > [AMD Official Use Only - General]
> > >
> > > HI Igor,
> > > This sounds to me reasonable to me. As you mentioned, RedfishPkg was
> > designed
> > > to support multiple Redfish applications and RedfishClientPkg is
> > > just one of
> > them. I
> > > think we can review the implementation of acquiring/deleting credential.
> > >
> > > Thanks
> > > Abner
> > >
> > >
> > > > -Original Message-
> > > > From: Igor Kulchytskyy 
> > > > Sent: Wednesday, May 15, 2024 11:02 PM
> > > > To: Nickle Wang ; devel@edk2.groups.io; Chang,
> > > > Abner 
> > > > Cc: Nick Ramirez 
> > > > Subject: RE: [EXTERNAL] RE: 

Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: introduce RedfishBootstrapAccountDxe

2024-05-15 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
I have one more question to discuss regarding this driver.
We have a bootstrap account and creation of this account controlled by 
RedfishCredentialDxe driver in RedfishPkg.
But deletion of that bootstrap account is moved to RedfishClientPkg.
What if we have another Redfish Client or some customer service which uses 
RedfishPkg for the communication.
Architecturally it is allowed.
But then RedfishBootstrapAccountDxe module would delete account just based on 
the RedfishClientPkg needs.
Maybe we should consider moving RedfishBootstrapAccountDxe driver to RedfishPkg 
and have some register mechanism which will be used by interested drivers to 
notify that they finished their job and after that RedfishBootstrapAccountDxe 
driver would delete an account.
What do you think?
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Tuesday, May 14, 2024 8:40 AM
To: devel@edk2.groups.io; abner.ch...@amd.com; Igor Kulchytskyy 
Cc: Nick Ramirez 
Subject: [EXTERNAL] RE: [edk2-devel] [edk2-redfish-client][PATCH] 
RedfishClientPkg: introduce RedfishBootstrapAccountDxe


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Abner,

> Ok, then I don't have the problem with invoking GetAuthInfo again. However, I
> will suggest to add more description in GetAuthInfo function header, mention 
> that
> we will keep the auth info in EFI variable until exist boot service.
> Also, give some more descriptions on the code you invoke to GetAuthInfo.

Thanks for your comment. I add descriptions to explain above before calling 
GetAuthInfo(). Version 2 path is here: 
https://edk2.groups.io/g/devel/message/118889

Regards,
Nickle

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang, Abner
> via groups.io
> Sent: Tuesday, April 23, 2024 3:42 PM
> To: Nickle Wang ; Igor Kulchytskyy ;
> devel@edk2.groups.io
> Cc: Nick Ramirez 
> Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg:
> introduce RedfishBootstrapAccountDxe
>
> External email: Use caution opening links or attachments
>
>
> [AMD Official Use Only - General]
>
> > -Original Message-
> > From: Nickle Wang 
> > Sent: Tuesday, April 23, 2024 3:09 PM
> > To: Igor Kulchytskyy ; Chang, Abner
> > ; devel@edk2.groups.io
> > Cc: Nick Ramirez 
> > Subject: RE: [EXTERNAL] RE: [edk2-redfish-client][PATCH] RedfishClientPkg:
> > introduce RedfishBootstrapAccountDxe
> >
> > [AMD Official Use Only - General]
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Hi Igor, Abner,
> >
> > Thanks for your review. Please allow me to answer your questions together.
> >
> > > 1. We suppose acquire the credential before we start to communicate
> > > with
> > Redfish. Will Redfish credential driver create another bootstrap
> > account here after provisioning?
> > No, according to the RedfishPlatformCredentialIpmiLib implementation,
> > Redfish credential driver requests credential from BMC and will keep
> > it for later use. So only one credential is requested for BIOS Redfish
> > feature drivers during POST time.
> Ok, then I don't have the problem with invoking GetAuthInfo again. However, I
> will suggest to add more description in GetAuthInfo function header, mention 
> that
> we will keep the auth info in EFI variable until exist boot service.
> Also, give some more descriptions on the code you invoke to GetAuthInfo.
>
> >
> > > 2. And why do we delete the credential after provisioning? How about
> > > the
> > later Redfish property updating process?
> > In this driver, we listen to "AfterProvisioning" event. And this is
> > the event triggered after Redfish feature driver finish all jobs.
> > There is no feature driver which gets executed after this event. And
> > since we finished all Redfish operations, we remove this account on BMC.
> Then this makes sense to me now.
>
> >
> > > Why do we need to delete those credentials? According to spec BMC
> > > should
> > delete the bootstrap credentials automatically on host or service reset.
> > Yes, bootstrap credentials get deleted on host reset. In practice,
> > server in datacenter usually takes long time running under OS before it gets
> rebooted.
> > The bootstrap credentials are exposed to end user at
> > "/redfish/v1/AccountService/Accounts". I got report that there is
> > concern for end user to see this unused account.
> This sounds to me reasonable as we will give bootstrap credential a high 
> privilege
> to update Redfish resource. Leave this information in Account service seems 
> not a
> good idea.
>
> Thanks
> Abner
>
> >
> > So, I create this driver to allows us to remove bootstrap account at
> > BMC after we finish Redfish jobs. And this also release the BMC
> > account resource since this account won't be used for a long period of time.
> >
> > Regards,
> > 

Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: rename x-uefi-redfish to x-UEFI-redfish

2024-05-06 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Regards,
Igor

-Original Message-
From: Chang, Abner 
Sent: Thursday, May 02, 2024 11:49 PM
To: Nickle Wang ; devel@edk2.groups.io
Cc: Igor Kulchytskyy ; Nick Ramirez 
Subject: [EXTERNAL] RE: [edk2-redfish-client][PATCH] RedfishClientPkg: rename 
x-uefi-redfish to x-UEFI-redfish


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Friday, May 3, 2024 9:57 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: rename x-uefi-redfish
> to x-UEFI-redfish
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Rename x-uefi-redfish to x-UEFI-redfish to match the format of
> UEFI configuration namespace prefix.
>
> RFC: https://edk2.groups.io/g/rfc/message/849
>
> Signed-off-by: Jeff Brasen 
> Co-authored-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../Features/Bios/v1_0_9/Common/BiosCommon.h  |  2 +-
>  .../v1_0_4/Common/BootOptionCommon.h  |  2 +-
>  .../v1_13_0/Common/ComputerSystemCommon.h |  2 +-
>  .../v1_5_0/Common/ComputerSystemCommon.h  |  2 +-
>  .../Memory/V1_7_1/Common/MemoryCommon.h   |  2 +-
>  .../HiiToRedfishBootDxe/HiiToRedfishBootDxe.h |  2 +-
>  .../EdkIIRedfishResourceConfigInternal.h  |  2 +-
>  .../RedfishFeatureUtilityInternal.h   |  2 +-
>  .../HiiToRedfishBootDxe/HiiToRedfishBootDxe.c |  4 +-
>  .../Media/RedfishClientDriverStack.svg|  2 +-
>  .../HiiToRedfishBiosDxeMap.uni| 16 +++---
>  .../HiiToRedfishBootDxeMap.uni| 32 +--
>  .../HiiToRedfishMemoryDxeMap.uni  | 56 +--
>  RedfishClientPkg/Readme.md| 41 +++---
>  14 files changed, 84 insertions(+), 83 deletions(-)
>
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h
> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h
> index 9a6f9684b..50772d5da 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.h
> @@ -24,7 +24,7 @@
>  #define RESOURCE_SCHEMA_VERSION  "v1_0_9"
>  #define REDPATH_ARRAY_PATTERNL"/Bios/.*"
>  #define REDPATH_ARRAY_PREFIX L"/Bios/"
> -#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-Bios.v1_0_9"
> +#define RESOURCE_SCHEMA_FULL "x-UEFI-redfish-Bios.v1_0_9"
>  #define REDFISH_SCHEMA_NAME  "ComputerSystem"
>
>  #endif
> diff --git
> a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.h
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.h
> index 83babf16f..9293d22cd 100644
> ---
> a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.h
> +++
> b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCom
> mon.h
> @@ -27,7 +27,7 @@
>  #define RESOURCE_SCHEMA_VERSION  "v1_0_4"
>  #define REDPATH_ARRAY_PATTERNL"/BootOptions/\\{.*\\}/"
>  #define REDPATH_ARRAY_PREFIX L"/BootOptions/"
> -#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-BootOption.v1_0_4"
> +#define RESOURCE_SCHEMA_FULL "x-UEFI-redfish-
> BootOption.v1_0_4"
>  #define REDFISH_BOOT_OPTION_PARAMETERL"?name="
>  #define REDFISH_BOOT_OPTION_DEBUG_TRACE  DEBUG_INFO
>  #endif
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.h
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.h
> index 7b83d2939..b5e3fa919 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.h
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/Compute
> rSystemCommon.h
> @@ -24,6 +24,6 @@
>  #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"
> +#define RESOURCE_SCHEMA_FULL "x-UEFI-redfish-
> ComputerSystem.v1_13_0"
>
>  #endif
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.h
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.h
> index a0eb41b8b..24a484d18 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.h
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Computer
> SystemCommon.h
> @@ -22,6 +22,6 @@
>  #define RESOURCE_SCHEMA_VERSION  "v1_5_0"
>  #define REDPATH_ARRAY_PATTERNL"/Systems/\\{.*\\}/"
>  #define REDPATH_ARRAY_PREFIX L"/Systems/"
> -#define RESOURCE_SCHEMA_FULL 

Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: introduce RedfishBootstrapAccountDxe

2024-04-22 Thread Igor Kulchytskyy via groups.io
Hi Nickle and Abner,
I also have the same question as Abner.
Why do we need to delete those credentials?
According to spec BMC should delete the bootstrap credentials automatically on 
host or service reset.
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Sunday, April 21, 2024 10:25 PM
To: Nickle Wang ; devel@edk2.groups.io
Cc: Igor Kulchytskyy ; Nick Ramirez 
Subject: [EXTERNAL] RE: [edk2-redfish-client][PATCH] RedfishClientPkg: 
introduce RedfishBootstrapAccountDxe


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Nickle,
One comment and few questions,

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, April 18, 2024 8:28 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: introduce
> RedfishBootstrapAccountDxe
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Introduce RedfishBootstrapAccountDxe to delete bootstrap
> account from /redfish/v1/AccountService/Accounts after BIOS
> finished all Redfish jobs. The bootstrap account won't be
> available to other application. So deleting bootstrap account
> helps to release resource at BMC.
> - After bootstrap account is deleted at BMC, the Redfish service
> instance is no longer usable. Close Redfish service instance to
> release the HTTP connection between BIOS and BMC.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishClientComponents.dsc.inc   |   1 +
>  .../RedfishBootstrapAccountDxe.inf|  53 +++
>  .../RedfishBootstrapAccountDxe.h  |  58 
>  .../RedfishBootstrapAccountDxe.c  | 328 ++
>  RedfishClientPkg/RedfishClient.fdf.inc|   1 +
>  5 files changed, 441 insertions(+)
>  create mode 100644
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.inf
>  create mode 100644
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.h
>  create mode 100644
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.c
>
> diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc
> b/RedfishClientPkg/RedfishClientComponents.dsc.inc
> index 42fc0c299..fe5248b62 100644
> --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc
> +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc
> @@ -20,6 +20,7 @@
>RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf
>RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf
>RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf
> +
> RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.inf
>  !endif
>#
># Below two modules should be pulled in by build tool.
> diff --git
> a/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in
> f
> b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in
> f
> new file mode 100644
> index 0..4073e95f4
> --- /dev/null
> +++
> b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in
> f
> @@ -0,0 +1,53 @@
> +## @file
> +#  This driver deletes bootstrap account in BMC after BIOS Redfish finished
> +#  all jobs
> +#
> +#  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +#  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.


Not sure if you want to update the copyright to 2024.


> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION   = 0x0001000b
> +  BASE_NAME = RedfishBootstrapAccountDxe
> +  FILE_GUID = 87555253-2F7E-45FC-B469-FD35B2E51210
> +  MODULE_TYPE   = DXE_DRIVER
> +  VERSION_STRING= 1.0
> +  ENTRY_POINT   = RedfishBootstrapAccountEntryPoint
> +  UNLOAD_IMAGE  = RedfishBootstrapAccountUnload
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  RedfishPkg/RedfishPkg.dec
> +  RedfishClientPkg/RedfishClientPkg.dec
> +
> +[Sources]
> +  RedfishBootstrapAccountDxe.h
> +  RedfishBootstrapAccountDxe.c
> +
> +[LibraryClasses]
> +  BaseLib
> +  BaseMemoryLib
> +  DebugLib
> +  MemoryAllocationLib
> +  PrintLib
> +  RedfishEventLib
> +  RedfishFeatureUtilityLib
> +  RedfishDebugLib
> +  RedfishVersionLib
> +  RedfishHttpLib
> +  UefiLib
> +  UefiBootServicesTableLib
> +  UefiRuntimeServicesTableLib
> +  UefiDriverEntryPoint
> +
> +[Protocols]
> +  gEdkIIRedfishConfigHandlerProtocolGuid  ## CONSUMES ##
> +  gEdkIIRedfishCredentialProtocolGuid ## CONSUMES ##
> +  gEfiRestExProtocolGuid  ## CONSUMES ##
> +
> +[Depex]
> +  gEdkIIRedfishCredentialProtocolGuid
> diff --git
> 

Re: [edk2-devel] [PATCH V3 4/6] RedfishPkg/RedfishPlatformConfigDxe: HII string is deleted unexpectedly

2024-04-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, April 4, 2024 6:18 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V3 4/6] RedfishPkg/RedfishPlatformConfigDxe: HII 
string is deleted unexpectedly


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

Add the condition check when delete HII string.
Only when the HiiStatement operand equal to "EFI_IFR_STRING_OP"
and the statement value type = EFI_IFR_TYPE_STRING.

Signed-off-by: Abner Chang 
Co-authored-by: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c| 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index 99e7827eeaf..86f5d3c4478 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1873,8 +1873,11 @@ RedfishPlatformConfigSetStatementCommon (
 DEBUG ((DEBUG_ERROR, "%a: failed to save question value: %r\n", __func__, 
Status));
   }

-  if (StatementValue->Value.string != 0) {
-HiiDeleteString (StatementValue->Value.string, 
TargetStatement->ParentForm->ParentFormset->HiiHandle);
+  if ((TargetStatement->HiiStatement->Operand == EFI_IFR_STRING_OP) && 
(StatementValue->Type == EFI_IFR_TYPE_STRING)) {
+if (StatementValue->Value.string != 0) {
+  // Delete HII string which was created for HII statement operand = 
EFI_IFR_STRING_OP and Type = EFI_IFR_TYPE_STRING.
+  HiiDeleteString (StatementValue->Value.string, 
TargetStatement->ParentForm->ParentFormset->HiiHandle);
+}
   }

   return Status;
--
2.37.1.windows.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117435): https://edk2.groups.io/g/devel/message/117435
Mute This Topic: https://groups.io/mt/105326107/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 6/6] RedfishPkg/RedfishPlatformConfigDxe: support menu path report

2024-04-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, April 4, 2024 6:18 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nickle 
Wang 
Subject: [EXTERNAL] [PATCH V3 6/6] RedfishPkg/RedfishPlatformConfigDxe: support 
menu path report


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Nickle Wang 

"MenuPath" is the attribute in BIOS attribute registry. To support
reporting this attribute, we need to include the formset without
x-uefi-redfish support in database. So driver can find menu path to
target attribute in BIOS menu.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
Signed-off-by: Abner Chang 
---
 .../RedfishPlatformConfigDxe.h|  8 +--
 .../RedfishPlatformConfigDxe.c|  8 +--
 .../RedfishPlatformConfigImpl.c   | 51 +++
 3 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
index 688f2067bff..8eb7b0dc2aa 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
@@ -2,7 +2,7 @@
   This file defines the EDKII Redfish Platform Config Protocol interface.

   (C) Copyright 2021 Hewlett Packard Enterprise Development LP
-  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
   Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -49,8 +49,8 @@
 // 2  RedfishPlatformConfigDxe debug enablement must be set in
 //PcdRedfishDebugCategory (defined in RedfishPkg.dec)
 //
-// 3. The suborinate debug enablement for RedfishPlatformConfigDxe
-//must be set in PcdRedfishPlatformConfigDebugPropert (defined
+// 3. The subordinate debug enablement for RedfishPlatformConfigDxe
+//must be set in PcdRedfishPlatformConfigDebugProperty (defined
 //in RedfishPkg.dec).
 //
 #define DEBUG_REDFISH_THIS_MODULE(DebugSubordinate, ...) \
@@ -116,7 +116,7 @@ typedef struct {

 #define REDFISH_MENU_PATH_SIZE  8

-// Definitions of Redfish platform config capbility
+// Definitions of Redfish platform config capability
 #define REDFISH_PLATFORM_CONFIG_BUILD_MENU_PATH   0x1
 #define REDFISH_PLATFORM_CONFIG_ALLOW_SUPPRESSED  0x2

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index 86f5d3c4478..8bcee5a16ae 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -2016,7 +2016,7 @@ RedfishPlatformConfigProtocolGetConfigureLang (
   UINTN   Index;
   CHAR8   *FullSchema;

-  DEBUG ((DEBUG_INFO, "%a: Harvest config language of %a_%a (Regex: %s).\n", 
__func__, Schema, Version, RegexPattern));
+  DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: Harvest config language of %a_%a 
(Regex: %s).\n", __func__, Schema, Version, RegexPattern));

   if ((This == NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) 
|| (Count == NULL) || (ConfigureLangList == NULL) || IS_EMPTY_STRING 
(RegexPattern)) {
 return EFI_INVALID_PARAMETER;
@@ -2103,7 +2103,7 @@ RELEASE_RESOURCE:
 ReleaseStatementList ();
   }

-  DEBUG ((DEBUG_INFO, "%a: exit.\n", __func__));
+  DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: exit.\n", __func__));
   return Status;
 }

@@ -2318,7 +2318,7 @@ RedfishPlatformConfigProtocolGetAttribute (
   CHAR8  *FullSchema;
   CHAR8  *Buffer;

-  DEBUG ((DEBUG_INFO, "%a: Entry\n", __func__));
+  DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: Entry\n", __func__));
   if ((This == NULL) || IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) 
|| IS_EMPTY_STRING (ConfigureLang) || (AttributeValue == NULL)) {
 return EFI_INVALID_PARAMETER;
   }
@@ -2395,7 +2395,7 @@ RELEASE_RESOURCE:
 FreePool (FullSchema);
   }

-  DEBUG ((DEBUG_INFO, "%a: Exit\n", __func__));
+  DEBUG ((DEBUG_REDFISH_PLATFORM_CONFIG, "%a: Exit\n", __func__));
   return Status;
 }

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c
index 03dcc8dbcd1..5fcaf426107 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c
@@ -2,7 +2,7 @@
   The implementation of EDKII Redfish Platform Config Protocol.

   (C) Copyright 2021-2022 Hewlett 

Re: [edk2-devel] [PATCH V3 1/6] RedfishPkg/RedfishPlatformConfigDxe: Config language searching optimization

2024-04-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, April 4, 2024 6:18 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V3 1/6] RedfishPkg/RedfishPlatformConfigDxe: Config 
language searching optimization


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: abnchang 

Build up the x-uefi-redfish string database for the Redfish confg
language searching, instead of using HII String protocol.
This can improve the time consumption lot on searching strings.

Signed-off-by: Abner Chang 
Co-authored-by: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 .../RedfishPlatformConfigImpl.h   | 107 ++-
 .../RedfishPlatformConfigDxe.c|  23 +-
 .../RedfishPlatformConfigImpl.c   | 819 +-
 3 files changed, 877 insertions(+), 72 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
index 9f4312decf5..8b8c544d58e 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
@@ -2,7 +2,8 @@
   This file defines the EDKII Redfish Platform Config Protocol private 
structure.

   (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
-  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -30,6 +31,10 @@
 #define ENGLISH_LANGUAGE_CODE  "en-US"
 #define X_UEFI_SCHEMA_PREFIX   "x-uefi-redfish-"

+#define MAX_X_UEFI_REDFISH_STRING_SIZE  (128 * 2)// 128 character in UCS.
+
+typedef struct _REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE 
REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE;
+
 //
 // Definition of REDFISH_PLATFORM_CONFIG_PRIVATE.
 //
@@ -46,17 +51,49 @@ typedef struct {
   CHAR8**SchemaList;// Schema list
 } REDFISH_PLATFORM_CONFIG_SCHEMA;

+// Defines the number of elements in array
+#define X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER  1024
+
+//
+// Definition of x-uefi-redfish string element.
+//
+typedef struct {
+  EFI_STRING_IDStringId;
+  CHAR16   *UcsString;
+} REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENT;
+
+//
+// Discrete string array buffer, each has X_UEFI_REDFISH_STRING_ARRAY_NUMBER 
element.
+//
+typedef struct {
+  LIST_ENTRY  NextArray;
+  REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENT*ArrayEntryAddress;
+} REDFISH_X_UEFI_STRINGS_ARRAY;
+
+//
+// x-uefi-redfish string database, x-uefi-redfish language based.
+//
+typedef struct {
+  LIST_ENTRYNextXuefiRedfishLanguage; 
// Link to the next suppoted x-uefi-Redfish language.
+  CHAR8 *XuefiRedfishLanguage;
// x-uefi-redfish language.
+  UINTN StringsArrayBlocks;   
// Number of the array blocks that accommodate 
X_UEFI_REDFISH_STRING_ARRAY_NUMBER
+  
// elements in each.
+  LIST_ENTRYXuefiRedfishStringArrays; 
// Link entry of x-uefi-redfish string array.
+} REDFISH_X_UEFI_STRING_DATABASE;
+
 //
 // Definition of REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE
 //
 typedef struct {
   LIST_ENTRYLink;
-  HII_FORMSET   *HiiFormSet; // Pointer to HII formset 
data.
-  EFI_GUID  Guid;// Formset GUID.
-  EFI_HII_HANDLEHiiHandle;   // Hii Handle of this 
formset.
-  LIST_ENTRYHiiFormList; // Form list that keep 
form data under this formset.
-  CHAR16*DevicePathStr;  // Device path of this 
formset.
-  REDFISH_PLATFORM_CONFIG_SCHEMASupportedSchema; // Schema that is 
supported in this formset.
+  HII_FORMSET   *HiiFormSet;// Pointer to 
HII formset data.
+  EFI_GUID  Guid;   // Formset 
GUID.
+  EFI_HII_HANDLEHiiHandle;  // Hii Handle 
of this formset.
+  EFI_HII_PACKAGE_LIST_HEADER   *HiiPackageListHeader;  // Hii Package 
list header.
+  LIST_ENTRYHiiFormList;// Form list 
that keep form data under this formset.
+  CHAR16*DevicePathStr; // Device path 
of this formset.
+  REDFISH_PLATFORM_CONFIG_SCHEMASupportedSchema;// Schema that 
is supported in this formset.
+  LIST_ENTRY  

Re: [edk2-devel] [PATCH V3 3/6] RedfishPkg/RedfishPlatformConfigDxe:Add RefishDebugLib support

2024-04-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, April 4, 2024 6:18 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V3 3/6] RedfishPkg/RedfishPlatformConfigDxe:Add 
RefishDebugLib support


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

Add RedfishPlatformConfigDxe debug capability that aligns
with edk2 Redfish debug mechanism.

- PcdRedfishPlatformConfigDebugProperty, add PCD to control
  RedfishPlatformConfigDxe subordinate of Redfish debug
  capabilities.
- PcdRedfishPlatformConfigFeatureProperty, add PCD to
  manage RedfishPlatformConfigDxe features.

Signed-off-by: Abner Chang 
Co-authored-by: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 RedfishPkg/RedfishPkg.dec |  15 +++
 .../RedfishPlatformConfigDxe.inf  |   8 ++
 .../RedfishPlatformConfigDxe.h|  46 +++-
 .../RedfishPlatformConfigImpl.h   |  28 +
 .../RedfishPlatformConfigCapability.c |  58 ++
 .../RedfishPlatformConfigDxe.c|  59 +++---
 .../RedfishPlatformConfigImpl.c   | 107 +++---
 7 files changed, 262 insertions(+), 59 deletions(-)
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigCapability.c

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index a9665ff68ef..c048e43f53b 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -193,3 +193,18 @@
   #   0x0001  RedfishPlatformConfigDxe driver debug enabled.
   #
   gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory|0|UINT64|0x1012
+  #
+  # Redfish RedfishPlatformConfigDxe Debug Properties
+  #   0x0001  x-uefi-redfish string database message enabled
+  #   0x0002  Debug Message for dumping formset
+  #   0x0004  Debug Message for x-uefi-redfish searching result
+  #   0x0008  Debug Message for x-uefi-redfish Regular Expression 
searching result
+  #
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigDebugProperty|0|UINT32|0x1013
+  #
+  # RedfishPlatformConfigDxe feature enablement
+  #   0x0001  Enable building Redfish Attribute Registry menu path.
+  #   0x0002  Allow supressed HII option to be exposed on Redfish.
+  #
+  # Redfish RedfishPlatformConfigDxe feature Properties
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigFeatureProperty|0|UINT32|0x1014
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf
index 5a249c8c3bc..2db47c2cffc 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf
@@ -3,6 +3,7 @@
 #
 #  (C) Copyright 2021 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
 #
@@ -23,6 +24,7 @@
   RedfishPkg/RedfishPkg.dec

 [Sources]
+  RedfishPlatformConfigCapability.c
   RedfishPlatformConfigDxe.h
   RedfishPlatformConfigDxe.c
   RedfishPlatformConfigImpl.h
@@ -36,7 +38,9 @@
   HiiLib
   HiiUtilityLib
   MemoryAllocationLib
+  PcdLib
   PrintLib
+  RedfishDebugLib
   UefiLib
   UefiBootServicesTableLib
   UefiRuntimeServicesTableLib
@@ -51,5 +55,9 @@
 [Guids]
   gEfiRegexSyntaxTypePerlGuid ## CONSUMED

+[FixedPcd]
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigFeatureProperty
+ gEfiRedfishPkgTokenSpaceGuid.PcdRedfishPlatformConfigDebugProperty
+
 [Depex]
   TRUE
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
index 38adea04c5b..688f2067bff 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
@@ -3,6 +3,7 @@

   (C) Copyright 2021 Hewlett Packard Enterprise Development LP
   Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -20,7 +21,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,6 +40,41 @@
 //
 #include 

+//
+// Debug message in DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE scope.
+// To enable the debug message for this module, below PCDs must be set.
+//
+// 1. DEBUG_MANAGEABILITY must be set PcdDebugPrintErrorLevel.
+//
+// 2  RedfishPlatformConfigDxe debug enablement must be set in
+//PcdRedfishDebugCategory (defined in RedfishPkg.dec)
+//
+// 3. The suborinate debug enablement 

Re: [edk2-devel] [PATCH V3 0/6] Config language searching algorithm enhancement and the bug fixes

2024-04-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, April 4, 2024 6:18 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V3 0/6] Config language searching algorithm 
enhancement and the bug fixes


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

PR # 5517

In V3, adddressed comments from Nickle and Igor.
In V2, add patch 6/6 contibuted by Nvidia for updating BIOS
menu path implementation based on the performance improvement.

In this patch set,
1 We enhance the config language searching algorithm.
  As the performance of searching config language using HII GetString is
  pretty slow. For the example, 1800 HII BIOS options takes over 30 mins
  to build up the metadata required for Redfish BIOS resource. With this
  improvement, it only takes 4 seconds.

2.Introduce the Redfish debug framework, there are three edk2 Redfish
  debug scopes.
  a. PcdDebugPrintErrorLevel, DEBUG_MANAGEABILITY to enable debug message
 for edk2 Redfish.
  b. PcdRedfishDebugCategory, enablement of individule edk2 Redfish
 component. Currently we only support RedfishPlatformConfigDxe
 module.
  c. PcdRedfishPlatformConfigDebugProperty, edk2 Redfish module debug
 scope. This PCD is used by RedfishPlatformConfigDxe debug enablement.

3 This patch set also fixes an issue that deletes HII string unexpectedly.

Signed-off-by: Abner Chang 
Co-authored-by: Nickle Wang 
Cc: Igor Kulchytskyy 

Abner Chang (4):
  RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro
  RedfishPkg/RedfishPlatformConfigDxe:Add RefishDebugLib support
  RedfishPkg/RedfishPlatformConfigDxe: HII string is deleted
unexpectedly
  EmulatorPkg/Redfish: Use edk2 Redfish debug PCDs

Nickle Wang (1):
  RedfishPkg/RedfishPlatformConfigDxe: support menu path report

abnchang (1):
  RedfishPkg/RedfishPlatformConfigDxe: Config language searching
optimization

 RedfishPkg/RedfishPkg.dec |  24 +
 EmulatorPkg/EmulatorPkg.dsc   |  21 +
 .../RedfishDebugLib/RedfishDebugLib.inf   |   4 +
 .../RedfishPlatformConfigDxe.inf  |   8 +
 RedfishPkg/Include/Library/RedfishDebugLib.h  |  43 +-
 .../RedfishPlatformConfigDxe.h|  48 +-
 .../RedfishPlatformConfigImpl.h   | 135 ++-
 .../Library/RedfishDebugLib/RedfishDebugLib.c |  55 +-
 .../RedfishPlatformConfigCapability.c |  58 ++
 .../RedfishPlatformConfigDxe.c|  89 +-
 .../RedfishPlatformConfigImpl.c   | 927 --
 11 files changed, 1239 insertions(+), 173 deletions(-)
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigCapability.c

--
2.37.1.windows.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117431): https://edk2.groups.io/g/devel/message/117431
Mute This Topic: https://groups.io/mt/105326102/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 2/6] RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro

2024-04-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, April 4, 2024 6:18 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V3 2/6] RedfishPkg/RedfishDebugLib: Introduce 
Redfish DEBUG macro


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

Introduce DEBUG_REDFISH macro for the debug message
of edk2 Redfish components.
DEBUG_REDFISH can be used in any edk2 Redfish component
with Redfish DebugCatagory as the first parameter.
Whether the debug message is output or not depends on
the platform setting of PcdRedfishDebugCatagory.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Reviewed-by: Nickle Wang 
---
 RedfishPkg/RedfishPkg.dec |  9 +++
 .../RedfishDebugLib/RedfishDebugLib.inf   |  4 ++
 RedfishPkg/Include/Library/RedfishDebugLib.h  | 43 +++
 .../Library/RedfishDebugLib/RedfishDebugLib.c | 55 ---
 4 files changed, 57 insertions(+), 54 deletions(-)

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index 1a9c9ed7bc5..a9665ff68ef 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -5,6 +5,7 @@
 # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
 # Copyright (c) 2023, American Megatrends International LLC.
 # Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -184,3 +185,11 @@
   gEfiRedfishPkgTokenSpaceGuid.PcdHttpRetryWaitInSecond|1|UINT16|0x1010
   ## This is used to disable Redfish HTTP cache function and every request 
will be sent to Redfish service.
   gEfiRedfishPkgTokenSpaceGuid.PcdHttpCacheDisabled|FALSE|BOOLEAN|0x1011
+  #
+  # Redfish debug catagories
+  # To enable the debug message for the entire edk2 Redfish implementation, 
below PCDs must be set.
+  # DEBUG_MANAGEABILITY must be set PcdDebugPrintErrorLevel.
+  #
+  #   0x0001  RedfishPlatformConfigDxe driver debug enabled.
+  #
+  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory|0|UINT64|0x1012
diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf 
b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
index d468bb213b6..42ff321b48e 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
@@ -2,6 +2,7 @@
 #  INF file for Redfish debug library.
 #
 #  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -35,5 +36,8 @@
   RedfishHttpLib
   UefiLib

+[FixedPcd]
+  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory
+
 [Depex]
   TRUE
diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h 
b/RedfishPkg/Include/Library/RedfishDebugLib.h
index ad7a6975867..19e5a895cc8 100644
--- a/RedfishPkg/Include/Library/RedfishDebugLib.h
+++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
@@ -2,6 +2,7 @@
   This file defines the Redfish debug library interface.

   Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -11,28 +12,48 @@
 #define REDFISH_DEBUG_LIB_H_

 #include 
+#include 
 #include 
 #include 
 #include 

 #include 

-#define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY   ///< Debug error 
level for Redfish networking function
-#define DEBUG_REDFISH_HOST_INTERFACE  DEBUG_MANAGEABILITY   ///< Debug error 
level for Redfish networking function
+// Used with MdePKg DEBUG macro.
+#define DEBUG_REDFISH_NETWORK  DEBUG_MANAGEABILITY  ///< Debug 
error level for Redfish networking function
+#define DEBUG_REDFISH_HOST_INTERFACE   DEBUG_MANAGEABILITY  ///< Debug 
error level for Redfish Host INterface
+#define DEBUG_REDFISH_PLATFORM_CONFIG  DEBUG_MANAGEABILITY  ///< Debug 
error level for Redfish Platform Configure Driver
+
+//
+// Definitions of Redfish debug capability in Redfish component scope, used 
with DEBUG_REDFISH macro
+// For example, Redfish Platform Config Driver
+//   DEBUG_REDFISH(DEBUG_REDFISH_PLATFORM_CONFIG_DXE, ...)
+//
+#define DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE  0x0001
+
+#define DEBUG_REDFISH(DebugCategory, ...) \
+do {\
+  if (!DebugPrintEnabled()) {   \
+break;  \
+  } \
+  if (!DebugRedfishComponentEnabled (DebugCategory)) { \
+break; \

Re: [edk2-devel] [PATCH V2 1/6] RedfishPkg/RedfishPlatformConfigDxe: Config language searching optimization

2024-04-03 Thread Igor Kulchytskyy via groups.io
Hi Abner,
Sorry for that delay.
Here is a couple of remarks.
DescriptionStr was introduced and, I think, it can be used in 
RedfishPlatformConfigProtocolGetAttribute function instead of using 
HiiGetRedfishString.
Also please check my comment below in NewRedfishXuefiStringArray and 
RedfishXuefiStringInsertDatabase  functions.
Best regards,
Igor


-Original Message-
From: abner.ch...@amd.com 
Sent: Tuesday, March 26, 2024 11:15 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V2 1/6] RedfishPkg/RedfishPlatformConfigDxe: Config 
language searching optimization


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: abnchang 

Build up the x-uefi-redfish string database for the Redfish confg
language searching, instead of using HII String protocol.
This can improve the time consumption lot on searching strings.

Signed-off-by: Abner Chang 
Co-authored-by: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../RedfishPlatformConfigImpl.h   | 107 ++-
 .../RedfishPlatformConfigDxe.c|  23 +-
 .../RedfishPlatformConfigImpl.c   | 820 +-
 3 files changed, 878 insertions(+), 72 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
index 9f4312decf5..6e6c7fdb8a9 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
@@ -2,7 +2,8 @@
   This file defines the EDKII Redfish Platform Config Protocol private 
structure.

   (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
-  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -30,6 +31,10 @@
 #define ENGLISH_LANGUAGE_CODE  "en-US"
 #define X_UEFI_SCHEMA_PREFIX   "x-uefi-redfish-"

+#define MAX_X_UEFI_REDFISH_STRING_SIZE  (128 * 2)// 128 character in UCS.
+
+typedef struct _REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE 
REDFISH_PLATFORM_CONFIG_STATEMENT_PRIVATE;
+
 //
 // Definition of REDFISH_PLATFORM_CONFIG_PRIVATE.
 //
@@ -46,17 +51,49 @@ typedef struct {
   CHAR8**SchemaList;// Schema list
 } REDFISH_PLATFORM_CONFIG_SCHEMA;

+// Defines the number of elements in array
+#define X_UEFI_REDFISH_STRING_ARRAY_ENTRY_NUMBER  1024
+
+//
+// Definition of x-uefi-redfish string element.
+//
+typedef struct {
+  EFI_STRING_IDStringId;
+  CHAR16   *UcsString;
+} REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENT;
+
+//
+// Discrete string array buffer, each has X_UEFI_REDFISH_STRING_ARRAY_NUMBER 
element.
+//
+typedef struct {
+  LIST_ENTRY  NextArray;
+  REDFISH_X_UEFI_STRINGS_ARRAY_ELEMENT*ArrayEntryAddress;
+} REDFISH_X_UEFI_STRINGS_ARRAY;
+
+//
+// x-uefi-redfish string database, x-uefi-redfish language based.
+//
+typedef struct {
+  LIST_ENTRYNextXuefiRedfishLanguage; 
// Link to the next suppoted x-uefi-Redfish language.
+  CHAR8 *XuefiRedfishLanguage;
// x-uefi-redfish language.
+  UINTN StringsArrayBlocks;   
// Number of the array blocks that accommodate 
X_UEFI_REDFISH_STRING_ARRAY_NUMBER
+  
// elements in each.
+  LIST_ENTRYXuefiRedfishStringArrays; 
// Link entry of x-uefi-redfish string array.
+} REDFISH_X_UEFI_STRING_DATABASE;
+
 //
 // Definition of REDFISH_PLATFORM_CONFIG_FORM_SET_PRIVATE
 //
 typedef struct {
   LIST_ENTRYLink;
-  HII_FORMSET   *HiiFormSet; // Pointer to HII formset 
data.
-  EFI_GUID  Guid;// Formset GUID.
-  EFI_HII_HANDLEHiiHandle;   // Hii Handle of this 
formset.
-  LIST_ENTRYHiiFormList; // Form list that keep 
form data under this formset.
-  CHAR16*DevicePathStr;  // Device path of this 
formset.
-  REDFISH_PLATFORM_CONFIG_SCHEMASupportedSchema; // Schema that is 
supported in this formset.
+  HII_FORMSET   *HiiFormSet;// Pointer to 
HII formset data.
+  EFI_GUID  Guid;   // Formset 
GUID.
+  EFI_HII_HANDLEHiiHandle;  // Hii Handle 
of this formset.
+  EFI_HII_PACKAGE_LIST_HEADER   *HiiPackageListHeader;  // Hii Package 
list header.
+  LIST_ENTRYHiiFormList;// Form list 
that 

Re: [edk2-devel] [PATCH V2 0/6] [PATCH V2 0/5] Config language searching algorithm enhancement and the bug fixes

2024-03-29 Thread Igor Kulchytskyy via groups.io
Hi Abner,
I'm very sorry, so busy those days with release.
I will be able to check it next week only.
Best regards,
Igor

Get Outlook for Android

From: Chang, Abner 
Sent: Wednesday, March 27, 2024 3:43:55 AM
To: Nickle Wang ; devel@edk2.groups.io 

Cc: Igor Kulchytskyy 
Subject: [EXTERNAL] RE: [PATCH V2 0/6] [PATCH V2 0/5] Config language searching 
algorithm enhancement and the bug fixes


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Igor,
If time is allowed, please also review this patch set.
Thanks
Abner

> -Original Message-
> From: Nickle Wang 
> Sent: Wednesday, March 27, 2024 3:42 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Igor Kulchytskyy 
> Subject: RE: [PATCH V2 0/6] [PATCH V2 0/5] Config language searching
> algorithm enhancement and the bug fixes
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> I have tested this patch series on my system and got a lot of performance
> improvements too.
>
> Great work, Abner!
>
> Regards,
> Nickle
>
> > -Original Message-
> > From: abner.ch...@amd.com 
> > Sent: Tuesday, March 26, 2024 11:15 PM
> > To: devel@edk2.groups.io
> > Cc: Nickle Wang ; Igor Kulchytskyy 
> > Subject: [PATCH V2 0/6] [PATCH V2 0/5] Config language searching
> algorithm
> > enhancement and the bug fixes
> >
> > External email: Use caution opening links or attachments
> >
> >
> > From: Abner Chang 
> >
> > PR # 5491
> >
> > In V2, add patch 6/6 contibuted by Nvidia for updating BIOS menu path
> > implementation based on the performance improvement.
> >
> > In this patch set,
> > 1 We enhance the config language searching algorithm.
> >   As the performance of searching config language using HII GetString is
> >   pretty slow. For the example, 1800 HII BIOS options takes over 30 mins
> >   to build up the metadata required for Redfish BIOS resource. With this
> >   improvement, it only takes 4 seconds.
> >
> > 2.Introduce the Redfish debug framework, there are three edk2 Redfish
> >   debug scopes.
> >   a. PcdDebugPrintErrorLevel, DEBUG_MANAGEABILITY to enable debug
> message
> >  for edk2 Redfish.
> >   b. PcdRedfishDebugCategory, enablement of individule edk2 Redfish
> >  component. Currently we only support RedfishPlatformConfigDxe
> >  module.
> >   c. PcdRedfishPlatformConfigDebugProperty, edk2 Redfish module debug
> >  scope. This PCD is used by RedfishPlatformConfigDxe debug enablement.
> >
> > 3 This patch set also fixes an issue that deletes HII string unexpectedly.
> >
> > Signed-off-by: Abner Chang 
> > Co-authored-by: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> >
> > Abner Chang (4):
> >   RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro
> >   RedfishPkg/RedfishPlatformConfigDxe:Add RefishDebugLib support
> >   RedfishPkg/RedfishPlatformConfigDxe: HII string is deleted
> > unexpectedly
> >   EmulatorPkg/Redfish: Use edk2 Redfish debug PCDs
> >
> > Nickle Wang (1):
> >   RedfishPkg/RedfishPlatformConfigDxe: support menu path report
> >
> > abnchang (1):
> >   RedfishPkg/RedfishPlatformConfigDxe: Config language searching
> > optimization
> >
> >  RedfishPkg/RedfishPkg.dec |  24 +
> >  EmulatorPkg/EmulatorPkg.dsc   |  21 +
> >  .../RedfishDebugLib/RedfishDebugLib.inf   |   4 +
> >  .../RedfishPlatformConfigDxe.inf  |   8 +
> >  RedfishPkg/Include/Library/RedfishDebugLib.h  |  43 +-
> >  .../RedfishPlatformConfigDxe.h|  48 +-
> >  .../RedfishPlatformConfigImpl.h   | 135 ++-
> >  .../Library/RedfishDebugLib/RedfishDebugLib.c |  55 +-
> >  .../RedfishPlatformConfigCapability.c |  58 ++
> >  .../RedfishPlatformConfigDxe.c|  89 +-
> >  .../RedfishPlatformConfigImpl.c   | 928 --
> >  11 files changed, 1240 insertions(+), 173 deletions(-)  create mode 100644
> > RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigCapability.c
> >
> > --
> > 2.37.1.windows.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117234): https://edk2.groups.io/g/devel/message/117234
Mute This Topic: https://groups.io/mt/105159781/21656
Group Owner: 

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

2024-03-05 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Whole patch reviewed
Regards,
Igor

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 29, 2024 3:53 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH 00/13] use Redfish HTTP protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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.

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

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then 

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

2024-03-05 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
Sorry, for late response.
AMI does not use RedfishLib in RedfishClientPkg, but library in RedfishPkg used.
Thank you,
Igor


From: Nickle Wang 
Sent: Thursday, February 29, 2024 8:24 PM
To: Mike Maslenkin ; devel@edk2.groups.io; Igor 
Kulchytskyy 
Cc: Abner Chang 
Subject: [EXTERNAL] RE: [edk2-devel] [edk2-redfish-client][PATCH 00/13] use 
Redfish HTTP protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Mike,



> May I know why didn't you remove

> RedfishClientPkg/PrivateLibrary/RedfishLib completely?



Yes, Abner and I had discussed this before. RedfishLib brings some difficulty 
to maintain because it is private library in two separated repositories.



Before we go and remove it, we like to make sure that no one is using it. @Igor 
Kulchytskyy, if my memory serves me well, you mentioned 
that AMI is using RedfishLib. Is it ok for us to remove RedfishLib in 
RedfishCientPkg (not RedfishPkg)?



Thanks,

Nickle



> -Original Message-

> From: Mike Maslenkin 
> mailto:mike.maslen...@gmail.com>>

> Sent: Friday, March 1, 2024 8:08 AM

> To: devel@edk2.groups.io; Nickle Wang 
> mailto:nick...@nvidia.com>>

> Cc: Abner Chang mailto:abner.ch...@amd.com>>; Igor 
> Kulchytskyy mailto:ig...@ami.com>>

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

> protocol

>

> External email: Use caution opening links or attachments

>

>

> Good work, Nickle!

>

> On Thu, Feb 29, 2024 at 11:53 AM Nickle Wang via groups.io

> mailto:nicklew=nvidia@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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith

> > ub.com%2Ftianocore%2Fedk2-redfish-

> client%2Fpull%2F79=05%7C02%7Cni

> >

> cklew%40nvidia.com%7C44d7d139b40b4acff94508dc3983b3df%7C43083d1572

> 7340

> >

> c1b7db39efd9ccc17a%7C0%7C0%7C638448485034820142%7CUnknown%7CTW

> FpbGZsb3

> >

> d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D

> %7

> >

> C0%7C%7C%7C=ocqaIR0%2BtKvx8ETphWlWFX2uZIQbQvDKWkn7D36c2z

> 0%3D

> > erved=0

> >

> > Signed-off-by: Nickle Wang mailto:nick...@nvidia.com>>

> > Cc: Abner Chang mailto:abner.ch...@amd.com>>

> > Cc: Igor Kulchytskyy mailto:ig...@ami.com>>

> >

> > 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 +-

> 

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

2024-02-28 Thread Igor Kulchytskyy via groups.io




-Original Message-
From: Chang, Abner 
Sent: Wednesday, February 28, 2024 7:31 PM
To: Nickle Wang ; Mike Maslenkin 
; Igor Kulchytskyy 
Cc: devel@edk2.groups.io; Nick Ramirez 
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement 
Redfish HTTP protocol





**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**



[AMD Official Use Only - General]



> -Original Message-

> From: Nickle Wang mailto:nick...@nvidia.com>>

> Sent: Thursday, February 29, 2024 8:11 AM

> To: Mike Maslenkin mailto:mike.maslen...@gmail.com>>

> Cc: devel@edk2.groups.io; Igor Kulchytskyy 
> mailto:ig...@ami.com>>; Chang, Abner

> mailto:abner.ch...@amd.com>>; Nick Ramirez 
> mailto:nrami...@nvidia.com>>

> Subject: RE: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish

> HTTP protocol

>

> Caution: This message originated from an External Source. Use proper caution

> when opening attachments, clicking links, or responding.

>

>

> > Sure!

> >

> > Reviewed-by: Mike Maslenkin 
> > mailto:mike.maslen...@gmail.com>>

>

> Thanks, Mike!

>

> > But I didn't see any implementation of gzip coding/encoding for edk2.

> > Do you know of any?

>

> I just talked to Aber about this. We are working to see if we can provide gzip

> implementation in edk2 or not. It seems to me that we need 3rd party library

> to edk2 for supporting gzip. Anber, please feel free to correct me if I am 
> wrong.

Yes and we hope someone can provide the implementation. @Igor Kulchytskyy, does 
AMI has the implementation of gzip? 

BTW, we do have a proposal that introduces EFI_SOURCE_CODING_PROTOCOL long time 
ago while I was worked for HPE. I think we should pick up this one and promote 
this protocol in UEFI spec, we can work with AMI on this as well.



Thanks

Abner



Hi Abner,

Unfortunately, AMI does not have the implementation of gzip.

Why do you think AMI has it? 

I can investigate the 3rd party libraries to be adopted for using in UEFI 
environment.

Thank you,

Igor



>

> > 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.

>

> Yes, I also have patch for edk2-redfish-client to use Redfish HTTP protocol. I

> had tested Redfish HTTP protocol on edk2-redfish-client. I will send out patch

> for review after Redfish HTTP protocol gets merged in edk2.

>

> Regards,

> Nickle

>

> > -Original Message-

> > From: Mike Maslenkin 
> > mailto:mike.maslen...@gmail.com>>

> > Sent: Thursday, February 29, 2024 1:56 AM

> > To: Nickle Wang mailto:nick...@nvidia.com>>

> > Cc: devel@edk2.groups.io; Igor Kulchytskyy 
> > mailto:ig...@ami.com>>; Abner Chang

> > mailto:abner.ch...@amd.com>>; Nick Ramirez 
> > mailto:nrami...@nvidia.com>>

> > Subject: Re: [edk2-devel] [PATCH v2 2/6] RedfishPkg: implement Redfish

> HTTP

> > protocol

> >

> > External email: Use caution opening links or attachments

> >

> >

> > On Wed, Feb 28, 2024 at 2:47 PM Nickle Wang 
> > mailto:nick...@nvidia.com>>

> wrote:

> > >

> > > Hi @Mike Maslenkin,

> > >

> > >

> > >

> > > May I have your reviewed-by if version 3 patch set look good to you?

> > >

> >

> > Sure!

> >

> > Reviewed-by: Mike Maslenkin 
> > mailto:mike.maslen...@gmail.com>>

> >

> > 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 
> > > > mailto:devel@edk2.groups.io>> On Behalf Of

> > > > Nickle Wang

> > >

> > > > via groups.io

> > >

> > > > Sent: Tuesday, February 27, 2024 8:49 AM

> > >

> > > > To: Mike Maslenkin 
> > > > mailto:mike.maslen...@gmail.com>>

> > >

> > > > Cc: devel@edk2.groups.io; Igor Kulchytskyy 
> > > > mailto:ig...@ami.com>>; Abner

> > > > Chang

> > >

> > > > mailto:abner.ch...@amd.com>>; Nick Ramirez 
> > > > mailto:nrami...@nvidia.com>>

> > >

> > > > 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!

> > >

> > > >

> > >

> > > > 

Re: [edk2-devel] [PATCH] RedfishPkg/RestJsonStructureDxe: Refine REST JSON C Structure DXE driver

2024-02-27 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Sunday, February 25, 2024 9:44 PM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RestJsonStructureDxe: Refine REST JSON C 
Structure DXE driver


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

BZ #: 4711
- Add mode debug messages.
- This driver shouldn't have a dependency on Redfish package and
  the references of "Redfish" terminology.
  Remove the references of "Redfish" from this driver.
- Fix the missing parameter of DEBUG macros used in this
  driver.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../RestJsonStructureDxe.inf  |  3 +-
 .../RestJsonStructureInternal.h   |  3 +-
 .../RestJsonStructureDxe.c| 96 ++-
 3 files changed, 96 insertions(+), 6 deletions(-)

diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf 
b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
index 61e6253d318..e74c9dfd38b 100644
--- a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
@@ -2,6 +2,7 @@
 # Implementation of EFI REST JSON Structure Protocol.
 #
 #  (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 ##

@@ -17,7 +18,6 @@
 [Packages]
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
-  RedfishPkg/RedfishPkg.dec

 [Sources]
   RestJsonStructureDxe.c
@@ -26,6 +26,7 @@
 [LibraryClasses]
   BaseLib
   BaseMemoryLib
+  DebugLib
   MemoryAllocationLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h 
b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h
index 8d7175125c1..04be5cc80b5 100644
--- a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h
@@ -3,6 +3,7 @@
   Protocol.

   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -25,7 +26,7 @@
 typedef struct _REST_JSON_STRUCTURE_INSTANCE {
   LIST_ENTRY   NextRestJsonStructureInstance; 
///< Next convertor instance
   UINTNNumberOfNameSpaceToConvert;
///< Number of resource type this convertor supports.
-  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER   *SupportedRsrcIndentifier; 
///< The resource type linklist
+  EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER   *SupportedRsrcIndentifier; 
///< The supported resource type array.
   EFI_REST_JSON_STRUCTURE_TO_STRUCTURE JsonToStructure;   
///< JSON to C structure function
   EFI_REST_JSON_STRUCTURE_TO_JSON  StructureToJson;   
///< C structure to JSON function
   EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTUREDestroyStructure;  
///< Destory C struture function.
diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c 
b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
index 404866fb319..0da5132e5ae 100644
--- a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
@@ -4,12 +4,14 @@
   Protocol.

   (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/

 #include 
+#include 
 #include 
 #include "RestJsonStructureInternal.h"

@@ -72,6 +74,8 @@ RestJsonStructureRegister (
 }
   }

+  DEBUG ((DEBUG_MANAGEABILITY, "%a: %d REST JSON-C interpreter(s) to register 
for the name spaces.\n", __func__, NumberOfNS));
+
   Instance =
 (REST_JSON_STRUCTURE_INSTANCE *)AllocateZeroPool (sizeof 
(REST_JSON_STRUCTURE_INSTANCE) + NumberOfNS * sizeof 
(EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
   if (Instance == NULL) {
@@ -88,6 +92,10 @@ RestJsonStructureRegister (
   ThisSupportedInterp= JsonStructureSupported;
   for (Index = 0; Index < NumberOfNS; Index++) {
 CopyMem ((VOID *)CloneSupportedInterpId, (VOID 
*)>RestResourceInterp, sizeof 
(EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
+DEBUG ((DEBUG_MANAGEABILITY, "  Resource type : %a\n", 
ThisSupportedInterp->RestResourceInterp.NameSpace.ResourceTypeName));
+DEBUG ((DEBUG_MANAGEABILITY, "  Major version : %a\n", 
ThisSupportedInterp->RestResourceInterp.NameSpace.MajorVersion));
+DEBUG ((DEBUG_MANAGEABILITY, "  Minor version : %a\n", 
ThisSupportedInterp->RestResourceInterp.NameSpace.MinorVersion));
+DEBUG ((DEBUG_MANAGEABILITY, "  Errata 

Re: [edk2-devel] [PATCH v3 0/6] Introduce Redfish http protocol

2024-02-27 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Reviewed the whole patch v3.

Regards,
Igor

-Original Message-
From: Nickle Wang 
Sent: Monday, February 26, 2024 7:44 PM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v3 0/6] Introduce Redfish http protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

v3: address review comments.
1) handle the condition while memory allocation failure happens to
HTTP headers. Make sure that HTTP headers can be released properly while
calling HttpFreeHeaderFields().
2) Create macro ASCII_STR_DUPLICATE() to copy ASCII string.
3) Fix typos.

v2: address review comments.
1) add comment to show the source file of MathFtol.c
2) update macro to follow file name in RedfishHttpOperation.h

This patch series introduce Redfish HTTP protocol to RedfishPkg.
This is to improve Redfish performance and communication stability
between BIOS and Redfish service. Two big functions are introduced:
1) HTTP cache mechanism is implemented to reduce the number of
communiocation between BIOS and BMC.
2) HTTP request retry mechanism is implemented to handle communication
failure. With retry mechanism, Redfish feature driver can finish its job
as best as possible.

Several libraries are updated to fix build issues. Pull request is created:
https://github.com/tianocore/edk2/pull/5348

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 

Nickle Wang (6):
  RedfishPkg: introduce Redfish HTTP protocol
  RedfishPkg: implement Redfish HTTP protocol
  RedfishPkg: introduce RedfishHttpLib
  RedfishPkg/RedfishLib: include RedfishServiceData.h
  RedfishPkg/RedfishDebugLib: use RedfishHttpLib
  RedfishPkg/RedfishCrtLib: fix unresolved external symbol issue

 RedfishPkg/RedfishPkg.dec |   32 +-
 RedfishPkg/RedfishComponents.dsc.inc  |3 +-
 RedfishPkg/RedfishLibs.dsc.inc|3 +-
 RedfishPkg/RedfishPkg.dsc |5 +-
 .../RedfishDebugLib/RedfishDebugLib.inf   |4 +-
 .../Library/RedfishHttpLib/RedfishHttpLib.inf |   43 +
 .../RedfishCrtLib/RedfishCrtLib.inf   |7 +-
 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf  |   73 +
 RedfishPkg/Include/Library/RedfishDebugLib.h  |2 +-
 RedfishPkg/Include/Library/RedfishHttpLib.h   |  326 
 RedfishPkg/Include/Library/RedfishLib.h   |   17 +-
 .../Protocol/EdkIIRedfishHttpProtocol.h   |  308 
 RedfishPkg/Include/RedfishServiceData.h   |   43 +
 RedfishPkg/RedfishHttpDxe/RedfishHttpData.h   |  256 
 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h|   44 +
 .../RedfishHttpDxe/RedfishHttpOperation.h |   77 +
 .../Library/RedfishDebugLib/RedfishDebugLib.c |1 +
 .../Library/RedfishHttpLib/RedfishHttpLib.c   |  585 +++
 .../RedfishCrtLib/Ia32/MathFtol.c |   37 +
 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c   |  667 
 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c| 1344 +
 .../RedfishHttpDxe/RedfishHttpOperation.c |  692 +
 RedfishPkg/Redfish.fdf.inc|3 +-
 RedfishPkg/RedfishPkg.ci.yaml |2 +
 24 files changed, 4549 insertions(+), 25 deletions(-)
 create mode 100644 RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
 create mode 100644 RedfishPkg/Include/Library/RedfishHttpLib.h
 create mode 100644 RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h
 create mode 100644 RedfishPkg/Include/RedfishServiceData.h
 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/Library/RedfishHttpLib/RedfishHttpLib.c
 create mode 100644 RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.c

--
2.34.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116046): https://edk2.groups.io/g/devel/message/116046
Mute This Topic: https://groups.io/mt/104594891/21656
Group Owner: 

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

2024-02-27 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Sunday, February 25, 2024 11:55 PM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy ; Mike 
Maslenkin 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH] edk2-Redfish-client: Clarify 
HTTP method used for provisioning


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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
+### Redfish
 Service Implementation that Incorporates with EDK2 Redfish
 The idea of Redfish synchronization design is to manage Redfish resource 
directly by platform host
 firmware. To do this, Redfish synchronization functions have to 

Re: [edk2-devel] [PATCH v2 6/6] RedfishPkg/RedfishCrtLib: fix unresolved external symbol issue

2024-02-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:12 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 6/6] RedfishPkg/RedfishCrtLib: fix unresolved 
external symbol issue


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

-Fix below compiler error reported in edk2 CI.
ERROR - Linker #2001 from JsonLib.lib(load.obj) : unresolved external
symbol __ftol2
-The file MathFtol.c is copied from IntrinsicLib in CryptoPkg.
-Add MathFtol.c to EccCheck IgnoreFiles.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishCrtLib/RedfishCrtLib.inf   |  7 +++-
 .../RedfishCrtLib/Ia32/MathFtol.c | 37 +++
 RedfishPkg/RedfishPkg.ci.yaml |  2 +
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c

diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf 
b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
index 6ff5dba75c..3a5e309d1a 100644
--- a/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
+++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/RedfishCrtLib.inf
@@ -3,6 +3,7 @@
 #
 # Copyright (c) 2019, Intel Corporation. All rights reserved.
 # (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -23,6 +24,9 @@
 [Sources]
   RedfishCrtLib.c

+[Sources.IA32]
+  Ia32/MathFtol.c   | MSFT
+
 [LibraryClasses]
   BaseLib
   SortLib
@@ -35,4 +39,5 @@
   MdeModulePkg/MdeModulePkg.dec
   RedfishPkg/RedfishPkg.dec

-
+[BuildOptions]
+  MSFT:*_*_IA32_CC_FLAGS = /GL-
diff --git a/RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c 
b/RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
new file mode 100644
index 00..e49f00eaf5
--- /dev/null
+++ b/RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
@@ -0,0 +1,37 @@
+/** @file This file is copied from 
CryptoPkg/Library/IntrinsicLib/Ia32/MathFtol.c
+  64-bit Math Worker Function.
+  The 32-bit versions of C compiler generate calls to library routines
+  to handle 64-bit math. These functions use non-standard calling conventions.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/*
+ * Floating point to integer conversion.
+ */
+__declspec(naked) void
+_ftol2 (
+  void
+  )
+{
+  _asm {
+fistp qword ptr [esp-8]
+mov   edx, [esp-4]
+mov   eax, [esp-8]
+ret
+  }
+}
+
+__declspec(naked) void
+_ftol2_sse (
+  void
+  )
+{
+  _asm {
+fistp dword ptr [esp-4]
+mov   eax,[esp-4]
+ret
+  }
+}
diff --git a/RedfishPkg/RedfishPkg.ci.yaml b/RedfishPkg/RedfishPkg.ci.yaml
index 69b6bf39f5..b95e8bfdc7 100644
--- a/RedfishPkg/RedfishPkg.ci.yaml
+++ b/RedfishPkg/RedfishPkg.ci.yaml
@@ -2,6 +2,7 @@
 # CI configuration for NetworkPkg
 #
 # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 {
@@ -38,6 +39,7 @@
 "PrivateInclude/Crt/string.h",
 "PrivateInclude/Crt/time.h",
 "PrivateLibrary/RedfishCrtLib/RedfishCrtLib.c",
+"PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c",
 "Include/Library/RedfishCrtLib.h",
 ##
 ## For jansson library open source
--
2.34.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115823): https://edk2.groups.io/g/devel/message/115823
Mute This Topic: https://groups.io/mt/104505407/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 5/6] RedfishPkg/RedfishDebugLib: use RedfishHttpLib

2024-02-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:12 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 5/6] RedfishPkg/RedfishDebugLib: use 
RedfishHttpLib


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Remove RedfishLib and use RedfishHttpLib for debug printing
Redfish response data.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Reviewed-by: Abner Chang 
---
 RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf | 4 ++--
 RedfishPkg/Include/Library/RedfishDebugLib.h   | 2 +-
 RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c   | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf 
b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
index 048d27c6dc..d468bb213b 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  INF file for Redfish debug library.
 #
-#  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
 #
@@ -32,7 +32,7 @@
   DebugLib
   JsonLib
   MemoryAllocationLib
-  RedfishLib
+  RedfishHttpLib
   UefiLib

 [Depex]
diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h 
b/RedfishPkg/Include/Library/RedfishDebugLib.h
index 3430cf1d14..ad7a697586 100644
--- a/RedfishPkg/Include/Library/RedfishDebugLib.h
+++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
@@ -11,9 +11,9 @@
 #define REDFISH_DEBUG_LIB_H_

 #include 
+#include 
 #include 
 #include 
-#include 

 #include 

diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c 
b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
index 3728f51213..8b0425b8c3 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #ifndef IS_EMPTY_STRING
--
2.34.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115822): https://edk2.groups.io/g/devel/message/115822
Mute This Topic: https://groups.io/mt/104505408/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 4/6] RedfishPkg/RedfishLib: include RedfishServiceData.h

2024-02-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:12 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 4/6] RedfishPkg/RedfishLib: include 
RedfishServiceData.h


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Redfish common structures are moved to RedfishServiceData.h. Remove
them from RedfishLib.h

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Reviewed-by: Abner Chang 
---
 RedfishPkg/Include/Library/RedfishLib.h | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/RedfishPkg/Include/Library/RedfishLib.h 
b/RedfishPkg/Include/Library/RedfishLib.h
index 8309a67c76..fb30ff68f6 100644
--- a/RedfishPkg/Include/Library/RedfishLib.h
+++ b/RedfishPkg/Include/Library/RedfishLib.h
@@ -70,6 +70,7 @@
 #ifndef REDFISH_LIB_H_
 #define REDFISH_LIB_H_

+#include 
 #include 

 #include 
@@ -78,22 +79,6 @@
 #define ODATA_TYPE_NAME_MAX_SIZE  128
 #define ODATA_TYPE_MAX_SIZE   128

-///
-/// Library class public defines
-///
-typedef  VOID  *REDFISH_SERVICE;
-typedef  VOID  *REDFISH_PAYLOAD;
-
-///
-/// Library class public structures/unions
-///
-typedef struct {
-  EFI_HTTP_STATUS_CODE*StatusCode;
-  UINTN   HeaderCount;
-  EFI_HTTP_HEADER *Headers;
-  REDFISH_PAYLOAD Payload;
-} REDFISH_RESPONSE;
-
 ///
 /// Odata type-name mapping structure.
 ///
--
2.34.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115821): https://edk2.groups.io/g/devel/message/115821
Mute This Topic: https://groups.io/mt/104505403/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-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:11 AM
To: devel@edk2.groups.io
Cc: Igor Kulchytskyy ; Abner Chang ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 2/6] RedfishPkg: implement Redfish HTTP protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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= 

Re: [edk2-devel] [PATCH v2 3/6] RedfishPkg: introduce RedfishHttpLib

2024-02-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:12 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 3/6] RedfishPkg: introduce RedfishHttpLib


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

RedfishHttpLib is a wrapper library for Redfish feature drivers to
call Redfish HTTP Protocol easily.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Reviewed-by: Abner Chang 
---
 RedfishPkg/RedfishPkg.dec |   5 +
 RedfishPkg/RedfishLibs.dsc.inc|   3 +-
 RedfishPkg/RedfishPkg.dsc |   3 +-
 .../Library/RedfishHttpLib/RedfishHttpLib.inf |  43 ++
 RedfishPkg/Include/Library/RedfishHttpLib.h   | 326 ++
 .../Library/RedfishHttpLib/RedfishHttpLib.c   | 585 ++
 6 files changed, 963 insertions(+), 2 deletions(-)
 create mode 100644 RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
 create mode 100644 RedfishPkg/Include/Library/RedfishHttpLib.h
 create mode 100644 RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.c

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index 114f8d2ad8..1a9c9ed7bc 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -69,6 +69,11 @@
   #
   RedfishPlatformConfigLib|Include/Library/RedfishPlatformConfigLib.h

+  ##  @libraryclass  Provides the library functions to access Redfish HTTP
+  #   protocol.
+  #
+  RedfishHttpLib|Include/Library/RedfishHttpLib.h
+
 [LibraryClasses.Common.Private]
   ##  @libraryclass  Provides the private C runtime library functions.
   #   CRT library is currently used by edk2 JsonLib (open source
diff --git a/RedfishPkg/RedfishLibs.dsc.inc b/RedfishPkg/RedfishLibs.dsc.inc
index 5426957da8..55846aaa9d 100644
--- a/RedfishPkg/RedfishLibs.dsc.inc
+++ b/RedfishPkg/RedfishLibs.dsc.inc
@@ -6,7 +6,7 @@
 # of EDKII network library classes.
 #
 # (C) Copyright 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
 #
@@ -21,5 +21,6 @@
   
RedfishPlatformCredentialLib|RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
   HiiUtilityLib|RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.inf
   
RedfishPlatformConfigLib|RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
+  RedfishHttpLib|RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
 !endif

diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 5849e7cf9e..b0150043a9 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -4,7 +4,7 @@
 # Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
 # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
 # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
-# 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
 #
@@ -74,5 +74,6 @@
   RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
   RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.inf
   RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
+  RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf

   !include RedfishPkg/Redfish.dsc.inc
diff --git a/RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf 
b/RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
new file mode 100644
index 00..fd53b8c2ed
--- /dev/null
+++ b/RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
@@ -0,0 +1,43 @@
+## @file
+#  Redfish HTTP library is wrapper library for application to call Redfish
+#  HTTP protocol easily.
+#
+#  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010006
+  BASE_NAME  = RedfishHttpLib
+  FILE_GUID  = 62855D9B-441B-436B-9CA6-B7FEB7ABF54E
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = RedfishHttpLib| DXE_DRIVER UEFI_DRIVER
+  CONSTRUCTOR= RedfishHttpConstructor
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#
+
+[Sources]
+  RedfishHttpLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  RedfishPkg/RedfishPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  UefiLib
+  UefiBootServicesTableLib
+
+[Protocols]
+  gEdkIIRedfishHttpProtocolGuid   ## CONSUMES ##
+
+[depex]
+  TRUE
+
diff --git 

Re: [edk2-devel] [PATCH v2 1/6] RedfishPkg: introduce Redfish HTTP protocol

2024-02-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:11 AM
To: devel@edk2.groups.io
Cc: Igor Kulchytskyy ; Abner Chang ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 1/6] RedfishPkg: introduce Redfish HTTP protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Introduce Redfish HTTP protocol to improve Redfish performance
and communication stability between BIOS and Redfish service.
- Feature drivers often query same Redfish resource multiple
times for different purpose. Implement HTTP cache mechanism to
improve HTTP GET performance. "UseCache" parameter is provided
if application likes to send HTTP GET request to Redfish service
without using cache data.
- This driver will retire stale cache data automatically when
application modify Redfish resource at service side.
- PCD PcdHttpCacheDisabled is used to disable cache mechanism in
this driver for debugging purpose.
- PCD PcdRedfishServiceContentEncoding is used to enable content
encoding while sending data to Redfish service.
- Redfish HTTP protocol also implement retry mechanism to retry
HTTP request when BIOS receive unexpected response from Redfish service.
This function helps BIOS Redfish to finish its job as much as possible.
- PCDs are defined to control how many times BIOS will retry the
request and how many time BIOS will wait between retries.

Signed-off-by: Nickle Wang 
Co-authored-by: Igor Kulchytskyy 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Reviewed-by: Abner Chang 
---
 RedfishPkg/RedfishPkg.dec |  24 +-
 .../Protocol/EdkIIRedfishHttpProtocol.h   | 308 ++
 RedfishPkg/Include/RedfishServiceData.h   |  43 +++
 3 files changed, 374 insertions(+), 1 deletion(-)
 create mode 100644 RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h
 create mode 100644 RedfishPkg/Include/RedfishServiceData.h

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index 3ea9ff3ef7..9b424efdf3 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -4,7 +4,7 @@
 # Copyright (c) 2019, Intel Corporation. All rights reserved.
 # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
 # Copyright (c) 2023, American Megatrends International LLC.
-# 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
 ##
@@ -93,6 +93,9 @@
   # Redfish Host Interface ready notification protocol
   gEdkIIRedfishHostInterfaceReadyProtocolGuid = { 0xC3F6D062, 0x3D38, 0x4EA4, 
{ 0x92, 0xB1, 0xE8, 0xF8, 0x02, 0x27, 0x63, 0xDF } }

+  ## Include/Protocol/EdkIIRedfishHttpProtocol.h
+  gEdkIIRedfishHttpProtocolGuid = { 0x58a0f47e, 0xf45f, 0x4d44, { 0x89, 0x5b, 
0x2a, 0xfe, 0xb0, 0x80, 0x15, 0xe2 } }
+
 [Guids]
   gEfiRedfishPkgTokenSpaceGuid  = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88, 
0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}

@@ -154,3 +157,22 @@
   # 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
+  #
+  # Use below PCDs to control Redfhs HTTP protocol.
+  #
+  ## The number of retry when HTTP GET request failed. If the value is 0, 
there is no retry enabled.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpGetRetry|0|UINT16|0x100B
+  ## The number of retry when HTTP PUT request failed. If the value is 0, 
there is no retry enabled.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpPutRetry|0|UINT16|0x100C
+  ## The number of retry when HTTP PATCH request failed. If the value is 0, 
there is no retry enabled.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpPatchRetry|0|UINT16|0x100D
+  ## The number of retry when HTTP POST request failed. If the value is 0, 
there is no retry enabled.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpPostRetry|0|UINT16|0x100E
+  ## The number of retry when HTTP DELETE request failed. If the value is 0, 
there is no retry enabled.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpDeleteRetry|0|UINT16|0x100F
+  ## The number of second to wait before driver retry HTTP request. If the 
value is 0, there is no wait before next retry.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpRetryWaitInSecond|1|UINT16|0x1010
+  ## This is used to disable Redfish HTTP cache function and every request 
will be sent to Redfish service.
+  gEfiRedfishPkgTokenSpaceGuid.PcdHttpCacheDisabled|FALSE|BOOLEAN|0x1011
diff --git a/RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h 
b/RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h
new file mode 100644
index 00..fef365730d
--- /dev/null
+++ b/RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h
@@ 

Re: [edk2-devel] [PATCH v2 0/6] Introduce Redfish http protocol

2024-02-22 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Thursday, February 22, 2024 4:11 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 0/6] Introduce Redfish http protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

v2: address review comments.
1) add comment to show the source file of MathFtol.c
2) update macro to follow file name in RedfishHttpOperation.h

This patch series introduce Redfish HTTP protocol to RedfishPkg.
This is to improve Redfish performance and communication stability
between BIOS and Redfish service. Two big functions are introduced:
1) HTTP cache mechanism is implemented to reduce the number of
communiocation between BIOS and BMC.
2) HTTP request retry mechanism is implemented to handle communication
failure. With retry mechanism, Redfish feature driver can finish its job
as best as possible.

Several libraries are updated to fix build issues. Pull request is created:
https://github.com/tianocore/edk2/pull/5348

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 

Nickle Wang (6):
  RedfishPkg: introduce Redfish HTTP protocol
  RedfishPkg: implement Redfish HTTP protocol
  RedfishPkg: introduce RedfishHttpLib
  RedfishPkg/RedfishLib: include RedfishServiceData.h
  RedfishPkg/RedfishDebugLib: use RedfishHttpLib
  RedfishPkg/RedfishCrtLib: fix unresolved external symbol issue

 RedfishPkg/RedfishPkg.dec |   32 +-
 RedfishPkg/RedfishComponents.dsc.inc  |3 +-
 RedfishPkg/RedfishLibs.dsc.inc|3 +-
 RedfishPkg/RedfishPkg.dsc |5 +-
 .../RedfishDebugLib/RedfishDebugLib.inf   |4 +-
 .../Library/RedfishHttpLib/RedfishHttpLib.inf |   43 +
 .../RedfishCrtLib/RedfishCrtLib.inf   |7 +-
 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf  |   73 +
 RedfishPkg/Include/Library/RedfishDebugLib.h  |2 +-
 RedfishPkg/Include/Library/RedfishHttpLib.h   |  326 
 RedfishPkg/Include/Library/RedfishLib.h   |   17 +-
 .../Protocol/EdkIIRedfishHttpProtocol.h   |  308 
 RedfishPkg/Include/RedfishServiceData.h   |   43 +
 RedfishPkg/RedfishHttpDxe/RedfishHttpData.h   |  256 
 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.h|   44 +
 .../RedfishHttpDxe/RedfishHttpOperation.h |   76 +
 .../Library/RedfishDebugLib/RedfishDebugLib.c |1 +
 .../Library/RedfishHttpLib/RedfishHttpLib.c   |  585 +++
 .../RedfishCrtLib/Ia32/MathFtol.c |   37 +
 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c   |  667 
 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c| 1344 +
 .../RedfishHttpDxe/RedfishHttpOperation.c |  693 +
 RedfishPkg/Redfish.fdf.inc|3 +-
 RedfishPkg/RedfishPkg.ci.yaml |2 +
 24 files changed, 4549 insertions(+), 25 deletions(-)
 create mode 100644 RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.inf
 create mode 100644 RedfishPkg/Include/Library/RedfishHttpLib.h
 create mode 100644 RedfishPkg/Include/Protocol/EdkIIRedfishHttpProtocol.h
 create mode 100644 RedfishPkg/Include/RedfishServiceData.h
 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/Library/RedfishHttpLib/RedfishHttpLib.c
 create mode 100644 RedfishPkg/PrivateLibrary/RedfishCrtLib/Ia32/MathFtol.c
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpData.c
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpDxe.c
 create mode 100644 RedfishPkg/RedfishHttpDxe/RedfishHttpOperation.c

--
2.34.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115817): https://edk2.groups.io/g/devel/message/115817
Mute This Topic: https://groups.io/mt/104505401/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] RedfishPkg/RedfishDebugLib: add function to print buffer.

2024-01-09 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: Nickle Wang 
Sent: Tuesday, January 9, 2024 6:13 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2] RedfishPkg/RedfishDebugLib: add function to 
print buffer.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Introduce DumpBuffer function to print the buffer content. This helps
developer to debug Redfish issue.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/Include/Library/RedfishDebugLib.h  | 20 -
 .../Library/RedfishDebugLib/RedfishDebugLib.c | 45 +--
 2 files changed, 61 insertions(+), 4 deletions(-)

diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h 
b/RedfishPkg/Include/Library/RedfishDebugLib.h
index 5f75bad12a..3430cf1d14 100644
--- a/RedfishPkg/Include/Library/RedfishDebugLib.h
+++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
@@ -1,7 +1,7 @@
 /** @file
   This file defines the Redfish debug library interface.

-  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

@@ -138,4 +138,22 @@ DumpIpv4Address (
   IN EFI_IPv4_ADDRESS  *Ipv4Address
   );

+/**
+  Debug output raw data buffer.
+
+  @param[in]ErrorLevel  DEBUG macro error level
+  @param[in]Buffer  Debug output data buffer.
+  @param[in]BufferSize  The size of Buffer in byte.
+
+  @retval EFI_SUCCESS Debug dump finished.
+  @retval EFI_INVALID_PARAMETER   Buffer is NULL.
+
+**/
+EFI_STATUS
+DumpBuffer (
+  IN  UINTN  ErrorLevel,
+  IN  UINT8  *Buffer,
+  IN  UINTN  BufferSize
+  );
+
 #endif
diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c 
b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
index efa9a5ca13..3728f51213 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
@@ -1,7 +1,7 @@
 /** @file
   Redfish debug library to debug Redfish application.

-  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

@@ -19,8 +19,9 @@
 #define IS_EMPTY_STRING(a)  ((a) == NULL || (a)[0] == '\0')
 #endif

-#define REDFISH_JSON_STRING_LENGTH  200
-#define REDFISH_JSON_OUTPUT_FORMAT  (EDKII_JSON_COMPACT | EDKII_JSON_INDENT(2))
+#define REDFISH_JSON_STRING_LENGTH  200
+#define REDFISH_JSON_OUTPUT_FORMAT  (EDKII_JSON_COMPACT | 
EDKII_JSON_INDENT(2))
+#define REDFISH_PRINT_BUFFER_BYTES_PER_ROW  16

 /**
   Debug print the value of StatementValue.
@@ -366,3 +367,41 @@ DumpIpv4Address (

   return EFI_SUCCESS;
 }
+
+/**
+  Debug output raw data buffer.
+
+  @param[in]ErrorLevel  DEBUG macro error level
+  @param[in]Buffer  Debug output data buffer.
+  @param[in]BufferSize  The size of Buffer in byte.
+
+  @retval EFI_SUCCESS Debug dump finished.
+  @retval EFI_INVALID_PARAMETER   Buffer is NULL.
+
+**/
+EFI_STATUS
+DumpBuffer (
+  IN  UINTN  ErrorLevel,
+  IN  UINT8  *Buffer,
+  IN  UINTN  BufferSize
+  )
+{
+  UINTN  Index;
+
+  if (Buffer == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  DEBUG ((ErrorLevel, "Address: 0x%p size: %d\n", Buffer, BufferSize));
+  for (Index = 0; Index < BufferSize; Index++) {
+if (Index % REDFISH_PRINT_BUFFER_BYTES_PER_ROW == 0) {
+  DEBUG ((ErrorLevel, "\n%04X: ", Index));
+}
+
+DEBUG ((ErrorLevel, "%02X ", Buffer[Index]));
+  }
+
+  DEBUG ((ErrorLevel, "\n"));
+
+  return EFI_SUCCESS;
+}
--
2.34.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113450): https://edk2.groups.io/g/devel/message/113450
Mute This Topic: https://groups.io/mt/103617651/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 V4] RedfishClientPkg: Add ETag PCD and revise Redfish ETag functions

2024-01-08 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Sunday, January 07, 2024 9:49 PM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy ; Mike 
Maslenkin 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH V4] RedfishClientPkg: Add ETag 
PCD and revise Redfish ETag functions


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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 |   3 +
 .../RedfishFeatureUtilityLib.inf  |   2 +
 .../Library/RedfishFeatureUtilityLib.h|  47 +++-
 .../Features/Bios/v1_0_9/Dxe/BiosDxe.c|  19 +-
 .../v1_0_4/Common/BootOptionCommon.c  |   5 +-
 .../BootOption/v1_0_4/Dxe/BootOptionDxe.c |  17 +-
 .../v1_5_0/Dxe/ComputerSystemDxe.c|  13 +-
 .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c|  17 +-
 .../RedfishFeatureUtilityLib.c| 209 --
 9 files changed, 204 insertions(+), 128 deletions(-)

diff --git a/RedfishClientPkg/RedfishClientPkg.dec 
b/RedfishClientPkg/RedfishClientPkg.dec
index b350facae0..ce3b6d9752 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -3,6 +3,7 @@
 #
 # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
 # Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -76,6 +77,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..63330c8e9d 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
@@ -3,6 +3,7 @@
 #
 #  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
 #  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -54,6 +55,7 @@

 [Pcd]
   gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
+  gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported

 [Guids]

diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h 
b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
index 9513a65617..0f8aede5c4 100644
--- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
@@ -3,6 +3,7 @@

   (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
   Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -81,7 +82,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 +560,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 +945,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
+  

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

2024-01-08 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: Chang, Abner 
Sent: Sunday, January 07, 2024 9:43 PM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Nickle Wang ; Mike Maslenkin 
Subject: RE: [EXTERNAL] [edk2-redfish-client][PATCH V3] RedfishClientPkg: Add 
ETag PCD and revise Redfish ETag functions

[AMD Official Use Only - General]

Thanks for catching that, Igor. Will send out V4 for this change.

Abner

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Thursday, January 4, 2024 10:59 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Nickle Wang ; Mike Maslenkin
> 
> Subject: RE: [EXTERNAL] [edk2-redfish-client][PATCH V3] 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.
>
>
> Hi Abner,
> Some small correction in comments syntax (see below).
> Thank you,
> Igor
>
> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Thursday, January 4, 2024 4:09 AM
> To: devel@edk2.groups.io
> Cc: Nickle Wang ; Igor Kulchytskyy ;
> Mike Maslenkin 
> Subject: [EXTERNAL] [edk2-redfish-client][PATCH V3] RedfishClientPkg: Add
> ETag PCD and revise Redfish ETag functions
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> 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 |   3 +
>  .../RedfishFeatureUtilityLib.inf  |   2 +
>  .../Library/RedfishFeatureUtilityLib.h|  47 +++-
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.c|  19 +-
>  .../v1_0_4/Common/BootOptionCommon.c  |   5 +-
>  .../BootOption/v1_0_4/Dxe/BootOptionDxe.c |  17 +-
>  .../v1_5_0/Dxe/ComputerSystemDxe.c|  13 +-
>  .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c|  17 +-
>  .../RedfishFeatureUtilityLib.c| 209 --
>  9 files changed, 204 insertions(+), 128 deletions(-)
>
> diff --git a/RedfishClientPkg/RedfishClientPkg.dec
> b/RedfishClientPkg/RedfishClientPkg.dec
> index b350facae0..ce3b6d9752 100644
> --- a/RedfishClientPkg/RedfishClientPkg.dec
> +++ b/RedfishClientPkg/RedfishClientPkg.dec
> @@ -3,6 +3,7 @@
>  #
>  # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>  # Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
> @@ -76,6 +77,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..63330c8e9d 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.i
> nf
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.i
> nf
> @@ -3,6 +3,7 @@
>  #
>  #  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
>  #  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -54,6 +55,7 @@
>
>  [Pcd]
>gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
> +  gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported
>
>  [Guids]
>
> diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> index 9513a65617..0f8aede5c4 100644
> --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> @@ -3,6 +3,7 @@
>
>(C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -81,7 +82,7 @@ CopyConfiglanguageList (
>
>  /**
>
> -  Get number of node from the string. Node is 

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

2024-01-04 Thread Igor Kulchytskyy via groups.io
Hi Abner,
Some small correction in comments syntax (see below).
Thank you,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, January 4, 2024 4:09 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy ; Mike 
Maslenkin 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH V3] RedfishClientPkg: Add ETag 
PCD and revise Redfish ETag functions


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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 |   3 +
 .../RedfishFeatureUtilityLib.inf  |   2 +
 .../Library/RedfishFeatureUtilityLib.h|  47 +++-
 .../Features/Bios/v1_0_9/Dxe/BiosDxe.c|  19 +-
 .../v1_0_4/Common/BootOptionCommon.c  |   5 +-
 .../BootOption/v1_0_4/Dxe/BootOptionDxe.c |  17 +-
 .../v1_5_0/Dxe/ComputerSystemDxe.c|  13 +-
 .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c|  17 +-
 .../RedfishFeatureUtilityLib.c| 209 --
 9 files changed, 204 insertions(+), 128 deletions(-)

diff --git a/RedfishClientPkg/RedfishClientPkg.dec 
b/RedfishClientPkg/RedfishClientPkg.dec
index b350facae0..ce3b6d9752 100644
--- a/RedfishClientPkg/RedfishClientPkg.dec
+++ b/RedfishClientPkg/RedfishClientPkg.dec
@@ -3,6 +3,7 @@
 #
 # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
 # Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -76,6 +77,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..63330c8e9d 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf
@@ -3,6 +3,7 @@
 #
 #  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
 #  Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -54,6 +55,7 @@

 [Pcd]
   gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired
+  gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishServiceEtagSupported

 [Guids]

diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h 
b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
index 9513a65617..0f8aede5c4 100644
--- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
@@ -3,6 +3,7 @@

   (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
   Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.

   SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -81,7 +82,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 +560,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 +945,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_SUCCESS

Re: [edk2-devel] [edk2-redfish-client][PATCH V2] RedfishClientPkg/libredfish: Fix build error

2024-01-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor Kulchytskyy

-Original Message-
From: abner.ch...@amd.com 
Sent: Thursday, January 4, 2024 4:12 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH V2] 
RedfishClientPkg/libredfish: Fix build error


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

Fix uninitialized variable build error

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../PrivateLibrary/RedfishLib/edk2libredfish/src/service.c| 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c 
b/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c
index ddd635fe44..293ca59c02 100644
--- a/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c
+++ b/RedfishClientPkg/PrivateLibrary/RedfishLib/edk2libredfish/src/service.c
@@ -11,6 +11,7 @@
   Copyright (c) 2019, Intel Corporation. All rights reserved.
   (C) Copyright 2021-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

@@ -1260,7 +1261,8 @@ deleteUriFromServiceEx (
   CHAR8  ContentLengthStr[80];
   size_t contentLength;

-  ret = NULL;
+  ret   = NULL;
+  contentLength = 0;

   if ((service == NULL) || (uri == NULL) || (StatusCode == NULL)) {
 return NULL;
--
2.37.1.windows.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH 6/9] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver

2023-12-12 Thread Igor Kulchytskyy via groups.io
Just mistype I guess (see below)

-Original Message-
From: Mike Maslenkin 
Sent: Tuesday, December 12, 2023 9:54 AM
To: devel@edk2.groups.io
Cc: abner.ch...@amd.com; nick...@nvidia.com; Igor Kulchytskyy ; 
Mike Maslenkin 
Subject: [EXTERNAL] [PATCH 6/9] RedfishPkg: add Component Name protocols to 
RedfishConfigHandler driver


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

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 ..e85d42ebdccd
--- /dev/null
+++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
@@ -0,0 +1,216 @@
+/** @file

+  Implementation of EFI_COMPONENT_NAME_PROTOCOL and 
EFI_COMPONENT_NAME2_PROTOCOL protocol

+  for EFI Refish Config Handler Protocol

+

+  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 that the 
caller
double "that that" should be only one "that"

+ 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

+ 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishDicovery: Remedy Redfish service discovery flow

2023-12-07 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Wednesday, December 6, 2023 10:05 AM
To: devel@edk2.groups.io
Cc: Nickle Wang ; Igor Kulchytskyy ; Mike 
Maslenkin 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishDicovery: Remedy Redfish service 
discovery flow


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

Remedy Redfish service discovery flow changes made
in commit 8736b8fd.

The above fix creates the dependency with SMBIOS 42h record,
which has a problem as SMBIOS 42h may not be created when
RedfishDiscovery.Supported() is invoked even all of the
required protocols are ready on the ControllerHandle. We can’t
guarantee SMBIOS 42 structure will be always created before
ConnectController(). USB NIC maybe detected late and it means
PlatformHostInterfaceBmcUsbNicLib can populate SMBIOS 42h
information late as well. Calling to
RedfishServiceGetNetworkInterface with the previous fix may
result in no network interface for BMC-exposed NIC as SMBIOS
42h is not ready yet.This is the first issue.

Second, to skip the network interface when
NetworkInterfaceGetSubnetInfo() returns a failure also has
problem, as the NIC may be configured via RestEx->Configure().
This happens after the Host interface is discovered, as at this
moment we have the sufficient network information to configure
BMC-exposed NIC.

Base on Redfish spec in 31.1.5.2, “EFI Redfish Client may provide
selection UI of network interfaces for Redfish service discovery.",
This means edk2 Redfish client gets all network interfaces
through RedfishServiceGetNetworkInterface and choose the desired
network interface at its discretion for Redfish service.

So the fix here is:
1. In BuildNetworkInterface(), we don’t skip any network
   interface. In RedfishServiceGetNetworkInterface, we don’t
   skip any network interface even the subnet information is not
   retrieved. We will still return all of network interfaces to
   client.
2. In RedfishServiceAcquireService for
   EFI_REDFISH_RISCOVER_HOST_INTERFACE case, we don’t skip any
   network interface even the subnet information is not
   retrieved.

3. Added some more debug information.

Note: The subnet information is used for the scenario the system
is managed by a centralized Redfish service (not on BMC), says
the multiple Redfish computer system instances. As it mentions
in 31.1.5.2, Redfish client they may have to know the subnet
information so they can know the network domain the NIC is
connected. There may have multiple subnets in the corporation
network environment. So the subnet information provides client
an idea when they choose the network interface, so does VLAN ID.

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

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 833ae2b969f..1cfcbcdc794 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -487,43 +487,6 @@ CheckIsIpVersion6 (
   return FALSE;
 }

-/**
-  This function returns the  IP type supported by the Host Interface.
-
-  @retval 00h is Unknown
-  01h is Ipv4
-  02h is Ipv6
-
-**/
-STATIC
-UINT8
-GetHiIpProtocolType (
-  VOID
-  )
-{
-  EFI_STATUS Status;
-  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
-  REDFISH_INTERFACE_DATA *DeviceDescriptor;
-
-  Data = NULL;
-  DeviceDescriptor = NULL;
-  if (mSmbios == NULL) {
-Status = gBS->LocateProtocol (, NULL, (VOID 
**));
-if (EFI_ERROR (Status)) {
-  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
-}
-  }
-
-  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
-  if (!EFI_ERROR (Status) && (Data != NULL) &&
-  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
-  {
-return Data->HostIpAddressFormat;
-  }
-
-  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
-}
-
 /**
   Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.

@@ -583,7 +546,10 @@ DiscoverRedfishHostInterface (
   }

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
-  if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+  if (EFI_ERROR (Status) || (Data == NULL) || (DeviceDescriptor == NULL)) {
+DEBUG ((DEBUG_ERROR, "%a: RedfishGetHostInterfaceProtocolData is 
failed.\n", __func__));
+return Status;
+  } else {
 // Check IP Type and skip an unnecessary network protocol if does not match
 if (FilterProtocol (Instance->NetworkInterface->NetworkProtocolType, 
Data->HostIpAddressFormat)) {
   

Re: [edk2-devel] [edk2-redfish-client][PATCH v2] RedfishClientPkg/RedfishFeatureUtilityLib: validate string array

2023-12-04 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Regards,
Igor

-Original Message-
From: Nickle Wang 
Sent: Monday, December 4, 2023 4:41 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH v2] 
RedfishClientPkg/RedfishFeatureUtilityLib: validate string array


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Add function ValidateRedfishStringArrayValues to validate Redfish
request for string array type. There is case that user request
invalid string array and feature driver can not find corresponding
HII option.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../Library/RedfishFeatureUtilityLib.h|  28 +++
 .../RedfishFeatureUtilityLib.c| 187 ++
 2 files changed, 172 insertions(+), 43 deletions(-)

diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h 
b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
index 6347585c..24f0ad24 100644
--- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
@@ -990,4 +990,32 @@ GetPendingSettings (
   OUT EFI_STRING*SettingUri
   );

+/**
+  This function goes through Head and StringArray to check below:
+  1) Check and see if value in Redfish string array can be found in HII
+  configuration string array. This is to see if there is any invalid
+  values from Redfish.
+  2) Check and see if size of Head is the same as ArraySize.
+  3) Check and see if value in Redfish string array are all the same as the one
+  from HII configuration.
+
+  @param[in]  Head  The head of string array.
+  @param[in]  StringArray   Input string array.
+  @param[in]  ArraySize The size of StringArray.
+  @param[out] ValueChanged  TRUE when The order of Head is not the same as the 
order of StringArray.
+FALSE when Head and StringArray are identical.
+
+  @retval  EFI_INVALID_PARAMETER  Input parameter is NULL or ArraySize is 0.
+  @retval  EFI_NOT_FOUND  The element in Head cannot be found in 
StringArray. This is invalid request.
+  @retval  EFI_BAD_BUFFER_SIZEThe size of Head is not the same as the size 
of StringArray. This is invalid request.
+
+**/
+EFI_STATUS
+ValidateRedfishStringArrayValues (
+  IN RedfishCS_char_Array  *Head,
+  IN CHAR8 **StringArray,
+  IN UINTN ArraySize,
+  OUT BOOLEAN  *ValueChanged
+  );
+
 #endif
diff --git 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
index 6652539c..07033488 100644
--- 
a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
+++ 
b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c
@@ -866,6 +866,7 @@ ApplyFeatureSettingsStringArrayType (
   EDKII_REDFISH_VALUE   RedfishValue;
   UINTN Index;
   RedfishCS_char_Array  *Buffer;
+  BOOLEAN   ValueChanged;

   if (IS_EMPTY_STRING (Schema) || IS_EMPTY_STRING (Version) || IS_EMPTY_STRING 
(ConfigureLang) || (ArrayHead == NULL)) {
 return EFI_INVALID_PARAMETER;
@@ -886,61 +887,69 @@ ApplyFeatureSettingsStringArrayType (
   }

   //
-  // If there is no change in array, do nothing
+  // Validate input string array from BMC to see:
+  // 1) String array from BMC is valid or not.
+  // 2) If there is no change in array, do nothing.
   //
-  if (!CompareRedfishStringArrayValues (ArrayHead, 
RedfishValue.Value.StringArray, RedfishValue.ArrayCount)) {
-//
-// Apply settings from redfish
-//
-DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", __func__, 
Schema, Version, ConfigureLang));
-FreeArrayTypeRedfishValue ();
-
-//
-// Convert array from RedfishCS_char_Array to EDKII_REDFISH_VALUE
-//
-RedfishValue.ArrayCount = 0;
-Buffer  = ArrayHead;
-while (Buffer != NULL) {
-  RedfishValue.ArrayCount += 1;
-  Buffer   = Buffer->Next;
-}
+  Status = ValidateRedfishStringArrayValues (ArrayHead, 
RedfishValue.Value.StringArray, RedfishValue.ArrayCount, );
+  if (!EFI_ERROR (Status)) {
+if (ValueChanged) {
+  //
+  // Apply settings from redfish
+  //
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", __func__, 
Schema, Version, ConfigureLang));
+  FreeArrayTypeRedfishValue ();

-//
-// Allocate pool for new values
-//
-RedfishValue.Value.StringArray = AllocatePool (RedfishValue.ArrayCount 
*sizeof (CHAR8 *));
-if (RedfishValue.Value.StringArray == NULL) {
-  ASSERT (FALSE);
-  return EFI_OUT_OF_RESOURCES;
-}
+  //
+  // Convert array from RedfishCS_char_Array to EDKII_REDFISH_VALUE
+  //
+

Re: [edk2-devel] [PATCH V3 1/9] RedfishPkg/BmcUsbNicLib: Update BMC USB NIC searching algorithm

2023-12-01 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: abner.ch...@amd.com 
Sent: Monday, November 27, 2023 12:31 AM
To: devel@edk2.groups.io
Cc: Mike Maslenkin ; Nickle Wang 
; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH V3 1/9] RedfishPkg/BmcUsbNicLib: Update BMC USB NIC 
searching algorithm


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

From: Abner Chang 

Update BMC USB NIC searching algorithm for IPv4 only.

Signed-off-by: Abner Chang 
Co-authored-by: Mike Maslenkin 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Mike Maslenkin 
---
 .../PlatformHostInterfaceBmcUsbNicLib.c   | 188 --
 1 file changed, 128 insertions(+), 60 deletions(-)

diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index 95900579118..e5bf70cfd58 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -368,7 +368,9 @@ RetrievedBmcUsbNicInfo (
 ));
   CopyMem ((VOID *)>RedfishIpAddressIpv4, (VOID 
*)>IpAddress, sizeof (DestIpAddress->IpAddress));
   //
-  // According to UEFI spec, the IP address at BMC USB NIC host end is the 
IP address at BMC end minus 1.
+  // According to the design spec:
+  // 
https://github.com/tianocore/edk2/tree/master/RedfishPkg#platform-with-bmc-and-the-bmc-exposed-usb-network-device
+  // The IP address at BMC USB NIC host end is the IP address at BMC end 
minus 1.
   //
   CopyMem ((VOID *)>HostIpAddressIpv4, (VOID 
*)>IpAddress, sizeof (DestIpAddress->IpAddress));
   ThisInstance->HostIpAddressIpv4[sizeof (ThisInstance->HostIpAddressIpv4) 
- 1] -= 1;
@@ -729,8 +731,10 @@ HostInterfaceIpmiCheckMacAddress (

   //
   // According to design spec in Readme file under RedfishPkg.
-  // Compare the first five MAC address and
-  // the 6th MAC address.
+  // 
https://github.com/tianocore/edk2/tree/master/RedfishPkg#platform-with-bmc-and-the-bmc-exposed-usb-network-device
+  // Compare the first five elements of MAC address and the 6th element of 
MAC address.
+  // The 6th element of MAC address must be the 6th element of
+  // IPMI channel MAC address minus 1.
   //
   if ((IpmiLanMacAddressSize != UsbNicInfo->MacAddressSize) ||
   (CompareMem (
@@ -738,8 +742,8 @@ HostInterfaceIpmiCheckMacAddress (
  (VOID *),
  IpmiLanMacAddressSize - 1
  ) != 0) ||
-  (IpmiLanChannelMacAddress.Addr[IpmiLanMacAddressSize - 1] !=
-   *(UsbNicInfo->MacAddress + IpmiLanMacAddressSize - 1) - 1)
+  ((IpmiLanChannelMacAddress.Addr[IpmiLanMacAddressSize - 1] - 1) !=
+   *(UsbNicInfo->MacAddress + IpmiLanMacAddressSize - 1))
   )
   {
 DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "MAC address is not 
matched.\n"));
@@ -962,6 +966,49 @@ UsbNicSearchUsbIo (
   return EFI_NOT_FOUND;
 }

+/**
+  This function identifies if the USB NIC has MAC address and internet
+  protocol device path installed. (Only support IPv4)
+
+  @param[in] UsbDevicePath USB device path.
+
+  @retval EFI_SUCCESS  Yes, this is IPv4 SNP handle
+  @retval EFI_NOT_FOUNDNo, this is not IPv4 SNP handle
+
+**/
+EFI_STATUS
+IdentifyNetworkMessageDevicePath (
+  IN EFI_DEVICE_PATH_PROTOCOL  *UsbDevicePath
+  )
+{
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+
+  DevicePath = UsbDevicePath;
+  while (TRUE) {
+DevicePath = NextDevicePathNode (DevicePath);
+if (IsDevicePathEnd (DevicePath)) {
+  DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "MAC address device path is not 
found on this handle.\n"));
+  break;
+}
+
+if ((DevicePath->Type == MESSAGING_DEVICE_PATH) && (DevicePath->SubType == 
MSG_MAC_ADDR_DP)) {
+  DevicePath = NextDevicePathNode (DevicePath); // Advance to next device 
path protocol.
+  if (IsDevicePathEnd (DevicePath)) {
+DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "IPv4 device path is not found 
on this handle.\n"));
+break;
+  }
+
+  if ((DevicePath->Type == MESSAGING_DEVICE_PATH) && (DevicePath->SubType 
== MSG_IPv4_DP)) {
+return EFI_SUCCESS;
+  }
+
+  break;
+}
+  }
+
+  return EFI_NOT_FOUND;
+}
+
 /**
   This function identifies if the USB NIC is exposed by BMC as
   the host-BMC channel.
@@ -1025,7 +1072,7 @@ IdentifyUsbNicBmcChannel (
 (VOID *)>Mode->CurrentAddress,
 BmcUsbNic->MacAddressSize
 );
-  DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "MAC address (in size %d) for this 
SNP instance:\n  ", BmcUsbNic->MacAddressSize));
+  DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "MAC address (in size %d) for this 
SNP instance:\n", 

Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-20 Thread Igor Kulchytskyy via groups.io
Hello,
I created a ticket.
https://bugzilla.tianocore.org/show_bug.cgi?id=4602
Since it is my first ticket, could you please check it and tell if it is what 
we need?
Thank you,
Igor

From: Igor Kulchytskyy 
Sent: Monday, November 20, 2023 8:50 AM
To: Chang, Abner ; Laszlo Ersek ; 
devel@edk2.groups.io
Subject: Re: [EXTERNAL] RE: [edk2-devel] [PATCH v6 0/2] Fix and optimize the 
issue if IPv4 installed after RestEx

Hi Abner,
I have an account.
I will create a ticket.
Thank you,
Igor

Get Outlook for Android<https://aka.ms/AAb9ysg>

From: Chang, Abner mailto:abner.ch...@amd.com>>
Sent: Sunday, November 19, 2023 11:31:37 PM
To: Laszlo Ersek mailto:ler...@redhat.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>; Igor Kulchytskyy 
mailto:ig...@ami.com>>
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue 
if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Yes Laszlo, we need one for this.
Hi Igor, do you have an account on Bugzilla? We need a ticket for this issue.

Thnaks
Abner

> -Original Message-
> From: Laszlo Ersek mailto:ler...@redhat.com>>
> Sent: Friday, November 17, 2023 5:11 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; 
> ig...@ami.com<mailto:ig...@ami.com>; Chang, Abner
> mailto:abner.ch...@amd.com>>
> Subject: Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4
> installed after RestEx
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On 11/15/23 23:12, Igor Kulchytskyy via groups.io wrote:
> > Igor Kulchytskyy (2):
> >   RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
> > RestEx
> >   RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225 --
> >  .../RedfishDiscoverInternal.h |   4 +
> >  2 files changed, 158 insertions(+), 71 deletions(-)
>
> Should this patch series be highlighted in the release plan? Is there a BZ?
>
> Laszlo
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-20 Thread Igor Kulchytskyy via groups.io
Hi Abner,
I have an account.
I will create a ticket.
Thank you,
Igor

Get Outlook for Android<https://aka.ms/AAb9ysg>

From: Chang, Abner 
Sent: Sunday, November 19, 2023 11:31:37 PM
To: Laszlo Ersek ; devel@edk2.groups.io 
; Igor Kulchytskyy 
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue 
if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Yes Laszlo, we need one for this.
Hi Igor, do you have an account on Bugzilla? We need a ticket for this issue.

Thnaks
Abner

> -Original Message-
> From: Laszlo Ersek 
> Sent: Friday, November 17, 2023 5:11 PM
> To: devel@edk2.groups.io; ig...@ami.com; Chang, Abner
> 
> Subject: Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4
> installed after RestEx
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On 11/15/23 23:12, Igor Kulchytskyy via groups.io wrote:
> > Igor Kulchytskyy (2):
> >   RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
> > RestEx
> >   RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225 --
> >  .../RedfishDiscoverInternal.h |   4 +
> >  2 files changed, 158 insertions(+), 71 deletions(-)
>
> Should this patch series be highlighted in the release plan? Is there a BZ?
>
> Laszlo

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: 回复: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-17 Thread Igor Kulchytskyy via groups.io
Liming,
I fixed the uncrustify issues.
Thank you,
Igor

-Original Message-
From: gaoliming 
Sent: Friday, November 17, 2023 5:05 AM
To: devel@edk2.groups.io; Igor Kulchytskyy ; 'Chang, Abner' 
; 'Leif Lindholm' 
Subject: [EXTERNAL] 回复: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue 
if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Igor:
  I re-create pull request https://github.com/tianocore/edk2/pull/5052 to 
revert previous commits and append new commits.

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Igor
> Kulchytskyy via groups.io
> 发送时间: 2023年11月16日 21:45
> 收件人: Chang, Abner ; devel@edk2.groups.io; Leif
> Lindholm 
> 抄送: Gao, Liming 
> 主题: Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4
> installed after RestEx
>
> Hi Liming,
> I created PR for the final v6 patch:
> https://github.com/tianocore/edk2/pull/5050
> Could you please merge those changes?
> Thank you,
> Igor
>
> -Original Message-
> From: Chang, Abner 
> Sent: Thursday, November 16, 2023 8:03 AM
> To: devel@edk2.groups.io; Igor Kulchytskyy ; Leif Lindholm
> 
> Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v6 0/2] Fix and optimize the
> issue if IPv4 installed after RestEx
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> [AMD Official Use Only - General]
>
> Great and happy ending! 
>
> Hi Igor, could you please inform Liming he can merge this change.
> Thanks
> Abner
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Igor
> > Kulchytskyy via groups.io
> > Sent: Thursday, November 16, 2023 8:31 PM
> > To: Leif Lindholm ; devel@edk2.groups.io
> > Subject: Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4
> > installed after RestEx
> >
> > Caution: This message originated from an External Source. Use proper
> caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Thank you all for the reviews!
> >
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Thursday, November 16, 2023 7:29 AM
> > To: devel@edk2.groups.io; Igor Kulchytskyy 
> > Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the
> > issue if IPv4 installed after RestEx
> >
> >
> > **CAUTION: The e-mail below is from an external source. Please exercise
> > caution before opening attachments, clicking links, or following guidance.**
> >
> > On Wed, Nov 15, 2023 at 22:12:34 +, Igor Kulchytskyy via groups.io
> > wrote:
> > > Igor Kulchytskyy (2):
> > >   RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
> > > RestEx
> > >   RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
> > >
> > >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225
> --
> > >  .../RedfishDiscoverInternal.h |   4 +
> > >  2 files changed, 158 insertions(+), 71 deletions(-)
> >
> > Happy with this. Many thanks for the rework.
> >
> > For the series:
> > Acked-by: Leif Lindholm 
> >
> >
> > > --
> > > 2.37.1.windows.1
> > > -The information contained in this message may be confidential and
> > proprietary to American Megatrends (AMI). This communication is intended
> > to be read only by the individual or entity to whom it is addressed or by 
> > their
> > designee. If the reader of this message is not the intended recipient, you 
> > are
> > on notice that any distribution of this message, in any form, is strictly
> > prohibited. Please promptly notify the sender by reply e-mail or by
> telephone
> > at 770-246-8600, and then delete or destroy all copies of the transmission.
> > >
> > >
> > >
> > >
> > >
> > -The information contained in this message may be confidential and
> > proprietary to American Megatrends (AMI). This communication is intended
> > to be read only by the individual or entity to whom it is addressed or by 
> > their
> > designee. If the reader of this message is not the intended recipient, you 
> > are
> > on notice that any distribution of this message, in any form, is strictly
> > prohibited. Please promptly notify the sender by reply e-mail or by
> telephone
> > at 770-246-8600, and then delete or destroy all copies of the transmission.
> >
>

Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-16 Thread Igor Kulchytskyy via groups.io
Hi Liming,
I created PR for the final v6 patch:
https://github.com/tianocore/edk2/pull/5050
Could you please merge those changes?
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Thursday, November 16, 2023 8:03 AM
To: devel@edk2.groups.io; Igor Kulchytskyy ; Leif Lindholm 

Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue 
if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Great and happy ending! 

Hi Igor, could you please inform Liming he can merge this change.
Thanks
Abner

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Igor
> Kulchytskyy via groups.io
> Sent: Thursday, November 16, 2023 8:31 PM
> To: Leif Lindholm ; devel@edk2.groups.io
> Subject: Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4
> installed after RestEx
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Thank you all for the reviews!
>
> -Original Message-
> From: Leif Lindholm 
> Sent: Thursday, November 16, 2023 7:29 AM
> To: devel@edk2.groups.io; Igor Kulchytskyy 
> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the
> issue if IPv4 installed after RestEx
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> On Wed, Nov 15, 2023 at 22:12:34 +, Igor Kulchytskyy via groups.io
> wrote:
> > Igor Kulchytskyy (2):
> >   RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
> > RestEx
> >   RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225 --
> >  .../RedfishDiscoverInternal.h |   4 +
> >  2 files changed, 158 insertions(+), 71 deletions(-)
>
> Happy with this. Many thanks for the rework.
>
> For the series:
> Acked-by: Leif Lindholm 
>
>
> > --
> > 2.37.1.windows.1
> > -The information contained in this message may be confidential and
> proprietary to American Megatrends (AMI). This communication is intended
> to be read only by the individual or entity to whom it is addressed or by 
> their
> designee. If the reader of this message is not the intended recipient, you are
> on notice that any distribution of this message, in any form, is strictly
> prohibited. Please promptly notify the sender by reply e-mail or by telephone
> at 770-246-8600, and then delete or destroy all copies of the transmission.
> >
> >
> >
> >
> >
> -The information contained in this message may be confidential and
> proprietary to American Megatrends (AMI). This communication is intended
> to be read only by the individual or entity to whom it is addressed or by 
> their
> designee. If the reader of this message is not the intended recipient, you are
> on notice that any distribution of this message, in any form, is strictly
> prohibited. Please promptly notify the sender by reply e-mail or by telephone
> at 770-246-8600, and then delete or destroy all copies of the transmission.
>
>
> 
>

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-16 Thread Igor Kulchytskyy via groups.io
Thank you all for the reviews!

-Original Message-
From: Leif Lindholm 
Sent: Thursday, November 16, 2023 7:29 AM
To: devel@edk2.groups.io; Igor Kulchytskyy 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v6 0/2] Fix and optimize the issue 
if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

On Wed, Nov 15, 2023 at 22:12:34 +, Igor Kulchytskyy via groups.io wrote:
> Igor Kulchytskyy (2):
>   RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
> RestEx
>   RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
>
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225 --
>  .../RedfishDiscoverInternal.h |   4 +
>  2 files changed, 158 insertions(+), 71 deletions(-)

Happy with this. Many thanks for the rework.

For the series:
Acked-by: Leif Lindholm 


> --
> 2.37.1.windows.1
> -The information contained in this message may be confidential and 
> proprietary to American Megatrends (AMI). This communication is intended to 
> be read only by the individual or entity to whom it is addressed or by their 
> designee. If the reader of this message is not the intended recipient, you 
> are on notice that any distribution of this message, in any form, is strictly 
> prohibited. Please promptly notify the sender by reply e-mail or by telephone 
> at 770-246-8600, and then delete or destroy all copies of the transmission.
>
>
> 
>
>
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-16 Thread Igor Kulchytskyy via groups.io
Hi Leif,
Already sent it yesterday.
Thank you,
Igor

-Original Message-
From: Leif Lindholm 
Sent: Thursday, November 16, 2023 7:15 AM
To: devel@edk2.groups.io; mike.maslen...@gmail.com; Igor Kulchytskyy 

Cc: Abner Chang ; Nickle Wang 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

On 2023-11-15 18:27, Mike Maslenkin wrote:
> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy  wrote:
>>
>> Hello Leif and Mike,
>> Let me try to explain the idea of the filtering IP.
>> That filtering should work only if we know exactly that IP is IPv4 or IPv6 
>> in SMBIOS Type 42.
> Hm. I've already composed a reply below, but then a returned to this
> statement...
>
> Is this a difference in condition between v3 and v5? I came to the
> conclusion that at the place we are discussing
> SMBIOS table 42h can be absent because
> PlatformHostInterfaceInformationReady hasn't been called yet,
> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
>
>
>> And it just helping to reduce the work in case we know the exact type of IP, 
>> which supposed to be used in BIOS BMC communication.
>> In that case there is no need to build network interface for the unused IP 
>> Type.
>> On some systems IP address could be dynamic and we will not be able to know 
>> the version of IP from SMBIOS.
>> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And 
>> return IP type UNKNOWN if it is not static.
>> If we get an unknown IP type, we should not return from 
>> BuildupNetworkInterface function, but just proceed and build the network 
>> interface for all IPs.
>> So, later Redfish Discover driver can find the right one.
>> Based on this logic I'm going to prepare the patch v6.
>> Thank you,
>> Igor
>
> Agree.. I was focused on edk2 implementation of
> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
> where HostIpAddressFormat is specified (hardcoded). I guess
> HostIpAddressFormat  as well as SMBIOS table 42h must be available
> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
> call, while it might be not available at the moment
> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
> condition from v3 looks correct to me.
>
> My main concern was introduction of defines. Those don't look great.
> Those are huge (it even doesn't fit into the screen) and misleading a
> bit.
> For example:
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)>MacAddress,
> >MacAddress,
> ThisNetworkInterface->HwAddressSize))
>
> The proposed variant is equal to #define MAC_COMPARE(A, B)
> (CompareMem ((VOID *)>MacAddress,
> >MacAddress,
> ThisNetworkInterface->HwAddressSize)), i.e a bit useless.
>
> I would expect it could be declared at least as:
> #define MAC_COMPARE(This, Target)  CompareMem ((VOID
> *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
> I.e define should really replace some arguments  also reducing the line 
> length.
>
> BTW: there is a place in ValidateTargetNetworkInterface() where
> CompareMem  can be replaced with MAC_COMPARE too.
>
> Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
> edk2. But according to that one, please consider moving "== 0" check
> to #define declaration.
> But I do not think this macro is required at all, because there are 5
> MAC compares left in this module. So, it just brings some
> inconsistency.
>
> Agreed that static helper function would be the best.
>
> Leif, do you expect something like this?
> STATIC
> BOOLEAN
> FilterInterface (
>IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
>IN UINT8 HostIpAddressFormat
>)
> {
>// This is based on v5, but according to the comments above
>// v3 is correct as it allows
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
>
>if (ProtocolType == ProtocolTypeTcp4) {
>  return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
>} else if (ProtocolType == ProtocolTypeTcp6) {
>  return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
>}

Yes, this looks ideal.

>return false;

Although this should be FALSE (upper-case).

> }
>
> and then::
>
> // Get IP Type to filter out unnecessary network protocol if possible
> IpType = GetHiIpProtocolType ();
>
> for (Index = 0; Index < ListCount; Index++) {
>// Check IP Type and skip an unnecessary network protocol if does not match
>   if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) {

This gives us a big but still readable chunk here, and much neater tests
in the helper than they *could* be either in place or in macros.

>  continue;
>}

Ship it.

/
 Leif

> Regards,
> Mike.
>
>
> 
>
>

-The information contained in this message 

[edk2-devel] [PATCH v6 2/2] [edk2-stable202311] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-15 Thread Igor Kulchytskyy via groups.io
Filter out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Mike Maslenkin 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c  | 196 
++--
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   4 +
 2 files changed, 143 insertions(+), 57 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 0f622e05a9..db927dd93c 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -40,7 +40,7 @@ Tcp6GetSubnetInfo (
   IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *Instance
   );

-static REDFISH_DISCOVER_REQUIRED_PROTOCOL  gRequiredProtocol[] = {
+static REDFISH_DISCOVER_REQUIRED_PROTOCOL  mRequiredProtocol[] = {
   {
 ProtocolTypeTcp4,
 L"TCP4 Service Binding Protocol",
@@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface)) &&
+(VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
+ VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface)))
+{
   return ThisNetworkInterface;
 }

@@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -399,7 +410,7 @@ ValidateTargetNetworkInterface (

   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface)) {
   break;
 }

@@ -476,6 +487,65 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface.
+
+  @retval 00h is Unknown
+  01h is Ipv4
+  02h is Ipv6
+
+**/
+STATIC
+UINT8
+GetHiIpProtocolType (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+  }
+
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
+  {
+return Data->HostIpAddressFormat;
+  }
+
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
+/**
+  Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.
+
+  @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
+  @param[in]  IpType   The Host IP Address Type from SMBIOS Type 
42.
+**/
+STATIC
+BOOLEAN
+FilterProtocol (
+  IN UINT32 NetworkProtocolType,
+  IN UINT8 IpType
+  )
+{
+  if (NetworkProtocolType == ProtocolTypeTcp4) {
+return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
+  }
+  if (NetworkProtocolType == ProtocolTypeTcp6) {
+return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
+  }
+  return FALSE;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +582,11 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+// Check IP Type and skip an unnecessary network protocol if does not match
+if (FilterProtocol (Instance->NetworkInterface->NetworkProtocolType, 
Data->HostIpAddressFormat)) {
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1000,8 +1075,8 @@ NetworkInterfaceGetSubnetInfo (
   }

   ProtocolType = Instance->NetworkProtocolType;
-  if ((gRequiredProtocol[ProtocolType].GetSubnetInfo != NULL) && 
(Instance->GotSubnetInfo == FALSE)) {
-Status = gRequiredProtocol[ProtocolType].GetSubnetInfo (
+  if 

[edk2-devel] [PATCH v6 1/2] [edk2-stable202311] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-15 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all network
interface to be installed.

Reviewed-by: Abner Chang 
Reviewed-by: Nickle Wang 
Acked-by Mike Maslenkin 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 31 ++--
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..0f622e05a9 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -1547,25 +1547,26 @@ TestForRequiredProtocols (
 ControllerHandle,
 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
 );
+if (EFI_ERROR (Status)) {
+  return EFI_UNSUPPORTED;
+}
+
+Status = gBS->OpenProtocol (
+ControllerHandle,
+gRequiredProtocol[Index].DiscoveredProtocolGuid,
+(VOID **),
+This->DriverBindingHandle,
+ControllerHandle,
+EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
 if (!EFI_ERROR (Status)) {
-  Status = gBS->OpenProtocol (
-  ControllerHandle,
-  gRequiredProtocol[Index].DiscoveredProtocolGuid,
-  (VOID **),
-  This->DriverBindingHandle,
-  ControllerHandle,
-  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-  );
-  if (EFI_ERROR (Status)) {
-if (Index == ListCount - 1) {
-  DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
-  return EFI_SUCCESS;
-}
-  }
+  // Already installed
+  return EFI_UNSUPPORTED;
 }
   }

-  return EFI_UNSUPPORTED;
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
+  return EFI_SUCCESS;
 }

 /**
--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH v6 0/2] [edk2-stable202311] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-15 Thread Igor Kulchytskyy via groups.io
Igor Kulchytskyy (2):
  RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
RestEx
  RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225 --
 .../RedfishDiscoverInternal.h |   4 +
 2 files changed, 158 insertions(+), 71 deletions(-)

--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH v6 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-15 Thread Igor Kulchytskyy via groups.io
Filter out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Mike Maslenkin 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c  | 196 
++--
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   4 +
 2 files changed, 143 insertions(+), 57 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 0f622e05a9..db927dd93c 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -40,7 +40,7 @@ Tcp6GetSubnetInfo (
   IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *Instance
   );

-static REDFISH_DISCOVER_REQUIRED_PROTOCOL  gRequiredProtocol[] = {
+static REDFISH_DISCOVER_REQUIRED_PROTOCOL  mRequiredProtocol[] = {
   {
 ProtocolTypeTcp4,
 L"TCP4 Service Binding Protocol",
@@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface)) &&
+(VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
+ VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface)))
+{
   return ThisNetworkInterface;
 }

@@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -399,7 +410,7 @@ ValidateTargetNetworkInterface (

   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface)) {
   break;
 }

@@ -476,6 +487,65 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface.
+
+  @retval 00h is Unknown
+  01h is Ipv4
+  02h is Ipv6
+
+**/
+STATIC
+UINT8
+GetHiIpProtocolType (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+  }
+
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
+  {
+return Data->HostIpAddressFormat;
+  }
+
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
+/**
+  Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.
+
+  @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
+  @param[in]  IpType   The Host IP Address Type from SMBIOS Type 
42.
+**/
+STATIC
+BOOLEAN
+FilterProtocol (
+  IN UINT32 NetworkProtocolType,
+  IN UINT8 IpType
+  )
+{
+  if (NetworkProtocolType == ProtocolTypeTcp4) {
+return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
+  }
+  if (NetworkProtocolType == ProtocolTypeTcp6) {
+return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
+  }
+  return FALSE;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +582,11 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+// Check IP Type and skip an unnecessary network protocol if does not match
+if (FilterProtocol (Instance->NetworkInterface->NetworkProtocolType, 
Data->HostIpAddressFormat)) {
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1000,8 +1075,8 @@ NetworkInterfaceGetSubnetInfo (
   }

   ProtocolType = Instance->NetworkProtocolType;
-  if ((gRequiredProtocol[ProtocolType].GetSubnetInfo != NULL) && 
(Instance->GotSubnetInfo == FALSE)) {
-Status = gRequiredProtocol[ProtocolType].GetSubnetInfo (
+  if 

[edk2-devel] [PATCH v6 1/2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-15 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all network
interface to be installed.

Reviewed-by: Abner Chang 
Reviewed-by: Nickle Wang 
Acked-by Mike Maslenkin 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 31 ++--
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..0f622e05a9 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -1547,25 +1547,26 @@ TestForRequiredProtocols (
 ControllerHandle,
 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
 );
+if (EFI_ERROR (Status)) {
+  return EFI_UNSUPPORTED;
+}
+
+Status = gBS->OpenProtocol (
+ControllerHandle,
+gRequiredProtocol[Index].DiscoveredProtocolGuid,
+(VOID **),
+This->DriverBindingHandle,
+ControllerHandle,
+EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
 if (!EFI_ERROR (Status)) {
-  Status = gBS->OpenProtocol (
-  ControllerHandle,
-  gRequiredProtocol[Index].DiscoveredProtocolGuid,
-  (VOID **),
-  This->DriverBindingHandle,
-  ControllerHandle,
-  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-  );
-  if (EFI_ERROR (Status)) {
-if (Index == ListCount - 1) {
-  DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
-  return EFI_SUCCESS;
-}
-  }
+  // Already installed
+  return EFI_UNSUPPORTED;
 }
   }

-  return EFI_UNSUPPORTED;
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
+  return EFI_SUCCESS;
 }

 /**
--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH v6 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-15 Thread Igor Kulchytskyy via groups.io
Igor Kulchytskyy (2):
  RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
RestEx
  RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 225 --
 .../RedfishDiscoverInternal.h |   4 +
 2 files changed, 158 insertions(+), 71 deletions(-)

--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-15 Thread Igor Kulchytskyy via groups.io


-Original Message-
From: Mike Maslenkin 
Sent: Wednesday, November 15, 2023 2:26 PM
To: Igor Kulchytskyy 
Cc: Leif Lindholm ; devel@edk2.groups.io; Abner 
Chang ; Nickle Wang 
Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
RedfishDiscoverDxe: Optimize the Redfish Discover flow

Hi Igor,

On Wed, Nov 15, 2023 at 9:37 PM Igor Kulchytskyy  wrote:
>
> Hi Mike,
> My implementation of checking the IpType supposed to be like this:
> /**
>   Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.
>
>   @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
>   @param[in]  IpType   The Host IP Address Type from SMBIOS Type 
> 42.
> **/
> STATIC
> BOOLEAN
> IsTcpTypeMatch (
>   IN UINT32 NetworkProtocolType,

NetworkProtocolType has defined type -
NETWORK_INTERFACE_PROTOCOL_TYPE, why don't you use it.
Ah. I see it is declared as UINT32 in REDFISH_DISCOVER_REQUIRED_PROTOCOL... Ok.
It's not clear why, because it is internal structure.

>   IN UINT8 IpType
>   )
> {
>   if ((NetworkProtocolType == ProtocolTypeTcp4) && (IpType == 
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
> return TRUE;
>   }
>   if ((NetworkProtocolType == ProtocolTypeTcp6) && (IpType == 
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
> return TRUE;
>   }
>   return FALSE;
> }
>
> And then in BuildupNetworkInterface function.
>
>   // Get IP Type to filter out unnecessary network protocol if possible
>   IpType = GetHiIpProtocolType ();
>
>   for (Index = 0; Index < ListCount; Index++) {
> // Check IP Type and skip an unnecessary network protocol if does not 
> match
> if (!IsTcpTypeMatch (mRequiredProtocol[Index].ProtocolType, IpType)) {
>   continue;
> }

So, where is REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN handled now?

If IpType == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
IsTcpTypeMatch() always returns FALSE,
so !IsTcpTypeMatch() gives TRUE and we skip this iteration.
Effectively this means
if (IpType  == REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN ) {
  return EFI_DEVICE_ERROR
}
Just because there is nothing after this loop.
And this is not what we wanted, and recognized as my mistake previously.

Igor:
Agree. We did recognize it as mistake. My fault.
Lets stick with your version and see what Leif say.


>
> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, November 15, 2023 1:27 PM
> To: Igor Kulchytskyy 
> Cc: Leif Lindholm ; devel@edk2.groups.io; Abner 
> Chang ; Nickle Wang 
> Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
> RedfishDiscoverDxe: Optimize the Redfish Discover flow
>
> On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy  wrote:
> >
> > Hello Leif and Mike,
> > Let me try to explain the idea of the filtering IP.
> > That filtering should work only if we know exactly that IP is IPv4 or IPv6 
> > in SMBIOS Type 42.
> Hm. I've already composed a reply below, but then a returned to this
> statement...
>
> Is this a difference in condition between v3 and v5? I came to the
> conclusion that at the place we are discussing
> SMBIOS table 42h can be absent because
> PlatformHostInterfaceInformationReady hasn't been called yet,
> so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.
>
>
> > And it just helping to reduce the work in case we know the exact type of 
> > IP, which supposed to be used in BIOS BMC communication.
> > In that case there is no need to build network interface for the unused IP 
> > Type.
> > On some systems IP address could be dynamic and we will not be able to know 
> > the version of IP from SMBIOS.
> > If you see I check HostIpAssignmentType in GetHiIpProtocolType function. 
> > And return IP type UNKNOWN if it is not static.
> > If we get an unknown IP type, we should not return from 
> > BuildupNetworkInterface function, but just proceed and build the network 
> > interface for all IPs.
> > So, later Redfish Discover driver can find the right one.
> > Based on this logic I'm going to prepare the patch v6.
> > Thank you,
> > Igor
>
> Agree.. I was focused on edk2 implementation of
> RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
> where HostIpAddressFormat is specified (hardcoded). I guess
> HostIpAddressFormat  as well as SMBIOS table 42h must be available
> by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
> call, while it might be not available at the moment
> RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
> condition from v3 looks correct to me.
>
> My main concern was introduction of defines. Those don't look great.
> Those are huge (it even doesn't fit into the screen) and misleading a
> bit.
> For example:
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
> (CompareMem ((VOID *)>MacAddress,
> >MacAddress,
> ThisNetworkInterface->HwAddressSize))
>
> The proposed variant is equal to #define 

Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-15 Thread Igor Kulchytskyy via groups.io
Hi Mike,
My implementation of checking the IpType supposed to be like this:
/**
  Check if Network Protocol Type matches with SMBIOS Type 42 IP Address Type.

  @param[in]  NetworkProtocolType  The Network Protocol Type to check with.
  @param[in]  IpType   The Host IP Address Type from SMBIOS Type 42.
**/
STATIC
BOOLEAN
IsTcpTypeMatch (
  IN UINT32 NetworkProtocolType,
  IN UINT8 IpType
  )
{
  if ((NetworkProtocolType == ProtocolTypeTcp4) && (IpType == 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) {
return TRUE;
  }
  if ((NetworkProtocolType == ProtocolTypeTcp6) && (IpType == 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) {
return TRUE;
  }
  return FALSE;
}

And then in BuildupNetworkInterface function.

  // Get IP Type to filter out unnecessary network protocol if possible
  IpType = GetHiIpProtocolType ();

  for (Index = 0; Index < ListCount; Index++) {
// Check IP Type and skip an unnecessary network protocol if does not match
if (!IsTcpTypeMatch (mRequiredProtocol[Index].ProtocolType, IpType)) {
  continue;
}

-Original Message-
From: Mike Maslenkin 
Sent: Wednesday, November 15, 2023 1:27 PM
To: Igor Kulchytskyy 
Cc: Leif Lindholm ; devel@edk2.groups.io; Abner 
Chang ; Nickle Wang 
Subject: Re: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
RedfishDiscoverDxe: Optimize the Redfish Discover flow

On Wed, Nov 15, 2023 at 4:52 PM Igor Kulchytskyy  wrote:
>
> Hello Leif and Mike,
> Let me try to explain the idea of the filtering IP.
> That filtering should work only if we know exactly that IP is IPv4 or IPv6 in 
> SMBIOS Type 42.
Hm. I've already composed a reply below, but then a returned to this
statement...

Is this a difference in condition between v3 and v5? I came to the
conclusion that at the place we are discussing
SMBIOS table 42h can be absent because
PlatformHostInterfaceInformationReady hasn't been called yet,
so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected.


> And it just helping to reduce the work in case we know the exact type of IP, 
> which supposed to be used in BIOS BMC communication.
> In that case there is no need to build network interface for the unused IP 
> Type.
> On some systems IP address could be dynamic and we will not be able to know 
> the version of IP from SMBIOS.
> If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And 
> return IP type UNKNOWN if it is not static.
> If we get an unknown IP type, we should not return from 
> BuildupNetworkInterface function, but just proceed and build the network 
> interface for all IPs.
> So, later Redfish Discover driver can find the right one.
> Based on this logic I'm going to prepare the patch v6.
> Thank you,
> Igor

Agree.. I was focused on edk2 implementation of
RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib
where HostIpAddressFormat is specified (hardcoded). I guess
HostIpAddressFormat  as well as SMBIOS table 42h must be available
by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface()
call, while it might be not available at the moment
RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So,
condition from v3 looks correct to me.

My main concern was introduction of defines. Those don't look great.
Those are huge (it even doesn't fit into the screen) and misleading a
bit.
For example:
+#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)
(CompareMem ((VOID *)>MacAddress,
>MacAddress,
ThisNetworkInterface->HwAddressSize))

The proposed variant is equal to #define MAC_COMPARE(A, B)
(CompareMem ((VOID *)>MacAddress,
>MacAddress,
ThisNetworkInterface->HwAddressSize)), i.e a bit useless.

I would expect it could be declared at least as:
#define MAC_COMPARE(This, Target)  CompareMem ((VOID
*)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize)
I.e define should really replace some arguments  also reducing the line length.

BTW: there is a place in ValidateTargetNetworkInterface() where
CompareMem  can be replaced with MAC_COMPARE too.

Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in
edk2. But according to that one, please consider moving "== 0" check
to #define declaration.
But I do not think this macro is required at all, because there are 5
MAC compares left in this module. So, it just brings some
inconsistency.

Agreed that static helper function would be the best.

Leif, do you expect something like this?
STATIC
BOOLEAN
FilterInterface (
  IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType,
  IN UINT8 HostIpAddressFormat
  )
{
  // This is based on v5, but according to the comments above
  // v3 is correct as it allows
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN

  if (ProtocolType == ProtocolTypeTcp4) {
return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4;
  } else if (ProtocolType == ProtocolTypeTcp6) {
return IpType != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6;
  }
  return 

Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-15 Thread Igor Kulchytskyy via groups.io
Hello Leif and Mike,
Let me try to explain the idea of the filtering IP.
That filtering should work only if we know exactly that IP is IPv4 or IPv6 in 
SMBIOS Type 42.
And it just helping to reduce the work in case we know the exact type of IP, 
which supposed to be used in BIOS BMC communication.
In that case there is no need to build network interface for the unused IP Type.
On some systems IP address could be dynamic and we will not be able to know the 
version of IP from SMBIOS.
If you see I check HostIpAssignmentType in GetHiIpProtocolType function. And 
return IP type UNKNOWN if it is not static.
If we get an unknown IP type, we should not return from BuildupNetworkInterface 
function, but just proceed and build the network interface for all IPs.
So, later Redfish Discover driver can find the right one.
Based on this logic I'm going to prepare the patch v6.
Thank you,
Igor

-Original Message-
From: Leif Lindholm 
Sent: Wednesday, November 15, 2023 7:02 AM
To: devel@edk2.groups.io; mike.maslen...@gmail.com; Igor Kulchytskyy 

Cc: Abner Chang ; Nickle Wang 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

On 2023-11-14 23:52, Mike Maslenkin wrote:
> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
>  wrote:
>>
>> Hi Leif,
>> Please see my comments below.
>> Thank you,
>> Igor
>>
>>
>> -Original Message-
>> From: Leif Lindholm 
>> Sent: Tuesday, November 14, 2023 12:26 PM
>> To: devel@edk2.groups.io; Igor Kulchytskyy 
>> Cc: Abner Chang ; Nickle Wang 
>> Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
>> RedfishDiscoverDxe: Optimize the Redfish Discover flow
>>
>>
>> **CAUTION: The e-mail below is from an external source. Please exercise 
>> caution before opening attachments, clicking links, or following guidance.**
>>
>> On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
>>> Filter out the network interfaces which are not supported by
>>> Redfish Host Interface.
>>>
>>> Cc: Abner Chang 
>>> Cc: Nickle Wang 
>>> Signed-off-by: Igor Kulchytskyy 
>>> ---
>>>RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c  | 163 
>>> ++--
>>>RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>>>2 files changed, 120 insertions(+), 49 deletions(-)
>>>
>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
>>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> index 0f622e05a9..ae83cd3c97 100644
>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
>>
>>
>>> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
>>>  EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
>>>  EFI_TPL  OldTpl;
>>>  BOOLEAN  
>>> NewNetworkInterfaceInstalled;
>>> +  UINT8IpType;
>>> +  UINTNListCount;
>>>
>>> +  ListCount= (sizeof (gRequiredProtocol) / sizeof 
>>> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
>>>  NewNetworkInterfaceInstalled = FALSE;
>>>  Index= 0;
>>> -  do {
>>> +
>>> +  // Get IP Type to filter out unnecessary network protocol if possible
>>> +  IpType = GetHiIpProtocolType ();
>>> +
>>> +  for (Index = 0; Index < ListCount; Index++) {
>>> +// Check IP Type and skip an unnecessary network protocol if does not 
>>> match
>>> +if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
>>
>> The logic of these macros is inverted compared to their names, though.
>>
>> You want this test to read
>> if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
>>
>>> +  continue;
>>> +}
>>> +
>>>Status = gBS->OpenProtocol (
>>>// Already in list?
>>>ControllerHandle,
>>
>>> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h 
>>> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
>>> index 01454acc1d..3093eea0d5 100644
>>> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
&g

Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-14 Thread Igor Kulchytskyy via groups.io
Hi Abner,
I will address Leif's and Mike's comments after stable release.
Thank you,
Igor

Get Outlook for Android<https://aka.ms/AAb9ysg>


From: Chang, Abner 
Sent: Tuesday, November 14, 2023 8:19:41 PM
To: Mike Maslenkin ; devel@edk2.groups.io 
; Igor Kulchytskyy 
Cc: Leif Lindholm ; Nickle Wang 
Subject: [EXTERNAL] RE: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Mike and Leif,
Thanks for your comments on this change. As we are rushing to get this change 
to be pulled in stable release 202312 this week, I will just merge this code to 
master branch and let the discussing keeps going.
I think there is no functionality difference base on your suggestions, but it's 
about the coding practice and readability.

Hi Igor,
Could you please resend the V6 after stable tag is released if Mike and Leif's 
comment is reasonable to you?

Thanks
Abner

> -Original Message-
> From: Mike Maslenkin 
> Sent: Wednesday, November 15, 2023 7:53 AM
> To: devel@edk2.groups.io; ig...@ami.com
> Cc: Leif Lindholm ; Chang, Abner
> ; Nickle Wang 
> Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe:
> Optimize the Redfish Discover flow
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Tue, Nov 14, 2023 at 9:57 PM Igor Kulchytskyy via groups.io
>  wrote:
> >
> > Hi Leif,
> > Please see my comments below.
> > Thank you,
> > Igor
> >
> >
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Tuesday, November 14, 2023 12:26 PM
> > To: devel@edk2.groups.io; Igor Kulchytskyy 
> > Cc: Abner Chang ; Nickle Wang
> 
> > Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg:
> RedfishDiscoverDxe: Optimize the Redfish Discover flow
> >
> >
> > **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
> >
> > On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> > > Filter out the network interfaces which are not supported by
> > > Redfish Host Interface.
> > >
> > > Cc: Abner Chang 
> > > Cc: Nickle Wang 
> > > Signed-off-by: Igor Kulchytskyy 
> > > ---
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c  | 163
> ++--
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
> > >   2 files changed, 120 insertions(+), 49 deletions(-)
> > >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > index 0f622e05a9..ae83cd3c97 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> >
> >
> > > @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> > > EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL
> *RestExInstance;
> > > EFI_TPL  OldTpl;
> > > BOOLEAN  
> > > NewNetworkInterfaceInstalled;
> > > +  UINT8IpType;
> > > +  UINTNListCount;
> > >
> > > +  ListCount= (sizeof (gRequiredProtocol) / sizeof
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> > > NewNetworkInterfaceInstalled = FALSE;
> > > Index= 0;
> > > -  do {
> > > +
> > > +  // Get IP Type to filter out unnecessary network protocol if possible
> > > +  IpType = GetHiIpProtocolType ();
> > > +
> > > +  for (Index = 0; Index < ListCount; Index++) {
> > > +// Check IP Type and skip an unnecessary network protocol if does not
> match
> > > +if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {
> >
> > The logic of these macros is inverted compared to their names, though.
> >
> > You want this test to read
> >if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {
> >
> > > +  continue;
> > > +}
> > > +
> > >   Status = gBS->OpenProtocol (
> > >   // Already in list?
> > >   ControllerHandle,
> &g

Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-14 Thread Igor Kulchytskyy via groups.io
Hi Leif,
Please see my comments below.
Thank you,
Igor


-Original Message-
From: Leif Lindholm 
Sent: Tuesday, November 14, 2023 12:26 PM
To: devel@edk2.groups.io; Igor Kulchytskyy 
Cc: Abner Chang ; Nickle Wang 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: 
RedfishDiscoverDxe: Optimize the Redfish Discover flow


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

On 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote:
> Filter out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Signed-off-by: Igor Kulchytskyy 
> ---
>   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c  | 163 
> ++--
>   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
>   2 files changed, 120 insertions(+), 49 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 0f622e05a9..ae83cd3c97 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c


> @@ -1601,10 +1681,22 @@ BuildupNetworkInterface (
> EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
> EFI_TPL  OldTpl;
> BOOLEAN  
> NewNetworkInterfaceInstalled;
> +  UINT8IpType;
> +  UINTNListCount;
>
> +  ListCount= (sizeof (gRequiredProtocol) / sizeof 
> (REDFISH_DISCOVER_REQUIRED_PROTOCOL));
> NewNetworkInterfaceInstalled = FALSE;
> Index= 0;
> -  do {
> +
> +  // Get IP Type to filter out unnecessary network protocol if possible
> +  IpType = GetHiIpProtocolType ();
> +
> +  for (Index = 0; Index < ListCount; Index++) {
> +// Check IP Type and skip an unnecessary network protocol if does not 
> match
> +if (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) {

The logic of these macros is inverted compared to their names, though.

You want this test to read
   if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) {

> +  continue;
> +}
> +
>   Status = gBS->OpenProtocol (
>   // Already in list?
>   ControllerHandle,

> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h 
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> index 01454acc1d..3093eea0d5 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
> @@ -39,6 +39,12 @@
>   #define REDFISH_DISCOVER_VERSION0x0001
>   #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL  TPL_NOTIFY
>
> +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  
> (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize))
> +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   
> (TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType 
> == ProtocolTypeTcp6))
> +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   
> (!TargetNetworkInterface->IsIpv6 && 
> (ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))
> +#define IS_TCP4_MATCH(IpType)  
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != 
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
> +#define IS_TCP6_MATCH(IpType)  
> ((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != 
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))

And these macros to test for ==, not !=


Igor: First version tested "==", but we agreed that it may not work if we have 
a wrong value of IpType.

Otherwise the code reads like it does the opposite of what it does.

(You could also keep the logic and call the macros IS_TCP#_MISMATCH, but
that feels a bit convoluted.)

Igor: I would prefer to go with IS_TCP#_MISMATCH names.

Regards,

Leif

> +
>   //
>   // GUID definitions
>   //
> --
> 2.37.1.windows.1
> -The information contained in this message may be confidential and 
> proprietary to American Megatrends (AMI). This communication is intended to 
> be read only by the individual or entity to whom it is addressed or by their 
> designee. If the reader of this message is not the intended recipient, you 
> are on notice that any distribution of this message, in any form

Re: [edk2-devel] [PATCH v5 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-14 Thread Igor Kulchytskyy via groups.io
Hi Leif,
I addressed your comments in that v5 patch.
Do you have any other concerns?
Thank you,
Igor

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Igor Kulchytskyy 
via groups.io
Sent: Tuesday, November 14, 2023 9:28 AM
To: devel@edk2.groups.io
Subject: [EXTERNAL] [edk2-devel] [PATCH v5 0/2] Fix and optimize the issue if 
IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Igor Kulchytskyy (2):
  RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
RestEx
  RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 132 +-
 .../RedfishDiscoverInternal.h |   6 +
 2 files changed, 105 insertions(+), 33 deletions(-)

--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.





-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-14 Thread Igor Kulchytskyy via groups.io
Filter out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c  | 163 
++--
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h |   6 +
 2 files changed, 120 insertions(+), 49 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 0f622e05a9..ae83cd3c97 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface) == 0) &&
+(VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
+ VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface)))
+{
   return ThisNetworkInterface;
 }

@@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +487,42 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface.
+
+  @retval 00h is Unknown
+  01h is Ipv4
+  02h is Ipv6
+
+**/
+UINT8
+GetHiIpProtocolType (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+  }
+
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
+  {
+return Data->HostIpAddressFormat;
+  }
+
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +559,18 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+if ((Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4) 
&&
+(Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) // IPv4 case
+{
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interface 
requires Ipv6\n", __func__));
+  return EFI_UNSUPPORTED;
+} else if ((Instance->NetworkInterface->NetworkProtocolType == 
ProtocolTypeTcp6) &&
+   (Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) // IPv6 case
+{
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interface 
requires IPv4\n", __func__));
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1102,6 +1161,7 @@ RedfishServiceGetNetworkInterface (
   OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances
   )
 {
+  EFI_STATUS   Status;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterfaceIntn;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE   *ThisNetworkInterface;
   EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
@@ -1141,13 +1201,23 @@ RedfishServiceGetNetworkInterface (

   ThisNetworkInterfaceIntn = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
+// If Get Subnet Info failed then skip this interface
+Status = NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, 
ImageHandle); // Get subnet info
+if (EFI_ERROR (Status)) {
+  if (IsNodeAtEnd (, 
>Entry)) {
+break;
+  }
+
+  ThisNetworkInterfaceIntn = 
(EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode 
(, >Entry);
+  continue;
+}
+
 ThisNetworkInterface->IsIpv6 = FALSE;
 if (CheckIsIpVersion6 (ThisNetworkInterfaceIntn)) {
   ThisNetworkInterface->IsIpv6 = TRUE;
 

[edk2-devel] [PATCH v5 1/2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-14 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all network
interface to be installed.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 31 ++--
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..0f622e05a9 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -1547,25 +1547,26 @@ TestForRequiredProtocols (
 ControllerHandle,
 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
 );
+if (EFI_ERROR (Status)) {
+  return EFI_UNSUPPORTED;
+}
+
+Status = gBS->OpenProtocol (
+ControllerHandle,
+gRequiredProtocol[Index].DiscoveredProtocolGuid,
+(VOID **),
+This->DriverBindingHandle,
+ControllerHandle,
+EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
 if (!EFI_ERROR (Status)) {
-  Status = gBS->OpenProtocol (
-  ControllerHandle,
-  gRequiredProtocol[Index].DiscoveredProtocolGuid,
-  (VOID **),
-  This->DriverBindingHandle,
-  ControllerHandle,
-  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-  );
-  if (EFI_ERROR (Status)) {
-if (Index == ListCount - 1) {
-  DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
-  return EFI_SUCCESS;
-}
-  }
+  // Already installed
+  return EFI_UNSUPPORTED;
 }
   }

-  return EFI_UNSUPPORTED;
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
+  return EFI_SUCCESS;
 }

 /**
--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH v5 0/2] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-14 Thread Igor Kulchytskyy via groups.io
Igor Kulchytskyy (2):
  RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
RestEx
  RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 132 +-
 .../RedfishDiscoverInternal.h |   6 +
 2 files changed, 105 insertions(+), 33 deletions(-)

--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#95): https://edk2.groups.io/g/devel/message/95
Mute This Topic: https://groups.io/mt/102584124/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] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

2023-11-13 Thread Igor Kulchytskyy via groups.io
Filter out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 169 +-
 1 file changed, 120 insertions(+), 49 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 0f622e05a9..3d514d7e4c 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -13,6 +13,12 @@

 #include "RedfishDiscoverInternal.h"

+#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface)  (CompareMem 
((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize))
+#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface)   
(TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType 
== ProtocolTypeTcp6))
+#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface)   
(!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType 
== ProtocolTypeTcp4))
+#define IS_TCP4_MATCH(IpType)  
((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp4) && (IpType != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4))
+#define IS_TCP6_MATCH(IpType)  
((gRequiredProtocol[Index].ProtocolType == ProtocolTypeTcp6) && (IpType != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6))
+
 LIST_ENTRY   mRedfishDiscoverList;
 LIST_ENTRY   mRedfishInstanceList;
 EFI_SMBIOS_PROTOCOL  *mSmbios = NULL;
@@ -322,9 +328,16 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface) == 0) &&
+(VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
+ VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface)))
+{
   return ThisNetworkInterface;
 }

@@ -354,6 +367,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +493,42 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface.
+
+  @retval 00h is Unknown
+  01h is Ipv4
+  02h is Ipv6
+
+**/
+UINT8
+GetHiIpProtocolType (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+  }
+
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
+  {
+return Data->HostIpAddressFormat;
+  }
+
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +565,18 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+if ((Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4) 
&&
+(Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) // IPv4 case
+{
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interface 
requires Ipv6\n", __func__));
+  return EFI_UNSUPPORTED;
+} else if ((Instance->NetworkInterface->NetworkProtocolType == 
ProtocolTypeTcp6) &&
+   (Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) // IPv6 case
+{
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interface 
requires IPv4\n", __func__));
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1102,6 +1167,7 @@ RedfishServiceGetNetworkInterface (
   OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances
   )
 {
+  

[edk2-devel] [PATCH 1/2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-13 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all network
interface to be installed.

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

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..0f622e05a9 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -1547,25 +1547,26 @@ TestForRequiredProtocols (
 ControllerHandle,
 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
 );
+if (EFI_ERROR (Status)) {
+  return EFI_UNSUPPORTED;
+}
+
+Status = gBS->OpenProtocol (
+ControllerHandle,
+gRequiredProtocol[Index].DiscoveredProtocolGuid,
+(VOID **),
+This->DriverBindingHandle,
+ControllerHandle,
+EFI_OPEN_PROTOCOL_GET_PROTOCOL
+);
 if (!EFI_ERROR (Status)) {
-  Status = gBS->OpenProtocol (
-  ControllerHandle,
-  gRequiredProtocol[Index].DiscoveredProtocolGuid,
-  (VOID **),
-  This->DriverBindingHandle,
-  ControllerHandle,
-  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-  );
-  if (EFI_ERROR (Status)) {
-if (Index == ListCount - 1) {
-  DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
-  return EFI_SUCCESS;
-}
-  }
+  // Already installed
+  return EFI_UNSUPPORTED;
 }
   }

-  return EFI_UNSUPPORTED;
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on this 
controller handle: %p.\n", __func__, ControllerHandle));
+  return EFI_SUCCESS;
 }

 /**
--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70): https://edk2.groups.io/g/devel/message/70
Mute This Topic: https://groups.io/mt/102566319/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] Fix and optimize the issue if IPv4 installed after RestEx

2023-11-13 Thread Igor Kulchytskyy via groups.io
Igor Kulchytskyy (2):
  RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after
RestEx
  RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow

 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 138 +-
 1 file changed, 105 insertions(+), 33 deletions(-)

--
2.37.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69): https://edk2.groups.io/g/devel/message/69
Mute This Topic: https://groups.io/mt/102566299/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] RedfishClientPkg/RedfishFeatureUtilityLib: validate string array

2023-11-09 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
I noticed one typo. See below the text.

And I have a question regarding newly introduced 
ValidateRedfishStringArrayValues function.
You use that function to check if value in Redfish string array can be found in 
HII configuration string array.
And you still call CompareRedfishStringArrayValues function. Both iterate 
through ArrayHead and RedfishValue.Value.StringArray.
Maybe their functionality can be combined in ValidateRedfishStringArrayValues? 
Some additional an out parameter from that function can indicate If there is no 
change in array.
What do you think?
Thank you,
Igor


-Original Message-
From: Nickle Wang 
Sent: Wednesday, November 8, 2023 2:25 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH] 
RedfishClientPkg/RedfishFeatureUtilityLib: validate string array


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

- Add function to validate Redfish request for string array
type. There is case that user request invalid string array
and feature driver can not find corresponding HII option.
- Fix typo.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../Library/RedfishFeatureUtilityLib.h|  56 +--
 .../RedfishFeatureUtilityLib.c| 156 +-
 2 files changed, 154 insertions(+), 58 deletions(-)

diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h 
b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
index e2f728b2..440c4b68 100644
--- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
+++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
@@ -22,7 +22,7 @@

   Read redfish resource by given resource URI.

-  @param[in]  Service   Redfish srvice instacne to make query.
+  @param[in]  Service   Redfish service instance to make query.
   @param[in]  ResourceUri   Target resource URI.
   @param[out] Response  HTTP response from redfish service.

@@ -47,7 +47,7 @@ GetResourceByUri (
   @param[out] ArraySignatureClose   String to the close of array signature.

   @retval EFI_SUCCESSIndex is found.
-  @retval EFI_NOT_FOUND  The non-array configure language string 
is retured.
+  @retval EFI_NOT_FOUND  The non-array configure language string 
is returned.
   @retval EFI_INVALID_PARAMETER  The format of input ConfigureLang is 
wrong.
   @retval Others Errors occur.

@@ -118,10 +118,10 @@ GetNumberOfRedpathNodes (

   @param[in]  NodeString The node string to parse.
   @param[in]  Index  Index of the node.
-  @param[out] EndOfNodePtr   Pointer to receive the poitner to
+  @param[out] EndOfNodePtr   Pointer to receive the pointer to
  the last character of node string.

-  @retval EFI_STRING the begining of the node string.
+  @retval EFI_STRING the beginning of the node string.

 **/
 EFI_STRING
@@ -140,7 +140,7 @@ GetRedpathNodeByIndex (
   @param[out] Index The array index number.

   @retval EFI_SUCCESSIndex is found.
-  @retval EFI_NOT_FOUND  The non-array configure language string 
is retured.
+  @retval EFI_NOT_FOUND  The non-array configure language string 
is returned.
   @retval EFI_INVALID_PARAMETER  The format of input ConfigureLang is 
wrong.
   @retval Others Errors occur.

@@ -188,7 +188,7 @@ DestroyConfiglanguageList (

   @param[in]  DestConfigLangPointer to the node's configure language 
string.
 The memory pointed by ConfigLang must be 
allocated
-through memory allocation interface. 
Becasue we will replace
+through memory allocation interface. 
Because we will replace
 the pointer in this function.
   @param[in]  MaxtLengthConfigLang  The maximum length of ConfigLang.
   @param[in]  ConfigLangInstancePointer to Collection member instance.
@@ -244,7 +244,7 @@ ApplyFeatureSettingsStringType (

 /**

-  Apply property value to UEFI HII database in numric type.
+  Apply property value to UEFI HII database in numeric type.

   @param[in]  SchemaProperty schema.
   @param[in]  Version   Property schema version.
@@ -356,7 +356,7 @@ ApplyFeatureSettingsNumericArrayType (
   @param[in]  SchemaProperty schema.
   @param[in]  Version   Property schema version.
   @param[in]  ConfigureLang Configure language refers to this property.
-  @param[in]  ArrayHead Head of Redfich CS boolean array value.
+  @param[in]  ArrayHead Head of Redfish CS boolean array value.

   @retval EFI_SUCCESS New value is applied 

[edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-07 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 165 ++--
 1 file changed, 117 insertions(+), 48 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..85e47843e4 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if ((CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
&&
+((TargetNetworkInterface->IsIpv6 && 
(ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6)) ||
+ (!TargetNetworkInterface->IsIpv6 && 
(ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4
+{
   return ThisNetworkInterface;
 }

@@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +487,42 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface.
+
+  @retval 00h is Unknown
+  01h is Ipv4
+  02h is Ipv6
+
+**/
+UINT8
+GetHiIpProtocolType (
+  VOID
+  )
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+  }
+
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic))
+  {
+return Data->HostIpAddressFormat;
+  }
+
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +559,18 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+if ((Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4) 
&&
+(Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) // IPv4 case
+{
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interface 
requires Ipv6\n", __func__));
+  return EFI_UNSUPPORTED;
+} else if ((Instance->NetworkInterface->NetworkProtocolType == 
ProtocolTypeTcp6) &&
+   (Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) // IPv6 case
+{
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interface 
requires IPv4\n", __func__));
+  return EFI_UNSUPPORTED;
+}
+
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1102,6 +1161,7 @@ RedfishServiceGetNetworkInterface (
   OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances
   )
 {
+  EFI_STATUS   Status;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterfaceIntn;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE   *ThisNetworkInterface;
   EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
@@ -1141,13 +1201,23 @@ RedfishServiceGetNetworkInterface (

   ThisNetworkInterfaceIntn = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
+// If Get Subnet Info failed then skip this interface
+Status = NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, 
ImageHandle); // Get subnet info
+if (EFI_ERROR (Status)) {
+  if (IsNodeAtEnd (, 
>Entry)) {
+break;
+  }
+
+  ThisNetworkInterfaceIntn = 
(EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode 
(, >Entry);
+  continue;
+}
+
 

Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-06 Thread Igor Kulchytskyy via groups.io
I changed TestForRequiredProtocols function as Mike suggested.
I also kept GetHiIpProtocolType function without STATIC.
Resend pull request with those changes.
Thank you,
Igor

From: devel@edk2.groups.io  On Behalf Of Igor Kulchytskyy 
via groups.io
Sent: Monday, November 6, 2023 9:37 PM
To: Chang, Abner ; devel@edk2.groups.io; M M 

Cc: Nickle Wang 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**
Hi Abner,
Thanks for the explanation!
Will keep it without static.
Best regards,
Igor


Get Outlook for Android<https://aka.ms/AAb9ysg>

From: Chang, Abner mailto:abner.ch...@amd.com>>
Sent: Monday, November 6, 2023 8:51:18 PM
To: Igor Kulchytskyy mailto:ig...@ami.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>>; M M 
mailto:mike.maslen...@gmail.com>>
Cc: Nickle Wang mailto:nick...@nvidia.com>>
Subject: RE: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: 
RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx


[AMD Official Use Only - General]


I would say to have static for a function used by module is a good coding 
practice and reduce the compile errors for the duplicated function naming, and 
maybe other advantages I am not quite sure.

But from edk2 C coding standard spec perspective, in 5.4.2.2.2, it says 
function should not be declared STATIC.

So my opinion is just keep the function without STATIC.



Abner





From: Igor Kulchytskyy mailto:ig...@ami.com>>
Sent: Tuesday, November 7, 2023 2:54 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Igor Kulchytskyy 
mailto:ig...@ami.com>>; M M 
mailto:mike.maslen...@gmail.com>>
Cc: Chang, Abner mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: RE: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: 
RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx



Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.



Hi Nickle and Abner,

What is your opinion – should we have GetHiIpProtocolType fuction as a static 
one?

Thank you,

Igor



From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of Igor 
Kulchytskyy via groups.io
Sent: Monday, November 6, 2023 9:14 AM
To: M M mailto:mike.maslen...@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Abner Chang 
mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx





**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Mike,

See my comments below.

Thank you,

Igor

P.S.

“There is no limits to perfection”



From: M M mailto:mike.maslen...@gmail.com>>
Sent: Sunday, November 05, 2023 9:30 PM
To: Igor Kulchytskyy mailto:ig...@ami.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Abner Chang 
mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx



Hi Igor



I want to return to my initial comments regarding this patch.

Please, find my comments below.





On 1. 11. 2023., at 06:24, Igor Kulchytskyy 
mailto:ig...@ami.com>> wrote:



Hi Mike,
Thank you for review.
Please see my answers below the text.

-Original Message-
From: Mike Maslenkin mailto:mike.maslen...@gmail.com>>
Sent: Tuesday, October 31, 2023 9:00 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Igor Kulchytskyy 
mailto:ig...@ami.com>>
Cc: Abner Chang mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Igor

please find my comments below.

On Tue, Oct 31, 2023 at 8:56 PM Igor Kulchytskyy via 
groups.io<http://groups.io/>
mailto:igork=ami@groups.io>> wrote:

Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

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: Igo

Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-06 Thread Igor Kulchytskyy via groups.io
Hi Abner,
Thanks for the explanation!
Will keep it without static.
Best regards,
Igor


Get Outlook for Android<https://aka.ms/AAb9ysg>

From: Chang, Abner 
Sent: Monday, November 6, 2023 8:51:18 PM
To: Igor Kulchytskyy ; devel@edk2.groups.io 
; M M 
Cc: Nickle Wang 
Subject: RE: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: 
RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx


[AMD Official Use Only - General]


I would say to have static for a function used by module is a good coding 
practice and reduce the compile errors for the duplicated function naming, and 
maybe other advantages I am not quite sure.

But from edk2 C coding standard spec perspective, in 5.4.2.2.2, it says 
function should not be declared STATIC.

So my opinion is just keep the function without STATIC.



Abner





From: Igor Kulchytskyy 
Sent: Tuesday, November 7, 2023 2:54 AM
To: devel@edk2.groups.io; Igor Kulchytskyy ; M M 

Cc: Chang, Abner ; Nickle Wang 
Subject: RE: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: 
RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx



Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.



Hi Nickle and Abner,

What is your opinion – should we have GetHiIpProtocolType fuction as a static 
one?

Thank you,

Igor



From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
mailto:devel@edk2.groups.io>> On Behalf Of Igor 
Kulchytskyy via groups.io
Sent: Monday, November 6, 2023 9:14 AM
To: M M mailto:mike.maslen...@gmail.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Abner Chang 
mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx





**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Mike,

See my comments below.

Thank you,

Igor

P.S.

“There is no limits to perfection”



From: M M mailto:mike.maslen...@gmail.com>>
Sent: Sunday, November 05, 2023 9:30 PM
To: Igor Kulchytskyy mailto:ig...@ami.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Abner Chang 
mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx



Hi Igor



I want to return to my initial comments regarding this patch.

Please, find my comments below.





On 1. 11. 2023., at 06:24, Igor Kulchytskyy 
mailto:ig...@ami.com>> wrote:



Hi Mike,
Thank you for review.
Please see my answers below the text.

-Original Message-
From: Mike Maslenkin mailto:mike.maslen...@gmail.com>>
Sent: Tuesday, October 31, 2023 9:00 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Igor Kulchytskyy 
mailto:ig...@ami.com>>
Cc: Abner Chang mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Igor

please find my comments below.

On Tue, Oct 31, 2023 at 8:56 PM Igor Kulchytskyy via 
groups.io<http://groups.io/>
mailto:igork=ami@groups.io>> wrote:

Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

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: Igor Kulchytskyy mailto:ig...@ami.com>>
---
RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 96 ++--
1 file changed, 89 insertions(+), 7 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..a88ad55938 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
{
  EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+
  ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
  while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0 
&&
+((TargetNetworkInterface->IsIpv6 &&am

Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-06 Thread Igor Kulchytskyy via groups.io
Hi Nickle and Abner,
What is your opinion – should we have GetHiIpProtocolType fuction as a static 
one?
Thank you,
Igor

From: devel@edk2.groups.io  On Behalf Of Igor Kulchytskyy 
via groups.io
Sent: Monday, November 6, 2023 9:14 AM
To: M M 
Cc: devel@edk2.groups.io; Abner Chang ; Nickle Wang 

Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**
Hi Mike,
See my comments below.
Thank you,
Igor
P.S.
“There is no limits to perfection”

From: M M mailto:mike.maslen...@gmail.com>>
Sent: Sunday, November 05, 2023 9:30 PM
To: Igor Kulchytskyy mailto:ig...@ami.com>>
Cc: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Abner Chang 
mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx

Hi Igor

I want to return to my initial comments regarding this patch.
Please, find my comments below.


On 1. 11. 2023., at 06:24, Igor Kulchytskyy 
mailto:ig...@ami.com>> wrote:

Hi Mike,
Thank you for review.
Please see my answers below the text.

-Original Message-
From: Mike Maslenkin mailto:mike.maslen...@gmail.com>>
Sent: Tuesday, October 31, 2023 9:00 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Igor Kulchytskyy 
mailto:ig...@ami.com>>
Cc: Abner Chang mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Igor

please find my comments below.

On Tue, Oct 31, 2023 at 8:56 PM Igor Kulchytskyy via 
groups.io<http://groups.io/>
mailto:igork=ami@groups.io>> wrote:

Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

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: Igor Kulchytskyy mailto:ig...@ami.com>>
---
RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 96 ++--
1 file changed, 89 insertions(+), 7 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..a88ad55938 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
{
  EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+
  ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
  while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0 
&&
+((TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
+(!TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
  return ThisNetworkInterface;
}

@@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
{
  EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+

I also have these two hunks in my pending list.
But I suggest to add ASSERT to GetTargetNetworkInterfaceInternal, just
because currently it is really impossible situation,
and mEfiRedfishDiscoverNetworkInterface was checked before in scope of
ValidateTargetNetworkInterface().

Igor: Agree.
I also just noticed that even if GetTargetNetworkInterfaceInternal function may 
return NULL, the return value is not verified on NULL in 
RedfishServiceAcquireService function.
I think we should add this verification.


Also I wonder why check patch doesn't complain about missed spaces in
"IsListEmpty ()" call for example.

  ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
  while (TRUE) {
if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +486,38 @@ CheckIsIpVersion6 (
  return FALSE;
}

+/**
+  This function returns the  IP type supported by the Host Interface
+
+  @retval IP Type
+  //  Unknown=00h,
+  //  Ipv4=01h,
+  //  Ipv6=02h,
+
+**/
+UINT8

STATIC ?
Igor: WHY?

I

Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-06 Thread Igor Kulchytskyy via groups.io
Hi Mike,
See my comments below.
Thank you,
Igor
P.S.
“There is no limits to perfection”

From: M M 
Sent: Sunday, November 05, 2023 9:30 PM
To: Igor Kulchytskyy 
Cc: devel@edk2.groups.io; Abner Chang ; Nickle Wang 

Subject: Re: [EXTERNAL] [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx

Hi Igor

I want to return to my initial comments regarding this patch.
Please, find my comments below.



On 1. 11. 2023., at 06:24, Igor Kulchytskyy 
mailto:ig...@ami.com>> wrote:

Hi Mike,
Thank you for review.
Please see my answers below the text.

-Original Message-
From: Mike Maslenkin mailto:mike.maslen...@gmail.com>>
Sent: Tuesday, October 31, 2023 9:00 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Igor Kulchytskyy 
mailto:ig...@ami.com>>
Cc: Abner Chang mailto:abner.ch...@amd.com>>; Nickle Wang 
mailto:nick...@nvidia.com>>
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Igor

please find my comments below.

On Tue, Oct 31, 2023 at 8:56 PM Igor Kulchytskyy via 
groups.io<http://groups.io/>
mailto:igork=ami@groups.io>> wrote:


Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

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: Igor Kulchytskyy mailto:ig...@ami.com>>
---
RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 96 ++--
1 file changed, 89 insertions(+), 7 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..a88ad55938 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
{
  EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+
  ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
  while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0 
&&
+((TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
+(!TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
  return ThisNetworkInterface;
}

@@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
{
  EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+

I also have these two hunks in my pending list.
But I suggest to add ASSERT to GetTargetNetworkInterfaceInternal, just
because currently it is really impossible situation,
and mEfiRedfishDiscoverNetworkInterface was checked before in scope of
ValidateTargetNetworkInterface().

Igor: Agree.
I also just noticed that even if GetTargetNetworkInterfaceInternal function may 
return NULL, the return value is not verified on NULL in 
RedfishServiceAcquireService function.
I think we should add this verification.


Also I wonder why check patch doesn't complain about missed spaces in
"IsListEmpty ()" call for example.


  ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
  while (TRUE) {
if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +486,38 @@ CheckIsIpVersion6 (
  return FALSE;
}

+/**
+  This function returns the  IP type supported by the Host Interface
+
+  @retval IP Type
+  //  Unknown=00h,
+  //  Ipv4=01h,
+  //  Ipv6=02h,
+
+**/
+UINT8

STATIC ?
Igor: WHY?

I remembered discussion about STATIC functions usage and why it isn't common in 
edk2.
AFAIR it was because of difficulties with source level debugging for the case 
when it could be inlined.
BTW I won't insist on this here.



+GetHiIpProtocolType()
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return 0;

In this driver REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP{4,6}
used and accessible.
so, 0 means  REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKN

Re: [edk2-devel] [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-05 Thread Igor Kulchytskyy via groups.io
Fixed and resubmitted.

Get Outlook for Android<https://aka.ms/AAb9ysg>

From: devel@edk2.groups.io  on behalf of Igor Kulchytskyy 
via groups.io 
Sent: Friday, November 3, 2023 2:01:36 PM
To: Mike Maslenkin 
Cc: devel@edk2.groups.io ; Abner Chang 
; Nickle Wang 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH v2] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Mike,
You are absolutely right.
I moved that NetworkInterfaceGetSubnetInfo function up, not copied it. But 
somehow it was copied.
My mistake.
I will fix it and resubmit.
Thank you,
Igor

-Original Message-
From: Mike Maslenkin 
Sent: Friday, November 3, 2023 11:54 AM
To: Igor Kulchytskyy 
Cc: devel@edk2.groups.io; Abner Chang ; Nickle Wang 

Subject: [EXTERNAL] Re: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if 
IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

On Wed, Nov 1, 2023 at 11:17 PM Igor Kulchytskyy  wrote:
>
> Supported function of the driver changed to wait for all newtwork
> interface to be installed.
> Filer out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Mike Maslenkin 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 131 ++--
>  1 file changed, 95 insertions(+), 36 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 23da3b968f..c67b8acf12 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;
>
> +  if (IsListEmpty ()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
> *)GetFirstNode ();
>while (TRUE) {
> -if (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize) == 
> 0) {
> +if (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize) == 
> 0 &&
> +((TargetNetworkInterface->IsIpv6 && 
> ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
> +(!TargetNetworkInterface->IsIpv6 && 
> ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
>return ThisNetworkInterface;
>  }
>
> @@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;
>
> +  if (IsListEmpty ()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
> *)GetFirstNode ();
>while (TRUE) {
>  if (ThisNetworkInterface->OpenDriverControllerHandle == 
> ControllerHandle) {
> @@ -476,6 +486,39 @@ CheckIsIpVersion6 (
>return FALSE;
>  }
>
> +/**
> +  This function returns the  IP type supported by the Host Interface
> +
> +  @retval IP Type
> +  //  Unknown=00h,
> +  //  Ipv4=01h,
> +  //  Ipv6=02h,
> +
> +**/
> +STATIC
> +UINT8
> +GetHiIpProtocolType()
> +{
> +  EFI_STATUS Status;
> +  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
> +  REDFISH_INTERFACE_DATA *DeviceDescriptor;
> +
> +  Data = NULL;
> +  DeviceDescriptor = NULL;
> +  if (mSmbios == NULL) {
> +Status = gBS->LocateProtocol (, NULL, (VOID 
> **));
> +if (EFI_ERROR (Status)) {
> +  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +  }
> +  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
> ); // Search for SMBIOS type 42h
> +  if (!EFI_ERROR (Status) && (Data != NULL) &&
> +  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic)) {
> +  return Data->HostIpAddressFormat;
> +  }
> +  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +
>  /**
>This function discover Redfish service through SMBIOS host interface.
>
> @@ -512,6 +555,15 @@ DiscoverRedfishHostInterface (
>
>Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
> ); // Search for SMBIOS type 42h
>if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
> +
> +   

Re: [edk2-devel] [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-03 Thread Igor Kulchytskyy via groups.io
Hi Mike,
You are absolutely right.
I moved that NetworkInterfaceGetSubnetInfo function up, not copied it. But 
somehow it was copied.
My mistake.
I will fix it and resubmit.
Thank you,
Igor

-Original Message-
From: Mike Maslenkin 
Sent: Friday, November 3, 2023 11:54 AM
To: Igor Kulchytskyy 
Cc: devel@edk2.groups.io; Abner Chang ; Nickle Wang 

Subject: [EXTERNAL] Re: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if 
IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

On Wed, Nov 1, 2023 at 11:17 PM Igor Kulchytskyy  wrote:
>
> Supported function of the driver changed to wait for all newtwork
> interface to be installed.
> Filer out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Mike Maslenkin 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 131 ++--
>  1 file changed, 95 insertions(+), 36 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 23da3b968f..c67b8acf12 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;
>
> +  if (IsListEmpty ()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
> *)GetFirstNode ();
>while (TRUE) {
> -if (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize) == 
> 0) {
> +if (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize) == 
> 0 &&
> +((TargetNetworkInterface->IsIpv6 && 
> ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
> +(!TargetNetworkInterface->IsIpv6 && 
> ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
>return ThisNetworkInterface;
>  }
>
> @@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;
>
> +  if (IsListEmpty ()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
> *)GetFirstNode ();
>while (TRUE) {
>  if (ThisNetworkInterface->OpenDriverControllerHandle == 
> ControllerHandle) {
> @@ -476,6 +486,39 @@ CheckIsIpVersion6 (
>return FALSE;
>  }
>
> +/**
> +  This function returns the  IP type supported by the Host Interface
> +
> +  @retval IP Type
> +  //  Unknown=00h,
> +  //  Ipv4=01h,
> +  //  Ipv6=02h,
> +
> +**/
> +STATIC
> +UINT8
> +GetHiIpProtocolType()
> +{
> +  EFI_STATUS Status;
> +  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
> +  REDFISH_INTERFACE_DATA *DeviceDescriptor;
> +
> +  Data = NULL;
> +  DeviceDescriptor = NULL;
> +  if (mSmbios == NULL) {
> +Status = gBS->LocateProtocol (, NULL, (VOID 
> **));
> +if (EFI_ERROR (Status)) {
> +  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +  }
> +  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
> ); // Search for SMBIOS type 42h
> +  if (!EFI_ERROR (Status) && (Data != NULL) &&
> +  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic)) {
> +  return Data->HostIpAddressFormat;
> +  }
> +  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +
>  /**
>This function discover Redfish service through SMBIOS host interface.
>
> @@ -512,6 +555,15 @@ DiscoverRedfishHostInterface (
>
>Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
> ); // Search for SMBIOS type 42h
>if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
> +
> +if (Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4 
> && Data->HostIpAddressFormat != 
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4) { // IPv4 case
> +  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host 
> Interface requires Ipv6\n", __func__));
> +  return EFI_UNSUPPORTED;
> +}
> +else if (Instance->NetworkInterface->NetworkProtocolType == 
> ProtocolTypeTcp6 && Data->HostIpAddressFormat != 
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6) { // IPv6 case
> +  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host 
> Interface requires IPv4\n", __func__));
> +  return EFI_UNSUPPORTED;
> +}
>  //
>  // Check if we can reach out Redfish service using this network 
> interface.
>  // Check with MAC address using Device Descriptor Data Device Type 04 
> and Type 05.
> @@ -1102,6 +1154,7 @@ RedfishServiceGetNetworkInterface (
>OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances

Re: [edk2-devel] [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-02 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
I fixed all your comments, Abner and Mike comments.
I also created PR
https://github.com/tianocore/edk2/pull/4994/
I fixed all Uncrustify errors and CI passed except PatchCheck which shows the 
error
* Missing Signed-off-by! (Note: this must be added by the code contributor!)
Which I'm not sure how to fix. I added Signed-off-by during commit.
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Wednesday, November 1, 2023 10:57 PM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Abner Chang ; Mike Maslenkin 
Subject: [EXTERNAL] RE: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if 
IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

This change looks good to me. Just minor comments:

> DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this controller 
> handle: %p.\n", __func__, ControllerHandle));

Could we use DEBUG_MANAGEABILITY to replace DEBUG_INFO in Redfish driver? This 
gives us the way to show manageability information only while debugging.

And it looks like we don't run uncrustify to this patch. May I know if it is 
possible to create a PR on edk2 repository and edk2 CI can test it? Edk2 CI 
helps me to catch some formatting issue that I am not aware of.

Thanks,
Nickle

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Thursday, November 2, 2023 4:18 AM
> To: devel@edk2.groups.io
> Cc: Abner Chang ; Nickle Wang ;
> Mike Maslenkin 
> Subject: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 
> installed
> after RestEx
>
> External email: Use caution opening links or attachments
>
>
> Supported function of the driver changed to wait for all newtwork
> interface to be installed.
> Filer out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Mike Maslenkin 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 131 ++---
> ---
>  1 file changed, 95 insertions(+), 36 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 23da3b968f..c67b8acf12 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> *ThisNetworkInterface;
>
> +  if (IsListEmpty ()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> ();
>while (TRUE) {
> -if (CompareMem ((VOID *)>MacAddress,
> >MacAddress, ThisNetworkInterface->HwAddressSize)
> == 0) {
> +if (CompareMem ((VOID *)>MacAddress,
> >MacAddress, ThisNetworkInterface->HwAddressSize)
> == 0 &&
> +((TargetNetworkInterface->IsIpv6 && ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp6) ||
> +(!TargetNetworkInterface->IsIpv6 && ThisNetworkInterface-
> >NetworkProtocolType == ProtocolTypeTcp4))) {
>return ThisNetworkInterface;
>  }
>
> @@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> *ThisNetworkInterface;
>
> +  if (IsListEmpty ()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface =
> (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> ();
>while (TRUE) {
>  if (ThisNetworkInterface->OpenDriverControllerHandle == 
> ControllerHandle) {
> @@ -476,6 +486,39 @@ CheckIsIpVersion6 (
>return FALSE;
>  }
>
> +/**
> +  This function returns the  IP type supported by the Host Interface
> +
> +  @retval IP Type
> +  //  Unknown=00h,
> +  //  Ipv4=01h,
> +  //  Ipv6=02h,
> +
> +**/
> +STATIC
> +UINT8
> +GetHiIpProtocolType()
> +{
> +  EFI_STATUS Status;
> +  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
> +  REDFISH_INTERFACE_DATA *DeviceDescriptor;
> +
> +  Data = NULL;
> +  DeviceDescriptor = NULL;
> +  if (mSmbios == NULL) {
> +Status = gBS->LocateProtocol (, NULL, (VOID
> **));
> +if (EFI_ERROR (Status)) {
> +  return
> REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +  }
> +  Status = RedfishGetHostInterfaceProtocolData (mSmbios, ,
> ); // Search for SMBIOS type 42h
> +  if (!EFI_ERROR (Status) && (Data != NULL) &&
> +  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic)) {
> +  return Data->HostIpAddressFormat;
> +  }
> +  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> +}
> +
>  /**
>This function discover Redfish service through SMBIOS host interface.
>
> @@ -512,6 +555,15 @@ DiscoverRedfishHostInterface (
>
>Status = RedfishGetHostInterfaceProtocolData (mSmbios, ,
> ); // Search for SMBIOS type 42h
>if (!EFI_ERROR (Status) && (Data != NULL) 

[edk2-devel] [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-01 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

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

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..c67b8acf12 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0 
&&
+((TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
+(!TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
   return ThisNetworkInterface;
 }

@@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty ()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +486,39 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface
+
+  @retval IP Type
+  //  Unknown=00h,
+  //  Ipv4=01h,
+  //  Ipv6=02h,
+
+**/
+STATIC
+UINT8
+GetHiIpProtocolType()
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+  }
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic)) {
+  return Data->HostIpAddressFormat;
+  }
+  return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +555,15 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+
+if (Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4 && 
Data->HostIpAddressFormat != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4) 
{ // IPv4 case
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interface 
requires Ipv6\n", __func__));
+  return EFI_UNSUPPORTED;
+}
+else if (Instance->NetworkInterface->NetworkProtocolType == 
ProtocolTypeTcp6 && Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6) { // IPv6 case
+  DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interface 
requires IPv4\n", __func__));
+  return EFI_UNSUPPORTED;
+}
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1102,6 +1154,7 @@ RedfishServiceGetNetworkInterface (
   OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances
   )
 {
+  EFI_STATUS   Status;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterfaceIntn;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE   *ThisNetworkInterface;
   EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
@@ -1141,6 +1194,16 @@ RedfishServiceGetNetworkInterface (

   ThisNetworkInterfaceIntn = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
+// If Get Subnet Info failed then skip this interface
+Status = NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, 
ImageHandle); // Get subnet info
+if (EFI_ERROR(Status)) {
+  if (IsNodeAtEnd (, 
>Entry)) {
+break;
+  }
+  ThisNetworkInterfaceIntn = 
(EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode 
(, >Entry);
+  continue;
+}
+
 ThisNetworkInterface->IsIpv6 = FALSE;
 if 

Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-10-31 Thread Igor Kulchytskyy via groups.io
Hi Mike,
Thank you for review.
Please see my answers below the text.

-Original Message-
From: Mike Maslenkin 
Sent: Tuesday, October 31, 2023 9:00 PM
To: devel@edk2.groups.io; Igor Kulchytskyy 
Cc: Abner Chang ; Nickle Wang 
Subject: [EXTERNAL] Re: [edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: 
Fix issue if IPv4 installed after RestEx


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Hi Igor

please find my comments below.

On Tue, Oct 31, 2023 at 8:56 PM Igor Kulchytskyy via groups.io
 wrote:
>
> Supported function of the driver changed to wait for all newtwork
> interface to be installed.
> Filer out the network interfaces which are not supported by
> Redfish Host Interface.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 96 ++--
>  1 file changed, 89 insertions(+), 7 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 23da3b968f..a88ad55938 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;
>
> +  if (IsListEmpty()) {
> +return NULL;
> +  }
> +
>ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
> *)GetFirstNode ();
>while (TRUE) {
> -if (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize) == 
> 0) {
> +if (CompareMem ((VOID *)>MacAddress, 
> >MacAddress, ThisNetworkInterface->HwAddressSize) == 
> 0 &&
> +((TargetNetworkInterface->IsIpv6 && 
> ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
> +(!TargetNetworkInterface->IsIpv6 && 
> ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
>return ThisNetworkInterface;
>  }
>
> @@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
>  {
>EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;
>
> +  if (IsListEmpty()) {
> +return NULL;
> +  }
> +

I also have these two hunks in my pending list.
But I suggest to add ASSERT to GetTargetNetworkInterfaceInternal, just
because currently it is really impossible situation,
and mEfiRedfishDiscoverNetworkInterface was checked before in scope of
 ValidateTargetNetworkInterface().

Igor: Agree.
I also just noticed that even if GetTargetNetworkInterfaceInternal function may 
return NULL, the return value is not verified on NULL in 
RedfishServiceAcquireService function.
I think we should add this verification.


Also I wonder why check patch doesn't complain about missed spaces in
"IsListEmpty ()" call for example.

>ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
> *)GetFirstNode ();
>while (TRUE) {
>  if (ThisNetworkInterface->OpenDriverControllerHandle == 
> ControllerHandle) {
> @@ -476,6 +486,38 @@ CheckIsIpVersion6 (
>return FALSE;
>  }
>
> +/**
> +  This function returns the  IP type supported by the Host Interface
> +
> +  @retval IP Type
> +  //  Unknown=00h,
> +  //  Ipv4=01h,
> +  //  Ipv6=02h,
> +
> +**/
> +UINT8

STATIC ?
Igor: WHY?

> +GetHiIpProtocolType()
> +{
> +  EFI_STATUS Status;
> +  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
> +  REDFISH_INTERFACE_DATA *DeviceDescriptor;
> +
> +  Data = NULL;
> +  DeviceDescriptor = NULL;
> +  if (mSmbios == NULL) {
> +Status = gBS->LocateProtocol (, NULL, (VOID 
> **));
> +if (EFI_ERROR (Status)) {
> +  return 0;

In this driver REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP{4,6}
used and accessible.
so, 0 means  REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN
And these values actually checked in scope of BuildupNetworkInterface() below.
Igor: Thank you. Missed that macro.

> +}
> +  }
> +  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
> ); // Search for SMBIOS type 42h
> +  if (!EFI_ERROR (Status) && (Data != NULL) &&
> +  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic)) {
> +  return Data->HostIpAddressFormat;
> +  }
> +  return 0;

Same here, 0 is a magic value for
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN

> +}
> +
>  /**
>This function discover Redfish service through SMBIOS host interface.
>
> @@ -512,6 +554,1

[edk2-devel] [PATCH] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-10-31 Thread Igor Kulchytskyy via groups.io
Supported function of the driver changed to wait for all newtwork
interface to be installed.
Filer out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 96 ++--
 1 file changed, 89 insertions(+), 7 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 23da3b968f..a88ad55938 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
-if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0) 
{
+if (CompareMem ((VOID *)>MacAddress, 
>MacAddress, ThisNetworkInterface->HwAddressSize) == 0 
&&
+((TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp6) ||
+(!TargetNetworkInterface->IsIpv6 && 
ThisNetworkInterface->NetworkProtocolType == ProtocolTypeTcp4))) {
   return ThisNetworkInterface;
 }

@@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController (
 {
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterface;

+  if (IsListEmpty()) {
+return NULL;
+  }
+
   ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
 if (ThisNetworkInterface->OpenDriverControllerHandle == ControllerHandle) {
@@ -476,6 +486,38 @@ CheckIsIpVersion6 (
   return FALSE;
 }

+/**
+  This function returns the  IP type supported by the Host Interface
+
+  @retval IP Type
+  //  Unknown=00h,
+  //  Ipv4=01h,
+  //  Ipv6=02h,
+
+**/
+UINT8
+GetHiIpProtocolType()
+{
+  EFI_STATUS Status;
+  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
+  REDFISH_INTERFACE_DATA *DeviceDescriptor;
+
+  Data = NULL;
+  DeviceDescriptor = NULL;
+  if (mSmbios == NULL) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return 0;
+}
+  }
+  Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
+  if (!EFI_ERROR (Status) && (Data != NULL) &&
+  (Data->HostIpAssignmentType == RedfishHostIpAssignmentStatic)) {
+  return Data->HostIpAddressFormat;
+  }
+  return 0;
+}
+
 /**
   This function discover Redfish service through SMBIOS host interface.

@@ -512,6 +554,15 @@ DiscoverRedfishHostInterface (

   Status = RedfishGetHostInterfaceProtocolData (mSmbios, , 
); // Search for SMBIOS type 42h
   if (!EFI_ERROR (Status) && (Data != NULL) && (DeviceDescriptor != NULL)) {
+
+if (Instance->NetworkInterface->NetworkProtocolType == ProtocolTypeTcp4 && 
Data->HostIpAddressFormat != REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4) 
{ // IPv4 case
+  DEBUG((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interface 
requires Ipv6\n"));
+  return EFI_UNSUPPORTED;
+}
+else if (Instance->NetworkInterface->NetworkProtocolType == 
ProtocolTypeTcp6 && Data->HostIpAddressFormat != 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6) { // IPv6 case
+  DEBUG((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interface 
requires IPv4\n"));
+  return EFI_UNSUPPORTED;
+}
 //
 // Check if we can reach out Redfish service using this network interface.
 // Check with MAC address using Device Descriptor Data Device Type 04 and 
Type 05.
@@ -1102,6 +1153,7 @@ RedfishServiceGetNetworkInterface (
   OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  **NetworkIntfInstances
   )
 {
+  EFI_STATUS   Status;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL  *ThisNetworkInterfaceIntn;
   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE   *ThisNetworkInterface;
   EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExInstance;
@@ -1141,6 +1193,16 @@ RedfishServiceGetNetworkInterface (

   ThisNetworkInterfaceIntn = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL 
*)GetFirstNode ();
   while (TRUE) {
+// If Get Subnet Info skip this interface
+Status = NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, 
ImageHandle); // Get subnet info
+if (EFI_ERROR(Status)) {
+  if (IsNodeAtEnd (, 
>Entry)) {
+break;
+  }
+  ThisNetworkInterfaceIntn = 
(EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode 
(, >Entry);
+  continue;
+}
+
 ThisNetworkInterface->IsIpv6 = FALSE;
 if (CheckIsIpVersion6 (ThisNetworkInterfaceIntn)) {
   ThisNetworkInterface->IsIpv6 = TRUE;
@@ -1260,7 +1322,12 @@ RedfishServiceAcquireService (
   

Re: [edk2-devel] [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers to caller

2023-10-26 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Reviewed the whole PATCH

-Original Message-
From: Nickle Wang 
Sent: Thursday, October 26, 2023 9:20 AM
To: Igor Kulchytskyy ; Chang, Abner ; 
devel@edk2.groups.io
Cc: Nick Ramirez 
Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP 
headers to caller

According to my experience, BIOS Redfish is usually the owner to handle Redfish 
task request, not the user to create task. So, I think that BIOS has no chance 
to read HTTP header in DELETE request/response.

But from specification perspective, Redfish task URI can be returned in HTTP 
header in DELETE request.

Regards,
Nickle

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Thursday, October 26, 2023 9:09 PM
> To: Nickle Wang ; Chang, Abner
> ; devel@edk2.groups.io
> Cc: Nick Ramirez 
> Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP
> headers to caller
>
> External email: Use caution opening links or attachments
>
>
> You mean, for the Redfish task functionality other functions will be used?
> Thank you,
> Igor
>
> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, October 26, 2023 8:58 AM
> To: Igor Kulchytskyy ; Chang, Abner ;
> devel@edk2.groups.io
> Cc: Nick Ramirez 
> Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP
> headers to caller
>
> Hi Igor,
>
> If the DELETE request to BMC is handled by Redfish task, we need to return 
> HTTP
> header to caller so caller can get Task URI. But from BIOS Redfish 
> perspective, I
> don't see this use case yet.
>
> Thanks,
> Nickle
>
> > -Original Message-
> > From: Igor Kulchytskyy 
> > Sent: Thursday, October 26, 2023 8:50 PM
> > To: Chang, Abner ; Nickle Wang
> > ; devel@edk2.groups.io
> > Cc: Nick Ramirez 
> > Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return
> > HTTP headers to caller
> >
> > External email: Use caution opening links or attachments
> >
> >
> > Hi Nickle,
> > Just one quick question.
> > Is there any sense to return the headers for DELETE request?
> > Thank you,
> > Igor
> >
> > -Original Message-
> > From: Chang, Abner 
> > Sent: Thursday, October 26, 2023 2:10 AM
> > To: Nickle Wang ; devel@edk2.groups.io
> > Cc: Igor Kulchytskyy ; Nick Ramirez
> > 
> > Subject: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP
> > headers to caller
> >
> >
> > **CAUTION: The e-mail below is from an external source. Please
> > exercise caution before opening attachments, clicking links, or
> > following guidance.**
> >
> > [AMD Official Use Only - General]
> >
> > Reviewed-by: Abner Chang 
> >
> > > -Original Message-
> > > From: Nickle Wang 
> > > Sent: Tuesday, October 24, 2023 4:40 PM
> > > To: devel@edk2.groups.io
> > > Cc: Chang, Abner ; Igor Kulchytskyy
> > > ; Nick Ramirez 
> > > Subject: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers to
> > > caller
> > >
> > > Caution: This message originated from an External Source. Use proper
> > > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > Call Ex interface to get HTTP headers and return to caller.
> > >
> > > Signed-off-by: Nickle Wang 
> > > Cc: Abner Chang 
> > > Cc: Igor Kulchytskyy 
> > > Cc: Nick Ramirez 
> > > ---
> > >  RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c | 10 +++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > > b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > > index f4045044829a..5e06d516ba84 100644
> > > --- a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > > @@ -356,7 +356,7 @@ RedfishGetByUri (
> > >
> > >ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> > >
> > > -  JsonValue= getUriFromService (RedfishService, Uri, 
> > > 
> > > >StatusCode);
> > > +  JsonValue= getUriFromServiceEx (RedfishService, Uri,
> 
> > > >Headers, >HeaderCount, >StatusCode);
> > >RedResponse->Payload = createRedfishPayload (JsonValue,
> > > RedfishService);
> > >
> > >//
> > > @@ -498,10 +498,12 @@ RedfishPatchToUri (
> > >
> > >ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> > >
> > > -  JsonValue = (EDKII_JSON_VALUE)patchUriFromService (
> > > +  JsonValue = (EDKII_JSON_VALUE)patchUriFromServiceEx (
> > >RedfishService,
> > >Uri,
> > >Content,
> > > +  &(RedResponse->Headers),
> > > +  &(RedResponse->HeaderCount),
> > >&(RedResponse->StatusCode)
> > >);
> > >
> > > @@ -661,12 +663,14 @@ RedfishPostToUri (
> > >
> > >ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> > >
> > > -  JsonValue = (EDKII_JSON_VALUE)postUriFromService (
> > > +  JsonValue = 

Re: [edk2-devel] [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers to caller

2023-10-26 Thread Igor Kulchytskyy via groups.io
You mean, for the Redfish task functionality other functions will be used?
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Thursday, October 26, 2023 8:58 AM
To: Igor Kulchytskyy ; Chang, Abner ; 
devel@edk2.groups.io
Cc: Nick Ramirez 
Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP 
headers to caller

Hi Igor,

If the DELETE request to BMC is handled by Redfish task, we need to return HTTP 
header to caller so caller can get Task URI. But from BIOS Redfish perspective, 
I don't see this use case yet.

Thanks,
Nickle

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Thursday, October 26, 2023 8:50 PM
> To: Chang, Abner ; Nickle Wang
> ; devel@edk2.groups.io
> Cc: Nick Ramirez 
> Subject: RE: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP
> headers to caller
>
> External email: Use caution opening links or attachments
>
>
> Hi Nickle,
> Just one quick question.
> Is there any sense to return the headers for DELETE request?
> Thank you,
> Igor
>
> -Original Message-
> From: Chang, Abner 
> Sent: Thursday, October 26, 2023 2:10 AM
> To: Nickle Wang ; devel@edk2.groups.io
> Cc: Igor Kulchytskyy ; Nick Ramirez 
> Subject: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP
> headers to caller
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> [AMD Official Use Only - General]
>
> Reviewed-by: Abner Chang 
>
> > -Original Message-
> > From: Nickle Wang 
> > Sent: Tuesday, October 24, 2023 4:40 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; Igor Kulchytskyy
> > ; Nick Ramirez 
> > Subject: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers to
> > caller
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > Call Ex interface to get HTTP headers and return to caller.
> >
> > Signed-off-by: Nickle Wang 
> > Cc: Abner Chang 
> > Cc: Igor Kulchytskyy 
> > Cc: Nick Ramirez 
> > ---
> >  RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > index f4045044829a..5e06d516ba84 100644
> > --- a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > +++ b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> > @@ -356,7 +356,7 @@ RedfishGetByUri (
> >
> >ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> >
> > -  JsonValue= getUriFromService (RedfishService, Uri, 
> > 
> > >StatusCode);
> > +  JsonValue= getUriFromServiceEx (RedfishService, Uri, 
> > 
> > >Headers, >HeaderCount, >StatusCode);
> >RedResponse->Payload = createRedfishPayload (JsonValue,
> > RedfishService);
> >
> >//
> > @@ -498,10 +498,12 @@ RedfishPatchToUri (
> >
> >ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> >
> > -  JsonValue = (EDKII_JSON_VALUE)patchUriFromService (
> > +  JsonValue = (EDKII_JSON_VALUE)patchUriFromServiceEx (
> >RedfishService,
> >Uri,
> >Content,
> > +  &(RedResponse->Headers),
> > +  &(RedResponse->HeaderCount),
> >&(RedResponse->StatusCode)
> >);
> >
> > @@ -661,12 +663,14 @@ RedfishPostToUri (
> >
> >ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
> >
> > -  JsonValue = (EDKII_JSON_VALUE)postUriFromService (
> > +  JsonValue = (EDKII_JSON_VALUE)postUriFromServiceEx (
> >RedfishService,
> >Uri,
> >Content,
> >ContentSize,
> >ContentType,
> > +  &(RedResponse->Headers),
> > +  &(RedResponse->HeaderCount),
> >&(RedResponse->StatusCode)
> >);
> >
> > --
> > 2.17.1
>
> -The information contained in this message may be confidential and proprietary
> to American Megatrends (AMI). This communication is intended to be read only 
> by
> the individual or entity to whom it is addressed or by their designee. If the 
> reader
> of this message is not the intended recipient, you are on notice that any
> distribution of this message, in any form, is strictly prohibited. Please 
> promptly
> notify the sender by reply e-mail or by telephone at 770-246-8600, and then
> delete or destroy all copies of the transmission.
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This 

Re: [edk2-devel] [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers to caller

2023-10-26 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
Just one quick question.
Is there any sense to return the headers for DELETE request?
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Thursday, October 26, 2023 2:10 AM
To: Nickle Wang ; devel@edk2.groups.io
Cc: Igor Kulchytskyy ; Nick Ramirez 
Subject: [EXTERNAL] RE: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers 
to caller


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, October 24, 2023 4:40 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [PATCH 3/3] RedfishPkg/RedfishLib: return HTTP headers to caller
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Call Ex interface to get HTTP headers and return to caller.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> index f4045044829a..5e06d516ba84 100644
> --- a/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> +++ b/RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c
> @@ -356,7 +356,7 @@ RedfishGetByUri (
>
>ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
>
> -  JsonValue= getUriFromService (RedfishService, Uri, 
> 
> >StatusCode);
> +  JsonValue= getUriFromServiceEx (RedfishService, Uri, 
> 
> >Headers, >HeaderCount, >StatusCode);
>RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
>
>//
> @@ -498,10 +498,12 @@ RedfishPatchToUri (
>
>ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
>
> -  JsonValue = (EDKII_JSON_VALUE)patchUriFromService (
> +  JsonValue = (EDKII_JSON_VALUE)patchUriFromServiceEx (
>RedfishService,
>Uri,
>Content,
> +  &(RedResponse->Headers),
> +  &(RedResponse->HeaderCount),
>&(RedResponse->StatusCode)
>);
>
> @@ -661,12 +663,14 @@ RedfishPostToUri (
>
>ZeroMem (RedResponse, sizeof (REDFISH_RESPONSE));
>
> -  JsonValue = (EDKII_JSON_VALUE)postUriFromService (
> +  JsonValue = (EDKII_JSON_VALUE)postUriFromServiceEx (
>RedfishService,
>Uri,
>Content,
>ContentSize,
>ContentType,
> +  &(RedResponse->Headers),
> +  &(RedResponse->HeaderCount),
>&(RedResponse->StatusCode)
>);
>
> --
> 2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/RedfishDiscoverDxe: introduce PcdRedfishSendReceiveTimeout

2023-10-18 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Wednesday, October 18, 2023 9:08 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishDiscoverDxe: introduce 
PcdRedfishSendReceiveTimeout


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Introduce PCD PcdRedfishSendReceiveTimeout to RedfishDiscoverDxe
driver. The SendReceiveTimeout is hard-code value in Redfish discover
driver. With this PCD, platform owner can configure timeout value
easily.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 RedfishPkg/RedfishPkg.dec| 5 +
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf | 2 +-
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index cdb1528cedc9..0f18865cea0b 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -142,3 +142,8 @@
   # This PCD indicates that if BMC bootstrap credential service will be 
disabled by BIOS or not.
   #
   
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1007
+  #
+  # The EFI_REST_EX_HTTP_CONFIG_DATA.SendReceiveTimeout value that 
RedfishDiscoverDxe driver
+  # set to EFI_REST_EX_PROTOCOL.
+  #
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT32|0x1008
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
index 950098bf6a0d..c982056fd700 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
@@ -54,4 +54,4 @@

 [Pcd]
   gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDiscoverAccessModeInBand ## CONSUMES
-
+  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout   ## CONSUEMS
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 17c88ad82db4..2f9e604f6cd6 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -877,7 +877,7 @@ AddAndSignalNewRedfishService (
 goto EXIT_FREE_CONFIG_DATA;
   }

-  RestExHttpConfigData->SendReceiveTimeout= 5000;
+  RestExHttpConfigData->SendReceiveTimeout= PcdGet32 
(PcdRedfishSendReceiveTimeout);
   RestExHttpConfigData->HttpConfigData.HttpVersion= HttpVersion11;
   RestExHttpConfigData->HttpConfigData.LocalAddressIsIPv6 = 
CheckIsIpVersion6 (NetworkInterface);
   if (RestExHttpConfigData->HttpConfigData.LocalAddressIsIPv6) {
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue

2023-09-20 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor
-Original Message-
From: Nickle Wang 
Sent: Monday, September 18, 2023 9:09 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

JsonObjectGetValue() cannot find corresponding JSON value
when the EDKII_JSON_VALUE object is created by another UEFI
driver. This is because "hashtable_seed" is initialized by
current time while JsonLib is loaded. So, "hashtable_seed"
will be different in each individual UEFI driver.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/Library/JsonLib/JsonLib.inf |  1 +
 RedfishPkg/Library/JsonLib/JsonLib.c   | 34 ++
 2 files changed, 35 insertions(+)

diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf 
b/RedfishPkg/Library/JsonLib/JsonLib.inf
index 9d52a622e13a..b0d1bcac7cb3 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.inf
+++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
@@ -15,6 +15,7 @@
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = JsonLib|DXE_DRIVER UEFI_APPLICATION 
UEFI_DRIVER
+  CONSTRUCTOR= JsonLibConstructor

 #
 #  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64 RISCV64
diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c 
b/RedfishPkg/Library/JsonLib/JsonLib.c
index 9b758b940293..a7ec2ab217a6 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.c
+++ b/RedfishPkg/Library/JsonLib/JsonLib.c
@@ -19,6 +19,8 @@

 #include "jansson.h"

+extern volatile UINT32  hashtable_seed;
+
 /**
   The function is used to initialize a JSON value which contains a new JSON 
array,
   or NULL on error. Initially, the array is empty.
@@ -1138,3 +1140,35 @@ JsonGetType (
 {
   return (EDKII_JSON_TYPE)(((json_t *)JsonValue)->type);
 }
+
+/**
+  JSON Library constructor.
+
+  @param ImageHandle The image handle.
+  @param SystemTable The system table.
+
+  @retval  EFI_SUCCESS  Protocol listener is registered successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+JsonLibConstructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  //
+  // hashtable_seed is initalized by current time while JsonLib is loaded.
+  // Due to above mechanism, hashtable_seed will be different in each 
individual
+  // UEFI driver. As the result, the hash of same key in different UEFI driver
+  // would be different. This breaks JsonObjectGetValue() because
+  // JsonObjectGetValue() won't be able to find corresponding JSON value if
+  // this EDKII_JSON_VALUE is created by another UEFI driver.
+  //
+  // Initial the seed to a fixed magic value for JsonLib to be working in all
+  // UEFI drivers.
+  //
+  hashtable_seed = 0xFDAE2143;
+
+  return EFI_SUCCESS;
+}
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue

2023-09-20 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
Yes, I understand the mechanism of how seed works.
And when I used the RedfishPkg and Jansson parser in my modules, I passed the 
seed to each driver, so, all of them used the same seed.
All of them call a  json_object_seed() function with the same seed.
Now, there is no need to do it.
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Wednesday, September 20, 2023 5:18 AM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Abner Chang ; Nick Ramirez 
Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue

Hi Igor,

According to my understanding to jansson implementation, json_object_seed() is 
only called in three places. Two of them are in test code and we don't use them 
in EDK2. The only chance to call json_object_seed() is in json_object(). So, it 
is called when driver create new JSON object and hashtable_seed is not 
initialized yet, which means  json_object_seed() will be called only once per 
UEFI driver.

json_object_seed() use current time as hash table seed, which creates issue in 
EDK2 environment. In EDK2, library is built with UEFI driver together. So, 
there are multiple instances of JsonLib in the system. And the hash table seed 
is different in each driver in current implementation. As the result, the JSON 
object created by this driver can not be used by another driver.

> Does that mean, that json_object_seed function is useless anymore with those
> changes?

Yes, once constructor set hashtable_seed to a magic value, json_object_seed() 
won't do anything.

> And there is no need for other module to call json_object_seed?

No, it is called when driver create JSON object and the seed is still zero. 
Once the seed is set to non-zero value, json_object_seed() does nothing.

Regards,
Nickle

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Monday, September 18, 2023 9:42 PM
> To: Nickle Wang ; devel@edk2.groups.io
> Cc: Abner Chang ; Nick Ramirez
> 
> Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue
> issue
>
> External email: Use caution opening links or attachments
>
>
> Hi Nickle,
> Does that mean, that json_object_seed function is useless anymore with those
> changes?
> And there is no need for other module to call json_object_seed?
> Thank you,
> Igor
>
> -Original Message-
> From: Nickle Wang 
> Sent: Monday, September 18, 2023 9:09 AM
> To: devel@edk2.groups.io
> Cc: Abner Chang ; Igor Kulchytskyy ;
> Nick Ramirez 
> Subject: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> JsonObjectGetValue() cannot find corresponding JSON value when the
> EDKII_JSON_VALUE object is created by another UEFI driver. This is because
> "hashtable_seed" is initialized by current time while JsonLib is loaded. So,
> "hashtable_seed"
> will be different in each individual UEFI driver.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishPkg/Library/JsonLib/JsonLib.inf |  1 +
>  RedfishPkg/Library/JsonLib/JsonLib.c   | 34 ++
>  2 files changed, 35 insertions(+)
>
> diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf
> b/RedfishPkg/Library/JsonLib/JsonLib.inf
> index 9d52a622e13a..b0d1bcac7cb3 100644
> --- a/RedfishPkg/Library/JsonLib/JsonLib.inf
> +++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
> @@ -15,6 +15,7 @@
>MODULE_TYPE= DXE_DRIVER
>VERSION_STRING = 1.0
>LIBRARY_CLASS  = JsonLib|DXE_DRIVER UEFI_APPLICATION
> UEFI_DRIVER
> +  CONSTRUCTOR= JsonLibConstructor
>
>  #
>  #  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64 RISCV64
> diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c
> b/RedfishPkg/Library/JsonLib/JsonLib.c
> index 9b758b940293..a7ec2ab217a6 100644
> --- a/RedfishPkg/Library/JsonLib/JsonLib.c
> +++ b/RedfishPkg/Library/JsonLib/JsonLib.c
> @@ -19,6 +19,8 @@
>
>  #include "jansson.h"
>
> +extern volatile UINT32  hashtable_seed;
> +
>  /**
>The function is used to initialize a JSON value which contains a new JSON 
> array,
>or NULL on error. Initially, the array is empty.
> @@ -1138,3 +1140,35 @@ JsonGetType (
>  {
>return (EDKII_JSON_TYPE)(((json_t *)JsonValue)->type);  }
> +
> +/**
> +  JSON Library constructor.
> +
> +  @param ImageHandle The image handle.
> +  @param SystemTable The system table.
> +
> +  @retval  EFI_SUCCESS  Protocol listener is registered successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +JsonLibConstructor (
> +  IN EFI_HANDLEImageHandle,
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  //
> +  // hashtable_seed is initalized by current time while JsonLib is loaded.
> +  // Due to above mechanism, hashtable_seed will be different in each
> +individual
> +  // UEFI driver. As the result, the hash 

Re: [edk2-devel] [PATCH v2] RedfishPkg/RedfishRestExDxe: return HTTP status code to caller.

2023-09-18 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: Nickle Wang 
Sent: Monday, September 18, 2023 9:13 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez ; Mike Maslenkin 
Subject: [EXTERNAL] [PATCH v2] RedfishPkg/RedfishRestExDxe: return HTTP status 
code to caller.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Return unsupported HTTP status code to caller so caller can handle
HTTP error status code. Current implementation only return EFI error
to caller. Without knowing the HTTP status code, caller has trouble
to handle HTTP request failure.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
Cc: Mike Maslenkin 
---
 MdePkg/Include/Protocol/RestEx.h  |  3 ++-
 .../RedfishRestExDxe/RedfishRestExProtocol.c  | 27 ++-
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/MdePkg/Include/Protocol/RestEx.h b/MdePkg/Include/Protocol/RestEx.h
index e9bc7be94f2c..da9f1c3f87ef 100644
--- a/MdePkg/Include/Protocol/RestEx.h
+++ b/MdePkg/Include/Protocol/RestEx.h
@@ -131,7 +131,8 @@ typedef struct {
   response when the data is retrieved from the service. RequestMessage 
contains the HTTP
   request to the REST resource identified by RequestMessage.Request.Url. The
   ResponseMessage is the returned HTTP response for that request, including 
any HTTP
-  status.
+  status. It's caller's responsibility to free this ResponseMessage using 
FreePool().
+  RestConfigFreeHttpMessage() in RedfishLib is an example to release 
ResponseMessage structure.

   @param[in]  ThisPointer to EFI_REST_EX_PROTOCOL instance for 
a particular
   REST service.
diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c 
b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c
index 90973619f2bc..5bcdade4b18c 100644
--- a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c
+++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c
@@ -29,7 +29,8 @@ EFI_REST_EX_PROTOCOL  mRedfishRestExProtocol = {
   response when the data is retrieved from the service. RequestMessage 
contains the HTTP
   request to the REST resource identified by RequestMessage.Request.Url. The
   ResponseMessage is the returned HTTP response for that request, including 
any HTTP
-  status.
+  status. It's caller's responsibility to free this ResponseMessage using 
FreePool().
+  RestConfigFreeHttpMessage() in RedfishLib is an example to release 
ResponseMessage structure.

   @param[in]  ThisPointer to EFI_REST_EX_PROTOCOL instance for 
a particular
   REST service.
@@ -320,6 +321,18 @@ ReSendRequest:;
 DEBUG ((DEBUG_ERROR, "This HTTP Status is not handled!\n"));
 DumpHttpStatusCode (DEBUG_REDFISH_NETWORK, 
ResponseData->Response.StatusCode);
 Status = EFI_UNSUPPORTED;
+
+//
+// Deliver status code back to caller so caller can handle it.
+//
+ResponseMessage->Data.Response = AllocateZeroPool (sizeof 
(EFI_HTTP_RESPONSE_DATA));
+if (ResponseMessage->Data.Response == NULL) {
+  Status = EFI_OUT_OF_RESOURCES;
+  goto ON_EXIT;
+}
+
+ResponseMessage->Data.Response->StatusCode = 
ResponseData->Response.StatusCode;
+
 goto ON_EXIT;
   }

@@ -443,18 +456,6 @@ ON_EXIT:
 FreePool (ResponseData);
   }

-  if (EFI_ERROR (Status)) {
-if (ResponseMessage->Data.Response != NULL) {
-  FreePool (ResponseMessage->Data.Response);
-  ResponseMessage->Data.Response = NULL;
-}
-
-if (ResponseMessage->Body != NULL) {
-  FreePool (ResponseMessage->Body);
-  ResponseMessage->Body = NULL;
-}
-  }
-
   return Status;
 }

--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue

2023-09-18 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
Does that mean, that json_object_seed function is useless anymore with those 
changes?
And there is no need for other module to call json_object_seed?
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Monday, September 18, 2023 9:09 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

JsonObjectGetValue() cannot find corresponding JSON value
when the EDKII_JSON_VALUE object is created by another UEFI
driver. This is because "hashtable_seed" is initialized by
current time while JsonLib is loaded. So, "hashtable_seed"
will be different in each individual UEFI driver.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/Library/JsonLib/JsonLib.inf |  1 +
 RedfishPkg/Library/JsonLib/JsonLib.c   | 34 ++
 2 files changed, 35 insertions(+)

diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf 
b/RedfishPkg/Library/JsonLib/JsonLib.inf
index 9d52a622e13a..b0d1bcac7cb3 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.inf
+++ b/RedfishPkg/Library/JsonLib/JsonLib.inf
@@ -15,6 +15,7 @@
   MODULE_TYPE= DXE_DRIVER
   VERSION_STRING = 1.0
   LIBRARY_CLASS  = JsonLib|DXE_DRIVER UEFI_APPLICATION 
UEFI_DRIVER
+  CONSTRUCTOR= JsonLibConstructor

 #
 #  VALID_ARCHITECTURES   = IA32 X64 ARM AARCH64 RISCV64
diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c 
b/RedfishPkg/Library/JsonLib/JsonLib.c
index 9b758b940293..a7ec2ab217a6 100644
--- a/RedfishPkg/Library/JsonLib/JsonLib.c
+++ b/RedfishPkg/Library/JsonLib/JsonLib.c
@@ -19,6 +19,8 @@

 #include "jansson.h"

+extern volatile UINT32  hashtable_seed;
+
 /**
   The function is used to initialize a JSON value which contains a new JSON 
array,
   or NULL on error. Initially, the array is empty.
@@ -1138,3 +1140,35 @@ JsonGetType (
 {
   return (EDKII_JSON_TYPE)(((json_t *)JsonValue)->type);
 }
+
+/**
+  JSON Library constructor.
+
+  @param ImageHandle The image handle.
+  @param SystemTable The system table.
+
+  @retval  EFI_SUCCESS  Protocol listener is registered successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+JsonLibConstructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  //
+  // hashtable_seed is initalized by current time while JsonLib is loaded.
+  // Due to above mechanism, hashtable_seed will be different in each 
individual
+  // UEFI driver. As the result, the hash of same key in different UEFI driver
+  // would be different. This breaks JsonObjectGetValue() because
+  // JsonObjectGetValue() won't be able to find corresponding JSON value if
+  // this EDKII_JSON_VALUE is created by another UEFI driver.
+  //
+  // Initial the seed to a fixed magic value for JsonLib to be working in all
+  // UEFI drivers.
+  //
+  hashtable_seed = 0xFDAE2143;
+
+  return EFI_SUCCESS;
+}
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108781): https://edk2.groups.io/g/devel/message/108781
Mute This Topic: https://groups.io/mt/101432663/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 1/1] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.

2023-09-12 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

Regards,
Igor

-Original Message-
From: Nickle Wang 
Sent: Tuesday, September 12, 2023 3:02 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v2 1/1] RedfishPkg/RedfishPlatformConfigDxe: fix can 
not set one-of option issue.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

StatementValue->Buffer is converted from ASCII to Unicode by caller
already so we don't have to convert it again.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishPlatformConfigDxe.c| 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index f2a8e77d9b00..30d2ef351eca 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1660,12 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
 // in string format from HII point of view. Do a patch here.
 //
 if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) && 
(StatementValue->Type == EFI_IFR_TYPE_STRING)) {
-  TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
-  if (TempBuffer == NULL) {
-return EFI_OUT_OF_RESOURCES;
-  }
-
-  FreePool (StatementValue->Buffer);
+  //
+  // Keep input buffer to TempBuffer because StatementValue will be
+  // assigned in HiiStringToOneOfOptionValue().
+  //
+  TempBuffer= (EFI_STRING)StatementValue->Buffer;
   StatementValue->Buffer= NULL;
   StatementValue->BufferLen = 0;

--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108551): https://edk2.groups.io/g/devel/message/108551
Mute This Topic: https://groups.io/mt/101310452/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 6/6] RedfishClientPkg: spelling fixes

2023-08-30 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 
Reviewed the whole patch V2
Regards,
Igor Kulchytskyy
-Original Message-
From: Mike Maslenkin 
Sent: Tuesday, August 29, 2023 4:01 AM
To: devel@edk2.groups.io
Cc: abner.ch...@amd.com; nick...@nvidia.com; Igor Kulchytskyy ; 
Mike Maslenkin 
Subject: [EXTERNAL] [PATCH v2 6/6] RedfishClientPkg: spelling fixes


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Signed-off-by: Mike Maslenkin 
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c   | 4 ++--
 .../ComputerSystemCollectionDxe.c   | 6 +++---
 .../Features/MemoryCollectionDxe/MemoryCollectionDxe.c  | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index a1738de46fdf..a969557ddfdb 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -831,7 +831,7 @@ HandleResource (
   DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri));

   Status = EdkIIRedfishResourceConfigConsume (, Uri);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %s: %r\n", 
__func__, Uri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to consume resource for: %s: %r\n", 
__func__, Uri, Status));

   }



   //

@@ -840,7 +840,7 @@ HandleResource (
   DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri));

   Status = EdkIIRedfishResourceConfigUpdate (, Uri);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to update resoruce for: %s: %r\n", 
__func__, Uri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to update resource for: %s: %r\n", 
__func__, Uri, Status));

   }



   return Status;

diff --git 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
index 8f2054e1e161..1e362d49cbb6 100644
--- 
a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
+++ 
b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
@@ -109,7 +109,7 @@ HandleResource (
   DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri));

   Status = EdkIIRedfishResourceConfigConsume (, Uri);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %s: %r\n", 
__func__, Uri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to consume resource for: %s: %r\n", 
__func__, Uri, Status));

   }



   //

@@ -118,7 +118,7 @@ HandleResource (
   DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri));

   Status = EdkIIRedfishResourceConfigUpdate (, Uri);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to update resoruce for: %s: %r\n", 
__func__, Uri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to update resource for: %s: %r\n", 
__func__, Uri, Status));

   }



   return Status;

@@ -228,7 +228,7 @@ CreateCollectionResource (


   Status = EdkIIRedfishResourceConfigProvisionging (, 
Private->CollectionUri, Private->InformationExchange, TRUE);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to create resoruce for: %s: %r\n", 
__func__, Private->CollectionUri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to create resource for: %s: %r\n", 
__func__, Private->CollectionUri, Status));

   }



   return Status;

diff --git 
a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c 
b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
index b94ff2e86572..1b755cde0130 100644
--- a/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
+++ b/RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.c
@@ -109,7 +109,7 @@ HandleResource (
   DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri));

   Status = EdkIIRedfishResourceConfigConsume (, Uri);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %s: %r\n", 
__func__, Uri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to consume resource for: %s: %r\n", 
__func__, Uri, Status));

   }



   //

@@ -118,7 +118,7 @@ HandleResource (
   DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri));

   Status = EdkIIRedfishResourceConfigUpdate (, Uri);

   if (EFI_ERROR (Status)) {

-DEBUG ((DEBUG_ERROR, "%a, failed to update resoruce for: %s: %r\n", 
__func__, Uri, Status));

+DEBUG ((DEBUG_ERROR, "%a, failed to update resource for: %s: %r\n", 
__func__, Uri, Status));

   }



   return Status;

@@ -228,7 +228,7 @@ CreateCollectionResource (


   Status = EdkIIRedfishResourceConfigProvisionging (, 
Private->CollectionUri, Private->InformationExchange, TRUE);

   if (EFI_ERROR 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.

2023-08-03 Thread Igor Kulchytskyy via groups.io
Thank you, Nickle.

-Original Message-
From: Nickle Wang 
Sent: Thursday, August 03, 2023 2:00 AM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Abner Chang ; Nick Ramirez 
Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can 
not set one-of option issue.

Hi Igor,

Thanks for your review. I think this is feasible. Let me try it and provide 
version 2 patch.

Thanks,
Nickle

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Monday, July 24, 2023 9:49 AM
> To: Nickle Wang ; devel@edk2.groups.io
> Cc: Abner Chang ; Nick Ramirez
> 
> Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can
> not set one-of option issue.
>
> External email: Use caution opening links or attachments
>
>
> Hi Nickle,
> May I ask you a question. What is the point to allocate and copy buffer. Then
> delete the original buffer.
> Could we just assign StatementValue->Buffer to TempBuffer and then assign
> NULL to StatementValue->Buffer?
>
> TempBuffer = StatementValue->Buffer;
> StatementValue->Buffer = NULL;
>
> Result would be the same, but we do not need to allocate and free memory.
> Or I do not understand something?
> Thank you,
> Igor
>
> -Original Message-
> From: Nickle Wang 
> Sent: Saturday, July 22, 2023 4:18 AM
> To: devel@edk2.groups.io
> Cc: Abner Chang ; Igor Kulchytskyy ;
> Nick Ramirez 
> Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not
> set one-of option issue.
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> StatementValue->Buffer is converted from ASCII to Unicode by caller
> already so we don't have to convert it again.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> index f2a8e77d9b00..648f3d2de7aa 100644
> --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> @@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
>  // in string format from HII point of view. Do a patch here.
>  //
>  if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) &&
> (StatementValue->Type == EFI_IFR_TYPE_STRING)) {
> -  TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
> +  //
> +  // Make a copy of input buffer to TempBuffer because StatementValue 
> will be
> +  // assigned in HiiStringToOneOfOptionValue().
> +  //
> +  TempBuffer = AllocateCopyPool (StrSize ((EFI_STRING)StatementValue-
> >Buffer), StatementValue->Buffer);
>if (TempBuffer == NULL) {
>  return EFI_OUT_OF_RESOURCES;
>}
> --
> 2.17.1
>
> -The information contained in this message may be confidential and proprietary
> to American Megatrends (AMI). This communication is intended to be read only 
> by
> the individual or entity to whom it is addressed or by their designee. If the 
> reader
> of this message is not the intended recipient, you are on notice that any
> distribution of this message, in any form, is strictly prohibited. Please 
> promptly
> notify the sender by reply e-mail or by telephone at 770-246-8600, and then
> delete or destroy all copies of the transmission.
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/RedfishDiscoverDxe: fix netmask check issue

2023-07-24 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy  

-Original Message-
From: Nickle Wang 
Sent: Monday, July 24, 2023 8:15 PM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishDiscoverDxe: fix netmask check 
issue


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

- Add NTOHL() for coverting IP address from EFI_IPv4_ADDRESS to
IP4_ADDR so that IP4_IS_VALID_NETMASK() return correct value.
- Add DumpIpv4Address() in RedfishDebugLib and print IP address
when invalid IP or subnet mask address is detected.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.inf |  2 ++
 RedfishPkg/Include/Library/RedfishDebugLib.h  | 17 
 .../RedfishDiscoverInternal.h |  1 +
 .../Library/RedfishDebugLib/RedfishDebugLib.c | 26 +++
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 11 +---
 5 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
index 345bacf44d20..950098bf6a0d 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.inf
@@ -2,6 +2,7 @@
 #  Implementation of EFI_REDFISH_DISCOVER_PROTOCOL interfaces.
 #
 #  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -34,6 +35,7 @@
   DebugLib
   MemoryAllocationLib
   PrintLib
+  RedfishDebugLib
   RestExLib
   UefiLib
   UefiBootServicesTableLib
diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h 
b/RedfishPkg/Include/Library/RedfishDebugLib.h
index da7e0d0bc9fc..5f75bad12a7f 100644
--- a/RedfishPkg/Include/Library/RedfishDebugLib.h
+++ b/RedfishPkg/Include/Library/RedfishDebugLib.h
@@ -121,4 +121,21 @@ DumpHttpStatusCode (
   IN EFI_HTTP_STATUS_CODE  HttpStatusCode
   );

+/**
+
+  This function dump the IPv4 address in given error level.
+
+  @param[in]  ErrorLevel  DEBUG macro error level
+  @param[in]  Ipv4Address IPv4 address to dump
+
+  @retval EFI_SUCCESS IPv4 address string is printed.
+  @retval Others  Errors occur.
+
+**/
+EFI_STATUS
+DumpIpv4Address (
+  IN UINTN ErrorLevel,
+  IN EFI_IPv4_ADDRESS  *Ipv4Address
+  );
+
 #endif
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
index d24c4081d9c0..01454acc1d9d 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c 
b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
index 0b2a9a5c4ec8..efa9a5ca1319 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
@@ -340,3 +340,29 @@ DumpRedfishResponse (

   return EFI_SUCCESS;
 }
+
+/**
+
+  This function dump the IPv4 address in given error level.
+
+  @param[in]  ErrorLevel  DEBUG macro error level
+  @param[in]  Ipv4Address IPv4 address to dump
+
+  @retval EFI_SUCCESS IPv4 address string is printed.
+  @retval Others  Errors occur.
+
+**/
+EFI_STATUS
+DumpIpv4Address (
+  IN UINTN ErrorLevel,
+  IN EFI_IPv4_ADDRESS  *Ipv4Address
+  )
+{
+  if (Ipv4Address == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  DEBUG ((ErrorLevel, "%d.%d.%d.%d\n", Ipv4Address->Addr[0], 
Ipv4Address->Addr[1], Ipv4Address->Addr[2], Ipv4Address->Addr[3]));
+
+  return EFI_SUCCESS;
+}
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 470b4c9e0060..17c88ad82db4 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -531,15 +531,17 @@ DiscoverRedfishHostInterface (
   IP4_COPY_ADDRESS ((VOID *)>HostSubnetMask.v4, (VOID 
*)Data->HostIpMask);

   if (EFI_IP4_EQUAL (>HostIpAddress.v4, )) {
-DEBUG ((DEBUG_ERROR, "%a: invalid host IP address: zero address\n", 
__func__));
+DEBUG ((DEBUG_ERROR, "%a: invalid host IP address: ", __func__));
+DumpIpv4Address (DEBUG_ERROR, >HostIpAddress.v4);
 //
 // Invalid IP address detected. Change address format to Unknown and 
use system default address.
 //
 Instance->HostAddrFormat = 
REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
   }

-  if (!IP4_IS_VALID_NETMASK (EFI_IP4 (Instance->HostSubnetMask.v4))) {
-DEBUG ((DEBUG_ERROR, "%a: invalid subnet mask 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishRestExDxe: return HTTP status code to caller.

2023-07-23 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy  

-Original Message-
From: Nickle Wang 
Sent: Saturday, July 22, 2023 4:18 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishRestExDxe: return HTTP status 
code to caller.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Return unsupported HTTP status code to caller so caller can handle
HTTP error status code. Current implementation only return EFI error
to caller. Without knowing the HTTP status code, caller has trouble
to handle HTTP request failure.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishRestExDxe/RedfishRestExProtocol.c| 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c 
b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c
index 90973619f2bc..f11cee8542fb 100644
--- a/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c
+++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExProtocol.c
@@ -320,6 +320,18 @@ ReSendRequest:;
 DEBUG ((DEBUG_ERROR, "This HTTP Status is not handled!\n"));
 DumpHttpStatusCode (DEBUG_REDFISH_NETWORK, 
ResponseData->Response.StatusCode);
 Status = EFI_UNSUPPORTED;
+
+//
+// Deliver status code back to caller so caller can handle it.
+//
+ResponseMessage->Data.Response = AllocateZeroPool (sizeof 
(EFI_HTTP_RESPONSE_DATA));
+if (ResponseMessage->Data.Response == NULL) {
+  Status = EFI_OUT_OF_RESOURCES;
+  goto ON_EXIT;
+}
+
+ResponseMessage->Data.Response->StatusCode = 
ResponseData->Response.StatusCode;
+
 goto ON_EXIT;
   }

@@ -444,11 +456,6 @@ ON_EXIT:
   }

   if (EFI_ERROR (Status)) {
-if (ResponseMessage->Data.Response != NULL) {
-  FreePool (ResponseMessage->Data.Response);
-  ResponseMessage->Data.Response = NULL;
-}
-
 if (ResponseMessage->Body != NULL) {
   FreePool (ResponseMessage->Body);
   ResponseMessage->Body = NULL;
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.

2023-07-23 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
May I ask you a question. What is the point to allocate and copy buffer. Then 
delete the original buffer.
Could we just assign StatementValue->Buffer to TempBuffer and then assign NULL 
to StatementValue->Buffer?

TempBuffer = StatementValue->Buffer;
StatementValue->Buffer = NULL;

Result would be the same, but we do not need to allocate and free memory.
Or I do not understand something?
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Saturday, July 22, 2023 4:18 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not 
set one-of option issue.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

StatementValue->Buffer is converted from ASCII to Unicode by caller
already so we don't have to convert it again.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index f2a8e77d9b00..648f3d2de7aa 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
 // in string format from HII point of view. Do a patch here.
 //
 if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) && 
(StatementValue->Type == EFI_IFR_TYPE_STRING)) {
-  TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
+  //
+  // Make a copy of input buffer to TempBuffer because StatementValue will 
be
+  // assigned in HiiStringToOneOfOptionValue().
+  //
+  TempBuffer = AllocateCopyPool (StrSize 
((EFI_STRING)StatementValue->Buffer), StatementValue->Buffer);
   if (TempBuffer == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/RedfishCrtLib: multiple definitions of strncpy.

2023-07-23 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy  

-Original Message-
From: Nickle Wang 
Sent: Saturday, July 22, 2023 4:18 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishCrtLib: multiple definitions of 
strncpy.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

There are two definitions for strncpy() function in RedfishCrtLib.h

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/Include/Library/RedfishCrtLib.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/Include/Library/RedfishCrtLib.h 
b/RedfishPkg/Include/Library/RedfishCrtLib.h
index 23c6acfca33e..a2c17d1b03fc 100644
--- a/RedfishPkg/Include/Library/RedfishCrtLib.h
+++ b/RedfishPkg/Include/Library/RedfishCrtLib.h
@@ -3,6 +3,7 @@

   Copyright (c) 2019, Intel Corporation. All rights reserved.
   (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

 SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -304,8 +305,7 @@ char   *
 strncpy(
   char *,
   size_t,
-  const char *,
-  size_t
+  const char *
   );

 int
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107149): https://edk2.groups.io/g/devel/message/107149
Mute This Topic: https://groups.io/mt/100292360/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] RedfishClientPkg/.github: add patch check

2023-06-12 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Monday, June 12, 2023 11:15 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add 
patch check


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

- Run /BaseTools/Scripts/PatchCheck.py to check changes
on pull request.
- Create main.yml to handle push check on main branch.
And show the status of RedfishClientPkg on README.md

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 .github/workflows/build.yml   |  3 --
 .github/workflows/main.yml| 58 +++
 .github/workflows/patch-check.sh  | 47 +
 .github/workflows/patch-check.yml | 39 +
 README.md |  3 ++
 5 files changed, 147 insertions(+), 3 deletions(-)
 create mode 100644 .github/workflows/main.yml
 create mode 100755 .github/workflows/patch-check.sh
 create mode 100644 .github/workflows/patch-check.yml

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f44184b3..e5a61992 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,9 +7,6 @@
 ##
 name: "RedfishClientPkg Build"
 on:
-  push:
-branches:
-  - main
   pull_request:
 branches:
   - main
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index ..4bfd5e8f
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,58 @@
+# @file
+# GitHub Workflow for build checks
+#
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+name: "RedfishClientPkg Build"
+on:
+  push:
+branches:
+  - main
+paths-ignore:
+  - '**/*.bat'
+  - '**/*.md'
+  - '**/*.py'
+  - '**/*.rst'
+  - '**/*.sh'
+  - '**/*.txt'
+
+jobs:
+  edk2-redfish-client-build:
+strategy:
+  fail-fast: false
+  matrix:
+include:
+  - Target: "DEBUG"
+ArchList: "X64"
+ToolChain: "GCC5"
+  - Target: "RELEASE"
+ArchList: "X64"
+ToolChain: "GCC5"
+  - Target: "NOOPT"
+ArchList: "X64"
+ToolChain: "GCC5"
+runs-on: ubuntu-latest
+container:
+  image: ghcr.io/tianocore/containers/ubuntu-22-dev:latest
+  options: --user root -v ${{ github.workspace }}:/home/edk2
+  env:
+EDK2_DOCKER_USER_HOME: "/home/edk2"
+name: edk2 build test
+steps:
+  - name: checkout edk2
+uses: actions/checkout@v3
+with:
+  repository: tianocore/edk2
+  path: ./edk2
+  submodules: recursive
+  - name: checkout edk2-redfish-client
+uses: actions/checkout@v3
+with:
+  path: ./edk2-redfish-client
+  - name: edk2 build
+run: |
+  ./edk2-redfish-client/.github/workflows/build.sh ./edk2 
./edk2-redfish-client ${{ matrix.ArchList }} ${{ matrix.Target }} ${{ 
matrix.ToolChain }}
+shell: bash
+
diff --git a/.github/workflows/patch-check.sh b/.github/workflows/patch-check.sh
new file mode 100755
index ..8cc63bd5
--- /dev/null
+++ b/.github/workflows/patch-check.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+
+if [ $# -ne 2 ]
+then
+echo "usage: $0 [PATH to PATCH-SET] [PATH to EDK2 REPO.]"
+exit 1
+fi
+
+PATCH_FOLDER="$PWD/$1"
+REPO_PATH="$PWD/$2"
+FAILURE=0
+
+if [ ! -e "$PATCH_FOLDER" ]
+then
+echo "$PATCH_FOLDER does not exist"
+exit 1
+fi
+
+if [ ! -e "$REPO_PATH" ]
+then
+echo "$REPO_PATH does not exist"
+exit 1
+fi
+
+for file in `ls $PATCH_FOLDER/*.patch`
+do
+  echo "Check patch: $file"
+  python3 $REPO_PATH/BaseTools/Scripts/PatchCheck.py $file
+  if [ $? -ne 0 ]
+  then
+echo "Patch check failure on file: $file"
+FAILURE=1
+  fi
+done
+
+if [ $FAILURE -eq 0 ]
+then
+  exit 0
+fi
+
+exit 1
diff --git a/.github/workflows/patch-check.yml 
b/.github/workflows/patch-check.yml
new file mode 100644
index ..2fdef679
--- /dev/null
+++ b/.github/workflows/patch-check.yml
@@ -0,0 +1,39 @@
+# @file
+# GitHub Workflow for patch check
+#
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+name: "Patch check"
+on:
+  pull_request:
+branches:
+  - main
+
+jobs:
+  patch-check:
+runs-on: ubuntu-latest
+name: EDK2 Patch check
+steps:
+  - name: checkout edk2
+uses: actions/checkout@v3
+with:
+  repository: tianocore/edk2
+  path: ./edk2
+  - name: checkout edk2-redfish-client
+

Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build check and uncrustify check

2023-06-07 Thread Igor Kulchytskyy via groups.io
Thank you, Nickle

Get Outlook for Android

From: Chang, Abner 
Sent: Wednesday, June 7, 2023 8:28:11 PM
To: Nickle Wang ; devel@edk2.groups.io 

Cc: Igor Kulchytskyy 
Subject: [EXTERNAL] RE: [edk2-redfish-client][PATCH] RedfishClientPkg/.github: 
add build check and uncrustify check


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Nice work Nickle!!

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, June 8, 2023 12:12 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg/.github: add build
> check and uncrustify check
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Enable Github Actions to check below items:
> - RedfishClientPkg build check on push and pull request
> - Uncrustify check on pull request
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  .github/.github/workflows/build.sh| 70 +++
>  .github/.github/workflows/build.yml   | 61 
>  .github/.github/workflows/uncrustify-check.sh | 51 ++
>  .github/.github/workflows/uncrustify.yml  | 44 
>  4 files changed, 226 insertions(+)
>  create mode 100755 .github/.github/workflows/build.sh
>  create mode 100644 .github/.github/workflows/build.yml
>  create mode 100755 .github/.github/workflows/uncrustify-check.sh
>  create mode 100644 .github/.github/workflows/uncrustify.yml
>
> diff --git a/.github/.github/workflows/build.sh
> b/.github/.github/workflows/build.sh
> new file mode 100755
> index ..f919d551
> --- /dev/null
> +++ b/.github/.github/workflows/build.sh
> @@ -0,0 +1,70 @@
> +#!/bin/bash
> +#
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +
> +ARCH="X64"
> +TARGET="DEBUG"
> +TOOLCHAIN="GCC5"
> +
> +if [ $# -eq 0 ]
> +then
> +echo "usage: $0 [path to edk2] [path to edk2-redfish-client] [ARCH]
> [TARGET] [TOOLCHAIN]"
> +exit 1
> +fi
> +
> +EDK2_ROOT="$PWD/$1"
> +EDK2_REDFISH_CLIENT="$PWD/$2"
> +ARCH="$3"
> +TARGET="$4"
> +TOOLCHAIN="$5"
> +
> +if [ ! -e "$EDK2_ROOT" ]
> +then
> +echo "$EDK2_ROOT does not exist"
> +exit 1
> +fi
> +
> +if [ ! -e "$EDK2_REDFISH_CLIENT" ]
> +then
> +echo "$EDK2_REDFISH_CLIENT does not exist"
> +exit 1
> +fi
> +
> +export PACKAGES_PATH="$EDK2_ROOT:$EDK2_REDFISH_CLIENT"
> +echo "PACKAGES_PATH: $PACKAGES_PATH"
> +echo "ARCH: $ARCH"
> +echo "TARGET: $TARGET"
> +echo "TOOLCHAIN: $TOOLCHAIN"
> +
> +cd "$EDK2_ROOT"
> +. edksetup.sh BaseTools
> +
> +if [ ! -e "BaseTools/Source/C/bin" ]
> +then
> +  echo "binary does not exist, rebuild it"
> +
> +  cd BaseTools
> +  make
> +  cd ..
> +
> +  echo "If there is build error related to nasm, try to use latest nasm from:
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.nasm.us%2Fpub%2Fnasm%2Freleasebuilds%2F=05%7C01%7Cigork%40ami.com%7Cfe7c0814e24544d5839a08db67b73fa7%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638217808989823384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=51RRpRuxeci9god2Hs5e%2Fa4S7GdeejhRpofp%2FSpjPS4%3D=0;
> +  echo ""
> +  echo "1) wget
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.nasm.us%2Fpub%2Fnasm%2Freleasebuilds%2F2.15rc12%2Fnasm-=05%7C01%7Cigork%40ami.com%7Cfe7c0814e24544d5839a08db67b73fa7%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638217808989823384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=0X%2B8JSzM7hjzAvLuE6AG1nf6dLKL4SHknyd%2Bv306N%2BA%3D=0
> 2.15rc12.tar.gz"
> +  echo "2) tar zxvf nasm-2.15rc12.tar.gz"
> +  echo "3) cd nasm-2.15rc12"
> +  echo "4) ./configure --prefix=/usr"
> +  echo "5) sudo make install"
> +  echo "6) nasm -v"
> +fi
> +
> +build -p RedfishClientPkg/RedfishClientPkg.dsc -a $ARCH -t $TOOLCHAIN -b
> $TARGET
> +if [ $? -ne 0 ]
> +then
> +  exit 1
> +fi
> +
> +exit 0
> diff --git a/.github/.github/workflows/build.yml
> b/.github/.github/workflows/build.yml
> new file mode 100644
> index ..f44184b3
> --- /dev/null
> +++ b/.github/.github/workflows/build.yml
> @@ -0,0 +1,61 @@
> +# @file
> +# GitHub Workflow for build checks
> +#
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +name: "RedfishClientPkg Build"
> +on:
> +  push:
> +branches:
> +  - main
> +  pull_request:
> +branches:
> +  - main
> +  

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.

2023-05-30 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Monday, May 29, 2023 2:24 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type 
issue.


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Fix incorrect value type issue for checked-box op-code.
When the variable for checked-box is defined as UINT8 in
varstore structure, IFR compiler assign its value type to
EFI_IFR_TYPE_NUM_SIZE_8 instead of EFI_IFR_TYPE_BOOLEAN.
However, the value type for checked-box is boolean value.
Redfish service may return error because of incorrect value
type passed to BIOS attribute registry.

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

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index 1172d1094b06..462f269f6a3f 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1221,6 +1221,16 @@ HiiValueToRedfishValue (
   RedfishValue->Type = RedfishValueTypeString;
   break;
 case EFI_IFR_CHECKBOX_OP:
+  //
+  // There is case where HII driver defines UINT8 for checked-box opcode 
storage.
+  // IFR compiler will assign EFI_IFR_TYPE_NUM_SIZE_8 to its value type 
instead of
+  // EFI_IFR_TYPE_BOOLEAN. We do a patch here and use boolean value type 
for this
+  // case.
+  //
+  if (Value->Type != EFI_IFR_TYPE_BOOLEAN) {
+Value->Type = EFI_IFR_TYPE_BOOLEAN;
+  }
+
 case EFI_IFR_NUMERIC_OP:
   Status = HiiValueToRedfishNumeric (Value, RedfishValue);
   if (EFI_ERROR (Status)) {
--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: Fix string assert issue

2023-05-15 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Monday, May 15, 2023 12:25 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: Fix string 
assert issue


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

When calling SetValue() with string type input, there is
assertion of providing zero string ID to HII string function.
Fix this issue by creating string ID for input string buffer.
Fix Unicode and Ascii code convert issue together.
Add text op-code support

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 .../RedfishPlatformConfigDxe.h|  14 +++
 .../RedfishPlatformConfigImpl.h   |  16 +++
 .../RedfishPlatformConfigDxe.c| 116 --
 .../RedfishPlatformConfigImpl.c   |  50 +---
 4 files changed, 169 insertions(+), 27 deletions(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
index 67697ecda787..c86bc6e9ce2d 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
@@ -78,4 +78,18 @@ typedef struct {
 #define REDFISH_PLATFORM_CONFIG_DEBUGDEBUG_VERBOSE
 #define REDFISH_MENU_PATH_SIZE   8

+/**
+  Convert input unicode string to ascii string. It's caller's
+  responsibility to free returned buffer using FreePool().
+
+  @param[in]  UnicodeString Unicode string to be converted.
+
+  @retval CHAR8 *   Ascii string on return.
+
+**/
+CHAR8 *
+StrToAsciiStr (
+  IN  EFI_STRING  UnicodeString
+  );
+
 #endif
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
index 9ef032748663..9f4312decf50 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
@@ -250,6 +250,22 @@ ProcessPendingList (
   IN  LIST_ENTRY  *PendingList
   );

+/**
+  Delete a string from HII Package List by given HiiHandle.
+
+  @param[in]  StringId   Id of the string in HII database.
+  @param[in]  HiiHandle  The HII package list handle.
+
+  @retval EFI_SUCCESSThe string was deleted successfully.
+  @retval EFI_INVALID_PARAMETER  StringId is zero.
+
+**/
+EFI_STATUS
+HiiDeleteString (
+  IN  EFI_STRING_ID   StringId,
+  IN  EFI_HII_HANDLE  HiiHandle
+  );
+
 /**
   Retrieves a unicode string from a string package in a given language. The
   returned string is allocated using AllocatePool().  The caller is responsible
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c 
b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index d3902f4127c1..1172d1094b06 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1172,6 +1172,7 @@ HiiValueToRedfishValue (
   UINTN  Index;
   UINTN  Count;
   EFI_STRING_ID  *StringIdArray;
+  CHAR8  NullChar;

   if ((HiiHandle == NULL) || (HiiStatement == NULL) || (Value == NULL) || 
(RedfishValue == NULL) || IS_EMPTY_STRING (FullSchema)) {
 return EFI_INVALID_PARAMETER;
@@ -1180,6 +1181,7 @@ HiiValueToRedfishValue (
   StringIdArray = NULL;
   Count = 0;
   Status= EFI_SUCCESS;
+  NullChar  = '\0';

   switch (HiiStatement->Operand) {
 case EFI_IFR_ONE_OF_OP:
@@ -1205,9 +1207,18 @@ HiiValueToRedfishValue (
 break;
   }

-  RedfishValue->Type = RedfishValueTypeString;
-  RedfishValue->Value.Buffer = AllocatePool (StrLen ((CHAR16 
*)Value->Buffer) + 1);
-  UnicodeStrToAsciiStrS ((CHAR16 *)Value->Buffer, 
RedfishValue->Value.Buffer, StrLen ((CHAR16 *)Value->Buffer) + 1);
+  if (Value->Buffer == NULL) {
+RedfishValue->Value.Buffer = AllocateCopyPool (sizeof (NullChar), 
);
+  } else {
+RedfishValue->Value.Buffer = StrToAsciiStr ((EFI_STRING)Value->Buffer);
+  }
+
+  if (RedfishValue->Value.Buffer == NULL) {
+Status = EFI_OUT_OF_RESOURCES;
+break;
+  }
+
+  RedfishValue->Type = RedfishValueTypeString;
   break;
 case EFI_IFR_CHECKBOX_OP:
 case EFI_IFR_NUMERIC_OP:
@@ -1256,6 +1267,30 @@ HiiValueToRedfishValue (

   FreePool (StringIdArray);
   break;
+case EFI_IFR_TEXT_OP:
+  //
+  // Use text two as the value
+  //
+  if (HiiStatement->ExtraData.TextTwo == 0x00) {
+Status = EFI_NOT_FOUND;
+break;
+  }
+
+  RedfishValue->Value.Buffer = HiiGetRedfishAsciiString (HiiHandle, 
FullSchema, HiiStatement->ExtraData.TextTwo);
+  if (RedfishValue->Value.Buffer == NULL) {
+//

Re: [edk2-devel] [edk2-redfish-client][PATCH v2] Initial edk2 redfish client repository

2023-04-26 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
Sorry for the delay.

Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Friday, April 21, 2023 10:45 PM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; 
Michael D Kinney 
Subject: [EXTERNAL] [edk2-redfish-client][PATCH v2] Initial edk2 redfish client 
repository


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Add required files to initial edk2 redfish client repository.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Michael D Kinney 
---
 .gitignore  |  6 +
 CONTRIBUTING.md |  3 +++
 LICENSE | 51 ++
 Maintainers.txt | 48 +++
 README.md   | 66 +
 5 files changed, 174 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 CONTRIBUTING.md
 create mode 100644 LICENSE
 create mode 100644 Maintainers.txt
 create mode 100644 README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..df38443
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+.DS_Store
+*_extdep/
+*.pyc
+__pycache__/
+tags/
+.vscode/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 000..39a1732
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,3 @@
+# Contributing to EDK Redfish Client
+
+Contributor documentation is maintained on the wiki: 
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000..ee84050
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,51 @@
+Copyright (c) 2019, TianoCore and contributors.  All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+Subject to the terms and conditions of this license, each copyright holder
+and contributor hereby grants to those receiving rights under this license
+a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except for failure to satisfy the conditions of this license) patent
+license to make, have made, use, offer to sell, sell, import, and otherwise
+transfer this software, where such license applies only to those patent
+claims, already acquired or hereafter acquired, licensable by such copyright
+holder or contributor that are necessarily infringed by:
+
+(a) their Contribution(s) (the licensed copyrights of copyright holders and
+non-copyrightable additions of contributors, in source or binary form)
+alone; or
+
+(b) combination of their Contribution(s) with the work of authorship to
+which such Contribution(s) was added by such copyright holder or
+contributor, if, at the time the Contribution is added, such addition
+causes such combination to be necessarily infringed. The patent license
+shall not apply to any other combinations which include the
+Contribution.
+
+Except as expressly stated above, no rights or licenses from any copyright
+holder or contributor is granted under this license, whether expressly, by
+implication, estoppel or otherwise.
+
+DISCLAIMER
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/Maintainers.txt b/Maintainers.txt
new file mode 100644
index 000..88fd03a
--- /dev/null
+++ b/Maintainers.txt
@@ -0,0 +1,48 @@
+EDK Redfish Client Maintainers
+==
+
+This file provides information about the primary maintainers for
+EDK Redfish Client.
+
+In general, you should not privately email the maintainer. You should
+email the edk2-devel list, and Cc the package maintainers and
+reviewers.
+
+If the package maintainer wants to hand over the role to other people,
+the package maintainer should send the patch to update 

Re: [edk2-devel] [PATCH] RedfishPkg: Remove the global variables related to Discover Token functionality

2023-04-21 Thread Igor Kulchytskyy via groups.io
Hi Abner,
I created PR.
https://github.com/tianocore/edk2/pull/4297
Since it is my first PR created, I'm not sure if everything done correctly.
Please double check everything.
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Thursday, April 20, 2023 8:13 PM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Nickle Wang 
Subject: RE: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global variables 
related to Discover Token functionality

[AMD Official Use Only - General]

Thanks Igor,
You probably can ask community if any one has the similar issue on patch email 
format.

I already gave R-B to this change, please create a PR against to edk2 and let 
me know the PR#. I will push it once it passes CI.
Thanks
Abner

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Friday, April 21, 2023 2:46 AM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Nickle Wang 
> Subject: RE: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global
> variables related to Discover Token functionality
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Hi Abner,
> I did what you asked to do - Patchcheck.py and UncrustiyCheck (got binary).
> Going to send PATCH V2.
> But I'm not sure what happened with white space. Going to check with MIS.
> Thank you,
> Igor
>
> -Original Message-
> From: Chang, Abner 
> Sent: Wednesday, April 19, 2023 9:00 PM
> To: Igor Kulchytskyy ; devel@edk2.groups.io
> Cc: Nickle Wang 
> Subject: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global variables
> related to Discover Token functionality
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> [AMD Official Use Only - General]
>
> Hi Igor,
> I have no problem with this change, however some upstream practices here,
>
> - Please shorten the subject to <= 76
> - Each line in the commit message should be <=76 You can run Patchcheck.py
> (here: BaseTools\Scripts) before you sending out the patches.
>
> Please run UncrustiyCheck for each source code you modified, .
> pytool/Plugin/UncrustifyCheck/ and used for beautifying the source code.
> You can get the binary from here:
> https://sourceforge.net/projects/uncrustify/files.
>
> Please resend the patch with above issue fixed.
>
> BTW, the patch you sent to group.io still has a problem. The white space of
> each blank line in the patch file were gone (you can take a look at your
> message sent to group.io). This leads to a failure of patch apply. I recover
> those white space in the blank lines and the patch can be applied. However, I
> can do this just for a short patch.  Please figure it out at your end.  
> That's
> fine if this problem still exist on your resent patch in case you need some
> time to figure out the email problem.
>
> Thanks
> Abner
>
> > -Original Message-
> > From: Igor Kulchytskyy 
> > Sent: Wednesday, April 19, 2023 11:04 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; Nickle Wang
> > 
> > Subject: [PATCH] RedfishPkg: Remove the global variables related to
> > Discover Token functionality
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > gRedfishDiscoveredToken may be allocated several times, if multiple
> > NIC installed on the system.
> > To avoid this issue Discover Token related global variables replaced
> > with the local variables.
> >
> > Cc: Abner Chang 
> > Cc: Nickle Wang 
> > Signed-off-by: Igor Kulchytskyy 
> > ---
> >  RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 139
> > 
> >  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  87
> -
> > ---
> >  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
> >  3 files changed, 140 insertions(+), 114 deletions(-)
> >
> > diff --git
> > a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > index 993ad33..8f85491 100644
> > --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> > @@ -22,12 +22,6 @@ EFI_HANDLE
> > gEfiRedfishDiscoverControllerHandle = NULL;
> >  EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol=
> > NULL;
> >  BOOLEANgRedfishDiscoverActivated   = FALSE;
> >  BOOLEANgRedfishServiceDiscovered   = FALSE;
> > -//
> > -// Network interfaces discovered by EFI Redfish Discover Protocol.
> > -//
> > -UINTN   gNumberOfNetworkInterfaces;
> > -EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> > *gNetworkInterfaceInstances = NULL;
> > -EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken=
> > NULL;
> >
> >  ///
> >  /// 

[edk2-devel] [PATCH V2] RedfishPkg: Remove the Discover Token global variables

2023-04-20 Thread Igor Kulchytskyy via groups.io
gRedfishDiscoveredToken may be allocated several times,
if multiple NIC installed on the system.
To avoid this issue Discover Token related global variables
replaced with the local variables.

Cc: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 143 

 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  88 
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
 3 files changed, 140 insertions(+), 119 deletions(-)

diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c 
b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
index 993ad338b6..161731b211 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
@@ -22,12 +22,6 @@ EFI_HANDLE 
gEfiRedfishDiscoverControllerHandle = NULL;
 EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol= NULL;
 BOOLEANgRedfishDiscoverActivated   = FALSE;
 BOOLEANgRedfishServiceDiscovered   = FALSE;
-//
-// Network interfaces discovered by EFI Redfish Discover Protocol.
-//
-UINTN   gNumberOfNetworkInterfaces;
-EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  *gNetworkInterfaceInstances = NULL;
-EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken= NULL;

 ///
 /// Driver Binding Protocol instance
@@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
   gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
 }

-//
-// Stop Redfish service discovery.
-//
-gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
-   gEfiRedfishDiscoverProtocol,
-   gNetworkInterfaceInstances
-   );
 gEfiRedfishDiscoverControllerHandle = NULL;
 gEfiRedfishDiscoverProtocol = NULL;
 gRedfishDiscoverActivated   = FALSE;
@@ -318,36 +305,38 @@ RedfishServiceDiscoveredCallback (
   EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
   EFI_REDFISH_DISCOVERED_INSTANCE  *RedfishInstance;

-  if (gRedfishServiceDiscovered) {
-//
-// Only support one Redfish service on platform.
-//
-return;
-  }
-
   RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
-  RedfishInstance= 
RedfishDiscoveredToken->DiscoverList.RedfishInstances;
+  gBS->CloseEvent (RedfishDiscoveredToken->Event);
+
   //
-  // Only pick up the first found Redfish service.
+  // Only support one Redfish service on platform.
   //
-  if (RedfishInstance->Status == EFI_SUCCESS) {
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = 
RedfishInstance->Information.RedfishRestExHandle;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  = 
RedfishInstance->Information.RedfishVersion;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = 
RedfishInstance->Information.Location;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = 
RedfishInstance->Information.Uuid;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   = 
RedfishInstance->Information.Os;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion= 
RedfishInstance->Information.OsVersion;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  = 
RedfishInstance->Information.Product;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   = 
RedfishInstance->Information.ProductVer;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = 
RedfishInstance->Information.UseHttps;
-gRedfishServiceDiscovered= TRUE;
+  if (!gRedfishServiceDiscovered) {
+RedfishInstance = RedfishDiscoveredToken->DiscoverList.RedfishInstances;
+//
+// Only pick up the first found Redfish service.
+//
+if (RedfishInstance->Status == EFI_SUCCESS) {
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = 
RedfishInstance->Information.RedfishRestExHandle;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  = 
RedfishInstance->Information.RedfishVersion;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = 
RedfishInstance->Information.Location;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = 
RedfishInstance->Information.Uuid;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   = 
RedfishInstance->Information.Os;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion= 
RedfishInstance->Information.OsVersion;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  = 
RedfishInstance->Information.Product;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   = 

Re: [edk2-devel] [PATCH] RedfishPkg: Remove the global variables related to Discover Token functionality

2023-04-20 Thread Igor Kulchytskyy via groups.io
Hi Abner,
I did what you asked to do - Patchcheck.py and UncrustiyCheck (got binary).
Going to send PATCH V2.
But I'm not sure what happened with white space. Going to check with MIS.
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Wednesday, April 19, 2023 9:00 PM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Nickle Wang 
Subject: [EXTERNAL] RE: [PATCH] RedfishPkg: Remove the global variables related 
to Discover Token functionality


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Igor,
I have no problem with this change, however some upstream practices here,

- Please shorten the subject to <= 76
- Each line in the commit message should be <=76
You can run Patchcheck.py (here: BaseTools\Scripts) before you sending out the 
patches.

Please run UncrustiyCheck for each source code you modified, . 
pytool/Plugin/UncrustifyCheck/ and used for beautifying the source code.
You can get the binary from here: 
https://sourceforge.net/projects/uncrustify/files.

Please resend the patch with above issue fixed.

BTW, the patch you sent to group.io still has a problem. The white space of 
each blank line in the patch file were gone (you can take a look at your 
message sent to group.io). This leads to a failure of patch apply. I recover 
those white space in the blank lines and the patch can be applied. However, I 
can do this just for a short patch.  Please figure it out at your end.  That's 
fine if this problem still exist on your resent patch in case you need some 
time to figure out the email problem.

Thanks
Abner

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Wednesday, April 19, 2023 11:04 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Nickle Wang
> 
> Subject: [PATCH] RedfishPkg: Remove the global variables related to
> Discover Token functionality
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> gRedfishDiscoveredToken may be allocated several times, if multiple NIC
> installed on the system.
> To avoid this issue Discover Token related global variables replaced with the
> local variables.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 139
> 
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  87 -
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
>  3 files changed, 140 insertions(+), 114 deletions(-)
>
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> index 993ad33..8f85491 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> @@ -22,12 +22,6 @@ EFI_HANDLE
> gEfiRedfishDiscoverControllerHandle = NULL;
>  EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol=
> NULL;
>  BOOLEANgRedfishDiscoverActivated   = FALSE;
>  BOOLEANgRedfishServiceDiscovered   = FALSE;
> -//
> -// Network interfaces discovered by EFI Redfish Discover Protocol.
> -//
> -UINTN   gNumberOfNetworkInterfaces;
> -EFI_REDFISH_DISCOVER_NETWORK_INTERFACE
> *gNetworkInterfaceInstances = NULL;
> -EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken=
> NULL;
>
>  ///
>  /// Driver Binding Protocol instance
> @@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
>gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
>  }
>
> -//
> -// Stop Redfish service discovery.
> -//
> -gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
> -   gEfiRedfishDiscoverProtocol,
> -   gNetworkInterfaceInstances
> -   );
>  gEfiRedfishDiscoverControllerHandle = NULL;
>  gEfiRedfishDiscoverProtocol = NULL;
>  gRedfishDiscoverActivated   = FALSE;
> @@ -318,36 +305,39 @@ RedfishServiceDiscoveredCallback (
>EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
>EFI_REDFISH_DISCOVERED_INSTANCE  *RedfishInstance;
>
> -  if (gRedfishServiceDiscovered) {
> -//
> -// Only support one Redfish service on platform.
> -//
> -return;
> -  }
> -
>RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
> -  RedfishInstance= RedfishDiscoveredToken-
> >DiscoverList.RedfishInstances;
> +  gBS->CloseEvent (RedfishDiscoveredToken->Event);
> +
>//
> -  // Only pick up the first found Redfish service.
> +  // Only support one Redfish service on platform.
>//
> -  if (RedfishInstance->Status == EFI_SUCCESS) {
> -

Re: [edk2-devel] [PATCH v3 0/5] Introduce EDKII Redfish Platform Config Protocol

2023-04-19 Thread Igor Kulchytskyy via groups.io
Full PATCH reviewed
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Wednesday, April 19, 2023 5:09 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v3 0/5] Introduce EDKII Redfish Platform Config 
Protocol


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

Introduce EDKII Redfish Platform Config Protocol and corresponding
libraries. This protocol is the interface between UEFI platform
configuration and Redfish property. It could handle different firmware
implementation and the implementation here is to map EDK2 HII questions
to the properties defined in Redfish schema. So that user can configure
UEFI platform configuration through RESTful interface provided by BMC.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 

Nickle Wang (5):
  RedfishPkg: introduce EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL
  RedfishPkg: introduce HII utility helper library
  RedfishPkg: Implementation of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL
  RedfishPkg: Helper library of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL
  RedfishPkg: Add Redfish Platform Config Protocol to RedfishPkg

 RedfishPkg/RedfishPkg.dec |   12 +
 RedfishPkg/RedfishComponents.dsc.inc  |3 +
 RedfishPkg/RedfishLibs.dsc.inc|2 +
 RedfishPkg/RedfishPkg.dsc |4 +
 .../Library/HiiUtilityLib/HiiUtilityLib.inf   |   62 +
 .../RedfishPlatformConfigLib.inf  |   41 +
 .../RedfishPlatformConfigDxe.inf  |   55 +
 RedfishPkg/Include/Library/HiiUtilityLib.h| 1204 
 .../Library/RedfishPlatformConfigLib.h|  143 +
 .../Protocol/EdkIIRedfishPlatformConfig.h |  257 +
 .../Library/HiiUtilityLib/HiiExpression.h |  191 +
 .../Library/HiiUtilityLib/HiiInternal.h   |  376 ++
 .../RedfishPlatformConfigInternal.h   |   35 +
 .../RedfishPlatformConfigDxe.h|   81 +
 .../RedfishPlatformConfigImpl.h   |  334 +
 .../Library/HiiUtilityLib/HiiExpression.c | 1439 
 .../Library/HiiUtilityLib/HiiIfrParse.c   | 2715 
 .../HiiUtilityLib/HiiUtilityInternal.c| 5770 +
 .../Library/HiiUtilityLib/HiiUtilityLib.c |  810 +++
 .../RedfishPlatformConfigLib.c|  310 +
 .../RedfishPlatformConfigDxe.c| 2495 +++
 .../RedfishPlatformConfigImpl.c   | 1364 
 RedfishPkg/Redfish.fdf.inc|3 +
 23 files changed, 17706 insertions(+)
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.inf
 create mode 100644 
RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.inf
 create mode 100644 RedfishPkg/Include/Library/HiiUtilityLib.h
 create mode 100644 RedfishPkg/Include/Library/RedfishPlatformConfigLib.h
 create mode 100644 RedfishPkg/Include/Protocol/EdkIIRedfishPlatformConfig.h
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiExpression.h
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiInternal.h
 create mode 100644 
RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInternal.h
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiExpression.c
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiIfrParse.c
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c
 create mode 100644 RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.c
 create mode 100644 
RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
 create mode 100644 
RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c

--
2.17.1

-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH] RedfishPkg: Remove the global variables related to Discover Token functionality

2023-04-19 Thread Igor Kulchytskyy via groups.io
gRedfishDiscoveredToken may be allocated several times,
if multiple NIC installed on the system.
To avoid this issue Discover Token related global variables
replaced with the local variables.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 139 

 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |  87 
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h  |  28 +++-
 3 files changed, 140 insertions(+), 114 deletions(-)

diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c 
b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
index 993ad33..8f85491 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
@@ -22,12 +22,6 @@ EFI_HANDLE 
gEfiRedfishDiscoverControllerHandle = NULL;
 EFI_REDFISH_DISCOVER_PROTOCOL  *gEfiRedfishDiscoverProtocol= NULL;
 BOOLEANgRedfishDiscoverActivated   = FALSE;
 BOOLEANgRedfishServiceDiscovered   = FALSE;
-//
-// Network interfaces discovered by EFI Redfish Discover Protocol.
-//
-UINTN   gNumberOfNetworkInterfaces;
-EFI_REDFISH_DISCOVER_NETWORK_INTERFACE  *gNetworkInterfaceInstances = NULL;
-EFI_REDFISH_DISCOVERED_TOKEN*gRedfishDiscoveredToken= NULL;

 ///
 /// Driver Binding Protocol instance
@@ -58,13 +52,6 @@ RedfishConfigStopRedfishDiscovery (
   gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
 }

-//
-// Stop Redfish service discovery.
-//
-gEfiRedfishDiscoverProtocol->AbortAcquireRedfishService (
-   gEfiRedfishDiscoverProtocol,
-   gNetworkInterfaceInstances
-   );
 gEfiRedfishDiscoverControllerHandle = NULL;
 gEfiRedfishDiscoverProtocol = NULL;
 gRedfishDiscoverActivated   = FALSE;
@@ -318,36 +305,39 @@ RedfishServiceDiscoveredCallback (
   EFI_REDFISH_DISCOVERED_TOKEN *RedfishDiscoveredToken;
   EFI_REDFISH_DISCOVERED_INSTANCE  *RedfishInstance;

-  if (gRedfishServiceDiscovered) {
-//
-// Only support one Redfish service on platform.
-//
-return;
-  }
-
   RedfishDiscoveredToken = (EFI_REDFISH_DISCOVERED_TOKEN *)Context;
-  RedfishInstance= 
RedfishDiscoveredToken->DiscoverList.RedfishInstances;
+  gBS->CloseEvent (RedfishDiscoveredToken->Event);
+
   //
-  // Only pick up the first found Redfish service.
+  // Only support one Redfish service on platform.
   //
-  if (RedfishInstance->Status == EFI_SUCCESS) {
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = 
RedfishInstance->Information.RedfishRestExHandle;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  = 
RedfishInstance->Information.RedfishVersion;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = 
RedfishInstance->Information.Location;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = 
RedfishInstance->Information.Uuid;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   = 
RedfishInstance->Information.Os;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion= 
RedfishInstance->Information.OsVersion;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  = 
RedfishInstance->Information.Product;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   = 
RedfishInstance->Information.ProductVer;
-gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = 
RedfishInstance->Information.UseHttps;
-gRedfishServiceDiscovered= TRUE;
+  if (!gRedfishServiceDiscovered) {
+RedfishInstance= 
RedfishDiscoveredToken->DiscoverList.RedfishInstances;
+//
+// Only pick up the first found Redfish service.
+//
+if (RedfishInstance->Status == EFI_SUCCESS) {
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceRestExHandle = 
RedfishInstance->Information.RedfishRestExHandle;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceVersion  = 
RedfishInstance->Information.RedfishVersion;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceLocation = 
RedfishInstance->Information.Location;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid = 
RedfishInstance->Information.Uuid;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceOs   = 
RedfishInstance->Information.Os;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceOsVersion= 
RedfishInstance->Information.OsVersion;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceProduct  = 
RedfishInstance->Information.Product;
+  gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer   = 

Re: [edk2-devel] [PATCH v4] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI implementation

2023-03-29 Thread Igor Kulchytskyy via groups.io
Reviewed-by: Igor Kulchytskyy 

-Original Message-
From: Nickle Wang 
Sent: Wednesday, March 29, 2023 1:33 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v4] RedfishPkg/RedfishPlatformCredentialIpmiLib: 
IPMI implementation


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

This library follows Redfish Host Interface specification and use IPMI
command to get bootstrap account credential(NetFn 2Ch, Command 02h)
from BMC. RedfishHostInterfaceDxe will use this credential for the
following communication between BIOS and BMC.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/RedfishPkg.dec |   7 +
 RedfishPkg/RedfishLibs.dsc.inc|   1 +
 RedfishPkg/RedfishPkg.dsc |   2 +
 .../RedfishPlatformCredentialIpmiLib.inf  |  42 ++
 .../RedfishPlatformCredentialIpmiLib.h|  89 
 .../RedfishPlatformCredentialIpmiLib.c| 458 ++
 6 files changed, 599 insertions(+)
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.h
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.c

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index 42d28d6dac..f171053aec 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -81,6 +81,9 @@
 [Guids]
   gEfiRedfishPkgTokenSpaceGuid  = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88, 
0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}

+  # Redfish variable guid
+  gEfiRedfishVariableGuid   = { 0x85ef8dd3, 0xe606, 0x4b89, { 0x8b, 
0xbd, 0x93, 0xbf, 0x5c, 0xbe, 0x1c, 0x18 } }
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   # This PCD is the UEFI device path which is used as the Redfish host 
interface.
@@ -123,3 +126,7 @@
   # specification for that.
   #
   
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid|L"----"|VOID*|0x1006
+  #
+  # This PCD indicates that if BMC bootstrap credential service will be 
disabled by BIOS or not.
+  #
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1007
diff --git a/RedfishPkg/RedfishLibs.dsc.inc b/RedfishPkg/RedfishLibs.dsc.inc
index 84f52d4b27..110526738c 100644
--- a/RedfishPkg/RedfishLibs.dsc.inc
+++ b/RedfishPkg/RedfishLibs.dsc.inc
@@ -19,5 +19,6 @@
   JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf
   RedfishLib|RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.inf
   RedfishDebugLib|RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
+  
RedfishPlatformCredentialLib|RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 !endif

diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 223ab72c1d..5503e65de4 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -4,6 +4,7 @@
 # Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
 # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
 # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -59,6 +60,7 @@
   
RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLibNull.inf
   
RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
   RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
+  
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
   
RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
   RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf
   RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
new file mode 100644
index 00..5c20ea22f8
--- /dev/null
+++ 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
@@ -0,0 +1,42 @@
+## @file
+#  INF file for RedfishPlatformCredentialIpmiLib.
+#
+#  Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001000b
+  BASE_NAME  = RedfishPlatformCredentialIpmiLib
+  FILE_GUID  = 9C45D622-4C66-417F-814C-F76246D97233
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = 

Re: [edk2-devel] [PATCH v3] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI implementation

2023-03-28 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
It looks good except one small question I would like to raise.
Please check my comment below.
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Monday, March 27, 2023 9:42 PM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH v3] RedfishPkg/RedfishPlatformCredentialIpmiLib: 
IPMI implementation


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

This library follows Redfish Host Interface specification and use IPMI
command to get bootstrap account credential(NetFn 2Ch, Command 02h)
from BMC. RedfishHostInterfaceDxe will use this credential for the
following communication between BIOS and BMC.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 RedfishPkg/RedfishPkg.dec |   7 +
 RedfishPkg/RedfishLibs.dsc.inc|   1 +
 RedfishPkg/RedfishPkg.dsc |   2 +
 .../RedfishPlatformCredentialIpmiLib.inf  |  42 ++
 .../RedfishPlatformCredentialIpmiLib.h|  89 
 .../RedfishPlatformCredentialIpmiLib.c| 457 ++
 6 files changed, 598 insertions(+)
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.h
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.c

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index 42d28d6dac..f171053aec 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -81,6 +81,9 @@
 [Guids]
   gEfiRedfishPkgTokenSpaceGuid  = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88, 
0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}

+  # Redfish variable guid
+  gEfiRedfishVariableGuid   = { 0x85ef8dd3, 0xe606, 0x4b89, { 0x8b, 
0xbd, 0x93, 0xbf, 0x5c, 0xbe, 0x1c, 0x18 } }
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   #
   # This PCD is the UEFI device path which is used as the Redfish host 
interface.
@@ -123,3 +126,7 @@
   # specification for that.
   #
   
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid|L"----"|VOID*|0x1006
+  #
+  # This PCD indicates that if BMC bootstrap credential service will be 
disabled by BIOS or not.
+  #
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1007
diff --git a/RedfishPkg/RedfishLibs.dsc.inc b/RedfishPkg/RedfishLibs.dsc.inc
index 84f52d4b27..110526738c 100644
--- a/RedfishPkg/RedfishLibs.dsc.inc
+++ b/RedfishPkg/RedfishLibs.dsc.inc
@@ -19,5 +19,6 @@
   JsonLib|RedfishPkg/Library/JsonLib/JsonLib.inf
   RedfishLib|RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.inf
   RedfishDebugLib|RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf
+  
RedfishPlatformCredentialLib|RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 !endif

diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 223ab72c1d..5503e65de4 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -4,6 +4,7 @@
 # Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
 # (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
 # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 #SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -59,6 +60,7 @@
   
RedfishPkg/Library/PlatformHostInterfaceLibNull/PlatformHostInterfaceLibNull.inf
   
RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
   RedfishPkg/Library/PlatformCredentialLibNull/PlatformCredentialLibNull.inf
+  
RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
   
RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
   RedfishPkg/Library/DxeRestExLib/DxeRestExLib.inf
   RedfishPkg/Library/BaseUcs2Utf8Lib/BaseUcs2Utf8Lib.inf
diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
new file mode 100644
index 00..5c20ea22f8
--- /dev/null
+++ 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
@@ -0,0 +1,42 @@
+## @file
+#  INF file for RedfishPlatformCredentialIpmiLib.
+#
+#  Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x0001000b
+  BASE_NAME  = RedfishPlatformCredentialIpmiLib
+  FILE_GUID  = 9C45D622-4C66-417F-814C-F76246D97233
+  MODULE_TYPE= 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI implementation

2023-03-12 Thread Igor Kulchytskyy via groups.io
Thank you, Nickle.

-Original Message-
From: Nickle Wang 
Sent: Sunday, March 12, 2023 8:05 AM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Abner Chang ; Nick Ramirez 
Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformCredentialIpmiLib: 
IPMI implementation

Hi Igor,

Thank you for your review. I will incorporate your comments in version 2 patch 
files.

Regards,
Nickle

-Original Message-
From: Igor Kulchytskyy 
Sent: Saturday, March 11, 2023 2:49 AM
To: Nickle Wang ; devel@edk2.groups.io
Cc: Abner Chang ; Nick Ramirez 
Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformCredentialIpmiLib: 
IPMI implementation

External email: Use caution opening links or attachments


Hi Nickle,
See my comments below the text.
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Wednesday, March 8, 2023 2:21 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI 
implementation


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

This library follows Redfish Host Interface specification and use IPMI command 
to get bootstrap account credential(NetFn 2Ch, Command 02h) from BMC. 
RedfishHostInterfaceDxe will use this credential for the following 
communication between BIOS and BMC.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishPlatformCredentialIpmiLib.c| 443 ++
 .../RedfishPlatformCredentialIpmiLib.h|  86 
 .../RedfishPlatformCredentialIpmiLib.inf  |  42 ++
 RedfishPkg/RedfishPkg.dec |   7 +
 RedfishPkg/RedfishPkg.dsc |   2 +
 5 files changed, 580 insertions(+)
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.h
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.inf

diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
new file mode 100644
index 00..2706b8508b
--- /dev/null
+++ b/RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCr
+++ edentialIpmiLib.c
@@ -0,0 +1,443 @@
+/** @file
+  Implementation of getting bootstrap credential via IPMI.
+
+  Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+  - Redfish Host Interface Specification
+
+(https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww%2F=05%7C01%7Cigork%40ami.com%7C25350a8acdeb43860e5e08db22f20b3f%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C0%7C638142195285165585%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=Eq5osO5loKqRwr4GWhkMn369mZCoGo0ePBQESQgZSR8%3D=0.
+dmtf.org%2Fsites%2Fdefault%2Ffiles%2Fstandards%2Fdocuments%2FDSP0270_1.
+3.0.pdf=05%7C01%7Cnicklew%40nvidia.com%7Cc2a7584372a24c0bade608db2
+198250c%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C638140709577922520
+%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik
+1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=oUyyzInu9QxV2Fq0wvt1Z2TrEtMk
+z2gS52TEIn%2Ftc3Y%3D=0)
+**/
+
+#include "RedfishPlatformCredentialIpmiLib.h"
+
+//
+// Global flag of controlling credential service // BOOLEAN
+mRedfishServiceStopped = FALSE;
+
+/**
+  Notify the Redfish service provide to stop provide configuration service to 
this platform.
+
+  This function should be called when the platform is about to leave the safe 
environment.
+  It will notify the Redfish service provider to abort all login
+ session, and prohibit  further login with original auth info.
+ GetAuthInfo() will return EFI_UNSUPPORTED once this  function is returned.
+
+  @param[in]   ThisPointer to 
EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
+  @param[in]   ServiceStopType Reason of stopping Redfish service.
+
+  @retval EFI_SUCCESS  Service has been stoped successfully.
+  @retval EFI_INVALID_PARAMETERThis is NULL.
+  @retval Others   Some error happened.
+
+**/
+EFI_STATUS
+EFIAPI
+LibStopRedfishService (
+  IN EDKII_REDFISH_CREDENTIAL_PROTOCOL   *This,
+  IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE  ServiceStopType
+  )
+{
+  EFI_STATUS  Status;
+
+  if ((ServiceStopType <= ServiceStopTypeNone) || (ServiceStopType >= 
ServiceStopTypeMax)) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Only stop credential service after leaving BIOS  //  if
+ (ServiceStopType != ServiceStopTypeExitBootService) {
+return EFI_UNSUPPORTED;
+  }
+
+  //
+  // Raise 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI implementation

2023-03-10 Thread Igor Kulchytskyy via groups.io
Hi Nickle,
See my comments below the text.
Thank you,
Igor

-Original Message-
From: Nickle Wang 
Sent: Wednesday, March 8, 2023 2:21 AM
To: devel@edk2.groups.io
Cc: Abner Chang ; Igor Kulchytskyy ; Nick 
Ramirez 
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformCredentialIpmiLib: IPMI 
implementation


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

This library follows Redfish Host Interface specification and use IPMI
command to get bootstrap account credential(NetFn 2Ch, Command 02h)
from BMC. RedfishHostInterfaceDxe will use this credential for the
following communication between BIOS and BMC.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishPlatformCredentialIpmiLib.c| 443 ++
 .../RedfishPlatformCredentialIpmiLib.h|  86 
 .../RedfishPlatformCredentialIpmiLib.inf  |  42 ++
 RedfishPkg/RedfishPkg.dec |   7 +
 RedfishPkg/RedfishPkg.dsc |   2 +
 5 files changed, 580 insertions(+)
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.h
 create mode 100644 
RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.inf

diff --git 
a/RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
new file mode 100644
index 00..2706b8508b
--- /dev/null
+++ 
b/RedfishPkg/Library/RedfishPlatformCredentialIpmi/RedfishPlatformCredentialIpmiLib.c
@@ -0,0 +1,443 @@
+/** @file
+  Implementation of getting bootstrap credential via IPMI.
+
+  Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Specification Reference:
+  - Redfish Host Interface Specification
+  
(https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dmtf.org%2Fsites%2Fdefault%2Ffiles%2Fstandards%2Fdocuments%2FDSP0270_1.3.0.pdf=05%7C01%7Cigork%40ami.com%7C0ed34699a31b433d952a08db1fa5ab9f%7C27e97857e15f486cb58e86c2b3040f93%7C1%7C1%7C638138568651052766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=0t4RMGFXAYj5dUI3C4l%2BfE7NveA3esyLu%2BTn9%2F1cnsE%3D=0)
+**/
+
+#include "RedfishPlatformCredentialIpmiLib.h"
+
+//
+// Global flag of controlling credential service
+//
+BOOLEAN  mRedfishServiceStopped = FALSE;
+
+/**
+  Notify the Redfish service provide to stop provide configuration service to 
this platform.
+
+  This function should be called when the platform is about to leave the safe 
environment.
+  It will notify the Redfish service provider to abort all login session, and 
prohibit
+  further login with original auth info. GetAuthInfo() will return 
EFI_UNSUPPORTED once this
+  function is returned.
+
+  @param[in]   ThisPointer to 
EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
+  @param[in]   ServiceStopType Reason of stopping Redfish service.
+
+  @retval EFI_SUCCESS  Service has been stoped successfully.
+  @retval EFI_INVALID_PARAMETERThis is NULL.
+  @retval Others   Some error happened.
+
+**/
+EFI_STATUS
+EFIAPI
+LibStopRedfishService (
+  IN EDKII_REDFISH_CREDENTIAL_PROTOCOL   *This,
+  IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE  ServiceStopType
+  )
+{
+  EFI_STATUS  Status;
+
+  if ((ServiceStopType <= ServiceStopTypeNone) || (ServiceStopType >= 
ServiceStopTypeMax)) {
+return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Only stop credential service after leaving BIOS
+  //
+  if (ServiceStopType != ServiceStopTypeExitBootService) {
+return EFI_UNSUPPORTED;
+  }
+
+  //
+  // Raise flag first
+  //
+  mRedfishServiceStopped = TRUE;
+
+  //
+  // Notify BMC to disable credential bootstrapping support.
+  //
+  if (PcdGetBool (PcdRedfishDisableBootstrapCredentialService)) {
+Status = GetBootstrapAccountCredentials (TRUE, NULL, NULL);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_ERROR, "%a: fail to disable bootstrap credential: %r\n", 
__FUNCTION__, Status));
+  return Status;
+}
+  }

Why should we call IPMI function to disable bootstrap credentials here?
This call will create new account on BMC side with username and password, which 
is not going to be used anyway (we even do not save those credentials).
We already have a call of IPMI function first time we need the credentials.
Then we agreed to cash them in NVRAM variable and all other calls to get 
credentials will use the credentials from that NVRAM variable.
Shouldn't we use that PCD and send the corresponding flag to IPMI command 
during our first call.
I do not see any differences for Redfish 

Re: [edk2-devel] [PATCH] RedfishPkg/RedfishConfigHandler: fix FreePool issue

2023-02-14 Thread Igor Kulchytskyy via groups.io
Hi Abner,
Yes, I will work on this to create the linked list.
Thank you,
Igor

-Original Message-
From: Chang, Abner 
Sent: Tuesday, February 14, 2023 1:55 AM
To: Igor Kulchytskyy ; devel@edk2.groups.io
Cc: Nickle Wang 
Subject: [EXTERNAL] RE: [PATCH] RedfishPkg/RedfishConfigHandler: fix FreePool 
issue


**CAUTION: The e-mail below is from an external source. Please exercise caution 
before opening attachments, clicking links, or following guidance.**

[AMD Official Use Only - General]

Hi Igor,
Thanks for catching this issue, I have a comment below inline.

> -Original Message-
> From: Igor Kulchytskyy 
> Sent: Saturday, February 11, 2023 5:43 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Nickle Wang
> 
> Subject: [PATCH] RedfishPkg/RedfishConfigHandler: fix FreePool issue
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> gRedfishDiscoveredToken buffer is allocated as one piece during protocol
> installed process, but deleted by parts during driver unload process.
>
> Cc: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Signed-off-by: Igor Kulchytskyy 
> ---
>  RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> index 96ac70f418..64b7fb7841 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> @@ -481,6 +481,7 @@ RedfishDiscoverProtocolInstalled (
>  ErrorReturn:
>if (gRedfishDiscoveredToken != NULL) {
>  FreePool (gRedfishDiscoveredToken);
> +gRedfishDiscoveredToken = NULL;
>}
>  }
>
> @@ -511,10 +512,10 @@ RedfishConfigHandlerDriverUnload (
>  gBS->CloseEvent (ThisRedfishDiscoveredToken->Event);
>}
>
> -  FreePool (ThisRedfishDiscoveredToken);
>ThisRedfishDiscoveredToken++;
>  }
>
> +FreePool (gRedfishDiscoveredToken);
I found here is a potential issue of gRedfishDiscoveredToken:
Due to RedfishDiscoverProtocolInstalled() may be called more than once in the 
case of multiple NIC installed on the system, means gRedfishDiscoveredToken 
will be overwritten by AllocateZeroPool() and result in memory leakage when 
unload the RedfishConfigHandler driver.
Could you please help to create an linked list (e.g. 
mRedfishDiscoveredTokenList) to record the newly allocated memory for 
gRedfishDiscoveredToken (I think we can rename it to just 
RedfishDiscoveredToken)?
So we can go through the link list to free RedfishDiscoveredToken allocated for 
each NIC when unload the driver.
Does this make sense?
Thanks
Abner

>  gRedfishDiscoveredToken = NULL;
>}
>
> --
> 2.37.1.windows.1
> -The information contained in this message may be confidential and
> proprietary to American Megatrends (AMI). This communication is intended
> to be read only by the individual or entity to whom it is addressed or by 
> their
> designee. If the reader of this message is not the intended recipient, you are
> on notice that any distribution of this message, in any form, is strictly
> prohibited. Please promptly notify the sender by reply e-mail or by
> telephone at 770-246-8600, and then delete or destroy all copies of the
> transmission.
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




  1   2   >