* [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements
@ 2023-12-14 23:24 Mike Maslenkin
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
` (13 more replies)
0 siblings, 14 replies; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
This is an exapanded version of the original set of 9 patches with
additional patch introducing brackets for IPv6 Redfish resource location
with required changes according to comments for the initial RFC patch.
PR: https://github.com/tianocore/edk2/pull/5149
diff from v1:
fixed typo double "that that"
removed variable declaration in block scope
added patches 10-13
removed unnecessary casts
added checks for memory allocation result
Cc: Abner Chang <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 (#112549): https://edk2.groups.io/g/devel/message/112549
Mute This Topic: https://groups.io/mt/103181035/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo.
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 2:32 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
` (12 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
PlatformHostInterfaceBmcUsbNicLib is the library instance name not
the class name.
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>
---
.../PlatformHostInterfaceBmcUsbNicLib.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
index 838a1721a7ae..3660249a3588 100644
--- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
+++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
@@ -14,7 +14,7 @@
FILE_GUID = C4837B58-225E-4352-8FDC-4C52A5D65891
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
- LIBRARY_CLASS = PlatformHostInterfaceBmcUsbNicLib
+ LIBRARY_CLASS = RedfishPlatformHostInterfaceLib
[Sources]
PlatformHostInterfaceBmcUsbNicLib.c
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112550): https://edk2.groups.io/g/devel/message/112550
Mute This Topic: https://groups.io/mt/103181036/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib library class name typo.
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 2:33 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
` (11 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
RedfishPlatformCredentialIpmiLib is the library instance name not the
class name.
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>
---
.../RedfishPlatformCredentialIpmiLib.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
index 5c20ea22f894..935461e1dcd0 100644
--- a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
+++ b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCredentialIpmiLib.inf
@@ -13,7 +13,7 @@
FILE_GUID = 9C45D622-4C66-417F-814C-F76246D97233
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
- LIBRARY_CLASS = RedfishPlatformCredentialIpmiLib
+ LIBRARY_CLASS = RedfishPlatformCredentialLib
[Sources]
RedfishPlatformCredentialIpmiLib.c
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112551): https://edk2.groups.io/g/devel/message/112551
Mute This Topic: https://groups.io/mt/103181037/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 2:38 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
` (10 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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: 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/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 (#112552): https://edk2.groups.io/g/devel/message/112552
Mute This Topic: https://groups.io/mt/103181038/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (2 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 2:44 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
` (9 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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: 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>
---
.../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index cbc65ba59408..f970e317b3f6 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -2057,9 +2057,7 @@ RedfishPlatformConfigProtocolGetConfigureLang (
TmpString = HiiGetRedfishString (StatementRef->Statement->ParentForm->ParentFormset->HiiHandle, FullSchema, StatementRef->Statement->Description);
ASSERT (TmpString != NULL);
if (TmpString != NULL) {
- TmpConfigureLangList[Index] = AllocateCopyPool (StrSize (TmpString), TmpString);
- ASSERT (TmpConfigureLangList[Index] != NULL);
- FreePool (TmpString);
+ TmpConfigureLangList[Index] = TmpString;
++Index;
}
}
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112553): https://edk2.groups.io/g/devel/message/112553
Mute This Topic: https://groups.io/mt/103181039/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (3 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 2:48 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
` (8 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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>
---
RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 06d8d00da7fb..e344e06d8dcc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -829,6 +829,10 @@ AddAndSignalNewRedfishService (
} while (TRUE);
}
+ if (Char16Uuid != NULL) {
+ FreePool (Char16Uuid);
+ }
+
if (NewFound || InfoRefresh) {
if (!InfoRefresh) {
DiscoveredList = (EFI_REDFISH_DISCOVERED_INTERNAL_LIST *)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_INTERNAL_LIST));
@@ -907,10 +911,6 @@ AddAndSignalNewRedfishService (
}
}
- if (Char16Uuid != NULL) {
- FreePool ((VOID *)Char16Uuid);
- }
-
Status = EFI_SUCCESS;
if (NewFound || InfoRefresh) {
//
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112554): https://edk2.groups.io/g/devel/message/112554
Mute This Topic: https://groups.io/mt/103181040/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (4 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 2:58 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
` (7 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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 | 216 ++++++++++++++++++
.../RedfishConfigHandlerDriver.c | 10 +-
.../RedfishConfigHandlerDriver.h | 4 +-
.../RedfishConfigHandlerDriver.inf | 1 +
4 files changed, 228 insertions(+), 3 deletions(-)
create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c
diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c b/RedfishPkg/RedfishConfigHandler/ComponentName.c
new file mode 100644
index 000000000000..c6b8b189f3e1
--- /dev/null
+++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
@@ -0,0 +1,218 @@
+/** @file
+ Implementation of EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PROTOCOL protocol
+ for EFI Refish Config Handler Protocol
+
+ Copyright (c) 2023, Mike Maslenkin <mike.maslenkin@gmail.com>
+
+ 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 (#112555): https://edk2.groups.io/g/devel/message/112555
Mute This Topic: https://groups.io/mt/103181041/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (5 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 3:27 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
` (6 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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: 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>
---
.../PlatformHostInterfaceBmcUsbNicLib.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index 7f295fe7f1c0..c73e76df5791 100644
--- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -616,9 +616,10 @@ HostInterfaceIpmiCheckMacAddress (
}
// Initial the get MAC address request.
- GetLanConfigReq.SetSelector = 0;
- GetLanConfigReq.BlockSelector = 0;
- GetLanConfigReq.ParameterSelector = IpmiLanMacAddress;
+ GetLanConfigReq.ChannelNumber.Uint8 = 0;
+ GetLanConfigReq.SetSelector = 0;
+ GetLanConfigReq.BlockSelector = 0;
+ GetLanConfigReq.ParameterSelector = IpmiLanMacAddress;
ExitStatus = EFI_NOT_FOUND;
for (ChannelNum = IPMI_CHANNEL_NUMBER_IMPLEMENTATION_SPECIFIC_1;
@@ -640,6 +641,7 @@ HostInterfaceIpmiCheckMacAddress (
} else {
DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, " No cached IPMI LAN info\n"));
DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, " Send NetFn = App, Command = 0x42 to channel %d\n", ChannelNum));
+ GetChanelInfoRequest.ChannelNumber.Uint8 = 0;
GetChanelInfoRequest.ChannelNumber.Bits.ChannelNo = (UINT8)ChannelNum;
Status = IpmiGetChannelInfo (
&GetChanelInfoRequest,
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112556): https://edk2.groups.io/g/devel/message/112556
Mute This Topic: https://groups.io/mt/103181042/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (6 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 3:30 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
` (5 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.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 (#112557): https://edk2.groups.io/g/devel/message/112557
Mute This Topic: https://groups.io/mt/103181043/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (7 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 3:29 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
` (4 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.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 (#112558): https://edk2.groups.io/g/devel/message/112558
Mute This Topic: https://groups.io/mt/103181044/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (8 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 4:25 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
` (3 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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..724aa35431a8 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -711,6 +711,69 @@ DiscoverRedfishHostInterface (
return Status;
}
+/**
+ The function initalizes particular strings into EFI_REDFISH_DISCOVERED_INFORMATION structure
+
+ @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION
+ @param[in] 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 (#112559): https://edk2.groups.io/g/devel/message/112559
Mute This Topic: https://groups.io/mt/103181045/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (9 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 4:27 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
` (2 subsequent siblings)
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin, Pedro Falcato
Cc: Abner Chang <abner.chang@amd.com>
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>
---
.../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 36 +++++++++----------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 724aa35431a8..e3fc2d809dbc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -730,12 +730,12 @@ VOID
InitInformationData (
IN EFI_REDFISH_DISCOVERED_INFORMATION *Information,
IN UINTN *RedfishVersion OPTIONAL,
- IN CHAR8 *RedfishLocation OPTIONAL,
- IN CHAR8 *Uuid OPTIONAL,
- IN CHAR8 *Os OPTIONAL,
- IN CHAR8 *OsVer OPTIONAL,
- IN CHAR8 *Product OPTIONAL,
- IN CHAR8 *ProductVer OPTIONAL
+ IN CONST CHAR8 *RedfishLocation OPTIONAL,
+ IN CONST CHAR8 *Uuid OPTIONAL,
+ IN CONST CHAR8 *Os OPTIONAL,
+ IN CONST CHAR8 *OsVer OPTIONAL,
+ IN CONST CHAR8 *Product OPTIONAL,
+ IN CONST CHAR8 *ProductVer OPTIONAL
)
{
if (RedfishVersion != NULL) {
@@ -744,33 +744,33 @@ InitInformationData (
}
if (RedfishLocation != NULL) {
- Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, Information->Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
+ Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
+ AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Information->Location));
}
if (Uuid != NULL) {
- Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, Information->Uuid, AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
+ Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
+ AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * sizeof (CHAR16));
DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
}
if (Os != NULL) {
- Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS ((const CHAR8 *)Os, Information->Os, AsciiStrSize ((const CHAR8 *)Os) * sizeof (CHAR16));
+ Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
+ AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof (CHAR16));
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", Information->Os, Information->OsVersion));
}
if (OsVer != NULL) {
- Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, Information->OsVersion, AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
+ Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof (CHAR16));
+ AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer) * sizeof (CHAR16));
}
if ((Product != NULL) && (ProductVer != NULL)) {
- Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS ((const CHAR8 *)Product, Information->Product, AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
- Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, Information->ProductVer, AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
+ Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof (CHAR16));
+ AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize (Product) * sizeof (CHAR16));
+ Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof (CHAR16));
+ AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize (ProductVer) * sizeof (CHAR16));
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", Information->Product, Information->ProductVer));
}
}
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112560): https://edk2.groups.io/g/devel/message/112560
Mute This Topic: https://groups.io/mt/103181047/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (10 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 4:32 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 UTC (permalink / raw)
To: devel; +Cc: abner.chang, nicklew, igork, Mike Maslenkin
Cache size of ASCII string in local variable.
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 | 34 ++++++++++++-------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index e3fc2d809dbc..3499a855570c 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -738,39 +738,47 @@ InitInformationData (
IN CONST CHAR8 *ProductVer OPTIONAL
)
{
+ UINTN AllocationSize;
+
if (RedfishVersion != NULL) {
Information->RedfishVersion = *RedfishVersion;
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", Information->RedfishVersion));
}
if (RedfishLocation != NULL) {
- Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
+ AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+ Information->Location = AllocatePool (AllocationSize);
+ AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AllocationSize);
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Information->Location));
}
if (Uuid != NULL) {
- Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * sizeof (CHAR16));
+ AllocationSize = AsciiStrSize (Uuid) * sizeof (CHAR16);
+ Information->Uuid = AllocatePool (AllocationSize);
+ AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
}
if (Os != NULL) {
- Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof (CHAR16));
- DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", Information->Os, Information->OsVersion));
+ AllocationSize = AsciiStrSize (Os) * sizeof (CHAR16);
+ Information->Os = AllocatePool (AllocationSize);
+ AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
}
if (OsVer != NULL) {
- Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer) * sizeof (CHAR16));
+ AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
+ Information->OsVersion = AllocatePool (AllocationSize);
+ AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
+ DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", Information->Os, Information->OsVersion));
}
if ((Product != NULL) && (ProductVer != NULL)) {
- Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize (Product) * sizeof (CHAR16));
- Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof (CHAR16));
- AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize (ProductVer) * sizeof (CHAR16));
+ AllocationSize = AsciiStrSize (Product) * sizeof (CHAR16);
+ Information->Product = AllocatePool (AllocationSize);
+ AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+ AllocationSize = AsciiStrSize (ProductVer) * sizeof (CHAR16);
+ Information->ProductVer = AllocatePool (AllocationSize);
+ AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AllocationSize);
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", Information->Product, Information->ProductVer));
}
}
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112561): https://edk2.groups.io/g/devel/message/112561
Mute This Topic: https://groups.io/mt/103181048/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions.
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (11 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 4:47 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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 | 85 ++++++++++++++++---
1 file changed, 75 insertions(+), 10 deletions(-)
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 3499a855570c..9d1678c3429e 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -748,38 +748,103 @@ InitInformationData (
if (RedfishLocation != NULL) {
AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
Information->Location = AllocatePool (AllocationSize);
- AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AllocationSize);
- DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Information->Location));
+ if (Information->Location != NULL) {
+ AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AllocationSize);
+ DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Information->Location));
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Can not allocate memory for Redfish service location: %a.\n",
+ __func__,
+ RedfishLocation
+ ));
+ }
}
if (Uuid != NULL) {
AllocationSize = AsciiStrSize (Uuid) * sizeof (CHAR16);
Information->Uuid = AllocatePool (AllocationSize);
- AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
- DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+ if (Information->Uuid != NULL) {
+ AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
+ DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid));
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Can not allocate memory for Service UUID: %a.\n",
+ __func__,
+ Uuid
+ ));
+ }
}
if (Os != NULL) {
AllocationSize = AsciiStrSize (Os) * sizeof (CHAR16);
Information->Os = AllocatePool (AllocationSize);
- AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
+ if (Information->Os != NULL) {
+ AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Can not allocate memory for Redfish service OS: %a.\n",
+ __func__,
+ Os
+ ));
+ }
}
if (OsVer != NULL) {
AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
Information->OsVersion = AllocatePool (AllocationSize);
- AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
- DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", Information->Os, Information->OsVersion));
+ if (Information->OsVersion != NULL) {
+ AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
+ DEBUG ((
+ DEBUG_MANAGEABILITY,
+ "Redfish service OS: %s, Version:%s.\n",
+ Information->Os,
+ Information->OsVersion
+ ));
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Can not allocate memory for Redfish OS Version:%a.\n",
+ __func__,
+ OsVer
+ ));
+ }
}
if ((Product != NULL) && (ProductVer != NULL)) {
AllocationSize = AsciiStrSize (Product) * sizeof (CHAR16);
Information->Product = AllocatePool (AllocationSize);
- AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+ if (Information->Product != NULL) {
+ AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Can not allocate memory for Redfish service product: %a.\n",
+ __func__,
+ Product
+ ));
+ }
+
AllocationSize = AsciiStrSize (ProductVer) * sizeof (CHAR16);
Information->ProductVer = AllocatePool (AllocationSize);
- AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AllocationSize);
- DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.\n", Information->Product, Information->ProductVer));
+ if (Information->ProductVer != NULL) {
+ AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AllocationSize);
+ DEBUG ((
+ DEBUG_MANAGEABILITY,
+ "Redfish service product: %s, Version:%s.\n",
+ Information->Product,
+ Information->ProductVer
+ ));
+ } else {
+ DEBUG ((
+ DEBUG_ERROR,
+ "%a: Can not allocate memory for Redfish service product Version: %a.\n",
+ __func__,
+ ProductVer
+ ));
+ }
}
}
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112562): https://edk2.groups.io/g/devel/message/112562
Mute This Topic: https://groups.io/mt/103181050/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] 32+ messages in thread
* [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
` (12 preceding siblings ...)
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
@ 2023-12-14 23:24 ` Mike Maslenkin
2023-12-18 4:58 ` Chang, Abner via groups.io
13 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-14 23:24 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 | 21 ++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 9d1678c3429e..38eaf4f6decc 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -715,6 +715,7 @@ DiscoverRedfishHostInterface (
The function initalizes particular strings into EFI_REDFISH_DISCOVERED_INFORMATION structure
@param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION
+ @param[in] 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.
@@ -729,6 +730,7 @@ STATIC
VOID
InitInformationData (
IN EFI_REDFISH_DISCOVERED_INFORMATION *Information,
+ IN BOOLEAN IsIpv6,
IN UINTN *RedfishVersion OPTIONAL,
IN CONST CHAR8 *RedfishLocation OPTIONAL,
IN CONST CHAR8 *Uuid OPTIONAL,
@@ -738,7 +740,8 @@ InitInformationData (
IN CONST CHAR8 *ProductVer OPTIONAL
)
{
- UINTN AllocationSize;
+ UINTN AllocationSize;
+ CONST CHAR8 *IpAddress;
if (RedfishVersion != NULL) {
Information->RedfishVersion = *RedfishVersion;
@@ -746,10 +749,21 @@ InitInformationData (
}
if (RedfishLocation != NULL) {
- AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+ AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
+ IpAddress = RedfishLocation;
+
+ if (IsIpv6) {
+ AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
+ }
+
Information->Location = AllocatePool (AllocationSize);
if (Information->Location != NULL) {
- AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AllocationSize);
+ if (IsIpv6) {
+ UnicodeSPrintAsciiFormat (Information->Location, AllocationSize, "[%a]", IpAddress);
+ } else {
+ AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AllocationSize);
+ }
+
DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Information->Location));
} else {
DEBUG ((
@@ -991,6 +1005,7 @@ AddAndSignalNewRedfishService (
InitInformationData (
&DiscoveredInstance->Information,
+ CheckIsIpVersion6 (NetworkInterface),
RedfishVersion,
RedfishLocation,
Uuid,
--
2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112563): https://edk2.groups.io/g/devel/message/112563
Mute This Topic: https://groups.io/mt/103181051/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] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo.
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
@ 2023-12-18 2:32 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 2:32 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: Friday, December 15, 2023 7:25 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 v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib
> library class name typo.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> PlatformHostInterfaceBmcUsbNicLib is the library instance name not
> the class name.
>
> 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>
> ---
> .../PlatformHostInterfaceBmcUsbNicLib.inf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.inf
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.inf
> index 838a1721a7ae..3660249a3588 100644
> ---
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.inf
> +++
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.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 (#112617): https://edk2.groups.io/g/devel/message/112617
Mute This Topic: https://groups.io/mt/103181036/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib library class name typo.
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
@ 2023-12-18 2:33 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 2:33 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: Friday, December 15, 2023 7:25 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 v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib library
> class name typo.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> RedfishPlatformCredentialIpmiLib is the library instance name not the
> class name.
>
> 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>
> ---
> .../RedfishPlatformCredentialIpmiLib.inf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCred
> entialIpmiLib.inf
> b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCred
> entialIpmiLib.inf
> index 5c20ea22f894..935461e1dcd0 100644
> ---
> a/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCred
> entialIpmiLib.inf
> +++
> b/RedfishPkg/Library/RedfishPlatformCredentialIpmiLib/RedfishPlatformCred
> entialIpmiLib.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 (#112618): https://edk2.groups.io/g/devel/message/112618
Mute This Topic: https://groups.io/mt/103181037/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
@ 2023-12-18 2:38 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 2:38 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[Public]
Not able to apply this patch from either email or group.io. You may want to try option "--transfer-encoding=8bit" when git send-email.
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 03/14] RedfishPkg: get rid of unused definitions from
> RedfishCrtLib.h
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> It seems that initial implementation of this header file is based on
> CrtLibSupport.h from CryptoPkg. But uid, euid, gid, egid and sa_family_t
> sre not used in RedfishPkg. So remove them.
>
> Also take "true" and "false" definition from MdePkg's LibFdtSupport.h
> header file, that also seems based on a header mentioned above.
>
> Cc: Abner Chang <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/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 (#112619): https://edk2.groups.io/g/devel/message/112619
Mute This Topic: https://groups.io/mt/103181038/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
@ 2023-12-18 2:44 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 2:44 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[Public]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce
> memory allocations
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> It's unclear why the new string is allocated as copy of the original
> string if its pointer is stored in an array and the original string
> is released immediately after the copy is created. All data allocated
> in the same pool.
>
> Cc: Abner Chang <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>
> ---
> .../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 (#112620): https://edk2.groups.io/g/devel/message/112620
Mute This Topic: https://groups.io/mt/103181039/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
@ 2023-12-18 2:48 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 2:48 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: Friday, December 15, 2023 7:25 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 v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak
> on error path.
>
> 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>
> ---
> 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 (#112621): https://edk2.groups.io/g/devel/message/112621
Mute This Topic: https://groups.io/mt/103181040/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
@ 2023-12-18 2:58 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 2:58 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
Hi Mike,
Not sure how do we have the copyright for individual contributor. Let me check with community.
And btw, you can in the patch format in below, there are additional blank line for each line. I believe you can use option " --transfer-encoding=8bit" to git send-email to resolve this problem.
Thanks
Abner
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 06/14] 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 | 216
> ++++++++++++++++++
> .../RedfishConfigHandlerDriver.c | 10 +-
> .../RedfishConfigHandlerDriver.h | 4 +-
> .../RedfishConfigHandlerDriver.inf | 1 +
> 4 files changed, 228 insertions(+), 3 deletions(-)
> create mode 100644 RedfishPkg/RedfishConfigHandler/ComponentName.c
>
> diff --git a/RedfishPkg/RedfishConfigHandler/ComponentName.c
> b/RedfishPkg/RedfishConfigHandler/ComponentName.c
> new file mode 100644
> index 000000000000..c6b8b189f3e1
> --- /dev/null
> +++ b/RedfishPkg/RedfishConfigHandler/ComponentName.c
> @@ -0,0 +1,218 @@
> +/** @file
>
> + Implementation of EFI_COMPONENT_NAME_PROTOCOL and
> EFI_COMPONENT_NAME2_PROTOCOL protocol
>
> + for EFI Refish Config Handler Protocol
>
> +
>
> + Copyright (c) 2023, Mike Maslenkin <mike.maslenkin@gmail.com>
>
> +
>
> + 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 (#112622): https://edk2.groups.io/g/devel/message/112622
Mute This Topic: https://groups.io/mt/103181041/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
@ 2023-12-18 3:27 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 3:27 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: Friday, December 15, 2023 7:25 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 v2 07/14] RedfishPkg: add proper initialization of IPMI
> request
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> All fields of IPMI_CHANNEL_INFO_CHANNEL_NUMBER union must be
> initialized to avoid error condition on BMC side.
>
> 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>
> ---
> .../PlatformHostInterfaceBmcUsbNicLib.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.c
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.c
> index 7f295fe7f1c0..c73e76df5791 100644
> ---
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.c
> +++
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInter
> faceBmcUsbNicLib.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 (#112624): https://edk2.groups.io/g/devel/message/112624
Mute This Topic: https://groups.io/mt/103181042/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
@ 2023-12-18 3:29 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 3:29 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: Friday, December 15, 2023 7:25 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 v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get
> rid of unused variable
>
> 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>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
> .../RedfishPlatformHostInterfaceLib.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git
> a/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHost
> InterfaceLib.c
> b/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHos
> tInterfaceLib.c
> index 4332caa71016..71b3dfc64358 100644
> ---
> a/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHost
> InterfaceLib.c
> +++
> b/EmulatorPkg/Library/RedfishPlatformHostInterfaceLib/RedfishPlatformHos
> tInterfaceLib.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 (#112625): https://edk2.groups.io/g/devel/message/112625
Mute This Topic: https://groups.io/mt/103181044/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
@ 2023-12-18 3:30 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 3:30 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: Friday, December 15, 2023 7:25 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 v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie ->
> PcdRedfishService
>
> 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>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.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|TR
> UE|BOOLEAN|0x00001020
>
> -
> gEmulatorPkgTokenSpaceGuid.PcdRedfishServieStopIfExitbootService|TRUE|
> BOOLEAN|0x00001021
>
> +
> gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceStopIfSecureBootDisabled|T
> RUE|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*|0x00
> 001022
>
> -
> gEmulatorPkgTokenSpaceGuid.PcdRedfishServiePassword|"pwd123456"|VOI
> D*|0x00001023
>
> +
> gEmulatorPkgTokenSpaceGuid.PcdRedfishServiceUserId|"admin"|VOID*|0x0
> 0001022
>
> +
> gEmulatorPkgTokenSpaceGuid.PcdRedfishServicePassword|"pwd123456"|V
> OID*|0x00001023
>
>
> gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize|0x4000000|UINT3
> 2|0x00001024
>
>
>
> [PcdsFixedAtBuild, PcdsPatchableInModule]
>
> diff --git
> a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.c
> b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.c
> index 614eaebb0d0e..5c167fcdea56 100644
> ---
> a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.c
> +++
> b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.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/RedfishPlatformCreden
> tialLib.inf
> b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.inf
> index 41c389c4a292..9d151f14ee17 100644
> ---
> a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.inf
> +++
> b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden
> tialLib.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 (#112626): https://edk2.groups.io/g/devel/message/112626
Mute This Topic: https://groups.io/mt/103181043/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
@ 2023-12-18 4:25 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 4:25 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 10/14] 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..724aa35431a8 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -711,6 +711,69 @@ DiscoverRedfishHostInterface (
> return Status;
>
> }
>
>
>
> +/**
>
> + The function initalizes particular strings into
> EFI_REDFISH_DISCOVERED_INFORMATION structure
>
> +
>
> + @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION
>
> + @param[in] 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));
Please use CONST instead of using const in this files as CONST is defined in Base.h.
Thanks
Abner
>
> + 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 (#112628): https://edk2.groups.io/g/devel/message/112628
Mute This Topic: https://groups.io/mt/103181045/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
@ 2023-12-18 4:27 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 4:27 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io
Cc: nicklew@nvidia.com, igork@ami.com, Pedro Falcato
[AMD Official Use Only - General]
After addressing comment on 10/14, Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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>; Pedro Falcato
> <pedro.falcato@gmail.com>
> Subject: [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(),
> remove unnecessary casts
>
> 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>
> Cc: Pedro Falcato <pedro.falcato@gmail.com>
> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.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 724aa35431a8..e3fc2d809dbc 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -730,12 +730,12 @@ VOID
> InitInformationData (
>
> IN EFI_REDFISH_DISCOVERED_INFORMATION *Information,
>
> IN UINTN *RedfishVersion OPTIONAL,
>
> - IN CHAR8 *RedfishLocation OPTIONAL,
>
> - IN CHAR8 *Uuid OPTIONAL,
>
> - IN CHAR8 *Os OPTIONAL,
>
> - IN CHAR8 *OsVer OPTIONAL,
>
> - IN CHAR8 *Product OPTIONAL,
>
> - IN CHAR8 *ProductVer OPTIONAL
>
> + IN CONST CHAR8 *RedfishLocation OPTIONAL,
>
> + IN CONST CHAR8 *Uuid OPTIONAL,
>
> + IN CONST CHAR8 *Os OPTIONAL,
>
> + IN CONST CHAR8 *OsVer OPTIONAL,
>
> + IN CONST CHAR8 *Product OPTIONAL,
>
> + IN CONST CHAR8 *ProductVer OPTIONAL
>
> )
>
> {
>
> if (RedfishVersion != NULL) {
>
> @@ -744,33 +744,33 @@ InitInformationData (
> }
>
>
>
> if (RedfishLocation != NULL) {
>
> - Information->Location = (CHAR16 *)AllocatePool (AsciiStrSize ((const
> CHAR8 *)RedfishLocation) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation, Information-
> >Location, AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
>
> + Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) *
> sizeof (CHAR16));
>
> + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AsciiStrSize (RedfishLocation) * sizeof (CHAR16));
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> }
>
>
>
> if (Uuid != NULL) {
>
> - Information->Uuid = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8
> *)Uuid) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS ((const CHAR8 *)Uuid, Information->Uuid,
> AsciiStrSize ((const CHAR8 *)Uuid) * sizeof (CHAR16));
>
> + Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
>
> + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) *
> sizeof (CHAR16));
>
> DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> }
>
>
>
> if (Os != NULL) {
>
> - Information->Os = (CHAR16 *)AllocatePool (AsciiStrSize ((const CHAR8
> *)Os) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS ((const CHAR8 *)Os, Information->Os, AsciiStrSize
> ((const CHAR8 *)Os) * sizeof (CHAR16));
>
> + Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
>
> + AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof
> (CHAR16));
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n",
> Information->Os, Information->OsVersion));
>
> }
>
>
>
> if (OsVer != NULL) {
>
> - Information->OsVersion = (CHAR16 *)AllocatePool (AsciiStrSize ((const
> CHAR8 *)OsVer) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS ((const CHAR8 *)OsVer, Information->OsVersion,
> AsciiStrSize ((const CHAR8 *)OsVer) * sizeof (CHAR16));
>
> + Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof
> (CHAR16));
>
> + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer)
> * sizeof (CHAR16));
>
> }
>
>
>
> if ((Product != NULL) && (ProductVer != NULL)) {
>
> - Information->Product = (CHAR16 *)AllocatePool (AsciiStrSize ((const
> CHAR8 *)Product) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS ((const CHAR8 *)Product, Information->Product,
> AsciiStrSize ((const CHAR8 *)Product) * sizeof (CHAR16));
>
> - Information->ProductVer = (CHAR16 *)AllocatePool (AsciiStrSize ((const
> CHAR8 *)ProductVer) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS ((const CHAR8 *)ProductVer, Information-
> >ProductVer, AsciiStrSize ((const CHAR8 *)ProductVer) * sizeof (CHAR16));
>
> + Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof
> (CHAR16));
>
> + AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize
> (Product) * sizeof (CHAR16));
>
> + Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof
> (CHAR16));
>
> + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize
> (ProductVer) * sizeof (CHAR16));
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> Version:%s.\n", Information->Product, Information->ProductVer));
>
> }
>
> }
>
> --
> 2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112629): https://edk2.groups.io/g/devel/message/112629
Mute This Topic: https://groups.io/mt/103181047/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
@ 2023-12-18 4:32 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 4:32 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
It's easy to read with this change.
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 12/14] RedfishDiscoverDxe: refine InitInformationData()
> function
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Cache size of ASCII string in local variable.
>
> 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 | 34 ++++++++++++-------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index e3fc2d809dbc..3499a855570c 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -738,39 +738,47 @@ InitInformationData (
> IN CONST CHAR8 *ProductVer OPTIONAL
>
> )
>
> {
>
> + UINTN AllocationSize;
>
> +
>
> if (RedfishVersion != NULL) {
>
> Information->RedfishVersion = *RedfishVersion;
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n",
> Information->RedfishVersion));
>
> }
>
>
>
> if (RedfishLocation != NULL) {
>
> - Information->Location = AllocatePool (AsciiStrSize (RedfishLocation) *
> sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AsciiStrSize
> (RedfishLocation) * sizeof (CHAR16));
>
> + AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
> + Information->Location = AllocatePool (AllocationSize);
>
> + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> }
>
>
>
> if (Uuid != NULL) {
>
> - Information->Uuid = AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * sizeof
> (CHAR16));
>
> + AllocationSize = AsciiStrSize (Uuid) * sizeof (CHAR16);
>
> + Information->Uuid = AllocatePool (AllocationSize);
>
> + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
>
> DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> }
>
>
>
> if (Os != NULL) {
>
> - Information->Os = AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16));
>
> - AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof
> (CHAR16));
>
> - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n",
> Information->Os, Information->OsVersion));
>
> + AllocationSize = AsciiStrSize (Os) * sizeof (CHAR16);
>
> + Information->Os = AllocatePool (AllocationSize);
>
> + AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
>
> }
>
>
>
> if (OsVer != NULL) {
>
> - Information->OsVersion = AllocatePool (AsciiStrSize (OsVer) * sizeof
> (CHAR16));
>
> - AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (OsVer)
> * sizeof (CHAR16));
>
> + AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
>
> + Information->OsVersion = AllocatePool (AllocationSize);
>
> + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
>
> + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s,
> Version:%s.\n", Information->Os, Information->OsVersion));
>
> }
>
>
>
> if ((Product != NULL) && (ProductVer != NULL)) {
>
> - Information->Product = AllocatePool (AsciiStrSize (Product) * sizeof
> (CHAR16));
>
> - AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize
> (Product) * sizeof (CHAR16));
>
> - Information->ProductVer = AllocatePool (AsciiStrSize (ProductVer) * sizeof
> (CHAR16));
>
> - AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSize
> (ProductVer) * sizeof (CHAR16));
>
> + AllocationSize = AsciiStrSize (Product) * sizeof (CHAR16);
>
> + Information->Product = AllocatePool (AllocationSize);
>
> + AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
>
> + AllocationSize = AsciiStrSize (ProductVer) * sizeof (CHAR16);
>
> + Information->ProductVer = AllocatePool (AllocationSize);
>
> + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> AllocationSize);
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> Version:%s.\n", Information->Product, Information->ProductVer));
>
> }
>
> }
>
> --
> 2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112630): https://edk2.groups.io/g/devel/message/112630
Mute This Topic: https://groups.io/mt/103181048/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions.
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
@ 2023-12-18 4:47 ` Chang, Abner via groups.io
2023-12-19 2:12 ` Mike Maslenkin
0 siblings, 1 reply; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 4:47 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 13/14] RedfishDiscoverDxe: handle memory allocation
> error conditions.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Cc: Abner Chang <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 | 85 ++++++++++++++++---
> 1 file changed, 75 insertions(+), 10 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 3499a855570c..9d1678c3429e 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -748,38 +748,103 @@ InitInformationData (
> if (RedfishLocation != NULL) {
>
> AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
> Information->Location = AllocatePool (AllocationSize);
>
> - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> + if (Information->Location != NULL) {
>
> + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> + } else {
>
> + DEBUG ((
>
> + DEBUG_ERROR,
>
> + "%a: Can not allocate memory for Redfish service location: %a.\n",
>
> + __func__,
>
> + RedfishLocation
>
> + ));
>
> + }
>
> }
>
>
>
> if (Uuid != NULL) {
>
> AllocationSize = AsciiStrSize (Uuid) * sizeof (CHAR16);
>
> Information->Uuid = AllocatePool (AllocationSize);
>
> - AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
>
> - DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> + if (Information->Uuid != NULL) {
>
> + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
>
> + DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> >Uuid));
>
> + } else {
>
> + DEBUG ((
>
> + DEBUG_ERROR,
>
> + "%a: Can not allocate memory for Service UUID: %a.\n",
>
> + __func__,
>
> + Uuid
>
> + ));
>
> + }
>
> }
>
>
>
> if (Os != NULL) {
>
> AllocationSize = AsciiStrSize (Os) * sizeof (CHAR16);
>
> Information->Os = AllocatePool (AllocationSize);
>
> - AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
>
> + if (Information->Os != NULL) {
>
> + AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
>
> + } else {
>
> + DEBUG ((
>
> + DEBUG_ERROR,
>
> + "%a: Can not allocate memory for Redfish service OS: %a.\n",
>
> + __func__,
>
> + Os
>
> + ));
>
> + }
>
> }
>
>
>
> if (OsVer != NULL) {
>
> AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
>
> Information->OsVersion = AllocatePool (AllocationSize);
>
> - AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
>
> - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n",
> Information->Os, Information->OsVersion));
>
> + if (Information->OsVersion != NULL) {
>
> + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
>
> + DEBUG ((
>
> + DEBUG_MANAGEABILITY,
>
> + "Redfish service OS: %s, Version:%s.\n",
Jus a note here: We expect the debug message will be <null string> for the case when Information->Os is NULL.
>
> + 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)) {
Not for your change, but could you please help to remove this check? I think we can have a consistent code as Os/OsVer, just print out the product information separately.
Thanks
Abner
>
> AllocationSize = AsciiStrSize (Product) * sizeof (CHAR16);
>
> Information->Product = AllocatePool (AllocationSize);
>
> - AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
>
> + if (Information->Product != NULL) {
>
> + AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
>
> + } else {
>
> + DEBUG ((
>
> + DEBUG_ERROR,
>
> + "%a: Can not allocate memory for Redfish service product: %a.\n",
>
> + __func__,
>
> + Product
>
> + ));
>
> + }
>
> +
>
> AllocationSize = AsciiStrSize (ProductVer) * sizeof (CHAR16);
>
> Information->ProductVer = AllocatePool (AllocationSize);
>
> - AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> AllocationSize);
>
> - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> Version:%s.\n", Information->Product, Information->ProductVer));
>
> + if (Information->ProductVer != NULL) {
>
> + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> AllocationSize);
>
> + DEBUG ((
>
> + DEBUG_MANAGEABILITY,
>
> + "Redfish service product: %s, Version:%s.\n",
>
> + Information->Product,
>
> + Information->ProductVer
>
> + ));
>
> + } else {
>
> + DEBUG ((
>
> + DEBUG_ERROR,
>
> + "%a: Can not allocate memory for Redfish service product Version:
> %a.\n",
>
> + __func__,
>
> + ProductVer
>
> + ));
>
> + }
>
> }
>
> }
>
>
>
> --
> 2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112631): https://edk2.groups.io/g/devel/message/112631
Mute This Topic: https://groups.io/mt/103181050/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
@ 2023-12-18 4:58 ` Chang, Abner via groups.io
2023-12-19 2:51 ` Mike Maslenkin
0 siblings, 1 reply; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-18 4:58 UTC (permalink / raw)
To: Mike Maslenkin, devel@edk2.groups.io; +Cc: nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Friday, December 15, 2023 7:25 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 v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to
> URI for IPv6 addresses
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> URI is generated based on the RedfishLocation containing an ASCII string
> representing the IP address. So, in the case of IPv4 the canonical
> representation of an IPv4 address was inserted into the resulting Unicode
> string i.e: "http{,s}://X.X.X.X/".
>
> In the case of IPv6, to access resources, the IP address must be specified
> in brackets, i.e. the resulting string should look like:
> "http{,s}://[X::X:X:X:X]/".
>
> Cc: Abner Chang <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 | 21 ++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 9d1678c3429e..38eaf4f6decc 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -715,6 +715,7 @@ DiscoverRedfishHostInterface (
> The function initalizes particular strings into
> EFI_REDFISH_DISCOVERED_INFORMATION structure
>
>
>
> @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION
>
> + @param[in] 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.
>
> @@ -729,6 +730,7 @@ STATIC
> VOID
>
> InitInformationData (
>
> IN EFI_REDFISH_DISCOVERED_INFORMATION *Information,
>
> + IN BOOLEAN IsIpv6,
>
> IN UINTN *RedfishVersion OPTIONAL,
>
> IN CONST CHAR8 *RedfishLocation OPTIONAL,
>
> IN CONST CHAR8 *Uuid OPTIONAL,
>
> @@ -738,7 +740,8 @@ InitInformationData (
> IN CONST CHAR8 *ProductVer OPTIONAL
>
> )
>
> {
>
> - UINTN AllocationSize;
>
> + UINTN AllocationSize;
>
> + CONST CHAR8 *IpAddress;
>
>
>
> if (RedfishVersion != NULL) {
>
> Information->RedfishVersion = *RedfishVersion;
>
> @@ -746,10 +749,21 @@ InitInformationData (
> }
>
>
>
> if (RedfishLocation != NULL) {
>
> - AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
> + AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
>
> + IpAddress = RedfishLocation;
Not quite understand why do we need a copy of RedfishLocation in IpAddress?
I think we can use RedfishLocation for UnicodeSPrintAsciiFormat later, right?
Thanks
Abner
>
> +
>
> + if (IsIpv6) {
>
> + AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
>
> + }
>
> +
>
> Information->Location = AllocatePool (AllocationSize);
>
> if (Information->Location != NULL) {
>
> - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> + if (IsIpv6) {
>
> + UnicodeSPrintAsciiFormat (Information->Location, AllocationSize,
> "[%a]", IpAddress);
>
> + } else {
>
> + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> AllocationSize);
>
> + }
>
> +
>
> DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> Information->Location));
>
> } else {
>
> DEBUG ((
>
> @@ -991,6 +1005,7 @@ AddAndSignalNewRedfishService (
>
>
> InitInformationData (
>
> &DiscoveredInstance->Information,
>
> + CheckIsIpVersion6 (NetworkInterface),
>
> RedfishVersion,
>
> RedfishLocation,
>
> Uuid,
>
> --
> 2.32.0 (Apple Git-132)
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112632): https://edk2.groups.io/g/devel/message/112632
Mute This Topic: https://groups.io/mt/103181051/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions.
2023-12-18 4:47 ` Chang, Abner via groups.io
@ 2023-12-19 2:12 ` Mike Maslenkin
2023-12-19 4:03 ` Chang, Abner via groups.io
0 siblings, 1 reply; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-19 2:12 UTC (permalink / raw)
To: Chang, Abner; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com
Hi Abner,
On Mon, Dec 18, 2023 at 7:47 AM Chang, Abner <Abner.Chang@amd.com> wrote:
>
> [AMD Official Use Only - General]
>
> > -----Original Message-----
> > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > Sent: Friday, December 15, 2023 7:25 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 v2 13/14] RedfishDiscoverDxe: handle memory allocation
> > error conditions.
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Cc: Abner Chang <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 | 85 ++++++++++++++++---
> > 1 file changed, 75 insertions(+), 10 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 3499a855570c..9d1678c3429e 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > @@ -748,38 +748,103 @@ InitInformationData (
> > if (RedfishLocation != NULL) {
> >
> > AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
> >
> > Information->Location = AllocatePool (AllocationSize);
> >
> > - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > Information->Location));
> >
> > + if (Information->Location != NULL) {
> >
> > + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > Information->Location));
> >
> > + } else {
> >
> > + DEBUG ((
> >
> > + DEBUG_ERROR,
> >
> > + "%a: Can not allocate memory for Redfish service location: %a.\n",
> >
> > + __func__,
> >
> > + RedfishLocation
> >
> > + ));
> >
> > + }
> >
> > }
> >
> >
> >
> > if (Uuid != NULL) {
> >
> > AllocationSize = AsciiStrSize (Uuid) * sizeof (CHAR16);
> >
> > Information->Uuid = AllocatePool (AllocationSize);
> >
> > - AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
> >
> > - DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> > >Uuid));
> >
> > + if (Information->Uuid != NULL) {
> >
> > + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
> >
> > + DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> > >Uuid));
> >
> > + } else {
> >
> > + DEBUG ((
> >
> > + DEBUG_ERROR,
> >
> > + "%a: Can not allocate memory for Service UUID: %a.\n",
> >
> > + __func__,
> >
> > + Uuid
> >
> > + ));
> >
> > + }
> >
> > }
> >
> >
> >
> > if (Os != NULL) {
> >
> > AllocationSize = AsciiStrSize (Os) * sizeof (CHAR16);
> >
> > Information->Os = AllocatePool (AllocationSize);
> >
> > - AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
> >
> > + if (Information->Os != NULL) {
> >
> > + AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
> >
> > + } else {
> >
> > + DEBUG ((
> >
> > + DEBUG_ERROR,
> >
> > + "%a: Can not allocate memory for Redfish service OS: %a.\n",
> >
> > + __func__,
> >
> > + Os
> >
> > + ));
> >
> > + }
> >
> > }
> >
> >
> >
> > if (OsVer != NULL) {
> >
> > AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
> >
> > Information->OsVersion = AllocatePool (AllocationSize);
> >
> > - AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
> >
> > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n",
> > Information->Os, Information->OsVersion));
> >
> > + if (Information->OsVersion != NULL) {
> >
> > + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
> >
> > + DEBUG ((
> >
> > + DEBUG_MANAGEABILITY,
> >
> > + "Redfish service OS: %s, Version:%s.\n",
>
> Jus a note here: We expect the debug message will be <null string> for the case when Information->Os is NULL.
Not sure I understood right, but there is no problem with this at this time.
But I see this patch is bad.
1. Did original code print OsVer correctly at all?
There were two conditions:
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));
}
So, in scope of the first condition
DiscoveredInstance->Information.OsVersion could be NULL, unless it was
a second call for "InfoRefresh".
But anyway, it's not clear why on info refresh Os matches to the old OsVer.
I would suggest to change the order of these conditions.
2. From said above, this patch doesn't take into account (as well as
original code) the case of "InfoRefresh" when DiscoveredInstance
wasn't allocated but taken from a some list and all string resources
could be allocated previously. It seems these resource must be freed
before allocating it again for refreshed values.
Hm... not a great to have smth like the following for every string:
if (OsVer != NULL) {
AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
if (DiscoveredInstance->Information.OsVersion != NULL) {
FreePool (DiscoveredInstance->Information.OsVersion);
}
DiscoveredInstance->Information.OsVersion = AllocatePool (AllocationSize);
if (DiscoveredInstance->Information.OsVersion != NULL) {
AsciiStrToUnicodeStrS (OsVer,
DiscoveredInstance->Information.OsVersion, AllocationSize);
} else {
DEBUG ((
DEBUG_ERROR,
"%a: Can not allocate memory for Redfish OS Version:%a.\n",
__func__,
OsVer
));
}
}
Can I assume that on info refresh it is possible to deallocate all
strings stored into this Information structure?
In this case a simple helper function deallocating strings could be
implemented and then also used here:
https://github.com/tianocore/edk2/blob/master/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c#L1469
>
> >
> > + 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)) {
>
> Not for your change, but could you please help to remove this check? I think we can have a consistent code as Os/OsVer, just print out the product information separately.
>
Ok.
>
> Thanks
> Abner
>
>
> >
> > AllocationSize = AsciiStrSize (Product) * sizeof (CHAR16);
> >
> > Information->Product = AllocatePool (AllocationSize);
> >
> > - AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
> >
> > + if (Information->Product != NULL) {
> >
> > + AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
> >
> > + } else {
> >
> > + DEBUG ((
> >
> > + DEBUG_ERROR,
> >
> > + "%a: Can not allocate memory for Redfish service product: %a.\n",
> >
> > + __func__,
> >
> > + Product
> >
> > + ));
> >
> > + }
> >
> > +
> >
> > AllocationSize = AsciiStrSize (ProductVer) * sizeof (CHAR16);
> >
> > Information->ProductVer = AllocatePool (AllocationSize);
> >
> > - AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> > AllocationSize);
> >
> > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> > Version:%s.\n", Information->Product, Information->ProductVer));
> >
> > + if (Information->ProductVer != NULL) {
> >
> > + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> > AllocationSize);
> >
> > + DEBUG ((
> >
> > + DEBUG_MANAGEABILITY,
> >
> > + "Redfish service product: %s, Version:%s.\n",
> >
> > + Information->Product,
> >
> > + Information->ProductVer
> >
> > + ));
> >
> > + } else {
> >
> > + DEBUG ((
> >
> > + DEBUG_ERROR,
> >
> > + "%a: Can not allocate memory for Redfish service product Version:
> > %a.\n",
> >
> > + __func__,
> >
> > + ProductVer
> >
> > + ));
> >
> > + }
> >
> > }
> >
> > }
> >
> >
> >
> > --
> > 2.32.0 (Apple Git-132)
>
As you requested, I have created a bug for this issue:
https://bugzilla.tianocore.org/show_bug.cgi?id=4625
Regards,
Mike
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112664): https://edk2.groups.io/g/devel/message/112664
Mute This Topic: https://groups.io/mt/103181050/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
2023-12-18 4:58 ` Chang, Abner via groups.io
@ 2023-12-19 2:51 ` Mike Maslenkin
0 siblings, 0 replies; 32+ messages in thread
From: Mike Maslenkin @ 2023-12-19 2:51 UTC (permalink / raw)
To: Chang, Abner; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com
Hi Abner,
On Mon, Dec 18, 2023 at 7:58 AM Chang, Abner <Abner.Chang@amd.com> wrote:
>
> [AMD Official Use Only - General]
>
> > -----Original Message-----
> > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > Sent: Friday, December 15, 2023 7:25 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 v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to
> > URI for IPv6 addresses
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > URI is generated based on the RedfishLocation containing an ASCII string
> > representing the IP address. So, in the case of IPv4 the canonical
> > representation of an IPv4 address was inserted into the resulting Unicode
> > string i.e: "http{,s}://X.X.X.X/".
> >
> > In the case of IPv6, to access resources, the IP address must be specified
> > in brackets, i.e. the resulting string should look like:
> > "http{,s}://[X::X:X:X:X]/".
> >
> > Cc: Abner Chang <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 | 21 ++++++++++++++++---
> > 1 file changed, 18 insertions(+), 3 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 9d1678c3429e..38eaf4f6decc 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > @@ -715,6 +715,7 @@ DiscoverRedfishHostInterface (
> > The function initalizes particular strings into
> > EFI_REDFISH_DISCOVERED_INFORMATION structure
> >
> >
> >
> > @param[in] Information EFI_REDFISH_DISCOVERED_INFORMATION
> >
> > + @param[in] 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.
> >
> > @@ -729,6 +730,7 @@ STATIC
> > VOID
> >
> > InitInformationData (
> >
> > IN EFI_REDFISH_DISCOVERED_INFORMATION *Information,
> >
> > + IN BOOLEAN IsIpv6,
> >
> > IN UINTN *RedfishVersion OPTIONAL,
> >
> > IN CONST CHAR8 *RedfishLocation OPTIONAL,
> >
> > IN CONST CHAR8 *Uuid OPTIONAL,
> >
> > @@ -738,7 +740,8 @@ InitInformationData (
> > IN CONST CHAR8 *ProductVer OPTIONAL
> >
> > )
> >
> > {
> >
> > - UINTN AllocationSize;
> >
> > + UINTN AllocationSize;
> >
> > + CONST CHAR8 *IpAddress;
> >
> >
> >
> > if (RedfishVersion != NULL) {
> >
> > Information->RedfishVersion = *RedfishVersion;
> >
> > @@ -746,10 +749,21 @@ InitInformationData (
> > }
> >
> >
> >
> > if (RedfishLocation != NULL) {
> >
> > - AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
> >
> > + AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
> >
> > + IpAddress = RedfishLocation;
> Not quite understand why do we need a copy of RedfishLocation in IpAddress?
> I think we can use RedfishLocation for UnicodeSPrintAsciiFormat later, right?
I'll remove IpAddress variable.
It was added into initial RFC as a minimal change reducing a number of
type casts.
It was also added as self-describing code to show we are supposed to
be dealing with RedfishLocation in IP address string format and not
anything else.
> Thanks
> Abner
>
> >
> > +
> >
> > + if (IsIpv6) {
> >
> > + AllocationSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
> >
> > + }
> >
> > +
> >
> > Information->Location = AllocatePool (AllocationSize);
> >
> > if (Information->Location != NULL) {
> >
> > - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > + if (IsIpv6) {
> >
> > + UnicodeSPrintAsciiFormat (Information->Location, AllocationSize,
> > "[%a]", IpAddress);
> >
> > + } else {
> >
> > + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > AllocationSize);
> >
> > + }
> >
> > +
> >
> > DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > Information->Location));
> >
> > } else {
> >
> > DEBUG ((
> >
> > @@ -991,6 +1005,7 @@ AddAndSignalNewRedfishService (
> >
> >
> > InitInformationData (
> >
> > &DiscoveredInstance->Information,
> >
> > + CheckIsIpVersion6 (NetworkInterface),
> >
> > RedfishVersion,
> >
> > RedfishLocation,
> >
> > Uuid,
> >
> > --
> > 2.32.0 (Apple Git-132)
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112667): https://edk2.groups.io/g/devel/message/112667
Mute This Topic: https://groups.io/mt/103181051/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions.
2023-12-19 2:12 ` Mike Maslenkin
@ 2023-12-19 4:03 ` Chang, Abner via groups.io
0 siblings, 0 replies; 32+ messages in thread
From: Chang, Abner via groups.io @ 2023-12-19 4:03 UTC (permalink / raw)
To: Mike Maslenkin; +Cc: devel@edk2.groups.io, nicklew@nvidia.com, igork@ami.com
[AMD Official Use Only - General]
> -----Original Message-----
> From: Mike Maslenkin <mike.maslenkin@gmail.com>
> Sent: Tuesday, December 19, 2023 10:12 AM
> To: Chang, Abner <Abner.Chang@amd.com>
> Cc: devel@edk2.groups.io; nicklew@nvidia.com; igork@ami.com
> Subject: Re: [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation
> error conditions.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi Abner,
>
> On Mon, Dec 18, 2023 at 7:47 AM Chang, Abner <Abner.Chang@amd.com>
> wrote:
> >
> > [AMD Official Use Only - General]
> >
> > > -----Original Message-----
> > > From: Mike Maslenkin <mike.maslenkin@gmail.com>
> > > Sent: Friday, December 15, 2023 7:25 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 v2 13/14] RedfishDiscoverDxe: handle memory allocation
> > > error conditions.
> > >
> > > Caution: This message originated from an External Source. Use proper
> caution
> > > when opening attachments, clicking links, or responding.
> > >
> > >
> > > Cc: Abner Chang <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 | 85 ++++++++++++++++--
> -
> > > 1 file changed, 75 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > index 3499a855570c..9d1678c3429e 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > @@ -748,38 +748,103 @@ InitInformationData (
> > > if (RedfishLocation != NULL) {
> > >
> > > AllocationSize = AsciiStrSize (RedfishLocation) * sizeof (CHAR16);
> > >
> > > Information->Location = AllocatePool (AllocationSize);
> > >
> > > - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > > AllocationSize);
> > >
> > > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > > Information->Location));
> > >
> > > + if (Information->Location != NULL) {
> > >
> > > + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location,
> > > AllocationSize);
> > >
> > > + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> > > Information->Location));
> > >
> > > + } else {
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_ERROR,
> > >
> > > + "%a: Can not allocate memory for Redfish service location: %a.\n",
> > >
> > > + __func__,
> > >
> > > + RedfishLocation
> > >
> > > + ));
> > >
> > > + }
> > >
> > > }
> > >
> > >
> > >
> > > if (Uuid != NULL) {
> > >
> > > AllocationSize = AsciiStrSize (Uuid) * sizeof (CHAR16);
> > >
> > > Information->Uuid = AllocatePool (AllocationSize);
> > >
> > > - AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
> > >
> > > - DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information-
> > > >Uuid));
> > >
> > > + if (Information->Uuid != NULL) {
> > >
> > > + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize);
> > >
> > > + DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n",
> Information-
> > > >Uuid));
> > >
> > > + } else {
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_ERROR,
> > >
> > > + "%a: Can not allocate memory for Service UUID: %a.\n",
> > >
> > > + __func__,
> > >
> > > + Uuid
> > >
> > > + ));
> > >
> > > + }
> > >
> > > }
> > >
> > >
> > >
> > > if (Os != NULL) {
> > >
> > > AllocationSize = AsciiStrSize (Os) * sizeof (CHAR16);
> > >
> > > Information->Os = AllocatePool (AllocationSize);
> > >
> > > - AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
> > >
> > > + if (Information->Os != NULL) {
> > >
> > > + AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize);
> > >
> > > + } else {
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_ERROR,
> > >
> > > + "%a: Can not allocate memory for Redfish service OS: %a.\n",
> > >
> > > + __func__,
> > >
> > > + Os
> > >
> > > + ));
> > >
> > > + }
> > >
> > > }
> > >
> > >
> > >
> > > if (OsVer != NULL) {
> > >
> > > AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
> > >
> > > Information->OsVersion = AllocatePool (AllocationSize);
> > >
> > > - AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize);
> > >
> > > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s,
> Version:%s.\n",
> > > Information->Os, Information->OsVersion));
> > >
> > > + if (Information->OsVersion != NULL) {
> > >
> > > + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion,
> AllocationSize);
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_MANAGEABILITY,
> > >
> > > + "Redfish service OS: %s, Version:%s.\n",
> >
> > Jus a note here: We expect the debug message will be <null string> for the
> case when Information->Os is NULL.
>
> Not sure I understood right, but there is no problem with this at this time.
> But I see this patch is bad.
> 1. Did original code print OsVer correctly at all?
>
> There were two conditions:
>
> 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));
> }
>
> So, in scope of the first condition
> DiscoveredInstance->Information.OsVersion could be NULL, unless it was
> a second call for "InfoRefresh".
> But anyway, it's not clear why on info refresh Os matches to the old OsVer.
Ok, here is the history when I was implemented this code with Redfish discovery on both Redfish host interface and SSDP in HPE lab. Many Redfish services were discovered and one of them is also indicated by Redfish host interface. We have an upper layer EFI Redfish application to discover Redfish via both methodologies. However, we didn’t upstream SSDP code to opensource. I think InfoRefresh was not removed back to that moment.
> I would suggest to change the order of these conditions.
I think the code for Product and ProductInfo is not good also. We can also make it similar to Os and OsVer.
>
> 2. From said above, this patch doesn't take into account (as well as
> original code) the case of "InfoRefresh" when DiscoveredInstance
> wasn't allocated but taken from a some list and all string resources
> could be allocated previously. It seems these resource must be freed
> before allocating it again for refreshed values.
> Hm... not a great to have smth like the following for every string:
> if (OsVer != NULL) {
> AllocationSize = AsciiStrSize (OsVer) * sizeof (CHAR16);
> if (DiscoveredInstance->Information.OsVersion != NULL) {
> FreePool (DiscoveredInstance->Information.OsVersion);
> }
> DiscoveredInstance->Information.OsVersion = AllocatePool
> (AllocationSize);
> if (DiscoveredInstance->Information.OsVersion != NULL) {
> AsciiStrToUnicodeStrS (OsVer,
> DiscoveredInstance->Information.OsVersion, AllocationSize);
> } else {
> DEBUG ((
> DEBUG_ERROR,
> "%a: Can not allocate memory for Redfish OS Version:%a.\n",
> __func__,
> OsVer
> ));
> }
> }
>
> Can I assume that on info refresh it is possible to deallocate all
> strings stored into this Information structure?
I think here we have two ways, however I prefer the latter.
1. Remove InfoRefresh, but we have to revisit the call if one day someone contribute SSDP. I believe I can’t upstream that code because legal issue as we didn't opensource SSDP code when I was with HPE.
2. Deallocate memory when InfoRefresh.
I would leave this to you, I am fine if you choose #1.
Thanks
Abner
> In this case a simple helper function deallocating strings could be
> implemented and then also used here:
> https://github.com/tianocore/edk2/blob/master/RedfishPkg/RedfishDiscove
> rDxe/RedfishDiscoverDxe.c#L1469
>
> >
> > >
> > > + 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)) {
> >
> > Not for your change, but could you please help to remove this check? I think
> we can have a consistent code as Os/OsVer, just print out the product
> information separately.
> >
>
> Ok.
>
> >
> > Thanks
> > Abner
> >
> >
> > >
> > > AllocationSize = AsciiStrSize (Product) * sizeof (CHAR16);
> > >
> > > Information->Product = AllocatePool (AllocationSize);
> > >
> > > - AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize);
> > >
> > > + if (Information->Product != NULL) {
> > >
> > > + AsciiStrToUnicodeStrS (Product, Information->Product,
> AllocationSize);
> > >
> > > + } else {
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_ERROR,
> > >
> > > + "%a: Can not allocate memory for Redfish service product: %a.\n",
> > >
> > > + __func__,
> > >
> > > + Product
> > >
> > > + ));
> > >
> > > + }
> > >
> > > +
> > >
> > > AllocationSize = AsciiStrSize (ProductVer) * sizeof (CHAR16);
> > >
> > > Information->ProductVer = AllocatePool (AllocationSize);
> > >
> > > - AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> > > AllocationSize);
> > >
> > > - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s,
> > > Version:%s.\n", Information->Product, Information->ProductVer));
> > >
> > > + if (Information->ProductVer != NULL) {
> > >
> > > + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer,
> > > AllocationSize);
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_MANAGEABILITY,
> > >
> > > + "Redfish service product: %s, Version:%s.\n",
> > >
> > > + Information->Product,
> > >
> > > + Information->ProductVer
> > >
> > > + ));
> > >
> > > + } else {
> > >
> > > + DEBUG ((
> > >
> > > + DEBUG_ERROR,
> > >
> > > + "%a: Can not allocate memory for Redfish service product Version:
> > > %a.\n",
> > >
> > > + __func__,
> > >
> > > + ProductVer
> > >
> > > + ));
> > >
> > > + }
> > >
> > > }
> > >
> > > }
> > >
> > >
> > >
> > > --
> > > 2.32.0 (Apple Git-132)
> >
>
> As you requested, I have created a bug for this issue:
> https://bugzilla.tianocore.org/show_bug.cgi?id=4625
>
>
> Regards,
> Mike
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112684): https://edk2.groups.io/g/devel/message/112684
Mute This Topic: https://groups.io/mt/103181050/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2023-12-19 4:04 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-14 23:24 [edk2-devel] [PATCH v2 0/14] Redfish related fixes and improvements Mike Maslenkin
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 01/14] RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo Mike Maslenkin
2023-12-18 2:32 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 02/14] RedfishPkg: fix RedfishPlatformCredentialLib " Mike Maslenkin
2023-12-18 2:33 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 03/14] RedfishPkg: get rid of unused definitions from RedfishCrtLib.h Mike Maslenkin
2023-12-18 2:38 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 04/14] RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations Mike Maslenkin
2023-12-18 2:44 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 05/14] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path Mike Maslenkin
2023-12-18 2:48 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 06/14] RedfishPkg: add Component Name protocols to RedfishConfigHandler driver Mike Maslenkin
2023-12-18 2:58 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 07/14] RedfishPkg: add proper initialization of IPMI request Mike Maslenkin
2023-12-18 3:27 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 08/14] EmulatorPkg: fix typo. PcdRedfishServie -> PcdRedfishService Mike Maslenkin
2023-12-18 3:30 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 09/14] EmulatorPkg: RedfishPlatformHostInterfaceLib: get rid of unused variable Mike Maslenkin
2023-12-18 3:29 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 10/14] RedfishDiscoverDxe: introduce InitInformationData helper function Mike Maslenkin
2023-12-18 4:25 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 11/14] RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts Mike Maslenkin
2023-12-18 4:27 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Mike Maslenkin
2023-12-18 4:32 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 13/14] RedfishDiscoverDxe: handle memory allocation error conditions Mike Maslenkin
2023-12-18 4:47 ` Chang, Abner via groups.io
2023-12-19 2:12 ` Mike Maslenkin
2023-12-19 4:03 ` Chang, Abner via groups.io
2023-12-14 23:24 ` [edk2-devel] [PATCH v2 14/14] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
2023-12-18 4:58 ` Chang, Abner via groups.io
2023-12-19 2:51 ` Mike Maslenkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox