summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-23 13:33:16 +0800
committerGuo Mang <mang.guo@intel.com>2017-05-09 13:02:58 +0800
commite7b8e072fd6da92d7820b0a18c30bd3eea6ffc44 (patch)
tree99cae09b138c37a958c7e4e80e318ad20dab553f /Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c
parent54901c47dd992753dfce0a234c8cd53492e70d1a (diff)
downloadedk2-platforms-e7b8e072fd6da92d7820b0a18c30bd3eea6ffc44.tar.xz
BroxtonPlatformPkg: Add package Include and Library
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c')
-rw-r--r--Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c b/Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c
new file mode 100644
index 0000000000..4fa42747ea
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/Common/Library/DxePolicyUpdateLib/DxeSaPolicyUpdate.c
@@ -0,0 +1,101 @@
+/** @file
+ This file is the library for SA DXE Policy initialzation.
+
+ Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <DxeSaPolicyUpdate.h>
+
+
+/**
+ Get data for platform policy from setup options.
+
+ @param[in] DxeSaPolicy The pointer to get SA Policy protocol instance
+ @param[in] SystemConfiguration The pointer to get System Setup
+
+ @retval EFI_SUCCESS Operation success.
+
+**/
+EFI_STATUS
+EFIAPI
+UpdateDxeSaPolicy (
+ IN OUT SA_POLICY_PROTOCOL *SaPolicy,
+ IN SYSTEM_CONFIGURATION *SystemConfiguration
+ )
+{
+#if defined (ENBDT_PF_ENABLE) && (ENBDT_PF_ENABLE == 1) // For ApolloLake
+ PLATFORM_GOP_POLICY_PROTOCOL *GopPolicy;
+ VBT_INFO *VbtInfo = NULL;
+ EFI_PHYSICAL_ADDRESS VbtAddress;
+ UINT32 Size;
+ EFI_PEI_HOB_POINTERS GuidHob;
+#endif
+ EFI_STATUS Status;
+ SA_DXE_MISC_CONFIG *SaDxeMiscConfig = NULL;
+ IGD_PANEL_CONFIG *IgdPanelConfig = NULL;
+
+ DEBUG ((DEBUG_INFO, "UpdateDxeSaPolicy\n"));
+
+ Status = GetConfigBlock ((CONFIG_BLOCK_TABLE_HEADER *) SaPolicy, &gIgdPanelConfigGuid, (VOID *) &IgdPanelConfig);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = GetConfigBlock ((CONFIG_BLOCK_TABLE_HEADER *) SaPolicy, &gSaDxeMiscConfigGuid, (VOID *) &SaDxeMiscConfig);
+ ASSERT_EFI_ERROR (Status);
+#if defined (ENBDT_PF_ENABLE) && (ENBDT_PF_ENABLE == 1) // For ApolloLake
+ DEBUG ((DEBUG_INFO, "Locate GopPolicy and GetVbtData\n"));
+
+ //
+ // Locate the GOP Policy Protocol.
+ //
+ GopPolicy = NULL;
+ Status = gBS->LocateProtocol (
+ &gPlatformGOPPolicyGuid,
+ NULL,
+ &GopPolicy
+ );
+
+ if (EFI_ERROR (Status) || (GopPolicy == NULL)) {
+ return Status;
+ }
+
+ //
+ // Get VBT data
+ //
+ VbtAddress = 0;
+ Size = 0;
+ DEBUG ((DEBUG_INFO, "GetVbtData\n"));
+ Status = GopPolicy->GetVbtData (&VbtAddress, &Size);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ GuidHob.Raw = GetHobList ();
+ if (GuidHob.Raw != NULL) {
+ if ((GuidHob.Raw = GetNextGuidHob (&gVbtInfoGuid, GuidHob.Raw)) != NULL) {
+ VbtInfo = GET_GUID_HOB_DATA (GuidHob.Guid);
+ VbtInfo->VbtAddress = VbtAddress;
+ VbtInfo->VbtSize = Size;
+ Status = EFI_SUCCESS;
+ }
+ } else {
+ Status = EFI_NOT_FOUND;
+ return Status;
+ }
+#endif
+
+ IgdPanelConfig->PFITStatus = SystemConfiguration->PanelScaling;
+ SaDxeMiscConfig->S0ixSupported = SystemConfiguration->LowPowerS0Idle;
+ IgdPanelConfig->PanelSelect = SystemConfiguration->VbtSelect;
+
+ return EFI_SUCCESS;
+}
+