summaryrefslogtreecommitdiff
path: root/Vlv2TbltDevicePkg/PlatformInfoDxe
diff options
context:
space:
mode:
authorDavid Wei <david.wei@intel.com>2015-01-12 09:37:20 +0000
committerzwei4 <zwei4@Edk2>2015-01-12 09:37:20 +0000
commit3cbfba02fef9dae07a041fdbf2e89611d72d6f90 (patch)
tree0b3bf0783124d38a191e09736492c0141aa36c15 /Vlv2TbltDevicePkg/PlatformInfoDxe
parent6f785cfcc304c48ec04e542ee429df95e7b51bc5 (diff)
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
https://svn.code.sf.net/p/edk2/code/trunk/edk2/, which are for MinnowBoard MAX open source project. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: David Wei <david.wei@intel.com> Reviewed-by: Mike Wu <mike.wu@intel.com> Reviewed-by: Hot Tian <hot.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16599 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Vlv2TbltDevicePkg/PlatformInfoDxe')
-rw-r--r--Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.c161
-rw-r--r--Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.h35
-rw-r--r--Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.inf57
3 files changed, 253 insertions, 0 deletions
diff --git a/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.c b/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.c
new file mode 100644
index 000000000..6bf276246
--- /dev/null
+++ b/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.c
@@ -0,0 +1,161 @@
+/** @file
+
+ Copyright (c) 2004 - 2014, 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 that 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.
+
+
+Module Name:
+
+ PlatformInfoDxe.c
+
+Abstract:
+ Platform Info driver to public platform related HOB data
+
+--*/
+
+#include "PlatformInfoDxe.h"
+
+/**
+ Entry point for the driver.
+
+ This routine get the platform HOB data from PEI and publish
+ as Platform Info variable that can be accessed during boot service and
+ runtime.
+
+ @param ImageHandle Image Handle.
+ @param SystemTable EFI System Table.
+
+ @retval Status Function execution status.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformInfoInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_PLATFORM_INFO_HOB *PlatformInfoHobPtr;
+ EFI_PEI_HOB_POINTERS GuidHob;
+ EFI_PLATFORM_INFO_HOB TmpHob;
+ UINTN VarSize;
+ EFI_OS_SELECTION_HOB *OsSlectionHobPtr;
+ UINT8 Selection;
+ SYSTEM_CONFIGURATION SystemConfiguration;
+ UINT8 *LpssDataHobPtr;
+ UINT8 *LpssDataVarPtr;
+ UINTN i;
+
+ VarSize = sizeof(SYSTEM_CONFIGURATION);
+ Status = gRT->GetVariable(
+ NORMAL_SETUP_NAME,
+ &gEfiNormalSetupGuid,
+ NULL,
+ &VarSize,
+ &SystemConfiguration
+ );
+
+ VarSize = sizeof(Selection);
+ Status = gRT->GetVariable(
+ L"OsSelection",
+ &gOsSelectionVariableGuid,
+ NULL,
+ &VarSize,
+ &Selection
+ );
+
+ if (EFI_ERROR(Status)) {
+ Selection = SystemConfiguration.ReservedO;
+ Status = gRT->SetVariable (
+ L"OsSelection",
+ &gOsSelectionVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(Selection),
+ &Selection
+ );
+ }
+
+ GuidHob.Raw = GetHobList ();
+ if (GuidHob.Raw != NULL) {
+ if ((GuidHob.Raw = GetNextGuidHob (&gOsSelectionVariableGuid, GuidHob.Raw)) != NULL) {
+ OsSlectionHobPtr = GET_GUID_HOB_DATA (GuidHob.Guid);
+
+ if (OsSlectionHobPtr->OsSelectionChanged) {
+ SystemConfiguration.ReservedO = OsSlectionHobPtr->OsSelection;
+
+ //
+ // Load Audio default configuration
+ //
+ SystemConfiguration.Lpe = OsSlectionHobPtr->Lpe;
+ SystemConfiguration.PchAzalia = OsSlectionHobPtr->PchAzalia;
+
+ //
+ // Load LPSS and SCC default configurations
+ //
+ LpssDataHobPtr = &OsSlectionHobPtr->LpssData.LpssPciModeEnabled;
+ LpssDataVarPtr = &SystemConfiguration.LpssPciModeEnabled;
+ for (i = 0; i < sizeof(EFI_PLATFORM_LPSS_DATA); i++) {
+ *LpssDataVarPtr = *LpssDataHobPtr;
+ LpssDataVarPtr++;
+ LpssDataHobPtr++;
+ }
+
+ SystemConfiguration.GOPEnable = TRUE;
+
+ Status = gRT->SetVariable (
+ NORMAL_SETUP_NAME,
+ &gEfiNormalSetupGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(SYSTEM_CONFIGURATION),
+ &SystemConfiguration
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+
+ GuidHob.Raw = GetHobList ();
+ if (GuidHob.Raw == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) {
+ PlatformInfoHobPtr = GET_GUID_HOB_DATA (GuidHob.Guid);
+ VarSize = sizeof(EFI_PLATFORM_INFO_HOB);
+ Status = gRT->GetVariable(
+ L"PlatformInfo",
+ &gEfiVlv2VariableGuid,
+ NULL,
+ &VarSize,
+ &TmpHob
+ );
+
+ if (EFI_ERROR(Status) || CompareMem (&TmpHob, PlatformInfoHobPtr, VarSize)) {
+
+ //
+ // Write the Platform Info to volatile memory
+ //
+ Status = gRT->SetVariable(
+ L"PlatformInfo",
+ &gEfiVlv2VariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof(EFI_PLATFORM_INFO_HOB),
+ PlatformInfoHobPtr
+ );
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.h b/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.h
new file mode 100644
index 000000000..717d0c9dd
--- /dev/null
+++ b/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.h
@@ -0,0 +1,35 @@
+/*++
+
+ Copyright (c) 2004 - 2014, 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 that 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.
+
+
+Module Name:
+ PlatformInfoDxe.h
+
+Abstract:
+ Platform Info Driver.
+
+--*/
+
+#ifndef _PLATFORM_INFO_DRIVER_H_
+#define _PLATFORM_INFO_DRIVER_H_
+
+#include <PiDxe.h>
+#include <Library/HobLib.h>
+#include <Guid/PlatformInfo.h>
+#include <Guid/GlobalVariable.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Guid/Vlv2Variable.h>
+#include <Library/BaseMemoryLib.h>
+#include <SetupMode.h>
+#include <Guid/OsSelection.h>
+#include <Guid/SetupVariable.h>
+#endif
diff --git a/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.inf b/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.inf
new file mode 100644
index 000000000..e507d498d
--- /dev/null
+++ b/Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.inf
@@ -0,0 +1,57 @@
+#
+#
+# Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved
+#
+# This program and the accompanying materials are licensed and made available under
+# the terms and conditions of the BSD License that 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.
+#
+#
+#
+# Module Name:
+#
+# PlatformInfoDxe.inf
+#
+# Abstract:
+#
+#
+--*/
+
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PlatformInfoDxe
+ FILE_GUID = 025F738B-4EBD-4d55-B728-5F421B601F1F
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = PlatformInfoInit
+
+[sources]
+ PlatformInfoDxe.c
+ PlatformInfoDxe.h
+
+[Guids]
+ gEfiAcpiVariableGuid # ALWAYS_CONSUMED
+ gEfiPlatformInfoGuid # ALWAYS_CONSUMED
+ gEfiVlv2VariableGuid
+ gEfiNormalSetupGuid
+ gOsSelectionVariableGuid
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ Vlv2TbltDevicePkg/PlatformPkg.dec
+ Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
+
+[LibraryClasses]
+ HobLib
+ UefiRuntimeServicesTableLib
+ UefiDriverEntryPoint
+ BaseMemoryLib
+
+[Depex]
+ gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid