summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/Library/MeKernel/Pei
diff options
context:
space:
mode:
Diffstat (limited to 'ReferenceCode/ME/Library/MeKernel/Pei')
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c185
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h86
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif15
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h27
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf56
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak53
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl36
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c59
-rw-r--r--ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h42
9 files changed, 559 insertions, 0 deletions
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c
new file mode 100644
index 0000000..905020b
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.c
@@ -0,0 +1,185 @@
+/** @file
+ Implementation file for Heci Message functionality
+
+@copyright
+ Copyright (c) 2010 - 2012 Intel Corporation. All rights
+ reserved This software and associated documentation (if any)
+ is furnished under a license and may only be used or copied in
+ accordance with the terms of the license. Except as permitted
+ by such license, no part of this software or documentation may
+ be reproduced, stored in a retrieval system, or transmitted in
+ any form or by any means without the express written consent
+ of Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "CoreBiosMsg.h"
+#include "HeciMsgLibPei.h"
+#include EFI_PPI_CONSUMER (Wdt)
+
+#endif
+
+/**
+ Start Watch Dog Timer HECI message
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] HeciPpi The pointer to HECI PPI
+ @param[in] HeciMemBar HECI Memory BAR
+ @param[in] WaitTimerBios The value of waiting limit
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciAsfStartWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *HeciPpi,
+ IN UINT32 HeciMemBar,
+ IN UINT16 WaitTimerBios
+ )
+{
+ EFI_STATUS Status;
+ ASF_START_WDT AsfStartWdt;
+ UINT32 HeciLength;
+ UINT32 MeMode;
+
+ Status = HeciPpi->GetMeMode (PeiServices, &MeMode);
+ if (EFI_ERROR (Status) || (MeMode != ME_MODE_NORMAL)) {
+ return EFI_UNSUPPORTED;
+ }
+ ///
+ /// Clear Start Watch Dog Timer HECI message
+ ///
+ ZeroMem ((VOID *) &AsfStartWdt, sizeof (ASF_START_WDT));
+
+ AsfStartWdt.Command = ASF_MANAGEMENT_CONTROL;
+ AsfStartWdt.ByteCount = START_WDT_BYTE_COUNT;
+ AsfStartWdt.SubCommand = ASF_SUB_COMMAND_START_WDT;
+ AsfStartWdt.VersionNumber = START_WDT_VERSION_NUMBER;
+ AsfStartWdt.TimeoutLow = (UINT8) WaitTimerBios;
+ AsfStartWdt.TimeoutHigh = (UINT8) (WaitTimerBios >> 8);
+ AsfStartWdt.EventSensorType = START_WDT_EVENT_SENSOR_TYPE;
+ AsfStartWdt.EventType = START_WDT_EVENT_TYPE;
+ AsfStartWdt.EventOffset = START_WDT_EVENT_OFFSET;
+ AsfStartWdt.EventSourceType = START_WDT_EVENT_SOURCE_TYPE_BIOS;
+ AsfStartWdt.EventSeverity = START_WDT_EVENT_SEVERITY;
+ AsfStartWdt.SensorDevice = START_WDT_SENSOR_DEVICE;
+ AsfStartWdt.SensorNumber = START_WDT_SENSOR_NUMBER;
+ AsfStartWdt.Entity = START_WDT_ENTITY;
+ AsfStartWdt.EntityInstance = START_WDT_ENTITY_INSTANCE;
+ AsfStartWdt.EventData[0] = START_WDT_EVENT_DATA_BYTE_0;
+ AsfStartWdt.EventData[1] = START_WDT_EVENT_DATA_BYTE_1_BIOS_TIMEOUT;
+
+ HeciLength = ASF_START_WDT_LENGTH;
+
+ Status = HeciPpi->SendMsg (
+ PeiServices,
+ HeciPpi,
+ (UINT32 *) &AsfStartWdt,
+ HeciMemBar,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_ASF_MESSAGE_ADDR
+ );
+
+ return Status;
+}
+
+/**
+ Send Core BIOS Reset Request Message through HECI to reset the system.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] ResetOrigin Reset source
+ @param[in] ResetType Global or Host reset
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciSendCbmResetRequest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 ResetOrigin,
+ IN UINT8 ResetType
+ )
+{
+ EFI_STATUS Status;
+ PEI_HECI_PPI *HeciPpi;
+ CBM_RESET_REQ CbmResetRequest;
+ UINT32 HeciLength;
+ UINT32 HeciMemBar;
+ PLATFORM_ME_HOOK_PPI *PlatformMeHookPpi;
+ EFI_GUID WdtPpiGuid = WDT_PPI_GUID;
+ WDT_PPI *WdtPpi;
+
+ Status = PeiServicesLocatePpi (
+ &gPlatformMeHookPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &PlatformMeHookPpi // PPI
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to Locate PlatformMeHook Protocol for Global Reset Hook, so skip instead.", Status));
+ } else {
+ PlatformMeHookPpi->PreGlobalReset (PeiServices, PlatformMeHookPpi);
+ }
+
+ Status = PeiServicesLocatePpi (
+ &gPeiHeciPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &HeciPpi // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ Status = HeciPpi->InitializeHeci (PeiServices, HeciPpi, &HeciMemBar);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CbmResetRequest.MKHIHeader.Data = 0;
+ CbmResetRequest.MKHIHeader.Fields.Command = CBM_RESET_REQ_CMD;
+ CbmResetRequest.MKHIHeader.Fields.IsResponse = 0;
+ CbmResetRequest.MKHIHeader.Fields.GroupId = MKHI_CBM_GROUP_ID;
+ CbmResetRequest.MKHIHeader.Fields.Reserved = 0;
+ CbmResetRequest.MKHIHeader.Fields.Result = 0;
+ CbmResetRequest.Data.RequestOrigin = CBM_RR_REQ_ORIGIN_BIOS_MEMORY_INIT;
+ CbmResetRequest.Data.ResetType = CBM_HRR_GLOBAL_RESET;
+
+ HeciLength = sizeof (CBM_RESET_REQ);
+
+ Status = PeiServicesLocatePpi (
+ &WdtPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) &WdtPpi // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+ WdtPpi->AllowKnownReset ();
+
+ Status = HeciPpi->SendMsg (
+ PeiServices,
+ HeciPpi,
+ (UINT32 *) &CbmResetRequest,
+ HeciMemBar,
+ HeciLength,
+ BIOS_FIXED_HOST_ADDR,
+ HECI_CORE_MESSAGE_ADDR
+ );
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h
new file mode 100644
index 0000000..7d5c7ce
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/HeciMsgLibPei.h
@@ -0,0 +1,86 @@
+/** @file
+ Header file for Heci Message functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_HECI_MESSAGE_LIB_H_
+#define _PEI_HECI_MESSAGE_LIB_H_
+
+#include EFI_PPI_DEFINITION (Heci)
+#include EFI_PPI_DEFINITION (PlatformMeHook)
+
+#define START_WDT_BYTE_COUNT 0x0F
+#define START_WDT_VERSION_NUMBER 0x10
+#define START_WDT_EVENT_SENSOR_TYPE 0x23
+#define START_WDT_EVENT_TYPE 0x6F
+#define START_WDT_EVENT_OFFSET 0x00
+#define START_WDT_EVENT_SOURCE_TYPE_OS 0x48
+#define START_WDT_EVENT_SOURCE_TYPE_BIOS 0x00
+#define START_WDT_EVENT_SOURCE_TYPE 0x00 ///< 0x00 - BIOs, 0x48 - OS
+#define START_WDT_EVENT_SEVERITY 0x10 ///< critical
+#define START_WDT_SENSOR_DEVICE 0xFF ///< unspecified
+#define START_WDT_SENSOR_NUMBER 0xFF ///< unspecified
+#define START_WDT_ENTITY 0x00 ///< unspecified
+#define START_WDT_ENTITY_INSTANCE 0x00 ///< unspecified
+#define START_WDT_EVENT_DATA_BYTE_0 0x40
+#define START_WDT_EVENT_DATA_BYTE_1 0x02 ///< 0x02 BIOS POST WDT Timeout, 0x04 OS WDT timeout
+#define START_WDT_EVENT_DATA_BYTE_1_BIOS_TIMEOUT 0x02
+#define START_WDT_EVENT_DATA_BYTE_1_OS_TIMEOUT 0x04
+
+/**
+ Start Watch Dog Timer HECI message
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] HeciPpi The pointer to HECI PPI
+ @param[in] HeciMemBar HECI Memory BAR
+ @param[in] WaitTimerBios The value of waiting limit
+
+ @exception EFI_UNSUPPORTED Current ME mode doesn't support this function
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciAsfStartWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_HECI_PPI *HeciPpi,
+ IN UINT32 HeciMemBar,
+ IN UINT16 WaitTimerBios
+ )
+;
+
+/**
+ Send Core BIOS Reset Request Message through HECI to reset the system.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] ResetOrigin Reset source
+ @param[in] ResetType Global or Host reset
+
+ @retval EFI_SUCCESS Command succeeded
+ @retval EFI_DEVICE_ERROR HECI Device error, command aborts abnormally
+ @retval EFI_TIMEOUT HECI does not return the buffer before timeout
+**/
+EFI_STATUS
+PeiHeciSendCbmResetRequest (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN UINT8 ResetOrigin,
+ IN UINT8 ResetType
+ )
+;
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif
new file mode 100644
index 0000000..195b908
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.cif
@@ -0,0 +1,15 @@
+<component>
+ name = "MeLibPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\MeKernel\Pei\"
+ RefName = "MeLibPei"
+[files]
+"MeLibPei.sdl"
+"MeLibPei.mak"
+"MePolicyLibPei.c"
+"MePolicyLibPei.h"
+"HeciMsgLibPei.c"
+"HeciMsgLibPei.h"
+"MeLibPei.h"
+"MeLibPei.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h
new file mode 100644
index 0000000..af3ad62
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.h
@@ -0,0 +1,27 @@
+/** @file
+ Header file for PEI Me functionality
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_ME_LIB_H_
+#define _PEI_ME_LIB_H_
+
+#include "MePolicyLibPei.h"
+#include "HeciMsgLibPei.h"
+
+#endif
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf
new file mode 100644
index 0000000..78478c4
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.inf
@@ -0,0 +1,56 @@
+## @file
+# Component description file for Me Library functions for PEIMs
+#
+#@copyright
+# Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+
+[defines]
+BASE_NAME = MeLibPei
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ MePolicyLibPei.c
+ MePolicyLibPei.h
+ HeciMsgLibPei.c
+ HEciMsgLibPei.h
+ MeLibPei.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+
+[libraries.common]
+ MeLibPpi
+ EdkIIGluePeiServicesLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak
new file mode 100644
index 0000000..b9abbdf
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.mak
@@ -0,0 +1,53 @@
+# /*++
+# Copyright (c) 2009 Intel Corporation. All rights reserved.
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+# --*/
+# MAK file for the ModulePart:MeLibPei
+all : MeLibPei
+
+$(BUILD_DIR)\MeLibPei.lib : MeLibPei
+
+MeLibPei : $(BUILD_DIR)\MeLibPei.mak MeLibPeiBin
+
+$(BUILD_DIR)\MeLibPei.mak : $(MeLibPei_DIR)\$(@B).cif $(MeLibPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(MeLibPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+MeLibPei_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES) \
+ /I$(NB_BOARD_DIR)\
+ -I$(INTEL_COUGAR_POINT_DIR)\
+
+MeLibPei_DEFINES=\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__
+
+MeLibPei_LIBS=\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(MeLibPpi_LIB)
+
+MeLibPeiBin : $(MeLibPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\MeLibPei.mak all \
+ "MY_INCLUDES=$(MeLibPei_INCLUDES)" \
+ "CFLAGS=$(CFLAGS) $(MeLibPei_DEFINES)"\
+ TYPE=PEI_LIBRARY \
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2006, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl
new file mode 100644
index 0000000..9dfe312
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MeLibPei.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "MeLibPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable MeLibPei support in Project"
+End
+
+MODULE
+ Help = "Includes MeLibPei.mak to Project"
+ File = "MeLibPei.mak"
+End
+
+PATH
+ Name = "MeLibPei_DIR"
+ Help = "Me Library file source directory"
+End
+
+ELINK
+ Name = "MeLibPei_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\MeLibPei.lib"
+ Parent = "MeLibPei_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(MeLibPei_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c
new file mode 100644
index 0000000..733d6e3
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.c
@@ -0,0 +1,59 @@
+/** @file
+ Implementation file for Me Policy functionality for PEIM
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+
+//
+// External include files do NOT need to be explicitly specified in real EDKII
+// environment
+//
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGluePeim.h"
+#include "MePolicyLibPei.h"
+#endif
+
+/**
+ Check if Me is enabled.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiMePlatformPolicy The Me Platform Policy protocol instance
+
+ @retval EFI_SUCCESS ME platform policy Ppi loacted
+ @retval All other error conditions encountered when no ME platform policy Ppi
+**/
+EFI_STATUS
+PeiMePolicyLibInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_ME_PLATFORM_POLICY_PPI **PeiMePlatformPolicy
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Locate system configuration variable
+ //
+ Status = PeiServicesLocatePpi (
+ &gPeiMePlatformPolicyPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) PeiMePlatformPolicy // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
diff --git a/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h
new file mode 100644
index 0000000..7de458b
--- /dev/null
+++ b/ReferenceCode/ME/Library/MeKernel/Pei/MePolicyLibPei.h
@@ -0,0 +1,42 @@
+/** @file
+ Header file to define some function for getting the Intel ME policy PEI phase.
+
+@copyright
+ Copyright (c) 2006 - 2012 Intel Corporation. All rights reserved
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+ This file contains an 'Intel Peripheral Driver' and uniquely
+ identified as "Intel Reference Module" and is
+ licensed for Intel CPUs and chipsets under the terms of your
+ license agreement with Intel or your vendor. This file may
+ be modified by the user, subject to additional terms of the
+ license agreement
+**/
+#ifndef _PEI_ME_POLICY_LIB_H_
+#define _PEI_ME_POLICY_LIB_H_
+
+#include EFI_PPI_DEFINITION (MePlatformPolicyPei)
+
+/**
+ Check if Me is enabled.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiMePlatformPolicy The Me Platform Policy protocol instance
+
+ @retval EFI_SUCCESS ME platform policy Ppi loacted
+ @retval All other error conditions encountered when no ME platform policy Ppi
+**/
+EFI_STATUS
+PeiMePolicyLibInit (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_ME_PLATFORM_POLICY_PPI **PeiMePlatformPolicy
+ )
+;
+
+#endif