public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements
@ 2023-12-24 22:59 Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 01/16] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
                   ` (16 more replies)
  0 siblings, 17 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

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

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

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

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

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>




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



^ permalink raw reply	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 01/16] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo.
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 02/16] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

PlatformHostInterfaceBmcUsbNicLib is the library instance name not
the class name.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../PlatformHostInterfaceBmcUsbNicLib.inf                       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 02/16] RedfishPkg: fix RedfishPlatformCredentialLib library class name typo.
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 01/16] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 03/16] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

RedfishPlatformCredentialIpmiLib is the library instance name not the
class name.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../RedfishPlatformCredentialIpmiLib.inf                        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 03/16] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 01/16] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 02/16] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 04/16] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

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

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

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 RedfishPkg/Include/Library/RedfishCrtLib.h | 45 ++++++----------------
 1 file changed, 11 insertions(+), 34 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 04/16] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (2 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 03/16] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 05/16] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

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

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c       | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 05/16] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (3 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 04/16] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (4 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 05/16] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-26  1:12   ` Chang, Abner via groups.io
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 07/16] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

Currently there is no description for RedfishConfigHandler driver.
This leads to <null string> in the "DRIVER NAME" column of a `drivers`
command for example.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishConfigHandler/ComponentName.c      | 218 ++++++++++++++++++
 .../RedfishConfigHandlerDriver.c              |  10 +-
 .../RedfishConfigHandlerDriver.h              |   4 +-
 .../RedfishConfigHandlerDriver.inf            |   1 +
 4 files changed, 230 insertions(+), 3 deletions(-)
 create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c

diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c b/RedfishPkg/RedfishConfigHandler/ComponentName.c
new file mode 100644
index 000000000000..8e19fdb2cde5
--- /dev/null
+++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
@@ -0,0 +1,218 @@
+/** @file
+  Implementation of EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PROTOCOL protocol
+  for EFI Refish Config Handler Protocol
+
+  Copyright (c) 2023, Mike Maslenkin <mike.maslenkin@gmail.com> <BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "RedfishConfigHandlerCommon.h"
+
+//
+// EFI Component Name Functions
+//
+
+/**
+  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
+
+  @param[in]  This       A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  Language   A pointer to a three-character ISO 639-2 language identifier.
+                         This is the language of the driver name that the caller
+                         is requesting, and it must match one of the languages specified
+                         in SupportedLanguages.  The number of languages supported by a
+                         driver is up to the driver writer.
+  @param[out] DriverName A pointer to the Unicode string to return.  This Unicode string
+                         is the name of the driver specified by This in the language
+                         specified by Language.
+
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This
+                                and the language specified by Language was returned
+                                in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the
+                                language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishConfigHandlerComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **DriverName
+  );
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being managed by an EFI Driver.
+
+  @param[in]  This             A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  ControllerHandle The handle of a controller that the driver specified by
+                               This is managing.  This handle specifies the controller
+                               whose name is to be returned.
+  @param[in]  ChildHandle      The handle of the child controller to retrieve the name
+                               of.  This is an optional parameter that may be NULL.  It
+                               will be NULL for device drivers.  It will also be NULL
+                               for a bus drivers that wish to retrieve the name of the
+                               bus controller.  It will not be NULL for a bus driver
+                               that wishes to retrieve the name of a child controller.
+  @param[in]  Language         A pointer to a three character ISO 639-2 language
+                               identifier.  This is the language of the controller name
+                               that the caller is requesting, and it must match one
+                               of the languages specified in SupportedLanguages.  The
+                               number of languages supported by a driver is up to the
+                               driver writer.
+  @param[out]  ControllerName  A pointer to the Unicode string to return.  This Unicode
+                               string is the name of the controller specified by
+                               ControllerHandle and ChildHandle in the language specified
+                               by Language, from the point of view of the driver specified
+                               by This.
+
+  @retval EFI_SUCCESS           The Unicode string for the user-readable name in the
+                                language specified by Language for the driver
+                                specified by This was returned in DriverName.
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently managing
+                                the controller specified by ControllerHandle and
+                                ChildHandle.
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the
+                                language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishConfigHandlerComponentNameGetControllerName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  EFI_HANDLE                   ControllerHandle,
+  IN  EFI_HANDLE                   ChildHandle        OPTIONAL,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **ControllerName
+  );
+
+///
+/// Component Name Protocol instance
+///
+GLOBAL_REMOVE_IF_UNREFERENCED
+EFI_COMPONENT_NAME_PROTOCOL  gRedfishConfigHandlerComponentName = {
+  RedfishConfigHandlerComponentNameGetDriverName,
+  RedfishConfigHandlerComponentNameGetControllerName,
+  "eng"
+};
+
+///
+/// Component Name 2 Protocol instance
+///
+GLOBAL_REMOVE_IF_UNREFERENCED
+EFI_COMPONENT_NAME2_PROTOCOL  gRedfishConfigHandlerComponentName2 = {
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)RedfishConfigHandlerComponentNameGetDriverName,
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)RedfishConfigHandlerComponentNameGetControllerName,
+  "en"
+};
+
+///
+/// Table of driver names
+///
+GLOBAL_REMOVE_IF_UNREFERENCED
+EFI_UNICODE_STRING_TABLE  mRedfishConfigHandlerDriverNameTable[] = {
+  { "eng;en", (CHAR16 *)L"Redfish Configuration UEFI Driver" },
+  { NULL,     NULL                                           }
+};
+
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE  *gRedfishConfigHandlerControllerNameTable = NULL;
+
+/**
+  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
+
+  @param[in]  This        A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  Language    A pointer to a three-character ISO 639-2 language identifier.
+                          This is the language of the driver name that the caller
+                          is requesting, and it must match one of the languages specified
+                          in SupportedLanguages.  The number of languages supported by a
+                          driver is up to the driver writer.
+  @param[out]  DriverName A pointer to the Unicode string to return.  This Unicode string
+                          is the name of the driver specified by This in the language
+                          specified by Language.
+
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This
+                                and the language specified by Language was returned
+                                in DriverName.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the
+                                language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishConfigHandlerComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **DriverName
+  )
+{
+  return LookupUnicodeString2 (
+           Language,
+           This->SupportedLanguages,
+           mRedfishConfigHandlerDriverNameTable,
+           DriverName,
+           (BOOLEAN)(This == &gRedfishConfigHandlerComponentName)
+           );
+}
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being managed by an EFI Driver.
+
+  @param[in]  This             A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
+  @param[in]  ControllerHandle The handle of a controller that the driver specified by
+                               This is managing.  This handle specifies the controller
+                               whose name is to be returned.
+  @param[in]  ChildHandle      The handle of the child controller to retrieve the name
+                               of.  This is an optional parameter that may be NULL.  It
+                               will be NULL for device drivers.  It will also be NULL
+                               for a bus drivers that wish to retrieve the name of the
+                               bus controller.  It will not be NULL for a bus driver
+                               that wishes to retrieve the name of a child controller.
+  @param[in]  Language         A pointer to a three character ISO 639-2 language
+                               identifier.  This is the language of the controller name
+                               that the caller is requesting, and it must match one
+                               of the languages specified in SupportedLanguages.  The
+                               number of languages supported by a driver is up to the
+                              driver writer.
+  @param[out]  ControllerName  A pointer to the Unicode string to return.  This Unicode
+                               string is the name of the controller specified by
+                               ControllerHandle and ChildHandle in the language specified
+                               by Language, from the point of view of the driver specified
+                               by This.
+
+  @retval EFI_SUCCESS           The Unicode string for the user-readable name in the
+                                language specified by Language for the driver
+                                specified by This was returned in DriverName.
+  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
+  @retval EFI_INVALID_PARAMETER Language is NULL.
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently managing
+                                the controller specified by ControllerHandle and
+                                ChildHandle.
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support the
+                                language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishConfigHandlerComponentNameGetControllerName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  EFI_HANDLE                   ControllerHandle,
+  IN  EFI_HANDLE                   ChildHandle        OPTIONAL,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **ControllerName
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
index 2d0170d88614..5e03132695d6 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
@@ -601,11 +601,17 @@ RedfishConfigHandlerDriverEntryPoint (
   //
   // Install UEFI Driver Model protocol(s).
   //
-  Status = EfiLibInstallDriverBinding (
+  Status = EfiLibInstallAllDriverProtocols2 (
              ImageHandle,
              SystemTable,
              &gRedfishConfigDriverBinding,
-             ImageHandle
+             ImageHandle,
+             &gRedfishConfigHandlerComponentName,
+             &gRedfishConfigHandlerComponentName2,
+             NULL,
+             NULL,
+             NULL,
+             NULL
              );
   if (EFI_ERROR (Status)) {
     gBS->CloseEvent (gEndOfDxeEvent);
diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
index 07214875bd5a..51701c05c697 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
@@ -24,7 +24,9 @@
 //
 // Protocol instances
 //
-extern EFI_DRIVER_BINDING_PROTOCOL  gRedfishConfigDriverBinding;
+extern EFI_DRIVER_BINDING_PROTOCOL   gRedfishConfigDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL   gRedfishConfigHandlerComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL  gRedfishConfigHandlerComponentName2;
 
 extern REDFISH_CONFIG_DRIVER_DATA         gRedfishConfigData;
 extern EDKII_REDFISH_CREDENTIAL_PROTOCOL  *gCredential;
diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
index aed93f570cf9..40ce0561379f 100644
--- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
+++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
@@ -30,6 +30,7 @@
   RedfishPkg/RedfishPkg.dec
 
 [Sources]
+  ComponentName.c
   RedfishConfigHandlerDriver.h
   RedfishConfigHandlerDriver.c
   RedfishConfigHandlerCommon.h
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112865): https://edk2.groups.io/g/devel/message/112865
Mute This Topic: https://groups.io/mt/103354125/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 07/16] RedfishPkg: add proper initialization of IPMI request
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (5 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 08/16] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

All fields of IPMI_CHANNEL_INFO_CHANNEL_NUMBER union must be
initialized to avoid error condition on BMC side.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../PlatformHostInterfaceBmcUsbNicLib.c                   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 08/16] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (6 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 07/16] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 09/16] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

Cc: Nickle Wang <nicklew@nvidia.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 EmulatorPkg/EmulatorPkg.dec                          |  8 ++++----
 .../RedfishPlatformCredentialLib.c                   | 12 ++++++------
 .../RedfishPlatformCredentialLib.inf                 |  8 ++++----
 3 files changed, 14 insertions(+), 14 deletions(-)

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112867): https://edk2.groups.io/g/devel/message/112867
Mute This Topic: https://groups.io/mt/103354127/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 09/16] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (7 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 08/16] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

Cc: Nickle Wang <nicklew@nvidia.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../RedfishPlatformHostInterfaceLib.c                           | 2 --
 1 file changed, 2 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (8 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 09/16] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-26  1:14   ` Chang, Abner via groups.io
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 11/16] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 108 ++++++++++++------
 1 file changed, 74 insertions(+), 34 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index e344e06d8dcc..7aa68b54a61b 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -6,6 +6,7 @@
   Copyright (c) 2022, AMD Incorporated. All rights reserved.
   Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
   Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
+  Copyright (c) 2023, Mike Maslenkin <mike.maslenkin@gmail.com> <BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -711,6 +712,69 @@ DiscoverRedfishHostInterface (
   return Status;
 }
 
+/**
+  The function initializes particular strings into the structure instance.
+
+  @param[in]  Information           EFI_REDFISH_DISCOVERED_INFORMATION
+  @param[in]  RedfishVersion        Redfish version.
+  @param[in]  RedfishLocation       Redfish location.
+  @param[in]  Uuid                  Service UUID string.
+  @param[in]  Os                    OS string.
+  @param[in]  OsVer                 OS version string.
+  @param[in]  Product               Product string.
+  @param[in]  ProductVer            Product version string.
+
+**/
+STATIC
+VOID
+InitInformationData (
+  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
+  IN UINTN                               *RedfishVersion OPTIONAL,
+  IN CHAR8                               *RedfishLocation OPTIONAL,
+  IN CHAR8                               *Uuid  OPTIONAL,
+  IN CHAR8                               *Os  OPTIONAL,
+  IN CHAR8                               *OsVer  OPTIONAL,
+  IN CHAR8                               *Product  OPTIONAL,
+  IN CHAR8                               *ProductVer  OPTIONAL
+  )
+{
+  if (RedfishVersion != NULL) {
+    Information->RedfishVersion = *RedfishVersion;
+    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", Information->RedfishVersion));
+  }
+
+  if (RedfishLocation != NULL) {
+    Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)RedfishLocation) * sizeof (CHAR16));
+    AsciiStrToUnicodeStrS ((CONST CHAR8 *)RedfishLocation, Information->Location, AsciiStrSize ((CONST CHAR8 *)RedfishLocation) * sizeof (CHAR16));
+    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Information->Location));
+  }
+
+  if (Uuid != NULL) {
+    Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)Uuid) * sizeof (CHAR16));
+    AsciiStrToUnicodeStrS ((CONST CHAR8 *)Uuid, Information->Uuid, AsciiStrSize ((CONST CHAR8 *)Uuid) * sizeof (CHAR16));
+    DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+  }
+
+  if (Os != NULL) {
+    Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)Os) * sizeof (CHAR16));
+    AsciiStrToUnicodeStrS ((CONST CHAR8 *)Os, Information->Os, AsciiStrSize ((CONST CHAR8 *)Os) * sizeof (CHAR16));
+    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", Information->Os, Information->OsVersion));
+  }
+
+  if (OsVer != NULL) {
+    Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)OsVer) * sizeof (CHAR16));
+    AsciiStrToUnicodeStrS ((CONST CHAR8 *)OsVer, Information->OsVersion, AsciiStrSize ((CONST CHAR8 *)OsVer) * sizeof (CHAR16));
+  }
+
+  if ((Product != NULL) && (ProductVer != NULL)) {
+    Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)Product) * sizeof (CHAR16));
+    AsciiStrToUnicodeStrS ((CONST CHAR8 *)Product, Information->Product, AsciiStrSize ((CONST CHAR8 *)Product) * sizeof (CHAR16));
+    Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8 *)ProductVer) * sizeof (CHAR16));
+    AsciiStrToUnicodeStrS ((CONST CHAR8 *)ProductVer, Information->ProductVer, AsciiStrSize ((CONST CHAR8 *)ProductVer) * sizeof (CHAR16));
+    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", Information->Product, Information->ProductVer));
+  }
+}
+
 /**
   The function adds a new found Redfish service to internal list and
   notify client.
@@ -851,41 +915,17 @@ AddAndSignalNewRedfishService (
     DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information ***\n"));
 
     DiscoveredInstance->Information.UseHttps = UseHttps;
-    if (RedfishVersion != NULL) {
-      DiscoveredInstance->Information.RedfishVersion = *RedfishVersion;
-      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", DiscoveredInstance->Information.RedfishVersion));
-    }
 
-    if (RedfishLocation != NULL) {
-      DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
-      AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, DiscoveredInstance->Information.Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
-      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", DiscoveredInstance->Information.Location));
-    }
-
-    if (Uuid != NULL) {
-      DiscoveredInstance->Information.Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
-      AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, DiscoveredInstance->Information.Uuid, AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
-      DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", DiscoveredInstance->Information.Uuid));
-    }
-
-    if (Os != NULL) {
-      DiscoveredInstance->Information.Os = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16));
-      AsciiStrToUnicodeStrS ((const CHAR8 *)Os, DiscoveredInstance->Information.Os, AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16));
-      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", DiscoveredInstance->Information.Os, DiscoveredInstance->Information.OsVersion));
-    }
-
-    if (OsVer != NULL) {
-      DiscoveredInstance->Information.OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
-      AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, DiscoveredInstance->Information.OsVersion, AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
-    }
-
-    if ((Product != NULL) && (ProductVer != NULL)) {
-      DiscoveredInstance->Information.Product = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
-      AsciiStrToUnicodeStrS ((const CHAR8 *)Product, DiscoveredInstance->Information.Product, AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
-      DiscoveredInstance->Information.ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
-      AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, DiscoveredInstance->Information.ProductVer, AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
-      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", DiscoveredInstance->Information.Product, DiscoveredInstance->Information.ProductVer));
-    }
+    InitInformationData (
+      &DiscoveredInstance->Information,
+      RedfishVersion,
+      RedfishLocation,
+      Uuid,
+      Os,
+      OsVer,
+      Product,
+      ProductVer
+      );
 
     if (RedfishLocation == NULL) {
       // This is the Redfish reported from SMBIOS 42h
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112869): https://edk2.groups.io/g/devel/message/112869
Mute This Topic: https://groups.io/mt/103354129/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 11/16] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (9 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 12/16] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin, Pedro Falcato

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 36 +++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112870): https://edk2.groups.io/g/devel/message/112870
Mute This Topic: https://groups.io/mt/103354130/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 12/16] RedfishDiscoverDxe: refine InitInformationData() function
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (10 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 11/16] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources Mike Maslenkin
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

Cache size of ASCII string in local variable.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 34 ++++++++++++-------
 1 file changed, 21 insertions(+), 13 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources.
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (11 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 12/16] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-26  1:17   ` Chang, Abner via groups.io
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data Mike Maslenkin
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

This patch adds a handy helper function deallocating resources from the
EFI_REDFISH_DISCOVERED_INFORMATION structure instance.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 68 ++++++++++++-------
 1 file changed, 44 insertions(+), 24 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (12 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-26  1:20   ` Chang, Abner via groups.io
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

It is required to free previously allocated strings stored in
DiscoveredInstance->Information structure.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 2 ++
 1 file changed, 2 insertions(+)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions.
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (13 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-26  1:22   ` Chang, Abner via groups.io
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
  2023-12-26  1:40 ` [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Chang, Abner via groups.io
  16 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4625

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 89 ++++++++++++++++---
 1 file changed, 78 insertions(+), 11 deletions(-)

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112874): https://edk2.groups.io/g/devel/message/112874
Mute This Topic: https://groups.io/mt/103354134/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (14 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
@ 2023-12-24 22:59 ` Mike Maslenkin
  2023-12-26  1:39   ` Chang, Abner via groups.io
  2023-12-26  1:40 ` [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Chang, Abner via groups.io
  16 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-24 22:59 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin

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

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

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishDiscoverDxe/RedfishDiscoverDxe.c     | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

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



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



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
@ 2023-12-26  1:12   ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:12 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 06/16] RedfishPkg: add Component Name protocols to
> RedfishConfigHandler driver
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Currently there is no description for RedfishConfigHandler driver.
> This leads to <null string> in the "DRIVER NAME" column of a `drivers`
> command for example.
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  .../RedfishConfigHandler/ComponentName.c      | 218
> ++++++++++++++++++
>  .../RedfishConfigHandlerDriver.c              |  10 +-
>  .../RedfishConfigHandlerDriver.h              |   4 +-
>  .../RedfishConfigHandlerDriver.inf            |   1 +
>  4 files changed, 230 insertions(+), 3 deletions(-)
>  create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c
>
> diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c
> b/RedfishPkg/RedfishConfigHandler/ComponentName.c
> new file mode 100644
> index 000000000000..8e19fdb2cde5
> --- /dev/null
> +++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
> @@ -0,0 +1,218 @@
> +/** @file
>
> +  Implementation of EFI_COMPONENT_NAME_PROTOCOL and
> EFI_COMPONENT_NAME2_PROTOCOL protocol
>
> +  for EFI Refish Config Handler Protocol
>
> +
>
> +  Copyright (c) 2023, Mike Maslenkin <mike.maslenkin@gmail.com> <BR>
>
> +
>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +
>
> +**/
>
> +
>
> +#include "RedfishConfigHandlerCommon.h"
>
> +
>
> +//
>
> +// EFI Component Name Functions
>
> +//
>
> +
>
> +/**
>
> +  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
>
> +
>
> +  @param[in]  This       A pointer to the EFI_COMPONENT_NAME_PROTOCOL
> instance.
>
> +  @param[in]  Language   A pointer to a three-character ISO 639-2 language
> identifier.
>
> +                         This is the language of the driver name that the caller
>
> +                         is requesting, and it must match one of the languages specified
>
> +                         in SupportedLanguages.  The number of languages supported by
> a
>
> +                         driver is up to the driver writer.
>
> +  @param[out] DriverName A pointer to the Unicode string to return.  This
> Unicode string
>
> +                         is the name of the driver specified by This in the language
>
> +                         specified by Language.
>
> +
>
> +  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This
>
> +                                and the language specified by Language was returned
>
> +                                in DriverName.
>
> +  @retval EFI_INVALID_PARAMETER Language is NULL.
>
> +  @retval EFI_INVALID_PARAMETER DriverName is NULL.
>
> +  @retval EFI_UNSUPPORTED       The driver specified by This does not
> support the
>
> +                                language specified by Language.
>
> +
>
> +**/
>
> +EFI_STATUS
>
> +EFIAPI
>
> +RedfishConfigHandlerComponentNameGetDriverName (
>
> +  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
>
> +  IN  CHAR8                        *Language,
>
> +  OUT CHAR16                       **DriverName
>
> +  );
>
> +
>
> +/**
>
> +  Retrieves a Unicode string that is the user readable name of the controller
>
> +  that is being managed by an EFI Driver.
>
> +
>
> +  @param[in]  This             A pointer to the
> EFI_COMPONENT_NAME_PROTOCOL instance.
>
> +  @param[in]  ControllerHandle The handle of a controller that the driver
> specified by
>
> +                               This is managing.  This handle specifies the controller
>
> +                               whose name is to be returned.
>
> +  @param[in]  ChildHandle      The handle of the child controller to retrieve the
> name
>
> +                               of.  This is an optional parameter that may be NULL.  It
>
> +                               will be NULL for device drivers.  It will also be NULL
>
> +                               for a bus drivers that wish to retrieve the name of the
>
> +                               bus controller.  It will not be NULL for a bus driver
>
> +                               that wishes to retrieve the name of a child controller.
>
> +  @param[in]  Language         A pointer to a three character ISO 639-2
> language
>
> +                               identifier.  This is the language of the controller name
>
> +                               that the caller is requesting, and it must match one
>
> +                               of the languages specified in SupportedLanguages.  The
>
> +                               number of languages supported by a driver is up to the
>
> +                               driver writer.
>
> +  @param[out]  ControllerName  A pointer to the Unicode string to return.
> This Unicode
>
> +                               string is the name of the controller specified by
>
> +                               ControllerHandle and ChildHandle in the language specified
>
> +                               by Language, from the point of view of the driver specified
>
> +                               by This.
>
> +
>
> +  @retval EFI_SUCCESS           The Unicode string for the user-readable name in
> the
>
> +                                language specified by Language for the driver
>
> +                                specified by This was returned in DriverName.
>
> +  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
>
> +  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
> valid EFI_HANDLE.
>
> +  @retval EFI_INVALID_PARAMETER Language is NULL.
>
> +  @retval EFI_INVALID_PARAMETER ControllerName is NULL.
>
> +  @retval EFI_UNSUPPORTED       The driver specified by This is not currently
> managing
>
> +                                the controller specified by ControllerHandle and
>
> +                                ChildHandle.
>
> +  @retval EFI_UNSUPPORTED       The driver specified by This does not
> support the
>
> +                                language specified by Language.
>
> +
>
> +**/
>
> +EFI_STATUS
>
> +EFIAPI
>
> +RedfishConfigHandlerComponentNameGetControllerName (
>
> +  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
>
> +  IN  EFI_HANDLE                   ControllerHandle,
>
> +  IN  EFI_HANDLE                   ChildHandle        OPTIONAL,
>
> +  IN  CHAR8                        *Language,
>
> +  OUT CHAR16                       **ControllerName
>
> +  );
>
> +
>
> +///
>
> +/// Component Name Protocol instance
>
> +///
>
> +GLOBAL_REMOVE_IF_UNREFERENCED
>
> +EFI_COMPONENT_NAME_PROTOCOL
> gRedfishConfigHandlerComponentName = {
>
> +  RedfishConfigHandlerComponentNameGetDriverName,
>
> +  RedfishConfigHandlerComponentNameGetControllerName,
>
> +  "eng"
>
> +};
>
> +
>
> +///
>
> +/// Component Name 2 Protocol instance
>
> +///
>
> +GLOBAL_REMOVE_IF_UNREFERENCED
>
> +EFI_COMPONENT_NAME2_PROTOCOL
> gRedfishConfigHandlerComponentName2 = {
>
> +
> (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)RedfishConfigHandlerComp
> onentNameGetDriverName,
>
> +
> (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)RedfishConfigHandler
> ComponentNameGetControllerName,
>
> +  "en"
>
> +};
>
> +
>
> +///
>
> +/// Table of driver names
>
> +///
>
> +GLOBAL_REMOVE_IF_UNREFERENCED
>
> +EFI_UNICODE_STRING_TABLE  mRedfishConfigHandlerDriverNameTable[] = {
>
> +  { "eng;en", (CHAR16 *)L"Redfish Configuration UEFI Driver" },
>
> +  { NULL,     NULL                                           }
>
> +};
>
> +
>
> +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE
> *gRedfishConfigHandlerControllerNameTable = NULL;
>
> +
>
> +/**
>
> +  Retrieves a Unicode string that is the user-readable name of the EFI Driver.
>
> +
>
> +  @param[in]  This        A pointer to the EFI_COMPONENT_NAME_PROTOCOL
> instance.
>
> +  @param[in]  Language    A pointer to a three-character ISO 639-2 language
> identifier.
>
> +                          This is the language of the driver name that the caller
>
> +                          is requesting, and it must match one of the languages specified
>
> +                          in SupportedLanguages.  The number of languages supported
> by a
>
> +                          driver is up to the driver writer.
>
> +  @param[out]  DriverName A pointer to the Unicode string to return.  This
> Unicode string
>
> +                          is the name of the driver specified by This in the language
>
> +                          specified by Language.
>
> +
>
> +  @retval EFI_SUCCESS           The Unicode string for the Driver specified by This
>
> +                                and the language specified by Language was returned
>
> +                                in DriverName.
>
> +  @retval EFI_INVALID_PARAMETER Language is NULL.
>
> +  @retval EFI_INVALID_PARAMETER DriverName is NULL.
>
> +  @retval EFI_UNSUPPORTED       The driver specified by This does not
> support the
>
> +                                language specified by Language.
>
> +
>
> +**/
>
> +EFI_STATUS
>
> +EFIAPI
>
> +RedfishConfigHandlerComponentNameGetDriverName (
>
> +  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
>
> +  IN  CHAR8                        *Language,
>
> +  OUT CHAR16                       **DriverName
>
> +  )
>
> +{
>
> +  return LookupUnicodeString2 (
>
> +           Language,
>
> +           This->SupportedLanguages,
>
> +           mRedfishConfigHandlerDriverNameTable,
>
> +           DriverName,
>
> +           (BOOLEAN)(This == &gRedfishConfigHandlerComponentName)
>
> +           );
>
> +}
>
> +
>
> +/**
>
> +  Retrieves a Unicode string that is the user readable name of the controller
>
> +  that is being managed by an EFI Driver.
>
> +
>
> +  @param[in]  This             A pointer to the
> EFI_COMPONENT_NAME_PROTOCOL instance.
>
> +  @param[in]  ControllerHandle The handle of a controller that the driver
> specified by
>
> +                               This is managing.  This handle specifies the controller
>
> +                               whose name is to be returned.
>
> +  @param[in]  ChildHandle      The handle of the child controller to retrieve the
> name
>
> +                               of.  This is an optional parameter that may be NULL.  It
>
> +                               will be NULL for device drivers.  It will also be NULL
>
> +                               for a bus drivers that wish to retrieve the name of the
>
> +                               bus controller.  It will not be NULL for a bus driver
>
> +                               that wishes to retrieve the name of a child controller.
>
> +  @param[in]  Language         A pointer to a three character ISO 639-2
> language
>
> +                               identifier.  This is the language of the controller name
>
> +                               that the caller is requesting, and it must match one
>
> +                               of the languages specified in SupportedLanguages.  The
>
> +                               number of languages supported by a driver is up to the
>
> +                              driver writer.
>
> +  @param[out]  ControllerName  A pointer to the Unicode string to return.
> This Unicode
>
> +                               string is the name of the controller specified by
>
> +                               ControllerHandle and ChildHandle in the language specified
>
> +                               by Language, from the point of view of the driver specified
>
> +                               by This.
>
> +
>
> +  @retval EFI_SUCCESS           The Unicode string for the user-readable name in
> the
>
> +                                language specified by Language for the driver
>
> +                                specified by This was returned in DriverName.
>
> +  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
>
> +  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a
> valid EFI_HANDLE.
>
> +  @retval EFI_INVALID_PARAMETER Language is NULL.
>
> +  @retval EFI_INVALID_PARAMETER ControllerName is NULL.
>
> +  @retval EFI_UNSUPPORTED       The driver specified by This is not currently
> managing
>
> +                                the controller specified by ControllerHandle and
>
> +                                ChildHandle.
>
> +  @retval EFI_UNSUPPORTED       The driver specified by This does not
> support the
>
> +                                language specified by Language.
>
> +
>
> +**/
>
> +EFI_STATUS
>
> +EFIAPI
>
> +RedfishConfigHandlerComponentNameGetControllerName (
>
> +  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
>
> +  IN  EFI_HANDLE                   ControllerHandle,
>
> +  IN  EFI_HANDLE                   ChildHandle        OPTIONAL,
>
> +  IN  CHAR8                        *Language,
>
> +  OUT CHAR16                       **ControllerName
>
> +  )
>
> +{
>
> +  return EFI_UNSUPPORTED;
>
> +}
>
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> index 2d0170d88614..5e03132695d6 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c
> @@ -601,11 +601,17 @@ RedfishConfigHandlerDriverEntryPoint (
>    //
>
>    // Install UEFI Driver Model protocol(s).
>
>    //
>
> -  Status = EfiLibInstallDriverBinding (
>
> +  Status = EfiLibInstallAllDriverProtocols2 (
>
>               ImageHandle,
>
>               SystemTable,
>
>               &gRedfishConfigDriverBinding,
>
> -             ImageHandle
>
> +             ImageHandle,
>
> +             &gRedfishConfigHandlerComponentName,
>
> +             &gRedfishConfigHandlerComponentName2,
>
> +             NULL,
>
> +             NULL,
>
> +             NULL,
>
> +             NULL
>
>               );
>
>    if (EFI_ERROR (Status)) {
>
>      gBS->CloseEvent (gEndOfDxeEvent);
>
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
> index 07214875bd5a..51701c05c697 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.h
> @@ -24,7 +24,9 @@
>  //
>
>  // Protocol instances
>
>  //
>
> -extern EFI_DRIVER_BINDING_PROTOCOL  gRedfishConfigDriverBinding;
>
> +extern EFI_DRIVER_BINDING_PROTOCOL   gRedfishConfigDriverBinding;
>
> +extern EFI_COMPONENT_NAME_PROTOCOL
> gRedfishConfigHandlerComponentName;
>
> +extern EFI_COMPONENT_NAME2_PROTOCOL
> gRedfishConfigHandlerComponentName2;
>
>
>
>  extern REDFISH_CONFIG_DRIVER_DATA         gRedfishConfigData;
>
>  extern EDKII_REDFISH_CREDENTIAL_PROTOCOL  *gCredential;
>
> diff --git a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
> b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
> index aed93f570cf9..40ce0561379f 100644
> --- a/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
> +++ b/RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf
> @@ -30,6 +30,7 @@
>    RedfishPkg/RedfishPkg.dec
>
>
>
>  [Sources]
>
> +  ComponentName.c
>
>    RedfishConfigHandlerDriver.h
>
>    RedfishConfigHandlerDriver.c
>
>    RedfishConfigHandlerCommon.h
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112892): https://edk2.groups.io/g/devel/message/112892
Mute This Topic: https://groups.io/mt/103354125/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
@ 2023-12-26  1:14   ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:14 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData
> helper function
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 108 ++++++++++++------
>  1 file changed, 74 insertions(+), 34 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index e344e06d8dcc..7aa68b54a61b 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -6,6 +6,7 @@
>    Copyright (c) 2022, AMD Incorporated. All rights reserved.
>
>    Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
>
>    Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
>
> +  Copyright (c) 2023, Mike Maslenkin <mike.maslenkin@gmail.com> <BR>
>
>
>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>
> @@ -711,6 +712,69 @@ DiscoverRedfishHostInterface (
>    return Status;
>
>  }
>
>
>
> +/**
>
> +  The function initializes particular strings into the structure instance.
>
> +
>
> +  @param[in]  Information           EFI_REDFISH_DISCOVERED_INFORMATION
>
> +  @param[in]  RedfishVersion        Redfish version.
>
> +  @param[in]  RedfishLocation       Redfish location.
>
> +  @param[in]  Uuid                  Service UUID string.
>
> +  @param[in]  Os                    OS string.
>
> +  @param[in]  OsVer                 OS version string.
>
> +  @param[in]  Product               Product string.
>
> +  @param[in]  ProductVer            Product version string.
>
> +
>
> +**/
>
> +STATIC
>
> +VOID
>
> +InitInformationData (
>
> +  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
>
> +  IN UINTN                               *RedfishVersion OPTIONAL,
>
> +  IN CHAR8                               *RedfishLocation OPTIONAL,
>
> +  IN CHAR8                               *Uuid  OPTIONAL,
>
> +  IN CHAR8                               *Os  OPTIONAL,
>
> +  IN CHAR8                               *OsVer  OPTIONAL,
>
> +  IN CHAR8                               *Product  OPTIONAL,
>
> +  IN CHAR8                               *ProductVer  OPTIONAL
>
> +  )
>
> +{
>
> +  if (RedfishVersion != NULL) {
>
> +    Information->RedfishVersion = *RedfishVersion;
>
> +    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n",
> Information->RedfishVersion));
>
> +  }
>
> +
>
> +  if (RedfishLocation != NULL) {
>
> +    Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST
> CHAR8 *)RedfishLocation) * sizeof (CHAR16));
>
> +    AsciiStrToUnicodeStrS ((CONST CHAR8 *)RedfishLocation, Information-
> >Location, AsciiStrSize ((CONST CHAR8 *)RedfishLocation) * sizeof (CHAR16));
>
> +    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> +  }
>
> +
>
> +  if (Uuid != NULL) {
>
> +    Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8
> *)Uuid) * sizeof (CHAR16));
>
> +    AsciiStrToUnicodeStrS ((CONST CHAR8 *)Uuid, Information->Uuid,
> AsciiStrSize ((CONST CHAR8 *)Uuid) * sizeof (CHAR16));
>
> +    DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> +  }
>
> +
>
> +  if (Os != NULL) {
>
> +    Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST CHAR8
> *)Os) * sizeof (CHAR16));
>
> +    AsciiStrToUnicodeStrS ((CONST CHAR8 *)Os, Information->Os, AsciiStrSize
> ((CONST CHAR8 *)Os) * sizeof (CHAR16));
>
> +    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s,
> Version:%s.\n", Information->Os, Information->OsVersion));
>
> +  }
>
> +
>
> +  if (OsVer != NULL) {
>
> +    Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST
> CHAR8 *)OsVer) * sizeof (CHAR16));
>
> +    AsciiStrToUnicodeStrS ((CONST CHAR8 *)OsVer, Information->OsVersion,
> AsciiStrSize ((CONST CHAR8 *)OsVer) * sizeof (CHAR16));
>
> +  }
>
> +
>
> +  if ((Product != NULL) && (ProductVer != NULL)) {
>
> +    Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST
> CHAR8 *)Product) * sizeof (CHAR16));
>
> +    AsciiStrToUnicodeStrS ((CONST CHAR8 *)Product, Information->Product,
> AsciiStrSize ((CONST CHAR8 *)Product) * sizeof (CHAR16));
>
> +    Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((CONST
> CHAR8 *)ProductVer) * sizeof (CHAR16));
>
> +    AsciiStrToUnicodeStrS ((CONST CHAR8 *)ProductVer, Information-
> >ProductVer, AsciiStrSize ((CONST CHAR8 *)ProductVer) * sizeof (CHAR16));
>
> +    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> Version:%s.\n", Information->Product, Information->ProductVer));
>
> +  }
>
> +}
>
> +
>
>  /**
>
>    The function adds a new found Redfish service to internal list and
>
>    notify client.
>
> @@ -851,41 +915,17 @@ AddAndSignalNewRedfishService (
>      DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information
> ***\n"));
>
>
>
>      DiscoveredInstance->Information.UseHttps = UseHttps;
>
> -    if (RedfishVersion != NULL) {
>
> -      DiscoveredInstance->Information.RedfishVersion = *RedfishVersion;
>
> -      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n",
> DiscoveredInstance->Information.RedfishVersion));
>
> -    }
>
>
>
> -    if (RedfishLocation != NULL) {
>
> -      DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
>
> -      AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation,
> DiscoveredInstance->Information.Location, AsciiStrSize ((const CHAR8
> *)RedfishLocation) * sizeof (CHAR16));
>
> -      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> DiscoveredInstance->Information.Location));
>
> -    }
>
> -
>
> -    if (Uuid != NULL) {
>
> -      DiscoveredInstance->Information.Uuid = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
>
> -      AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, DiscoveredInstance-
> >Information.Uuid, AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
>
> -      DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n",
> DiscoveredInstance->Information.Uuid));
>
> -    }
>
> -
>
> -    if (Os != NULL) {
>
> -      DiscoveredInstance->Information.Os = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16));
>
> -      AsciiStrToUnicodeStrS ((const CHAR8 *)Os, DiscoveredInstance-
> >Information.Os, AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16));
>
> -      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s,
> Version:%s.\n", DiscoveredInstance->Information.Os, DiscoveredInstance-
> >Information.OsVersion));
>
> -    }
>
> -
>
> -    if (OsVer != NULL) {
>
> -      DiscoveredInstance->Information.OsVersion = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
>
> -      AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, DiscoveredInstance-
> >Information.OsVersion, AsciiStrSize ((const CHAR8 *)OsVer) * sizeof
> (CHAR16));
>
> -    }
>
> -
>
> -    if ((Product != NULL) && (ProductVer != NULL)) {
>
> -      DiscoveredInstance->Information.Product = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
>
> -      AsciiStrToUnicodeStrS ((const CHAR8 *)Product, DiscoveredInstance-
> >Information.Product, AsciiStrSize ((const CHAR8 *)Product) * sizeof
> (CHAR16));
>
> -      DiscoveredInstance->Information.ProductVer = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
>
> -      AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, DiscoveredInstance-
> >Information.ProductVer, AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof
> (CHAR16));
>
> -      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> Version:%s.\n", DiscoveredInstance->Information.Product,
> DiscoveredInstance->Information.ProductVer));
>
> -    }
>
> +    InitInformationData (
>
> +      &DiscoveredInstance->Information,
>
> +      RedfishVersion,
>
> +      RedfishLocation,
>
> +      Uuid,
>
> +      Os,
>
> +      OsVer,
>
> +      Product,
>
> +      ProductVer
>
> +      );
>
>
>
>      if (RedfishLocation == NULL) {
>
>        // This is the Redfish reported from SMBIOS 42h
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112893): https://edk2.groups.io/g/devel/message/112893
Mute This Topic: https://groups.io/mt/103354129/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources.
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources Mike Maslenkin
@ 2023-12-26  1:17   ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:17 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function
> deallocating string resources.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> This patch adds a handy helper function deallocating resources from the
> EFI_REDFISH_DISCOVERED_INFORMATION structure instance.
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 68 ++++++++++++-------
>  1 file changed, 44 insertions(+), 24 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 76f87e4fe5e7..ff0c3ff1d1f5 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -712,6 +712,49 @@ DiscoverRedfishHostInterface (
>    return Status;
>
>  }
>
>
>
> +/**
>
> +  The function releases particular strings into the structure instance.
>
> +
>
> +  @param[in]  Information           EFI_REDFISH_DISCOVERED_INFORMATION
>
> +
>
> +**/
>
> +STATIC
>
> +VOID
>
> +FreeInformationData (
>
> +  IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information
>
> +  )
>
> +{
>
> +  if (Information->Location != NULL) {
>
> +    FreePool (Information->Location);
>
> +    Information->Location = NULL;
>
> +  }
>
> +
>
> +  if (Information->Uuid != NULL) {
>
> +    FreePool (Information->Uuid);
>
> +    Information->Uuid = NULL;
>
> +  }
>
> +
>
> +  if (Information->Os != NULL) {
>
> +    FreePool (Information->Os);
>
> +    Information->Os = NULL;
>
> +  }
>
> +
>
> +  if (Information->OsVersion != NULL) {
>
> +    FreePool (Information->OsVersion);
>
> +    Information->OsVersion = NULL;
>
> +  }
>
> +
>
> +  if (Information->Product != NULL) {
>
> +    FreePool (Information->Product);
>
> +    Information->Product = NULL;
>
> +  }
>
> +
>
> +  if (Information->ProductVer != NULL) {
>
> +    FreePool (Information->ProductVer);
>
> +    Information->ProductVer = NULL;
>
> +  }
>
> +}
>
> +
>
>  /**
>
>    The function initializes particular strings into the structure instance.
>
>
>
> @@ -1514,30 +1557,7 @@ RedfishServiceReleaseService (
>      do {
>
>        if (DiscoveredRedfishInstance->Instance == ThisRedfishInstance) {
>
>          RemoveEntryList (&DiscoveredRedfishInstance->NextInstance);
>
> -        if (ThisRedfishInstance->Information.Location != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Location);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.Uuid != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Uuid);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.Os != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Os);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.OsVersion != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.OsVersion);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.Product != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.Product);
>
> -        }
>
> -
>
> -        if (ThisRedfishInstance->Information.ProductVer != NULL) {
>
> -          FreePool (ThisRedfishInstance->Information.ProductVer);
>
> -        }
>
> -
>
> +        FreeInformationData (&ThisRedfishInstance->Information);
>
>          FreePool ((VOID *)ThisRedfishInstance);
>
>          goto ReleaseNext;
>
>        }
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112894): https://edk2.groups.io/g/devel/message/112894
Mute This Topic: https://groups.io/mt/103354132/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data Mike Maslenkin
@ 2023-12-26  1:20   ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:20 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 14/16] RedfishDiscoverDxe: release resources when
> refreshing information data
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> It is required to free previously allocated strings stored in
> DiscoveredInstance->Information structure.
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index ff0c3ff1d1f5..bbd1f4b86400 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -961,6 +961,8 @@ AddAndSignalNewRedfishService (
>          FreePool ((VOID *)DiscoveredList);
>
>          return EFI_OUT_OF_RESOURCES;
>
>        }
>
> +    } else {
>
> +      FreeInformationData (&DiscoveredInstance->Information);
>
>      }
>
>
>
>      DEBUG ((DEBUG_MANAGEABILITY, "*** Redfish Service Information
> ***\n"));
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112895): https://edk2.groups.io/g/devel/message/112895
Mute This Topic: https://groups.io/mt/103354133/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions.
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
@ 2023-12-26  1:22   ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:22 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation
> error conditions.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4625
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 89 ++++++++++++++++---
>  1 file changed, 78 insertions(+), 11 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index bbd1f4b86400..1022ab090df8 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -791,38 +791,105 @@ InitInformationData (
>    if (RedfishLocation != NULL) {
>
>      AllocationSize        = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
>      Information->Location = AllocatePool (AllocationSize);
>
> -    AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> -    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> +    if (Information->Location != NULL) {
>
> +      AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> +      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> +    } else {
>
> +      DEBUG ((
>
> +        DEBUG_ERROR,
>
> +        "%a: Can not allocate memory for Redfish service location: %a.\n",
>
> +        __func__,
>
> +        RedfishLocation
>
> +        ));
>
> +    }
>
>    }
>
>
>
>    if (Uuid != NULL) {
>
>      AllocationSize    = AsciiStrSize (Uuid) * sizeof (CHAR16);
>
>      Information->Uuid = AllocatePool (AllocationSize);
>
> -    AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
>
> -    DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> +    if (Information->Uuid != NULL) {
>
> +      AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
>
> +      DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> +    } else {
>
> +      DEBUG ((
>
> +        DEBUG_ERROR,
>
> +        "%a: Can not allocate memory for Service UUID: %a.\n",
>
> +        __func__,
>
> +        Uuid
>
> +        ));
>
> +    }
>
>    }
>
>
>
>    if (Os != NULL) {
>
>      AllocationSize  = AsciiStrSize (Os) * sizeof (CHAR16);
>
>      Information->Os = AllocatePool (AllocationSize);
>
> -    AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
>
> +    if (Information->Os != NULL) {
>
> +      AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
>
> +    } else {
>
> +      DEBUG ((
>
> +        DEBUG_ERROR,
>
> +        "%a: Can not allocate memory for Redfish service OS: %a.\n",
>
> +        __func__,
>
> +        Os
>
> +        ));
>
> +    }
>
>    }
>
>
>
>    if (OsVer != NULL) {
>
>      AllocationSize         = AsciiStrSize (OsVer) * sizeof (CHAR16);
>
>      Information->OsVersion = AllocatePool (AllocationSize);
>
> -    AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
>
> -    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n",
> Information->Os, Information->OsVersion));
>
> +    if (Information->OsVersion != NULL) {
>
> +      AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
>
> +      DEBUG ((
>
> +        DEBUG_MANAGEABILITY,
>
> +        "Redfish service OS: %s, Version:%s.\n",
>
> +        Information->Os,
>
> +        Information->OsVersion
>
> +        ));
>
> +    } else {
>
> +      DEBUG ((
>
> +        DEBUG_ERROR,
>
> +        "%a: Can not allocate memory for Redfish OS Version:%a.\n",
>
> +        __func__,
>
> +        OsVer
>
> +        ));
>
> +    }
>
>    }
>
>
>
> -  if ((Product != NULL) && (ProductVer != NULL)) {
>
> +  if (Product != NULL) {
>
>      AllocationSize       = AsciiStrSize (Product) * sizeof (CHAR16);
>
>      Information->Product = AllocatePool (AllocationSize);
>
> -    AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
>
> +    if (Information->Product != NULL) {
>
> +      AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
>
> +    } else {
>
> +      DEBUG ((
>
> +        DEBUG_ERROR,
>
> +        "%a: Can not allocate memory for Redfish service product: %a.\n",
>
> +        __func__,
>
> +        Product
>
> +        ));
>
> +    }
>
> +  }
>
> +
>
> +  if (ProductVer != NULL) {
>
>      AllocationSize          = AsciiStrSize (ProductVer) * sizeof (CHAR16);
>
>      Information->ProductVer = AllocatePool (AllocationSize);
>
> -    AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> AllocationSize);
>
> -    DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> Version:%s.\n", Information->Product, Information->ProductVer));
>
> +    if (Information->ProductVer != NULL) {
>
> +      AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> AllocationSize);
>
> +      DEBUG ((
>
> +        DEBUG_MANAGEABILITY,
>
> +        "Redfish service product: %s, Version:%s.\n",
>
> +        Information->Product,
>
> +        Information->ProductVer
>
> +        ));
>
> +    } else {
>
> +      DEBUG ((
>
> +        DEBUG_ERROR,
>
> +        "%a: Can not allocate memory for Redfish service product Version:
> %a.\n",
>
> +        __func__,
>
> +        ProductVer
>
> +        ));
>
> +    }
>
>    }
>
>  }
>
>
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112896): https://edk2.groups.io/g/devel/message/112896
Mute This Topic: https://groups.io/mt/103354134/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
@ 2023-12-26  1:39   ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:39 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to
> URI for IPv6 addresses
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> URI is generated based on the RedfishLocation containing an ASCII string
> representing the IP address. So, in the case of IPv4 the canonical
> representation of an IPv4 address was inserted into the resulting Unicode
> string i.e: "http{,s}://X.X.X.X/".
>
> In the case of IPv6, to access resources, the IP address must be specified
> in brackets, i.e. the resulting string should look like:
>   "http{,s}://[X::X:X:X:X]/".
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c     | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 1022ab090df8..238039b57717 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -759,6 +759,7 @@ FreeInformationData (
>    The function initializes particular strings into the structure instance.
>
>
>
>    @param[in]  Information           EFI_REDFISH_DISCOVERED_INFORMATION
>
> +  @param[in]  IsIpv6                Flag indicating IP version 6 protocol is used
>
>    @param[in]  RedfishVersion        Redfish version.
>
>    @param[in]  RedfishLocation       Redfish location.
>
>    @param[in]  Uuid                  Service UUID string.
>
> @@ -772,6 +773,7 @@ STATIC
>  VOID
>
>  InitInformationData (
>
>    IN EFI_REDFISH_DISCOVERED_INFORMATION  *Information,
>
> +  IN BOOLEAN                             IsIpv6,
>
>    IN UINTN                               *RedfishVersion OPTIONAL,
>
>    IN CONST CHAR8                         *RedfishLocation OPTIONAL,
>
>    IN CONST CHAR8                         *Uuid OPTIONAL,
>
> @@ -789,10 +791,20 @@ InitInformationData (
>    }
>
>
>
>    if (RedfishLocation != NULL) {
>
> -    AllocationSize        = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
> +    AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
> +
>
> +    if (IsIpv6) {
>
> +      AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
>
> +    }
>
> +
>
>      Information->Location = AllocatePool (AllocationSize);
>
>      if (Information->Location != NULL) {
>
> -      AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> +      if (IsIpv6) {
>
> +        UnicodeSPrintAsciiFormat (Information->Location, AllocationSize,
> "[%a]", RedfishLocation);
>
> +      } else {
>
> +        AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> +      }
>
> +
>
>        DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
>      } else {
>
>        DEBUG ((
>
> @@ -1038,6 +1050,7 @@ AddAndSignalNewRedfishService (
>
>
>      InitInformationData (
>
>        &DiscoveredInstance->Information,
>
> +      CheckIsIpVersion6 (NetworkInterface),
>
>        RedfishVersion,
>
>        RedfishLocation,
>
>        Uuid,
>
> --
> 2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112897): https://edk2.groups.io/g/devel/message/112897
Mute This Topic: https://groups.io/mt/103354135/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements
  2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
                   ` (15 preceding siblings ...)
  2023-12-24 22:59 ` [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
@ 2023-12-26  1:40 ` Chang, Abner via groups.io
  2023-12-26 16:10   ` Mike Maslenkin
  16 siblings, 1 reply; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-26  1:40 UTC (permalink / raw)
  To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Hi Mike,
I had RB on this patch set. Please update PR with my RB. Also let me know when you reset it.

Thanks
Abner

> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Monday, December 25, 2023 6:59 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; nicklew@nvidia.com;
> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [PATCH v3 0/16] Redfish related fixes and improvements
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> This is an expanded version of the original set of 9 patches with
> additional patch introducing brackets for IPv6 Redfish resource location
> with required changes according to comments for the initial RFC patch.
>
> PR: https://github.com/tianocore/edk2/pull/5149
>
> diff from v2:
>   added Abner's R-b
>   refined copyrights
>   added additional patches [13-14] deallocating stings stored in
> EFI_REDFISH_DISCOVERED_INFORMATION
>   changed const to CONST in intermediate patches (patch 10)
>   reworked Product and ProductVer strings handling in accordance with the
> comments
>   removed IpAddress local variable in the last patch
>
> diff from v1:
>  fixed typo double "that that"
>  removed variable declaration in block scope
>  added patches 10-13
>  removed unnecessary casts
>  added checks for memory allocation result
>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112898): https://edk2.groups.io/g/devel/message/112898
Mute This Topic: https://groups.io/mt/103354119/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements
  2023-12-26  1:40 ` [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Chang, Abner via groups.io
@ 2023-12-26 16:10   ` Mike Maslenkin
  2023-12-27  2:54     ` Chang, Abner via groups.io
  0 siblings, 1 reply; 26+ messages in thread
From: Mike Maslenkin @ 2023-12-26 16:10 UTC (permalink / raw)
  To: Chang, Abner; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com

Hi Abner,

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

Thanks,
Mike.

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


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



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements
  2023-12-26 16:10   ` Mike Maslenkin
@ 2023-12-27  2:54     ` Chang, Abner via groups.io
  0 siblings, 0 replies; 26+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-27  2:54 UTC (permalink / raw)
  To: Mike Maslenkin; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com

[AMD Official Use Only - General]

Merged.
Thanks
Abner

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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112929): https://edk2.groups.io/g/devel/message/112929
Mute This Topic: https://groups.io/mt/103354119/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2023-12-27  2:54 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-24 22:59 [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 01/16] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 02/16] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 03/16] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 04/16] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 05/16] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 06/16] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
2023-12-26  1:12   ` Chang, Abner via groups.io
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 07/16] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 08/16] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 09/16] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 10/16] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
2023-12-26  1:14   ` Chang, Abner via groups.io
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 11/16] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 12/16] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 13/16] RedfishDiscoverDxe: add a helper function deallocating string resources Mike Maslenkin
2023-12-26  1:17   ` Chang, Abner via groups.io
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 14/16] RedfishDiscoverDxe: release resources when refreshing information data Mike Maslenkin
2023-12-26  1:20   ` Chang, Abner via groups.io
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
2023-12-26  1:22   ` Chang, Abner via groups.io
2023-12-24 22:59 ` [edk2-devel] [PATCH v3 16/16] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
2023-12-26  1:39   ` Chang, Abner via groups.io
2023-12-26  1:40 ` [edk2-devel] [PATCH v3 0/16] Redfish related fixes and improvements Chang, Abner via groups.io
2023-12-26 16:10   ` Mike Maslenkin
2023-12-27  2:54     ` Chang, Abner via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox