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

Cc: Star Zeng <star.zeng@intel.com>
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@18603 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenu.c
MdeModulePkg/Application/UiApp/BootMaint/Variable.c
MdeModulePkg/Application/UiApp/FrontPage.c
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c

index c5a35c070fe2822d6f6a12aecfff411a4b1ee56e..d43c12f34ad209f5dd2f5698f63b11e2ae07b22b 100644 (file)
@@ -775,8 +775,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
@@ -817,11 +819,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
-  \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
   // Video mode is changed, so restart graphics console driver and higher level driver.\r
index 76dbd3a4a9463e01e556b94e6f3a14be0c242373..a8d9cd5efbdb997b0bd196bb69dc54ca5da5b66e 100644 (file)
@@ -1064,9 +1064,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 d1b4f5cb6a9839c81b68208c877b26ba9110c71e..245c3497c8023cc85708345b6d9a2412bcb9f2d7 100644 (file)
@@ -989,8 +989,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
@@ -1031,10 +1033,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 bea206d35bfe12a36f534fa7ee0af01faec642bc..dae97b09a2e2909c08f04859b22c4235f4a71ab6 100644 (file)
@@ -16,7 +16,7 @@
   never removed. Such design ensures sytem function well during none console\r
   device situation.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -2946,8 +2946,10 @@ ConsplitterSetConsoleOutMode (
     Status = TextOut->SetMode (TextOut, BaseMode);\r
     ASSERT(!EFI_ERROR(Status));\r
 \r
-    PcdSet32 (PcdConOutColumn, 80);\r
-    PcdSet32 (PcdConOutRow, 25);\r
+    Status = PcdSet32S (PcdConOutColumn, 80);\r
+    ASSERT(!EFI_ERROR(Status));\r
+    Status = PcdSet32S (PcdConOutRow, 25);\r
+    ASSERT(!EFI_ERROR(Status));\r
   }\r
 \r
   return ;\r