On 2015/10/14 13:35, Eric Dong wrote:
PcdSet## has no error status returned, then the caller has no idea about
whether the set operation is successful or not.
PcdSet##S were added to return error status and PcdSet## APIs were put in
ifndef DISABLE_NEW_DEPRECATED_INTERFACES condition.
To adopt PcdSet##S and further code development with
DISABLE_NEW_DEPRECATED_INTERFACES defined, we need to Replace PcdSet## usage
with PcdSet##S.
Normally, DynamicDefault PCD set is expected to be success, but DynamicHii PCD
set failure is a legal case.
So for DynamicDefault, we add assert when set failure. For DynamicHii, we add
logic to handle it.
Cc: Star Zeng <star.z...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.d...@intel.com>
---
.../Universal/BdsDxe/BootMaint/Variable.c | 8 +++++---
IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c | 18 ++++++++++++------
IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c | 5 ++++-
3 files changed, 21 insertions(+), 10 deletions(-)
Reviewed-by: Star Zeng <star.z...@intel.com>
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
index 616549e..b933dd9 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
@@ -1368,11 +1368,13 @@ Var_UpdateConMode (
Mode = CallbackData->BmmFakeNvData.ConsoleOutMode;
Status = gST->ConOut->QueryMode (gST->ConOut, Mode, &(ModeInfo.Column),
&(ModeInfo.Row));
if (!EFI_ERROR(Status)) {
- PcdSet32 (PcdSetupConOutColumn, (UINT32) ModeInfo.Column);
- PcdSet32 (PcdSetupConOutRow, (UINT32) ModeInfo.Row);
+ Status = PcdSet32S (PcdSetupConOutColumn, (UINT32) ModeInfo.Column);
+ if (!EFI_ERROR (Status)){
+ Status = PcdSet32S (PcdSetupConOutRow, (UINT32) ModeInfo.Row);
+ }
}
- return EFI_SUCCESS;
+ return Status;
}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
index 14a7ae2..0a9238c 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
@@ -1393,12 +1393,14 @@ BdsSetConsoleMode (
Status = SimpleTextOut->SetMode (SimpleTextOut, Index);
ASSERT_EFI_ERROR (Status);
//
// Update text mode PCD.
//
- PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);
- PcdSet32 (PcdConOutRow, mSetupTextModeRow);
+ Status = PcdSet32S (PcdConOutColumn, mSetupTextModeColumn);
+ ASSERT_EFI_ERROR (Status);
+ Status = PcdSet32S (PcdConOutRow, mSetupTextModeRow);
+ ASSERT_EFI_ERROR (Status);
FreePool (Info);
return EFI_SUCCESS;
}
}
}
@@ -1435,14 +1437,18 @@ BdsSetConsoleMode (
//
// Set PCD to Inform GraphicsConsole to change video resolution.
// Set PCD to Inform Consplitter to change text mode.
//
- PcdSet32 (PcdVideoHorizontalResolution, NewHorizontalResolution);
- PcdSet32 (PcdVideoVerticalResolution, NewVerticalResolution);
- PcdSet32 (PcdConOutColumn, NewColumns);
- PcdSet32 (PcdConOutRow, NewRows);
+ Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);
+ ASSERT_EFI_ERROR (Status);
+ Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);
+ ASSERT_EFI_ERROR (Status);
+ Status = PcdSet32S (PcdConOutColumn, NewColumns);
+ ASSERT_EFI_ERROR (Status);
+ Status = PcdSet32S (PcdConOutRow, NewRows);
+ ASSERT_EFI_ERROR (Status);
//
// Video mode is changed, so restart graphics console driver and higher
level driver.
// Reconnect graphics console driver and higher level driver.
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
index fedb151..700e3e6 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
@@ -424,10 +424,13 @@ Done:
// Use a DynamicHii type pcd to save the boot status, which is used to
// control configuration mode, such as FULL/MINIMAL/NO_CHANGES
configuration.
//
IsFirstBoot = PcdGetBool(PcdBootState);
if (IsFirstBoot) {
- PcdSetBool(PcdBootState, FALSE);
+ Status = PcdSetBoolS(PcdBootState, FALSE);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Set PcdBootState to FALSE failed.\n"));
+ }
}
return ReturnStatus;
}
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel