summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/Library/AMT/Pei
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/Library/AMT/Pei
downloadzprj-master.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'ReferenceCode/ME/Library/AMT/Pei')
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif13
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h26
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf51
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak50
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl36
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c241
-rw-r--r--ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h126
7 files changed, 543 insertions, 0 deletions
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif
new file mode 100644
index 0000000..1c34f45
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.cif
@@ -0,0 +1,13 @@
+<component>
+ name = "AmtLibPei"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\ME\Library\AMT\Pei\"
+ RefName = "AmtLibPei"
+[files]
+"AmtLibPei.sdl"
+"AmtLibPei.mak"
+"AmtPolicyLibPei.c"
+"AmtPolicyLibPei.h"
+"AmtLibPei.h"
+"AmtLibPei.inf"
+<endComponent>
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h
new file mode 100644
index 0000000..4b29fc9
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.h
@@ -0,0 +1,26 @@
+/** @file
+ Header file for PEI AMT 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_AMT_LIB_H_
+#define _PEI_AMT_LIB_H_
+
+#include "AmtPolicyLibPei.h"
+
+#endif
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf
new file mode 100644
index 0000000..44d88ad
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file for AMT 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 = AmtLibPei
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ AmtPolicyLibPei.c
+ AmtPolicyLibPei.h
+ AmtLibPei.h
+
+[includes.common]
+ $(EFI_SOURCE)/$(PROJECT_ME_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]
+ EdkIIGluePeiServicesLib
+
+[nmake.common]
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_PEI_SERVICES_LIB__
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak
new file mode 100644
index 0000000..e31ecc5
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.mak
@@ -0,0 +1,50 @@
+# /*++
+# 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:AmtLibPei
+all : AmtLibPei
+
+$(BUILD_DIR)\AmtLibPei.lib : AmtLibPei
+
+AmtLibPei : $(BUILD_DIR)\AmtLibPei.mak AmtLibPeiBin
+
+$(BUILD_DIR)\AmtLibPei.mak : $(AmtLibPei_DIR)\$(@B).cif $(AmtLibPei_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(AmtLibPei_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+AmtLibPei_INCLUDES=\
+ $(EDK_INCLUDES) \
+ $(EdkIIGlueLib_INCLUDES)\
+ $(ME_INCLUDES) \
+
+AmtLibPei_DEFINES=\
+ /D __EDKII_GLUE_PEI_SERVICES_LIB__
+
+AmtLibPei_LIBS=\
+ $(EdkIIGluePeiServicesLib_LIB)\
+
+AmtLibPeiBin : $(AmtLibPei_LIBS) $(MeLibPei_LIBS)
+ $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \
+ /f $(BUILD_DIR)\AmtLibPei.mak all \
+ "MY_INCLUDES=$(AmtLibPei_INCLUDES)" \
+ "CFLAGS=$(CFLAGS) $(AmtLibPei_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/AMT/Pei/AmtLibPei.sdl b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl
new file mode 100644
index 0000000..b3a63bd
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtLibPei.sdl
@@ -0,0 +1,36 @@
+TOKEN
+ Name = "AmtLibPei_SUPPORT"
+ Value = "1"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+ Help = "Main switch to enable AmtLibPei support in Project"
+End
+
+MODULE
+ Help = "Includes AmtLibPei.mak to Project"
+ File = "AmtLibPei.mak"
+End
+
+PATH
+ Name = "AmtLibPei_DIR"
+ Help = "iAMT Library file source directory"
+End
+
+ELINK
+ Name = "AmtLibPei_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\AmtLibPei.lib"
+ Parent = "AmtLibPei_LIB"
+ InvokeOrder = AfterParent
+End
+
+ELINK
+ Name = "/I$(AmtLibPei_DIR)"
+ Parent = "ME_INCLUDES"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c
new file mode 100644
index 0000000..472ebbc
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.c
@@ -0,0 +1,241 @@
+/** @file
+ Implementation file for AMT 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 "AmtPolicyLibPei.h"
+#endif
+
+EFI_GUID mPeiAmtStatusCodePpiGuid = PEI_AMT_STATUS_CODE_PPI_GUID;
+
+/**
+ Check if Amt is enabled in setup options.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiAmtPlatformPolicy The AMT Platform Policy protocol instance
+
+ @retval EFI_SUCCESS AMT platform policy Ppi located
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PeiAmtPolicyLibInit (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_AMT_PLATFORM_POLICY_PPI **PeiAmtPlatformPolicy
+ )
+{
+ EFI_STATUS Status;
+
+ ///
+ /// Locate system configuration variable
+ ///
+ Status = PeiServicesLocatePpi (
+ &gPeiAmtPlatformPolicyPpiGuid, // GUID
+ 0, // INSTANCE
+ NULL, // EFI_PEI_PPI_DESCRIPTOR
+ (VOID **) PeiAmtPlatformPolicy // PPI
+ );
+ ASSERT_EFI_ERROR (Status);
+ return Status;
+}
+
+/**
+ Check if AMT WatchDog is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE AMT WatchDog is disabled.
+ @retval TRUE AMT WatchDog is enabled.
+**/
+BOOLEAN
+PeiAmtWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Supported = FALSE;
+ if (ManageabilityModeSetting (PeiServices) != 0) {
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+ //
+ // First check if AMT WatchDog is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->WatchDog == 1) {
+ Supported = TRUE;
+ }
+ }
+
+ return Supported;
+}
+
+/**
+ Get WatchDog BIOS Timmer.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT16 WatchDog BIOS Timer
+**/
+UINT16
+PeiAmtWatchTimerBiosGet (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ return PeiAmtPlatformPolicy->WatchDogTimerBios;
+}
+
+/**
+ Check if AMT is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ActiveManagement is disabled.
+ @retval TRUE ActiveManagement is enabled.
+**/
+BOOLEAN
+PeiAmtSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // First check if AMT support is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->iAmtEnabled == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
+
+/**
+ Check if ASF is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ASF is disabled.
+ @retval TRUE ASF is enabled.
+**/
+BOOLEAN
+PeiAsfSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ if (PeiAmtPlatformPolicy->Revision < PEI_AMT_PLATFORM_POLICY_PPI_REVISION_2) {
+ return FALSE;
+ }
+ //
+ // First check if ASF support is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->AsfEnabled == 1) {
+ Supported = TRUE;
+ } else {
+ Supported = FALSE;
+ }
+
+ return Supported;
+}
+
+/**
+ Provide Manageability Mode setting from MEBx BIOS Sync Data
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT8 Manageability Mode = MNT_AMT or MNT_ASF
+**/
+UINT8
+ManageabilityModeSetting (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ if (PeiAmtPlatformPolicy->Revision < PEI_AMT_PLATFORM_POLICY_PPI_REVISION_2) {
+ return 0;
+ }
+
+ return (UINT8) (PeiAmtPlatformPolicy->ManageabilityMode);
+}
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+PeiFwProgressSupport (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ BOOLEAN Supported;
+ PEI_AMT_PLATFORM_POLICY_PPI *PeiAmtPlatformPolicy;
+
+ Status = PeiAmtPolicyLibInit (PeiServices, &PeiAmtPlatformPolicy);
+ ASSERT_EFI_ERROR (Status);
+
+ Supported = FALSE;
+
+ if (PeiAmtPlatformPolicy->Revision >= PEI_AMT_PLATFORM_POLICY_PPI_REVISION_3) {
+ //
+ // Check if progress event is enabled in Setup.
+ //
+ if (PeiAmtPlatformPolicy->FWProgress == 1) {
+ Supported = TRUE;
+ }
+ }
+
+ return Supported;
+}
diff --git a/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h
new file mode 100644
index 0000000..b7361f4
--- /dev/null
+++ b/ReferenceCode/ME/Library/AMT/Pei/AmtPolicyLibPei.h
@@ -0,0 +1,126 @@
+/** @file
+ Header file for PEI AMT Policy 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_AMT_POLICY_LIB_H_
+#define _PEI_AMT_POLICY_LIB_H_
+
+#include EFI_PPI_DEFINITION (AmtPlatformPolicyPei)
+#include EFI_PPI_DEFINITION (AmtStatusCode)
+
+/**
+ Check if Amt is enabled in setup options.
+
+ @param[in] PeiServices General purpose services available to every PEIM.
+ @param[in] PeiAmtPlatformPolicy The AMT Platform Policy protocol instance
+
+ @retval EFI_SUCCESS AMT platform policy Ppi located
+ @retval All other error conditions encountered result in an ASSERT.
+**/
+EFI_STATUS
+PeiAmtPolicyLibInit (
+ EFI_PEI_SERVICES **PeiServices,
+ PEI_AMT_PLATFORM_POLICY_PPI **PeiAmtPlatformPolicy
+ )
+;
+
+/**
+ Check if AMT WatchDog is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE AMT WatchDog is disabled.
+ @retval TRUE AMT WatchDog is enabled.
+**/
+BOOLEAN
+PeiAmtWatchDog (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Get WatchDog BIOS Timmer.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT16 WatchDog BIOS Timer
+**/
+UINT16
+PeiAmtWatchTimerBiosGet (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Check if AMT is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ActiveManagement is disabled.
+ @retval TRUE ActiveManagement is enabled.
+**/
+BOOLEAN
+PeiAmtSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Check if ASF is enabled in setup options.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval FALSE ASF is disabled.
+ @retval TRUE ASF is enabled.
+**/
+BOOLEAN
+PeiAsfSupported (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ Provide Manageability Mode setting from MEBx BIOS Sync Data
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval UINT8 Manageability Mode = MNT_AMT or MNT_ASF
+**/
+UINT8
+ManageabilityModeSetting (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+/**
+ This will return progress event Option.
+ True if the option is enabled.
+
+ @param[in] PeiServices Point to Pei Services structure
+
+ @retval True progress event is enabled.
+ @retval False progress event is disabled.
+**/
+BOOLEAN
+PeiFwProgressSupport (
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+
+#endif