diff options
author | Guo Mang <mang.guo@intel.com> | 2016-12-23 14:31:00 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2016-12-26 19:15:24 +0800 |
commit | 60e6c5617f66c7c9daece88d288b54dda314886b (patch) | |
tree | 25593f4020b0dfc4881cdf9745e05fd1b8d0488f /Platform/BroxtonPlatformPkg/Common | |
parent | 8ab3a9adc8f2b56e865e6ad4f9900066a159ec00 (diff) | |
download | edk2-platforms-60e6c5617f66c7c9daece88d288b54dda314886b.tar.xz |
BroxtonPlatformPkg: Add PlatformInfoDxe
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'Platform/BroxtonPlatformPkg/Common')
3 files changed, 141 insertions, 0 deletions
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.<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 "PlatformInfoDxe.h"
+#include <Guid/BxtVariable.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[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.<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.
+
+**/
+
+#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>
+
+#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.<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.
+#
+##
+
+[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
+
|