* [edk2-devel] [edk2-redfish-client][PATCH 2/6] RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement.
@ 2023-11-23 14:33 Nickle Wang via groups.io
2023-11-28 3:19 ` Chang, Abner via groups.io
0 siblings, 1 reply; 2+ messages in thread
From: Nickle Wang via groups.io @ 2023-11-23 14:33 UTC (permalink / raw)
To: devel; +Cc: Abner Chang, Igor Kulchytskyy, Nick Ramirez
-Fix typo (replace Listheader to ListHeader).
-Replace "%a," to "%a:".
-Add more debug message.
-Fix issue of assigning ASCII character to Unicode string pointer.
-Remove the exit-boot-service callback since data is saved at
after-provisioning event. There is no need to save data to variable
again.
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
.../RedfishConfigLangMapDxe.inf | 1 -
.../RedfishConfigLangMapDxe.h | 2 +-
.../RedfishConfigLangMapDxe.c | 89 +++++++++----------
3 files changed, 41 insertions(+), 51 deletions(-)
diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf
index 42d9daf2..02346745 100644
--- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf
+++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf
@@ -41,7 +41,6 @@
gEdkIIRedfishConfigLangMapProtocolGuid ## PRODUCED ##
[Guids]
- gEfiEventExitBootServicesGuid ## CONSUMED ##
gEfiRedfishClientVariableGuid ## CONSUMED ##
[Depex]
diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
index efa27d4d..4ac55941 100644
--- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
+++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
@@ -49,7 +49,7 @@ typedef struct {
// Definition of REDFISH_CONFIG_LANG_MAP_LIST
//
typedef struct {
- LIST_ENTRY Listheader;
+ LIST_ENTRY ListHeader;
UINTN TotalSize;
UINTN Count;
} REDFISH_CONFIG_LANG_MAP_LIST;
diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
index 97f29549..8c930445 100644
--- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
+++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
@@ -102,7 +102,7 @@ ON_ERROR:
@param[in] Uri The URI string matching to this ConfigLang.
@param[in] ConfigLang ConfigLang string.
- @retval EFI_SUCCESS config language map recourd is added.
+ @retval EFI_SUCCESS config language map record is added.
@retval Others Fail to add config language map.
**/
@@ -124,7 +124,7 @@ AddConfigLangMapRecord (
return EFI_OUT_OF_RESOURCES;
}
- InsertTailList (&List->Listheader, &NewRecord->List);
+ InsertTailList (&List->ListHeader, &NewRecord->List);
++List->Count;
List->TotalSize += NewRecord->Size;
@@ -137,7 +137,7 @@ AddConfigLangMapRecord (
@param[in] List Target config language map list to be removed.
@param[in] Record Pointer to the instance to be deleted.
- @retval EFI_SUCCESS config language map recourd is removed.
+ @retval EFI_SUCCESS config language map record is removed.
@retval Others Fail to add config language map.
**/
@@ -237,20 +237,20 @@ DumpConfigLangMapList (
DEBUG ((DEBUG_ERROR, "%s\n", Msg));
}
- if (IsListEmpty (&ConfigLangMapList->Listheader)) {
+ if (IsListEmpty (&ConfigLangMapList->ListHeader)) {
DEBUG ((DEBUG_MANAGEABILITY, "ConfigLangMap list is empty\n"));
return EFI_NOT_FOUND;
}
DEBUG ((DEBUG_MANAGEABILITY, "Count: %d Total Size: %d\n", ConfigLangMapList->Count, ConfigLangMapList->TotalSize));
Record = NULL;
- List = GetFirstNode (&ConfigLangMapList->Listheader);
- while (!IsNull (&ConfigLangMapList->Listheader, List)) {
+ List = GetFirstNode (&ConfigLangMapList->ListHeader);
+ while (!IsNull (&ConfigLangMapList->ListHeader, List)) {
Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
DEBUG ((DEBUG_MANAGEABILITY, "ConfigLang: %s Uri: %s Size: %d\n", Record->ConfigLang, Record->Uri, Record->Size));
- List = GetNextNode (&ConfigLangMapList->Listheader, List);
+ List = GetNextNode (&ConfigLangMapList->ListHeader, List);
}
return EFI_SUCCESS;
@@ -317,16 +317,16 @@ ReleaseConfigLangMapList (
return EFI_INVALID_PARAMETER;
}
- if (IsListEmpty (&ConfigLangMapList->Listheader)) {
+ if (IsListEmpty (&ConfigLangMapList->ListHeader)) {
return EFI_SUCCESS;
}
Record = NULL;
Next = NULL;
- List = GetFirstNode (&ConfigLangMapList->Listheader);
- while (!IsNull (&ConfigLangMapList->Listheader, List)) {
+ List = GetFirstNode (&ConfigLangMapList->ListHeader);
+ while (!IsNull (&ConfigLangMapList->ListHeader, List)) {
Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
- Next = GetNextNode (&ConfigLangMapList->Listheader, List);
+ Next = GetNextNode (&ConfigLangMapList->ListHeader, List);
DeleteConfigLangMapRecord (ConfigLangMapList, Record);
@@ -365,12 +365,12 @@ SaveConfigLangMapList (
return EFI_INVALID_PARAMETER;
}
- if (IsListEmpty (&ConfigLangMapList->Listheader)) {
+ if (IsListEmpty (&ConfigLangMapList->ListHeader)) {
return EFI_SUCCESS;
}
//
- // Caculate the total size we need to keep ConfigLangMap list.
+ // Calculate the total size we need to keep ConfigLangMap list.
//
VarSize = ConfigLangMapList->TotalSize + sizeof (CHAR16); // terminator character
VarData = AllocateZeroPool (VarSize);
@@ -380,29 +380,29 @@ SaveConfigLangMapList (
Seeker = (EFI_STRING)VarData;
Record = NULL;
- List = GetFirstNode (&ConfigLangMapList->Listheader);
- while (!IsNull (&ConfigLangMapList->Listheader, List)) {
+ List = GetFirstNode (&ConfigLangMapList->ListHeader);
+ while (!IsNull (&ConfigLangMapList->ListHeader, List)) {
Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
StringSize = StrSize (Record->Uri);
CopyMem (Seeker, Record->Uri, StringSize);
Seeker += (StringSize / sizeof (CHAR16) - 1);
- *Seeker = '|';
+ *Seeker = L'|';
++Seeker;
StringSize = StrSize (Record->ConfigLang);
CopyMem (Seeker, Record->ConfigLang, StringSize);
Seeker += (StringSize / sizeof (CHAR16) - 1);
- *Seeker = '\n';
+ *Seeker = L'\n';
++Seeker;
- List = GetNextNode (&ConfigLangMapList->Listheader, List);
+ List = GetNextNode (&ConfigLangMapList->ListHeader, List);
}
- *Seeker = '\0';
+ *Seeker = L'\0';
#if CONFIG_LANG_MAP_DEBUG_ENABLED
DumpRawBuffer (VarData, VarSize);
@@ -481,7 +481,7 @@ InitialConfigLangMapList (
//
Seeker = StrStr (UriPointer, L"|");
if (Seeker == NULL) {
- DEBUG ((DEBUG_ERROR, "%a, data corrupted\n", __func__));
+ DEBUG ((DEBUG_ERROR, "%a: data corrupted\n", __func__));
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
@@ -494,7 +494,7 @@ InitialConfigLangMapList (
//
Seeker = StrStr (ConfigLangPointer, L"\n");
if (Seeker == NULL) {
- DEBUG ((DEBUG_ERROR, "%a, data corrupted\n", __func__));
+ DEBUG ((DEBUG_ERROR, "%a: data corrupted\n", __func__));
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
@@ -548,11 +548,13 @@ RedfishConfigLangMapGet (
return EFI_INVALID_PARAMETER;
}
+ DEBUG ((DEBUG_MANAGEABILITY, "%a: type: 0x%x %s\n", __func__, QueryStringType, QueryString));
+
Private = REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This);
*ResultString = NULL;
- Target = FindConfigLangMapRecord (&Private->ConfigLangList.Listheader, QueryString, (QueryStringType == RedfishGetTypeUri));
+ Target = FindConfigLangMapRecord (&Private->ConfigLangList.ListHeader, QueryString, (QueryStringType == RedfishGetTypeUri));
if (Target == NULL) {
#if CONFIG_LANG_MAP_DEBUG_ENABLED
DumpConfigLangMapList (&Private->ConfigLangList, L"EFI_NOT_FOUND");
@@ -597,10 +599,12 @@ RedfishConfigLangMapSet (
return EFI_INVALID_PARAMETER;
}
+ DEBUG ((DEBUG_MANAGEABILITY, "%a: %s -> %s\n", __func__, ConfigLang, (Uri == NULL ? L"NULL" : Uri)));
+
Private = REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This);
Status = EFI_NOT_FOUND;
- Target = FindConfigLangMapRecord (&Private->ConfigLangList.Listheader, ConfigLang, FALSE);
+ Target = FindConfigLangMapRecord (&Private->ConfigLangList.ListHeader, ConfigLang, FALSE);
if (Target != NULL) {
//
// Remove old one and create new one.
@@ -609,7 +613,7 @@ RedfishConfigLangMapSet (
}
//
- // When Uri is NULL, it means that we want to remov this record.
+ // When Uri is NULL, it means that we want to remove this record.
//
if (Uri == NULL) {
return Status;
@@ -644,14 +648,16 @@ RedfishConfigLangMapFlush (
Status = SaveConfigLangMapList (&Private->ConfigLangList, Private->VariableName);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a, save ConfigLangMap list to variable: %s failed: %r\n", __func__, Private->VariableName, Status));
+ DEBUG ((DEBUG_ERROR, "%a: save ConfigLangMap list to variable: %s failed: %r\n", __func__, Private->VariableName, Status));
}
+ DEBUG ((DEBUG_MANAGEABILITY, "%a: save Config Language map to variable: %s\n", __func__, Private->VariableName));
+
return Status;
}
/**
- Callback function executed when the ExitBootService event group is signaled.
+ Callback function executed when the AfterProvisioning event group is signaled.
@param[in] Event Event whose notification function is being invoked.
@param[out] Context Pointer to the Context buffer
@@ -659,13 +665,13 @@ RedfishConfigLangMapFlush (
**/
VOID
EFIAPI
-RedfishConfigLangMapOnExitBootService (
+RedfishConfigLangMapOnAfterProvisioning (
IN EFI_EVENT Event,
OUT VOID *Context
)
{
//
- // Memory is about to be released. Keep list into variable.
+ // Redfish provisioning is finished. Keep list into variable.
//
RedfishConfigLangMapFlush (&mRedfishConfigLangMapPrivate->Protocol);
}
@@ -694,7 +700,7 @@ RedfishConfigLangMapDriverUnload (
(VOID *)&mRedfishConfigLangMapPrivate->Protocol
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a, can not uninstall gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
+ DEBUG ((DEBUG_ERROR, "%a: can not uninstall gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
ASSERT (FALSE);
}
@@ -753,7 +759,7 @@ RedfishConfigLangMapDriverEntryPoint (
return EFI_OUT_OF_RESOURCES;
}
- InitializeListHead (&mRedfishConfigLangMapPrivate->ConfigLangList.Listheader);
+ InitializeListHead (&mRedfishConfigLangMapPrivate->ConfigLangList.ListHeader);
mRedfishConfigLangMapPrivate->VariableName = AllocateCopyPool (StrSize (CONFIG_LANG_MAP_VARIABLE_NAME), CONFIG_LANG_MAP_VARIABLE_NAME);
if (mRedfishConfigLangMapPrivate->VariableName == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -770,40 +776,25 @@ RedfishConfigLangMapDriverEntryPoint (
(VOID *)&mRedfishConfigLangMapPrivate->Protocol
);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a, can not install gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
+ DEBUG ((DEBUG_ERROR, "%a: can not install gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
ASSERT (FALSE);
goto ON_ERROR;
}
- //
- // Create Exit Boot Service event.
- //
- Status = gBS->CreateEventEx (
- EVT_NOTIFY_SIGNAL,
- TPL_CALLBACK,
- RedfishConfigLangMapOnExitBootService,
- NULL,
- &gEfiEventExitBootServicesGuid,
- &mRedfishConfigLangMapPrivate->ExitBootEvent
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "%a: Fail to register Exit Boot Service event.", __func__));
- goto ON_ERROR;
- }
-
//
// Read existing record from variable.
//
+ DEBUG ((DEBUG_MANAGEABILITY, "%a: Initial ConfigLangMap List from variable: %s\n", __func__, mRedfishConfigLangMapPrivate->VariableName));
Status = InitialConfigLangMapList (&mRedfishConfigLangMapPrivate->ConfigLangList, mRedfishConfigLangMapPrivate->VariableName);
if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_MANAGEABILITY, "%a, Initial ConfigLangMap List: %r\n", __func__, Status));
+ DEBUG ((DEBUG_MANAGEABILITY, "%a: Initial ConfigLangMap List: %r\n", __func__, Status));
}
//
// Register after provisioning event
//
Status = CreateAfterProvisioningEvent (
- RedfishConfigLangMapOnExitBootService,
+ RedfishConfigLangMapOnAfterProvisioning,
NULL,
&mRedfishConfigLangMapPrivate->ProvisionEvent
);
--
2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111672): https://edk2.groups.io/g/devel/message/111672
Mute This Topic: https://groups.io/mt/102767542/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] 2+ messages in thread
* Re: [edk2-devel] [edk2-redfish-client][PATCH 2/6] RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement.
2023-11-23 14:33 [edk2-devel] [edk2-redfish-client][PATCH 2/6] RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement Nickle Wang via groups.io
@ 2023-11-28 3:19 ` Chang, Abner via groups.io
0 siblings, 0 replies; 2+ messages in thread
From: Chang, Abner via groups.io @ 2023-11-28 3:19 UTC (permalink / raw)
To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy, Nick Ramirez
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-redfish-client][PATCH 2/6]
> RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Fix typo (replace Listheader to ListHeader).
> -Replace "%a," to "%a:".
> -Add more debug message.
> -Fix issue of assigning ASCII character to Unicode string pointer.
> -Remove the exit-boot-service callback since data is saved at
> after-provisioning event. There is no need to save data to variable
> again.
>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
> .../RedfishConfigLangMapDxe.inf | 1 -
> .../RedfishConfigLangMapDxe.h | 2 +-
> .../RedfishConfigLangMapDxe.c | 89 +++++++++----------
> 3 files changed, 41 insertions(+), 51 deletions(-)
>
> diff --git
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> index 42d9daf2..02346745 100644
> ---
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> +++
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> @@ -41,7 +41,6 @@
> gEdkIIRedfishConfigLangMapProtocolGuid ## PRODUCED ##
>
> [Guids]
> - gEfiEventExitBootServicesGuid ## CONSUMED ##
> gEfiRedfishClientVariableGuid ## CONSUMED ##
>
> [Depex]
> diff --git
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> index efa27d4d..4ac55941 100644
> ---
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> +++
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> @@ -49,7 +49,7 @@ typedef struct {
> // Definition of REDFISH_CONFIG_LANG_MAP_LIST
> //
> typedef struct {
> - LIST_ENTRY Listheader;
> + LIST_ENTRY ListHeader;
> UINTN TotalSize;
> UINTN Count;
> } REDFISH_CONFIG_LANG_MAP_LIST;
> diff --git
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> index 97f29549..8c930445 100644
> ---
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> +++
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> @@ -102,7 +102,7 @@ ON_ERROR:
> @param[in] Uri The URI string matching to this ConfigLang.
> @param[in] ConfigLang ConfigLang string.
>
> - @retval EFI_SUCCESS config language map recourd is added.
> + @retval EFI_SUCCESS config language map record is added.
> @retval Others Fail to add config language map.
>
> **/
> @@ -124,7 +124,7 @@ AddConfigLangMapRecord (
> return EFI_OUT_OF_RESOURCES;
> }
>
> - InsertTailList (&List->Listheader, &NewRecord->List);
> + InsertTailList (&List->ListHeader, &NewRecord->List);
> ++List->Count;
> List->TotalSize += NewRecord->Size;
>
> @@ -137,7 +137,7 @@ AddConfigLangMapRecord (
> @param[in] List Target config language map list to be removed.
> @param[in] Record Pointer to the instance to be deleted.
>
> - @retval EFI_SUCCESS config language map recourd is removed.
> + @retval EFI_SUCCESS config language map record is removed.
> @retval Others Fail to add config language map.
>
> **/
> @@ -237,20 +237,20 @@ DumpConfigLangMapList (
> DEBUG ((DEBUG_ERROR, "%s\n", Msg));
> }
>
> - if (IsListEmpty (&ConfigLangMapList->Listheader)) {
> + if (IsListEmpty (&ConfigLangMapList->ListHeader)) {
> DEBUG ((DEBUG_MANAGEABILITY, "ConfigLangMap list is empty\n"));
> return EFI_NOT_FOUND;
> }
>
> DEBUG ((DEBUG_MANAGEABILITY, "Count: %d Total Size: %d\n",
> ConfigLangMapList->Count, ConfigLangMapList->TotalSize));
> Record = NULL;
> - List = GetFirstNode (&ConfigLangMapList->Listheader);
> - while (!IsNull (&ConfigLangMapList->Listheader, List)) {
> + List = GetFirstNode (&ConfigLangMapList->ListHeader);
> + while (!IsNull (&ConfigLangMapList->ListHeader, List)) {
> Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
>
> DEBUG ((DEBUG_MANAGEABILITY, "ConfigLang: %s Uri: %s Size: %d\n",
> Record->ConfigLang, Record->Uri, Record->Size));
>
> - List = GetNextNode (&ConfigLangMapList->Listheader, List);
> + List = GetNextNode (&ConfigLangMapList->ListHeader, List);
> }
>
> return EFI_SUCCESS;
> @@ -317,16 +317,16 @@ ReleaseConfigLangMapList (
> return EFI_INVALID_PARAMETER;
> }
>
> - if (IsListEmpty (&ConfigLangMapList->Listheader)) {
> + if (IsListEmpty (&ConfigLangMapList->ListHeader)) {
> return EFI_SUCCESS;
> }
>
> Record = NULL;
> Next = NULL;
> - List = GetFirstNode (&ConfigLangMapList->Listheader);
> - while (!IsNull (&ConfigLangMapList->Listheader, List)) {
> + List = GetFirstNode (&ConfigLangMapList->ListHeader);
> + while (!IsNull (&ConfigLangMapList->ListHeader, List)) {
> Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
> - Next = GetNextNode (&ConfigLangMapList->Listheader, List);
> + Next = GetNextNode (&ConfigLangMapList->ListHeader, List);
>
> DeleteConfigLangMapRecord (ConfigLangMapList, Record);
>
> @@ -365,12 +365,12 @@ SaveConfigLangMapList (
> return EFI_INVALID_PARAMETER;
> }
>
> - if (IsListEmpty (&ConfigLangMapList->Listheader)) {
> + if (IsListEmpty (&ConfigLangMapList->ListHeader)) {
> return EFI_SUCCESS;
> }
>
> //
> - // Caculate the total size we need to keep ConfigLangMap list.
> + // Calculate the total size we need to keep ConfigLangMap list.
> //
> VarSize = ConfigLangMapList->TotalSize + sizeof (CHAR16); // terminator
> character
> VarData = AllocateZeroPool (VarSize);
> @@ -380,29 +380,29 @@ SaveConfigLangMapList (
>
> Seeker = (EFI_STRING)VarData;
> Record = NULL;
> - List = GetFirstNode (&ConfigLangMapList->Listheader);
> - while (!IsNull (&ConfigLangMapList->Listheader, List)) {
> + List = GetFirstNode (&ConfigLangMapList->ListHeader);
> + while (!IsNull (&ConfigLangMapList->ListHeader, List)) {
> Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
>
> StringSize = StrSize (Record->Uri);
> CopyMem (Seeker, Record->Uri, StringSize);
>
> Seeker += (StringSize / sizeof (CHAR16) - 1);
> - *Seeker = '|';
> + *Seeker = L'|';
> ++Seeker;
>
> StringSize = StrSize (Record->ConfigLang);
> CopyMem (Seeker, Record->ConfigLang, StringSize);
>
> Seeker += (StringSize / sizeof (CHAR16) - 1);
> - *Seeker = '\n';
> + *Seeker = L'\n';
>
> ++Seeker;
>
> - List = GetNextNode (&ConfigLangMapList->Listheader, List);
> + List = GetNextNode (&ConfigLangMapList->ListHeader, List);
> }
>
> - *Seeker = '\0';
> + *Seeker = L'\0';
>
> #if CONFIG_LANG_MAP_DEBUG_ENABLED
> DumpRawBuffer (VarData, VarSize);
> @@ -481,7 +481,7 @@ InitialConfigLangMapList (
> //
> Seeker = StrStr (UriPointer, L"|");
> if (Seeker == NULL) {
> - DEBUG ((DEBUG_ERROR, "%a, data corrupted\n", __func__));
> + DEBUG ((DEBUG_ERROR, "%a: data corrupted\n", __func__));
> Status = EFI_DEVICE_ERROR;
> goto ON_ERROR;
> }
> @@ -494,7 +494,7 @@ InitialConfigLangMapList (
> //
> Seeker = StrStr (ConfigLangPointer, L"\n");
> if (Seeker == NULL) {
> - DEBUG ((DEBUG_ERROR, "%a, data corrupted\n", __func__));
> + DEBUG ((DEBUG_ERROR, "%a: data corrupted\n", __func__));
> Status = EFI_DEVICE_ERROR;
> goto ON_ERROR;
> }
> @@ -548,11 +548,13 @@ RedfishConfigLangMapGet (
> return EFI_INVALID_PARAMETER;
> }
>
> + DEBUG ((DEBUG_MANAGEABILITY, "%a: type: 0x%x %s\n", __func__,
> QueryStringType, QueryString));
> +
> Private = REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This);
>
> *ResultString = NULL;
>
> - Target = FindConfigLangMapRecord (&Private->ConfigLangList.Listheader,
> QueryString, (QueryStringType == RedfishGetTypeUri));
> + Target = FindConfigLangMapRecord (&Private->ConfigLangList.ListHeader,
> QueryString, (QueryStringType == RedfishGetTypeUri));
> if (Target == NULL) {
> #if CONFIG_LANG_MAP_DEBUG_ENABLED
> DumpConfigLangMapList (&Private->ConfigLangList, L"EFI_NOT_FOUND");
> @@ -597,10 +599,12 @@ RedfishConfigLangMapSet (
> return EFI_INVALID_PARAMETER;
> }
>
> + DEBUG ((DEBUG_MANAGEABILITY, "%a: %s -> %s\n", __func__, ConfigLang,
> (Uri == NULL ? L"NULL" : Uri)));
> +
> Private = REDFISH_CONFIG_LANG_MAP_PRIVATE_FROM_THIS (This);
>
> Status = EFI_NOT_FOUND;
> - Target = FindConfigLangMapRecord (&Private->ConfigLangList.Listheader,
> ConfigLang, FALSE);
> + Target = FindConfigLangMapRecord (&Private->ConfigLangList.ListHeader,
> ConfigLang, FALSE);
> if (Target != NULL) {
> //
> // Remove old one and create new one.
> @@ -609,7 +613,7 @@ RedfishConfigLangMapSet (
> }
>
> //
> - // When Uri is NULL, it means that we want to remov this record.
> + // When Uri is NULL, it means that we want to remove this record.
> //
> if (Uri == NULL) {
> return Status;
> @@ -644,14 +648,16 @@ RedfishConfigLangMapFlush (
>
> Status = SaveConfigLangMapList (&Private->ConfigLangList, Private-
> >VariableName);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a, save ConfigLangMap list to variable: %s
> failed: %r\n", __func__, Private->VariableName, Status));
> + DEBUG ((DEBUG_ERROR, "%a: save ConfigLangMap list to variable: %s
> failed: %r\n", __func__, Private->VariableName, Status));
> }
>
> + DEBUG ((DEBUG_MANAGEABILITY, "%a: save Config Language map to
> variable: %s\n", __func__, Private->VariableName));
> +
> return Status;
> }
>
> /**
> - Callback function executed when the ExitBootService event group is signaled.
> + Callback function executed when the AfterProvisioning event group is
> signaled.
>
> @param[in] Event Event whose notification function is being invoked.
> @param[out] Context Pointer to the Context buffer
> @@ -659,13 +665,13 @@ RedfishConfigLangMapFlush (
> **/
> VOID
> EFIAPI
> -RedfishConfigLangMapOnExitBootService (
> +RedfishConfigLangMapOnAfterProvisioning (
> IN EFI_EVENT Event,
> OUT VOID *Context
> )
> {
> //
> - // Memory is about to be released. Keep list into variable.
> + // Redfish provisioning is finished. Keep list into variable.
> //
> RedfishConfigLangMapFlush (&mRedfishConfigLangMapPrivate->Protocol);
> }
> @@ -694,7 +700,7 @@ RedfishConfigLangMapDriverUnload (
> (VOID *)&mRedfishConfigLangMapPrivate->Protocol
> );
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a, can not uninstall
> gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
> + DEBUG ((DEBUG_ERROR, "%a: can not uninstall
> gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
> ASSERT (FALSE);
> }
>
> @@ -753,7 +759,7 @@ RedfishConfigLangMapDriverEntryPoint (
> return EFI_OUT_OF_RESOURCES;
> }
>
> - InitializeListHead (&mRedfishConfigLangMapPrivate-
> >ConfigLangList.Listheader);
> + InitializeListHead (&mRedfishConfigLangMapPrivate-
> >ConfigLangList.ListHeader);
> mRedfishConfigLangMapPrivate->VariableName = AllocateCopyPool (StrSize
> (CONFIG_LANG_MAP_VARIABLE_NAME),
> CONFIG_LANG_MAP_VARIABLE_NAME);
> if (mRedfishConfigLangMapPrivate->VariableName == NULL) {
> Status = EFI_OUT_OF_RESOURCES;
> @@ -770,40 +776,25 @@ RedfishConfigLangMapDriverEntryPoint (
> (VOID *)&mRedfishConfigLangMapPrivate->Protocol
> );
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a, can not install
> gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
> + DEBUG ((DEBUG_ERROR, "%a: can not install
> gEdkIIRedfishConfigLangMapProtocolGuid: %r\n", __func__, Status));
> ASSERT (FALSE);
> goto ON_ERROR;
> }
>
> - //
> - // Create Exit Boot Service event.
> - //
> - Status = gBS->CreateEventEx (
> - EVT_NOTIFY_SIGNAL,
> - TPL_CALLBACK,
> - RedfishConfigLangMapOnExitBootService,
> - NULL,
> - &gEfiEventExitBootServicesGuid,
> - &mRedfishConfigLangMapPrivate->ExitBootEvent
> - );
> - if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR, "%a: Fail to register Exit Boot Service event.",
> __func__));
> - goto ON_ERROR;
> - }
> -
> //
> // Read existing record from variable.
> //
> + DEBUG ((DEBUG_MANAGEABILITY, "%a: Initial ConfigLangMap List from
> variable: %s\n", __func__, mRedfishConfigLangMapPrivate->VariableName));
> Status = InitialConfigLangMapList (&mRedfishConfigLangMapPrivate-
> >ConfigLangList, mRedfishConfigLangMapPrivate->VariableName);
> if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_MANAGEABILITY, "%a, Initial ConfigLangMap List: %r\n",
> __func__, Status));
> + DEBUG ((DEBUG_MANAGEABILITY, "%a: Initial ConfigLangMap List: %r\n",
> __func__, Status));
> }
>
> //
> // Register after provisioning event
> //
> Status = CreateAfterProvisioningEvent (
> - RedfishConfigLangMapOnExitBootService,
> + RedfishConfigLangMapOnAfterProvisioning,
> NULL,
> &mRedfishConfigLangMapPrivate->ProvisionEvent
> );
> --
> 2.17.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111783): https://edk2.groups.io/g/devel/message/111783
Mute This Topic: https://groups.io/mt/102767542/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-28 3:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 14:33 [edk2-devel] [edk2-redfish-client][PATCH 2/6] RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement Nickle Wang via groups.io
2023-11-28 3:19 ` Chang, Abner via groups.io
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox