summaryrefslogtreecommitdiff
path: root/ReferenceCode/Chipset/SystemAgent/SampleCode
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/Chipset/SystemAgent/SampleCode
downloadzprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz
init. 1AQQW051HEADmaster
Diffstat (limited to 'ReferenceCode/Chipset/SystemAgent/SampleCode')
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc96
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h66
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c27
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h60
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif18
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf51
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak64
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl28
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h145
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h45
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c25
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h136
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf42
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h30
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c247
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs31
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h59
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf84
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c548
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs42
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h57
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf95
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif22
-rw-r--r--ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exebin0 -> 69632 bytes
26 files changed, 2068 insertions, 0 deletions
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc
new file mode 100644
index 0000000..cc3fb3d
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/AcpiBuild.dsc
@@ -0,0 +1,96 @@
+## @file
+# Build description file for building ASL and ACT file types used in ACPI tables
+# You should not put platform details, like how to build DSDT, SSDT, or how to
+# package the ACPI tables into a data file in this build. This should be platform
+# neutral code only.
+#
+#@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 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
+#
+
+[=============================================================================]
+[Compile.Ia32.act,Compile.x64.act]
+#
+# Instructions to create ACPI table sections out of ACPI table C source files.
+#
+
+#/*++
+#
+# If it already exists, then include the dependency list file for this
+# source file. If it doesn't exist, then this is a clean build and the
+# dependency file will get created below and the source file will get
+# compiled. Don't do any of this if NO_MAKEDEPS is defined.
+#
+#--*/
+!IF ("$(NO_MAKEDEPS)" == "")
+
+!IF EXIST($(DEST_DIR)\$(FILE).dep)
+!INCLUDE $(DEST_DIR)\$(FILE).dep
+!ENDIF
+
+#
+# This is how to create the dependency file.
+#
+DEP_FILE = $(DEST_DIR)\$(FILE).dep
+
+$(DEP_FILE) : $(SOURCE_FILE_NAME)
+ $(MAKEDEPS) -ignorenotfound -f $(SOURCE_FILE_NAME) -q -target \
+ $(DEST_DIR)\$(FILE).obj \
+ -o $(DEP_FILE) $(INC)
+
+!ENDIF
+
+#
+# Compile the file
+#
+$(DEST_DIR)\$(FILE).obj : $(SOURCE_FILE_NAME) $(INC_DEPS) $(DEP_FILE)
+ $(CC) $(C_FLAGS) /TC $(SOURCE_FILE_NAME)
+
+#
+# Link it
+#
+$(DEST_DIR)\$(FILE).exe : $(DEST_DIR)\$(FILE).obj
+ $(LINK) $(LINK_FLAGS_EXE) $(DEST_DIR)\$(FILE).obj /OUT:$(DEST_DIR)\$(FILE).exe /ENTRY:main
+
+#
+# Strip out the ACPI table
+#
+$(DEST_DIR)\$(FILE).acpi : $(DEST_DIR)\$(FILE).exe
+ $(GENACPITABLE) $(DEST_DIR)\$(FILE).exe $(DEST_DIR)\$(FILE).acpi
+
+#
+# Create a section from the ACPI table
+#
+$(DEST_DIR)\$(FILE).sec : $(DEST_DIR)\$(FILE).acpi
+ $(GENSECTION) -I $(DEST_DIR)\$(FILE).acpi -O $(DEST_DIR)\$(FILE).sec -S EFI_SECTION_RAW
+
+#
+# Add it to the targets to build
+#
+SECTIONS = $(SECTIONS) $(DEST_DIR)\$(FILE).sec
+
+[=============================================================================]
+[Compile.Ia32.asl,Compile.x64.asl]
+#
+# We run the ASL through the C Preprocessor to resolve definitions.
+#
+$(DEST_DIR)\$(FILE).asl : $(SOURCE_FILE_NAME)
+ $(CC) $(ASL_CPP_FLAGS) /nologo /C /EP /TC $(INC) -oa $(SOURCE_FILE_NAME) > $(DEST_DIR)\$(FILE).asl
+
+#
+# Add it to the targets to build
+#
+ASL_FILES = $(ASL_FILES) $(DEST_DIR)\$(FILE).asl
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h
new file mode 100644
index 0000000..510f1b7
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Include/Cpu.h
@@ -0,0 +1,66 @@
+/** @file
+ Various CPU-specific definitions.
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+
+#ifndef _CPU_H_
+#define _CPU_H_
+
+#define B_FAMILY_MODEL_STEPPING 0x00000FFF
+
+#define EFI_MSR_CORE_THREAD_COUNT 0x35
+#define EFI_MSR_IA32_PERF_STS 0x198
+#define EFI_MSR_IA32_PERF_CTL 0x199
+#define EFI_MSR_IA32_CLOCK_MODULATION 0x19A
+#define EFI_MSR_IA32_THERM_STATUS 0x19C
+
+#define B_BS_VID 0x0000003F
+#define N_BS_VID 0
+#define B_BS_RATIO 0x00001F00
+#define N_BS_RATIO 8
+
+///
+/// UINT64 workaround
+///
+/// The MS compiler doesn't handle QWORDs very well. I'm breaking
+/// them into DWORDs to circumvent the problems. Converting back
+/// shouldn't be a big deal.
+///
+#pragma pack(1)
+typedef union _MSR_REGISTER {
+ UINT64 Qword;
+
+ struct _DWORDS {
+ UINT32 Low;
+ UINT32 High;
+ } Dwords;
+
+ struct _BYTES {
+ UINT8 FirstByte;
+ UINT8 SecondByte;
+ UINT8 ThirdByte;
+ UINT8 FouthByte;
+ UINT8 FifthByte;
+ UINT8 SixthByte;
+ UINT8 SeventhByte;
+ UINT8 EighthByte;
+ } Bytes;
+
+} MSR_REGISTER;
+#pragma pack()
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c
new file mode 100644
index 0000000..4b1ea89
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.c
@@ -0,0 +1,27 @@
+/** @file
+ Capsule PPI GUID declaration.
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+
+#include "Tiano.h"
+#include "PeiBind.h"
+#include "PeiApi.h"
+#include EFI_PPI_DEFINITION (Capsule)
+
+EFI_GUID gPeiCapsulePpiGuid = PEI_CAPSULE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiCapsulePpiGuid, "Capsule", "Capsule Update PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h
new file mode 100644
index 0000000..200e7f5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/Capsule/Capsule.h
@@ -0,0 +1,60 @@
+/** @file
+ Capsule PPI definitions.
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+
+#ifndef _PEI_CAPSULE_PPI_H_
+#define _PEI_CAPSULE_PPI_H_
+
+#define PEI_CAPSULE_PPI_GUID \
+ { \
+ 0x3acf33ee, 0xd892, 0x40f4, 0xa2, 0xfc, 0x38, 0x54, 0xd2, 0xe1, 0x32, 0x3d \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_CAPSULE_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CAPSULE_COALESCE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN OUT VOID **MemoryBase,
+ IN OUT UINTN *MemSize
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CAPSULE_CREATE_STATE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN VOID *CapsuleBase, /// returned from coalesce
+ IN UINTN CapsuleSize /// returned from coalesce
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CAPSULE_CHECK_CAPSULE_UPDATE) (
+ IN EFI_PEI_SERVICES **PeiServices
+ );
+
+struct _PEI_CAPSULE_PPI {
+ PEI_CAPSULE_COALESCE Coalesce;
+ PEI_CAPSULE_CHECK_CAPSULE_UPDATE CheckCapsuleUpdate;
+ PEI_CAPSULE_CREATE_STATE CreateState;
+};
+
+extern EFI_GUID gPeiCapsulePpiGuid;
+
+#endif /// #ifndef _PEI_CAPSULE_PPI_H_
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif
new file mode 100644
index 0000000..e8e28a4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.cif
@@ -0,0 +1,18 @@
+<component>
+ name = "IntelSaSampleCodePpiLib"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SampleCode\Ppi"
+ RefName = "IntelSaSampleCodePpiLib"
+[files]
+"IntelSaSampleCodePpiLib.sdl"
+"IntelSaSampleCodePpiLib.mak"
+"IntelSaSampleCodePpiLib.inf"
+"PlatformMemoryRange\PlatformMemoryRange.c"
+"PlatformMemoryRange\PlatformMemoryRange.h"
+"PlatformMemorySize\PlatformMemorySize.c"
+"PlatformMemorySize\PlatformMemorySize.h"
+"Capsule\Capsule.c"
+"Capsule\Capsule.h"
+"SmmAccess\SmmAccess.c"
+"SmmAccess\SmmAccess.h"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf
new file mode 100644
index 0000000..ce3a918
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.inf
@@ -0,0 +1,51 @@
+## @file
+# Component description file for the PEI protocol library
+#
+#@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 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 = IntelSaSampleCodePpiLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ Capsule/Capsule.h
+ Capsule/Capsule.c
+ PlatformMemorySize/PlatformMemorySize.h
+ PlatformMemorySize/PlatformMemorySize.c
+ PlatformMemoryRange/PlatformMemoryRange.h
+ PlatformMemoryRange/PlatformMemoryRange.c
+ SmmAccess/SmmAccess.c
+ SmmAccess/SmmAccess.h
+
+[includes.common]
+ $(EFI_SOURCE)
+ $(EDK_SOURCE)/Foundation
+ $(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/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak
new file mode 100644
index 0000000..c94e324
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.mak
@@ -0,0 +1,64 @@
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#*************************************************************************
+
+#*************************************************************************
+# $Header: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Refcode/SaSampleCode/IntelSaSampleCodePpiLib/IntelSaSampleCodePpiLib.mak 1 2/08/12 4:53a Yurenlai $
+#
+# $Revision: 1 $
+#
+# $Date: 2/08/12 4:53a $
+#*************************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/BIN/Chipset/Intel/NorthBridge/Haswell/Intel SystemAgent NB Refcode/SaSampleCode/IntelSaSampleCodePpiLib/IntelSaSampleCodePpiLib.mak $
+#
+# 1 2/08/12 4:53a Yurenlai
+# Intel Haswell/NB eChipset initially releases.
+#
+#*************************************************************************
+#<AMI_FHDR_START>
+#
+# Name: IntelSaSampleCodePpiLib_LIB.mak
+#
+# Description:
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : IntelSaSampleCodePpiLib
+
+$(BUILD_DIR)\IntelSaSampleCodePpiLib.lib : IntelSaSampleCodePpiLib
+
+IntelSaSampleCodePpiLib : $(BUILD_DIR)\IntelSaSampleCodePpiLib.mak IntelSaSampleCodePpiLibBin
+
+$(BUILD_DIR)\IntelSaSampleCodePpiLib.mak : $(IntelSaSampleCodePpiLib_DIR)\$(@B).cif $(IntelSaSampleCodePpiLib_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(IntelSaSampleCodePpiLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+IntelSaSampleCodePpiLibBin :
+ $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\
+ /f $(BUILD_DIR)\IntelSaSampleCodePpiLib.mak all\
+ "MY_INCLUDES=$(EDK_INCLUDES) $(INTEL_MCH_INCLUDES) /I$(INTEL_SYSTEM_AGENT_DIR)\SampleCode" \
+ TYPE=PEI_LIBRARY \
+#*************************************************************************
+#*************************************************************************
+#** **
+#** (C)Copyright 1985-2011, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#*************************************************************************
+#************************************************************************* \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl
new file mode 100644
index 0000000..02bda23
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/IntelSaSampleCodePpiLib.sdl
@@ -0,0 +1,28 @@
+TOKEN
+ Name = "IntelSaSampleCodePpiLib_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable FrameworkPpiLib support in Project"
+ TokenType = Boolean
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "IntelSaSampleCodePpiLib_DIR"
+End
+
+MODULE
+ Help = "Includes IntelSaSampleCodePpiLib.mak to Project"
+ File = "IntelSaSampleCodePpiLib.mak"
+End
+
+ELINK
+ Name = "IntelSaSampleCodePpiLib_LIB"
+ InvokeOrder = ReplaceParent
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\IntelSaSampleCodePpiLib.lib"
+ Parent = "IntelSaSampleCodePpiLib_LIB"
+ InvokeOrder = AfterParent
+End
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c
new file mode 100644
index 0000000..c3c1d75
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.c
@@ -0,0 +1,25 @@
+/** @file
+ Platform Memory Range PPI GUID as defined in EFI 2.0
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (PlatformMemoryRange)
+
+EFI_GUID gPeiPlatformMemoryRangePpiGuid = PEI_PLATFORM_MEMORY_RANGE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiPlatformMemoryRangePpiGuid, "PlatformMemoryRange", "Platform Memory Range PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h
new file mode 100644
index 0000000..a9a2b3e
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemoryRange/PlatformMemoryRange.h
@@ -0,0 +1,145 @@
+/** @file
+ Platform Memory Range PPI as defined in EFI 2.0
+ PPI for reserving special purpose memory ranges.
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_PLATFORM_MEMORY_RANGE_H_
+#define _PEI_PLATFORM_MEMORY_RANGE_H_
+
+#define PEI_PLATFORM_MEMORY_RANGE_PPI_GUID \
+ { \
+ 0x30eb2979, 0xb0f7, 0x4d60, 0xb2, 0xdc, 0x1a, 0x2c, 0x96, 0xce, 0xb1, 0xf4 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_PLATFORM_MEMORY_RANGE_PPI);
+
+#define PEI_MEMORY_RANGE_OPTION_ROM UINT32
+
+#define PEI_MR_OPTION_ROM_ALL 0xFFFFFFFF
+#define PEI_MR_OPTION_ROM_NONE 0x00000000
+#define PEI_MR_OPTION_ROM_C0000_16K 0x00000001
+#define PEI_MR_OPTION_ROM_C4000_16K 0x00000002
+#define PEI_MR_OPTION_ROM_C8000_16K 0x00000004
+#define PEI_MR_OPTION_ROM_CC000_16K 0x00000008
+#define PEI_MR_OPTION_ROM_D0000_16K 0x00000010
+#define PEI_MR_OPTION_ROM_D4000_16K 0x00000020
+#define PEI_MR_OPTION_ROM_D8000_16K 0x00000040
+#define PEI_MR_OPTION_ROM_DC000_16K 0x00000080
+#define PEI_MR_OPTION_ROM_E0000_16K 0x00000100
+#define PEI_MR_OPTION_ROM_E4000_16K 0x00000200
+#define PEI_MR_OPTION_ROM_E8000_16K 0x00000400
+#define PEI_MR_OPTION_ROM_EC000_16K 0x00000800
+#define PEI_MR_OPTION_ROM_F0000_16K 0x00001000
+#define PEI_MR_OPTION_ROM_F4000_16K 0x00002000
+#define PEI_MR_OPTION_ROM_F8000_16K 0x00004000
+#define PEI_MR_OPTION_ROM_FC000_16K 0x00008000
+
+///
+/// SMRAM Memory Range
+///
+#define PEI_MEMORY_RANGE_SMRAM UINT32
+#define PEI_MR_SMRAM_ALL 0xFFFFFFFF
+#define PEI_MR_SMRAM_NONE 0x00000000
+#define PEI_MR_SMRAM_CACHEABLE_MASK 0x80000000
+#define PEI_MR_SMRAM_SEGTYPE_MASK 0x00FF0000
+#define PEI_MR_SMRAM_ABSEG_MASK 0x00010000
+#define PEI_MR_SMRAM_HSEG_MASK 0x00020000
+#define PEI_MR_SMRAM_TSEG_MASK 0x00040000
+///
+/// If adding additional entries, SMRAM Size
+/// is a multiple of 128KB.
+///
+#define PEI_MR_SMRAM_SIZE_MASK 0x0000FFFF
+#define PEI_MR_SMRAM_SIZE_128K_MASK 0x00000001
+#define PEI_MR_SMRAM_SIZE_256K_MASK 0x00000002
+#define PEI_MR_SMRAM_SIZE_512K_MASK 0x00000004
+#define PEI_MR_SMRAM_SIZE_1024K_MASK 0x00000008
+#define PEI_MR_SMRAM_SIZE_2048K_MASK 0x00000010
+#define PEI_MR_SMRAM_SIZE_4096K_MASK 0x00000020
+#define PEI_MR_SMRAM_SIZE_8192K_MASK 0x00000040
+#define PEI_MR_SMRAM_SIZE_16384K_MASK 0x00000080
+#define PEI_MR_SMRAM_SIZE_32768K_MASK 0x00000100
+#define PEI_MR_SMRAM_SIZE_65536K_MASK 0x00000200
+
+#define PEI_MR_SMRAM_ABSEG_128K_NOCACHE 0x00010001
+#define PEI_MR_SMRAM_HSEG_128K_CACHE 0x80020001
+#define PEI_MR_SMRAM_HSEG_128K_NOCACHE 0x00020001
+#define PEI_MR_SMRAM_TSEG_128K_CACHE 0x80040001
+#define PEI_MR_SMRAM_TSEG_128K_NOCACHE 0x00040001
+#define PEI_MR_SMRAM_TSEG_256K_CACHE 0x80040002
+#define PEI_MR_SMRAM_TSEG_256K_NOCACHE 0x00040002
+#define PEI_MR_SMRAM_TSEG_512K_CACHE 0x80040004
+#define PEI_MR_SMRAM_TSEG_512K_NOCACHE 0x00040004
+#define PEI_MR_SMRAM_TSEG_1024K_CACHE 0x80040008
+#define PEI_MR_SMRAM_TSEG_1024K_NOCACHE 0x00040008
+
+///
+/// Graphics Memory Range
+///
+#define PEI_MEMORY_RANGE_GRAPHICS_MEMORY UINT32
+#define PEI_MR_GRAPHICS_MEMORY_ALL 0xFFFFFFFF
+#define PEI_MR_GRAPHICS_MEMORY_NONE 0x00000000
+#define PEI_MR_GRAPHICS_MEMORY_CACHEABLE 0x80000000
+///
+/// If adding additional entries, Graphics Memory Size
+/// is a multiple of 512KB.
+///
+#define PEI_MR_GRAPHICS_MEMORY_SIZE_MASK 0x0000FFFF
+#define PEI_MR_GRAPHICS_MEMORY_512K_NOCACHE 0x00000001
+#define PEI_MR_GRAPHICS_MEMORY_512K_CACHE 0x80000001
+#define PEI_MR_GRAPHICS_MEMORY_1M_NOCACHE 0x00000002
+#define PEI_MR_GRAPHICS_MEMORY_1M_CACHE 0x80000002
+#define PEI_MR_GRAPHICS_MEMORY_4M_NOCACHE 0x00000008
+#define PEI_MR_GRAPHICS_MEMORY_4M_CACHE 0x80000008
+#define PEI_MR_GRAPHICS_MEMORY_8M_NOCACHE 0x00000010
+#define PEI_MR_GRAPHICS_MEMORY_8M_CACHE 0x80000010
+#define PEI_MR_GRAPHICS_MEMORY_16M_NOCACHE 0x00000020
+#define PEI_MR_GRAPHICS_MEMORY_16M_CACHE 0x80000020
+#define PEI_MR_GRAPHICS_MEMORY_32M_NOCACHE 0x00000040
+#define PEI_MR_GRAPHICS_MEMORY_32M_CACHE 0x80000040
+#define PEI_MR_GRAPHICS_MEMORY_48M_NOCACHE 0x00000060
+#define PEI_MR_GRAPHICS_MEMORY_48M_CACHE 0x80000060
+#define PEI_MR_GRAPHICS_MEMORY_64M_NOCACHE 0x00000080
+#define PEI_MR_GRAPHICS_MEMORY_64M_CACHE 0x80000080
+#define PEI_MR_GRAPHICS_MEMORY_128M_NOCACHE 0x00000100
+#define PEI_MR_GRAPHICS_MEMORY_128M_CACHE 0x80000100
+#define PEI_MR_GRAPHICS_MEMORY_256M_NOCACHE 0x00000200
+#define PEI_MR_GRAPHICS_MEMORY_256M_CACHE 0x80000200
+///
+/// Pci Memory Hole
+///
+#define PEI_MEMORY_RANGE_PCI_MEMORY UINT32
+#define PEI_MR_PCI_MEMORY_SIZE_512M_MASK 0x00000001
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_CHOOSE_RANGES) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_PLATFORM_MEMORY_RANGE_PPI * This,
+ IN OUT PEI_MEMORY_RANGE_OPTION_ROM * OptionRomMask,
+ IN OUT PEI_MEMORY_RANGE_SMRAM * SmramMask,
+ IN OUT PEI_MEMORY_RANGE_GRAPHICS_MEMORY * GraphicsMemoryMask,
+ IN OUT PEI_MEMORY_RANGE_PCI_MEMORY * PciMemoryMask
+ );
+
+struct _PEI_PLATFORM_MEMORY_RANGE_PPI {
+ PEI_CHOOSE_RANGES ChooseRanges;
+};
+
+extern EFI_GUID gPeiPlatformMemoryRangePpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c
new file mode 100644
index 0000000..4a6c6ea
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.c
@@ -0,0 +1,25 @@
+/** @file
+ Platform Memory Size PPI GUID as defined in Tiano
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (PlatformMemorySize)
+
+EFI_GUID gPeiPlatformMemorySizePpiGuid = PEI_PLATFORM_MEMORY_SIZE_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiPlatformMemorySizePpiGuid, "PlatformMemorySize", "Platform Memory Size PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h
new file mode 100644
index 0000000..0c11041
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/PlatformMemorySize/PlatformMemorySize.h
@@ -0,0 +1,45 @@
+/** @file
+ Platform Memory Size PPI as defined in Tiano
+ PPI for describing the minimum platform memory size in order to successfully
+ pass control into DXE
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_PLATFORM_MEMORY_SIZE_H_
+#define _PEI_PLATFORM_MEMORY_SIZE_H_
+
+#define PEI_PLATFORM_MEMORY_SIZE_PPI_GUID \
+ { \
+ 0x9a7ef41e, 0xc140, 0x4bd1, 0xb8, 0x84, 0x1e, 0x11, 0x24, 0xb, 0x4c, 0xe6 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_PLATFORM_MEMORY_SIZE_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_GET_MINIMUM_PLATFORM_MEMORY_SIZE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_PLATFORM_MEMORY_SIZE_PPI * This,
+ IN OUT UINT64 *MemorySize
+ );
+
+struct _PEI_PLATFORM_MEMORY_SIZE_PPI {
+ PEI_GET_MINIMUM_PLATFORM_MEMORY_SIZE GetPlatformMemorySize;
+};
+
+extern EFI_GUID gPeiPlatformMemorySizePpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c
new file mode 100644
index 0000000..9dc4695
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.c
@@ -0,0 +1,25 @@
+/** @file
+ SmmAccess PPI GUID
+
+@copyright
+ Copyright (c) 2009 - 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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#include "Tiano.h"
+#include "Pei.h"
+#include EFI_PPI_DEFINITION (SmmAccess)
+
+EFI_GUID gPeiSmmAccessPpiGuid = PEI_SMM_ACCESS_PPI_GUID;
+
+EFI_GUID_STRING(&gPeiSmmAccessPpiGuid, "SmmAccess", "SMM Access PPI");
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h
new file mode 100644
index 0000000..8ff077f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Ppi/SmmAccess/SmmAccess.h
@@ -0,0 +1,136 @@
+/** @file
+ This code abstracts the PEI core to provide SmmAccess services.
+
+@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 'Framework Code' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may not be modified, except as allowed by
+ additional terms of your license agreement.
+**/
+#ifndef _PEI_SMM_ACCESS_PPI_H_
+#define _PEI_SMM_ACCESS_PPI_H_
+
+#include EFI_GUID_DEFINITION (SmramMemoryReserve)
+
+#define PEI_SMM_ACCESS_PPI_GUID \
+ { \
+ 0x268f33a9, 0xcccd, 0x48be, 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 \
+ }
+
+EFI_FORWARD_DECLARATION (PEI_SMM_ACCESS_PPI);
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_OPEN) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "open" a region of SMRAM. The
+ region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
+ The use of "open" means that the memory is visible from all PEIM
+ and SMM agents.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Open.
+
+ @retval EFI_SUCCESS - The region was successfully opened.
+ @retval EFI_DEVICE_ERROR - The region could not be opened because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_CLOSE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "close" a region of SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "close" means that the memory is only visible from SMM agents,
+ not from PEIM.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Close.
+
+ @retval EFI_SUCCESS - The region was successfully closed.
+ @retval EFI_DEVICE_ERROR - The region could not be closed because locked by
+ chipset.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_LOCK) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN UINTN DescriptorIndex
+ )
+/**
+ This routine accepts a request to "lock" SMRAM. The
+ region could be legacy AB or TSEG near top of physical memory.
+ The use of "lock" means that the memory can no longer be opened
+ to PEIM.
+
+ @param[in] This - Pointer to the SMM Access Interface.
+ @param[in] DescriptorIndex - Region of SMRAM to Lock.
+
+ @retval EFI_SUCCESS - The region was successfully locked.
+ @retval EFI_DEVICE_ERROR - The region could not be locked because at least
+ one range is still open.
+ @retval EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
+**/
+;
+
+typedef
+EFI_STATUS
+(EFIAPI *PEI_SMM_CAPABILITIES) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_SMM_ACCESS_PPI * This,
+ IN OUT UINTN *SmramMapSize,
+ IN OUT EFI_SMRAM_DESCRIPTOR * SmramMap
+ )
+/**
+ This routine services a user request to discover the SMRAM
+ capabilities of this platform. This will report the possible
+ ranges that are possible for SMRAM access, based upon the
+ memory controller capabilities.
+
+ @param[in] This - Pointer to the SMRAM Access Interface.
+ @param[in] SmramMapSize - Pointer to the variable containing size of the
+ buffer to contain the description information.
+ @param[in] SmramMap - Buffer containing the data describing the Smram
+ region descriptors.
+
+ @retval EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
+ @retval EFI_SUCCESS - The user provided a sufficiently-sized buffer.
+**/
+;
+
+struct _PEI_SMM_ACCESS_PPI {
+ PEI_SMM_OPEN Open;
+ PEI_SMM_CLOSE Close;
+ PEI_SMM_LOCK Lock;
+ PEI_SMM_CAPABILITIES GetCapabilities;
+ BOOLEAN LockState;
+ BOOLEAN OpenState;
+};
+
+extern EFI_GUID gPeiSmmAccessPpiGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf
new file mode 100644
index 0000000..32dd4d1
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/IntelSaSampleCodeProtocolLib.inf
@@ -0,0 +1,42 @@
+## @file
+# Component description file for SA SamepleCode protocol library
+#
+#@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 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 = IntelSaSampleCodeProtocolLib
+COMPONENT_TYPE = LIBRARY
+
+[sources.common]
+ PciEnumerationComplete.h
+
+[includes.common]
+ $(EDK_SOURCE)/Foundation
+ $(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
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SampleCode
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+
+[nmake.common]
+C_STD_INCLUDE=
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h
new file mode 100644
index 0000000..405c2d5
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Protocol/PciEnumerationComplete.h
@@ -0,0 +1,30 @@
+/** @file
+ PCI Enumeration Complete Protocol as defined in the PI 1.1 specification.
+ This protocol indicates that pci enumeration complete
+
+@copyright
+ Copyright (c) 2009 - 2012 Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+@par Revision Reference:
+ This Protocol is defined in UEFI Platform Initialization Specification 1.2
+ Volume 5: Standards
+**/
+
+#ifndef _PCI_ENUMERATION_COMPLETE_H_
+#define _PCI_ENUMERATION_COMPLETE_H_
+
+#define EFI_PCI_ENUMERATION_COMPLETE_GUID \
+ { \
+ 0x30cfe3e7, 0x3de1, 0x4586, { 0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93 } \
+ }
+
+extern EFI_GUID gEfiPciEnumerationCompleteProtocolGuid;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c
new file mode 100644
index 0000000..f907f4f
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.c
@@ -0,0 +1,247 @@
+/** @file
+ This file is a wrapper for Intel SA Platform Policy driver.
+ Get Setup Value to initilize Intel SA DXE Platform Policy.
+
+@copyright
+ Copyright (c) 1999 - 2014 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
+
+**/
+#include "SaDxePolicyInit.h"
+
+DXE_PLATFORM_SA_POLICY_PROTOCOL mDxePlatformSaPolicy;
+
+PCIE_ASPM_DEV_INFO mPcieAspmDevsOverride[] = {
+ ///
+ /// Tekoa w/o iAMT
+ ///
+ {0x8086, 0x108b, 0xff, 2, 2},
+ ///
+ /// Tekoa A2
+ ///
+ {0x8086, 0x108c, 0x00, 0, 0},
+ ///
+ /// Tekoa others
+ ///
+ {0x8086, 0x108c, 0xff, 2, 2},
+ ///
+ /// Vidalia
+ ///
+ {0x8086, 0x109a, 0xff, 2, 2},
+ ///
+ /// 3945ABG
+ ///
+ {0x8086, 0x4222, 0xff, 2, 3},
+ ///
+ /// 3945ABG
+ ///
+ {0x8086, 0x4227, 0xff, 2, 3},
+ ///
+ /// 3945ABG
+ ///
+ {0x8086, 0x4228, 0xff, 2, 3},
+ ///
+ /// End of table
+ ///
+ {SA_PCIE_DEV_END_OF_TABLE, 0, 0, 0, 0}
+};
+
+PCIE_LTR_DEV_INFO mPcieLtrDevsOverride[] = {
+ ///
+ /// Place holder for PCIe devices with correct LTR requirements
+ ///
+ ///
+ /// End of table
+ ///
+ {SA_PCIE_DEV_END_OF_TABLE, 0, 0, 0, 0}
+};
+///
+/// Function implementations
+///
+/**
+ Initilize Intel SA DXE Platform Policy
+
+ @param[in] ImageHandle Image handle of this driver.
+ @param[in] SystemTable Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+EFIAPI
+SaDxePolicyInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ UINT8 pegFn;
+ UINT8 Index;
+
+ SetMem (&mDxePlatformSaPolicy, sizeof (DXE_PLATFORM_SA_POLICY_PROTOCOL), 0);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_VTD_CONFIGURATION), &(mDxePlatformSaPolicy.Vtd));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_MEMORY_CONFIGURATION), &(mDxePlatformSaPolicy.MemoryConfig));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_PCIE_CONFIGURATION), &(mDxePlatformSaPolicy.PcieConfig));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_IGD_CONFIGURATION), &(mDxePlatformSaPolicy.IgdConfig));
+ ASSERT_EFI_ERROR (Status);
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_MISC_CONFIGURATION), &(mDxePlatformSaPolicy.MiscConfig));
+ ASSERT_EFI_ERROR (Status);
+#ifdef SG_SUPPORT
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_SG_VBIOS_CONFIGURATION), &(mDxePlatformSaPolicy.VbiosConfig));
+ ASSERT_EFI_ERROR (Status);
+#endif
+
+ ///
+ /// SA DXE Policy Init
+ ///
+ mDxePlatformSaPolicy.Revision = DXE_SA_PLATFORM_POLICY_PROTOCOL_REVISION_8;
+
+ ///
+ /// Initialize the VTD Configuration
+ ///
+ mDxePlatformSaPolicy.Vtd->VtdEnable = 0;
+ mDxePlatformSaPolicy.Vtd->BaseAddress[0] = 0xFED90000;
+ mDxePlatformSaPolicy.Vtd->BaseAddress[1] = 0xFED91000;
+ ///
+ /// RMRR Base and Limit Address for USB
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, (sizeof (EFI_PHYSICAL_ADDRESS) * 2), (VOID **) &mDxePlatformSaPolicy.Vtd->RmrrUsbBaseAddress);
+ ASSERT_EFI_ERROR (Status);
+ ///
+ /// BIOS must update USB RMRR base address
+ ///
+ mDxePlatformSaPolicy.Vtd->RmrrUsbBaseAddress[0] = 0x3E2E0000;
+ mDxePlatformSaPolicy.Vtd->RmrrUsbBaseAddress[1] = 0x3E2FFFFF;
+
+ ///
+ /// Initialize the PCIE Configuration
+ ///
+ mDxePlatformSaPolicy.PcieConfig->DmiAspm = PcieAspmL0sL1;
+ ///
+ /// PEG ASPM per port configuration. 3 PEG controllers i.e. 0,1,2
+ ///
+ for (pegFn = 0; pegFn < 3; pegFn++) {
+ mDxePlatformSaPolicy.PcieConfig->PegAspm[pegFn] = PcieAspmAutoConfig;
+ mDxePlatformSaPolicy.PcieConfig->PegAspmL0s[pegFn] = 0;
+ mDxePlatformSaPolicy.PcieConfig->PegDeEmphasis[pegFn] = 1;
+ }
+
+ mDxePlatformSaPolicy.PcieConfig->DmiExtSync = 0;
+ mDxePlatformSaPolicy.PcieConfig->DmiDeEmphasis = 0;
+ mDxePlatformSaPolicy.PcieConfig->DmiIot = 0;
+ mDxePlatformSaPolicy.PcieConfig->C7Allowed = 0;
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].LtrEnable = 1;
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].LtrMaxSnoopLatency = V_SA_LTR_MAX_SNOOP_LATENCY_VALUE;
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].LtrMaxNoSnoopLatency = V_SA_LTR_MAX_NON_SNOOP_LATENCY_VALUE;
+ mDxePlatformSaPolicy.PcieConfig->PegPwrOpt[Index].ObffEnable = 1;
+ }
+
+ mDxePlatformSaPolicy.PcieConfig->PcieAspmDevsOverride = mPcieAspmDevsOverride;
+ mDxePlatformSaPolicy.PcieConfig->PcieLtrDevsOverride = mPcieLtrDevsOverride;
+
+ ///
+ /// Initialize the Memory Configuration
+ ///
+ ///
+ /// DIMM SMBus addresses info
+ /// Refer to the SpdAddressTable[] mapping rule in SaPlatformPolicy.h
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, (sizeof (UINT8) * 4), (VOID **) &mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable);
+ ASSERT_EFI_ERROR (Status);
+
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[0] = DIMM_SMB_SPD_P0C0D0;
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[1] = DIMM_SMB_SPD_P0C0D1;
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[2] = DIMM_SMB_SPD_P0C1D0;
+ mDxePlatformSaPolicy.MemoryConfig->SpdAddressTable[3] = DIMM_SMB_SPD_P0C1D1;
+
+ mDxePlatformSaPolicy.MemoryConfig->ChannelASlotMap = 0x01;
+ mDxePlatformSaPolicy.MemoryConfig->ChannelBSlotMap = 0x01;
+ mDxePlatformSaPolicy.MemoryConfig->RmtBdatEnable = 0x00;
+
+ ///
+ /// Initialize the Graphics configuration
+ ///
+ mDxePlatformSaPolicy.IgdConfig->RenderStandby = 1;
+ mDxePlatformSaPolicy.IgdConfig->VbtAddress = 0x00000000;
+ mDxePlatformSaPolicy.IgdConfig->Size = 0;
+ mDxePlatformSaPolicy.IgdConfig->CdClk = 0;
+ mDxePlatformSaPolicy.IgdConfig->PlatformConfig = 1;
+
+ ///
+ /// SA internal devices and misc configuration
+ ///
+ mDxePlatformSaPolicy.MiscConfig->ChapDeviceEnable = FALSE;
+ mDxePlatformSaPolicy.MiscConfig->Device4Enable = FALSE;
+ mDxePlatformSaPolicy.MiscConfig->CridEnable = FALSE;
+ mDxePlatformSaPolicy.MiscConfig->AudioEnable = TRUE;
+ mDxePlatformSaPolicy.MiscConfig->FviReport = 1;
+ ///
+ /// Default Enable FVI SMBIOS Report
+ ///
+ mDxePlatformSaPolicy.MiscConfig->FviSmbiosType = 0xDD;
+ ///
+ /// Default SMBIOS Type 221
+ ///
+ Status = (gBS->AllocatePool) (EfiBootServicesData, sizeof (SA_DEFAULT_SVID_SID), (VOID **) &mDxePlatformSaPolicy.MiscConfig->DefaultSvidSid);
+ ASSERT_EFI_ERROR (Status);
+ mDxePlatformSaPolicy.MiscConfig->DefaultSvidSid->SubSystemVendorId = V_SA_MC_VID;
+ ///
+ /// 0x8086;
+ ///
+ mDxePlatformSaPolicy.MiscConfig->DefaultSvidSid->SubSystemId = 0x2010;
+
+
+#ifdef SG_SUPPORT
+ ///
+ /// Initialize the Switchable Graphics DXE Policies
+ ///
+
+ ///
+ /// 1 = Load secondary display device VBIOS
+ /// 0 = Do not load
+ ///
+ mDxePlatformSaPolicy.VbiosConfig->LoadVbios = 0;
+ ///
+ /// 1 = Execute the secondary display device VBIOS (only if LoadVbios == 1)
+ /// 0 = Do no execute
+ ///
+ mDxePlatformSaPolicy.VbiosConfig->ExecuteVbios = 0;
+ ///
+ /// 1 = secondary display device VBIOS Source is PCI Card
+ /// 0 = secondary display device VBIOS Source is FW Volume
+ ///
+ mDxePlatformSaPolicy.VbiosConfig->VbiosSource = 1;
+#endif
+
+ UpdateDxeSaPlatformPolicy (&mDxePlatformSaPolicy);
+
+ ///
+ /// Install protocol to to allow access to this Policy.
+ ///
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gDxePlatformSaPolicyGuid,
+ &mDxePlatformSaPolicy,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs
new file mode 100644
index 0000000..21fcf4c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.dxs
@@ -0,0 +1,31 @@
+/** @file
+ Dependency expression source 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 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
+
+**/
+
+
+#include "EfiDepex.h"
+#include EFI_PROTOCOL_DEFINITION (PchPlatformPolicy)
+#include EFI_ARCH_PROTOCOL_DEFINITION (Variable)
+
+DEPENDENCY_START
+ DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID AND
+ EFI_VARIABLE_ARCH_PROTOCOL_GUID
+DEPENDENCY_END
+
+
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h
new file mode 100644
index 0000000..8f87761
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.h
@@ -0,0 +1,59 @@
+/** @file
+ Header file for the SaDxePolicyInit Driver.
+
+@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 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
+**/
+#ifndef _SA_DXE_PLATFORM_POLICY_H_
+#define _SA_DXE_PLATFORM_POLICY_H_
+
+#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
+#include "EdkIIGlueDxe.h"
+#include "EfiScriptLib.h"
+#include EFI_PROTOCOL_PRODUCER (SaPlatformPolicy)
+#endif
+
+#include "SaAccess.h"
+#include "SaPlatformPolicyUpdateDxeLib.h"
+
+///
+/// DIMM SMBus addresses
+///
+#define DIMM_SMB_SPD_P0C0D0 0xA0
+#define DIMM_SMB_SPD_P0C0D1 0xA2
+#define DIMM_SMB_SPD_P0C1D0 0xA4
+#define DIMM_SMB_SPD_P0C1D1 0xA6
+#define DIMM_SMB_SPD_P0C0D2 0xA8
+#define DIMM_SMB_SPD_P0C1D2 0xAA
+
+/**
+ Initilize Intel SA DXE Platform Policy
+
+ @param[in] ImageHandle - Image handle of this driver.
+ @param[in] SystemTable - Global system service table.
+
+ @retval EFI_SUCCESS Initialization complete.
+ @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
+ @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
+ @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
+**/
+EFI_STATUS
+SaDxePolicyInitEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN OUT EFI_SYSTEM_TABLE *SystemTable
+ )
+;
+
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf
new file mode 100644
index 0000000..8ee2520
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Dxe/SaDxePolicyInit.inf
@@ -0,0 +1,84 @@
+## @file
+# Component description file for the SaDxePolicyInit DXE driver.
+#
+#@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 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 = SaDxePolicyInit
+FILE_GUID = 67a54a24-3f4f-4048-8787-3e5aa2a0b7d2
+COMPONENT_TYPE = BS_DRIVER
+
+[sources.common]
+ SaDxePolicyInit.c
+ SaDxePolicyInit.h
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGlueDxeDriverEntryPoint.c
+
+[includes.common]
+ .
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+ $(PLATFORM_ECP_PACKAGE)/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+
+[libraries.common]
+ EdkGuidLib
+ EdkFrameworkGuidLib
+ EdkFrameworkProtocolLib
+ EdkProtocolLib
+ EfiGuidLib
+ EfiCommonLib
+ $(PROJECT_SA_FAMILY)ProtocolLib
+ EdkIIGlueBaseLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBasePciLibPciExpress
+ EdkIIGlueDxeReportStatusCodeLib
+ EdkIIGlueDxeDebugLibReportStatusCode
+ EdkIIGlueUefiBootServicesTableLib
+ EdkIIGlueUefiRuntimeServicesTableLib
+ EdkIIGlueDxeServicesTableLib
+ PlatformPolicyUpdateDxeLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT= _ModuleEntryPoint
+ DPX_SOURCE=SaDxePolicyInit.dxs
+ C_FLAGS = $(C_FLAGS) -D"__EDKII_GLUE_MODULE_ENTRY_POINT__=SaDxePolicyInitEntryPoint" \
+ -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \
+ -D __EDKII_GLUE_BASE_LIB__ \
+ -D __EDKII_GLUE_BASE_MEMORY_LIB__ \
+ -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \
+ -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \
+ -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\
+ -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \
+ -D __EDKII_GLUE_UEFI_LIB__
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c
new file mode 100644
index 0000000..7317fb4
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.c
@@ -0,0 +1,548 @@
+/** @file
+ This file is SampleCode for Intel SA PEI Platform Policy initialzation.
+
+@copyright
+ Copyright (c) 1999 - 2014 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
+
+**/
+#include "SaPeiPolicyInit.h"
+
+///
+/// This IO Trap address can be overridden by defining it
+/// in compiling environment variable
+/// It must not conflict with other IO address in platform
+///
+#ifndef SA_IOTRAP_SMI_ADDRESS
+#define SA_IOTRAP_SMI_ADDRESS 0x2000
+#endif
+
+EFI_STATUS
+SaPeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+/**
+ This PEIM performs SA PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader - Pointer to Firmware File System file header.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - The PPI is installed and initialized.
+ @retval EFI ERRORS - The PPI is not successfully installed.
+**/
+{
+ EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *SaPlatformPolicyPpiDesc;
+ SA_PLATFORM_POLICY_PPI *SaPlatformPolicyPpi;
+ SA_PLATFORM_DATA *PlatformData;
+ GT_CONFIGURATION *GtConfig;
+ MEMORY_CONFIGURATION *MemConfig;
+ PCIE_CONFIGURATION *PcieConfig;
+ OVERCLOCKING_CONFIGURATION *OcConfig;
+ PEG_GPIO_DATA *PegGpioData;
+ CPU_FAMILY CpuFamilyId;
+#ifdef SG_SUPPORT
+ SG_GPIO_DATA *SgGpioData;
+#endif
+ UINT8 Index;
+ ///
+ /// Allocate descriptor and PPI structures
+ ///
+ SaPlatformPolicyPpi = (SA_PLATFORM_POLICY_PPI *) AllocatePool (sizeof (SA_PLATFORM_POLICY_PPI));
+ ASSERT (SaPlatformPolicyPpi != NULL);
+ EfiCommonLibZeroMem (SaPlatformPolicyPpi, sizeof (SA_PLATFORM_POLICY_PPI));
+
+ SaPlatformPolicyPpiDesc = (EFI_PEI_PPI_DESCRIPTOR *) AllocatePool (sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT (SaPlatformPolicyPpiDesc != NULL);
+ EfiCommonLibZeroMem (SaPlatformPolicyPpiDesc, sizeof (EFI_PEI_PPI_DESCRIPTOR));
+
+ PlatformData = (SA_PLATFORM_DATA *) AllocatePool (sizeof (SA_PLATFORM_DATA));
+ ASSERT (PlatformData != NULL);
+ EfiCommonLibZeroMem (PlatformData, sizeof (SA_PLATFORM_DATA));
+
+ GtConfig = (GT_CONFIGURATION *) AllocatePool (sizeof (GT_CONFIGURATION));
+ ASSERT (GtConfig != NULL);
+ EfiCommonLibZeroMem (GtConfig, sizeof (GT_CONFIGURATION));
+
+ MemConfig = (MEMORY_CONFIGURATION *) AllocatePool (sizeof (MEMORY_CONFIGURATION));
+ ASSERT (MemConfig != NULL);
+ EfiCommonLibZeroMem (MemConfig, sizeof (MEMORY_CONFIGURATION));
+
+ PcieConfig = (PCIE_CONFIGURATION *) AllocatePool (sizeof (PCIE_CONFIGURATION));
+ ASSERT (PcieConfig != NULL);
+ EfiCommonLibZeroMem (PcieConfig, sizeof (PCIE_CONFIGURATION));
+
+ PegGpioData = (PEG_GPIO_DATA *) AllocatePool (sizeof (PEG_GPIO_DATA));
+ ASSERT (PegGpioData != NULL);
+ EfiCommonLibZeroMem (PegGpioData, sizeof (PEG_GPIO_DATA));
+
+ OcConfig = (OVERCLOCKING_CONFIGURATION *) AllocatePool (sizeof (OVERCLOCKING_CONFIGURATION));
+ ASSERT (OcConfig != NULL);
+ EfiCommonLibZeroMem (OcConfig, sizeof (OVERCLOCKING_CONFIGURATION));
+
+#ifdef SG_SUPPORT
+ SgGpioData = (SG_GPIO_DATA *) AllocatePool (sizeof (SG_GPIO_DATA));
+ ASSERT (SgGpioData != NULL);
+ EfiCommonLibZeroMem (SgGpioData, sizeof (SG_GPIO_DATA));
+#endif
+
+ SetMem ((VOID *) SaPlatformPolicyPpi, sizeof (SA_PLATFORM_POLICY_PPI), 0);
+
+ ///
+ /// Initialize the PPI
+ ///
+ SaPlatformPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
+ SaPlatformPolicyPpiDesc->Guid = &gSaPlatformPolicyPpiGuid;
+ SaPlatformPolicyPpiDesc->Ppi = SaPlatformPolicyPpi;
+
+ ///
+ /// Update the REVISION number
+ ///
+ SaPlatformPolicyPpi->Revision = SA_PLATFORM_POLICY_PPI_REVISION_15;
+
+ CpuFamilyId = GetCpuFamily();
+
+ ///
+ /// Initialize the Platform Configuration
+ ///
+ PlatformData->SpdAddressTable[0] = 0xA0;
+ PlatformData->SpdAddressTable[1] = 0xA2;
+ PlatformData->SpdAddressTable[2] = 0xA4;
+ PlatformData->SpdAddressTable[3] = 0xA6;
+ PlatformData->MchBar = 0xfed10000;
+ PlatformData->DmiBar = 0xfed18000;
+ PlatformData->EpBar = 0xfed19000;
+ PlatformData->EdramBar = 0xfed80000;
+ PlatformData->PciExpressBar = (UINTN) PcdGet64 (PcdPciExpressBaseAddress);
+ PlatformData->SmbusBar = 0xEFA0;
+ PlatformData->TsegSize = 0x800000;
+ PlatformData->IedSize = 0x400000;
+ PlatformData->FastBoot = 0;
+ PlatformData->GdxcBar = 0xFED84000;
+ PlatformData->BoardId = 0;
+
+ SaPlatformPolicyPpi->PlatformData = PlatformData;
+ ///
+ /// Initialize the Graphics configuration
+ ///
+ GtConfig->GttSize = 2;
+ GtConfig->IgdDvmt50PreAlloc = 1;
+ GtConfig->InternalGraphics = 2;
+ GtConfig->PrimaryDisplay = 3;
+ GtConfig->ApertureSize = 2;
+ GtConfig->PanelPowerEnable = 0;
+ SaPlatformPolicyPpi->GtConfig = GtConfig;
+
+ ///
+ /// Initialize the Memory Configuration
+ ///
+ MemConfig->EccSupport = 1;
+ MemConfig->DdrFreqLimit = 0;
+ MemConfig->MaxTolud = 0;
+ MemConfig->SpdProfileSelected = 0;
+ MemConfig->NModeSupport = 0;
+ MemConfig->ScramblerSupport = 1;
+ MemConfig->PowerDownMode = 0xFF;
+ MemConfig->PwdwnIdleCounter = 0x80;
+ MemConfig->RankInterleave = TRUE;
+ MemConfig->EnhancedInterleave = TRUE;
+ MemConfig->WeaklockEn = TRUE;
+ MemConfig->EnCmdRate = 7;
+ MemConfig->CmdTriStateDis = FALSE;
+ MemConfig->RefreshRate2x = FALSE;
+ MemConfig->AutoSelfRefreshSupport = TRUE;
+ MemConfig->ExtTemperatureSupport = TRUE;
+
+ ///
+ /// Thermal Management Configuration
+ ///
+ MemConfig->ThermalManagement = 1;
+ MemConfig->PeciInjectedTemp = 0;
+ MemConfig->ExttsViaTsOnBoard = 0;
+ MemConfig->ExttsViaTsOnDimm = 0;
+ MemConfig->VirtualTempSensor = 0;
+ ///
+ /// Channel DIMM Disable
+ ///
+ MemConfig->DisableDimmChannel[0] = 0;
+ MemConfig->DisableDimmChannel[1] = 0;
+ ///
+ /// Channel Hash Configuration
+ ///
+ MemConfig->ChHashEnable = TRUE;
+ MemConfig->ChHashMask = 0x30CE;
+ MemConfig->ChHashInterleaveBit = 1;
+ ///
+ /// Options for Thermal settings
+ ///
+ MemConfig->EnableExtts = 0;
+ MemConfig->EnableCltm = 0;
+ MemConfig->EnableOltm = 0;
+ MemConfig->EnablePwrDn = 1;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ MemConfig->EnablePwrDnLpddr = 0;
+ }
+ MemConfig->Refresh2X = 0;
+ MemConfig->LpddrThermalSensor = 1;
+ MemConfig->LockPTMregs = 0;
+ MemConfig->UserPowerWeightsEn = 0;
+
+ MemConfig->EnergyScaleFact = 3;
+ MemConfig->RaplPwrFlCh1 = 0;
+ MemConfig->RaplPwrFlCh0 = 0;
+
+ MemConfig->RaplLim2Lock = 0;
+ MemConfig->RaplLim2WindX = 0;
+ MemConfig->RaplLim2WindY = 0;
+ MemConfig->RaplLim2Ena = 0;
+ MemConfig->RaplLim2Pwr = 0;
+ MemConfig->RaplLim1WindX = 0;
+ MemConfig->RaplLim1WindY = 0;
+ MemConfig->RaplLim1Ena = 0;
+ MemConfig->RaplLim1Pwr = 0;
+
+ MemConfig->WarmThresholdCh0Dimm0 = 0xFF;
+ MemConfig->WarmThresholdCh0Dimm1 = 0xFF;
+ MemConfig->WarmThresholdCh1Dimm0 = 0xFF;
+ MemConfig->WarmThresholdCh1Dimm1 = 0xFF;
+ MemConfig->HotThresholdCh0Dimm0 = 0xFF;
+ MemConfig->HotThresholdCh0Dimm1 = 0xFF;
+ MemConfig->HotThresholdCh1Dimm0 = 0xFF;
+ MemConfig->HotThresholdCh1Dimm1 = 0xFF;
+ MemConfig->WarmBudgetCh0Dimm0 = 0xFF;
+ MemConfig->WarmBudgetCh0Dimm1 = 0xFF;
+ MemConfig->WarmBudgetCh1Dimm0 = 0xFF;
+ MemConfig->WarmBudgetCh1Dimm1 = 0xFF;
+ MemConfig->HotBudgetCh0Dimm0 = 0xFF;
+ MemConfig->HotBudgetCh0Dimm1 = 0xFF;
+ MemConfig->HotBudgetCh1Dimm0 = 0xFF;
+ MemConfig->HotBudgetCh1Dimm1 = 0xFF;
+
+ MemConfig->IdleEnergyCh0Dimm1 = 0;
+ MemConfig->IdleEnergyCh0Dimm0 = 0;
+ MemConfig->PdEnergyCh0Dimm1 = 0;
+ MemConfig->PdEnergyCh0Dimm0 = 0;
+ MemConfig->ActEnergyCh0Dimm1 = 0;
+ MemConfig->ActEnergyCh0Dimm0 = 0;
+ MemConfig->RdEnergyCh0Dimm1 = 0;
+ MemConfig->RdEnergyCh0Dimm0 = 0;
+ MemConfig->WrEnergyCh0Dimm1 = 0;
+ MemConfig->WrEnergyCh0Dimm0 = 0;
+
+ MemConfig->IdleEnergyCh1Dimm1 = 0;
+ MemConfig->IdleEnergyCh1Dimm0 = 0;
+ MemConfig->PdEnergyCh1Dimm1 = 0;
+ MemConfig->PdEnergyCh1Dimm0 = 0;
+ MemConfig->ActEnergyCh1Dimm1 = 0;
+ MemConfig->ActEnergyCh1Dimm0 = 0;
+ MemConfig->RdEnergyCh1Dimm1 = 0;
+ MemConfig->RdEnergyCh1Dimm0 = 0;
+ MemConfig->WrEnergyCh1Dimm1 = 0;
+ MemConfig->WrEnergyCh1Dimm0 = 0;
+
+ MemConfig->SrefCfgEna = 1;
+ MemConfig->SrefCfgIdleTmr = 0x200;
+ MemConfig->ThrtCkeMinDefeat = 0;
+ MemConfig->ThrtCkeMinTmr = 0x30;
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ MemConfig->ThrtCkeMinDefeatLpddr = 1;
+ MemConfig->ThrtCkeMinTmrLpddr = 0x40;
+ }
+
+
+ MemConfig->McLock = TRUE;
+
+ MemConfig->GdxcEnable = TRUE;
+ MemConfig->GdxcIotSize = 4;
+ MemConfig->GdxcMotSize = 12;
+
+ MemConfig->MemoryTrace = 0;
+
+ MemConfig->ECT = 0;
+ MemConfig->SOT = 1;
+ MemConfig->RDMPRT = 1;
+ MemConfig->RCVET = 1;
+ MemConfig->JWRL = 1;
+ MemConfig->FWRL = 0;
+ MemConfig->WRTC1D = 1;
+ MemConfig->RDTC1D = 1;
+ MemConfig->DIMMODTT = 1;
+ MemConfig->WRDST = 0;
+ MemConfig->WREQT = 1;
+ MemConfig->RDODTT = 1;
+ MemConfig->RDEQT = 0;
+ MemConfig->RDAPT = 1;
+ MemConfig->WRTC2D = 1;
+ MemConfig->RDTC2D = 1;
+ MemConfig->CMDVC = 1;
+ MemConfig->WRVC2D = 1;
+ MemConfig->RDVC2D = 1;
+ MemConfig->LCT = 1;
+ MemConfig->RTL = 1;
+ MemConfig->TAT = 1;
+ MemConfig->RMT = 0;
+ MemConfig->MEMTST = 0;
+ MemConfig->DIMMODTT1D = 0;
+ MemConfig->WRSRT = 0;
+ MemConfig->DIMMRONT = 1;
+ MemConfig->ALIASCHK = 1;
+ MemConfig->RCVENC1D = 1;
+ MemConfig->RMC = 1;
+
+ MemConfig->RemapEnable = TRUE;
+ MemConfig->RmtBdatEnable = FALSE;
+ MemConfig->MrcTimeMeasure = FALSE;
+ MemConfig->MrcFastBoot = TRUE;
+ MemConfig->DDR3Voltage = 0;
+ MemConfig->DDR3VoltageWaitTime = 0;
+ MemConfig->RefClk = 0;
+ MemConfig->Ratio = 0;
+ MemConfig->BClkFrequency = 100 * 1000 * 1000;
+ MemConfig->MaxRttWr = 0;
+ ///
+ /// MrcUltPoSafeConfig
+ /// 1 to enable, 0 to disable
+ ///
+ MemConfig->MrcUltPoSafeConfig = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ ///
+ /// Interleaving mode of DQ/DQS pins - depends on board routing
+ ///
+ MemConfig->DqPinsInterleaved = FALSE;
+ }
+
+ SaPlatformPolicyPpi->MemConfig = MemConfig;
+
+ ///
+ /// Initialize the PciExpress Configuration
+ ///
+ PcieConfig->DmiVc1 = 0;
+ PcieConfig->DmiVcp = 1;
+ PcieConfig->DmiVcm = 1;
+ PcieConfig->DmiGen2 = 1;
+ PcieConfig->AlwaysEnablePeg = 0;
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ PcieConfig->PegGenx[Index] = 0;
+ }
+
+ for (Index = 0; Index < SA_PEG_MAX_FUN; Index++) {
+ PcieConfig->PowerDownUnusedBundles[Index] = 0xFF;
+ }
+
+ PcieConfig->PegGen3Equalization = 1;
+ PcieConfig->PegSamplerCalibrate = 0;
+ PcieConfig->PegSwingControl = 2;
+ PcieConfig->PegComplianceTestingMode = 0;
+
+ ///
+ /// PEG Gen3 Preset Search: 0 = Disabled, 1 = Enabled (default)
+ /// PEG Gen3 Force Preset Search (always re-search): 0 = Disabled (default), 1 = Enabled
+ /// PEG Gen3 Preset Search Dwell Time: 400 usec
+ /// PEG Gen3 Preset Search Timing Margin Steps: 2
+ /// PEG Gen3 Preset Search Timing Start Margin: 15
+ /// PEG Gen3 Preset Search Voltage Margin Steps: 2
+ /// PEG Gen3 Preset Search Voltage Start Margin: 20
+ /// PEG Gen3 Preset Search Favor Timing: 0 = Timing + Voltage (default), 1 = Timing only
+ /// PEG Gen3 Preset Search Error Target: 4
+ ///
+ PcieConfig->PegGen3PresetSearch = 1;
+ PcieConfig->PegGen3ForcePresetSearch = 0;
+ PcieConfig->PegGen3PresetSearchDwellTime = STALL_ONE_MILLI_SECOND;
+ PcieConfig->PegGen3PresetSearchStartMargin = 15;
+ PcieConfig->PegGen3PresetSearchVoltageStartMargin = 20;
+ PcieConfig->PegGen3PresetSearchErrorTarget = 1;
+
+ for (Index = 0; Index < SA_PEG_MAX_LANE; Index++) {
+ PcieConfig->Gen3RootPortPreset[Index] = 8;
+ PcieConfig->Gen3EndPointPreset[Index] = 7;
+ PcieConfig->Gen3EndPointHint[Index] = 2;
+ }
+
+ ///
+ /// Parameters for PCIe ASPM flow control
+ /// InitPcieAspmAfterOprom:
+ /// 0 (default) - PCIe ASPM will be initialized Before Oprom
+ /// 1 - PCIe ASPM will be initialized After Oprom (required IOTRAP SMI handler)
+ /// Note: This setting should match supported mode!
+ ///
+ /// SaIotrapSmiAddress:
+ /// IOTRAP SMI address for SA SMI callback handler. This should be given if platform supports InitPcieAspmAfterOprom = 1 scenario (SaLateInitSmm driver was compiled)
+ ///
+ PcieConfig->InitPcieAspmAfterOprom = FALSE;
+ PcieConfig->SaIotrapSmiAddress = SA_IOTRAP_SMI_ADDRESS;
+
+ ///
+ /// Parameters for PCIe Gen3 device reset
+ /// Note: Refer to the Platform Design Guide (PDG) for additional information about this GPIO.
+ ///
+ PegGpioData->GpioSupport = TRUE;
+ if (PegGpioData->GpioSupport) {
+ PegGpioData->SaPegReset = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (PegGpioData->SaPegReset != NULL);
+ if (PegGpioData->SaPegReset == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ ///
+ /// PEG Reset: GPIO 50, Active Low (Mobile PDG)
+ ///
+ PegGpioData->SaPegReset->Value = 50;
+ PegGpioData->SaPegReset->Active = 0;
+ PcieConfig->PegGpioData = PegGpioData;
+ }
+
+ ///
+ /// Enable/Disable RxCEM Loop back
+ /// 1=Enable, 0=Disable (default)
+ /// When enabled, Lane for loop back should be selected (0 ~ 15 and default is Lane 0)
+ ///
+ PcieConfig->RxCEMLoopback = 0;
+ PcieConfig->RxCEMLoopbackLane = 0;
+
+ ///
+ /// Gen3 RxCTLE peaking default is 8
+ ///
+ for (Index = 0; Index < SA_PEG_MAX_BUNDLE; Index++) {
+ PcieConfig->Gen3RxCtleP[Index] = 8;
+ }
+
+ ///
+ /// Initialize the SA PEG Data pointer for saved preset search results
+ ///
+ PcieConfig->PegDataPtr = NULL;
+
+ SaPlatformPolicyPpi->PcieConfig = PcieConfig;
+
+ ///
+ /// Initialize the Overclocking Configuration
+ ///
+ OcConfig->GtVoltageOffset = 0;
+ OcConfig->GtVoltageOverride = 0;
+ OcConfig->GtExtraTurboVoltage = 0;
+ OcConfig->GtMaxOcTurboRatio = 0;
+ OcConfig->SaVoltageOffset = 0;
+ OcConfig->GtVoltageMode = 0;
+ OcConfig->OcSupport = 0;
+ OcConfig->IoaVoltageOffset = 0;
+ OcConfig->IodVoltageOffset = 0;
+
+ SaPlatformPolicyPpi->OcConfig = OcConfig;
+
+
+#ifdef SG_SUPPORT
+ ///
+ /// Initialize the Switchable Graphics Configuration
+ ///
+ ///
+ /// Switchable Graphics mode set as MUXLESS (By default)
+ ///
+ PlatformData->SgMode = SgModeMuxless;
+ PlatformData->SgSubSystemId = 0x2112;
+
+ SaPlatformPolicyPpi->PlatformData = PlatformData;
+
+ ///
+ /// Configure below based on the OEM platfrom design
+ /// Switchable Graphics GPIO support - 1=Supported, 0=Not Supported
+ ///
+ SgGpioData->GpioSupport = TRUE;
+
+ if (SgGpioData->GpioSupport) {
+ ///
+ /// Initialzie the GPIO Configuration
+ ///
+ ///
+ /// dGPU PWROK GPIO assigned
+ ///
+ SgGpioData->SgDgpuPwrOK = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuPwrOK != NULL);
+ if (SgGpioData->SgDgpuPwrOK == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuPwrOK->Value = 17;
+ ///
+ /// dGPU PWROK Active High
+ ///
+ SgGpioData->SgDgpuPwrOK->Active = 1;
+
+ ///
+ /// dGPU HLD RST GPIO assigned
+ ///
+ SgGpioData->SgDgpuHoldRst = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuHoldRst != NULL);
+ if (SgGpioData->SgDgpuHoldRst == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuHoldRst->Value = 50;
+ ///
+ /// dGPU HLD RST Active Low
+ ///
+ SgGpioData->SgDgpuHoldRst->Active = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ SgGpioData->SgDgpuHoldRst->Value = 48;
+ }
+
+ ///
+ /// dGPU PWR Enable GPIO assigned
+ ///
+ SgGpioData->SgDgpuPwrEnable = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuPwrEnable != NULL);
+ if (SgGpioData->SgDgpuPwrEnable == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuPwrEnable->Value = 54;
+ ///
+ /// dGPU PWR Enable Active Low
+ ///
+ SgGpioData->SgDgpuPwrEnable->Active = 0;
+
+ if (CpuFamilyId == EnumCpuHswUlt) {
+ SgGpioData->SgDgpuPwrEnable->Value = 84;
+ }
+
+ ///
+ /// dGPU_PRSNT# GPIO assigned
+ ///
+ SgGpioData->SgDgpuPrsnt = (SA_GPIO_INFO *) AllocatePool (sizeof (SA_GPIO_INFO));
+ ASSERT (SgGpioData->SgDgpuPrsnt != NULL);
+ if (SgGpioData->SgDgpuPrsnt == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ SgGpioData->SgDgpuPrsnt->Value = 67;
+ ///
+ /// dGPU_PRSNT# Active Low
+ ///
+ SgGpioData->SgDgpuPrsnt->Active = 0;
+
+ SaPlatformPolicyPpi->SgGpioData = SgGpioData;
+ }
+#endif
+
+ ///
+ /// Initialize the DataPtr for S3 resume
+ ///
+ SaPlatformPolicyPpi->S3DataPtr = NULL;
+
+ UpdatePeiSaPlatformPolicy (PeiServices, SaPlatformPolicyPpi);
+
+ ///
+ /// Install SA Platform Policy PPI
+ ///
+ Status = (**PeiServices).InstallPpi (PeiServices, SaPlatformPolicyPpiDesc);
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs
new file mode 100644
index 0000000..b3b2c70
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.dxs
@@ -0,0 +1,42 @@
+/** @file
+ Dependency expression source 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 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_DEPENDENCY (Variable)
+#endif
+
+
+DEPENDENCY_START
+
+ PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID
+DEPENDENCY_END
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h
new file mode 100644
index 0000000..2cfb8e3
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.h
@@ -0,0 +1,57 @@
+/** @file
+ Header file for the SaPeiPolicyInit PEIM.
+
+@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 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
+**/
+#ifndef _SA_PEI_PLATFORM_POLICY_H_
+#define _SA_PEI_PLATFORM_POLICY_H_
+
+///
+/// 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 "SaAccess.h"
+#include "MrcApi.h"
+#include "CpuRegs.h"
+#include "CpuPlatformLib.h"
+
+#include EFI_PPI_PRODUCER (SaPlatformPolicy)
+#include EFI_GUID_DEFINITION (SaDataHob)
+#endif
+
+#include "SaPlatformPolicyUpdatePeiLib.h"
+
+///
+/// Functions
+///
+/**
+ This PEIM performs SA PEI Platform Policy initialzation.
+
+ @param[in] FfsHeader - Pointer to Firmware File System file header.
+ @param[in] PeiServices - General purpose services available to every PEIM.
+
+ @retval EFI_SUCCESS - The PPI is installed and initialized.
+ @retval EFI ERRORS - The PPI is not successfully installed.
+**/
+EFI_STATUS
+SaPeiPolicyInitEntryPoint (
+ IN EFI_FFS_FILE_HEADER *FfsHeader,
+ IN EFI_PEI_SERVICES **PeiServices
+ )
+;
+#endif
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf
new file mode 100644
index 0000000..175d1ba
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaPolicyInit/Pei/SaPeiPolicyInit.inf
@@ -0,0 +1,95 @@
+## @file
+# Component description file for the SaPeiPolicyInit PEIM.
+#
+#@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 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 = SaPeiPolicyInit
+FILE_GUID = FD236AE7-0791-48c4-B29E-29BDEEE1A822
+COMPONENT_TYPE = PE32_PEIM
+
+[sources.common]
+ SaPeiPolicyInit.h
+ SaPeiPolicyInit.c
+#
+# Edk II Glue Driver Entry Point
+#
+ EdkIIGluePeimEntryPoint.c
+
+
+[includes.common]
+ .
+ ../Common
+ $(EDK_SOURCE)/Foundation/Efi
+ $(EDK_SOURCE)/Foundation/Include
+ $(EDK_SOURCE)/Foundation/Efi/Include
+ $(EDK_SOURCE)/Foundation/Framework/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include
+
+#
+# EDK II Glue Library utilizes some standard headers from EDK
+#
+ $(EFI_SOURCE)
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)
+ $(EDK_SOURCE)/Foundation
+ $(EDK_SOURCE)/Foundation/Framework
+ $(EDK_SOURCE)/Foundation/Include/IndustryStandard
+ $(EDK_SOURCE)/Foundation/Core/Dxe
+ $(EDK_SOURCE)/Foundation/Include/Pei
+ $(EDK_SOURCE)/Foundation/Library/Pei/Include
+ $(EDK_SOURCE)/Foundation/Library/Dxe/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include
+ $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include
+ $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Pcd
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include
+ $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include/MrcRegisters
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include
+ $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library
+ $(PLATFORM_ECP_PACKAGE)/Include
+
+[libraries.common]
+ $(PROJECT_PCH_FAMILY)PpiLib
+ EdkFrameworkPpiLib
+ EdkIIGlueBaseIoLibIntrinsic
+ EdkIIGlueBaseMemoryLib
+ EdkIIGluePeiDebugLibReportStatusCode
+ EdkIIGluePeiReportStatusCodeLib
+ EdkIIGluePeiServicesLib
+ EdkIIGluePeiMemoryAllocationLib
+ EdkIIGlueBasePciExpressLib
+ PeiLib
+ $(PROJECT_SA_FAMILY)PpiLib
+ PlatformPolicyUpdatePeiLib
+ CpuPlatformLib
+
+[nmake.common]
+ IMAGE_ENTRY_POINT = _ModuleEntryPoint
+ DPX_SOURCE = SaPeiPolicyInit.dxs
+#
+# Module Entry Point
+#
+ C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=SaPeiPolicyInitEntryPoint
+ C_FLAGS = $(C_FLAGS) -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__ \
+ -D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \ No newline at end of file
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif
new file mode 100644
index 0000000..ddaedbc
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/SaSampleCode.cif
@@ -0,0 +1,22 @@
+<component>
+ name = "SaSampleCode"
+ category = ModulePart
+ LocalRoot = "ReferenceCode\Chipset\SystemAgent\SampleCode"
+ RefName = "SaSampleCode"
+[files]
+"Include\AcpiBuild.dsc"
+"Protocol\IntelSaSampleCodeProtocolLib.inf"
+"Protocol\PciEnumerationComplete.h"
+"Tools\GenAcpiTable.exe"
+"Include\Cpu.h"
+"SaPolicyInit\Dxe\SaDxePolicyInit.c"
+"SaPolicyInit\Dxe\SaDxePolicyInit.h"
+"SaPolicyInit\Pei\SaPeiPolicyInit.c"
+"SaPolicyInit\Pei\SaPeiPolicyInit.h"
+"SaPolicyInit\Dxe\SaDxePolicyInit.inf"
+"SaPolicyInit\Dxe\SaDxePolicyInit.dxs"
+"SaPolicyInit\Pei\SaPeiPolicyInit.dxs"
+"SaPolicyInit\Pei\SaPeiPolicyInit.inf"
+[parts]
+"IntelSaSampleCodePpiLib"
+<endComponent>
diff --git a/ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exe b/ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exe
new file mode 100644
index 0000000..5aad32c
--- /dev/null
+++ b/ReferenceCode/Chipset/SystemAgent/SampleCode/Tools/GenAcpiTable.exe
Binary files differ