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
This commit is contained in:
161
Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.c
Normal file
161
Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.c
Normal file
@@ -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
|
||||
);
|
35
Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.h
Normal file
35
Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.h
Normal file
@@ -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>
|
57
Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.inf
Normal file
57
Vlv2TbltDevicePkg/PlatformInfoDxe/PlatformInfoDxe.inf
Normal file
@@ -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
|
Reference in New Issue
Block a user