--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+ Copyright (c) 2007, Intel Corporation.\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/HobLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+\r
+#endif\r
--- /dev/null
+#/** @file\r
+# Component description file for Dxe Core Hob Library.\r
+#\r
+# HOB Library implementation for the DXE Core. Does not have a constructor.\r
+# Uses gHobList defined in the DXE Core Entry Point Library.\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = DxeCoreHobLib\r
+ FILE_GUID = 882ee1a3-35b2-412c-b8a2-7a8d34a7c390\r
+ MODULE_TYPE = DXE_CORE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = HobLib|DXE_CORE \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ HobLib.h\r
+ HobLib.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+ $(WORKSPACE)/MdePkg\Include/Library\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+ DebugLib\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>DxeCoreHobLib</ModuleName>\r
+ <ModuleType>DXE_CORE</ModuleType>\r
+ <GuidValue>882ee1a3-35b2-412c-b8a2-7a8d34a7c390</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Component description file for Dxe Core Hob Library.</Abstract>\r
+ <Description>HOB Library implementation for the DXE Core. Does not have a constructor.
+ Uses gHobList defined in the DXE Core Entry Point Library.</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>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.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>DxeCoreHobLib</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE">\r
+ <Keyword>HobLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>HobLib.c</Filename>\r
+ <Filename>HobLib.h</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/** @file\r
+ HOB Library.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: HobLib.c\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include "HobLib.h"\r
+\r
+/**\r
+ Returns the pointer to the HOB list.\r
+\r
+ This function returns the pointer to first HOB in the list.\r
+\r
+ @return The pointer to the HOB list.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetHobList (\r
+ VOID\r
+ )\r
+{\r
+ return gHobList;\r
+}\r
+\r
+/**\r
+ Returns the next instance of a HOB type from the starting HOB.\r
+\r
+ This function searches the first instance of a HOB type from the starting HOB pointer. \r
+ If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r
+ In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
+ unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
+ caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
+ If HobStart is NULL, then ASSERT().\r
+\r
+ @param Type The HOB type to return.\r
+ @param HobStart The starting HOB pointer to search from.\r
+\r
+ @return The next instance of a HOB type from the starting HOB.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetNextHob (\r
+ IN UINT16 Type,\r
+ IN CONST VOID *HobStart\r
+ )\r
+{\r
+ EFI_PEI_HOB_POINTERS Hob;\r
+\r
+ ASSERT (HobStart != NULL);\r
+ \r
+ Hob.Raw = (UINT8 *) HobStart;\r
+ //\r
+ // Parse the HOB list until end of list or matching type is found.\r
+ //\r
+ while (!END_OF_HOB_LIST (Hob)) {\r
+ if (Hob.Header->HobType == Type) {\r
+ return Hob.Raw;\r
+ }\r
+ Hob.Raw = GET_NEXT_HOB (Hob);\r
+ }\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Returns the first instance of a HOB type among the whole HOB list.\r
+\r
+ This function searches the first instance of a HOB type among the whole HOB list. \r
+ If there does not exist such HOB type in the HOB list, it will return NULL. \r
+\r
+ @param Type The HOB type to return.\r
+\r
+ @return The next instance of a HOB type from the starting HOB.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetFirstHob (\r
+ IN UINT16 Type\r
+ )\r
+{\r
+ VOID *HobList;\r
+\r
+ HobList = GetHobList ();\r
+ return GetNextHob (Type, HobList);\r
+}\r
+\r
+/**\r
+ This function searches the first instance of a HOB from the starting HOB pointer. \r
+ Such HOB should satisfy two conditions: \r
+ its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. \r
+ If there does not exist such HOB from the starting HOB pointer, it will return NULL. \r
+ Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
+ to extract the data section and its size info respectively.\r
+ In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
+ unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
+ caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
+ If Guid is NULL, then ASSERT().\r
+ If HobStart is NULL, then ASSERT().\r
+\r
+ @param Guid The GUID to match with in the HOB list.\r
+ @param HobStart A pointer to a Guid.\r
+\r
+ @return The next instance of the matched GUID HOB from the starting HOB.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetNextGuidHob (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN CONST VOID *HobStart\r
+ )\r
+{\r
+ EFI_PEI_HOB_POINTERS GuidHob;\r
+\r
+ GuidHob.Raw = (UINT8 *) HobStart;\r
+ while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {\r
+ if (CompareGuid (Guid, &GuidHob.Guid->Name)) {\r
+ break;\r
+ }\r
+ GuidHob.Raw = GET_NEXT_HOB (GuidHob);\r
+ }\r
+ return GuidHob.Raw;\r
+}\r
+\r
+/**\r
+ This function searches the first instance of a HOB among the whole HOB list. \r
+ Such HOB should satisfy two conditions:\r
+ its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
+ If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
+ Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
+ to extract the data section and its size info respectively.\r
+ If Guid is NULL, then ASSERT().\r
+\r
+ @param Guid The GUID to match with in the HOB list.\r
+\r
+ @return The first instance of the matched GUID HOB among the whole HOB list.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetFirstGuidHob (\r
+ IN CONST EFI_GUID *Guid\r
+ )\r
+{\r
+ VOID *HobList;\r
+\r
+ HobList = GetHobList ();\r
+ return GetNextGuidHob (Guid, HobList);\r
+}\r
+\r
+/**\r
+ Get the Boot Mode from the HOB list.\r
+\r
+ This function returns the system boot mode information from the \r
+ PHIT HOB in HOB list.\r
+\r
+ @param VOID\r
+\r
+ @return The Boot Mode.\r
+\r
+**/\r
+EFI_BOOT_MODE\r
+EFIAPI\r
+GetBootModeHob (\r
+ VOID\r
+ )\r
+{\r
+ EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
+\r
+ HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();\r
+\r
+ return HandOffHob->BootMode;\r
+}\r
+/**\r
+ Builds a HOB for a loaded PE32 module.\r
+\r
+ This function builds a HOB for a loaded PE32 module.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If ModuleName is NULL, then ASSERT().\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param ModuleName The GUID File Name of the module.\r
+ @param MemoryAllocationModule The 64 bit physical address of the module.\r
+ @param ModuleLength The length of the module in bytes.\r
+ @param EntryPoint The 64 bit physical address of the module's entry point.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildModuleHob (\r
+ IN CONST EFI_GUID *ModuleName,\r
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
+ IN UINT64 ModuleLength,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB that describes a chunk of system memory.\r
+\r
+ This function builds a HOB that describes a chunk of system memory.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param ResourceType The type of resource described by this HOB.\r
+ @param ResourceAttribute The resource attributes of the memory described by this HOB.\r
+ @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r
+ @param NumberOfBytes The length of the memory described by this HOB in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildResourceDescriptorHob (\r
+ IN EFI_RESOURCE_TYPE ResourceType,\r
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
+ IN UINT64 NumberOfBytes\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a GUID HOB with a certain data length.\r
+\r
+ This function builds a customized HOB tagged with a GUID for identification \r
+ and returns the start address of GUID HOB data so that caller can fill the customized data. \r
+ The HOB Header and Name field is already stripped.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If Guid is NULL, then ASSERT().\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+ If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+\r
+ @param Guid The GUID to tag the customized HOB.\r
+ @param DataLength The size of the data payload for the GUID HOB.\r
+\r
+ @return The start address of GUID HOB data.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+BuildGuidHob (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN UINTN DataLength\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Copies a data buffer to a newly-built HOB.\r
+\r
+ This function builds a customized HOB tagged with a GUID for identification,\r
+ copies the input data to the HOB data field and returns the start address of the GUID HOB data.\r
+ The HOB Header and Name field is already stripped.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If Guid is NULL, then ASSERT().\r
+ If Data is NULL and DataLength > 0, then ASSERT().\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+ If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+\r
+ @param Guid The GUID to tag the customized HOB.\r
+ @param Data The data to be copied into the data field of the GUID HOB.\r
+ @param DataLength The size of the data payload for the GUID HOB.\r
+\r
+ @return The start address of GUID HOB data.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+BuildGuidDataHob (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN VOID *Data,\r
+ IN UINTN DataLength\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Builds a Firmware Volume HOB.\r
+\r
+ This function builds a Firmware Volume HOB.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The base address of the Firmware Volume.\r
+ @param Length The size of the Firmware Volume in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildFvHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a Capsule Volume HOB.\r
+\r
+ This function builds a Capsule Volume HOB.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The base address of the Capsule Volume.\r
+ @param Length The size of the Capsule Volume in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildCvHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the CPU.\r
+\r
+ This function builds a HOB for the CPU.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r
+ @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildCpuHob (\r
+ IN UINT8 SizeOfMemorySpace,\r
+ IN UINT8 SizeOfIoSpace\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the Stack.\r
+\r
+ This function builds a HOB for the stack.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The 64 bit physical address of the Stack.\r
+ @param Length The length of the stack in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildStackHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the BSP store.\r
+\r
+ This function builds a HOB for BSP store.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The 64 bit physical address of the BSP.\r
+ @param Length The length of the BSP store in bytes.\r
+ @param MemoryType Type of memory allocated by this HOB.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildBspStoreHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the memory allocation.\r
+\r
+ This function builds a HOB for the memory allocation.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The 64 bit physical address of the memory.\r
+ @param Length The length of the memory allocation in bytes.\r
+ @param MemoryType Type of memory allocated by this HOB.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildMemoryAllocationHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
--- /dev/null
+/** @file\r
+ Internal include file of DXE Entry Point HOB Library.\r
+\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: HobLib.h\r
+\r
+**/\r
+\r
+#ifndef __DXE_ENTRY_POINT_HOB_LIB_H__\r
+#define __DXE_ENTRY_POINT_HOB_LIB_H__\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+extern VOID *gHobList;\r
+\r
+#endif\r
--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+ Copyright (c) 2007, Intel Corporation.\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Guid/HobList.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/HobLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+\r
+#endif\r
--- /dev/null
+#/** @file\r
+# Component description file for Dxe Hob Library.\r
+#\r
+# HOB Library implementation that retrieves the HOB List\r
+# from the System Configuration Table in the EFI System Table.\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = DxeHobLib\r
+ FILE_GUID = f12b59c9-76d0-4661-ad7c-f04d1bef0558\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = HobLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+ CONSTRUCTOR = HobLibConstructor\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ HobLib.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+ $(WORKSPACE)/MdePkg\Include/Library\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ BaseMemoryLib\r
+ DebugLib\r
+ UefiLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Guid C Name Section - list of Guids that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Guids]\r
+ gEfiHobListGuid # ALWAYS_CONSUMED\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>DxeHobLib</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>f12b59c9-76d0-4661-ad7c-f04d1bef0558</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Component description file for Dxe Hob Library.</Abstract>\r
+ <Description>HOB Library implementation that retrieves the HOB List
+ from the System Configuration Table in the EFI System Table.</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>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.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>DxeHobLib</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">\r
+ <Keyword>HobLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>HobLib.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Guids>\r
+ <GuidCNames Usage="ALWAYS_CONSUMED">\r
+ <GuidCName>gEfiHobListGuid</GuidCName>\r
+ </GuidCNames>\r
+ </Guids>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ <Extern>\r
+ <Constructor>HobLibConstructor</Constructor>\r
+ </Extern>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/** @file\r
+ HOB Library.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: HobLib.c\r
+\r
+**/\r
+\r
+\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+STATIC VOID *mHobList = NULL;\r
+\r
+/**\r
+ The constructor function caches the pointer to HOB list.\r
+ \r
+ The constructor function gets the start address of HOB list from system configuration table.\r
+ It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. \r
+\r
+ @param ImageHandle The firmware allocated handle for the EFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
+ \r
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HobLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &mHobList);\r
+ ASSERT_EFI_ERROR (Status);\r
+ ASSERT (mHobList != NULL);\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Returns the pointer to the HOB list.\r
+\r
+ This function returns the pointer to first HOB in the list.\r
+\r
+ @return The pointer to the HOB list.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetHobList (\r
+ VOID\r
+ )\r
+{\r
+ return mHobList;\r
+}\r
+\r
+/**\r
+ Returns the next instance of a HOB type from the starting HOB.\r
+\r
+ This function searches the first instance of a HOB type from the starting HOB pointer. \r
+ If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r
+ In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
+ unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
+ caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
+ If HobStart is NULL, then ASSERT().\r
+\r
+ @param Type The HOB type to return.\r
+ @param HobStart The starting HOB pointer to search from.\r
+\r
+ @return The next instance of a HOB type from the starting HOB.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetNextHob (\r
+ IN UINT16 Type,\r
+ IN CONST VOID *HobStart\r
+ )\r
+{\r
+ EFI_PEI_HOB_POINTERS Hob;\r
+\r
+ ASSERT (HobStart != NULL);\r
+ \r
+ Hob.Raw = (UINT8 *) HobStart;\r
+ //\r
+ // Parse the HOB list until end of list or matching type is found.\r
+ //\r
+ while (!END_OF_HOB_LIST (Hob)) {\r
+ if (Hob.Header->HobType == Type) {\r
+ return Hob.Raw;\r
+ }\r
+ Hob.Raw = GET_NEXT_HOB (Hob);\r
+ }\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Returns the first instance of a HOB type among the whole HOB list.\r
+\r
+ This function searches the first instance of a HOB type among the whole HOB list. \r
+ If there does not exist such HOB type in the HOB list, it will return NULL. \r
+\r
+ @param Type The HOB type to return.\r
+\r
+ @return The next instance of a HOB type from the starting HOB.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetFirstHob (\r
+ IN UINT16 Type\r
+ )\r
+{\r
+ VOID *HobList;\r
+\r
+ HobList = GetHobList ();\r
+ return GetNextHob (Type, HobList);\r
+}\r
+\r
+/**\r
+ This function searches the first instance of a HOB from the starting HOB pointer. \r
+ Such HOB should satisfy two conditions: \r
+ its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. \r
+ If there does not exist such HOB from the starting HOB pointer, it will return NULL. \r
+ Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
+ to extract the data section and its size info respectively.\r
+ In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
+ unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
+ caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
+ If Guid is NULL, then ASSERT().\r
+ If HobStart is NULL, then ASSERT().\r
+\r
+ @param Guid The GUID to match with in the HOB list.\r
+ @param HobStart A pointer to a Guid.\r
+\r
+ @return The next instance of the matched GUID HOB from the starting HOB.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetNextGuidHob (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN CONST VOID *HobStart\r
+ )\r
+{\r
+ EFI_PEI_HOB_POINTERS GuidHob;\r
+\r
+ GuidHob.Raw = (UINT8 *) HobStart;\r
+ while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {\r
+ if (CompareGuid (Guid, &GuidHob.Guid->Name)) {\r
+ break;\r
+ }\r
+ GuidHob.Raw = GET_NEXT_HOB (GuidHob);\r
+ }\r
+ return GuidHob.Raw;\r
+}\r
+\r
+/**\r
+ This function searches the first instance of a HOB among the whole HOB list. \r
+ Such HOB should satisfy two conditions:\r
+ its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
+ If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
+ Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
+ to extract the data section and its size info respectively.\r
+ If Guid is NULL, then ASSERT().\r
+\r
+ @param Guid The GUID to match with in the HOB list.\r
+\r
+ @return The first instance of the matched GUID HOB among the whole HOB list.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+GetFirstGuidHob (\r
+ IN CONST EFI_GUID *Guid\r
+ )\r
+{\r
+ VOID *HobList;\r
+\r
+ HobList = GetHobList ();\r
+ return GetNextGuidHob (Guid, HobList);\r
+}\r
+\r
+/**\r
+ Get the Boot Mode from the HOB list.\r
+\r
+ This function returns the system boot mode information from the \r
+ PHIT HOB in HOB list.\r
+\r
+ @param VOID\r
+\r
+ @return The Boot Mode.\r
+\r
+**/\r
+EFI_BOOT_MODE\r
+EFIAPI\r
+GetBootModeHob (\r
+ VOID\r
+ )\r
+{\r
+ EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
+\r
+ HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();\r
+\r
+ return HandOffHob->BootMode;\r
+}\r
+\r
+/**\r
+ Builds a HOB for a loaded PE32 module.\r
+\r
+ This function builds a HOB for a loaded PE32 module.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If ModuleName is NULL, then ASSERT().\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param ModuleName The GUID File Name of the module.\r
+ @param MemoryAllocationModule The 64 bit physical address of the module.\r
+ @param ModuleLength The length of the module in bytes.\r
+ @param EntryPoint The 64 bit physical address of the module's entry point.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildModuleHob (\r
+ IN CONST EFI_GUID *ModuleName,\r
+ IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
+ IN UINT64 ModuleLength,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB that describes a chunk of system memory.\r
+\r
+ This function builds a HOB that describes a chunk of system memory.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param ResourceType The type of resource described by this HOB.\r
+ @param ResourceAttribute The resource attributes of the memory described by this HOB.\r
+ @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r
+ @param NumberOfBytes The length of the memory described by this HOB in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildResourceDescriptorHob (\r
+ IN EFI_RESOURCE_TYPE ResourceType,\r
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
+ IN UINT64 NumberOfBytes\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a GUID HOB with a certain data length.\r
+\r
+ This function builds a customized HOB tagged with a GUID for identification \r
+ and returns the start address of GUID HOB data so that caller can fill the customized data. \r
+ The HOB Header and Name field is already stripped.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If Guid is NULL, then ASSERT().\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+ If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+\r
+ @param Guid The GUID to tag the customized HOB.\r
+ @param DataLength The size of the data payload for the GUID HOB.\r
+\r
+ @return The start address of GUID HOB data.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+BuildGuidHob (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN UINTN DataLength\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Copies a data buffer to a newly-built HOB.\r
+\r
+ This function builds a customized HOB tagged with a GUID for identification,\r
+ copies the input data to the HOB data field and returns the start address of the GUID HOB data.\r
+ The HOB Header and Name field is already stripped.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If Guid is NULL, then ASSERT().\r
+ If Data is NULL and DataLength > 0, then ASSERT().\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+ If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
+\r
+ @param Guid The GUID to tag the customized HOB.\r
+ @param Data The data to be copied into the data field of the GUID HOB.\r
+ @param DataLength The size of the data payload for the GUID HOB.\r
+\r
+ @return The start address of GUID HOB data.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+BuildGuidDataHob (\r
+ IN CONST EFI_GUID *Guid,\r
+ IN VOID *Data,\r
+ IN UINTN DataLength\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+ return NULL;\r
+}\r
+\r
+/**\r
+ Builds a Firmware Volume HOB.\r
+\r
+ This function builds a Firmware Volume HOB.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The base address of the Firmware Volume.\r
+ @param Length The size of the Firmware Volume in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildFvHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a Capsule Volume HOB.\r
+\r
+ This function builds a Capsule Volume HOB.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The base address of the Capsule Volume.\r
+ @param Length The size of the Capsule Volume in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildCvHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the CPU.\r
+\r
+ This function builds a HOB for the CPU.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r
+ @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildCpuHob (\r
+ IN UINT8 SizeOfMemorySpace,\r
+ IN UINT8 SizeOfIoSpace\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the Stack.\r
+\r
+ This function builds a HOB for the stack.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The 64 bit physical address of the Stack.\r
+ @param Length The length of the stack in bytes.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildStackHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the BSP store.\r
+\r
+ This function builds a HOB for BSP store.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The 64 bit physical address of the BSP.\r
+ @param Length The length of the BSP store in bytes.\r
+ @param MemoryType Type of memory allocated by this HOB.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildBspStoreHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+ Builds a HOB for the memory allocation.\r
+\r
+ This function builds a HOB for the memory allocation.\r
+ It can only be invoked during PEI phase;\r
+ for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+ If there is no additional space for HOB creation, then ASSERT().\r
+\r
+ @param BaseAddress The 64 bit physical address of the memory.\r
+ @param Length The length of the memory allocation in bytes.\r
+ @param MemoryType Type of memory allocated by this HOB.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildMemoryAllocationHob (\r
+ IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
+ IN UINT64 Length,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
+ )\r
+{\r
+ //\r
+ // PEI HOB is read only for DXE phase\r
+ //\r
+ ASSERT (FALSE);\r
+}\r
--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+ Copyright (c) 2007 - 2007, Intel Corporation.\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiPei.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/PeiServicesTablePointerLib.h>\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Implementation for PEI Services Library.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ Module Name: PeiServicesLib.c\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+/**\r
+ This service enables a given PEIM to register an interface into the PEI Foundation.\r
+\r
+ @param PpiList A pointer to the list of interfaces that the caller shall install.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully installed.\r
+ @retval EFI_INVALID_PARAMETER The PpiList pointer is NULL.\r
+ @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesInstallPpi (\r
+ IN EFI_PEI_PPI_DESCRIPTOR *PpiList\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->InstallPpi (PeiServices, PpiList);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to replace an entry in the PPI database with an alternate entry.\r
+\r
+ @param OldPpi Pointer to the old PEI PPI Descriptors.\r
+ @param NewPpi Pointer to the new PEI PPI Descriptors.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully installed.\r
+ @retval EFI_INVALID_PARAMETER The OldPpi or NewPpi is NULL.\r
+ @retval EFI_INVALID_PARAMETER Any of the PEI PPI descriptors in the list do not have the\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI bit set in the Flags field.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
+ @retval EFI_NOT_FOUND The PPI for which the reinstallation was requested has not been\r
+ installed.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesReInstallPpi (\r
+ IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,\r
+ IN EFI_PEI_PPI_DESCRIPTOR *NewPpi\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->ReInstallPpi (PeiServices, OldPpi, NewPpi);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to discover a given instance of an interface.\r
+\r
+ @param Guid A pointer to the GUID whose corresponding interface needs to be\r
+ found.\r
+ @param Instance The N-th instance of the interface that is required.\r
+ @param PpiDescriptor A pointer to instance of the EFI_PEI_PPI_DESCRIPTOR.\r
+ @param Ppi A pointer to the instance of the interface.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully returned.\r
+ @retval EFI_NOT_FOUND The PPI descriptor is not found in the database.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesLocatePpi (\r
+ IN EFI_GUID *Guid,\r
+ IN UINTN Instance,\r
+ IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,\r
+ IN OUT VOID **Ppi\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->LocatePpi (PeiServices, Guid, Instance, PpiDescriptor, Ppi);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to register a given service to be invoked when another service is\r
+ installed or reinstalled.\r
+\r
+ @param NotifyList A pointer to the list of notification interfaces that the caller\r
+ shall install.\r
+\r
+ @retval EFI_SUCCESS The interface was successfully installed.\r
+ @retval EFI_INVALID_PARAMETER The NotifyList pointer is NULL.\r
+ @retval EFI_INVALID_PARAMETER Any of the PEI notify descriptors in the list do not have the\r
+ EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES bit set in the Flags field.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space in the PPI database.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesNotifyPpi (\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->NotifyPpi (PeiServices, NotifyList);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to ascertain the present value of the boot mode.\r
+\r
+ @param BootMode A pointer to contain the value of the boot mode.\r
+\r
+ @retval EFI_SUCCESS The boot mode was returned successfully.\r
+ @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesGetBootMode (\r
+ IN OUT EFI_BOOT_MODE *BootMode\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->GetBootMode (PeiServices, BootMode);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to update the boot mode variable.\r
+\r
+ @param BootMode The value of the boot mode to set.\r
+\r
+ @retval EFI_SUCCESS The value was successfully updated\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesSetBootMode (\r
+ IN EFI_BOOT_MODE BootMode\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->SetBootMode (PeiServices, BootMode);\r
+}\r
+\r
+/**\r
+ This service enables a PEIM to ascertain the address of the list of HOBs in memory.\r
+\r
+ @param HobList A pointer to the list of HOBs that the PEI Foundation will initialize.\r
+\r
+ @retval EFI_SUCCESS The list was successfully returned.\r
+ @retval EFI_NOT_AVAILABLE_YET The HOB list is not yet published.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesGetHobList (\r
+ IN OUT VOID **HobList\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->GetHobList (PeiServices, HobList);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to create various types of HOBs.\r
+\r
+ @param Type The type of HOB to be installed.\r
+ @param Length The length of the HOB to be added.\r
+ @param Hob The address of a pointer that will contain the HOB header.\r
+\r
+ @retval EFI_SUCCESS The HOB was successfully created.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesCreateHob (\r
+ IN UINT16 Type,\r
+ IN UINT16 Length,\r
+ IN OUT VOID **Hob\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->CreateHob (PeiServices, Type, Length, Hob);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to discover additional firmware volumes.\r
+\r
+ @param Instance This instance of the firmware volume to find. The value 0 is the\r
+ Boot Firmware Volume (BFV).\r
+ @param FwVolHeader Pointer to the firmware volume header of the volume to return.\r
+\r
+ @retval EFI_SUCCESS The volume was found.\r
+ @retval EFI_NOT_FOUND The volume was not found.\r
+ @retval EFI_INVALID_PARAMETER FwVolHeader is NULL.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsFindNextVolume (\r
+ IN UINTN Instance,\r
+ IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->FfsFindNextVolume (PeiServices, Instance, FwVolHeader);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to discover additional firmware files.\r
+\r
+ @param SearchType A filter to find files only of this type.\r
+ @param FwVolHeader Pointer to the firmware volume header of the volume to search.\r
+ This parameter must point to a valid FFS volume.\r
+ @param FileHeader Pointer to the current file from which to begin searching.\r
+\r
+ @retval EFI_SUCCESS The file was found.\r
+ @retval EFI_NOT_FOUND The file was not found.\r
+ @retval EFI_NOT_FOUND The header checksum was not zero.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsFindNextFile (\r
+ IN EFI_FV_FILETYPE SearchType,\r
+ IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,\r
+ IN OUT EFI_FFS_FILE_HEADER **FileHeader\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, FwVolHeader, FileHeader);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to discover sections of a given type within a valid FFS file.\r
+\r
+ @param SearchType The value of the section type to find.\r
+ @param FfsFileHeader A pointer to the file header that contains the set of sections to\r
+ be searched.\r
+ @param SectionData A pointer to the discovered section, if successful.\r
+\r
+ @retval EFI_SUCCESS The section was found.\r
+ @retval EFI_NOT_FOUND The section was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesFfsFindSectionData (\r
+ IN EFI_SECTION_TYPE SectionType,\r
+ IN EFI_FFS_FILE_HEADER *FfsFileHeader,\r
+ IN OUT VOID **SectionData\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->FfsFindSectionData (PeiServices, SectionType, FfsFileHeader, SectionData);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to register the permanent memory configuration\r
+ that has been initialized with the PEI Foundation.\r
+\r
+ @param MemoryBegin The value of a region of installed memory.\r
+ @param MemoryLength The corresponding length of a region of installed memory.\r
+\r
+ @retval EFI_SUCCESS The region was successfully installed in a HOB.\r
+ @retval EFI_INVALID_PARAMETER MemoryBegin and MemoryLength are illegal for this system.\r
+ @retval EFI_OUT_OF_RESOURCES There is no additional space for HOB creation.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesInstallPeiMemory (\r
+ IN EFI_PHYSICAL_ADDRESS MemoryBegin,\r
+ IN UINT64 MemoryLength\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->InstallPeiMemory (PeiServices, MemoryBegin, MemoryLength);\r
+}\r
+\r
+/**\r
+ This service enables PEIMs to allocate memory after the permanent memory has been installed by a\r
+ PEIM.\r
+\r
+ @param MemoryType Type of memory to allocate.\r
+ @param Pages Number of pages to allocate.\r
+ @param Memory Pointer of memory allocated.\r
+\r
+ @retval EFI_SUCCESS The memory range was successfully allocated.\r
+ @retval EFI_INVALID_PARAMETER Type is not equal to AllocateAnyPages.\r
+ @retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available.\r
+ @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesAllocatePages (\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Pages,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->AllocatePages (PeiServices, MemoryType, Pages, Memory);\r
+}\r
+\r
+/**\r
+ This service allocates memory from the Hand-Off Block (HOB) heap.\r
+\r
+ @param Size The number of bytes to allocate from the pool.\r
+ @param Buffer If the call succeeds, a pointer to a pointer to the allocate\r
+ buffer; undefined otherwise.\r
+\r
+ @retval EFI_SUCCESS The allocation was successful\r
+ @retval EFI_OUT_OF_RESOURCES There is not enough heap to allocate the requested size.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesAllocatePool (\r
+ IN UINTN Size,\r
+ OUT VOID **Buffer\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer);\r
+}\r
+\r
+/**\r
+ This service resets the entire platform, including all processors and devices, and reboots the\r
+ system.\r
+\r
+ @retval EFI_NOT_AVAILABLE_YET The service has not been installed yet.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesResetSystem (\r
+ VOID\r
+ )\r
+{\r
+ EFI_PEI_SERVICES **PeiServices;\r
+\r
+ PeiServices = GetPeiServicesTablePointer ();\r
+ return (*PeiServices)->ResetSystem (PeiServices);\r
+}\r
--- /dev/null
+#/** @file\r
+# Component description file for Pei Services Library.\r
+#\r
+# PEI Services Library implementation.\r
+# Copyright (c) 2007 - 2007, Intel Corporation.\r
+#\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = PeiServicesLib\r
+ FILE_GUID = a804239b-4155-446f-acc8-f0825d74908c\r
+ MODULE_TYPE = PEIM\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = PeiServicesLib|PEIM PEI_CORE \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ PeiServicesLib.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+ $(WORKSPACE)/MdePkg\Include/Library\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ PeiServicesTablePointerLib\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>PeiServicesLib</ModuleName>\r
+ <ModuleType>PEIM</ModuleType>\r
+ <GuidValue>a804239b-4155-446f-acc8-f0825d74908c</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Component description file for Pei Services Library.</Abstract>\r
+ <Description>PEI Services Library implementation.</Description>\r
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
+ <License>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.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>PeiServicesLib</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM PEI_CORE">\r
+ <Keyword>PeiServicesLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PeiServicesTablePointerLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>PeiServicesLib.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+ Copyright (c) 2007, Intel Corporation.\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiPei.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#endif\r
--- /dev/null
+\r
+/** @file\r
+ Entry point to a PEIM.\r
+\r
+Copyright (c) 2006, Intel Corporation<BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+/**\r
+ Image entry point of Peim.\r
+\r
+ @param FfsHeader Pointer to FFS header the loaded driver.\r
+ @param PeiServices Pointer to the PEI services.\r
+\r
+ @return Status returned by entry points of Peims.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ IN EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ if (_gPeimRevision != 0) {\r
+ //\r
+ // Make sure that the PEI spec revision of the platform is >= PEI spec revision of the driver\r
+ //\r
+ ASSERT ((*PeiServices)->Hdr.Revision >= _gPeimRevision);\r
+ }\r
+\r
+ //\r
+ // Call constructor for all libraries\r
+ //\r
+ ProcessLibraryConstructorList (FfsHeader, PeiServices);\r
+\r
+ //\r
+ // Call the driver entry point\r
+ //\r
+ return ProcessModuleEntryPointList (FfsHeader, PeiServices);\r
+}\r
+\r
+\r
+/**\r
+ Wrapper of Peim image entry point.\r
+\r
+ @param FfsHeader Pointer to FFS header the loaded driver.\r
+ @param PeiServices Pointer to the PEI services.\r
+\r
+ @return Status returned by entry points of Peims.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiMain (\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ IN EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ return _ModuleEntryPoint (FfsHeader, PeiServices);\r
+}\r
--- /dev/null
+#/** @file\r
+# Entry point of PEIM\r
+#\r
+# Contain entry point to PEIM Module Type, construct all dependent libararies\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = PeimEntryPoint\r
+ FILE_GUID = fa177ff7-1fc7-458d-a358-d9d62ae61cec\r
+ MODULE_TYPE = PEIM\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = PeimEntryPoint|PEIM \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ PeimEntryPoint.c\r
+ CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+ $(WORKSPACE)/MdePkg\Include/Library\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ DebugLib\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>PeimEntryPoint</ModuleName>\r
+ <ModuleType>PEIM</ModuleType>\r
+ <GuidValue>fa177ff7-1fc7-458d-a358-d9d62ae61cec</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Entry point of PEIM</Abstract>\r
+ <Description>Contain entry point to PEIM Module Type, construct all dependent libararies</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>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.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>PeimEntryPoint</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM">\r
+ <Keyword>PeimEntryPoint</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>PeimEntryPoint.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file