]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
Vlv2DeviceRefCodePkg&Vlv2TbltDevicePkg:Add setup option of LPE Audio.
[mirror_edk2.git] / Vlv2TbltDevicePkg / AcpiPlatform / AcpiPlatform.c
index 824f2377772bd61db1b2ccb9d7bed211c07a0830..db1b5a5eeb554e57789fecdf05bf2a050bd20913 100644 (file)
@@ -1,23 +1,23 @@
 /** @file\r
 \r
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>\r
-                                                                                   \r
+  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>\r
+\r
 \r
   This program and the accompanying materials are licensed and made available under\r
 \r
-  the terms and conditions of the BSD License that accompanies this distribution.  \r
+  the terms and conditions of the BSD License that accompanies this distribution.\r
+\r
+  The full text of the license may be found at\r
+\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
-  The full text of the license may be found at                                     \r
 \r
-  http://opensource.org/licenses/bsd-license.php.                                  \r
 \r
-                                                                                   \r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,            \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.    \r
 \r
-                                                                                   \r
 \r
 \r
 \r
@@ -31,7 +31,7 @@ Abstract:
   ACPI Platform Driver\r
 \r
 \r
---*/\r
+**/\r
 \r
 #include <PiDxe.h>\r
 #include <Protocol/TcgService.h>\r
@@ -697,7 +697,18 @@ OnReadyToBoot (
                   &VariableSize,\r
                   &SetupVarBuffer\r
                   );\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+    //The setup variable is corrupted\r
+    VariableSize = sizeof(SYSTEM_CONFIGURATION);\r
+    Status = gRT->GetVariable(\r
+              L"SetupRecovery",\r
+              &mSystemConfigurationGuid,\r
+              NULL,\r
+              &VariableSize,\r
+              &SetupVarBuffer\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
 \r
   //\r
   // Find the AcpiSupport protocol.\r
@@ -817,7 +828,18 @@ AcpiPlatformEntryPoint (
                   &VarSize,\r
                   &mSystemConfiguration\r
                   );\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+    //The setup variable is corrupted\r
+    VarSize = sizeof(SYSTEM_CONFIGURATION);\r
+    Status = gRT->GetVariable(\r
+              L"SetupRecovery",\r
+              &mSystemConfigurationGuid,\r
+              NULL,\r
+              &VarSize,\r
+              &mSystemConfiguration\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
 \r
   //\r
   // Find the AcpiSupport protocol.\r
@@ -842,6 +864,19 @@ AcpiPlatformEntryPoint (
                   &SysCfgSize,\r
                   &mSystemConfig\r
                   );\r
+  if (EFI_ERROR (Status) || SysCfgSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+    //The setup variable is corrupted\r
+    SysCfgSize = sizeof(SYSTEM_CONFIGURATION);\r
+    Status = gRT->GetVariable(\r
+              L"SetupRecovery",\r
+              &gEfiNormalSetupGuid,\r
+              NULL,\r
+              &SysCfgSize,\r
+              &mSystemConfig\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
 \r
   Status    = EFI_SUCCESS;\r
   Instance  = 0;\r
@@ -933,6 +968,7 @@ AcpiPlatformEntryPoint (
   mGlobalNvsArea.Area->UartSelection = mSystemConfiguration.UartInterface;\r
   mGlobalNvsArea.Area->PcuUart1Enable = mSystemConfiguration.PcuUart1;\r
   mGlobalNvsArea.Area->NativePCIESupport = 1;\r
+  mGlobalNvsArea.Area->RtcBattery = mSystemConfiguration.RtcBattery;\r
 \r
 \r
 \r
@@ -1015,6 +1051,7 @@ AcpiPlatformEntryPoint (
   mGlobalNvsArea.Area->BatteryChargingSolution          = GLOBAL_NVS_DEVICE_DISABLE;\r
   mGlobalNvsArea.Area->ISPDevSel                        = mSystemConfiguration.ISPDevSel;\r
   mGlobalNvsArea.Area->LpeEnable                        = mSystemConfiguration.Lpe;\r
+  mGlobalNvsArea.Area->LpeAudioReportedByDSDT           = mSystemConfiguration.LpeAudioReportedByDSDT;\r
 \r
   if (mSystemConfiguration.ISPEn == 0) {\r
     mGlobalNvsArea.Area->ISPDevSel                      = GLOBAL_NVS_DEVICE_DISABLE;\r
@@ -1094,7 +1131,7 @@ AcpiPlatformEntryPoint (
   }\r
 \r
   mGlobalNvsArea.Area->SdCardRemovable = mSystemConfiguration.SdCardRemovable;\r
-  \r
+\r
   //\r
   // Microsoft IOT\r
   //\r
@@ -1107,7 +1144,7 @@ AcpiPlatformEntryPoint (
     mGlobalNvsArea.Area->MicrosoftIoT = GLOBAL_NVS_DEVICE_DISABLE;\r
     DEBUG ((EFI_D_ERROR, "JP1 is not set to be MSFT IOT configuration.\n"));\r
   }\r
-  \r
+\r
   //\r
   // SIO related option.\r
   //\r