]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkModulePkg BdsDxe: Use PcdSet##S to replace PcdSet##
authorEric Dong <eric.dong@intel.com>
Thu, 15 Oct 2015 00:57:45 +0000 (00:57 +0000)
committerydong10 <ydong10@Edk2>
Thu, 15 Oct 2015 00:57:45 +0000 (00:57 +0000)
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.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18605 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c
IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c

index 616549e64a223f505a6de112695984680f744338..b933dd9699cb9ec2c2b79b8e08baf62dd5c705e4 100644 (file)
@@ -1370,9 +1370,11 @@ Var_UpdateConMode (
 \r
   Status = gST->ConOut->QueryMode (gST->ConOut, Mode, &(ModeInfo.Column), &(ModeInfo.Row));\r
   if (!EFI_ERROR(Status)) {\r
-    PcdSet32 (PcdSetupConOutColumn, (UINT32) ModeInfo.Column);\r
-    PcdSet32 (PcdSetupConOutRow, (UINT32) ModeInfo.Row);\r
+    Status = PcdSet32S (PcdSetupConOutColumn, (UINT32) ModeInfo.Column);\r
+    if (!EFI_ERROR (Status)){\r
+      Status = PcdSet32S (PcdSetupConOutRow, (UINT32) ModeInfo.Row);\r
+    }\r
   }\r
 \r
-  return EFI_SUCCESS;\r
+  return Status;\r
 }\r
index 14a7ae29f4dd347bc6d04ebc7837aae1c5864420..0a9238c2e7c8da87a81e6b9bff940f8bb51e72ed 100644 (file)
@@ -1395,8 +1395,10 @@ BdsSetConsoleMode (
                   //\r
                   // Update text mode PCD.\r
                   //\r
-                  PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);\r
-                  PcdSet32 (PcdConOutRow, mSetupTextModeRow);\r
+                  Status = PcdSet32S (PcdConOutColumn, mSetupTextModeColumn);\r
+                  ASSERT_EFI_ERROR (Status);\r
+                  Status = PcdSet32S (PcdConOutRow, mSetupTextModeRow);\r
+                  ASSERT_EFI_ERROR (Status);\r
                   FreePool (Info);\r
                   return EFI_SUCCESS;\r
                 }\r
@@ -1437,10 +1439,14 @@ BdsSetConsoleMode (
   // Set PCD to Inform GraphicsConsole to change video resolution.\r
   // Set PCD to Inform Consplitter to change text mode.\r
   //\r
-  PcdSet32 (PcdVideoHorizontalResolution, NewHorizontalResolution);\r
-  PcdSet32 (PcdVideoVerticalResolution, NewVerticalResolution);\r
-  PcdSet32 (PcdConOutColumn, NewColumns);\r
-  PcdSet32 (PcdConOutRow, NewRows);\r
+  Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);\r
+  ASSERT_EFI_ERROR (Status);\r
+  Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);\r
+  ASSERT_EFI_ERROR (Status);\r
+  Status = PcdSet32S (PcdConOutColumn, NewColumns);\r
+  ASSERT_EFI_ERROR (Status);\r
+  Status = PcdSet32S (PcdConOutRow, NewRows);\r
+  ASSERT_EFI_ERROR (Status);\r
   \r
   \r
   //\r
index fedb151a0c63bb3195a70af2e81d6fb7c0ccb3f9..700e3e6626af83cc908bd45a235cf5ca86f4955e 100644 (file)
@@ -426,7 +426,10 @@ Done:
   //\r
   IsFirstBoot = PcdGetBool(PcdBootState);\r
   if (IsFirstBoot) {\r
-    PcdSetBool(PcdBootState, FALSE);\r
+    Status = PcdSetBoolS(PcdBootState, FALSE);\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((EFI_D_ERROR, "Set PcdBootState to FALSE failed.\n"));\r
+    }\r
   }\r
 \r
   return ReturnStatus;\r