summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/ActiveManagement/StartWatchDog
diff options
context:
space:
mode:
authorraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
committerraywu <raywu0301@gmail.com>2018-06-15 00:00:50 +0800
commitb7c51c9cf4864df6aabb99a1ae843becd577237c (patch)
treeeebe9b0d0ca03062955223097e57da84dd618b9a /ReferenceCode/ME/ActiveManagement/StartWatchDog
downloadzprj-master.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'ReferenceCode/ME/ActiveManagement/StartWatchDog')
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c96
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif13
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs47
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h49
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf74
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak52
-rw-r--r--ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl25
7 files changed, 356 insertions, 0 deletions
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c
new file mode 100644
index 0000000..87c0818
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.c
@@ -0,0 +1,96 @@
+/** @file
+ Start Watchdog timer in PEI phase
+
+@copyright
+ Copyright (c) 1999 - 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 "StartWatchDog.h"
+#include "MeLibPei.h"
+#endif
+
+/**
+ Perform the platform spefific initializations.
+
+ @param[in] FfsHeader FFS file header pointer of this driver.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS if the interface could be successfully installed.
+**/
+EFI_STATUS
+EFIAPI
+PeiInitStartWatchDog (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ PEI_HECI_PPI *HeciPpi;
+ UINT32 HeciMemBar;
+ UINT16 WaitTimerBios;
+ UINT32 MeStatus;
+
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ ASSERT_EFI_ERROR (Status);
+
+ if (!EFI_ERROR (Status) && (BootMode == BOOT_ON_S3_RESUME)) {
+ return EFI_SUCCESS;
+ }
+
+ if (PeiAmtWatchDog (PeiServices)) {
+ 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)) {
+ ///
+ /// Get ME Status
+ ///
+ Status = HeciPpi->GetMeStatus (PeiServices, &MeStatus);
+ ASSERT_EFI_ERROR (Status);
+
+ ///
+ /// If ME is ready, send AsfStartWatchDog message
+ ///
+ if (ME_STATUS_ME_STATE_ONLY (MeStatus) == ME_READY) {
+ WaitTimerBios = PeiAmtWatchTimerBiosGet (PeiServices);
+
+ Status = PeiHeciAsfStartWatchDog (
+ PeiServices,
+ HeciPpi,
+ HeciMemBar,
+ WaitTimerBios
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ }
+
+ return Status;
+}
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif
new file mode 100644
index 0000000..0dfa5a9
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "StartWatchDog"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\ActiveManagement\StartWatchDog\Pei\"
+ RefName = "StartWatchDog"
+[files]
+"StartWatchDog.sdl"
+"StartWatchDog.mak"
+"StartWatchDog.h"
+"StartWatchDog.c"
+"StartWatchDog.dxs"
+"StartWatchDog.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs
new file mode 100644
index 0000000..3c05cbb
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.dxs
@@ -0,0 +1,47 @@
+/** @file
+ Dependency expression file for the StartWatchDog 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 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
+
+**/
+
+
+//
+// Common for R8 and R9 codebase
+//
+#include "AutoGen.h"
+#include "PeimDepex.h"
+
+//
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase;
+// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version
+// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase.
+//
+#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB)
+#include "EfiDepex.h"
+
+#include EFI_PPI_DEFINITION (Heci)
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+#include EFI_PPI_CONSUMER (BootMode)
+#endif
+
+DEPENDENCY_START
+ PEI_HECI_PPI_GUID AND
+ PEI_MASTER_BOOT_MODE_PEIM_PPI AND
+ PEI_AMT_PLATFORM_POLICY_PPI_GUID
+DEPENDENCY_END
+
+
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h
new file mode 100644
index 0000000..5415206
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.h
@@ -0,0 +1,49 @@
+/** @file
+ StartWatchDog header file
+
+@copyright
+ Copyright (c) 1999 - 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 _EFI_START_WATCH_DOG_H_
+#define _EFI_START_WATCH_DOG_H_
+
+#include "BootMode.h"
+#include "AmtLibPei.h"
+
+#include EFI_PPI_DEPENDENCY (Heci)
+
+//
+// Function Prototypes
+//
+
+/**
+ Perform the platform spefific initializations.
+
+ @param[in] FfsHeader FFS file header pointer of this driver.
+ @param[in] PeiServices General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS if the interface could be successfully installed.
+**/
+EFI_STATUS
+EFIAPI
+PeiInitStartWatchDog (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+#endif // _EFI_START_WATCH_DOG_H_
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf
new file mode 100644
index 0000000..1dd3811
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.inf
@@ -0,0 +1,74 @@
+## @file
+# Component description file for the Start Watch Dog PEIM driver.
+#
+#@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 = StartWatchDog
+FILE_GUID = 5479E09C-2E74-481b-89F8-B0172E388D1F
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ StartWatchDog.h
+ StartWatchDog.c
+
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/AMT/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Pei
+ $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include
+
+#
+# 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
+ MeLibPei
+ AmtLibPei
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = StartWatchDog.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=PeiInitStartWatchDog
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak
new file mode 100644
index 0000000..489c455
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.mak
@@ -0,0 +1,52 @@
+# MAK file for the ModulePart:StartWatchDog
+
+all: StartWatchDog
+
+StartWatchDog: $(BUILD_DIR)\StartWatchDog.mak StartWatchDogBin
+
+$(BUILD_DIR)\StartWatchDog.mak : $(StartWatchDog_DIR)\$(@B).cif $(StartWatchDog_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(StartWatchDog_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+
+StartWatchDog_INCLUDES=\
+ $(EDK_INCLUDES)\
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES)\
+
+StartWatchDog_DEFINES = $(MY_DEFINES)\
+ /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=PeiInitStartWatchDog"\
+ /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ /D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__\
+ /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \
+
+StartWatchDog_LIBS =\
+ $(EDKPROTOCOLLIB)\
+ $(AmtLibPei_LIB)\
+ $(MeLibPpi_LIB)\
+ $(MeLibPei_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGlueBaseLibIA32_LIB)\
+ $(EdkIIGlueBaseLib_LIB)\
+ $(EdkIIGlueBaseIoLibIntrinsic_LIB)\
+ $(EdkIIGlueBaseMemoryLib_LIB)\
+ $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\
+ $(EdkIIGluePeiReportStatusCodeLib_LIB)\
+ $(EdkIIGluePeiServicesLib_LIB)\
+ $(EdkIIGluePeiMemoryAllocationLib_LIB)\
+
+StartWatchDogBin : $(StartWatchDog_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\
+ /f $(BUILD_DIR)\StartWatchDog.mak all\
+ NAME=StartWatchDog\
+ MAKEFILE=$(BUILD_DIR)\StartWatchDog.mak \
+ GUID=5479E09C-2E74-481b-89F8-B0172E388D1F\
+ "MY_INCLUDES=$(StartWatchDog_INCLUDES)"\
+ "MY_DEFINES=$(StartWatchDog_DEFINES)"\
+ ENTRY_POINT=_ModuleEntryPoint \
+ TYPE=PEIM \
+ EDKIIModule=PEIM\
+ DEPEX1=$(StartWatchDog_DIR)\StartWatchDog.dxs DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \
+ COMPRESS=0
diff --git a/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl
new file mode 100644
index 0000000..ec760e6
--- /dev/null
+++ b/ReferenceCode/ME/ActiveManagement/StartWatchDog/Pei/StartWatchDog.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "StartWatchDog_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable StartWatchDog support in Project"
+End
+
+MODULE
+ Help = "Includes StartWatchDog.mak to Project"
+ File = "StartWatchDog.mak"
+End
+
+PATH
+ Name = "StartWatchDog_DIR"
+ Help = "iAMT Heci Pei file source directory"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\StartWatchDog.ffs"
+ Parent = "FV_BB"
+ InvokeOrder = AfterParent
+End