From 60e6c5617f66c7c9daece88d288b54dda314886b Mon Sep 17 00:00:00 2001 From: Guo Mang Date: Fri, 23 Dec 2016 14:31:00 +0800 Subject: BroxtonPlatformPkg: Add PlatformInfoDxe Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang --- .../PlatformInfoDxe/PlatformInfoDxe.c | 68 ++++++++++++++++++++++ .../PlatformInfoDxe/PlatformInfoDxe.h | 26 +++++++++ .../PlatformInfoDxe/PlatformInfoDxe.inf | 47 +++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.c create mode 100644 Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.h create mode 100644 Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.inf diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.c new file mode 100644 index 0000000000..979e3fe9b9 --- /dev/null +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.c @@ -0,0 +1,68 @@ +/** @file + Platform Info driver to public platform related HOB data. + + Copyright (c) 1999 - 2016, 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 + 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 "PlatformInfoDxe.h" +#include + + +/** + 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[in] ImageHandle Image Handle. + @param[in] 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; + + 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); + // + // Write the Platform Info to volatile memory + // + Status = gRT->SetVariable( + L"PlatformInfo", + &gEfiBxtVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (EFI_PLATFORM_INFO_HOB), + PlatformInfoHobPtr + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.h b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.h new file mode 100644 index 0000000000..7a756a2623 --- /dev/null +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.h @@ -0,0 +1,26 @@ +/** @file + Header file for Platform Info Driver. + + Copyright (c) 1999 - 2016, 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 + 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. + +**/ + +#ifndef _PLATFORM_INFO_DRIVER_H_ +#define _PLATFORM_INFO_DRIVER_H_ + +#include +#include +#include +#include +#include + +#endif + diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.inf new file mode 100644 index 0000000000..9b462ab4f3 --- /dev/null +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformInfoDxe/PlatformInfoDxe.inf @@ -0,0 +1,47 @@ +## @file +# Platform Info Driver Module. +# +# Copyright (c) 1999 - 2016, 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 +# 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. +# +## + +[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 + gEfiBxtVariableGuid + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + BroxtonPlatformPkg/PlatformPkg.dec + BroxtonSiPkg/BroxtonSiPkg.dec + +[LibraryClasses] + HobLib + UefiRuntimeServicesTableLib + UefiDriverEntryPoint + +[Depex] + gEfiVariableArchProtocolGuid AND + gEfiVariableWriteArchProtocolGuid + -- cgit v1.2.3